/* DEEP SWARM spectator — dark "deep mine" glass UI with BNB-yellow accents.
   Design tokens live on :root so other static pages (agents.html) can share them. */

:root {
  color-scheme: dark;

  /* surfaces */
  --bg: #06070b;
  --bg-2: #0c0e15;
  --void: #040408;
  --glass: rgba(14, 16, 24, 0.72);
  --glass-strong: rgba(12, 14, 21, 0.9);
  --glass-hi: rgba(255, 255, 255, 0.04);
  --stroke: rgba(255, 255, 255, 0.08);
  --stroke-2: rgba(255, 255, 255, 0.14);
  --shadow: 0 10px 40px rgba(0, 0, 0, 0.55), 0 2px 8px rgba(0, 0, 0, 0.4);

  /* text */
  --text: #eceef4;
  --text-2: #a7adbd;
  --text-3: #6c7286;

  /* brand + semantic */
  --accent: #F0B90B;
  --accent-2: #FCD535;
  --accent-ink: #1a1400;
  --accent-soft: rgba(240, 185, 11, 0.14);
  --accent-glow: rgba(240, 185, 11, 0.35);
  --good: #3ddc97;
  --bad: #ff5d5d;
  --warn: #ff9f43;
  --info: #5cc8ff;
  --sim: #8f96ab;

  /* ores (mirrored in app.js for canvas drawing) */
  --ore-copper: #e3894b;
  --ore-iron: #cdb9a4;
  --ore-gold: #f5c542;
  --ore-emerald: #39e58c;
  --ore-diamond: #8ff0ff;
  --ore-bnbcore: #F0B90B;

  /* type + shape */
  /* Latin faces first; CJK glyphs fall through to Noto Sans SC (then system CJK fonts). */
  --font-cjk: 'Noto Sans SC', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  --font-ui: 'Space Grotesk', 'Noto Sans SC', system-ui, -apple-system, 'Segoe UI', Roboto, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'Cascadia Mono', Consolas, 'Noto Sans SC', 'PingFang SC', 'Microsoft YaHei', monospace;
  --radius: 14px;
  --radius-sm: 9px;
  --gutter: 14px;
  --topbar-h: 56px;
  --dock-w: 344px;
  --sheet-h: 0px; /* height taken by the mobile bottom sheet (set by JS on phones) */
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

button { font: inherit; color: inherit; }
a { color: inherit; }
[hidden] { display: none !important; }

.mono { font-family: var(--font-mono); font-feature-settings: 'zero' 1; }

/* ------------------------------------------------------------------ canvas */

#view {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  cursor: grab;
  background: var(--void);
}
#view.dragging { cursor: grabbing; }
#view.hovering { cursor: pointer; }

/* ------------------------------------------------------------------ glass */

.glass {
  background: var(--glass);
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  box-shadow: var(--shadow), inset 0 1px 0 var(--glass-hi);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
}

/* ------------------------------------------------------------------ top bar */

.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 var(--gutter);
  padding-top: env(safe-area-inset-top);
  z-index: 20;
  background: linear-gradient(180deg, rgba(6, 7, 11, 0.92), rgba(6, 7, 11, 0.55));
  border-bottom: 1px solid var(--stroke);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  white-space: nowrap;
}
.brand .logo {
  width: 26px; height: 26px;
  flex: none;
  filter: drop-shadow(0 0 8px var(--accent-glow));
}
.brand b {
  font-weight: 700;
  letter-spacing: 0.16em;
  font-size: 15px;
}
.brand .sep { color: var(--text-3); }
.brand .mode { color: var(--text-2); }
.brand .live-dot {
  display: inline-block;
  width: 7px; height: 7px;
  margin-right: 6px;
  border-radius: 50%;
  background: var(--bad);
  box-shadow: 0 0 8px var(--bad);
  animation: pulse 1.6s ease-in-out infinite;
  vertical-align: 1px;
}
.brand .tagline { color: var(--text-3); overflow: hidden; text-overflow: ellipsis; }
.brand .tagline em { font-style: normal; color: var(--accent); font-family: var(--font-mono); }

.status {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text-3);
  white-space: nowrap;
}
.status b { color: var(--text); font-weight: 500; }

.conn { display: inline-flex; align-items: center; gap: 7px; }
.conn i {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--warn);
  box-shadow: 0 0 8px var(--warn);
}
.conn[data-state='live'] i { background: var(--good); box-shadow: 0 0 8px var(--good); }
.conn[data-state='down'] i { background: var(--bad); box-shadow: 0 0 8px var(--bad); animation: pulse 1s infinite; }

.cta {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 14px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 700;
  font-size: 13px;
  text-decoration: none;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.12) inset, 0 6px 20px rgba(240, 185, 11, 0.25);
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.cta:hover { background: var(--accent-2); transform: translateY(-1px); box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.2) inset, 0 8px 26px rgba(240, 185, 11, 0.38); }
.cta:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
.cta .cta-short { display: none; }

.brand .brand-zh {
  font-family: var(--font-cjk);
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin-left: -2px;
}
.brand .brand-zh:empty { display: none; }

/* language toggle: EN | 中文 */
.lang-toggle {
  flex: none;
  display: inline-flex;
  align-items: center;
  height: 30px;
  padding: 0 3px;
  border-radius: 999px;
  border: 1px solid var(--stroke-2);
  background: rgba(255, 255, 255, 0.03);
  font-size: 12px;
}
.lang-toggle button {
  height: 24px;
  min-width: 34px;
  padding: 0 8px;
  border: 0;
  border-radius: 999px;
  background: none;
  color: var(--text-3);
  font-weight: 600;
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
}
.lang-toggle button[lang='en'] { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.06em; }
.lang-toggle button[lang='zh-CN'] { font-family: var(--font-cjk); }
.lang-toggle button:hover { color: var(--text); }
.lang-toggle button[aria-pressed='true'] { color: var(--accent-ink); background: var(--accent); }
.lang-toggle button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.lang-toggle .lt-sep { color: var(--text-3); opacity: 0.5; padding: 0 1px; font-size: 11px; }

/* ------------------------------------------------------------------ map overlay (minimap + controls) */

.map-ui {
  position: fixed;
  left: var(--gutter);
  bottom: calc(var(--gutter) + var(--sheet-h) + env(safe-area-inset-bottom));
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: flex-start;
  pointer-events: none;
}
.map-ui > * { pointer-events: auto; }

.controls {
  display: flex;
  gap: 6px;
  padding: 6px;
  border-radius: 12px;
}
.ctl {
  height: 32px;
  min-width: 32px;
  padding: 0 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid var(--stroke);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-2);
  font-size: 12px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  user-select: none;
}
.ctl:hover { background: rgba(255, 255, 255, 0.08); color: var(--text); }
.ctl:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.ctl svg { width: 16px; height: 16px; }
.ctl[aria-pressed='true'] { color: var(--accent); border-color: rgba(240, 185, 11, 0.4); background: var(--accent-soft); }

.minimap {
  position: relative;
  padding: 8px;
  border-radius: 12px;
}
.minimap canvas {
  display: block;
  width: 192px;
  height: 144px;
  border-radius: 6px;
  image-rendering: pixelated;
  cursor: crosshair;
  touch-action: none;
}
.minimap .mm-label {
  position: absolute;
  top: 12px; left: 14px;
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.12em;
  color: rgba(255, 255, 255, 0.55);
  pointer-events: none;
  text-shadow: 0 1px 2px #000;
}

/* ------------------------------------------------------------------ dock (right column of panels) */

.dock {
  position: fixed;
  top: calc(var(--topbar-h) + var(--gutter));
  right: var(--gutter);
  bottom: var(--gutter);
  width: var(--dock-w);
  z-index: 15;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.12) transparent;
  pointer-events: none;
}
.dock > * { pointer-events: auto; }
.dock-tabs { display: none; }

.panel { flex: none; overflow: hidden; }
.panel.grow { flex: 1 1 auto; min-height: 180px; display: flex; flex-direction: column; }
.panel.grow.collapsed { flex: none; min-height: 0; }

.panel-head {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 11px 14px;
  border: 0;
  background: none;
  text-align: left;
  cursor: pointer;
}
.panel-head h2 {
  margin: 0;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-2);
}
.panel-head .hint { margin-left: auto; font-family: var(--font-mono); font-size: 11px; color: var(--text-3); }
.panel-head .chev {
  width: 14px; height: 14px;
  color: var(--text-3);
  transition: transform 0.2s ease;
}
.panel-head .hint + .chev { margin-left: 4px; }
.panel-head h2 + .chev { margin-left: auto; }
.panel.collapsed .chev { transform: rotate(-90deg); }
.panel.collapsed .panel-body { display: none; }
.panel-head:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; border-radius: var(--radius); }

.panel-body { padding: 0 14px 14px; }
.panel.grow .panel-body { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }

/* ---- treasury */

.treasury-top { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; }
.big-num {
  font-family: var(--font-mono);
  font-size: 30px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.05;
  color: var(--text);
}
.big-num small { font-size: 14px; color: var(--accent); font-weight: 600; margin-left: 4px; letter-spacing: 0; }
.label { font-size: 10.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-3); }
.badge {
  display: inline-flex;
  align-items: center;
  height: 18px;
  padding: 0 6px;
  border-radius: 5px;
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  vertical-align: middle;
}
.badge.demo { background: rgba(255, 159, 67, 0.16); color: var(--warn); border: 1px solid rgba(255, 159, 67, 0.35); }
.badge.sim { background: rgba(143, 150, 171, 0.14); color: var(--sim); border: 1px solid rgba(143, 150, 171, 0.3); }
.badge.real { background: var(--accent-soft); color: var(--accent); border: 1px solid rgba(240, 185, 11, 0.4); }

.epoch {
  margin-top: 14px;
  padding: 12px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--stroke);
}
.epoch-row { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.countdown { font-family: var(--font-mono); font-size: 22px; font-weight: 600; color: var(--accent); text-shadow: 0 0 18px var(--accent-glow); }
.progress {
  position: relative;
  height: 6px;
  margin: 10px 0 10px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
}
.progress > i {
  position: absolute; inset: 0 auto 0 0;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, #a77d00, var(--accent) 60%, var(--accent-2));
  box-shadow: 0 0 12px var(--accent-glow);
  transition: width 0.5s linear;
}
.kv { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; font-size: 12.5px; }
.kv dt { color: var(--text-2); }
.kv dd { margin: 0; font-family: var(--font-mono); text-align: right; color: var(--text); }
.kv dd.accent { color: var(--accent); }

.winners { margin-top: 12px; }
.winners ol { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 4px; }
.winners li { display: flex; align-items: center; gap: 8px; font-size: 12.5px; }
.winners li .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.winners li .amt { font-family: var(--font-mono); color: var(--accent); font-size: 12px; }
.note { margin: 10px 0 0; font-size: 11.5px; color: var(--text-3); }
.ca { display: flex; align-items: center; gap: 8px; margin: 10px 0 0; padding: 7px 9px; border: 1px solid rgba(240, 185, 11, 0.35); border-radius: 8px; background: rgba(240, 185, 11, 0.06); font-size: 11.5px; }
.ca-label { color: var(--text-3); white-space: nowrap; }
.ca-addr { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; font-family: var(--font-mono); color: #F0B90B; text-decoration: none; }
.ca-addr:hover { text-decoration: underline; }
.ca-copy { flex: none; font: inherit; font-size: 11px; padding: 3px 8px; border-radius: 6px; border: 1px solid rgba(240, 185, 11, 0.45); background: transparent; color: #F0B90B; cursor: pointer; }
.ca-copy:hover { background: rgba(240, 185, 11, 0.12); }
.disclaimer { margin: 6px 0 0; font-size: 10.5px; color: var(--text-3); opacity: 0.75; }

/* ---- tabs */

.seg {
  display: flex;
  gap: 4px;
  padding: 3px;
  margin-bottom: 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--stroke);
}
.seg button {
  flex: 1;
  height: 28px;
  border: 0;
  border-radius: 7px;
  background: none;
  color: var(--text-2);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.seg button[aria-selected='true'] { background: rgba(255, 255, 255, 0.08); color: var(--text); box-shadow: inset 0 0 0 1px var(--stroke-2); }
.seg button:focus-visible { outline: 2px solid var(--accent); outline-offset: -1px; }

/* ---- leaderboard */

.lb {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 2px;
  max-height: min(300px, 26vh);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.12) transparent;
}
.lb-row {
  position: relative;
  display: grid;
  grid-template-columns: 22px 10px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 8px;
  cursor: pointer;
  overflow: hidden;
  font-size: 12.5px;
}
.lb-row:hover { background: rgba(255, 255, 255, 0.05); }
.lb-row.selected { background: var(--accent-soft); box-shadow: inset 0 0 0 1px rgba(240, 185, 11, 0.35); }
.lb-row .bar {
  position: absolute; left: 0; top: 0; bottom: 0;
  background: linear-gradient(90deg, rgba(240, 185, 11, 0.09), rgba(240, 185, 11, 0.02));
  pointer-events: none;
}
.lb-row > :not(.bar) { position: relative; }
.lb-row .rk { font-family: var(--font-mono); font-size: 11px; color: var(--text-3); text-align: right; }
.lb-row:nth-child(1) .rk { color: var(--accent); }
.lb-row:nth-child(2) .rk { color: #d6dbe6; }
.lb-row:nth-child(3) .rk { color: #d88c4f; }
.dot { width: 9px; height: 9px; border-radius: 3px; box-shadow: 0 0 6px currentColor; background: currentColor; }
.lb-row .nm { display: flex; align-items: center; gap: 6px; min-width: 0; }
.lb-row .nm span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-row .pts { font-family: var(--font-mono); font-size: 12px; color: var(--text); }
.empty { padding: 14px 6px; color: var(--text-3); font-size: 12.5px; text-align: center; }

/* ---- feed */

.feed {
  list-style: none;
  margin: 0;
  padding: 0;
  flex: 1 1 auto;
  min-height: 120px;
  max-height: 100%;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.12) transparent;
  mask-image: linear-gradient(180deg, #000 85%, transparent);
  -webkit-mask-image: linear-gradient(180deg, #000 85%, transparent);
}
.feed li {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  gap: 8px;
  padding: 6px 4px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  font-size: 12.5px;
  color: var(--text-2);
  cursor: default;
  animation: feed-in 0.35s ease-out;
}
.feed li.clickable { cursor: pointer; }
.feed li.clickable:hover { background: rgba(255, 255, 255, 0.03); }
.feed .ic {
  width: 20px; height: 20px;
  display: grid; place-items: center;
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.05);
}
.feed .who { color: var(--text); font-weight: 600; }
.feed .ore { font-weight: 700; }
.feed .amt { font-family: var(--font-mono); color: var(--accent); }
.feed .meta { color: var(--text-3); font-family: var(--font-mono); font-size: 10.5px; margin-left: 4px; }
.feed li.ev-epoch { background: linear-gradient(90deg, var(--accent-soft), transparent); border-radius: 6px; }

/* ------------------------------------------------------------------ inspector */

.inspector {
  position: fixed;
  top: calc(var(--topbar-h) + var(--gutter));
  left: var(--gutter);
  width: 320px;
  max-height: calc(100% - var(--topbar-h) - 2 * var(--gutter) - 260px);
  min-height: 0;
  z-index: 16;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: slide-in 0.25s ease-out;
}
.insp-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 12px 10px 14px;
  border-bottom: 1px solid var(--stroke);
}
.insp-swatch {
  width: 30px; height: 30px; flex: none;
  border-radius: 8px;
  box-shadow: 0 0 14px currentColor, inset 0 0 0 2px rgba(0, 0, 0, 0.25);
  background: currentColor;
}
.insp-title { min-width: 0; flex: 1; }
.insp-title h3 { margin: 0; font-size: 15px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.insp-title .sub { font-family: var(--font-mono); font-size: 11px; color: var(--text-3); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.icon-btn {
  width: 30px; height: 30px; flex: none;
  display: grid; place-items: center;
  border: 1px solid var(--stroke);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-2);
  cursor: pointer;
}
.icon-btn:hover { color: var(--text); background: rgba(255, 255, 255, 0.08); }
.icon-btn[aria-pressed='true'] { color: var(--accent); border-color: rgba(240, 185, 11, 0.4); background: var(--accent-soft); }
.icon-btn svg { width: 15px; height: 15px; }
.icon-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.insp-body {
  padding: 12px 14px 14px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.12) transparent;
  display: grid;
  gap: 14px;
}
.state-chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 1px 7px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-2);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.state-chip::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.state-chip[data-s='mining'] { color: var(--accent); }
.state-chip[data-s='moving'], .state-chip[data-s='returning'] { color: var(--info); }
.state-chip[data-s='selling'], .state-chip[data-s='charging'] { color: var(--good); }
.state-chip[data-s='stunned'] { color: var(--bad); }

.meter { display: grid; gap: 5px; }
.meter-top { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--text-2); }
.meter-top b { font-family: var(--font-mono); font-weight: 500; color: var(--text); }
.meter .progress { margin: 0; height: 7px; }
.meter.energy .progress > i { background: linear-gradient(90deg, #1f9d6a, var(--good)); box-shadow: 0 0 10px rgba(61, 220, 151, 0.4); }
.meter.energy.low .progress > i { background: linear-gradient(90deg, #a52b2b, var(--bad)); box-shadow: 0 0 10px rgba(255, 93, 93, 0.5); }
.meter.cargo .progress > i { background: linear-gradient(90deg, #a1620f, var(--warn)); box-shadow: 0 0 10px rgba(255, 159, 67, 0.4); }

.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.stat {
  padding: 8px 6px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--stroke);
  text-align: center;
  min-width: 0;
}
.stat b { display: block; font-family: var(--font-mono); font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.stat span { font-size: 9.5px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-3); }

.sec-title { margin: 0 0 7px; font-size: 10.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-3); font-weight: 600; }

.levels { display: grid; grid-template-columns: 62px 1fr 18px; gap: 5px 8px; align-items: center; font-size: 11.5px; }
.levels .pname { color: var(--text-2); text-transform: capitalize; }
.levels .pips { display: grid; grid-template-columns: repeat(10, 1fr); gap: 2px; }
.levels .pips i { height: 7px; border-radius: 2px; background: rgba(255, 255, 255, 0.07); }
.levels .pips i.on { background: var(--accent); box-shadow: 0 0 6px var(--accent-glow); }
.levels .lv { font-family: var(--font-mono); color: var(--text); text-align: right; }

.chips { display: flex; flex-wrap: wrap; gap: 5px; }
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 8px;
  border-radius: 99px;
  border: 1px solid var(--stroke);
  background: rgba(255, 255, 255, 0.03);
  font-size: 11.5px;
  color: var(--text-2);
}
.chip b { font-family: var(--font-mono); color: var(--text); font-weight: 500; }
.chip .o { width: 7px; height: 7px; border-radius: 2px; background: currentColor; transform: rotate(45deg); }
.chip .ord { font-family: var(--font-mono); font-size: 10px; color: var(--text-3); }

.strategy { display: grid; gap: 7px; font-size: 12px; }
.strategy .row { display: flex; justify-content: space-between; gap: 10px; color: var(--text-2); }
.strategy .row b { font-family: var(--font-mono); font-weight: 500; color: var(--text); text-align: right; }

.muted { color: var(--text-3); }

/* ------------------------------------------------------------------ toast */

.toasts {
  position: fixed;
  top: calc(var(--topbar-h) + 18px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 30;
  display: grid;
  gap: 8px;
  justify-items: center;
  pointer-events: none;
  width: min(520px, calc(100% - 2 * var(--gutter)));
}
.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-radius: 12px;
  background: var(--glass-strong);
  border: 1px solid rgba(240, 185, 11, 0.45);
  box-shadow: var(--shadow), 0 0 30px rgba(240, 185, 11, 0.18);
  font-size: 13px;
  animation: toast-in 0.35s cubic-bezier(.2, 1.4, .4, 1), toast-out 0.5s ease-in forwards;
  animation-delay: 0s, var(--ttl, 5s);
}
.toast .t-ic { width: 22px; height: 22px; flex: none; }
.toast b { color: var(--accent); }

/* ------------------------------------------------------------------ animations */

@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }
@keyframes feed-in { from { opacity: 0; transform: translateY(-4px); background: var(--accent-soft); } to { opacity: 1; transform: none; } }
@keyframes slide-in { from { opacity: 0; transform: translateX(-10px); } to { opacity: 1; transform: none; } }
@keyframes toast-in { from { opacity: 0; transform: translateY(-12px) scale(0.96); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateY(-8px); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition: none !important; }
}

/* ------------------------------------------------------------------ Simplified Chinese */
/* CJK has no case and looks broken with wide tracking: drop uppercase spacing, nudge sizes up a touch. */

html[lang='zh-CN'] .panel-head h2,
html[lang='zh-CN'] .label,
html[lang='zh-CN'] .sec-title,
html[lang='zh-CN'] .stat span,
html[lang='zh-CN'] .state-chip,
html[lang='zh-CN'] .minimap .mm-label {
  letter-spacing: 0.04em;
  text-transform: none;
}
html[lang='zh-CN'] .badge { letter-spacing: 0.02em; }
html[lang='zh-CN'] .panel-head h2 { font-size: 12.5px; }
html[lang='zh-CN'] .label { font-size: 11.5px; }
html[lang='zh-CN'] .sec-title { font-size: 11.5px; }
html[lang='zh-CN'] .stat span { font-size: 10.5px; }
html[lang='zh-CN'] .state-chip { font-size: 11px; }
html[lang='zh-CN'] .levels { grid-template-columns: 50px 1fr 18px; }
html[lang='zh-CN'] .feed li { line-height: 1.55; }
html[lang='zh-CN'] .status .opt > span { font-family: var(--font-cjk); }
html[lang='zh-CN'] .stat b { white-space: nowrap; }

/* ------------------------------------------------------------------ medium screens */

@media (max-width: 1100px) {
  :root { --dock-w: 300px; }
  .brand .tagline { display: none; }
}

/* ------------------------------------------------------------------ phones / narrow: dock becomes a bottom sheet */

@media (max-width: 760px) {
  :root { --gutter: 10px; --topbar-h: 52px; }

  .topbar { gap: 10px; }
  .brand b { font-size: 13px; letter-spacing: 0.12em; }
  .brand .mode-wrap, .brand .sep { display: none; }
  .status .opt { display: none; }
  .cta { height: 30px; padding: 0 11px; font-size: 12px; }
  .cta .long { display: none; }
  .cta .cta-long { display: none; }
  .cta .cta-short { display: inline; }
  .brand .brand-zh { display: none; }
  .lang-toggle { height: 28px; }
  .lang-toggle button { height: 22px; min-width: 30px; padding: 0 6px; }
  .lang-toggle .lt-sep { display: none; }

  .dock {
    top: auto;
    left: 0; right: 0; bottom: 0;
    width: auto;
    max-height: 46vh;
    gap: 0;
    overflow: hidden;
    border-radius: 18px 18px 0 0;
    background: var(--glass-strong);
    border-top: 1px solid var(--stroke-2);
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .dock-tabs {
    display: flex;
    gap: 4px;
    padding: 8px 10px;
    flex: none;
    border-bottom: 1px solid var(--stroke);
  }
  .dock-tabs button {
    flex: 1;
    height: 34px;
    border: 0;
    border-radius: 9px;
    background: none;
    color: var(--text-2);
    font-weight: 600;
    font-size: 12.5px;
    cursor: pointer;
  }
  .dock-tabs button[aria-selected='true'] { background: var(--accent-soft); color: var(--accent); }
  .dock.sheet-closed .dock-tabs button[aria-selected='true'] { background: rgba(255, 255, 255, 0.06); color: var(--text); }

  .dock .panel {
    display: none;
    border: 0;
    border-radius: 0;
    background: none;
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
  .dock .panel.active { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; overflow-y: auto; }
  .dock.sheet-closed .panel.active { display: none; }
  .dock .panel .panel-head { display: none; }
  .dock .panel.collapsed .panel-body { display: flex; flex-direction: column; }
  .dock .panel .panel-body { padding-top: 12px; }
  .feed { mask-image: none; -webkit-mask-image: none; }
  .lb { max-height: none; overflow: visible; }

  .map-ui { gap: 6px; }
  .minimap { padding: 5px; }
  .minimap canvas { width: 104px; height: 78px; }
  .minimap .mm-label { top: 8px; left: 9px; }
  .controls { padding: 4px; gap: 4px; }
  .ctl { height: 30px; min-width: 30px; padding: 0 7px; }
  .ctl .ctl-text { display: none; }

  .inspector {
    left: var(--gutter);
    right: var(--gutter);
    width: auto;
    max-height: calc(100% - var(--topbar-h) - var(--sheet-h) - 3 * var(--gutter) - 150px);
  }
  .stat-grid { grid-template-columns: repeat(4, 1fr); }
  .big-num { font-size: 26px; }
}

@media (max-width: 380px) {
  .status { display: none; }
}
