/* ═══════════════════════════════════════════════════════════
   OTCstack — design system
   Paper-light by default, inverted ink for dark. Desktop terminal.
   ═══════════════════════════════════════════════════════════ */

:root {
  --paper: #f3f0ea;
  --paper-2: #ebe7df;
  --paper-3: #e2ddd2;
  --card: #fbfaf7;
  --ink: #121211;
  --ink-2: #46433e;
  --ink-3: #8d887f;
  --line: #dcd6cb;
  --line-2: #c8c1b3;
  --panel: #131312;
  --panel-2: #1d1c1a;
  --panel-3: #2a2926;
  --panel-ink: #efebe3;
  --panel-dim: #8c877e;
  --accent: #2433ff;
  --accent-soft: rgba(36, 51, 255, .1);
  --up: #0d8a4e;
  --down: #d4391d;
  --up-soft: rgba(13, 138, 78, .12);
  --down-soft: rgba(212, 57, 29, .12);
  --t-exchange: #2433ff;
  --t-lp: #0d8a4e;
  --t-team: #d98a00;
  --t-unknown: #9a958c;
  --t-burn: #c8c1b3;
  --t-program: #7d4fe0;
  --t-locked: #128c99;
  --dot: rgba(18, 18, 17, .13);

  --serif: 'Instrument Serif', 'Times New Roman', serif;
  --sans: 'Geist', 'Inter', system-ui, sans-serif;
  --mono: 'Geist Mono', 'JetBrains Mono', ui-monospace, monospace;

  --r: 14px;
  --ease: cubic-bezier(.22, 1, .36, 1);
  --ease-io: cubic-bezier(.65, 0, .35, 1);
  color-scheme: light;
}

:root[data-theme="dark"] {
  --paper: #0e0e0d;
  --paper-2: #161614;
  --paper-3: #1f1e1c;
  --card: #151513;
  --ink: #efebe3;
  --ink-2: #b9b4aa;
  --ink-3: #6f6b64;
  --line: #262522;
  --line-2: #36342f;
  /* the dark panel flips to paper in dark mode */
  --panel: #f1ede5;
  --panel-2: #e6e1d7;
  --panel-3: #d6d0c4;
  --panel-ink: #131312;
  --panel-dim: #77726a;
  --accent: #8189ff;
  --accent-soft: rgba(129, 137, 255, .14);
  --up: #34d27f;
  --down: #ff6040;
  --up-soft: rgba(52, 210, 127, .13);
  --down-soft: rgba(255, 96, 64, .13);
  --t-exchange: #8189ff;
  --t-lp: #34d27f;
  --t-team: #ffb02e;
  --t-unknown: #6f6b64;
  --t-burn: #3a3833;
  --t-program: #a787ff;
  --t-locked: #3cc6d3;
  --dot: rgba(239, 235, 227, .09);
  color-scheme: dark;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { background: var(--paper); }
body {
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--paper);
  min-width: 1280px;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "ss01", "cv11";
  transition: background .5s var(--ease), color .5s var(--ease);
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input, select { font: inherit; color: inherit; }
::selection { background: var(--accent); color: #fff; }
.num, .mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* ───────── shell ───────── */

.shell {
  display: grid;
  grid-template-columns: 104px minmax(0, 1fr) 60px;
  min-height: 100vh;
}

/* left rail — vertical navigation */
.rail-l {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column;
  border-right: 1px solid var(--line);
  background: var(--paper);
  z-index: 20;
}
.brand {
  height: 104px; flex: none;
  display: grid; place-items: center;
  background: var(--ink); color: var(--paper);
  position: relative; overflow: hidden;
}
.brand pre {
  font-family: var(--mono); font-size: 7px; line-height: 7px;
  letter-spacing: 0; opacity: .9; user-select: none;
}
.brand .word {
  position: absolute; bottom: 8px; left: 0; right: 0;
  text-align: center; font-family: var(--mono); font-size: 9.5px;
  letter-spacing: .22em; text-transform: uppercase; opacity: .7;
}
.nav { flex: 1; display: flex; flex-direction: column; }
.nav a {
  flex: 1; position: relative; overflow: hidden;
  display: flex; flex-direction: column; align-items: center; justify-content: space-between;
  padding: 18px 0 22px;
  border-bottom: 1px solid var(--line);
  transition: background .35s var(--ease), color .35s var(--ease);
}
.nav a::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--accent); transform: scaleY(0); transform-origin: bottom;
  transition: transform .45s var(--ease);
}
.nav a:hover::before { transform: scaleY(1); }
.nav a:hover { background: var(--paper-2); }
.nav .n { font-family: var(--mono); font-size: 11px; color: var(--ink-3); letter-spacing: .08em; }
.nav .v {
  writing-mode: vertical-rl; transform: rotate(180deg);
  font-family: var(--mono); font-size: 11.5px; letter-spacing: .24em; text-transform: uppercase;
  white-space: nowrap;
}
.nav .g {
  font-family: var(--mono); font-size: 10px; line-height: 10px; color: var(--ink-3);
  white-space: pre; transition: color .3s;
}
.nav a:hover .g { color: var(--accent); }
.nav a.on { background: var(--ink); color: var(--paper); }
.nav a.on .n, .nav a.on .g { color: var(--paper); opacity: .6; }
.nav a.on::after {
  content: ''; position: absolute; right: 10px; top: 20px; width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent); animation: beat 1.8s var(--ease-io) infinite;
}
.nav-tip {
  position: fixed; left: 112px; z-index: 50; pointer-events: none;
  background: var(--ink); color: var(--paper);
  padding: 12px 14px; border-radius: 10px; width: 250px;
  font-size: 12.5px; line-height: 1.4;
  opacity: 0; transform: translateX(-8px);
  transition: opacity .25s var(--ease), transform .35s var(--ease), top .35s var(--ease);
}
.nav-tip b { display: block; font-family: var(--serif); font-weight: 400; font-size: 22px; margin-bottom: 4px; }
.nav-tip.show { opacity: 1; transform: none; }
.rail-foot { flex: none; border-top: 1px solid var(--line); }
.theme-btn {
  width: 100%; height: 76px; display: grid; place-items: center; gap: 4px;
  font-family: var(--mono); font-size: 10px; letter-spacing: .16em; text-transform: uppercase; color: var(--ink-2);
  transition: background .3s;
}
.theme-btn:hover { background: var(--paper-2); }
.theme-btn .sw {
  width: 34px; height: 18px; border-radius: 10px; border: 1px solid var(--ink); position: relative;
}
.theme-btn .sw::after {
  content: ''; position: absolute; top: 2px; left: 2px; width: 12px; height: 12px; border-radius: 50%;
  background: var(--ink); transition: transform .45s var(--ease);
}
:root[data-theme="dark"] .theme-btn .sw::after { transform: translateX(16px); }

/* right rail — live status, rotated */
.rail-r {
  position: sticky; top: 0; height: 100vh;
  border-left: 1px solid var(--line);
  display: flex; flex-direction: column; align-items: center;
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .18em; text-transform: uppercase; color: var(--ink-2);
  z-index: 20; background: var(--paper);
}
.rail-r .live { height: 104px; display: grid; place-items: center; border-bottom: 1px solid var(--line); width: 100%; }
.pulse-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--up); position: relative; }
.pulse-dot::after {
  content: ''; position: absolute; inset: -6px; border-radius: 50%; border: 1px solid var(--up);
  animation: ring 2s var(--ease) infinite;
}
.vtxt { writing-mode: vertical-rl; white-space: nowrap; }
.rail-r .marquee { flex: 1; overflow: hidden; width: 100%; display: flex; justify-content: center; border-bottom: 1px solid var(--line); }
.rail-r .marquee .vtxt { animation: vscroll 40s linear infinite; color: var(--ink-3); }
.rail-r .clock, .rail-r .sol { padding: 18px 0; width: 100%; display: flex; justify-content: center; border-bottom: 1px solid var(--line); }
.rail-r .sol b { color: var(--ink); font-weight: 500; }

/* ───────── main canvas ───────── */

.main {
  position: relative;
  padding: 0 44px 120px;
  background-image: radial-gradient(var(--dot) 1px, transparent 1px);
  background-size: 22px 22px;
  background-position: 11px 11px;
}
.cross { position: absolute; width: 28px; height: 28px; pointer-events: none; color: var(--line-2); }
.cross::before, .cross::after { content: ''; position: absolute; background: currentColor; }
.cross::before { left: 50%; top: 0; bottom: 0; width: 1px; }
.cross::after { top: 50%; left: 0; right: 0; height: 1px; }
.cross span { position: absolute; inset: 7px; border: 1px solid currentColor; border-radius: 50%; }

/* command bar */
.cmd {
  position: relative;
  height: 104px; display: flex; align-items: center; justify-content: space-between; gap: 32px;
  border-bottom: 1px solid var(--line);
}
.crumb { font-family: var(--mono); font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: var(--ink-3); }
.crumb b { color: var(--ink); font-weight: 500; }
.paste {
  display: flex; align-items: center; gap: 14px; width: min(620px, 52%);
}
.paste .field {
  flex: 1; position: relative; border-bottom: 1px solid var(--ink-2);
  transition: border-color .3s;
}
.paste .field:focus-within { border-color: var(--accent); }
.paste input {
  width: 100%; border: 0; outline: 0; background: transparent;
  padding: 12px 0; font-family: var(--mono); font-size: 13px;
}
.paste input::placeholder { color: var(--ink-3); }
.paste .hint { position: absolute; right: 0; top: 50%; transform: translateY(-50%); font-family: var(--mono); font-size: 10px; color: var(--ink-3); letter-spacing: .12em; }
.go {
  width: 52px; height: 52px; border-radius: 50%; border: 1px solid var(--ink);
  display: grid; place-items: center; flex: none;
  transition: background .3s var(--ease), color .3s var(--ease), transform .3s var(--ease);
}
.go:hover { background: var(--ink); color: var(--paper); }
.go svg { width: 18px; height: 18px; transition: transform .4s var(--ease); }
.go:hover svg { transform: rotate(45deg); }

/* page header */
.head {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 40px;
  padding: 54px 0 40px;
}
.head.flip { grid-template-columns: auto minmax(0, 1fr); }
.head.flip .head-copy { text-align: right; }
.head.flip .head-copy .lede { margin-left: auto; }
.kicker { font-family: var(--mono); font-size: 11px; letter-spacing: .18em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 20px; }
.kicker b { color: var(--accent); font-weight: 500; }
h1 {
  font-family: var(--serif); font-weight: 400;
  font-size: clamp(64px, 6.4vw, 104px); line-height: .9; letter-spacing: -.025em;
}
h1 i { font-style: italic; color: var(--ink-2); }
.lede { max-width: 520px; margin-top: 22px; color: var(--ink-2); font-size: 15px; line-height: 1.55; }

/* ascii characters */
.char {
  position: relative; cursor: crosshair; user-select: none;
  padding: 10px; border-radius: var(--r);
  transition: background .4s var(--ease);
}
.char pre {
  font-family: var(--mono); font-size: 9px; line-height: 9px; letter-spacing: .5px;
  color: var(--ink); white-space: pre;
}
.char .who {
  display: flex; justify-content: space-between; gap: 18px; margin-top: 10px;
  font-family: var(--mono); font-size: 10px; letter-spacing: .16em; text-transform: uppercase; color: var(--ink-3);
}
.char .who b { color: var(--ink); font-weight: 500; }
.char:hover { background: var(--paper-2); }
.char .bubble {
  position: absolute; top: 4px; right: 100%; margin-right: 8px; width: 220px;
  background: var(--ink); color: var(--paper); border-radius: 12px 12px 2px 12px;
  padding: 10px 12px; font-size: 12.5px; line-height: 1.4;
  opacity: 0; transform: translateY(6px) scale(.97); transform-origin: right top;
  transition: opacity .3s var(--ease), transform .4s var(--ease); pointer-events: none;
}
.head.flip .char .bubble { right: auto; left: 100%; margin-left: 8px; margin-right: 0; border-radius: 12px 12px 12px 2px; }
.char:hover .bubble { opacity: 1; transform: none; }

/* ───────── primitives ───────── */

.label { font-family: var(--mono); font-size: 10.5px; letter-spacing: .16em; text-transform: uppercase; color: var(--ink-3); }
.panel {
  background: var(--panel); color: var(--panel-ink); border-radius: var(--r);
  position: relative; overflow: hidden;
}
.panel .label { color: var(--panel-dim); }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r);
  position: relative;
}
.hr { height: 1px; background: var(--line); }
.up { color: var(--up); }
.down { color: var(--down); }

.seg {
  display: inline-flex; padding: 3px; gap: 2px; border-radius: 999px; border: 1px solid var(--line-2);
  background: var(--card);
}
.seg button {
  padding: 7px 14px; border-radius: 999px; font-family: var(--mono); font-size: 11.5px; color: var(--ink-2);
  transition: background .3s var(--ease), color .3s var(--ease);
}
.seg button:hover { color: var(--ink); }
.seg button.on { background: var(--ink); color: var(--paper); }
.panel .seg { background: var(--panel-2); border-color: var(--panel-3); }
.panel .seg button { color: var(--panel-dim); }
.panel .seg button.on { background: var(--panel-ink); color: var(--panel); }

.btn {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 12px 20px; border-radius: 999px; background: var(--ink); color: var(--paper);
  font-size: 13.5px; font-weight: 500;
  transition: transform .3s var(--ease), background .3s;
}
.btn:hover { background: var(--accent); }
.btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line-2); }
.btn.ghost:hover { border-color: var(--ink); background: transparent; }

.addr {
  display: inline-flex; align-items: center; gap: 6px; font-family: var(--mono); font-size: 12px;
  padding: 3px 8px 3px 8px; border-radius: 6px; background: var(--paper-2); color: var(--ink);
  transition: background .25s, color .25s; white-space: nowrap;
}
.addr:hover { background: var(--accent); color: #fff; }
.addr .tag { font-family: var(--sans); font-size: 10.5px; padding: 1px 6px; border-radius: 4px; background: var(--ink); color: var(--paper); }
.panel .addr { background: var(--panel-2); color: var(--panel-ink); }
.panel .addr:hover { background: var(--accent); color: #fff; }
.panel .addr .tag { background: var(--panel-ink); color: var(--panel); }
.copy { opacity: .55; cursor: copy; font-size: 11px; }
.copy:hover { opacity: 1; }

.tok { display: inline-flex; align-items: center; gap: 9px; font-weight: 500; }
.tok img, .tok .ph {
  width: 22px; height: 22px; border-radius: 50%; object-fit: cover; flex: none;
  background: var(--paper-3); display: grid; place-items: center; font-family: var(--mono); font-size: 10px;
}
.panel .tok img, .panel .tok .ph { background: var(--panel-3); }

.chip {
  font-family: var(--mono); font-size: 11px; padding: 6px 11px; border-radius: 999px;
  border: 1px solid var(--line-2); color: var(--ink-2); transition: all .25s var(--ease);
}
.chip:hover { border-color: var(--ink); color: var(--ink); }
.chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }

.spark { display: block; width: 100%; overflow: visible; }

/* table */
.tbl { width: 100%; border-collapse: collapse; }
.tbl th {
  text-align: left; font-family: var(--mono); font-weight: 400; font-size: 10.5px; letter-spacing: .14em;
  text-transform: uppercase; color: var(--ink-3); padding: 12px 14px; border-bottom: 1px solid var(--line);
}
.tbl td { padding: 13px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr { transition: background .25s var(--ease); }
.tbl tbody tr:hover { background: var(--paper-2); }
.tbl .r { text-align: right; }
.panel .tbl th { color: var(--panel-dim); border-color: var(--panel-3); }
.panel .tbl td { border-color: var(--panel-2); }
.panel .tbl tbody tr:hover { background: var(--panel-2); }

.empty { padding: 60px 24px; text-align: center; color: var(--ink-3); font-family: var(--mono); font-size: 12px; line-height: 1.7; }
.panel .empty { color: var(--panel-dim); }
.err { color: var(--down); font-family: var(--mono); font-size: 12px; }

.scan {
  position: relative; overflow: hidden;
}
.scan::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, var(--accent-soft), transparent);
  transform: translateX(-100%); animation: sweep 1.4s var(--ease-io) infinite;
}

/* loading ascii spinner */
.spin { font-family: var(--mono); color: var(--ink-3); }

/* title block (drawing sheet) */
.sheet {
  position: absolute; right: 44px; bottom: 32px;
  display: grid; grid-template-columns: repeat(4, auto); border: 1px solid var(--line-2);
  font-family: var(--mono); font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3);
  background: var(--paper);
}
.sheet div { padding: 8px 14px; border-right: 1px solid var(--line-2); }
.sheet div:last-child { border-right: 0; }
.sheet b { display: block; color: var(--ink); font-weight: 500; margin-top: 2px; letter-spacing: .06em; }

/* trail canvas */
#trail { position: fixed; inset: 0; pointer-events: none; z-index: 100; }

/* reveal */
.rv { opacity: 0; transform: translateY(14px); transition: opacity .8s var(--ease), transform .9s var(--ease); }
.rv.in { opacity: 1; transform: none; }

/* toast */
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 20px); opacity: 0; z-index: 120;
  background: var(--ink); color: var(--paper); padding: 10px 16px; border-radius: 999px;
  font-family: var(--mono); font-size: 12px; transition: all .4s var(--ease);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@keyframes beat { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(.55); opacity: .5; } }
@keyframes ring { from { transform: scale(.4); opacity: 1; } to { transform: scale(1.6); opacity: 0; } }
@keyframes vscroll { from { transform: translateY(0); } to { transform: translateY(-50%); } }
@keyframes sweep { to { transform: translateX(100%); } }
@keyframes flash { 0% { background: var(--accent); color: #fff; } 100% { background: transparent; } }
@keyframes rise { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ═══════════════════════ 01 · TAPE ═══════════════════════ */

.tape-grid { display: grid; grid-template-columns: 330px minmax(0, 1fr); gap: 22px; align-items: start; }
.hero-print {
  grid-column: 1 / -1;
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 34px; align-items: center;
  padding: 26px 30px; margin-bottom: 4px;
}
.hero-print .big { font-family: var(--serif); font-size: 64px; line-height: 1; letter-spacing: -.02em; }
.hero-print .what { font-size: 15px; color: var(--ink-2); line-height: 1.6; }
.hero-print .what .addr { margin: 0 2px; }
.hero-print .when { text-align: right; }
.hero-print .when .num { font-size: 22px; }

.watch { padding: 0; }
.watch-h { display: flex; justify-content: space-between; align-items: center; padding: 18px 18px 14px; }
.watch-row {
  display: grid; grid-template-columns: minmax(0, 1fr) 74px 62px; gap: 10px; align-items: center;
  padding: 11px 18px; border-top: 1px solid var(--line); cursor: pointer;
  transition: background .25s var(--ease), padding .35s var(--ease);
}
.watch-row:hover { background: var(--paper-2); padding-left: 24px; }
.watch-row.on { background: var(--ink); color: var(--paper); }
.watch-row.on .label { color: var(--paper); opacity: .6; }
.watch-row .chg { font-family: var(--mono); font-size: 11.5px; text-align: right; }
.watch-row.scanning .tok::after { content: '◉'; color: var(--accent); font-size: 9px; animation: beat 1.2s infinite; }
.stats { display: grid; grid-template-columns: 1fr 1fr; }
.stat { padding: 18px; border-top: 1px solid var(--line); }
.stat:nth-child(odd) { border-right: 1px solid var(--line); }
.stat .v { font-family: var(--mono); font-size: 22px; margin-top: 6px; letter-spacing: -.02em; }

.tape-panel { min-height: calc(100vh - 140px); display: flex; flex-direction: column; }
.tape-scroll { flex: 1; height: calc(100vh - 260px); min-height: 560px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--panel-3) transparent; }
.tape-scroll thead th { position: sticky; top: 0; background: var(--panel); z-index: 1; }
.tape-top {
  display: flex; justify-content: space-between; align-items: center; padding: 18px 20px; gap: 16px;
  border-bottom: 1px solid var(--panel-2);
}
.tape-title { font-family: var(--serif); font-size: 30px; line-height: 1; }
.tape-title small { font-family: var(--mono); font-size: 11px; color: var(--panel-dim); letter-spacing: .14em; margin-left: 10px; vertical-align: middle; }
.tape-panel .tbl td { font-size: 13px; }
.tape-panel tr.new td { animation: flash 1.6s var(--ease) ; }
.tape-panel tr.new { animation: rise .6s var(--ease); }
.size { font-family: var(--mono); }
.size b { display: block; font-weight: 500; font-size: 14px; }
.size span { color: var(--panel-dim); font-size: 11px; }
.flow { display: flex; align-items: center; gap: 8px; }
.flow .arrow { color: var(--panel-dim); font-family: var(--mono); transition: color .3s, transform .3s; }
.tape-panel tr:hover .arrow { color: var(--accent); transform: translateX(3px); }
.bar { height: 3px; border-radius: 2px; background: var(--panel-3); margin-top: 7px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--accent); }
.tx { font-family: var(--mono); font-size: 11px; color: var(--panel-dim); }
.tx:hover { color: var(--accent); }
.tape-foot { padding: 14px 20px; display: flex; justify-content: space-between; color: var(--panel-dim); font-family: var(--mono); font-size: 11px; }

/* ═══════════════════════ 02 · CHECK ═══════════════════════ */

.probe {
  display: flex; align-items: center; gap: 12px; padding: 10px 10px 10px 26px;
  border-radius: 999px; background: var(--card); border: 1px solid var(--line-2);
  box-shadow: 0 1px 0 var(--line), 0 24px 40px -30px rgba(0,0,0,.25);
  max-width: 980px; margin: 0 auto 46px;
  transition: border-color .3s, box-shadow .4s var(--ease);
}
.probe:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.probe .label { flex: none; }
.probe input { flex: 1; border: 0; outline: 0; background: transparent; font-family: var(--mono); font-size: 15px; padding: 10px 6px; }
.probe input::placeholder { color: var(--ink-3); }

.dossier { display: grid; grid-template-columns: 420px minmax(0, 1fr); gap: 22px; align-items: start; }
.verdict { padding: 30px; min-height: 520px; display: flex; flex-direction: column; }
.verdict .word { font-family: var(--serif); font-size: 112px; line-height: .86; letter-spacing: -.03em; margin: 18px 0 8px; }
.verdict .word i { color: var(--accent); font-style: normal; }
.verdict[data-v="clear"] .word i { color: var(--up); }
.verdict[data-v="caution"] .word i { color: var(--t-team); }
.verdict[data-v="avoid"] .word i { color: var(--down); }
.gauge { font-family: var(--mono); font-size: 13px; letter-spacing: 1px; margin: 16px 0 6px; white-space: pre; }
.signals { list-style: none; margin-top: auto; padding-top: 24px; }
.signals li { display: grid; grid-template-columns: 18px 1fr; gap: 8px; padding: 10px 0; border-top: 1px solid var(--panel-2); font-size: 13.5px; }
.signals li::before { font-family: var(--mono); }
.signals li.good::before { content: '+'; color: var(--up); }
.signals li.warn::before { content: '!'; color: var(--t-team); }
.signals li.bad::before { content: '×'; color: var(--down); }
.flagbox { margin-top: 16px; padding: 14px; border-radius: 10px; background: var(--down); color: #fff; font-size: 13px; }

.facts { display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid var(--line); border-radius: var(--r); background: var(--card); }
.fact { padding: 20px; border-right: 1px solid var(--line); transition: background .3s; }
.fact:last-child { border-right: 0; }
.fact:hover { background: var(--paper-2); }
.fact .v { font-family: var(--serif); font-size: 40px; line-height: 1; margin-top: 12px; letter-spacing: -.02em; }
.fact .s { font-family: var(--mono); font-size: 11px; color: var(--ink-3); margin-top: 8px; }
.trail-box { margin-top: 22px; display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
.trail-box .card { padding: 22px; }
.cex-row { display: grid; grid-template-columns: 1fr auto auto; gap: 18px; align-items: center; padding: 12px 0; border-top: 1px solid var(--line); font-size: 13.5px; }
.cex-row .via { font-family: var(--mono); font-size: 10.5px; color: var(--ink-3); }
.hold { margin-top: 22px; }
.hold .card { overflow: hidden; }
.hold-h { display: flex; justify-content: space-between; align-items: center; padding: 18px 20px; }
.mini-bar { height: 4px; background: var(--paper-3); border-radius: 2px; width: 90px; overflow: hidden; display: inline-block; vertical-align: middle; margin-left: 8px; }
.mini-bar i { display: block; height: 100%; background: var(--ink); }
.recent { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin: -26px 0 40px; }

/* ═══════════════════════ 03 · SLIPPAGE ═══════════════════════ */

.rig {
  display: grid; grid-template-columns: 1.3fr .7fr 1fr .9fr auto; gap: 0;
  border: 1px solid var(--line-2); border-radius: var(--r); background: var(--card); margin-bottom: 22px;
}
.rig > div { padding: 16px 20px; border-right: 1px solid var(--line); }
.rig > div:last-child { border-right: 0; display: grid; place-items: center; }
.rig .label { margin-bottom: 10px; }
.rig input[type="text"], .rig input[type="number"] {
  width: 100%; border: 0; outline: 0; background: transparent; font-family: var(--mono); font-size: 22px; letter-spacing: -.02em;
}
.rig input[type="number"]::-webkit-inner-spin-button { display: none; }
.rig .unit { display: flex; align-items: center; gap: 10px; }
.rig .unit span { font-family: var(--mono); color: var(--ink-3); }
.picker { position: relative; }
.picker .cur { display: flex; align-items: center; gap: 10px; cursor: pointer; font-size: 18px; font-weight: 500; }
.picker .cur .num { font-size: 12px; color: var(--ink-3); font-weight: 400; }
.picker .menu {
  position: absolute; top: calc(100% + 14px); left: -20px; width: 380px; max-height: 420px; overflow: auto; z-index: 30;
  background: var(--card); border: 1px solid var(--line-2); border-radius: 12px; box-shadow: 0 30px 60px -30px rgba(0,0,0,.35);
  opacity: 0; transform: translateY(-6px); pointer-events: none; transition: all .3s var(--ease);
}
.picker.open .menu { opacity: 1; transform: none; pointer-events: auto; }
.picker .menu input { width: 100%; padding: 14px 16px; border: 0; border-bottom: 1px solid var(--line); outline: 0; background: transparent; font-family: var(--mono); font-size: 12.5px; }
.picker .opt { display: flex; justify-content: space-between; align-items: center; padding: 10px 16px; cursor: pointer; transition: background .2s; }
.picker .opt:hover { background: var(--paper-2); }
.picker .opt .num { color: var(--ink-3); font-size: 11px; }
input[type="range"] { -webkit-appearance: none; appearance: none; width: 100%; height: 2px; background: var(--line-2); outline: 0; margin-top: 16px; }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 18px; height: 18px; border-radius: 50%; background: var(--ink); border: 3px solid var(--card); box-shadow: 0 0 0 1px var(--ink); cursor: grab; transition: transform .2s; }
input[type="range"]::-webkit-slider-thumb:hover { transform: scale(1.2); }
input[type="range"]::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: var(--ink); border: 3px solid var(--card); }

.versus { display: grid; grid-template-columns: 1fr 1.25fr 1fr; gap: 22px; align-items: stretch; }
.side { padding: 28px; display: flex; flex-direction: column; min-height: 470px; }
.side .t { font-family: var(--serif); font-size: 38px; line-height: 1; margin-top: 10px; }
.side .cost { font-family: var(--serif); font-size: 84px; line-height: 1; letter-spacing: -.03em; margin-top: auto; }
.side .pct { font-family: var(--mono); font-size: 14px; margin-top: 8px; }
.side dl { margin-top: 22px; display: grid; grid-template-columns: 1fr auto; gap: 8px 16px; font-size: 13px; }
.side dt { color: var(--ink-3); }
.side dd { font-family: var(--mono); text-align: right; }
.panel.side dt { color: var(--panel-dim); }
.mid { padding: 22px 22px 18px; display: flex; flex-direction: column; }
.mid .save { text-align: center; padding: 10px 0 6px; }
.mid .save .v { font-family: var(--serif); font-size: 58px; line-height: 1; letter-spacing: -.02em; }
.mid .save .v.pos { color: var(--up); }
.curve { flex: 1; min-height: 250px; margin-top: 12px; }
.curve svg { width: 100%; height: 100%; display: block; overflow: visible; }
.curve text { font-family: var(--mono); font-size: 10px; fill: var(--ink-3); }
.route { margin-top: 10px; font-family: var(--mono); font-size: 11px; color: var(--ink-3); text-align: center; }
.cube-wrap { display: flex; justify-content: center; margin: 4px 0 0; }

/* ═══════════════════════ 04 · SUPPLY ═══════════════════════ */

.map-grid { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 22px; align-items: start; }
.tokbar {
  display: grid; grid-template-columns: auto 1fr repeat(4, auto); gap: 34px; align-items: center;
  padding: 18px 24px; margin-bottom: 22px;
}
.tokbar .name { font-family: var(--serif); font-size: 40px; line-height: 1; }
.tokbar .name small { font-family: var(--mono); font-size: 11px; color: var(--ink-3); margin-left: 8px; letter-spacing: .1em; }
.tokbar .k .v { font-family: var(--mono); font-size: 17px; margin-top: 4px; }
.tokbar .sp { width: 180px; height: 44px; }
.tree { position: relative; height: 620px; border-radius: var(--r); overflow: hidden; background: var(--paper-2); }
.cell {
  position: absolute; padding: 10px 12px; overflow: hidden; cursor: pointer;
  border: 1px solid var(--paper); color: #fff;
  display: flex; flex-direction: column; justify-content: space-between;
  transition: filter .3s var(--ease), transform .4s var(--ease);
}
.cell:hover { filter: brightness(1.12) saturate(1.1); z-index: 2; }
.cell .p { font-family: var(--serif); font-size: 30px; line-height: 1; letter-spacing: -.02em; }
.cell .o { font-family: var(--mono); font-size: 11px; opacity: .85; }
.cell .l { font-family: var(--mono); font-size: 10px; letter-spacing: .14em; text-transform: uppercase; opacity: .9; }
.cell.sm .p { font-size: 16px; }
.cell.xs .p, .cell.xs .o, .cell.xs .l { display: none; }
.cell[data-t="exchange"] { background: var(--t-exchange); }
.cell[data-t="lp"] { background: var(--t-lp); }
.cell[data-t="team"] { background: var(--t-team); }
.cell[data-t="unknown"] { background: var(--ink); color: var(--paper); }
.cell[data-t="burn"] { background: repeating-linear-gradient(45deg, var(--t-burn) 0 6px, transparent 6px 12px); color: var(--ink); }
.cell[data-t="program"] { background: var(--t-program); }
.cell[data-t="locked"] { background: var(--t-locked); }
.cell[data-t="flagged"] { background: var(--down); }
.cell[data-t="rest"] { background: var(--accent); color: #fff; }
.cell.dim { filter: grayscale(1) opacity(.25); }
.legend { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 14px; }
.legend button { display: inline-flex; gap: 8px; align-items: center; font-family: var(--mono); font-size: 11px; padding: 6px 11px; border-radius: 999px; border: 1px solid var(--line-2); transition: all .25s; }
.legend button:hover, .legend button.on { border-color: var(--ink); }
.legend i { width: 9px; height: 9px; border-radius: 2px; display: inline-block; }
.conc { padding: 24px; }
.conc .big { font-family: var(--serif); font-size: 72px; line-height: 1; letter-spacing: -.03em; margin: 10px 0 4px; }
.meter { font-family: var(--mono); font-size: 12px; white-space: pre; margin-top: 10px; letter-spacing: .5px; }
.conc dl { display: grid; grid-template-columns: 1fr auto; gap: 10px; margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--panel-2); font-size: 13px; }
.conc dd { font-family: var(--mono); text-align: right; }
.conc dt { color: var(--panel-dim); }
.hlist { margin-top: 22px; }
.hlist .card { overflow: hidden; }
.typebadge { display: inline-flex; align-items: center; gap: 6px; font-family: var(--mono); font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; }
.typebadge i { width: 8px; height: 8px; border-radius: 2px; }

/* directory */
#dir { margin-top: 10px; }
.dir-h { display: flex; justify-content: space-between; align-items: end; gap: 30px; padding-bottom: 18px; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.dir-t { font-family: var(--serif); font-size: 36px; line-height: 1; margin-top: 8px; }
.dir-add { display: flex; gap: 10px; align-items: center; }
.dir-add input { border: 0; border-bottom: 1px solid var(--line-2); background: transparent; outline: 0; padding: 10px 2px; font-family: var(--mono); font-size: 12.5px; width: 150px; }
.dir-add input[name=address] { width: 330px; }
.dir-add input:focus { border-color: var(--accent); }
.dir-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.dir-card { display: block; padding: 18px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); transition: transform .35s var(--ease), border-color .3s, background .3s; }
.dir-card:hover { transform: translateY(-3px); border-color: var(--ink); }
.dir-card .n { font-family: var(--serif); font-size: 26px; line-height: 1.05; margin: 10px 0 12px; }
.dir-card .a { font-family: var(--mono); font-size: 11.5px; color: var(--ink-3); }
.dir-card .tg { font-family: var(--mono); font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--accent); }
.dir-card[data-c] .tg { color: var(--up); }

.coin { display: flex; align-items: center; gap: 8px; margin-right: auto; margin-left: 28px; }
.coin .ca, .coin .xl { display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 14px; border: 1px solid var(--line-2); border-radius: 999px; font-family: var(--mono); font-size: 11.5px; transition: all .25s var(--ease); }
.coin .ca[data-copy] { cursor: copy; }
.coin .ca:hover, .coin .xl:hover { border-color: var(--ink); background: var(--ink); color: var(--paper); }
.coin .k { font-size: 10px; letter-spacing: .14em; color: var(--ink-3); }
.coin .ca:hover .k { color: var(--paper); opacity: .6; }
.coin .xl { padding: 0 11px; }

.wordmark {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  font-family: var(--serif); font-size: 46px; line-height: 1; letter-spacing: -.03em; color: var(--ink);
  transition: letter-spacing .5s var(--ease);
}
.wordmark i { font-style: italic; font-size: .72em; color: var(--accent); margin-left: 3px; letter-spacing: -.01em; }
.wordmark:hover { letter-spacing: .02em; }

.chain-sw { display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid var(--line); }
.chain-sw button { height: 42px; font-family: var(--mono); font-size: 10.5px; letter-spacing: .12em; color: var(--ink-3); transition: all .25s var(--ease); }
.chain-sw button:first-child { border-right: 1px solid var(--line); }
.chain-sw button:hover { color: var(--ink); background: var(--paper-2); }
.chain-sw button.on { background: var(--accent); color: #fff; }

/* Robinhood Chain mode — green accent */
:root[data-chain="rh"] { --accent: #00a83a; --accent-soft: rgba(0, 168, 58, .12); }
:root[data-chain="rh"][data-theme="dark"] { --accent: #2be074; --accent-soft: rgba(43, 224, 116, .14); }
:root[data-chain="rh"] ::selection { background: var(--accent); }

/* ═══════════════════════ MOBILE ═══════════════════════ */
@media (max-width: 900px) {
  body { min-width: 0; font-size: 14px; }
  .shell { display: block; padding-bottom: 72px; }

  /* left rail → bottom tab bar */
  .rail-l {
    position: fixed; top: auto; bottom: 0; left: 0; right: 0; height: 64px; z-index: 60;
    flex-direction: row; border-right: 0; border-top: 1px solid var(--line);
    background: color-mix(in srgb, var(--paper) 92%, transparent); backdrop-filter: blur(12px);
  }
  .brand, .nav .g, .nav-tip { display: none; }
  .nav { flex-direction: row; flex: 1; }
  .nav a { flex-direction: column; justify-content: center; gap: 3px; padding: 0; border-bottom: 0; border-right: 1px solid var(--line); }
  .nav a::before { left: 0; right: 0; top: 0; bottom: auto; width: auto; height: 3px; transform: scaleX(0); }
  .nav a.on::after { top: 8px; right: 8px; width: 5px; height: 5px; }
  .nav .v { writing-mode: horizontal-tb; transform: none; font-size: 8.5px; letter-spacing: .08em; }
  .nav .n { font-size: 10px; }
  .chain-sw { grid-template-columns: 1fr; border-top: 0; border-right: 1px solid var(--line); width: 46px; }
  .chain-sw button { height: 32px; font-size: 9.5px; }
  .chain-sw button:first-child { border-right: 0; border-bottom: 1px solid var(--line); }
  .rail-foot { border-top: 0; width: 52px; }
  .theme-btn { height: 64px; font-size: 8px; }
  .theme-btn .sw { width: 28px; height: 16px; }
  .theme-btn .sw::after { width: 10px; height: 10px; }
  :root[data-theme="dark"] .theme-btn .sw::after { transform: translateX(12px); }
  .rail-r { display: none; }

  /* canvas */
  .main { padding: 0 16px 40px; background-size: 18px 18px; }
  .cross, .sheet, #trail { display: none; }
  .cmd { height: auto; flex-wrap: wrap; gap: 12px; padding: 14px 0; }
  .wordmark { position: static; transform: none; order: -1; width: 100%; text-align: center; font-size: 38px; }
  .crumb { font-size: 10px; }
  .coin { margin: 0 0 0 auto; }
  .coin .ca, .coin .xl { height: 30px; font-size: 10.5px; padding: 0 10px; }
  .paste { width: 100%; }
  .paste .hint { display: none; }
  .go { width: 44px; height: 44px; }

  /* headers — always stacked, copy first */
  .head, .head.flip { grid-template-columns: 1fr; gap: 18px; padding: 30px 0 24px; }
  .head.flip .head-copy { text-align: left; order: -1; }
  .head.flip .head-copy .lede { margin-left: 0; }
  h1 { font-size: 46px; }
  .lede { font-size: 14px; margin-top: 14px; }
  .char { justify-self: center; padding: 4px; }
  .char pre { font-size: 6.5px; line-height: 6.5px; }
  .char .bubble { display: none; }

  /* tables scroll sideways */
  .tbl { min-width: 640px; }
  .tbl th, .tbl td { padding: 10px; }
  .tape-scroll, .hold .card, .hlist .card { overflow-x: auto; }

  /* 01 tape */
  .tape-grid { grid-template-columns: 1fr; gap: 14px; }
  .hero-print { grid-template-columns: 1fr; gap: 12px; padding: 20px; }
  .hero-print .big { font-size: 48px; }
  .hero-print .when { text-align: left; }
  .tape-panel { min-height: 0; }
  .tape-scroll { height: 70vh; min-height: 0; }
  .tape-top { flex-wrap: wrap; padding: 14px; }
  .tape-top .seg button { padding: 6px 10px; font-size: 10.5px; }
  .tape-foot { flex-direction: column; gap: 4px; padding: 12px 14px; }
  .watch #watch { max-height: 320px; overflow-y: auto; }

  /* 02 check */
  .probe { flex-wrap: wrap; border-radius: 18px; padding: 12px; margin-bottom: 30px; }
  .probe .label { display: none; }
  .probe input { flex: 1 1 100%; font-size: 13px; padding: 8px 6px; }
  .probe .btn { width: 100%; justify-content: center; }
  .recent { margin: -14px 0 24px; justify-content: flex-start; }
  .dossier { grid-template-columns: 1fr; gap: 14px; }
  .verdict { min-height: 0; padding: 22px; }
  .verdict .word { font-size: 76px; }
  .gauge { font-size: 11px; }
  .facts { grid-template-columns: 1fr 1fr; }
  .fact { border-bottom: 1px solid var(--line); }
  .fact:nth-child(2n) { border-right: 0; }
  .fact .v { font-size: 32px; }
  .trail-box { grid-template-columns: 1fr; gap: 14px; margin-top: 14px; }
  .dir-h { flex-direction: column; align-items: stretch; }
  .dir-t { font-size: 28px; }
  .dir-add { flex-wrap: wrap; }
  .dir-add input, .dir-add input[name=address] { width: 100%; }
  .dir-add .btn { width: 100%; justify-content: center; }
  .dir-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .dir-card { padding: 14px; }
  .dir-card .n { font-size: 20px; }

  /* 03 slippage */
  .rig { grid-template-columns: 1fr 1fr; }
  .rig > div { border-right: 0; border-bottom: 1px solid var(--line); padding: 14px; }
  .rig > div:nth-child(1), .rig > div:nth-child(3), .rig > div:nth-child(4) { grid-column: 1 / -1; }
  .rig > div:last-child { border-bottom: 0; }
  .picker .menu { left: 0; width: calc(100vw - 64px); }
  .versus { grid-template-columns: 1fr; gap: 14px; }
  .side { min-height: 0; padding: 22px; }
  .side .cost { font-size: 60px; margin-top: 18px; }
  .mid .save .v { font-size: 46px; }
  .curve { min-height: 210px; }

  /* 04 supply */
  .tokbar { grid-template-columns: 1fr 1fr; gap: 14px; padding: 16px; }
  .tokbar .name { grid-column: 1 / -1; font-size: 32px; }
  .tokbar .sp { grid-column: 1 / -1; width: 100%; }
  .map-grid { grid-template-columns: 1fr; gap: 14px; }
  .tree { height: 420px; }
  .cell { padding: 6px 8px; }
  .cell .p { font-size: 20px; }
  .conc .big { font-size: 56px; }
  .meter { font-size: 10px; }
}

@media (max-width: 420px) {
  h1 { font-size: 40px; }
  .dir-grid { grid-template-columns: 1fr; }
  .facts { grid-template-columns: 1fr; }
  .fact { border-right: 0; }
}
