/* SPAWN. Layout: an arcade cabinet. One sticky HUD header with tab nav and a marquee ticker,
   a single <main> that swaps tab panels, bottom tab bar on phones. Pixel-notched panels,
   chunky 3D buttons, CRT scanlines. Single dark theme by design (it is a lit arcade screen). */
:root {
  --bg: #0d0806;
  --bg-2: #17100d;
  --bg-3: #221815;
  --bg-4: #2e201b;
  --line: #3f2a22;
  --line-2: #5e3d31;
  --fg: #fbf1e4;
  --muted: #c9ab97;
  --dim: #80665a;
  --gold: #ff6a2e;
  --gold-2: #b8360f;
  --gold-3: #ffb48c;
  --pink: #5fb0ff;
  --cyan: #35e0d6;
  --lime: #8cff5a;
  --red: #ff3b52;
  --orange: #ffc247;
  --shadow: #050201;
  --on-gold: #1a0600;
  --font-display: 'Press Start 2P', 'Courier New', monospace;
  --font-body: 'Chakra Petch', 'Segoe UI', system-ui, sans-serif;
  --font-term: 'VT323', 'Courier New', monospace;
  --hud-h: 64px;
  --gutter: clamp(16px, 4vw, 40px);
  --notch: 6px;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { height: 100%; scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0; min-height: 100%;
  background: var(--bg);
  background-image: radial-gradient(ellipse at 50% -10%, #3a1a0f 0%, transparent 60%);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 16px; line-height: 1.5;
  overflow-x: hidden;
}
body::before { /* scanlines */
  content: ''; position: fixed; inset: 0; z-index: 90; pointer-events: none;
  background: repeating-linear-gradient(0deg, rgba(0,0,0,.16) 0 1px, transparent 1px 3px);
}
body::after { /* vignette */
  content: ''; position: fixed; inset: 0; z-index: 89; pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 55%, rgba(6,2,1,.55) 100%);
}
img { max-width: 100%; }
img.px, .sprite, .pxi { image-rendering: pixelated; image-rendering: crisp-edges; }
a { color: var(--cyan); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
h1, h2, h3, h4 { margin: 0; text-wrap: balance; }
p { margin: 0; }
button { font: inherit; color: inherit; cursor: pointer; }
input, textarea, select { font: inherit; color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.skip { position: absolute; left: -999px; top: 8px; z-index: 200; background: var(--gold); color: var(--on-gold); padding: 8px 12px; }
.skip:focus { left: 8px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- type ---------- */
.eyebrow { font-family: var(--font-display); font-size: 9px; letter-spacing: .08em; color: var(--muted); text-transform: uppercase; line-height: 1.6; }
.h-xl { font-family: var(--font-display); font-size: clamp(18px, 3.6vw, 34px); line-height: 1.45; color: var(--fg); text-shadow: 4px 4px 0 var(--shadow); }
.h-l { font-family: var(--font-display); font-size: clamp(12px, 1.6vw, 15px); line-height: 1.6; color: var(--gold); }
.h-m { font-family: var(--font-display); font-size: 11px; line-height: 1.6; color: var(--fg); }
.lead { font-size: clamp(16px, 1.4vw, 19px); color: var(--muted); max-width: 58ch; }
.num { font-family: var(--font-term); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.gold { color: var(--gold); } .pink { color: var(--pink); } .cyan { color: var(--cyan); } .lime { color: var(--lime); } .red { color: var(--red); }

/* ---------- pixel primitives ---------- */
.panel {
  background: var(--bg-2); border: 3px solid var(--line);
  clip-path: polygon(0 var(--notch), var(--notch) var(--notch), var(--notch) 0, calc(100% - var(--notch)) 0, calc(100% - var(--notch)) var(--notch), 100% var(--notch), 100% calc(100% - var(--notch)), calc(100% - var(--notch)) calc(100% - var(--notch)), calc(100% - var(--notch)) 100%, var(--notch) 100%, var(--notch) calc(100% - var(--notch)), 0 calc(100% - var(--notch)));
  padding: 18px;
  min-width: 0;
}
.panel-raised { background: var(--bg-3); }
.panel-gold { border-color: var(--gold-2); }
.panel-pink { border-color: var(--pink); }
.panel-cyan { border-color: var(--cyan); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--font-body); font-weight: 700; text-transform: uppercase; letter-spacing: .06em; font-size: 14px;
  padding: 11px 18px; border: 3px solid var(--shadow); background: var(--bg-4); color: var(--fg);
  box-shadow: 0 5px 0 0 var(--shadow); transform: translateY(0); transition: transform .05s, box-shadow .05s;
  text-decoration: none; white-space: nowrap; min-height: 44px;
}
.btn:hover { text-decoration: none; filter: brightness(1.08); }
.btn:active { transform: translateY(5px); box-shadow: 0 0 0 0 var(--shadow); }
.btn-gold { background: var(--gold); color: var(--on-gold); }
.btn-pink { background: var(--pink); color: #fff; }
.btn-cyan { background: var(--cyan); color: #042a27; }
.btn-ghost { background: transparent; border-color: var(--line-2); box-shadow: 0 5px 0 0 var(--line); }
.btn-sm { padding: 7px 12px; font-size: 12px; min-height: 36px; box-shadow: 0 4px 0 0 var(--shadow); }
.btn-sm:active { transform: translateY(4px); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .45; cursor: not-allowed; }
.btn[disabled]:active { transform: none; box-shadow: 0 5px 0 0 var(--shadow); }
.btn .pxi { width: 14px; height: 14px; }

.pxi { width: 16px; height: 16px; display: inline-block; vertical-align: -3px; flex: none; }
.pxi-lg { width: 24px; height: 24px; }

.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; padding: 3px 8px; border: 2px solid var(--line-2); color: var(--muted); background: var(--bg); }
.chip-gold { border-color: var(--gold-2); color: var(--gold); }
.chip-lime { border-color: var(--lime); color: var(--lime); }
.chip-pink { border-color: var(--pink); color: var(--pink); }
.chip-cyan { border-color: var(--cyan); color: var(--cyan); }
.chip-red { border-color: var(--red); color: var(--red); }

.lvl { font-family: var(--font-display); font-size: 8px; letter-spacing: .04em; padding: 5px 7px 4px; border: 2px solid currentColor; text-transform: uppercase; line-height: 1; white-space: nowrap; }
.lvl-egg { color: var(--muted); } .lvl-hatchling { color: var(--cyan); } .lvl-beast { color: var(--lime); } .lvl-alpha { color: var(--gold); } .lvl-legend { color: var(--pink); }

.status { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.status::before { content: ''; width: 8px; height: 8px; background: currentColor; }
.status-awake { color: var(--lime); } .status-awake::before { animation: blink 1.2s steps(2, start) infinite; }
.status-asleep { color: var(--red); } .status-egg { color: var(--muted); }
@keyframes blink { to { visibility: hidden; } }

.bar { position: relative; height: 12px; background: var(--bg); border: 2px solid var(--line); overflow: hidden; }
.bar > i { display: block; height: 100%; background: repeating-linear-gradient(90deg, var(--c, var(--gold)) 0 6px, color-mix(in srgb, var(--c, var(--gold)) 70%, black) 6px 8px); transition: width .6s steps(12); }
.bar-xp > i { --c: var(--gold); } .bar-energy > i { --c: var(--cyan); } .bar-fed > i { --c: var(--lime); } .bar-fed.low > i { --c: var(--red); } .bar-hoard > i { --c: var(--orange); }
.bar-row { display: grid; grid-template-columns: 58px 1fr auto; gap: 8px; align-items: center; font-size: 12px; }
.bar-row b { font-family: var(--font-display); font-size: 7px; letter-spacing: .06em; color: var(--muted); }
.bar-row span { font-family: var(--font-term); font-size: 17px; color: var(--fg); min-width: 7ch; text-align: right; }

/* ---------- HUD header ---------- */
.hud {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 100;
  display: flex; align-items: center; gap: 16px; min-height: var(--hud-h);
  padding-inline: var(--gutter); padding-block: 8px;
  background: var(--bg-2); border-bottom: 3px solid var(--line);
  box-shadow: 0 6px 0 rgba(0,0,0,.35);
}
.logo { display: flex; align-items: center; gap: 10px; color: var(--fg); font-family: var(--font-display); font-size: 14px; text-shadow: 3px 3px 0 var(--shadow); }
.logo:hover { text-decoration: none; }
.logo img { width: 34px; height: 34px; }
.tabs { display: flex; gap: 4px; margin-inline: auto; }
.tabs a {
  font-family: var(--font-display); font-size: 9px; letter-spacing: .04em; color: var(--muted);
  padding: 10px 12px 8px; border-bottom: 4px solid transparent; text-transform: uppercase;
}
.tabs a:hover { color: var(--fg); text-decoration: none; }
.tabs a[aria-current="page"] { color: var(--gold); border-bottom-color: var(--gold); }
.hud-right { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.tabs + .hud-right { margin-left: 0; }
.demo-badge { font-family: var(--font-display); font-size: 7px; color: var(--on-gold); background: var(--gold-3); padding: 5px 6px 4px; letter-spacing: .06em; }
.wallet-pill { font-family: var(--font-term); font-size: 18px; }

.ticker { overflow: hidden; background: var(--shadow); border-bottom: 3px solid var(--line); height: 34px; display: flex; align-items: center; }
.ticker-track { display: flex; gap: 0; white-space: nowrap; animation: marquee 60s linear infinite; will-change: transform; }
.ticker:hover .ticker-track { animation-play-state: paused; }
.ticker-track span { font-family: var(--font-term); font-size: 20px; color: var(--muted); padding-inline: 18px; }
.ticker-track span b { color: var(--gold); font-weight: 400; }
.ticker-track span i { font-style: normal; color: var(--dim); }
/* $SPAWN contract address bar under the ticker: rendered only once SPAWN_TOKEN_MINT is set in .env */
.cabar { display: flex; align-items: center; gap: 8px 14px; flex-wrap: wrap; padding: 8px 16px; background: var(--bg-2); border-bottom: 3px solid var(--line); }
.cabar .eyebrow { color: var(--gold); }
.cabar code { font-family: var(--font-term); font-size: 20px; line-height: 1; color: var(--fg); word-break: break-all; min-width: 0; user-select: all; }
.cabar .btn { padding: 6px 12px; font-size: 12px; min-height: 32px; box-shadow: 0 3px 0 0 var(--shadow); }
@keyframes marquee { to { transform: translateX(-50%); } }
@media (prefers-reduced-motion: reduce) { .ticker-track { animation: none; } .status-awake::before { animation: none; } }

/* ---------- layout ---------- */
main { padding-inline: var(--gutter); padding-block: 28px 80px; max-width: 1280px; margin-inline: auto; }
.tab { display: grid; gap: 44px; }
.section { display: grid; gap: 18px; min-width: 0; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.section-head p { color: var(--muted); max-width: 60ch; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); gap: 20px; align-items: start; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: 16px; }

/* ---------- hero ---------- */
.hero { display: grid; grid-template-columns: 1.15fr .85fr; gap: 32px; align-items: center; }
.hero-copy { display: grid; gap: 20px; }
.hero-ctas { display: flex; gap: 12px; flex-wrap: wrap; }
.hero-tags { display: flex; gap: 8px; flex-wrap: wrap; }
.cabinet { position: relative; padding: 14px; background: var(--bg-3); border: 3px solid var(--line-2); box-shadow: 0 10px 0 var(--shadow); }
.cabinet-screen { background: var(--shadow); border: 3px solid var(--line); padding: 18px; display: grid; gap: 14px; min-height: 300px; }
.cabinet-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.cabinet-stage { display: grid; grid-template-columns: 120px 1fr; gap: 16px; align-items: center; }
.cabinet-stage .sprite { width: 120px; height: 120px; animation: idle 1.6s steps(2) infinite; }
@keyframes idle { 50% { transform: translateY(-4px); } }
@media (prefers-reduced-motion: reduce) { .cabinet-stage .sprite { animation: none; } }
.cabinet-bars { display: grid; gap: 8px; min-width: 0; }
.cabinet-thought { font-family: var(--font-term); font-size: 20px; color: var(--lime); min-height: 2.3em; border-top: 2px dashed var(--line); padding-top: 10px; }
.cabinet-thought::after { content: '_'; animation: blink 1s steps(2, start) infinite; }
.cabinet-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.cabinet-foot .num { font-size: 18px; color: var(--fg); }
.coin-slot { position: absolute; right: 22px; bottom: -22px; background: var(--gold); color: var(--on-gold); font-family: var(--font-display); font-size: 7px; padding: 6px 9px 5px; border: 3px solid var(--shadow); letter-spacing: .08em; }

/* ---------- HUD stats ---------- */
.hud-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr)); gap: 12px; }
.hud-stat { padding: 12px 14px; display: grid; gap: 4px; }
.hud-stat b { font-family: var(--font-display); font-size: 7px; letter-spacing: .08em; color: var(--muted); text-transform: uppercase; }
.hud-stat .num { font-size: 36px; line-height: 1; color: var(--gold); }
.hud-stat .num.cyan { color: var(--cyan); } .hud-stat .num.lime { color: var(--lime); } .hud-stat .num.pink { color: var(--pink); }
.hud-stat small { font-size: 12px; color: var(--dim); }

/* ---------- live row ---------- */
.live-row { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 8px; scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch; }
.live-row::-webkit-scrollbar { height: 8px; } .live-row::-webkit-scrollbar-thumb { background: var(--line-2); }
.live-card { flex: 0 0 240px; scroll-snap-align: start; display: grid; grid-template-columns: 56px 1fr; gap: 10px; padding: 12px; cursor: pointer; transition: transform .08s; text-align: left; color: var(--fg); }
.live-card:hover { transform: translateY(-3px); border-color: var(--line-2); }
.live-card .sprite { width: 56px; height: 56px; }
.live-card h4 { font-size: 14px; font-weight: 700; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.live-card p { font-family: var(--font-term); font-size: 16px; line-height: 1.15; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

/* ---------- leaderboard ---------- */
.board { padding: 0; overflow: hidden; }
.board-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: 3px solid var(--line); background: var(--bg-3); gap: 10px; flex-wrap: wrap; }
.board table { width: 100%; border-collapse: collapse; font-size: 14px; }
.board th { font-family: var(--font-display); font-size: 7px; letter-spacing: .08em; color: var(--muted); text-align: left; padding: 10px 12px; border-bottom: 2px solid var(--line); text-transform: uppercase; }
.board th.num { text-align: right; }
.board td { padding: 8px 12px; border-bottom: 2px solid var(--bg); vertical-align: middle; }
.board tr:hover td { background: var(--bg-3); }
.board tbody tr { cursor: pointer; }
.board td.num { text-align: right; font-size: 19px; white-space: nowrap; }
.board .rank { font-family: var(--font-display); font-size: 9px; color: var(--muted); width: 36px; }
.board .rank.r1 { color: var(--gold); } .board .rank.r2 { color: #f1d9c6; } .board .rank.r3 { color: var(--gold-2); }
.board .who { display: flex; align-items: center; gap: 10px; }
.board .who .sprite { width: 28px; height: 28px; }
.board .who b { font-weight: 700; }
.board .who small { color: var(--muted); display: block; font-size: 12px; }
.table-wrap { overflow-x: auto; }

/* ---------- terminal / battle log ---------- */
.terminal { padding: 0; display: grid; grid-template-rows: auto 1fr; background: var(--shadow); border-color: var(--line); }
.terminal-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 3px solid var(--line); background: var(--bg-2); flex-wrap: wrap; }
.filters { display: flex; gap: 4px; flex-wrap: wrap; }
.filters button { font-family: var(--font-display); font-size: 7px; letter-spacing: .06em; padding: 7px 8px 6px; background: transparent; border: 2px solid var(--line); color: var(--muted); text-transform: uppercase; min-height: 32px; }
.filters button[aria-pressed="true"] { color: var(--on-gold); background: var(--gold); border-color: var(--gold); }
.log { list-style: none; margin: 0; padding: 10px 14px; font-family: var(--font-term); font-size: 19px; line-height: 1.2; max-height: 520px; overflow-y: auto; display: grid; gap: 6px; align-content: start; }
.log li { display: grid; grid-template-columns: 7ch 1fr; gap: 10px; color: var(--fg); animation: logIn .25s steps(3); min-width: 0; }
.log li > div { min-width: 0; overflow-wrap: anywhere; }
@keyframes logIn { from { opacity: 0; transform: translateX(-6px); } }
@media (prefers-reduced-motion: reduce) { .log li { animation: none; } }
.log time { color: var(--dim); }
.log .tag { font-weight: 400; margin-right: 6px; }
.log .who { color: var(--gold); cursor: pointer; background: none; border: 0; padding: 0; font: inherit; }
.log .who:hover { text-decoration: underline; }
.log .tx { color: var(--cyan); margin-left: 6px; font-size: 16px; }
.t-thought .tag, .t-research .tag, .t-meme .tag, .t-advisor .tag { color: var(--muted); }
.t-buyback .tag, .t-dca .tag, .t-burn .tag { color: var(--orange); }
.t-loot .tag, .t-jackpot .tag { color: var(--lime); }
.t-blocked .tag { color: var(--red); } .t-blocked { color: var(--muted); }
.t-levelup .tag, .t-wake .tag { color: var(--gold); }
.t-sleep .tag { color: var(--cyan); }
.t-quest .tag { color: var(--pink); }

/* ---------- how it plays / ladder ---------- */
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr)); gap: 16px; counter-reset: step; }
.step { display: grid; gap: 10px; position: relative; padding-top: 48px; align-content: start; }
.step::before { counter-increment: step; content: counter(step); position: absolute; top: 14px; left: 16px; font-family: var(--font-display); font-size: 14px; color: var(--gold); text-shadow: 3px 3px 0 var(--shadow); }
.step h3 { font-size: 16px; font-weight: 700; }
.step p { color: var(--muted); font-size: 14px; }
.step > .pxi { position: absolute; top: 12px; right: 14px; width: 22px; height: 22px; }

.ladder { display: grid; gap: 10px; }
.rung { display: grid; grid-template-columns: 64px 120px 1fr auto; gap: 14px; align-items: center; padding: 12px 14px; }
.rung .sprite { width: 48px; height: 48px; }
.rung .range { font-family: var(--font-term); font-size: 18px; color: var(--muted); }
.rung .note { font-size: 14px; color: var(--muted); }
.split { display: flex; gap: 2px; height: 10px; width: 160px; max-width: 100%; border: 2px solid var(--line); background: var(--bg); }
.split i { display: block; height: 100%; }
.split .s-energy { background: var(--cyan); } .split .s-hoard { background: var(--orange); } .split .s-furnace { background: var(--pink); }
.split-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.split-legend i { display: inline-block; width: 10px; height: 10px; vertical-align: -1px; margin-right: 6px; }

/* ---------- creature cards ---------- */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; justify-content: space-between; }
.toolbar .filters { flex: 1 1 auto; }
.toolbar select, .toolbar input { background: var(--bg); border: 3px solid var(--line); color: var(--fg); padding: 9px 10px; min-height: 42px; }
.toolbar input { flex: 1 1 180px; max-width: 320px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 290px), 1fr)); gap: 16px; }
.ccard { display: grid; grid-template-columns: 84px 1fr; gap: 14px; padding: 14px; cursor: pointer; transition: transform .08s, border-color .08s; text-align: left; color: var(--fg); }
.ccard:hover { transform: translateY(-3px); border-color: var(--line-2); }
.ccard .sprite { width: 84px; height: 84px; }
.ccard-body { display: grid; gap: 8px; min-width: 0; }
.ccard-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ccard-top h3 { font-size: 17px; font-weight: 700; }
.ccard-name { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ccard-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 10px; margin: 0; }
.ccard-stats div { display: flex; justify-content: space-between; gap: 6px; font-size: 12px; }
.ccard-stats dt { color: var(--dim); } .ccard-stats dd { margin: 0; font-family: var(--font-term); font-size: 17px; color: var(--fg); white-space: nowrap; }
.brain-tag { display: inline-flex; gap: 6px; align-items: center; font-size: 12px; color: var(--muted); }
.ccard .brain-tag { font-family: var(--font-term); font-size: 13px; color: var(--cyan); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.ccard .brain-tag::before { content: 'AI '; color: var(--dim); }
.ccard.retired { opacity: .6; }
.empty { padding: 40px; text-align: center; color: var(--muted); }

/* ---------- drawer (creature detail) ---------- */
.drawer-backdrop { position: fixed; inset: 0; background: rgba(6,2,1,.7); z-index: 150; border: 0; padding: 0; margin: 0; width: 100%; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(100%, 720px); z-index: 160; background: var(--bg-2); border-left: 3px solid var(--line-2); overflow-y: auto; padding: 20px var(--gutter) 40px; display: grid; gap: 22px; align-content: start; animation: slideIn .2s steps(4); }
@keyframes slideIn { from { transform: translateX(40px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .drawer { animation: none; } }
.drawer-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.drawer-id { display: grid; grid-template-columns: 112px 1fr; gap: 16px; align-items: center; }
.drawer-id .sprite { width: 112px; height: 112px; }
.drawer-id h2 { font-size: 26px; font-weight: 700; }
.drawer-id .ccard-top { margin-bottom: 6px; }
.kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; }
.kv div { padding: 10px 12px; background: var(--bg); border: 2px solid var(--line); display: grid; gap: 2px; min-width: 0; }
.kv b { font-family: var(--font-display); font-size: 7px; letter-spacing: .08em; color: var(--muted); text-transform: uppercase; }
.kv span { font-family: var(--font-term); font-size: 24px; line-height: 1; color: var(--fg); }
.quests { display: grid; gap: 8px; }
.quest { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 12px; background: var(--bg); border: 2px solid var(--line); font-size: 14px; flex-wrap: wrap; }
.quest .chip { font-size: 10px; }
.party-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.links { display: flex; gap: 10px; flex-wrap: wrap; }
.drawer .log { max-height: 320px; }
.lastwill { display: flex; gap: 12px; align-items: center; padding: 12px 14px; border: 3px solid var(--red); background: color-mix(in srgb, var(--red) 10%, var(--bg)); font-size: 14px; }
.lastwill .pxi { width: 24px; height: 24px; color: var(--red); }

/* ---------- wizard (spawn) ---------- */
.wizard { display: grid; grid-template-columns: 1fr 340px; gap: 24px; align-items: start; }
.wiz-steps { display: flex; gap: 6px; }
.wiz-steps button { flex: 1; font-family: var(--font-display); font-size: 7px; letter-spacing: .04em; padding: 10px 6px 8px; background: var(--bg); border: 3px solid var(--line); color: var(--dim); text-transform: uppercase; min-height: 40px; }
.wiz-steps button[aria-current="step"] { color: var(--on-gold); background: var(--gold); border-color: var(--gold); }
.wiz-steps button.done { color: var(--lime); border-color: var(--lime); }
.wiz-panel { display: grid; gap: 18px; }
.field { display: grid; gap: 6px; }
.field label { font-family: var(--font-display); font-size: 8px; letter-spacing: .06em; color: var(--muted); text-transform: uppercase; display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.field label small { font-family: var(--font-body); font-size: 12px; letter-spacing: 0; text-transform: none; color: var(--dim); }
.field input, .field textarea, .field select { background: var(--bg); border: 3px solid var(--line); color: var(--fg); padding: 11px 12px; min-height: 46px; width: 100%; }
.field input:focus, .field textarea:focus { border-color: var(--gold); outline: none; }
.field textarea { min-height: 96px; resize: vertical; }
.field .hint { font-size: 12px; color: var(--dim); }
.field .err { font-size: 13px; color: var(--red); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.upload { display: grid; grid-template-columns: 84px 1fr; gap: 14px; align-items: center; }
.upload .preview { width: 84px; height: 84px; border: 3px dashed var(--line-2); display: grid; place-items: center; background: var(--bg); overflow: hidden; color: var(--dim); font-size: 11px; text-align: center; }
.upload .preview img { width: 100%; height: 100%; object-fit: cover; }
.upload input[type=file] { font-size: 13px; }
.wiz-nav { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.presets { display: flex; gap: 6px; flex-wrap: wrap; }
.presets button { font-size: 12px; font-weight: 600; padding: 6px 10px; border: 2px solid var(--line-2); background: var(--bg); color: var(--muted); min-height: 32px; }
.presets button:hover { color: var(--fg); border-color: var(--cyan); }

.brains { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 215px), 1fr)); gap: 10px; }
.brain { text-align: left; display: grid; gap: 8px; padding: 12px; background: var(--bg); border: 3px solid var(--line); color: var(--fg); position: relative; min-width: 0; }
.brain:hover { border-color: var(--line-2); }
.brain[aria-pressed="true"] { border-color: var(--gold); background: var(--bg-3); box-shadow: 0 0 0 3px var(--shadow), 0 0 0 6px var(--gold-2); }
.brain .cls { font-family: var(--font-display); font-size: 7px; color: var(--pink); letter-spacing: .06em; text-transform: uppercase; }
.brain h4 { font-size: 15px; font-weight: 700; }
.brain .prov { font-size: 12px; color: var(--muted); }
.brain .pips { display: grid; gap: 3px; }
.brain .pips div { display: grid; grid-template-columns: 52px 1fr; gap: 6px; align-items: center; color: var(--dim); font-family: var(--font-display); font-size: 6px; letter-spacing: .06em; }
.brain .pips i { display: flex; gap: 2px; }
.brain .pips i b { width: 10px; height: 8px; background: var(--line); }
.brain .pips i b.on { background: var(--cyan); }
.brain .cost { font-family: var(--font-term); font-size: 17px; color: var(--gold); }
.model-pick .brain h4 { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.model-pick .brain h4 .chip { font-size: 10px; padding: 2px 6px; }
.model-pick .brain .cost { font-size: 13px; color: var(--muted); }
.model-pick .brain .cls { color: var(--cyan); }
.brain-detail { display: grid; gap: 10px; }
.brain-detail .big { font-family: var(--font-term); font-size: 30px; color: var(--gold); line-height: 1; }

.summary { position: sticky; top: calc(var(--hud-h) + 16px); display: grid; gap: 14px; }
.summary .sprite { width: 96px; height: 96px; justify-self: center; }
.summary dl { margin: 0; display: grid; gap: 6px; }
.summary dl div { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; border-bottom: 2px dashed var(--line); padding-bottom: 6px; }
.summary dt { color: var(--muted); } .summary dd { margin: 0; text-align: right; font-weight: 600; max-width: 60%; overflow-wrap: anywhere; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; color: var(--muted); }
.check input { width: 20px; height: 20px; accent-color: var(--gold); flex: none; margin-top: 2px; }
.range-wrap { display: grid; gap: 8px; }
.range-wrap input[type=range] { width: 100%; accent-color: var(--gold); }
.range-wrap output { font-family: var(--font-term); font-size: 28px; color: var(--gold); }
.success { text-align: center; display: grid; gap: 16px; justify-items: center; padding: 30px 18px; }
.success .sprite { width: 140px; height: 140px; animation: idle 1.2s steps(2) infinite; }
@media (prefers-reduced-motion: reduce) { .success .sprite { animation: none; } }

/* ---------- token / furnace ---------- */
.furnace { display: grid; grid-template-columns: 1.2fr .8fr; gap: 20px; align-items: start; }
.flame-box { display: grid; gap: 14px; padding: 20px; background: linear-gradient(180deg, var(--bg-2), color-mix(in srgb, var(--pink) 12%, var(--bg-2))); }
.flame-box > .pxi { width: 56px; height: 56px; }
.ca { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-family: var(--font-term); font-size: 18px; background: var(--bg); border: 2px solid var(--line); padding: 8px 10px; overflow-wrap: anywhere; min-width: 0; }
.ca code { font: inherit; min-width: 0; overflow-wrap: anywhere; }
.flow { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr)); gap: 10px; }
.flow div { padding: 12px; background: var(--bg); border: 2px solid var(--line); display: grid; gap: 4px; font-size: 13px; }
.flow b { font-family: var(--font-display); font-size: 7px; color: var(--muted); letter-spacing: .08em; }
.flow .num { font-size: 26px; color: var(--pink); }

/* ---------- rules (docs) ---------- */
.rules { display: grid; grid-template-columns: 220px 1fr; gap: 28px; align-items: start; }
.subtabs { display: grid; gap: 4px; position: sticky; top: calc(var(--hud-h) + 16px); }
.subtabs a { font-family: var(--font-display); font-size: 8px; letter-spacing: .04em; padding: 11px 12px 9px; color: var(--muted); border-left: 4px solid transparent; text-transform: uppercase; line-height: 1.4; }
.subtabs a:hover { color: var(--fg); text-decoration: none; background: var(--bg-2); }
.subtabs a[aria-current="page"] { color: var(--gold); border-left-color: var(--gold); background: var(--bg-2); }
.doc { display: grid; gap: 18px; max-width: 72ch; min-width: 0; }
.doc h2 { font-family: var(--font-display); font-size: 15px; line-height: 1.6; color: var(--gold); }
.doc h3 { font-family: var(--font-display); font-size: 10px; line-height: 1.6; color: var(--fg); margin-top: 8px; }
.doc p, .doc li { font-size: 17px; line-height: 1.6; color: var(--fg); }
.doc ul, .doc ol { margin: 0; padding-left: 22px; display: grid; gap: 6px; }
.doc .callout { padding: 14px 16px; border: 3px solid var(--cyan); background: color-mix(in srgb, var(--cyan) 8%, var(--bg-2)); font-size: 15px; }
.doc .callout.warn { border-color: var(--red); background: color-mix(in srgb, var(--red) 10%, var(--bg-2)); }
.doc .callout.gold { border-color: var(--gold-2); background: color-mix(in srgb, var(--gold) 8%, var(--bg-2)); }
.doc table { width: 100%; border-collapse: collapse; font-size: 15px; }
.doc th, .doc td { text-align: left; padding: 8px 10px; border-bottom: 2px solid var(--line); vertical-align: top; }
.doc th { font-family: var(--font-display); font-size: 7px; letter-spacing: .08em; color: var(--muted); text-transform: uppercase; }
.doc td.num { font-family: var(--font-term); font-size: 19px; }
.doc code { font-family: var(--font-term); font-size: 18px; background: var(--bg); padding: 0 6px; border: 2px solid var(--line); }
.faq { display: grid; gap: 8px; }
.faq details { border: 3px solid var(--line); background: var(--bg-2); }
.faq summary { cursor: pointer; padding: 14px 16px; font-weight: 700; font-size: 16px; list-style: none; display: flex; justify-content: space-between; gap: 12px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: '+'; font-family: var(--font-display); color: var(--gold); flex: none; }
.faq details[open] summary::after { content: '-'; }
.faq details p { padding: 0 16px 16px; color: var(--muted); font-size: 15px; }
.trust { display: grid; gap: 10px; }
.trust-row { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: center; padding: 12px 14px; }
.trust-row b { font-weight: 700; display: block; } .trust-row small { color: var(--muted); font-size: 13px; }

/* ---------- footer ---------- */
footer { border-top: 3px solid var(--line); background: var(--bg-2); padding-inline: var(--gutter); padding-block: 28px 100px; display: grid; gap: 20px; }
.foot-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); gap: 20px; max-width: 1280px; margin-inline: auto; width: 100%; }
.foot-grid h4 { font-family: var(--font-display); font-size: 8px; color: var(--muted); letter-spacing: .08em; margin-bottom: 10px; }
.foot-grid ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: 14px; }
.foot-grid a { color: var(--fg); } .foot-grid a:hover { color: var(--gold); }
.health { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.health span::before { content: ''; display: inline-block; width: 8px; height: 8px; background: var(--lime); margin-right: 6px; }
.health span.bad::before { background: var(--red); }
.disclaimer { font-size: 13px; color: var(--dim); max-width: 1280px; margin-inline: auto; width: 100%; }

/* ---------- bottom nav (phones), modal, toasts ---------- */
.bottom-nav { display: none; }
.modal-backdrop { position: fixed; inset: 0; background: rgba(6,2,1,.78); z-index: 170; display: grid; place-items: center; padding: 16px; }
.modal { width: min(100%, 440px); display: grid; gap: 14px; }
.modal.intro { width: min(100%, 640px); max-height: calc(100vh - 32px); overflow-y: auto; }
.modal.intro .intro-head { display: flex; align-items: center; gap: 14px; }
.modal.intro .intro-head img { width: 56px; height: 56px; image-rendering: pixelated; flex: none; }
.modal.intro .intro-head h3 { margin: 0; font-size: 13px; }
.modal.intro .intro-head p { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.intro-steps { display: grid; gap: 8px; }
.intro-steps li { display: grid; grid-template-columns: 28px 1fr; gap: 10px; align-items: start; padding: 10px 12px; background: var(--bg-3); border: 2px solid var(--line); font-size: 14px; }
.intro-steps li i { font-family: var(--font-display); font-size: 10px; color: var(--gold); line-height: 1.6; font-style: normal; }
.intro-steps li b { display: block; font-weight: 700; }
.intro-steps li span { color: var(--muted); }
.intro-note { font-size: 13px; color: var(--dim); }
.intro-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.modal.intro .intro-actions { position: sticky; bottom: -18px; margin: 0 -18px -18px; padding: 10px 18px 18px; background: var(--bg-3); box-shadow: 0 -14px 12px -6px var(--bg-3); }
.btn-help { min-width: 38px; padding-inline: 10px; font-family: var(--font-display); font-size: 10px; }
.modal h3 { font-family: var(--font-display); font-size: 11px; color: var(--gold); line-height: 1.6; }
.wallets { display: grid; gap: 8px; }
.wallets .btn { justify-content: space-between; }
.toasts { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 180; display: grid; gap: 8px; width: min(100% - 32px, 420px); pointer-events: none; }
.toast { background: var(--bg-3); border: 3px solid var(--gold); padding: 12px 14px; font-size: 14px; box-shadow: 0 5px 0 var(--shadow); animation: logIn .2s steps(3); }
.toast.bad { border-color: var(--red); }

/* ---------- responsive ---------- */
@media (max-width: 1000px) {
  .hero { grid-template-columns: 1fr; }
  .wizard { grid-template-columns: 1fr; }
  .summary { position: static; }
  .furnace { grid-template-columns: 1fr; }
  .rules { grid-template-columns: 1fr; }
  .subtabs { position: static; display: flex; flex-wrap: wrap; gap: 4px; }
  .subtabs a { border-left: none; border-bottom: 4px solid transparent; }
  .subtabs a[aria-current="page"] { border-bottom-color: var(--gold); }
}
@media (max-width: 760px) {
  :root { --hud-h: 56px; }
  .tabs { display: none; }
  .hud { gap: 10px; }
  .logo span { display: none; }
  .bottom-nav { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 120; background: var(--bg-2); border-top: 3px solid var(--line); padding-bottom: env(safe-area-inset-bottom, 0px); }
  .bottom-nav a { flex: 1; display: grid; justify-items: center; gap: 4px; padding: 10px 4px 8px; font-family: var(--font-display); font-size: 6px; letter-spacing: .04em; color: var(--muted); text-transform: uppercase; }
  .bottom-nav a:hover { text-decoration: none; }
  .bottom-nav a .pxi { width: 18px; height: 18px; }
  .bottom-nav a[aria-current="page"] { color: var(--gold); }
  .rung { grid-template-columns: 48px 1fr; }
  .rung .note { grid-column: 1 / -1; }
  .rung .split { grid-column: 1 / -1; width: 100%; }
  .field-row { grid-template-columns: 1fr; }
  .modal.intro { gap: 10px; }
  .intro-steps li { padding: 8px 10px; font-size: 13px; }
  .cabinet-stage { grid-template-columns: 90px 1fr; }
  .cabinet-stage .sprite { width: 90px; height: 90px; }
  .drawer-id { grid-template-columns: 84px 1fr; }
  .drawer-id .sprite { width: 84px; height: 84px; }
  .board td:nth-child(5), .board th:nth-child(5) { display: none; }
  .wiz-steps button span { display: none; }
  .log { font-size: 17px; }
  .toasts { bottom: calc(80px + env(safe-area-inset-bottom, 0px)); }
}
