:root {
  --bg: #060b16; --ink: #eef2f8; --soft: #a9b4c6; --dim: #6f7c92;
  --jade: #4ade80; --amber: #fbbf24; --red: #f87171; --sky: #7dd3fc;
  --glass: linear-gradient(155deg, rgba(255,255,255,.10), rgba(255,255,255,.035) 55%, rgba(255,255,255,.05));
  --line: rgba(255,255,255,.11);
  --r: 24px;
  --ease: cubic-bezier(.2,.8,.2,1);
}
* { box-sizing: border-box; margin: 0; }
html { background: var(--bg); }
body { color: var(--ink); font: 14px/1.45 -apple-system, BlinkMacSystemFont, "SF Pro Text", Inter, system-ui, sans-serif; -webkit-font-smoothing: antialiased; min-height: 100vh; overflow-x: hidden; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }

/* background: slow colour light behind the glass */
.field { position: fixed; inset: 0; z-index: -1; overflow: hidden; background: radial-gradient(120% 80% at 50% -10%, #0e1a33 0%, var(--bg) 60%); }
.blob { position: absolute; border-radius: 50%; filter: blur(90px); opacity: .55; animation: drift 38s ease-in-out infinite alternate; }
.b1 { width: 46vw; height: 46vw; left: -8vw; top: 18vh; background: #0f766e; }
.b2 { width: 40vw; height: 40vw; right: -6vw; top: -10vh; background: #3730a3; animation-duration: 46s; }
.b3 { width: 34vw; height: 34vw; left: 38vw; bottom: -18vh; background: #1d4ed8; opacity: .4; animation-duration: 52s; }
@keyframes drift { to { transform: translate(6vw, -4vh) scale(1.12); } }

/* empty start: only the ask bar, in the middle */
.ask { transition: transform .7s var(--ease), border-color .2s, box-shadow .2s; }
body.empty .ask { transform: translateY(calc(50vh - 80px)) scale(1.06); }
body.empty .side .trail { opacity: 0; }

/* three test questions: under the bar at the start, and whenever the empty bar is clicked */
.suggest { position: absolute; left: 0; right: 0; top: calc(100% + 14px); display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; opacity: 0; pointer-events: none; transform: translateY(-4px); transition: opacity .25s, transform .25s; }
.suggest button { font-size: 13px; padding: 8px 14px; border-radius: 999px; background: rgba(255,255,255,.07); border: 1px solid var(--line); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); color: var(--soft); }
.suggest button:hover { color: var(--ink); border-color: rgba(74,222,128,.45); }
body.empty .suggest, .ask:focus-within:has(input:placeholder-shown) .suggest, .suggest:hover { opacity: 1; pointer-events: auto; transform: none; }

/* top bar */
.bar { position: sticky; top: 0; z-index: 20; display: grid; grid-template-columns: 1fr minmax(320px, 680px) 1fr; align-items: center; gap: 20px; padding: 16px 28px 10px; }
.brand { display: flex; align-items: baseline; gap: 10px; }
.mark { font-weight: 700; letter-spacing: -.02em; font-size: 17px; }
.ws { color: var(--soft); font-weight: 500; padding-left: 10px; border-left: 1px solid var(--line); }
.ask { position: relative; display: flex; align-items: center; height: 52px; padding: 0 16px 0 46px; border-radius: 26px; background: rgba(255,255,255,.07);
  backdrop-filter: blur(26px) saturate(170%); -webkit-backdrop-filter: blur(26px) saturate(170%); border: 1px solid var(--line);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.16), 0 12px 40px -12px rgba(0,0,0,.6); transition: border-color .2s, box-shadow .2s; }
.ask:focus-within { border-color: rgba(74,222,128,.45); box-shadow: inset 0 1px 0 rgba(255,255,255,.16), 0 0 0 4px rgba(74,222,128,.10), 0 12px 40px -12px rgba(0,0,0,.6); }
.ask-icon { position: absolute; left: 17px; top: 15px; width: 20px; height: 20px; }
.ask-icon svg { width: 20px; height: 20px; fill: var(--jade); }
.ask input { flex: 1; background: none; border: 0; outline: 0; color: var(--ink); font: inherit; font-size: 15.5px; }
.ask input::placeholder { color: var(--dim); }
kbd { font: 12px Inter, sans-serif; color: var(--dim); border: 1px solid var(--line); border-radius: 6px; padding: 1px 7px; }
.side { display: flex; align-items: center; justify-content: flex-end; gap: 10px; min-width: 0; }
.trail { display: flex; gap: 6px; overflow: hidden; min-width: 0; }
.crumb { font-size: 12px; color: var(--soft); padding: 5px 10px; border-radius: 999px; border: 1px solid transparent; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 130px; flex: none; }
.crumb:hover { border-color: var(--line); color: var(--ink); }
.crumb.cur { color: var(--ink); background: rgba(255,255,255,.07); border-color: var(--line); }
.tplbtn { display: inline-flex; align-items: center; gap: 7px; flex: none; font-size: 13px; font-weight: 500; padding: 8px 13px; border-radius: 999px; background: rgba(255,255,255,.07); border: 1px solid var(--line); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); }
.tplbtn svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.langbtn { flex: none; min-width: 38px; height: 34px; padding: 0 10px; border-radius: 999px; font-size: 13px; font-weight: 600; background: rgba(255,255,255,.07); border: 1px solid var(--line); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); }
.langbtn:hover { background: rgba(255,255,255,.12); }
.pnote { font-size: 13.5px; margin-top: 14px; }
:lang(zh-Hant) body { font-family: -apple-system, BlinkMacSystemFont, "PingFang HK", "Noto Sans HK", "Noto Sans CJK TC", Inter, system-ui, sans-serif; }
.tplbtn:hover { background: rgba(255,255,255,.12); }

.understood { display: flex; justify-content: center; gap: 8px; height: 24px; margin: 2px 0 8px; opacity: 0; font-size: 12px; }
.understood.show { animation: chipin .5s var(--ease) forwards; }
.u-k { color: var(--jade); font-weight: 600; letter-spacing: .06em; text-transform: uppercase; font-size: 11px; padding-top: 2px; }
.u-s { color: var(--soft); }
@keyframes chipin { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

/* the canvas: 12 columns x 6 rows filling one screen */
.stage { position: relative; max-width: 1400px; margin: 0 auto; padding: 0 28px 28px; }
#swarm { position: absolute; left: 0; top: 0; pointer-events: none; z-index: 5; }
.canvas { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); grid-auto-rows: max(84px, calc((100vh - 250px) / 6)); gap: 16px; }
.tile > .scroll, .tile > ul { min-height: 0; }
.tile:not(.bare) { overflow-x: hidden; overflow-y: auto; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.15) transparent; }

/* glass panel */
.tile, .glass { position: relative; border-radius: var(--r); background: var(--glass); border: 1px solid var(--line);
  backdrop-filter: blur(30px) saturate(180%); -webkit-backdrop-filter: blur(30px) saturate(180%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.18), inset 0 -1px 0 rgba(255,255,255,.03), 0 24px 60px -28px rgba(0,0,0,.75); }
.tile::before, .glass::before { content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: radial-gradient(120% 60% at 0% 0%, rgba(255,255,255,.10), transparent 50%); }
.tile { padding: 18px 20px; min-width: 0; display: flex; flex-direction: column; overflow: hidden; transition: opacity .2s, filter .2s, transform .2s; }
.tile.bare { background: none; border: 0; box-shadow: none; backdrop-filter: none; -webkit-backdrop-filter: none; padding: 0; overflow: visible; }
.tile.bare::before { display: none; }
.canvas.leaving .tile { opacity: 0; filter: blur(8px); transform: scale(.975); }
.canvas.building .tile { opacity: 0; transition: none; }
.canvas.landed .tile { animation: land .6s var(--ease) both; animation-delay: calc(var(--i) * 70ms); }
@keyframes land { from { opacity: 0; filter: blur(10px); transform: scale(.985); } to { opacity: 1; filter: blur(0); transform: none; } }
[data-ask] { cursor: pointer; }

.th { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.th h2 { font-size: 15px; font-weight: 600; letter-spacing: -.01em; }
.ts { color: var(--dim); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dim { display: block; color: var(--dim); font-size: 12px; }

.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 500; padding: 3px 9px; border-radius: 999px; background: rgba(255,255,255,.07); color: var(--soft); white-space: nowrap; }
.chip.jade { color: var(--jade); background: rgba(74,222,128,.10); }
.chip.amber { color: var(--amber); background: rgba(251,191,36,.12); }
.chip.red { color: var(--red); background: rgba(248,113,113,.13); }
.chip.jade::before, .chip.amber::before, .chip.red::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.logo { flex: none; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 10px; font-size: 11.5px; font-weight: 700; letter-spacing: .02em;
  color: hsl(var(--h) 80% 82%); background: linear-gradient(150deg, hsl(var(--h) 55% 45% / .55), hsl(var(--h) 55% 30% / .35)); border: 1px solid hsl(var(--h) 60% 70% / .25); }
.logo.big { width: 60px; height: 60px; border-radius: 18px; font-size: 19px; }
.btn { font-size: 12.5px; font-weight: 500; padding: 7px 13px; border-radius: 999px; background: rgba(255,255,255,.08); border: 1px solid var(--line); white-space: nowrap; }
.btn:hover { background: rgba(255,255,255,.14); }
.btn.go { background: var(--jade); color: #052e16; border-color: transparent; font-weight: 600; }
.btn.go:hover { background: #6ee7a0; }

/* kpis */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; height: 100%; }
.kpi { padding: 14px 18px; display: flex; flex-direction: column; justify-content: center; min-width: 0; }
.kpi span { color: var(--soft); font-size: 12.5px; }
.kpi b { font-size: 28px; font-weight: 600; letter-spacing: -.03em; line-height: 1.15; margin: 2px 0; }
.kpi em { font-style: normal; color: var(--dim); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi.click:hover { border-color: rgba(251,191,36,.35); }
.kpi.click b { color: var(--amber); }

/* map */
.map { flex: 1; width: 100%; min-height: 0; }
.land circle { fill: rgba(203,213,225,.2); }
.route { fill: none; stroke: rgba(125,211,252,.10); stroke-width: .35; }
.route.on { stroke: rgba(74,222,128,.38); stroke-dasharray: 1.4 1.2; animation: flow 3s linear infinite; }
@keyframes flow { to { stroke-dashoffset: -10; } }
.hub { fill: var(--sky); filter: drop-shadow(0 0 2px var(--sky)); }
.pin circle { fill: var(--jade); }
.pin.low circle { fill: var(--amber); }
.pin.out circle { fill: var(--red); }
.pin .halo { opacity: .18; transform-box: fill-box; transform-origin: center; }
.pin.on .halo { animation: pulse 2.4s ease-out infinite; }
.pin:not(.on) { opacity: .25; }
.pin.focus .halo { opacity: .35; animation: pulse 1.6s ease-out infinite; }
.pin:hover .halo { opacity: .5; }
@keyframes pulse { 0% { transform: scale(.6); opacity: .45; } 100% { transform: scale(2.2); opacity: 0; } }
.lbl { fill: var(--ink); font-size: 5px; font-weight: 600; }

/* tables */
.scroll { flex: 1; min-height: 0; overflow: auto; margin: 0 -8px; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.15) transparent; }
.tbl { width: 100%; border-collapse: collapse; }
.tbl th { position: sticky; top: 0; text-align: left; font-size: 11.5px; font-weight: 500; color: var(--dim); padding: 0 8px 8px; background: transparent; white-space: nowrap; }
.tbl td { white-space: nowrap; padding: 9px 8px; border-top: 1px solid rgba(255,255,255,.06); vertical-align: middle; }
.tbl tr[data-ask]:hover td { background: rgba(255,255,255,.05); }
.tbl tr.on td { background: rgba(74,222,128,.08); }
.tbl .n { text-align: right; font-variant-numeric: tabular-nums; }
.who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.who b { display: block; font-weight: 500; white-space: nowrap; }
.who span { display: block; color: var(--dim); font-size: 12px; }

/* bars (countries, shelf, cover) */
.bars, .shelf { list-style: none; padding: 0; display: grid; gap: 6px; align-content: start; }
.bars li, .shelf li { display: grid; grid-template-columns: 130px 1fr 44px 64px; align-items: center; gap: 12px; padding: 4px 8px; margin: 0 -8px; border-radius: 10px; }
.shelf li { grid-template-columns: 150px 1fr 36px; padding: 7px 8px; }
.bars li:hover, .shelf li:hover { background: rgba(255,255,255,.05); }
.bars li.on { background: rgba(74,222,128,.08); }
.bl { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--soft); }
.bl em { font-style: normal; color: var(--dim); font-size: 12px; }
.bt { position: relative; height: 8px; border-radius: 99px; background: rgba(255,255,255,.06); }
.bt i { position: absolute; inset: 0 auto 0 0; border-radius: inherit; background: linear-gradient(90deg, rgba(74,222,128,.5), var(--jade)); transform-origin: left; }
.canvas.landed .bt i { animation: grow .9s var(--ease) both; animation-delay: calc(var(--i) * 70ms + .15s); }
@keyframes grow { from { transform: scaleX(0); } }
.bt u { position: absolute; top: -4px; bottom: -4px; width: 2px; border-radius: 2px; background: rgba(255,255,255,.55); }
.bars b, .shelf b { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.bars em { font-style: normal; color: var(--dim); font-size: 12px; }
.shelf li.low .bt i, .cover.low .bt i { background: linear-gradient(90deg, rgba(251,191,36,.5), var(--amber)); }
.shelf li.low b { color: var(--amber); }
.shelf li.out b { color: var(--red); }
.cover { display: grid; grid-template-columns: 1fr 64px; align-items: center; gap: 10px; min-width: 140px; }
.cover b { font-weight: 500; font-variant-numeric: tabular-nums; text-align: right; }
.cover.low b { color: var(--amber); }

/* store */
.prof { display: flex; gap: 16px; align-items: center; }
.prof h2 { font-size: 22px; font-weight: 600; letter-spacing: -.02em; line-height: 1.2; }
.prof p { color: var(--soft); margin: 2px 0 8px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.facts { display: grid; gap: 10px; margin-top: auto; padding-top: 16px; }
.facts div { display: flex; justify-content: space-between; gap: 12px; border-top: 1px solid rgba(255,255,255,.06); padding-top: 10px; }
.facts dt { color: var(--dim); }
.facts dd { text-align: right; }
.facts.big { margin-top: 0; padding-top: 0; }
.gist { color: var(--soft); font-size: 14.5px; line-height: 1.55; max-width: 72ch; }
.next { display: flex; align-items: center; gap: 10px; margin-top: auto; padding-top: 12px; text-align: left; font-weight: 500; }
.next span { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--jade); }
.next:hover { color: var(--jade); }
.tile-note { flex-direction: column; }
.chart { flex: 1; width: 100%; min-height: 0; overflow: visible; }
.chart rect { fill: rgba(169,180,198,.28); transform-box: fill-box; transform-origin: bottom; }
.chart .cur rect { fill: var(--jade); }
.canvas.landed .chart rect { animation: rise .8s var(--ease) both; animation-delay: calc(var(--d) + .25s); }
@keyframes rise { from { transform: scaleY(0); } }
.chart text { font-size: 9px; fill: var(--dim); text-anchor: middle; }
.chart text.m { text-anchor: start; }
.chart text.m.end { text-anchor: end; }
.chart text.v { fill: var(--ink); font-weight: 600; }
.tl { list-style: none; padding: 0; display: grid; gap: 0; }
.tl li { position: relative; display: flex; gap: 14px; padding: 0 0 16px 0; }
.tl li::before { content: ""; position: absolute; left: 5px; top: 14px; bottom: 0; width: 1px; background: rgba(255,255,255,.1); }
.tl li:last-child::before { display: none; }
.tl i { flex: none; width: 11px; height: 11px; margin-top: 4px; border-radius: 50%; border: 2px solid var(--dim); }
.tl .k-next i { border-color: var(--jade); box-shadow: 0 0 0 4px rgba(74,222,128,.15); }
.tl .k-done i { border-color: var(--sky); }
.tl .k-pay i { border-color: var(--amber); }
.tl b { display: block; font-weight: 500; }
.tl span { color: var(--dim); font-size: 12px; }

/* inventory */
.acts, .mini { list-style: none; padding: 0; display: grid; gap: 4px; overflow: auto; }
.acts li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 10px; margin: 0 -10px; border-radius: 12px; }
.acts li.hl { background: rgba(251,191,36,.08); }
.acts b { display: block; font-weight: 500; }
.acts span { color: var(--dim); font-size: 12px; }
.mini li { display: flex; align-items: center; gap: 10px; padding: 7px 8px; margin: 0 -8px; border-radius: 12px; }
.mini li:hover { background: rgba(255,255,255,.05); }
.mini li > div { flex: 1; min-width: 0; }
.mini b { display: block; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini span { color: var(--dim); font-size: 12px; }

/* weekly bars */
.vbars { flex: 1; min-height: 0; display: flex; align-items: stretch; gap: 12px; padding-top: 4px; }
.vbars div { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 6px; }
.vbars b { font-size: 12px; font-weight: 500; color: var(--dim); font-variant-numeric: tabular-nums; }
.vbars i { width: 100%; max-width: 56px; border-radius: 10px 10px 4px 4px; background: rgba(169,180,198,.24); transform-origin: bottom; }
.vbars .cur i { background: linear-gradient(180deg, #86efac, var(--jade)); }
.vbars .cur b { color: var(--ink); font-weight: 600; }
.canvas.landed .vbars i { animation: rise .8s var(--ease) both; animation-delay: calc(var(--d) + .25s); }
.axis { display: flex; justify-content: space-between; color: var(--dim); font-size: 12px; margin-top: 8px; }

/* product */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 22px 0; }
.stats div { padding: 12px 14px; border-radius: 16px; background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.06); }
.stats span { display: block; color: var(--dim); font-size: 12px; }
.stats b { font-size: 22px; font-weight: 600; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stats b.low { color: var(--amber); }
.sub { font-size: 13px; font-weight: 600; color: var(--soft); margin-bottom: 6px; }
.mini b.n { font-variant-numeric: tabular-nums; }

/* help */
.tries { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0; }
.try { font-size: 13px; padding: 8px 14px; border-radius: 999px; background: rgba(255,255,255,.07); border: 1px solid var(--line); }
.try:hover { border-color: rgba(74,222,128,.45); color: var(--jade); }
.small { color: var(--dim); font-size: 12px; }

.toast { position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; z-index: 30; padding: 11px 18px; border-radius: 999px; font-size: 13px;
  background: rgba(20,28,44,.75); border: 1px solid var(--line); backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px); transition: .3s var(--ease); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 1100px) {
  .bar { grid-template-columns: auto 1fr auto; }
  .trail { display: none; }
}
@media (max-width: 900px) {
  .bar { grid-template-columns: 1fr auto; padding: 12px 16px 8px; gap: 10px; }
  .ask { grid-column: 1 / -1; grid-row: 2; }
  .stage { padding: 0 16px 24px; }
  .canvas { grid-template-columns: minmax(0, 1fr); grid-auto-rows: auto; gap: 12px; }
  .tile { grid-column: 1 / -1 !important; grid-row: auto !important; }
  .tile-map { min-height: 220px; }
  .tile-sales { min-height: 220px; }
  .scroll { max-height: 60vh; }
  .kpis, .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  body.empty .ask { transform: translateY(calc(42vh - 80px)); }
  .bars li { grid-template-columns: 100px 1fr 36px; }
  .bars em { display: none; }
  .shelf li { grid-template-columns: 120px 1fr 32px; }
  kbd { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
