:root {
  --font-display: 'Cabinet Grotesk', 'Satoshi', system-ui, sans-serif;
  --font-body: 'Satoshi', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;
  --bg: #08142a;
  --ink: #0f1d33;
  --ink-2: #44516a;
  --ink-3: #7a869b;
  --paper: #f6f7f9;
  --paper-2: #ffffff;
  --line: #e1e5eb;
  --red: #C8102E;
  --blue: #0A5BB5;
  --lblue: #3E9FDB;
  --navy: #13294b;
  --panel-w: 420px;
  --rail-w: 272px;
  --r: 10px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--ink); font-family: var(--font-body); -webkit-font-smoothing: antialiased; }
button { font: inherit; color: inherit; cursor: pointer; }
#app { position: fixed; inset: 0; }
#stage { position: absolute; inset: 0; left: var(--rail-w); right: var(--panel-w); }
#stage canvas { display: block; outline: none; }
.labels { position: absolute; inset: 0; left: var(--rail-w); right: var(--panel-w); pointer-events: none; overflow: hidden; z-index: 1; }
.topbar, .filter, .hint { z-index: 3; }
.labels > div { pointer-events: none; }

/* ---------- top bar ---------- */
.topbar { position: absolute; top: 0; left: var(--rail-w); right: var(--panel-w); display: flex; align-items: center; gap: 22px; padding: 18px 24px; pointer-events: none; background: linear-gradient(180deg, rgba(8,20,42,.85), rgba(8,20,42,0)); }
.brand { pointer-events: auto; background: none; border: 0; padding: 0; text-align: left; display: flex; flex-direction: column; color: #fff; }
.brand-kicker { font-family: var(--font-mono); font-size: 11px; letter-spacing: .18em; text-transform: uppercase; color: #9fb4d3; }
.brand-title { font-family: var(--font-display); font-weight: 800; font-size: 26px; line-height: 1.05; letter-spacing: -.01em; }
.crumbs { pointer-events: auto; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 14px; color: #c8d4e6; padding-left: 20px; border-left: 1px solid rgba(255,255,255,.18); min-height: 34px; }
.crumbs button { background: none; border: 0; padding: 4px 6px; border-radius: 6px; color: #c8d4e6; }
.crumbs button:hover { background: rgba(255,255,255,.08); color: #fff; }
.crumbs .sep { color: #5f7393; }
.crumbs .cur { color: #fff; font-weight: 700; padding: 4px 6px; }

/* ---------- company filter ---------- */
.filter { position: absolute; left: calc(var(--rail-w) + 24px); bottom: 22px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; padding: 6px; background: rgba(10,24,48,.72); backdrop-filter: blur(10px); border: 1px solid rgba(255,255,255,.1); border-radius: 999px; max-width: calc(100vw - var(--panel-w) - var(--rail-w) - 48px); }
.filter-label { font-family: var(--font-mono); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: #8fa3c2; padding: 0 8px 0 10px; }
.chip { display: inline-flex; align-items: center; gap: 7px; border: 1px solid transparent; background: transparent; color: #d7e0ee; padding: 7px 13px; border-radius: 999px; font-size: 14px; font-weight: 500; transition: background .18s var(--ease), color .18s; }
.chip i { width: 9px; height: 9px; border-radius: 50%; background: var(--c); box-shadow: 0 0 0 2px rgba(255,255,255,.15); }
.chip:hover { background: rgba(255,255,255,.08); }
.chip.is-on { background: #fff; color: var(--ink); font-weight: 700; }
.chip:focus-visible, .brand:focus-visible, .crumbs button:focus-visible { outline: 2px solid var(--lblue); outline-offset: 2px; }

.hint { position: absolute; left: 50%; transform: translateX(calc(-50% + (var(--rail-w) - var(--panel-w)) / 2)); top: 84px; font-size: 13px; color: #a9bad3; background: rgba(10,24,48,.6); padding: 7px 14px; border-radius: 999px; pointer-events: none; transition: opacity .6s; white-space: nowrap; }
.hint.hide { opacity: 0; }

/* ---------- globe pins / market hotspots (CSS2D) ---------- */
.hq-label { transform: translateY(14px); font-family: var(--font-mono); font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: #e9eef6; background: rgba(8,20,42,.75); padding: 3px 7px; border-radius: 4px; white-space: nowrap; border-left: 3px solid var(--c); }
.hq-label.is-hidden { opacity: 0; }

.hs { pointer-events: auto !important; position: relative; display: inline-flex; align-items: center; gap: 8px; background: rgba(15,29,51,.92); color: #fff; border: 1px solid rgba(255,255,255,.22); border-radius: 999px; padding: 4px 12px 4px 4px; font-size: 13px; font-weight: 700; white-space: nowrap; box-shadow: 0 8px 22px rgba(0,0,0,.35); transition: background .18s, opacity .2s; }
.hs::before { content: ''; position: absolute; left: 4px; top: 4px; width: 24px; height: 24px; border-radius: 50%; box-shadow: 0 0 0 0 rgba(255,255,255,.6); animation: pulse 2.2s infinite; }
.hs .n { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: #fff; color: var(--ink); font-family: var(--font-mono); font-size: 12px; }
.hs .dots { display: inline-flex; gap: 3px; margin-left: 2px; }
.hs .dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--c); }
.hs:hover, .hs.is-sel, .hs.is-hot { background: var(--red); border-color: var(--red); }
.hs.is-dim { opacity: .28; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(255,255,255,.55); } 70% { box-shadow: 0 0 0 12px rgba(255,255,255,0); } 100% { box-shadow: 0 0 0 0 rgba(255,255,255,0); } }

/* ---------- globe callouts ---------- */
.callouts { position: absolute; inset: 0; left: var(--rail-w); right: var(--panel-w); pointer-events: none; overflow: hidden; z-index: 2; transition: opacity .35s; }
.callouts.is-out { opacity: 0; }
.callouts svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.co-line { fill: none; stroke: rgba(196,222,255,.5); stroke-width: 1.1; transition: stroke .15s, opacity .2s; }
.co-line.is-hot { stroke: #fff; stroke-width: 2; }
.co-dot { fill: #e8f1ff; transition: opacity .2s; }
.co-dot.is-hot { fill: #ff6b81; r: 4; }
.co-line.is-dim, .co-dot.is-dim { opacity: .2; }
.callout { position: absolute; left: 0; top: 0; pointer-events: auto; display: inline-flex; align-items: center; gap: 7px; height: 26px; padding: 0 11px 0 3px; background: rgba(8,20,42,.86); color: #eef4fc; border: 1px solid rgba(255,255,255,.2); border-radius: 999px; font-size: 12.5px; font-weight: 700; white-space: nowrap; backdrop-filter: blur(6px); will-change: transform; transition: background .15s, border-color .15s, opacity .2s; }
.callout b { display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: #fff; color: var(--navy); font-family: var(--font-mono); font-size: 9.5px; font-weight: 600; letter-spacing: -.02em; }
.callout:hover, .callout.is-hot { background: var(--red); border-color: #ff8a9a; color: #fff; z-index: 2; }
.callout:focus-visible { outline: 2px solid var(--lblue); outline-offset: 2px; }
.callout.is-hidden { visibility: hidden; pointer-events: none; }
.callout.is-dim { opacity: .3; }
.callout.is-badge { padding: 0 3px; gap: 0; }
.callout.is-badge .t { display: none; }
.callout.is-badge.is-hot .t { display: inline; margin: 0 8px 0 6px; }

/* ---------- market rail ---------- */
.rail { position: absolute; left: 0; top: 0; bottom: 0; width: 272px; background: #0a1730; color: #dbe5f3; border-right: 1px solid rgba(255,255,255,.08); display: flex; flex-direction: column; z-index: 6; }
.rail-head { display: flex; align-items: flex-end; justify-content: space-between; padding: 22px 18px 12px; }
.rail-k { margin: 0; font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .18em; text-transform: uppercase; color: #8fa3c2; }
.rail-t { margin: 2px 0 0; font-family: var(--font-display); font-weight: 800; font-size: 24px; color: #fff; line-height: 1; }
.rail-close { display: none; background: rgba(255,255,255,.08); border: 0; border-radius: 8px; width: 34px; height: 34px; place-items: center; color: #dbe5f3; }
.rail-search { margin: 0 14px 10px; display: flex; align-items: center; gap: 8px; background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.1); border-radius: 9px; padding: 0 10px; color: #8fa3c2; }
.rail-search:focus-within { border-color: var(--lblue); }
.rail-search input { flex: 1; min-width: 0; background: transparent; border: 0; outline: 0; color: #fff; font: inherit; font-size: 13.5px; padding: 9px 0; }
.rail-search input::placeholder { color: #7f93b3; }
.rail-list { flex: 1; overflow-y: auto; padding: 2px 8px 24px; scrollbar-width: thin; scrollbar-color: #2a3e62 transparent; }
.grp { margin-bottom: 4px; border-radius: 10px; transition: background .4s; }
.grp.is-flash { background: rgba(62,159,219,.16); }
.grp-h { width: 100%; display: flex; align-items: center; gap: 8px; background: none; border: 0; padding: 10px 10px 6px; font-family: var(--font-mono); font-size: 10.5px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: #8fa3c2; text-align: left; }
.grp-h span { flex: 1; }
.grp-h em { font-style: normal; color: #5f7393; }
.grp-h .cv { transition: transform .2s var(--ease); }
.grp.is-collapsed .grp-h .cv { transform: rotate(-90deg); }
.grp.is-collapsed .grp-b { display: none; }
.grp-h:hover { color: #fff; }
.mk { width: 100%; display: flex; align-items: center; gap: 10px; background: none; border: 0; border-radius: 8px; padding: 7px 10px; text-align: left; color: #dbe5f3; font-size: 14px; font-weight: 500; transition: background .15s, color .15s; }
.mk b { flex: none; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 7px; background: rgba(255,255,255,.08); color: #c8d6ea; font-family: var(--font-mono); font-size: 10.5px; font-weight: 600; }
.mk .t { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mk .dots { display: flex; gap: 3px; }
.mk .dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--c); }
.mk:hover, .mk.is-hot { background: rgba(255,255,255,.08); color: #fff; }
.mk.is-cur { background: #fff; color: var(--ink); font-weight: 700; }
.mk.is-cur b { background: var(--red); color: #fff; }
.mk.is-dim { opacity: .38; }
.mk:focus-visible, .grp-h:focus-visible { outline: 2px solid var(--lblue); outline-offset: -2px; }
.rail-empty { color: #8fa3c2; font-size: 13px; padding: 10px; }
.rail-btn { display: none; pointer-events: auto; align-items: center; gap: 8px; background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.16); color: #fff; border-radius: 9px; padding: 8px 12px; font-size: 14px; font-weight: 700; }
.rail-btn:hover { background: rgba(255,255,255,.16); }
.scrim { display: none; }
.browse { display: none; width: 100%; align-items: center; justify-content: space-between; background: var(--navy); color: #fff; border: 0; border-radius: var(--r); padding: 13px 16px; font-weight: 700; font-size: 15px; margin-top: 4px; }
.browse:hover { background: var(--red); }
.cats { display: grid; gap: 6px; }
.cat { text-align: left; background: var(--paper-2); border: 1px solid var(--line); border-radius: var(--r); padding: 10px 12px; transition: border-color .15s; }
.cat:hover { border-color: var(--navy); }
.cat strong { display: block; font-size: 14px; }
.cat span { display: block; font-size: 12.5px; color: var(--ink-3); line-height: 1.45; margin-top: 2px; }

@media (max-width: 1439px) {
  :root { --rail-w: 0px; }
  .rail { width: min(300px, 86vw); transform: translateX(-102%); transition: transform .32s var(--ease); z-index: 40; box-shadow: 18px 0 40px rgba(0,0,0,.4); }
  body.rail-open .rail { transform: none; }
  .rail-close { display: grid; }
  .rail-btn { display: inline-flex; }
  .scrim { display: block; position: absolute; inset: 0; background: rgba(4,10,22,.5); z-index: 39; opacity: 0; pointer-events: none; transition: opacity .3s; }
  body.rail-open .scrim { opacity: 1; pointer-events: auto; }
  .browse { display: flex; }
}

/* ---------- panel ---------- */
.panel { position: absolute; top: 0; right: 0; bottom: 0; width: var(--panel-w); background: var(--paper); border-left: 1px solid #0b1a33; display: flex; flex-direction: column; z-index: 5; }
.panel-grip { display: none; }
.panel-body { flex: 1; overflow-y: auto; padding: 26px 26px 40px; scroll-behavior: smooth; }
.panel-body::-webkit-scrollbar { width: 8px; } .panel-body::-webkit-scrollbar-thumb { background: #cfd5de; border-radius: 8px; }
.eyebrow { font-family: var(--font-mono); font-size: 11px; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; color: var(--red); margin: 0 0 8px; }
.h1 { font-family: var(--font-display); font-weight: 800; font-size: 32px; line-height: 1.05; letter-spacing: -.015em; margin: 0 0 10px; color: var(--ink); }
.h2 { font-family: var(--font-body); font-weight: 700; font-size: 18px; margin: 0; }
.lede { font-size: 15px; line-height: 1.55; color: var(--ink-2); margin: 0 0 20px; }
.sec { margin-top: 26px; }
.sec-t { font-family: var(--font-mono); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3); margin: 0 0 10px; display: flex; justify-content: space-between; }
.back { display: inline-flex; align-items: center; gap: 6px; background: none; border: 0; padding: 6px 0; margin: -6px 0 12px; font-size: 14px; font-weight: 500; color: var(--ink-2); }
.back:hover { color: var(--red); }
.back svg { width: 16px; height: 16px; }

.cos { display: grid; gap: 10px; }
.co { display: grid; grid-template-columns: 120px 1fr; gap: 14px; align-items: center; background: var(--paper-2); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; text-decoration: none; color: inherit; transition: border-color .18s, transform .18s var(--ease); }
.co:hover { border-color: #b8c2d0; transform: translateY(-1px); }
.co img { width: 120px; height: 58px; object-fit: contain; }
.co strong { display: block; font-size: 15px; }
.co span { display: block; font-size: 13px; color: var(--ink-2); line-height: 1.4; margin-top: 2px; }
.co em { font-style: normal; font-family: var(--font-mono); font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--c); font-weight: 600; }

.list { display: grid; grid-template-columns: minmax(0,1fr); gap: 6px; }
.row { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; background: var(--paper-2); border: 1px solid var(--line); border-radius: var(--r); padding: 11px 12px; transition: border-color .15s, background .15s, transform .15s var(--ease); }
.row:hover, .row.is-hot { border-color: var(--navy); transform: translateX(2px); }
.row:focus-visible { outline: 2px solid var(--blue); outline-offset: 1px; }
.row .ic { flex: none; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; background: var(--navy); color: #fff; font-family: var(--font-mono); font-size: 13px; font-weight: 600; }
.row .tx { flex: 1; min-width: 0; }
.row .tx strong { display: block; font-size: 15px; font-weight: 700; }
.row .tx span { display: block; font-size: 13px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .dots { display: flex; gap: 4px; }
.row .dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--c); }
.row .chev { color: #a0aabb; }
.row.is-dim { opacity: .4; }

.app { background: var(--paper-2); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; margin-bottom: 12px; }
.app h3 { font-size: 16px; margin: 0 0 4px; }
.app p { font-size: 13.5px; color: var(--ink-2); margin: 0 0 12px; line-height: 1.5; }
.group-t { display: flex; align-items: center; gap: 8px; font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); margin: 12px 0 6px; }
.group-t i { width: 8px; height: 8px; border-radius: 50%; background: var(--c); }
.prods { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.prod { display: flex; flex-direction: column; text-align: left; background: #fff; border: 1px solid var(--line); border-top: 3px solid var(--c); border-radius: 8px; overflow: hidden; padding: 0; transition: transform .15s var(--ease), box-shadow .15s; }
.prod:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(15,29,51,.12); }
.prod .im { height: 78px; background: #f1f3f6; display: grid; place-items: center; overflow: hidden; }
.prod .im img { width: 100%; height: 100%; object-fit: cover; }
.prod .im img.contain { object-fit: contain; padding: 6px; }
.prod .nm { font-size: 13px; font-weight: 700; padding: 8px 9px 9px; line-height: 1.25; }
.prod.is-dim { opacity: .35; }

.pd-img { width: 100%; aspect-ratio: 16/10; background: #fff; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; position: relative; display: grid; place-items: center; }
.pd-img img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.pd-img img.contain { object-fit: contain; padding: 18px; }
.pd-co { display: flex; align-items: center; gap: 12px; margin: 16px 0 6px; }
.pd-co img { height: 34px; width: auto; max-width: 120px; object-fit: contain; }
.pd-co span { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--c); font-weight: 600; }
.specs { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.specs li { font-size: 14px; padding: 9px 12px; background: #fff; border: 1px solid var(--line); border-left: 3px solid var(--c); border-radius: 6px; }
.used { display: grid; gap: 6px; }
.used button { text-align: left; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 9px 12px; font-size: 13.5px; }
.used button:hover { border-color: var(--navy); }
.used small { display: block; color: var(--ink-3); font-size: 12px; }
.cta { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 22px; background: var(--navy); color: #fff; text-decoration: none; padding: 14px 16px; border-radius: var(--r); font-weight: 700; font-size: 15px; transition: background .18s; }
.cta:hover { background: var(--red); }
.note { font-size: 12px; color: var(--ink-3); line-height: 1.5; margin-top: 18px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 4px 0 6px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 10px; }
.stat b { display: block; font-family: var(--font-display); font-size: 24px; font-weight: 800; font-variant-numeric: tabular-nums; }
.stat span { font-size: 12px; color: var(--ink-3); }

/* ---------- overlays ---------- */
.fade { position: absolute; inset: 0; left: var(--rail-w); right: var(--panel-w); background: var(--bg); opacity: 0; pointer-events: none; transition: opacity .45s ease; }
.fade.on { opacity: 1; }
.loader { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 14px; background: var(--bg); color: #a9bad3; z-index: 20; transition: opacity .6s; font-size: 14px; }
.loader.done { opacity: 0; pointer-events: none; }
.loader-ring { width: 38px; height: 38px; border-radius: 50%; border: 3px solid rgba(255,255,255,.15); border-top-color: var(--red); animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) { .hs::before { animation: none; } * { scroll-behavior: auto !important; } }

/* ---------- mobile ---------- */
@media (max-width: 860px) {
  :root { --panel-w: 0px; }
  #stage, .labels, .fade, .topbar, .callouts { right: 0; }
  #stage { bottom: 38vh; }
  .labels, .callouts { bottom: 38vh; }
  .rail-btn { padding: 6px 10px; font-size: 13px; }
  .topbar { padding: 12px 14px; gap: 12px; flex-wrap: wrap; }
  .brand-title { font-size: 20px; }
  .crumbs { font-size: 13px; padding-left: 10px; }
  .filter { left: 10px; right: 10px; bottom: calc(38vh + 10px); max-width: none; border-radius: 999px; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; gap: 2px; padding: 4px; }
  .filter::-webkit-scrollbar { display: none; }
  .filter-label { display: none; }
  .chip { padding: 6px 9px; font-size: 12.5px; gap: 5px; flex: none; }
  .hint { display: none; }
  .panel { top: auto; left: 0; width: 100%; height: 38vh; border-left: 0; border-top: 1px solid #0b1a33; border-radius: 16px 16px 0 0; transition: height .35s var(--ease); }
  .panel.is-open { height: 78vh; }
  .panel-grip { display: grid; place-items: center; height: 22px; border: 0; background: transparent; flex: none; }
  .panel-grip span { width: 44px; height: 5px; border-radius: 3px; background: #c4cbd6; }
  .panel-body { padding: 4px 18px 30px; }
  .h1 { font-size: 26px; }
  .co { grid-template-columns: 90px 1fr; } .co img { width: 90px; height: 44px; }
}
