/* BULLION · Foundry Terminal
   A dark trading console: command bar + ticker on top, status bar at the bottom, sharp
   panels on a graphite grid, molten gold for anything live. */

:root {
  color-scheme: dark;
  --bg: #0a0b0c;
  --bg-2: #0e0f11;
  --panel: #121316;
  --panel-2: #17191c;
  --raise: #1d1f23;
  --line: #24262a;
  --line-2: #34373c;
  --text: #ece8df;
  --dim: #9a9ea6;
  --faint: #62666e;
  --gold: #f0b90b;
  --gold-2: #ffd24a;
  --gold-3: #b88a00;
  --ember: #ff5a36;
  --molten: linear-gradient(90deg, #f0b90b 0%, #ff9a1f 100%);
  --glow: 0 0 0 1px #f0b90b55, 0 0 24px -4px #f0b90b66;

  --disp: "Unbounded", "Noto Sans SC", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", monospace;
  --sans: "Inter Tight", "Noto Sans SC", system-ui, sans-serif;

  --bar: 56px;
  --tick: 30px;
  --status: 30px;
  --r: 3px;

  --dsp: 1;
  --dsp-lh: 1;
  --upper: uppercase;
}
html[lang="zh"] {
  --disp: "Noto Sans SC", system-ui, sans-serif;
  --sans: "Noto Sans SC", system-ui, sans-serif;
  --dsp: .92;
  --dsp-lh: 1.2;
  --upper: none;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--bar) + var(--tick) + 16px); }
body {
  margin: 0; min-height: 100vh;
  font: 400 14px/1.5 var(--sans); color: var(--text);
  background-color: var(--bg);
  background-image:
    radial-gradient(1200px 500px at 70% -10%, #f0b90b12, transparent 60%),
    linear-gradient(#ffffff06 1px, transparent 1px),
    linear-gradient(90deg, #ffffff06 1px, transparent 1px);
  background-size: auto, 32px 32px, 32px 32px;
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  padding-bottom: var(--status);
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
img, svg { display: block; max-width: 100%; }
h1, h2, h3, p, ol, ul { margin: 0; }
[hidden] { display: none !important; }
::selection { background: #f0b90b; color: #0a0b0c; }
:focus-visible { outline: 1px solid var(--gold); outline-offset: 2px; }

.mono { font-family: var(--mono); }
.num { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.gold { color: var(--gold); }
.ember { color: var(--ember); }
.dim { color: var(--dim); }
.faint { color: var(--faint); }
.label { font: 500 10.5px/16px var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--faint); }
html[lang="zh"] .label { font: 500 12px/16px var(--sans); letter-spacing: .08em; }
.disp { font-family: var(--disp); font-weight: 700; text-transform: var(--upper); letter-spacing: -.01em; line-height: calc(1.02 * var(--dsp-lh)); }
.disp-xl { font-size: calc(clamp(34px, 4.6vw, 64px) * var(--dsp)); }
.disp-l { font-size: calc(clamp(26px, 3vw, 40px) * var(--dsp)); }
.disp-m { font-size: calc(clamp(18px, 1.7vw, 22px) * var(--dsp)); }
.txt { color: var(--dim); line-height: 1.6; text-wrap: pretty; }
.txt-l { font-size: 16px; }
.readout { font: 600 clamp(32px, 3.6vw, 52px)/1 var(--mono); letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.readout-s { font: 600 24px/1.1 var(--mono); letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.molten-text { background: var(--molten); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* ---------- command bar ---------- */
.cmd {
  position: sticky; top: 0; z-index: 40;
  height: var(--bar); display: flex; align-items: center; gap: 22px;
  padding: 0 20px; background: #0a0b0cdd; border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
}
.brand { display: flex; align-items: center; gap: 10px; flex: none; }
.brand img { width: 26px; height: 26px; }
.brand b { font: 700 15px/1 var(--disp); letter-spacing: .08em; }
html[lang="zh"] .brand b { font-size: 17px; letter-spacing: .1em; }
.brand .led { margin-left: 4px; }
.nav { display: flex; align-items: stretch; height: 100%; gap: 2px; }
.nav a { position: relative; display: flex; align-items: center; gap: 8px; padding: 0 14px; font: 500 12px/1 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--dim); }
html[lang="zh"] .nav a { font: 500 14px/1 var(--sans); letter-spacing: .06em; }
.nav a i { font-style: normal; font-size: 10px; color: var(--faint); }
.nav a:hover { color: var(--text); }
.nav a[aria-current="page"] { color: var(--gold); }
.nav a[aria-current="page"]::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 2px; background: var(--gold); box-shadow: 0 0 12px #f0b90b; }
.cmd-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.led { width: 7px; height: 7px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 10px #f0b90b; flex: none; animation: led 2s steps(2, jump-none) infinite; }
.led-off { background: var(--faint); box-shadow: none; animation: none; }
.led-ember { background: var(--ember); box-shadow: 0 0 10px #ff5a36; }
@keyframes led { 50% { opacity: .35; } }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 34px; padding: 0 14px; border-radius: 2px; font: 600 11.5px/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; white-space: nowrap; border: 1px solid transparent; transition: background .15s, border-color .15s, box-shadow .15s, color .15s; }
html[lang="zh"] .btn { font: 600 13px/1 var(--sans); letter-spacing: .04em; }
.btn svg { width: 14px; height: 14px; }
.btn-gold { background: var(--gold); color: #0a0b0c; }
.btn-gold:hover { background: var(--gold-2); box-shadow: var(--glow); }
.btn-ghost { border-color: var(--line-2); color: var(--text); background: #ffffff03; }
.btn-ghost:hover { border-color: var(--gold); color: var(--gold); }
.btn-line-gold { border-color: #f0b90b88; color: var(--gold); }
.btn-line-gold:hover { background: #f0b90b14; box-shadow: var(--glow); }
.btn-lg { height: 44px; padding: 0 20px; font-size: 12.5px; }
.btn[disabled] { opacity: .45; cursor: not-allowed; box-shadow: none; }
.icon-btn { width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--line-2); border-radius: 2px; color: var(--dim); }
.icon-btn:hover { color: var(--gold); border-color: var(--gold); }
.icon-btn svg { width: 16px; height: 16px; }
.lang { height: 34px; padding: 0 12px; border: 1px solid var(--line-2); border-radius: 2px; font-size: 13px; color: var(--text); }
.lang:hover { border-color: var(--gold); color: var(--gold); }
.lang[lang="zh"] { font-family: "Noto Sans SC", sans-serif; }
.lang[lang="en"] { font-family: "JetBrains Mono", monospace; font-size: 12px; letter-spacing: .06em; }

/* ---------- ticker ---------- */
.ticker { position: sticky; top: var(--bar); z-index: 39; height: var(--tick); overflow: hidden; border-bottom: 1px solid var(--line); background: #0d0e10ee; }
.ticker-track { display: flex; width: max-content; height: 100%; animation: tick 80s linear infinite; }
.ticker:hover .ticker-track { animation-play-state: paused; }
@keyframes tick { to { transform: translateX(-50%); } }
.tk { display: flex; align-items: center; gap: 8px; padding: 0 22px; border-right: 1px solid var(--line); white-space: nowrap; font: 500 12px/1 var(--mono); }
.tk span { font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--faint); }
html[lang="zh"] .tk span { font: 500 12px/1 var(--sans); letter-spacing: .04em; }
.tk b { font-weight: 600; color: var(--text); }
.tk em { font-style: normal; font-size: 10px; }

/* ---------- status bar + tape ---------- */
.status { position: fixed; left: 0; right: 0; bottom: 0; z-index: 45; height: var(--status); display: flex; align-items: center; gap: 18px; padding: 0 14px; background: #0e0f11; border-top: 1px solid var(--line); font: 500 11px/1 var(--mono); color: var(--dim); }
html[lang="zh"] .status { font: 500 12px/1 var(--sans); }
.status .seg { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.status .grow { flex: 1; }
.status button { height: 100%; display: flex; align-items: center; gap: 8px; padding: 0 12px; border-left: 1px solid var(--line); color: var(--text); letter-spacing: .08em; text-transform: uppercase; }
.status button:hover, .status button[aria-expanded="true"] { color: var(--gold); background: #f0b90b10; }
.status button svg { width: 12px; height: 12px; transition: transform .2s; }
.status button[aria-expanded="true"] svg { transform: rotate(180deg); }

.tape { position: fixed; left: 0; right: 0; bottom: var(--status); z-index: 44; height: min(320px, 46vh); display: flex; flex-direction: column; background: #07080aee; backdrop-filter: blur(10px); border-top: 1px solid var(--gold); box-shadow: 0 -20px 60px -20px #000; animation: rise .22s ease-out; }
@keyframes rise { from { transform: translateY(16px); opacity: 0; } }
.tape-head { display: flex; align-items: center; gap: 12px; height: 36px; padding: 0 16px; border-bottom: 1px solid var(--line); }
.tape-head .icon-btn { margin-left: auto; width: 26px; height: 26px; }
.tape-log { flex: 1; overflow-y: auto; padding: 8px 16px 12px; font: 400 12.5px/1.9 var(--mono); }
html[lang="zh"] .tape-log { font-family: var(--mono), var(--sans); }
.tape-log div { display: grid; grid-template-columns: 76px 110px 128px minmax(0, 1fr) auto; gap: 14px; white-space: nowrap; }
.tape-log div > * { overflow: hidden; text-overflow: ellipsis; }
.tape-log time { color: var(--faint); }
.tape-log .k { font-weight: 600; }
.tape-log .fresh { animation: flash 1.4s ease-out; }
@keyframes flash { from { background: #f0b90b22; } }
.k-licence { color: var(--gold); } .k-melt { color: var(--ember); } .k-gold { color: var(--gold-2); } .k-claim { color: #d8d4ca; } .k-deposit { color: #b9b4a8; } .k-retire { color: #ff9a7a; }

/* ---------- page frame ---------- */
.page { max-width: 1520px; margin: 0 auto; padding: 18px 20px 48px; display: flex; flex-direction: column; gap: 14px; }
.grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 14px; }
.c3 { grid-column: span 3; } .c4 { grid-column: span 4; } .c5 { grid-column: span 5; } .c6 { grid-column: span 6; } .c7 { grid-column: span 7; } .c8 { grid-column: span 8; } .c9 { grid-column: span 9; } .c12 { grid-column: span 12; }

/* panels */
.pnl { position: relative; background: linear-gradient(180deg, var(--panel), #101114); border: 1px solid var(--line); border-radius: var(--r); display: flex; flex-direction: column; min-width: 0; }
.pnl::before { content: ""; position: absolute; left: -1px; top: -1px; width: 10px; height: 10px; border-left: 1px solid var(--gold); border-top: 1px solid var(--gold); pointer-events: none; }
.pnl-h { display: flex; align-items: center; gap: 10px; min-height: 36px; padding: 0 14px; border-bottom: 1px solid var(--line); }
.pnl-h .label { color: var(--dim); }
.pnl-h .meta { margin-left: auto; display: flex; align-items: center; gap: 10px; font: 500 11px/1 var(--mono); color: var(--faint); }
html[lang="zh"] .pnl-h .meta { font: 500 12px/1 var(--sans); }
.pnl-b { padding: 16px; display: flex; flex-direction: column; gap: 12px; flex: 1; }
.pnl-b-lg { padding: 22px; }
.pnl-f { border-top: 1px solid var(--line); padding: 10px 14px; display: flex; align-items: center; gap: 8px 12px; flex-wrap: wrap; }
.pnl-f .btn { margin-left: auto; }
.pnl-hot { border-color: #f0b90b55; box-shadow: inset 0 0 60px -30px #f0b90b55; }

/* headline strip */
.hdr { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 14px; }
.prompt { font: 500 13px/1 var(--mono); color: var(--faint); display: flex; gap: 8px; align-items: center; }
.prompt b { color: var(--gold); font-weight: 500; }
.caret { display: inline-block; width: .55em; height: .9em; background: var(--gold); margin-left: .12em; vertical-align: -.06em; animation: led 1.1s steps(2, jump-none) infinite; }
.kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.kpi { background: var(--panel); padding: 14px 16px; display: flex; flex-direction: column; gap: 6px; }
.kpi .v { font: 600 26px/1.1 var(--mono); letter-spacing: -.03em; }
.kpi .s { font-size: 12px; color: var(--faint); }

/* tabs (terminal) */
.tabs { display: flex; gap: 0; border: 1px solid var(--line-2); border-radius: 2px; overflow: hidden; flex-wrap: wrap; }
.tab { height: 30px; padding: 0 12px; font: 600 11px/1 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--dim); border-right: 1px solid var(--line-2); }
html[lang="zh"] .tab { font: 500 13px/1 var(--sans); letter-spacing: .04em; }
.tab:last-child { border-right: 0; }
.tab:hover { color: var(--text); }
.tab[aria-selected="true"] { background: var(--gold); color: #0a0b0c; }

.chip { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px; border: 1px solid var(--line-2); border-radius: 2px; font: 600 10.5px/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--dim); white-space: nowrap; }
html[lang="zh"] .chip { font: 500 12px/1 var(--sans); letter-spacing: .02em; }
.chip-gold { border-color: #f0b90b77; color: var(--gold); background: #f0b90b10; }
.chip-ember { border-color: #ff5a3677; color: var(--ember); background: #ff5a3610; }

/* key/value table */
.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th { text-align: left; font: 500 10.5px/1 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--faint); padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
html[lang="zh"] .tbl th { font: 500 12px/1 var(--sans); letter-spacing: .04em; }
.tbl td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tr:hover td { background: #ffffff04; }
.tbl .v { font-family: var(--mono); font-weight: 600; white-space: nowrap; color: var(--text); }
.tbl .n { color: var(--faint); font-size: 12.5px; }
.tbl-wrap { overflow-x: auto; }

.meter { position: relative; height: 6px; background: #ffffff0a; border-radius: 1px; }
.meter i { position: absolute; top: 0; bottom: 0; background: var(--molten); box-shadow: 0 0 10px #f0b90b88; }
.meter i.neg { background: var(--ember); box-shadow: 0 0 10px #ff5a3688; }
.meter.center::after { content: ""; position: absolute; left: 50%; top: -3px; bottom: -3px; width: 1px; background: var(--line-2); }

/* licence board: 100 cells */
.cells { display: grid; grid-template-columns: repeat(20, minmax(0, 1fr)); gap: 3px; }
.cells i { aspect-ratio: 1; background: #ffffff0b; border-radius: 1px; }
.cells i.on { background: var(--gold); box-shadow: 0 0 6px #f0b90b88; }
.cells i.new { animation: flash 1.4s; }

/* ladder */
.ladder { display: flex; flex-direction: column; font: 500 12.5px/1 var(--mono); }
.ladder div { position: relative; display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; gap: 10px; padding: 8px 10px; border-bottom: 1px solid #ffffff08; }
.ladder div::before { content: ""; position: absolute; right: 0; top: 2px; bottom: 2px; width: var(--w, 0%); background: linear-gradient(270deg, #f0b90b26, #f0b90b05); }
.ladder time { color: var(--faint); }
.ladder b { color: var(--gold); font-weight: 600; }
.ladder > * { position: relative; }

/* vault cam */
.cam { position: relative; flex: 1; min-height: 240px; background-size: cover; background-position: center 30%; filter: saturate(.9) contrast(1.08); overflow: hidden; }
.cam::before { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(0deg, #00000038 0 1px, transparent 1px 3px), radial-gradient(ellipse at center, transparent 50%, #000000b0 100%); }
.cam-hud { position: absolute; inset: 12px; display: flex; flex-direction: column; justify-content: space-between; font: 600 11px/1 var(--mono); letter-spacing: .1em; color: #f5efe0dd; text-shadow: 0 1px 2px #000; }
.cam-hud .row { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.cam-hud .rec { display: flex; align-items: center; gap: 6px; color: var(--ember); }
.cam::after { content: ""; position: absolute; inset: 12px; border: 1px solid #f5efe022; pointer-events: none; }

/* command rows (links styled as shell commands) */
.cmdrow { display: flex; align-items: center; gap: 14px; padding: 16px 18px; font: 500 14px/1.3 var(--mono); border-bottom: 1px solid var(--line); transition: background .15s; }
.cmdrow:last-child { border-bottom: 0; }
.cmdrow:hover { background: #f0b90b0c; }
.cmdrow .pr { color: var(--gold); }
.cmdrow .d { color: var(--faint); font-family: var(--sans); font-size: 13px; }
.cmdrow svg { margin-left: auto; width: 16px; height: 16px; color: var(--faint); transition: transform .15s, color .15s; flex: none; }
.cmdrow:hover svg { transform: translateX(3px); color: var(--gold); }

/* steps */
.steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.step { padding: 20px; border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; position: relative; }
.step:last-child { border-right: 0; }
.step .no { font: 700 34px/1 var(--mono); color: transparent; -webkit-text-stroke: 1px var(--line-2); }
.step:hover .no { -webkit-text-stroke-color: var(--gold); }

.slots { display: grid; grid-template-columns: repeat(10, 12px); gap: 3px; }
.slots i { height: 12px; background: #ffffff0d; }
.slots i.on { background: var(--gold); }

.range { -webkit-appearance: none; appearance: none; width: 100%; height: 4px; background: #ffffff14; outline: none; }
.range::-webkit-slider-thumb { -webkit-appearance: none; width: 18px; height: 18px; background: var(--gold); border: 0; border-radius: 1px; box-shadow: var(--glow); cursor: pointer; }
.range::-moz-range-thumb { width: 18px; height: 18px; background: var(--gold); border: 0; border-radius: 1px; cursor: pointer; }
.stepper { display: inline-flex; border: 1px solid var(--line-2); border-radius: 2px; }
.stepper button { width: 34px; height: 34px; color: var(--dim); font: 600 16px/1 var(--mono); }
.stepper button:hover { color: var(--gold); }
.stepper output { min-width: 40px; display: flex; align-items: center; justify-content: center; font: 600 14px/1 var(--mono); border-left: 1px solid var(--line-2); border-right: 1px solid var(--line-2); }

.select { display: flex; align-items: center; justify-content: space-between; gap: 10px; height: 44px; padding: 0 12px; border: 1px solid var(--line-2); border-radius: 2px; background: var(--bg-2); color: var(--dim); font-size: 13px; }

.note { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border: 1px dashed #f0b90b55; border-radius: 2px; color: var(--dim); font-size: 13px; line-height: 1.55; background: #f0b90b08; }
.note svg { width: 16px; height: 16px; color: var(--gold); flex: none; margin-top: 2px; }

.pend { display: inline-flex; align-items: center; gap: 7px; font: 600 10.5px/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--gold); }
html[lang="zh"] .pend { font: 500 12.5px/1 var(--sans); letter-spacing: .02em; }
.pend::before { content: ""; width: 6px; height: 6px; background: var(--gold); animation: led 1.4s steps(2, jump-none) infinite; }

/* tooltips */
.tip { position: relative; display: inline-flex; vertical-align: middle; }
.tip > button { width: 16px; height: 16px; border: 1px solid var(--line-2); border-radius: 1px; font: 600 10px/1 var(--mono); color: var(--faint); display: inline-flex; align-items: center; justify-content: center; }
.tip > button:hover, .tip.open > button { color: var(--gold); border-color: var(--gold); }
.tip .tip-body { display: none; position: absolute; left: 50%; bottom: calc(100% + 8px); transform: translateX(-50%); width: 270px; padding: 12px 14px; background: #1b1d21; border: 1px solid var(--line-2); border-top: 2px solid var(--gold); color: var(--text); font: 400 12.5px/1.55 var(--sans); letter-spacing: 0; text-transform: none; z-index: 60; box-shadow: 0 16px 40px -10px #000; text-align: left; }
.tip .tip-body .tp { display: block; }
.tip .tip-body .tp + .tp { margin-top: 6px; color: var(--dim); }
.tip:hover .tip-body, .tip.open .tip-body { display: block; }

.toast { position: fixed; left: 50%; bottom: calc(var(--status) + 20px); transform: translateX(-50%); z-index: 70; padding: 10px 16px; background: #1b1d21; border: 1px solid var(--gold); color: var(--text); font: 500 12.5px/1.4 var(--mono); border-radius: 2px; max-width: calc(100vw - 32px); animation: rise .2s; }
html[lang="zh"] .toast { font-family: var(--sans); }

.reveal { opacity: 0; transform: translateY(8px); transition: opacity .5s ease, transform .5s ease; }
.reveal.in { opacity: 1; transform: none; }

.chart { width: 100%; height: auto; overflow: visible; }
.chart text { font: 500 10.5px var(--mono); fill: var(--faint); }
html[lang="zh"] .chart text { font-family: var(--sans); font-size: 11.5px; }

/* schematic (assay) */
.schem { width: 100%; height: auto; }
.schem text { font: 600 12px var(--mono); fill: var(--text); letter-spacing: .06em; }
html[lang="zh"] .schem text { font: 500 14px var(--sans); letter-spacing: .02em; }
.schem .sub { font: 400 10.5px var(--mono); fill: var(--faint); letter-spacing: 0; }
html[lang="zh"] .schem .sub { font: 400 12px var(--sans); }
.flowdash { stroke-dasharray: 6 8; animation: dash 1.6s linear infinite; }
@keyframes dash { to { stroke-dashoffset: -28; } }

.sec-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding: 22px 2px 4px; }
.sec-head .label { color: var(--gold); }

.subnav { position: sticky; top: calc(var(--bar) + var(--tick)); z-index: 30; display: flex; align-items: center; gap: 12px; padding: 10px 0; background: linear-gradient(180deg, var(--bg) 70%, transparent); }

.foot { margin-top: 26px; padding: 18px 2px 0; border-top: 1px solid var(--line); display: flex; align-items: center; gap: 22px; flex-wrap: wrap; font: 500 11.5px/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--faint); }
html[lang="zh"] .foot { font: 500 13px/1 var(--sans); letter-spacing: .04em; }
.foot a:hover { color: var(--gold); }
.foot .brand { margin-right: auto; color: var(--text); }
.foot .brand img { width: 20px; height: 20px; }

/* codex (whitepaper) */
.codex { max-width: 1180px; margin: 0 auto; padding: 22px 20px 80px; display: flex; flex-direction: column; gap: 22px; }
.progress { position: fixed; left: 0; top: calc(var(--bar) + var(--tick)); height: 2px; background: var(--molten); z-index: 38; width: 0; box-shadow: 0 0 10px #f0b90b; }
.codex-hero { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 14px; }
.chapters { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); }
.chapters a { background: var(--panel); padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; min-height: 76px; transition: background .15s; }
.chapters a:hover, .chapters a.on { background: #f0b90b12; }
.chapters a span { font: 600 11px/1 var(--mono); color: var(--gold); }
.chapters a b { font-weight: 500; font-size: 13.5px; line-height: 1.35; color: var(--text); }
.article { max-width: 760px; margin: 0 auto; width: 100%; display: flex; flex-direction: column; gap: 64px; padding-top: 20px; }
.article section { display: flex; flex-direction: column; gap: 16px; scroll-margin-top: calc(var(--bar) + var(--tick) + 20px); }
.article .sno { font: 700 13px/1 var(--mono); color: var(--gold); display: flex; align-items: center; gap: 12px; }
.article .sno::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, var(--line-2), transparent); }
.article p { font-size: 17px; line-height: 1.75; color: #cfcbc2; text-wrap: pretty; }
html[lang="zh"] .article p { font-size: 16.5px; line-height: 1.95; }

/* ---------- mobile tab bar ---------- */
.tabbar { display: none; }
.mob-only { display: none; }

@media (max-width: 1180px) {
  .c3, .c4, .c5 { grid-column: span 6; }
  .c7, .c8, .c9 { grid-column: span 12; }
  .c6 { grid-column: span 12; }
  .hdr { grid-template-columns: minmax(0, 1fr); }
  .chapters { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .codex-hero { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 860px) {
  :root { --bar: 52px; }
  .nav, .status { display: none; }
  .mob-only { display: inline-flex; }
  body { padding-bottom: calc(62px + env(safe-area-inset-bottom, 0px)); }
  .tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 45; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); height: calc(62px + env(safe-area-inset-bottom, 0px)); padding-bottom: env(safe-area-inset-bottom, 0px); background: #0b0c0ef2; backdrop-filter: blur(12px); border-top: 1px solid var(--line); }
  .tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; font: 600 9.5px/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--faint); }
  html[lang="zh"] .tabbar a { font: 500 11.5px/1 var(--sans); }
  .tabbar a svg { width: 20px; height: 20px; }
  .tabbar a[aria-current="page"] { color: var(--gold); }
  .tape { bottom: calc(62px + env(safe-area-inset-bottom, 0px)); }
  .toast { bottom: 80px; }
  .cmd { padding: 0 12px; gap: 10px; }
  .cmd .btn { padding: 0 10px; }
  .brand .led { display: none; }
  .page { padding: 12px 12px 32px; gap: 12px; }
  .grid { gap: 12px; }
  .c3, .c4, .c5, .c6 { grid-column: span 12; }
  .steps { grid-template-columns: minmax(0, 1fr); }
  .step { border-right: 0; border-bottom: 1px solid var(--line); }
  .step:last-child { border-bottom: 0; }
  .tape-log div { grid-template-columns: 64px 100px minmax(0, 1fr); }
  .tape-log div > :nth-child(3) { display: none; }
  .tape-log div > :nth-child(5) { display: none; }
  .chapters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .article p { font-size: 16px; }
  .cells { gap: 2px; }
  .tip .tip-body { width: 230px; }
}
@media (max-width: 420px) {
  .cmd .brand b { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .ticker-track, .led, .caret, .flowdash, .pend::before { animation: none; }
  .reveal { opacity: 1; transform: none; transition: none; }
}
.k-keeper { color: #9fd3c7; }
