/* GMG TERMINAL · 2026 — cockpit base */
@import url('./tokens.css');

/* ---------- reset + base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-sans);
  background: #050505;
  color: rgba(255,255,255,0.86);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: 'kern' 1, 'palt' 1, 'ss01' 1, 'ss02' 1;
  font-optical-sizing: auto;
  overflow: hidden;
  height: 100vh;
  height: 100dvh;
}
html[lang^='zh'] body { font-feature-settings: 'kern' 1, 'palt' 1, 'ss01' 1; letter-spacing: 0.005em; }
/* CJK font stack — system fonts only (no web font load).
 * Latin glyphs still come from --font-sans (Plex Sans / Inter); CJK glyphs
 * fall through to the first installed face by OS:
 *   macOS / iOS    → PingFang SC (default Apple Chinese)
 *   Windows        → Microsoft YaHei (default Windows Chinese)
 *   Linux / Android → Noto Sans CJK SC (Google open Chinese)
 * This is a fallback APPEND, not a replacement — the existing font-family
 * still wins for ASCII characters. */
html[lang^='zh'] body,
html[lang^='zh'] button,
html[lang^='zh'] input,
html[lang^='zh'] select,
html[lang^='zh'] textarea {
  font-family:
    var(--font-sans),
    'PingFang SC',
    'Hiragino Sans GB',
    'Microsoft YaHei',
    'Noto Sans CJK SC',
    'Source Han Sans CN',
    sans-serif;
}
.mono, .panel__title, .panel__sub, .eyebrow, .eyebrow-dim,
[class*="__price"], [class*="__chg"], [class*="__val"], [class*="__lbl"],
[class*="__px"], [class*="__pct"], [class*="__ratio"], [class*="__cap"], [class*="__vol"] {
  font-feature-settings: 'tnum' 1, 'zero' 1, 'ss01' 1;
}
html[lang^='zh'] .row__body,
html[lang^='zh'] .brief__b,
html[lang^='zh'] .pm-row__q,
html[lang^='zh'] .msg__body { line-height: 1.55; letter-spacing: 0.01em; }

/* ---------- terminal-wide variables ---------- */
:root {
  --bg-0: #050505;
  --bg-1: #0a0907;
  --bg-2: #0f0d09;
  --bg-3: #14110b;
  --panel: rgba(20, 17, 11, 0.6);
  --panel-strong: rgba(28, 23, 16, 0.78);
  --hairline: rgba(201,168,106,0.10);
  --hairline-2: rgba(201,168,106,0.18);
  --hairline-3: rgba(201,168,106,0.32);
  --hairline-4: rgba(255,255,255,0.06);
  --txt-1: rgba(255,255,255,0.92);
  --txt-2: rgba(255,255,255,0.62);
  --txt-3: rgba(255,255,255,0.40);
  --txt-4: rgba(255,255,255,0.22);
  --up:    #34D399;
  --up-bg: rgba(52,211,153,0.10);
  --dn:    #F87171;
  --dn-bg: rgba(248,113,113,0.10);
  --warn:  #FBBF24;
  --info:  #93C5FD;
  --grid-gap: 12px;
}

/* ---------- scanlines + CRT layer (very subtle) ---------- */
body::before {
  content: "";
  position: fixed; inset: 0;
  pointer-events: none;
  background:
    repeating-linear-gradient(
      0deg,
      rgba(255,255,255,0.014) 0 1px,
      transparent 1px 3px
    );
  z-index: 200;
  mix-blend-mode: overlay;
}
body::after {
  content: "";
  position: fixed; inset: -20%;
  pointer-events: none;
  background:
    radial-gradient(80% 60% at 20% 0%, rgba(201,168,106,0.07) 0%, transparent 70%),
    radial-gradient(70% 50% at 100% 100%, rgba(230,201,136,0.05) 0%, transparent 70%);
  z-index: 0;
}

/* ---------- typography helpers ---------- */
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.serif { font-family: var(--font-serif-display); }
.eyebrow {
  font-family: var(--font-sans);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: rgba(201,168,106,0.78);
}
.eyebrow-dim { color: rgba(255,255,255,0.32); letter-spacing: 0.28em; text-transform: uppercase; font-size: 10px; font-weight: 700; }
.up { color: var(--up); }
.dn { color: var(--dn); }
.flat { color: var(--txt-3); }

/* ---------- language toggle ---------- */
.lang-toggle { display: inline-flex; gap: 0; border: 1px solid var(--hairline-2); border-radius: 4px; overflow: hidden; }
.lang-toggle__btn {
  font-family: var(--font-mono);
  font-size: 10px; font-weight: 600; letter-spacing: 0.08em;
  background: transparent; color: var(--txt-3);
  border: 0; padding: 4px 8px; cursor: pointer;
  border-right: 1px solid var(--hairline-2);
}
.lang-toggle__btn:last-child { border-right: 0; }
.lang-toggle__btn:hover { color: var(--txt-1); }
.lang-toggle__btn.is-active { background: rgba(201,168,106,0.16); color: var(--gold); }

/* ---------- terminal frame ---------- */
.term {
  position: relative;
  z-index: 1;
  height: 100vh;
  height: 100dvh;
  display: grid;
  grid-template-rows: 56px 34px 1fr 52px;
  overflow: hidden;
}

/* ---------- top bar ---------- */
.topbar {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 16px;
  padding: 0 16px;
  background: linear-gradient(180deg, rgba(20,17,11,0.92), rgba(10,9,7,0.92));
  border-bottom: 1px solid var(--hairline);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  /* v34.2 fix: lift topbar above .term sibling rows so popovers
   * (System tray, Lang switcher) anchored inside .topbar can render over
   * the ticker / main / cmdline. backdrop-filter already creates a
   * stacking context AND a containing block for fixed descendants, so
   * popovers are contained by topbar's box. Without explicit z-index
   * topbar stacks at auto inside .term — DOM-later siblings paint on top.
   * overflow: visible required so the popovers (which extend below topbar's
   * 56px row) aren't clipped. */
  position: relative;
  z-index: 100;
  overflow: visible;
}
.topbar__brand {
  display: flex; align-items: center; gap: 10px;
  white-space: nowrap;
}
.topbar__logo {
  height: 26px;
  width: auto;
  display: block;
  filter:
    brightness(1.35)
    saturate(1.15)
    drop-shadow(0 0 6px rgba(255,231,166,0.55))
    drop-shadow(0 0 14px rgba(201,168,106,0.35));
}
.topbar__sep { color: rgba(201,168,106,0.4); font-size: 14px; }
.topbar__product {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.22em;
  color: var(--gold-bright);
  text-transform: uppercase;
}
.topbar__brand .ver {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  color: rgba(201,168,106,0.5);
  margin-left: 2px;
}

.topbar__nav { display: flex; gap: 2px; justify-self: center; align-items: center; flex-wrap: nowrap; overflow: hidden; }
.chip {
  position: relative;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--txt-2);
  padding: 8px 12px;
  border: 1px solid transparent;
  border-radius: 6px;
  cursor: pointer;
  background: transparent;
  transition: all 180ms var(--ease-out);
  display: flex; align-items: center; gap: 6px;
}
.chip .num {
  font-size: 9px;
  color: rgba(201,168,106,0.5);
  border: 1px solid rgba(201,168,106,0.2);
  border-radius: 3px;
  padding: 1px 4px;
  line-height: 1;
}
.chip:hover { color: var(--gold-bright); border-color: rgba(201,168,106,0.2); background: rgba(201,168,106,0.04); }
.chip.is-active {
  color: var(--gold-bright);
  background: rgba(201,168,106,0.08);
  border-color: rgba(201,168,106,0.32);
  box-shadow: inset 0 0 0 1px rgba(230,201,136,0.06);
}
.chip.is-active::after {
  content: ""; position: absolute; left: 12px; right: 12px; bottom: -1px; height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
}
.chip.is-soon { opacity: 0.45; }
.chip.is-soon .num { color: rgba(255,255,255,0.25); border-color: rgba(255,255,255,0.08); }

.topbar__right { display: flex; align-items: center; gap: 14px; font-family: var(--font-mono); font-size: 11px; white-space: nowrap; }
.topbar__clock { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.1; }
.topbar__clock .time { color: var(--gold-bright); letter-spacing: 0.08em; font-size: 13px; font-weight: 600; }
.topbar__clock .sub { color: var(--txt-3); font-size: 9px; letter-spacing: 0.18em; margin-top: 2px; }
.live-dot {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--up);
  font-size: 10px;
  letter-spacing: 0.22em;
}
.live-dot .pulse {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--up);
  position: relative;
  box-shadow: 0 0 8px rgba(52,211,153,0.6);
}
.live-dot .pulse::after {
  content: "";
  position: absolute; inset: -3px; border-radius: 50%;
  border: 1px solid var(--up);
  animation: pulse-ring 1.8s var(--ease-pulse) infinite;
}
@keyframes pulse-ring {
  0% { transform: scale(0.6); opacity: 1; }
  100% { transform: scale(2.2); opacity: 0; }
}
/* WS-state truth — the LIVE pulse colors what's actually happening:
 *  body[data-ws-state="live"]  → green + ring (default, no override)
 *  body[data-ws-state="stale"] → gold static pip, ring suppressed (WS silent >10s)
 *  body[data-ws-state="down"]  → red static pip, ring suppressed (WS disconnected)
 * Doctrine §3 only uses gold + up/dn red/green — same palette, no new colors.
 */
body[data-ws-state="stale"] .live-dot              { color: var(--gold); }
body[data-ws-state="stale"] .live-dot .pulse       { background: var(--gold); box-shadow: 0 0 6px rgba(201,168,106,0.55); }
body[data-ws-state="stale"] .live-dot .pulse::after,
body[data-ws-state="stale"] .dot--live::after      { animation: none; opacity: 0; }
body[data-ws-state="stale"] .dot--live             { background: var(--gold); box-shadow: 0 0 4px rgba(201,168,106,0.55); }

body[data-ws-state="down"] .live-dot               { color: var(--dn); }
body[data-ws-state="down"] .live-dot .pulse        { background: var(--dn); box-shadow: 0 0 6px rgba(248,113,113,0.55); }
body[data-ws-state="down"] .live-dot .pulse::after,
body[data-ws-state="down"] .dot--live::after       { animation: none; opacity: 0; }
body[data-ws-state="down"] .dot--live              { background: var(--dn); box-shadow: 0 0 4px rgba(248,113,113,0.55); }

/* ── SourceLink — every cell that wraps in <SourceLink href> gets a subtle
 * gold underline (0.4 alpha) + a tiny ↗ glyph at the top-right that brightens
 * on hover. Click opens the source in a new tab. Inherits text color so it
 * doesn't override .up/.dn semantic coloring on numeric cells.
 * Doctrine: gold only; no new palette.
 * ──────────────────────────────────────────────────────────────────────── */
.source-link {
  position: relative;
  display: inline-block;
  color: inherit;
  text-decoration: none;
  cursor: pointer;
  border-bottom: 1px dashed rgba(201,168,106,0.20);
  transition: border-color 120ms ease;
}
.source-link:hover, .source-link:focus-visible {
  border-bottom-color: rgba(201,168,106,0.65);
  outline: none;
}
.source-link__arrow {
  display: inline-block;
  margin-left: 3px;
  color: rgba(201,168,106,0.55);
  font-size: 0.7em;
  font-family: var(--font-mono);
  transition: color 120ms ease, transform 120ms ease;
  vertical-align: super;
}
.source-link:hover .source-link__arrow,
.source-link:focus-visible .source-link__arrow {
  color: var(--gold-bright);
  transform: translate(1px, -1px);
}
/* When SourceLink wraps a whole panel card (movers/predict), suppress the underline
 * and only show the ↗ in the top-right corner. */
.movers2__card.source-link,
.pred2__card.source-link {
  border-bottom: none;
}
.movers2__card.source-link .source-link__arrow,
.pred2__card.source-link .source-link__arrow {
  position: absolute;
  top: 6px;
  right: 8px;
  margin-left: 0;
  vertical-align: baseline;
}
@media (prefers-reduced-motion: reduce) {
  .source-link, .source-link__arrow { transition: none !important; }
}

.session-pill {
  display: inline-flex; gap: 8px; align-items: center;
  padding: 4px 10px;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 999px;
  color: var(--txt-2);
  font-size: 10px;
  letter-spacing: 0.18em;
}
.session-pill .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--warn); }

/* ---------- ticker tape ---------- */
.ticker {
  position: relative;
  overflow: hidden;
  border-bottom: 1px solid var(--hairline);
  background: linear-gradient(180deg, #08070500, #08070595);
}
.ticker::before, .ticker::after {
  content: "";
  position: absolute; top: 0; bottom: 0; width: 80px;
  z-index: 2; pointer-events: none;
}
.ticker::before { left: 0; background: linear-gradient(90deg, var(--bg-0), transparent); }
.ticker::after { right: 0; background: linear-gradient(-90deg, var(--bg-0), transparent); }
.ticker__track {
  display: flex; gap: 0;
  white-space: nowrap;
  /* 90s → 50s: previous "calm" pace felt stalled. 50s gives a noticeable
   * left-drift without becoming a blur — items roll through ~1.8× faster. */
  animation: ticker 50s linear infinite;
  will-change: transform;
}
.ticker__item {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 0 22px;
  height: 36px;
  font-family: var(--font-mono);
  font-size: 12px;
  border-right: 1px solid rgba(201,168,106,0.08);
}
.ticker__sym { color: var(--gold-bright); letter-spacing: 0.06em; font-weight: 600; }
.ticker__price { color: var(--txt-1); }
.ticker__chg { font-size: 11px; }
@keyframes ticker {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}

/* ---------- main grid — hero + macro auto-size, middle rows flex ---------- */
/* Doctrine §2.0: 4-row × 12-col. Hero row was 1.3fr — too tall, clipping content
 * rows. Equal 1fr × 4 rows gives every panel ~140-180px body, all content fits. */
.main {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  /* Doctrine §2.2 hierarchy-not-democracy:
   *   Row 1 (hero strip)        — 1.18fr (5 content rows per card)
   *   Row 2 (BRIEF + MOVERS)    — 1.55fr (brief: 2 paragraphs + 3 watch items; movers: 4 cards)
   *   Row 3 (working B)          — 1.55fr (calendar/tape/predict OR depth/oi/L-S — densest row)
   *   Row 4 (summary strip)      — auto (vital-signs strip OR stance cards — content-only).
   *                               `auto` lets short footer strips (CRYPTO vital signs ~80px)
   *                               give their leftover height back to Row 3, while long
   *                               cards (COCKPIT stance ~150px) still get what they need. */
  grid-template-rows:
    minmax(0, 1.18fr)
    minmax(0, 1.55fr)
    minmax(0, 1.55fr)
    minmax(0, auto);
  /* row-gap > column-gap: vertical breathing room between grid rows prevents
     the hero chg-row from visually crowding the brief panel header below.
     Columns stay tight (8px) for desktop density. */
  row-gap: 14px;
  column-gap: 8px;
  padding: 8px 12px 10px;
  overflow: hidden;
  min-height: 0;
}
/* 所有页统一 4 行骨架 — doctrine §2.0。禁止 .main--xxx 覆盖。 */

/* ---------- panel base ---------- */
.panel {
  position: relative;
  /* Opaque enough that adjacent-cell content can't bleed through —
     prevents visual "overlap" with hero sparklines / chg-rows under tight grid gaps. */
  background: linear-gradient(180deg, rgba(20,17,11,0.92), rgba(14,12,8,0.95));
  border: 1px solid var(--hairline-2);
  border-radius: 10px;
  overflow: hidden;
  display: flex; flex-direction: column;
  height: 100%;
  min-height: 0;
}
.panel::before {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(135deg, rgba(201,168,106,0.04) 0%, transparent 40%);
  pointer-events: none;
}
.panel__h {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 12px;
  border-bottom: 1px solid var(--hairline);
  background: linear-gradient(180deg, rgba(201,168,106,0.04), transparent);
  flex: 0 0 auto;
  min-height: 32px;
}
.panel__h-l { display: flex; align-items: center; gap: 10px; }
.panel__title {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--gold-bright);
}
.panel__sub {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  color: var(--txt-3);
  text-transform: uppercase;
}
.panel__h-r { display: flex; align-items: center; gap: 10px; font-family: var(--font-mono); font-size: 10px; color: var(--txt-3); }
.panel__body { padding: 12px 14px; flex: 1 1 auto; min-height: 0; overflow: hidden; position: relative; }
.panel__body--scroll {
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(201,165,92,0.32) transparent;
  /* Soft fade at top + bottom so rows dissolve into the panel edge */
  -webkit-mask-image: linear-gradient(180deg, transparent 0, #000 12px, #000 calc(100% - 14px), transparent 100%);
          mask-image: linear-gradient(180deg, transparent 0, #000 12px, #000 calc(100% - 14px), transparent 100%);
}
.panel__body--scroll::-webkit-scrollbar { width: 4px; }
.panel__body--scroll::-webkit-scrollbar-track { background: transparent; }
.panel__body--scroll::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(201,165,92,0.25), rgba(201,165,92,0.55));
  border-radius: 2px;
}
.panel__body--scroll::-webkit-scrollbar-thumb:hover { background: rgba(201,165,92,0.7); }
/* When a section uses sticky sub-headers inside a scrollable body */
.panel__body--scroll .scroll-sticky {
  position: sticky; top: 0; z-index: 2;
  background: linear-gradient(180deg, rgba(14,12,8,0.96), rgba(14,12,8,0.72));
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  padding: 4px 0;
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.22em;
  color: var(--txt-3);
  text-transform: uppercase;
  border-bottom: 1px solid rgba(201,165,92,0.10);
}

/* ---------- hero quote card ---------- */
.quote {
  position: relative;
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  gap: 4px;
  padding: 8px 12px 10px;
  /* Floor at 100px so the label+price always fit even when row 1 share is
   * squeezed by short laptop viewports (doctrine §4.5 content-aware sub-tweak). */
  min-height: 100px;
  /* Opaque base so card content cannot visually bleed into the panel below
     when grid row gaps are tight (Cockpit row 1 → row 2 boundary). */
  background:
    radial-gradient(60% 80% at 0% 0%, rgba(201,168,106,0.10), transparent 60%),
    linear-gradient(180deg, rgba(20,17,11,0.95), rgba(10,9,7,0.98));
  border: 1px solid var(--hairline-2);
  border-radius: 10px;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}
.quote__top { display: flex; align-items: baseline; justify-content: space-between; }
.quote__sym {
  font-family: var(--font-serif-display);
  font-weight: 700;
  color: var(--txt-1);
  font-size: 22px;
  letter-spacing: 0.02em;
}
.quote__name {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  color: var(--txt-3);
  text-transform: uppercase;
}
.quote__cat {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.22em;
  color: var(--gold);
  border: 1px solid var(--hairline-3);
  padding: 2px 6px;
  border-radius: 3px;
}
.quote__price {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 28px;
  color: var(--txt-1);
  letter-spacing: -0.01em;
  line-height: 1;
  margin-top: 2px;
}
.quote__chg-row { display: flex; align-items: center; gap: 12px; font-family: var(--font-mono); font-size: 12px; flex-shrink: 0; }
.quote__chg { padding: 2px 8px; border-radius: 3px; font-weight: 600; }
.quote__chg--up { color: var(--up); background: var(--up-bg); }
.quote__chg--dn { color: var(--dn); background: var(--dn-bg); }
.quote__chg-abs { color: var(--txt-3); font-size: 11px; }
.quote__range { display: flex; justify-content: space-between; font-family: var(--font-mono); font-size: 10px; color: var(--txt-3); }
.quote__range strong { color: var(--txt-2); font-weight: 500; }
.quote__spark { display: block; width: 100%; height: 100%; margin: 0 -4px; }
.quote .syncchart--spark { display: block; width: 100%; height: 100%; min-height: 0; overflow: hidden; }
.quote__flash { position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity 250ms; }
.quote.flash-up .quote__flash { opacity: 1; background: radial-gradient(60% 60% at 50% 50%, rgba(52,211,153,0.18), transparent 70%); }
.quote.flash-dn .quote__flash { opacity: 1; background: radial-gradient(60% 60% at 50% 50%, rgba(248,113,113,0.18), transparent 70%); }

/* ---------- heatmap ---------- */
.heatmap-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 3px;
  height: 100%;
}
.heat-cell {
  position: relative;
  border-radius: 4px;
  padding: 6px 8px;
  display: flex; flex-direction: column; justify-content: space-between;
  min-height: 56px;
  border: 1px solid rgba(255,255,255,0.04);
  overflow: hidden;
  cursor: default;
}
.heat-cell__sym { font-family: var(--font-mono); font-size: 10.5px; font-weight: 700; color: rgba(255,255,255,0.95); letter-spacing: 0.04em; }
.heat-cell__chg { font-family: var(--font-mono); font-size: 10.5px; font-weight: 600; }
.heat-cell__cap { font-family: var(--font-mono); font-size: 8.5px; color: rgba(255,255,255,0.5); }

/* ---------- list row (news, flows, prediction, liquidations) ---------- */
.row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  padding: 9px 12px;
  border-bottom: 1px solid rgba(201,168,106,0.06);
  align-items: center;
  transition: background 180ms;
}
.row:hover { background: rgba(201,168,106,0.04); }
.row:last-child { border-bottom: none; }
.row__time { font-family: var(--font-mono); font-size: 10px; color: var(--txt-3); letter-spacing: 0.06em; min-width: 38px; }
.row__body { font-size: 13px; color: var(--txt-1); line-height: 1.45; }
.row__tag { font-family: var(--font-mono); font-size: 9px; padding: 2px 6px; border-radius: 3px; letter-spacing: 0.16em; text-transform: uppercase; }
.tag-macro    { color: var(--gold-bright); background: rgba(201,168,106,0.12); border: 1px solid rgba(201,168,106,0.25); }
.tag-crypto   { color: var(--up); background: rgba(52,211,153,0.08); border: 1px solid rgba(52,211,153,0.22); }
.tag-defi     { color: var(--warn); background: rgba(251,191,36,0.08); border: 1px solid rgba(251,191,36,0.22); }
.tag-markets  { color: var(--info); background: rgba(147,197,253,0.08); border: 1px solid rgba(147,197,253,0.22); }
.tag-asia     { color: var(--dn); background: rgba(248,113,113,0.08); border: 1px solid rgba(248,113,113,0.22); }
.tag-gmg      { color: var(--gold-soft); background: rgba(255,231,166,0.08); border: 1px solid rgba(255,231,166,0.30); }

/* ---------- AI brief ---------- */
.brief {
  display: flex; flex-direction: column; gap: 12px;
  padding: 14px;
  height: 100%;
}
.brief__head {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--font-mono); font-size: 10px;
  letter-spacing: 0.22em; color: var(--gold);
  text-transform: uppercase;
}
.brief__head .icon {
  width: 18px; height: 18px;
  border-radius: 4px;
  display: grid; place-items: center;
  border: 1px solid rgba(201,168,106,0.4);
  background: radial-gradient(circle at 30% 30%, rgba(230,201,136,0.3), transparent 70%);
  color: var(--gold-bright);
  font-size: 10px;
}
.brief__bullets { display: flex; flex-direction: column; gap: 10px; }
.brief__b {
  display: grid; grid-template-columns: 16px 1fr; gap: 8px;
  font-size: 13px; line-height: 1.5; color: var(--txt-1);
}
.brief__b .marker {
  font-family: var(--font-mono); font-size: 10px;
  color: var(--gold); margin-top: 3px;
  letter-spacing: 0.1em;
}
.brief__b strong { color: var(--gold-bright); font-weight: 600; }
.brief__b em { font-style: normal; color: var(--up); font-family: var(--font-mono); }
.brief__b .dn-em { color: var(--dn); font-family: var(--font-mono); font-style: normal; }
.brief__cite {
  font-family: var(--font-mono); font-size: 9px;
  color: var(--txt-3); letter-spacing: 0.16em;
  display: inline;
}
.brief__foot {
  margin-top: auto;
  display: flex; align-items: center; justify-content: space-between;
  padding-top: 10px;
  border-top: 1px solid var(--hairline);
  font-family: var(--font-mono); font-size: 9px;
  color: var(--txt-3); letter-spacing: 0.16em;
}

/* ---------- prediction market row ---------- */
.pm-row {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(201,168,106,0.06);
  display: grid;
  gap: 6px;
}
.pm-row:last-child { border-bottom: none; }
.pm-row__q { font-size: 13px; color: var(--txt-1); line-height: 1.4; }
.pm-row__bar {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--font-mono); font-size: 11px;
}
.pm-row__bar .pct { color: var(--gold-bright); font-weight: 600; min-width: 42px; }
.pm-row__bar .track { flex: 1; height: 4px; background: rgba(255,255,255,0.06); border-radius: 2px; overflow: hidden; }
.pm-row__bar .fill { height: 100%; background: linear-gradient(90deg, var(--gold-deep), var(--gold), var(--gold-bright)); border-radius: 2px; }
.pm-row__bar .vol { color: var(--txt-3); font-size: 10px; letter-spacing: 0.06em; }

/* ---------- macro strip ---------- */
.macro-strip {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 1px;
  background: rgba(201,168,106,0.10);
  border-radius: 8px;
  overflow: hidden;
}
.macro-cell {
  padding: 8px 12px;
  background: rgba(15,13,9,0.96);
  min-width: 0;
  overflow: hidden;
  display: grid; gap: 4px;
}
.macro-cell__lbl { font-family: var(--font-mono); font-size: 9px; letter-spacing: 0.2em; color: var(--txt-3); text-transform: uppercase; }
.macro-cell__val { font-family: var(--font-mono); font-size: 15px; font-weight: 600; color: var(--txt-1); line-height: 1.15; }
.macro-cell__chg { font-family: var(--font-mono); font-size: 10px; }

/* ---------- flows panel ---------- */
.flow-row {
  display: grid; grid-template-columns: 1fr auto auto; gap: 8px;
  padding: 8px 12px;
  align-items: center;
  border-bottom: 1px solid rgba(201,168,106,0.06);
}
.flow-row:last-child { border-bottom: none; }
.flow-row__nm { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--txt-1); }
.flow-row__nm .ico { width: 18px; height: 18px; border-radius: 4px; background: rgba(201,168,106,0.12); display: grid; place-items: center; color: var(--gold-bright); font-family: var(--font-mono); font-size: 9px; font-weight: 700; }
.flow-row__val { font-family: var(--font-mono); font-size: 12px; font-weight: 600; }
.flow-row__bar {
  width: 70px; height: 5px; border-radius: 3px;
  background: rgba(255,255,255,0.05);
  overflow: hidden; position: relative;
}
.flow-row__bar > span {
  display: block; height: 100%;
  border-radius: 3px;
}

/* ---------- liquidations ---------- */
.liq-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: rgba(201,168,106,0.08);
  border-radius: 6px;
  overflow: hidden;
}
.liq-cell { padding: 7px 10px; background: rgba(15,13,9,0.96); display: grid; gap: 2px; min-width: 0; overflow: hidden; }
.liq-cell__lbl { font-family: var(--font-mono); font-size: 8.5px; color: var(--txt-3); letter-spacing: 0.18em; text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.liq-cell__val { font-family: var(--font-mono); font-size: 15px; font-weight: 600; line-height: 1.1; }

/* ---------- command line ---------- */
.cmdline {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 0 16px;
  background: linear-gradient(180deg, rgba(10,9,7,0.92), rgba(20,17,11,0.95));
  border-top: 1px solid var(--hairline-3);
  backdrop-filter: blur(20px);
}
.cmdline__brand {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--font-mono); font-size: 11px;
  color: var(--gold-bright);
  letter-spacing: 0.18em;
  text-transform: uppercase;
}
.cmdline__brand .caret {
  color: var(--gold);
  font-size: 14px;
}
.cmdline__input-wrap { display: flex; align-items: center; gap: 10px; }
.cmdline__input {
  flex: 1;
  background: transparent;
  border: none; outline: none;
  font-family: var(--font-mono); font-size: 13px;
  color: var(--txt-1);
  letter-spacing: 0.02em;
  padding: 8px 0;
  width: 100%;
}
.cmdline__input::placeholder { color: var(--txt-3); letter-spacing: 0.04em; }
.cmdline__chips { display: flex; gap: 6px; }
.cmdline__chip {
  font-family: var(--font-mono); font-size: 10px;
  color: var(--txt-2);
  border: 1px solid var(--hairline-2);
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(201,168,106,0.04);
  cursor: pointer;
  letter-spacing: 0.08em;
  white-space: nowrap;
  transition: all 180ms;
}
.cmdline__chip:hover { color: var(--gold-bright); border-color: var(--hairline-3); background: rgba(201,168,106,0.10); }
.cmdline__hint { font-family: var(--font-mono); font-size: 10px; color: var(--txt-3); letter-spacing: 0.18em; }
.cmdline__hint kbd {
  display: inline-block;
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 3px;
  padding: 1px 5px;
  font-family: var(--font-mono); font-size: 10px;
  color: var(--gold-bright);
  margin: 0 2px;
}
.cmdline__caret { color: var(--gold); animation: blink 1.1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* ---------- AI chat overlay (full-screen sheet) ---------- */
.ai-sheet {
  position: fixed; inset: 0; z-index: 300;
  display: grid; place-items: end stretch;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(18px);
  animation: fadeIn 220ms var(--ease-out);
}
.ai-sheet__panel {
  width: 100%;
  max-height: 78vh;
  background: linear-gradient(180deg, rgba(20,17,11,0.95), rgba(10,9,7,0.98));
  border-top: 1px solid var(--hairline-3);
  box-shadow: 0 -30px 80px rgba(0,0,0,0.6), inset 0 1px 0 rgba(230,201,136,0.08);
  display: flex; flex-direction: column;
  animation: sheetUp 320ms var(--ease-out);
}
.ai-sheet__h {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 18px;
  border-bottom: 1px solid var(--hairline);
}
.ai-sheet__h-l { display: flex; align-items: center; gap: 12px; }
.ai-sheet__convo {
  flex: 1; overflow-y: auto;
  padding: 18px 24px;
  display: flex; flex-direction: column; gap: 16px;
}
.msg { display: grid; gap: 6px; max-width: 800px; }
.msg--user { justify-self: end; }
.msg__role { font-family: var(--font-mono); font-size: 9px; letter-spacing: 0.22em; color: var(--txt-3); text-transform: uppercase; }
.msg--user .msg__role { text-align: right; color: var(--gold); }
.msg__body {
  font-size: 14px; line-height: 1.6; color: var(--txt-1);
  padding: 12px 16px;
  border-radius: 8px;
  background: rgba(255,255,255,0.025);
  border: 1px solid rgba(255,255,255,0.06);
  white-space: pre-wrap;
}
.msg--user .msg__body {
  background: rgba(201,168,106,0.08);
  border-color: rgba(201,168,106,0.25);
  color: var(--gold-bright);
  font-family: var(--font-mono);
}
.msg__body strong { color: var(--gold-bright); font-weight: 600; }
.msg__body code {
  font-family: var(--font-mono); font-size: 12px;
  background: rgba(255,255,255,0.04);
  padding: 1px 5px; border-radius: 3px;
  color: var(--gold-bright);
}
.msg--typing .msg__body { color: var(--txt-3); font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.12em; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes sheetUp { from { transform: translateY(40px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* ---------- grid spans ---------- */
.col-3 { grid-column: span 3; }
.col-4 { grid-column: span 4; }
.col-5 { grid-column: span 5; }
.col-6 { grid-column: span 6; }
.col-7 { grid-column: span 7; }
.col-8 { grid-column: span 8; }
.col-9 { grid-column: span 9; }
.col-12 { grid-column: span 12; }

/* ---------- watermark kirin ---------- */
.kirin-mark {
  position: fixed;
  right: -120px; bottom: 60px;
  width: 600px; height: 600px;
  pointer-events: none;
  opacity: 0.012;
  z-index: 1;
  mix-blend-mode: screen;
  background-image: url('../assets/gmg-logo.svg');
  background-size: contain; background-repeat: no-repeat; background-position: center;
  filter: invert(85%) sepia(35%) saturate(620%) hue-rotate(0deg);
}

/* ---------- scrollbar ---------- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(201,168,106,0.18); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(201,168,106,0.30); }

/* ---------- responsive ---------- */
@media (max-width: 1600px) {
  .chip { padding: 7px 9px; font-size: 10px; letter-spacing: 0.14em; }
  .chip .num { display: none; }
  .topbar__brand .ver { display: none; }
}
/* Laptop-tier (900-1600) content-aware sub-tweaks — these are NOT new tiers.
 * Doctrine §4.5 forbids new ui-scale tiers, but allows content-density adjustments
 * within an existing tier when a panel content geometrically can't fit. The macro-strip
 * specifically wraps to 2 rows under ~1400px wide, so we shrink to horizontal-scroll
 * single-row instead. heatmap-grid similarly drops a column to keep cells legible. */
/* Short laptop viewports (browser chrome eats vertical space) — compress hero
 * typography so the price always fits within the squeezed quote panel.
 * Doctrine §4.5 content-aware sub-tweak. Targets 14"/15" laptop with bookmarks bar. */
@media (min-width: 900px) and (max-height: 800px) {
  .quote { gap: 2px; padding: 6px 10px 8px; }
  .quote__top { padding-bottom: 0; }
  .quote__sym { font-size: 18px; }
  .quote__name { font-size: 9px; }
  .quote__price { font-size: 22px; line-height: 1; margin-top: 0; }
  .quote__chg-row { font-size: 11px; gap: 8px; }
}

@media (max-width: 1400px) {
  .heatmap-grid { grid-template-columns: repeat(6, 1fr); }
  /* macro-strip: keep cells on a single row at narrow widths and let the panel scroll
   * horizontally instead of stacking into 2 rows that would exceed Row 4's height share.
   * Min column width 140px keeps the value+chg legible. */
  .macro-strip {
    grid-template-columns: repeat(6, minmax(140px, 1fr));
    overflow-x: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(201,165,92,0.32) transparent;
  }
  .macro-strip::-webkit-scrollbar { height: 3px; }
  .macro-strip::-webkit-scrollbar-thumb { background: rgba(201,165,92,0.35); border-radius: 2px; }
  .quote__price { font-size: 26px; }
  .session-pill { display: none; }
}
@media (max-width: 1200px) {
  .topbar__product { display: none; }
  .chip { padding: 6px 7px; font-size: 9px; }
  .cmdline__chips { display: none; }
}
@media (max-width: 1100px) {
  .main { grid-template-columns: repeat(6, 1fr); padding: 8px; gap: 8px; }
  .col-3 { grid-column: span 3; }
  .col-4 { grid-column: span 6; }
  .col-5 { grid-column: span 6; }
  .col-6 { grid-column: span 6; }
  .col-7, .col-8, .col-9 { grid-column: span 6; }
  .col-12 { grid-column: span 6; }
  /* At narrow width, let pages flow vertically instead of forcing fixed row count */
  .main, .main--cockpit, .main--news, .main--flows, .main--options,
  .main--defi, .main--crypto, .main--markets, .main--macro,
  .main--predict, .main--ai {
    grid-template-rows: none;
    grid-auto-rows: minmax(140px, auto);
    overflow-y: auto;
  }
}
/* Mobile boundary — aligned to doctrine §4.5 (was 820, now 899 per spec).
 * Phone breakpoint switches grid to single column + scrolling body. */
@media (max-width: 899px) {
  /* v34.7 mobile scroll fix: body uses visible overflow so window scrolling
   * (with momentum) takes over. Dropped overscroll-behavior-y: contain (v34.5
   * added it but it suppresses iOS rubber-band, contributing to jankiness). */
  body { overflow: visible; height: auto; }
  .term { height: auto; min-height: 100vh; overflow: visible; grid-template-rows: 52px 30px auto 56px; }
  .main { grid-template-rows: none; overflow: visible; }
  .topbar { padding: 0 10px; gap: 8px; grid-template-columns: auto 1fr auto; }
  .topbar__logo { height: 22px; }
  .topbar__nav {
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    justify-self: stretch;
    justify-content: flex-start;
  }
  .topbar__nav::-webkit-scrollbar { display: none; }
  .topbar__right { gap: 8px; }
  .topbar__clock .sub { display: none; }
  .live-dot span:last-child { display: none; }
  .main {
    grid-template-columns: 1fr 1fr;
    padding: 8px; gap: 8px;
  }
  .col-3, .col-4, .col-5, .col-6, .col-7, .col-8, .col-9, .col-12 { grid-column: span 2; }

  /* tablet — lift density floor */
  .chip { padding: 6px 10px; min-height: 36px; }
  .chip .num { font-size: 10px; }
  .chip__lbl { font-size: 11px; letter-spacing: 0.12em; }
  .quote { min-height: 138px; padding: 12px 14px; }
  .quote__price { font-size: 26px; }
  .quote__sym { font-size: 19px; }
  .quote__day { font-size: 13px; }
  .heatmap-grid { grid-template-columns: repeat(4, 1fr); }
  .heat-cell__sym { font-size: 12px; }
  .heat-cell__chg { font-size: 12px; }
  .heat-cell__cap { font-size: 10px; }
  .macro-strip { grid-template-columns: repeat(3, 1fr); }
  .macro-cell__lbl { font-size: 10.5px; letter-spacing: 0.14em; }
  .macro-cell__val { font-size: 16px; }
  .macro-cell__chg { font-size: 11px; }
  .panel__h { padding: 10px 12px; }
  .panel__title { font-size: 11.5px; letter-spacing: 0.14em; }
  .panel__sub { font-size: 10.5px; }
  .row { grid-template-columns: 38px 1fr auto; padding: 10px 12px; gap: 10px; }
  .row__body { font-size: 13px; line-height: 1.45; }
  .row__meta { font-size: 10.5px; }
  .brief { padding: 12px; }
  .brief__title { font-size: 11.5px; }
  .brief__b { font-size: 13px; line-height: 1.5; }
  .brief__stamp { font-size: 10.5px; }
  .cmdline { padding: 0 12px; gap: 10px; grid-template-columns: auto 1fr; height: 56px; }
  .cmdline__hint { display: none; }
  .cmdline__brand { font-size: 11px; }
  .cmdline__input { font-size: 14px; }
  .ai-sheet__panel { max-height: 92vh; }
  .ai-sheet__convo { padding: 12px 14px; }
  .msg { max-width: 100%; font-size: 13.5px; line-height: 1.55; }

  /* crypto page floors */
  .ftable th { font-size: 10.5px; padding: 8px 6px; }
  .ftable td { font-size: 12.5px; padding: 7px 6px; }
  .onchain__lbl { font-size: 10px; }
  .onchain__val { font-size: 15px; }
  .onchain__sub { font-size: 10.5px; }
  .altmov__row { padding: 8px 12px; }
  .altmov__sym { font-size: 12.5px; }
  .altmov__chg { font-size: 12px; }
  .altmov__cap, .altmov__vol { font-size: 11px; }
  .oibars__row { font-size: 12px; }
  .oibars__v { font-size: 12px; }
  .liq-cell__lbl { font-size: 10px; }
  .liq-cell__val { font-size: 16px; }
  .lsgauge__sym { font-size: 14px; }
  .lsgauge__ratio { font-size: 13px; }
  .lsgauge__pct { font-size: 11px; }
  .depth { font-size: 12px; }
  .depth__spread { font-size: 10.5px; }
  .depth__mark { font-size: 15px; }
  .ticker__cell { padding: 0 14px; }
  .ticker__sym { font-size: 11px; }
  .ticker__px { font-size: 12px; }
  .ticker__chg { font-size: 11px; }
}

@media (max-width: 480px) {
  .main { grid-template-columns: 1fr; padding: 8px; gap: 8px; }
  .col-3, .col-4, .col-5, .col-6, .col-7, .col-8, .col-9, .col-12 { grid-column: span 1; }
  .heatmap-grid { grid-template-columns: repeat(3, 1fr); }

  /* phone — iOS HIG-grade floor */
  .topbar { padding: 0 8px; }
  .topbar__product { display: none; }
  .ver { display: none; }
  .chip { padding: 8px 12px; min-height: 44px; }
  .chip .num { font-size: 11px; }
  .chip__lbl { font-size: 12px; }
  .quote__price { font-size: 30px; }
  .quote__sym { font-size: 20px; }
  .quote__day { font-size: 14px; }
  .heat-cell { padding: 8px; }
  .heat-cell__sym { font-size: 13px; }
  .heat-cell__chg { font-size: 13px; }
  .heat-cell__cap { font-size: 10.5px; }
  .macro-cell { padding: 10px 12px; }
  .macro-cell__lbl { font-size: 11px; }
  .macro-cell__val { font-size: 18px; }
  .macro-cell__chg { font-size: 12px; }
  .panel__title { font-size: 12px; }
  .panel__sub { font-size: 11px; }
  .row__body { font-size: 14px; }
  .row__meta { font-size: 11px; }
  .brief__title { font-size: 12px; }
  .brief__b { font-size: 14px; }
  .cmdline__input { font-size: 15px; }
  .lang-toggle__btn { padding: 6px 10px; font-size: 11px; min-height: 32px; }
  .session-pill { display: none; }

  /* crypto page phone floors */
  .onchain__val { font-size: 16px; }
  .onchain__lbl { font-size: 10.5px; }
  .altmov__sym { font-size: 13px; }
  .altmov__chg { font-size: 13px; }
  .liq-cell__val { font-size: 18px; }
  .lsgauge__sym { font-size: 15px; }
  .ftable td { font-size: 13px; }
  .ftable th { font-size: 11px; }
}
/* Wall-75 tier — aligned to doctrine §4.5 (was 2200, now 2400 per spec) */
@media (min-width: 2400px) {
  :root { --grid-gap: 16px; }
  body { font-size: 17px; }
  .main { padding: 16px; }
  .term { grid-template-rows: 66px 40px 1fr 60px; }
  /* Top bar + chrome */
  .topbar { padding: 0 22px; }
  .topbar__logo { height: 32px; }
  .topbar__product { font-size: 14px; letter-spacing: 0.24em; }
  .topbar__brand .ver { font-size: 11px; }
  .chip { font-size: 12.5px; padding: 9px 14px; }
  .chip .num { font-size: 10.5px; }
  .topbar__clock .time { font-size: 15px; }
  .topbar__clock .sub { font-size: 10.5px; }
  /* Ticker */
  .ticker__item { padding: 0 28px; font-size: 13.5px; height: 40px; }
  .ticker__sym { font-size: 13px; }
  .ticker__chg { font-size: 12.5px; }
  /* Panels */
  .panel__h { padding: 13px 18px; }
  .panel__title { font-size: 12.5px; letter-spacing: 0.24em; }
  .panel__sub { font-size: 11.5px; letter-spacing: 0.18em; }
  .panel__h-r { font-size: 11.5px; }
  .panel__body { padding: 14px 18px; }
  /* Hero quote (big numbers stay readable at distance) */
  .quote { padding: 14px 18px 12px; gap: 7px; }
  .quote__sym { font-size: 28px; }
  .quote__name { font-size: 11.5px; }
  .quote__cat { font-size: 10.5px; padding: 3px 8px; }
  .quote__price { font-size: 42px; }
  .quote__chg-row { font-size: 14px; }
  .quote__chg { padding: 3px 10px; }
  .quote__chg-abs { font-size: 12.5px; }
  .quote__range { font-size: 11.5px; }
  /* List rows */
  .row { padding: 11px 16px; }
  .row__body { font-size: 14.5px; }
  .row__time { font-size: 11.5px; min-width: 44px; }
  .row__tag { font-size: 10px; padding: 3px 7px; }
  /* AI Brief on Cockpit */
  .brief__head { font-size: 11.5px; }
  .brief__b { font-size: 14.5px; }
  .brief__foot { font-size: 10.5px; }
  /* Prediction rows */
  .pm-row__q { font-size: 14.5px; }
  .pm-row__bar .pct { font-size: 12.5px; }
  /* Macro + footer strips — stay LAPTOP-density at wall (no font bloat).
   * The strip is a SUMMARY, not a primary; per §4.5.3 wall density goes DOWN not up. */
  .macro-strip { gap: 1px; }
  .macro-cell { padding: 8px 14px; }
  .macro-cell__lbl { font-size: 9.5px; }
  .macro-cell__val { font-size: 15px; }
  .macro-cell__chg { font-size: 10.5px; }
  /* Heatmap — go denser, not bigger */
  .heatmap-grid { grid-template-columns: repeat(10, 1fr); gap: 4px; }
  .heat-cell { padding: 8px 10px; min-height: 64px; }
  .heat-cell__sym { font-size: 12.5px; }
  .heat-cell__chg { font-size: 12.5px; }
  .heat-cell__cap { font-size: 10px; }
  /* Flow row */
  .flow-row { padding: 10px 16px; font-size: 13.5px; }
  .flow-row__bar { width: 90px; }
  /* Liq grid */
  .liq-cell { padding: 9px 14px; }
  .liq-cell__lbl { font-size: 10.5px; }
  .liq-cell__val { font-size: 17px; }
  /* Command line */
  .cmdline { padding: 0 20px; }
  .cmdline__brand { font-size: 12.5px; }
  .cmdline__input { font-size: 15px; }
  .cmdline__chip { font-size: 11.5px; padding: 5px 12px; }
  .cmdline__hint { font-size: 11px; }
  /* AI sheet */
  .ai-sheet__title { font-size: 12.5px; }
  .ai-sheet__feeds { font-size: 11px; }
  .ai-sheet__head { font-size: 32px; }
  .ai-sheet__dek { font-size: 13px; }
  .ai-sheet__glyph { font-size: 64px; }
  .ai-sheet__card { padding: 14px 18px; }
  .ai-sheet__card-q { font-size: 14px; }
  .ai-sheet__card-cat { font-size: 10px; padding: 3px 8px; }
  .msg__body { font-size: 15.5px; }
  .msg__role { font-size: 10px; }
  /* Cockpit composite widgets */
  .brief2__h-l > * { font-size: 11.5px; }
  .brief2__headline { font-size: 26px; }
  .brief2__paras { font-size: 14px; }
  .brief2__paras code { font-size: 13.5px; }
  .brief2__watch-row { font-size: 13.5px; padding: 5px 0; }
  .brief2__watch-t { font-size: 12px; }
  .brief2__watch-h { font-size: 10.5px; }
  .movers2__card { padding: 12px 18px; }
  .movers2__headline { font-size: 13.5px; }
  .movers2__detail { font-size: 12px; }
  .movers2__metric { font-size: 18px; }
  .movers2__tag { font-size: 10px; padding: 3px 7px; }
  .cal2__row { grid-template-columns: 50px 56px 1fr auto 40px; padding: 8px 18px; font-size: 13px; }
  .cal2__t { font-size: 12px; }
  .cal2__cat { font-size: 9.5px; padding: 3px 7px; }
  .cal2__date { font-size: 12.5px; }
  .tape2__row { grid-template-columns: 52px 60px 44px 1fr auto; padding: 8px 18px; font-size: 13px; }
  .tape2__t { font-size: 12px; }
  .tape2__kind { font-size: 9.5px; padding: 3px 7px; }
  .tape2__val { font-size: 12.5px; min-width: 72px; }
  .pred2__card { padding: 12px 18px; gap: 8px; }
  .pred2__q { font-size: 13.5px; }
  .pred2__yes { font-size: 20px; }
  .pred2__chg { font-size: 12.5px; }
  /* Generic dense lists */
  .altmov__row, .single-movers__row { padding: 8px 16px; font-size: 13px; }
  .dexvol__row, .lst__row, .feerev__row { padding: 9px 18px; font-size: 13px; }
  .stab-sup__row { padding: 8px 16px; }
  .stab-sup__sym { font-size: 13.5px; }
  .chain-tvl__row { font-size: 13px; }
  /* Crypto widgets */
  .lsgauge__sym { font-size: 15px; }
  .lsgauge__ratio { font-size: 13.5px; }
  .lsgauge__pct { font-size: 12px; }
  .onchain__lbl { font-size: 10.5px; }
  .onchain__val { font-size: 17px; }
  .onchain__sub { font-size: 11.5px; }
  .liqmap__px { font-size: 12px; }
  .liqmap__v { font-size: 10.5px; }
  /* Markets widgets */
  .idx-cell__sym { font-size: 14px; }
  .idx-cell__nm { font-size: 11px; }
  .idx-cell__val { font-size: 17px; }
  .idx-cell__chg { font-size: 12px; }
  .megacap__row { padding: 9px 16px; font-size: 13px; }
  .sectors__row { padding: 8px 16px; font-size: 13px; }
  /* Macro widgets */
  .mkey__lbl { font-size: 10.5px; }
  .mkey__val { font-size: 17px; }
  .ytable th { font-size: 10.5px; }
  .ytable td { font-size: 12.5px; }
  .fxtable__pair { font-size: 13px; }
  .fxtable__val { font-size: 13px; }
  .comgrid__val { font-size: 15px; }
  /* Options */
  .vol-hero__big { font-size: 32px; }
  .chain__k { font-size: 13px; }
  .chain td { font-size: 12px; padding: 5px 8px; }
  /* News */
  .news-hero__head { font-size: 26px; }
  .news-hero__dek { font-size: 14.5px; }
  .wire__row { padding: 8px 16px; font-size: 13px; }
  .desk-feed__head { font-size: 13.5px; }
  .econ-tbl td, .earn-tbl td { font-size: 12.5px; padding: 6px 10px; }
  /* Predict */
  .hdl__row { padding: 8px 16px; font-size: 13px; }
  .movers__row { padding: 8px 16px; font-size: 13px; }
  /* AI page hero */
  .ai-hero__head { font-size: 36px; }
  .ai-hero__dek { font-size: 14px; }
  /* Pinstrip */
  .pinstrip { height: 32px; padding: 0 18px; }
  .pinstrip__lbl { font-size: 10.5px; }
  .pinstrip__chip { font-size: 11.5px; padding: 4px 10px; }
}

/* Wall-100 tier — aligned to doctrine §4.5 (was 2800, now 3600 per spec) */
@media (min-width: 3600px) {
  :root { --grid-gap: 20px; }
  body { font-size: 19px; }
  .main { padding: 20px; }
  .term { grid-template-rows: 76px 46px 1fr 68px; }
  /* Brand + nav */
  .topbar__logo { height: 38px; }
  .topbar__product { font-size: 16px; }
  .chip { font-size: 14px; padding: 10px 16px; }
  .ticker__item { padding: 0 36px; font-size: 15.5px; height: 46px; }
  /* Panels */
  .panel__h { padding: 16px 22px; }
  .panel__title { font-size: 14.5px; letter-spacing: 0.26em; }
  .panel__sub { font-size: 13px; }
  .panel__h-r { font-size: 13px; }
  /* Hero quote */
  .quote { padding: 18px 22px 16px; gap: 9px; }
  .quote__sym { font-size: 34px; }
  .quote__price { font-size: 56px; }
  .quote__chg-row { font-size: 16px; }
  /* List rows */
  .row { padding: 13px 20px; }
  .row__body { font-size: 16px; }
  .brief__b { font-size: 16.5px; }
  .pm-row__q { font-size: 16px; }
  /* Cockpit composite */
  .brief2__headline { font-size: 32px; }
  .brief2__paras { font-size: 16px; }
  .movers2__headline { font-size: 15.5px; }
  .movers2__detail { font-size: 13.5px; }
  .movers2__metric { font-size: 22px; }
  .tape2__row, .cal2__row, .altmov__row, .single-movers__row,
  .dexvol__row, .lst__row, .feerev__row, .wire__row,
  .hdl__row, .movers__row, .megacap__row, .sectors__row { padding: 10px 22px; font-size: 14.5px; }
  /* Big numbers — but NOT macro-cell. Doctrine §4.5.3: wall-tier panels reduce
   * content density, not blow up font. The Row 4 summary strip stays compact so the
   * row keeps its tight 100-130px footprint and gives leftover height to Row 3. */
  .onchain__val { font-size: 20px; }
  .idx-cell__val { font-size: 20px; }
  .mkey__val { font-size: 20px; }
  .vol-hero__big { font-size: 40px; }
  .liq-cell__val { font-size: 20px; }
  /* AI */
  .ai-sheet__head { font-size: 40px; }
  .ai-sheet__glyph { font-size: 80px; }
  .ai-sheet__card-q { font-size: 16px; }
  .ai-hero__head { font-size: 44px; }
  .msg__body { font-size: 17.5px; line-height: 1.65; }
  /* Heatmap can fit 12 cells per row at 2800+ */
  .heatmap-grid { grid-template-columns: repeat(12, 1fr); gap: 5px; }
  .heat-cell { min-height: 72px; }
  /* Command line */
  .cmdline__input { font-size: 17px; }
  .cmdline__brand { font-size: 14px; }
  /* Pinstrip */
  .pinstrip { height: 36px; }
  .pinstrip__chip { font-size: 13px; padding: 5px 12px; }
}

/* ---------- prefers-reduced-motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .ticker__track { animation: none; }
  .live-dot .pulse::after { animation: none; }
  .cmdline__caret { animation: none; }
}


/* ---------- P1-6 Context menu ---------- */
.ctxmenu {
  position: fixed; z-index: 300;
  min-width: 180px;
  background: linear-gradient(180deg, rgba(22,18,11,0.98), rgba(14,12,8,0.98));
  border: 1px solid rgba(201,165,92,0.34);
  border-radius: 4px;
  box-shadow: 0 14px 36px rgba(0,0,0,0.55), 0 0 0 1px rgba(201,165,92,0.08);
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 4px 0;
  animation: ctxmIn 120ms ease;
}
@keyframes ctxmIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.ctxmenu__h {
  padding: 8px 12px 6px;
  font-size: 10px; letter-spacing: 0.22em; color: var(--gold-bright);
  border-bottom: 1px solid rgba(201,165,92,0.16);
  margin-bottom: 4px;
}
.ctxmenu__row {
  display: flex; align-items: center; gap: 10px;
  width: 100%;
  background: none; border: 0; cursor: pointer;
  padding: 7px 12px; color: var(--txt-2);
  font-family: var(--font-mono); font-size: 12px; text-align: left;
}
.ctxmenu__row:hover { background: rgba(201,165,92,0.10); color: var(--gold-bright); }
.ctxmenu__i { color: var(--gold); width: 14px; text-align: center; font-size: 10px; }

/* ---------- P1-7 Hover sparkline tooltip ---------- */
.sparktip {
  position: fixed; z-index: 280; transform: translate(-50%, -100%);
  background: linear-gradient(180deg, rgba(20,16,8,0.96), rgba(12,10,6,0.98));
  border: 1px solid rgba(201,165,92,0.32);
  border-radius: 5px;
  padding: 8px 10px 6px;
  box-shadow: 0 10px 28px rgba(0,0,0,0.55);
  pointer-events: none;
  animation: sparkIn 180ms ease;
}
@keyframes sparkIn { from { opacity: 0; transform: translate(-50%, calc(-100% + 6px)); } to { opacity: 1; transform: translate(-50%, -100%); } }
.sparktip__h { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 2px; }
.sparktip__sym { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.18em; color: var(--gold-bright); }
.sparktip__chg { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.10em; }
.sparktip__f { font-family: var(--font-mono); font-size: 9px; letter-spacing: 0.16em; color: var(--txt-4); margin-top: 2px; text-align: center; }

/* ---------- P1-8 Synchronized crosshair across .syncchart elements ---------- */
.syncchart { position: relative; }
.syncchart::after {
  content: ''; position: absolute; top: 0; bottom: 0;
  left: var(--xhair, -10px); width: 1px;
  background: linear-gradient(180deg, transparent, rgba(201,165,92,0.65), transparent);
  pointer-events: none; opacity: 0; transition: opacity 120ms;
  z-index: 5;
}
.syncchart--hover::after { opacity: 1; }
.syncchart--spark { display: block; }

.xhair-bubble {
  position: fixed;
  transform: translate(-50%, -100%);
  z-index: 290; pointer-events: none;
  background: linear-gradient(180deg, rgba(22,18,11,0.96), rgba(14,12,8,0.98));
  border: 1px solid rgba(201,165,92,0.42);
  border-radius: 3px;
  padding: 4px 9px;
  font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.12em;
  display: inline-flex; gap: 8px; align-items: baseline;
  box-shadow: 0 6px 18px rgba(0,0,0,0.5);
}
.xhair-bubble__dom { color: var(--gold); font-size: 9px; letter-spacing: 0.22em; }
.xhair-bubble__t { color: var(--gold-bright); }

/* ---------- P1-9 Pinned strip ---------- */
.pinstrip {
  position: fixed;
  top: 56px; left: 0; right: 0;
  height: 28px;
  display: flex; align-items: center; gap: 8px;
  padding: 0 14px;
  background: linear-gradient(180deg, rgba(22,18,11,0.94), rgba(14,12,8,0.86));
  border-bottom: 1px solid rgba(201,165,92,0.18);
  font-family: var(--font-mono);
  font-size: 11px;
  z-index: 50;
  overflow-x: auto;
  scrollbar-width: none;
}
.pinstrip::-webkit-scrollbar { display: none; }
.pinstrip__lbl { color: var(--gold); letter-spacing: 0.22em; font-size: 9.5px; flex-shrink: 0; }
.pinstrip__chip {
  background: rgba(201,165,92,0.08);
  border: 1px solid rgba(201,165,92,0.22);
  color: var(--txt-1);
  padding: 3px 9px;
  border-radius: 3px;
  font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.08em;
  cursor: pointer; flex-shrink: 0;
  transition: background 120ms, border-color 120ms;
}
.pinstrip__chip:hover { background: rgba(201,165,92,0.16); border-color: rgba(201,165,92,0.45); }
.pinstrip__clear {
  background: none; border: 0; color: var(--txt-4);
  font-family: var(--font-mono); font-size: 9px; letter-spacing: 0.18em;
  cursor: pointer; padding: 4px 8px; margin-left: auto;
}
.pinstrip__clear:hover { color: var(--gold-bright); }
/* When pinstrip is visible, push the ticker tape down via real reflow (margin-top, not top — relative positioning doesn't reflow). */
body:has(.pinstrip) .ticker { margin-top: 28px; }

/* ---------- Toast (used by Enhancements) ---------- */
.gmg-toast {
  position: fixed; bottom: 80px; left: 50%; transform: translateX(-50%);
  background: linear-gradient(180deg, rgba(22,18,11,0.96), rgba(14,12,8,0.98));
  border: 1px solid rgba(201,165,92,0.42);
  color: var(--gold-bright);
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.14em;
  padding: 8px 14px; border-radius: 4px;
  z-index: 400;
  box-shadow: 0 8px 22px rgba(0,0,0,0.5);
  animation: toastIn 160ms ease, toastOut 220ms ease 1.55s forwards;
}
@keyframes toastIn { from { opacity: 0; transform: translateX(-50%) translateY(8px); } to { opacity: 1; transform: translateX(-50%); } }
@keyframes toastOut { to { opacity: 0; transform: translateX(-50%) translateY(8px); } }

/* ---------- P1-5 · Panel freshness pip (every panel header gets a live dot) ---------- */
.panel__h-r { position: relative; }
.panel__h-r::before {
  content: '';
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: #34D399;
  margin-right: 8px;
  box-shadow: 0 0 0 0 rgba(52,211,153,0.5);
  animation: livePipPulse 2.4s ease-in-out infinite;
  vertical-align: middle;
  flex-shrink: 0;
}
/* If the header already explicitly shows a .dot--live we suppress our pip to avoid duplication */
.panel__h-r:has(.dot--live)::before { display: none; }
.panel__h-r:has(.dot)::before { display: none; }
@keyframes livePipPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(52,211,153,0.45); opacity: 0.85; }
  50%      { box-shadow: 0 0 0 4px rgba(52,211,153,0); opacity: 1; }
}

/* ---------- Command-line suggestion + help overlay ---------- */
.cmdline__sug {
  position: absolute;
  left: 0; right: 0; bottom: calc(100% + 6px);
  background: linear-gradient(180deg, rgba(20,16,8,0.96), rgba(14,11,6,0.96));
  border: 1px solid rgba(201,165,92,0.32);
  border-radius: 4px;
  padding: 8px 12px;
  font-family: var(--font-mono);
  font-size: 11px;
  z-index: 60;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5), 0 0 0 1px rgba(201,165,92,0.08);
}
.cmdline__sug-row { display: flex; align-items: center; gap: 14px; }
.cmdline__sug-c { color: var(--gold-bright); font-weight: 600; letter-spacing: 0.08em; min-width: 90px; }
.cmdline__sug-h { color: var(--txt-2); flex: 1; }
.cmdline__sug-k { color: var(--txt-4); font-size: 10px; letter-spacing: 0.18em; }

.help-overlay {
  position: fixed; inset: 0;
  background: rgba(5,5,5,0.78);
  backdrop-filter: blur(10px) saturate(120%);
  -webkit-backdrop-filter: blur(10px) saturate(120%);
  z-index: 200; display: grid; place-items: center;
  animation: helpFade 220ms ease;
}
@keyframes helpFade { from { opacity: 0; } to { opacity: 1; } }
.help-overlay__panel {
  width: min(620px, 92vw);
  max-height: 80vh;
  background: linear-gradient(180deg, rgba(22,18,11,0.98), rgba(14,12,8,0.98));
  border: 1px solid rgba(201,165,92,0.34);
  border-radius: 6px;
  box-shadow: 0 18px 48px rgba(0,0,0,0.6), 0 0 0 1px rgba(201,165,92,0.10), inset 0 1px 0 rgba(255,231,166,0.08);
  display: flex; flex-direction: column;
  overflow: hidden;
}
.help-overlay__h {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid rgba(201,165,92,0.16);
  background: linear-gradient(180deg, rgba(201,165,92,0.08), transparent);
}
.help-overlay__title {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.28em;
  color: var(--gold-bright);
}
.help-overlay__close {
  background: none; border: 1px solid var(--hairline-2); color: var(--txt-2);
  font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.18em;
  padding: 4px 10px; border-radius: 3px; cursor: pointer;
}
.help-overlay__close:hover { color: var(--gold-bright); border-color: rgba(201,165,92,0.42); }
.help-overlay__body { padding: 8px 0; overflow-y: auto; }
.help-overlay__row {
  display: grid; grid-template-columns: 220px 1fr; gap: 16px;
  padding: 8px 18px;
  font-family: var(--font-mono); font-size: 12px;
}
.help-overlay__row:hover { background: rgba(201,165,92,0.05); }
.help-overlay__k { color: var(--gold); letter-spacing: 0.04em; }
.help-overlay__d { color: var(--txt-2); }
.help-overlay__foot {
  padding: 10px 18px; border-top: 1px solid rgba(201,165,92,0.12);
  font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.18em;
  color: var(--txt-4); text-align: center;
}

/* ---------- Cross-panel entity pulse (P0-4 hook) ---------- */
[data-entity].gmg-entity-pulse {
  animation: entityPulse 900ms ease;
  position: relative; z-index: 1;
}
@keyframes entityPulse {
  0%   { box-shadow: 0 0 0 0 rgba(201,165,92,0.0); background-color: transparent; }
  35%  { box-shadow: 0 0 0 2px rgba(230,201,136,0.55), 0 0 16px 2px rgba(201,165,92,0.45); background-color: rgba(201,165,92,0.10); }
  100% { box-shadow: 0 0 0 0 rgba(201,165,92,0); background-color: transparent; }
}

/* ---------- TickCell flash (Bloomberg signature) ---------- */
.tick-cell { position: relative; transition: color 220ms ease, background-color 220ms ease; }
.tick-cell::before {
  content: '';
  position: absolute;
  inset: -2px -4px;
  border-radius: 2px;
  pointer-events: none;
  opacity: 0;
  background: transparent;
  transition: opacity 360ms ease;
  z-index: -1;
}
/* Bloomberg-grade flash v3 — punchier attack + faster fade so price ticks
 * feel like a real terminal pulse, not a slow glow. 480ms total: full
 * intensity for first 35%, then ease-out fade. Saturation +30% on bg
 * gradient and halo. Adds a 1.05× scale punch that decays in 220ms. */
.tick-cell.tick-flash--up::before {
  opacity: 1;
  background: linear-gradient(180deg, rgba(52,211,153,0.55), rgba(52,211,153,0.12));
  box-shadow: 0 0 0 1px rgba(52,211,153,0.75), inset 0 0 18px rgba(52,211,153,0.24), 0 0 14px rgba(52,211,153,0.30);
  animation: tickFlashFade 480ms cubic-bezier(.2, .85, .35, 1) forwards;
}
.tick-cell.tick-flash--dn::before {
  opacity: 1;
  background: linear-gradient(180deg, rgba(248,113,113,0.55), rgba(248,113,113,0.12));
  box-shadow: 0 0 0 1px rgba(248,113,113,0.75), inset 0 0 18px rgba(248,113,113,0.24), 0 0 14px rgba(248,113,113,0.30);
  animation: tickFlashFade 480ms cubic-bezier(.2, .85, .35, 1) forwards;
}
.tick-cell.tick-flash--neutral::before {
  opacity: 1;
  background: rgba(201,165,92,0.24);
  box-shadow: 0 0 0 1px rgba(201,165,92,0.52);
  animation: tickFlashFade 480ms cubic-bezier(.2, .85, .35, 1) forwards;
}
@keyframes tickFlashFade {
  0%   { opacity: 1; }
  35%  { opacity: 1; }
  100% { opacity: 0; }
}
/* When TickCell sits inline (most cases) it should not break flow */
span.tick-cell { display: inline-block; }

/* ---------- CJK refinement layer (Plex Sans SC + Noto Serif SC) ---------- */
/* Wide Latin tracking translated to tight CJK tracking on the same elements */
html[lang^='zh'] .panel__title { letter-spacing: 0.08em; font-weight: 600; }
html[lang^='zh'] .panel__sub   { letter-spacing: 0.04em; }
html[lang^='zh'] .eyebrow,
html[lang^='zh'] .eyebrow-dim  { letter-spacing: 0.14em; }
html[lang^='zh'] .chip         { letter-spacing: 0.08em; font-weight: 500; }
html[lang^='zh'] .topbar__product { letter-spacing: 0.12em; }
html[lang^='zh'] .cmdline__brand  { letter-spacing: 0.08em; }
html[lang^='zh'] .row__tag        { letter-spacing: 0.06em; }
html[lang^='zh'] .macro-cell__lbl,
html[lang^='zh'] .liq-cell__lbl,
html[lang^='zh'] .heat-cell__cap  { letter-spacing: 0.06em; }
html[lang^='zh'] .brief__head,
html[lang^='zh'] .brief__foot,
html[lang^='zh'] .msg__role       { letter-spacing: 0.12em; }
html[lang^='zh'] .session-pill,
html[lang^='zh'] .quote__cat      { letter-spacing: 0.06em; }

/* ============================================================
 * AI Sheet — rich empty state, prompt cards, message copy, typing dots
 * ============================================================ */

/* Clickable brand button on cmdline */
.cmdline__brand--btn {
  background: none; border: 0; padding: 4px 8px;
  display: flex; align-items: center; gap: 8px;
  cursor: pointer;
  border-radius: 4px;
  transition: background 180ms, box-shadow 180ms;
  font-family: inherit;
  color: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  font-size: inherit;
}
.cmdline__brand--btn .caret { color: var(--gold); font-size: 14px; }
.cmdline__brand--btn:hover {
  background: rgba(201,165,92,0.10);
  box-shadow: inset 0 0 0 1px rgba(201,165,92,0.32);
}
.cmdline__brand--btn:hover .caret { animation: blink 1.1s steps(2) infinite; }

/* AI Sheet header polish */
.ai-sheet__mark {
  width: 24px; height: 24px; border-radius: 5px;
  display: grid; place-items: center;
  border: 1px solid rgba(201,165,92,0.5);
  background: radial-gradient(circle at 30% 30%, rgba(230,201,136,0.45), transparent 70%);
  color: var(--gold-bright); font-size: 12px;
  box-shadow: 0 0 10px rgba(201,165,92,0.2);
}
.ai-sheet__title {
  font-family: var(--font-mono);
  font-size: 11px; letter-spacing: 0.24em; font-weight: 600;
  color: var(--gold-bright);
}
.ai-sheet__feeds {
  font-family: var(--font-mono);
  font-size: 9.5px; letter-spacing: 0.18em;
  color: var(--txt-3);
  display: inline-flex; align-items: center; gap: 6px;
  padding-left: 12px;
  border-left: 1px solid rgba(201,165,92,0.18);
}
.ai-sheet__feed-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--up);
  box-shadow: 0 0 6px rgba(52,211,153,0.6);
  animation: livePipPulse 2.4s ease-in-out infinite;
}
.ai-sheet__close {
  background: none; border: 1px solid var(--hairline-2); color: var(--txt-2);
  font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.18em;
  padding: 5px 12px; border-radius: 4px; cursor: pointer;
  transition: all 180ms;
}
.ai-sheet__close:hover {
  color: var(--gold-bright);
  border-color: rgba(201,165,92,0.45);
  background: rgba(201,165,92,0.06);
}

/* Empty state — hero + prompt cards grid */
.ai-sheet__empty {
  display: flex; flex-direction: column; gap: 28px;
  align-items: center; justify-content: center;
  max-width: 920px; margin: 24px auto 16px;
  padding: 0 16px;
}
.ai-sheet__hero { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; }
.ai-sheet__glyph {
  font-family: var(--font-serif-display);
  font-size: 56px; line-height: 1;
  color: var(--gold);
  text-shadow: 0 0 24px rgba(201,165,92,0.45);
  letter-spacing: 0.02em;
  margin-bottom: 4px;
}
.ai-sheet__head {
  margin: 0;
  font-family: var(--font-serif-display);
  font-size: 28px; font-weight: 600;
  color: var(--txt-1);
  letter-spacing: -0.005em;
  text-wrap: balance;
}
.ai-sheet__dek {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 11.5px; letter-spacing: 0.10em;
  color: var(--txt-3);
  max-width: 620px;
  line-height: 1.6;
}

.ai-sheet__cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  width: 100%;
}
.ai-sheet__card {
  display: grid;
  grid-template-columns: 1fr 14px;
  grid-template-rows: auto auto;
  gap: 6px 8px;
  padding: 12px 14px;
  background: linear-gradient(180deg, rgba(201,165,92,0.04), rgba(0,0,0,0.18));
  border: 1px solid rgba(201,165,92,0.16);
  border-radius: 5px;
  cursor: pointer;
  text-align: left;
  font-family: var(--font-sans);
  transition: all 180ms;
  color: var(--txt-1);
}
.ai-sheet__card:hover {
  background: linear-gradient(180deg, rgba(201,165,92,0.10), rgba(0,0,0,0.20));
  border-color: rgba(201,165,92,0.40);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(201,165,92,0.10);
}
.ai-sheet__card-cat {
  grid-column: 1 / 2;
  font-family: var(--font-mono);
  font-size: 9px; font-weight: 600;
  letter-spacing: 0.22em;
  padding: 2px 6px;
  border-radius: 2px;
  width: max-content;
}
.ai-sheet__card-cat--analysis { color: var(--gold-bright); background: rgba(201,165,92,0.12); border: 1px solid rgba(201,165,92,0.28); }
.ai-sheet__card-cat--explain  { color: var(--info);        background: rgba(147,197,253,0.12); border: 1px solid rgba(147,197,253,0.28); }
.ai-sheet__card-cat--scenario { color: var(--gold-soft);   background: rgba(255,231,166,0.10); border: 1px solid rgba(255,231,166,0.28); }
.ai-sheet__card-cat--screen   { color: var(--up);          background: rgba(52,211,153,0.10);  border: 1px solid rgba(52,211,153,0.28); }
.ai-sheet__card-cat--flows    { color: var(--gold);        background: rgba(201,165,92,0.08);  border: 1px solid rgba(201,165,92,0.24); }
.ai-sheet__card-cat--risk     { color: var(--dn);          background: rgba(248,113,113,0.10); border: 1px solid rgba(248,113,113,0.28); }
.ai-sheet__card-q {
  grid-column: 1 / 2;
  font-size: 12.5px; line-height: 1.45;
  color: var(--txt-1);
  text-wrap: pretty;
}
.ai-sheet__card-arrow {
  grid-column: 2 / 3; grid-row: 1 / 3;
  align-self: center;
  color: var(--gold);
  font-size: 18px; line-height: 1;
  transition: transform 180ms, color 180ms;
}
.ai-sheet__card:hover .ai-sheet__card-arrow {
  color: var(--gold-bright);
  transform: translateX(2px);
}

.ai-sheet__hint {
  display: flex; align-items: center; gap: 6px;
  font-family: var(--font-mono);
  font-size: 10px; letter-spacing: 0.18em;
  color: var(--txt-4);
  flex-wrap: wrap;
  justify-content: center;
}
.ai-sheet__hint kbd {
  display: inline-block;
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 3px;
  padding: 1px 6px;
  font-family: var(--font-mono); font-size: 10px;
  color: var(--gold-bright);
}

/* Message head row — role icon + role + copy button on hover */
.msg__head {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--font-mono);
}
.msg__role-icon {
  width: 18px; height: 18px;
  display: grid; place-items: center;
  border-radius: 3px;
  font-size: 11px;
  border: 1px solid rgba(201,165,92,0.32);
  background: rgba(201,165,92,0.06);
  color: var(--gold-bright);
}
.msg--user .msg__role-icon {
  border-color: rgba(201,165,92,0.42);
  background: rgba(201,165,92,0.12);
}
.msg__copy {
  margin-left: auto;
  background: none; border: 1px solid var(--hairline-2);
  color: var(--txt-3);
  font-family: var(--font-mono); font-size: 9px;
  letter-spacing: 0.18em;
  padding: 2px 8px; border-radius: 2px;
  cursor: pointer;
  opacity: 0;
  transition: opacity 180ms, color 180ms, border-color 180ms;
}
.msg:hover .msg__copy { opacity: 1; }
.msg__copy:hover { color: var(--gold-bright); border-color: rgba(201,165,92,0.45); }

/* Typing dots — proper 3-dot indicator */
.msg__typing {
  display: inline-flex; gap: 4px; vertical-align: middle;
  margin-right: 8px;
}
.msg__typing-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--gold);
  animation: typingBounce 1.2s ease-in-out infinite;
}
.msg__typing-dot:nth-child(2) { animation-delay: 0.15s; }
.msg__typing-dot:nth-child(3) { animation-delay: 0.30s; }
.msg__typing-lbl {
  font-family: var(--font-mono); font-size: 11px;
  letter-spacing: 0.12em; color: var(--txt-3);
}
@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.55; }
  30% { transform: translateY(-4px); opacity: 1; }
}

/* Responsive — collapse cards to 2 cols on narrow */
@media (max-width: 820px) {
  .ai-sheet__cards { grid-template-columns: 1fr 1fr; }
  .ai-sheet__head { font-size: 22px; }
  .ai-sheet__glyph { font-size: 44px; }
}
@media (max-width: 480px) {
  .ai-sheet__cards { grid-template-columns: 1fr; }
}
html[lang^='zh'] .quote__name     { letter-spacing: 0.06em; }

/* Quote hero symbol — Plex Serif looks better at 600 than 700 */
.quote__sym { font-weight: 600; letter-spacing: 0; }
html[lang^='zh'] .quote__sym { font-weight: 600; letter-spacing: 0.02em; }

/* Plex Mono numerics — tighten the kerning for big price displays */
.quote__price, .macro-cell__val, .liq-cell__val { letter-spacing: -0.015em; }

/* Latin uppercase labels — Plex Sans is denser than Inter; nudge tracking up slightly */
.panel__title { font-weight: 600; }
.eyebrow      { font-weight: 600; }
.chip         { font-weight: 500; }

/* Body copy — slightly larger optical size feels right with Plex */
.row__body { font-size: 13px; }
.brief__b  { font-size: 13px; }

/* CJK never wants the 'italic' fallback that Plex Serif lacks */
em, i, .brief__b em, .brief__b .dn-em { font-style: normal; }

/* ---------- §4.6 panel focus mode — append-only block (doctrine §4.6) ----------
 * 桌面端 ⤢ 按钮 → 单 panel zoom-to-fill 近全屏 + backdrop。
 * 落到 app/lib/panel-expand.js 通过 MutationObserver 自动注入按钮。
 * 仅 transform/opacity 动画（§3.4.1 GPU 守则）；移动端整体 unset。 */
.panel__expand-btn {
  background: transparent;
  border: 1px solid var(--hairline);
  border-radius: 4px;
  padding: 4px 9px;             /* 触发区 ~28×23 桌面端足够稳点击 */
  min-width: 24px;
  min-height: 22px;
  cursor: zoom-in;              /* 浏览器原生 UX 信号："此处可放大"，零文字成本 */
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1;
  color: var(--txt-3);
  letter-spacing: 0.04em;
  transition: color 140ms ease-out, border-color 140ms ease-out, background-color 140ms ease-out;
}
.panel__expand-btn:hover {
  color: var(--gold-bright);
  border-color: var(--gold-bright);
}
.panel__expand-btn:focus-visible {
  outline: 1px solid var(--gold-bright);
  outline-offset: 2px;
}
/* Discoverability：hover 任意 panel 时 ⤢ 按钮自然亮起，潜意识告诉用户"这格可放大" — Grafana 同款手法 */
.panel:hover .panel__expand-btn:not([aria-expanded="true"]) {
  color: var(--gold-bright);
  border-color: var(--gold-bright);
}
/* 展开态：按钮明显高亮，强化 close affordance（小角金属点 → 大金按钮）*/
.panel__expand-btn[aria-expanded="true"] {
  cursor: zoom-out;
  color: var(--gold-bright);
  border-color: var(--gold-bright);
  background: rgba(201, 168, 106, 0.14);
}

/* 浮动 fallback：非标准头部（如 Brief 的 brief2__h）时绝对定位到 panel 右上 */
.panel__expand-btn--floating {
  position: absolute;
  top: 8px;
  right: 10px;
  z-index: 2;
  background: rgba(20, 17, 11, 0.78);
}

/* 占位兄弟节点：展开期间替原 panel 占住 grid cell，避免邻居重排 */
.panel-placeholder {
  background: transparent;
  pointer-events: none;
  min-height: 0;
}

.panel-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(8, 6, 4, 0.62);
  -webkit-backdrop-filter: blur(6px);
          backdrop-filter: blur(6px);
  z-index: 149;
  opacity: 0;
  pointer-events: none;
  transition: opacity 220ms ease-out;
}
.panel-backdrop.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.panel.panel--expanded {
  position: fixed;
  /* 居中 + 内容自适应。宽 max 1400px（宽屏不浪费，普通屏也合身）；
     高 min 360px（sparse 内容不会大片空白）/ max 85vh（dense 内容自然扩大，不顶到屏幕边）。
     对齐 Notion modal / Linear issue / TradingView chart maximize 的主流做法。 */
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(1400px, 84vw);
  max-width: none;            /* 防止 .panel base 任何潜在的 max-width 限制 */
  height: auto;               /* 覆盖 .panel { height: 100% }，让 flex 内容定高 */
  min-height: min(360px, 55vh);   /* sparse 内容也要明显 > 原 cell，体感"放大" */
  max-height: min(85vh, 900px);   /* 不顶到屏幕边，保留 backdrop 视觉留白 */
  z-index: 150;
  border-color: var(--gold-bright);    /* §3.1 金色守则 */
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.65);
  /* 无 fade 动画：@keyframes 在 Chrome hidden tab 下会 pause-at-from（opacity:0），
     导致面板隐形。瞬时切换对齐 Grafana View / Datadog Fullscreen 工业标准。 */
}
.panel.panel--expanded .panel__body {
  /* 展开后允许 body 内部滚动，原本可能是 overflow:hidden 的 panel 也得能滚 */
  overflow: auto;
}

@media (prefers-reduced-motion: reduce) {
  .panel-backdrop { transition: none !important; }
}

/* 移动端 killswitch：CSS 层兜底，与 JS 守卫互为冗余 */
@media (max-width: 899px) {
  .panel__expand-btn { display: none !important; }
  .panel.panel--expanded {
    position: relative !important;
    inset: auto !important;
    z-index: auto !important;
    box-shadow: none !important;
    animation: none !important;
    border-color: var(--hairline-2) !important;
  }
  .panel-backdrop,
  .panel-placeholder { display: none !important; }
}
