/* /play — game page. Base tokens, fonts, navbar and buttons come from /shared/base.css. */
:root {
  --hud: rgba(42, 31, 61, 0.74); --hud-2: rgba(58, 44, 84, 0.86); --hud-line: rgba(255, 228, 240, 0.16); --hud-text: #fff4ec; --hud-muted: rgba(255, 236, 228, 0.66);
  --top: calc(var(--nav-h) + 10px);
  --rail-w: 72px;
}
html, body { height: 100%; }
body.game { overflow: hidden; overscroll-behavior: none; background: var(--rose); }
.app { position: fixed; inset: 0; }
.stage { position: absolute; inset: 0; touch-action: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
#scene { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.ico { display: inline-grid; place-items: center; width: 20px; height: 20px; flex: none; }
.ico svg { width: 100%; height: 100%; }
.mono { font-family: var(--mono); font-size: 0.92em; letter-spacing: 0; }
.k { font: 800 10.5px/1.2 var(--body); letter-spacing: 0.2em; text-transform: uppercase; color: var(--hud-muted); margin: 0; }
.fine { font-size: 12.5px; color: var(--ink-2); margin-top: 12px; line-height: 1.5; }
.sub { font: 800 11.5px var(--body); letter-spacing: 0.2em; text-transform: uppercase; color: var(--ink-2); margin: 18px 0 10px; }
.sub:first-child { margin-top: 0; }

/* ── veil (loading) ─────────────────────────────────────────────────── */
.veil { position: absolute; inset: 0; z-index: 30; display: grid; place-items: center; background: radial-gradient(120% 90% at 50% 100%, #ffd2bd 0%, #f1bfb6 45%, #c9a6dc 100%); transition: opacity 0.6s; }
.veil-in { display: grid; justify-items: center; gap: 16px; text-align: center; padding: 24px; }
.veil-ridge svg { width: 160px; height: 54px; stroke: var(--ink); stroke-dasharray: 220; stroke-dashoffset: 220; animation: ridge 1.6s ease-in-out infinite; }
@keyframes ridge { 50% { stroke-dashoffset: 0; } 100% { stroke-dashoffset: -220; } }
#veil-msg { font: 400 26px/1.1 var(--display); color: var(--ink); max-width: 22ch; }
body:not([data-mode="boot"]) .veil:not(.on) { opacity: 0; pointer-events: none; }

/* ── HUD shell ──────────────────────────────────────────────────────── */
.hud { position: absolute; inset: 0; pointer-events: none; z-index: 10; color: var(--hud-text); }
.hud > * { pointer-events: auto; }
.hud-top, .rail, .side .card, .chartbar { background: var(--hud); border: 1px solid var(--hud-line); backdrop-filter: blur(12px) saturate(1.15); -webkit-backdrop-filter: blur(12px) saturate(1.15); box-shadow: 0 16px 40px -22px rgba(23, 15, 36, 0.8), inset 0 1px 0 rgba(255, 255, 255, 0.08); }

.hud-top { position: absolute; top: var(--top); left: 12px; right: 12px; height: 56px; display: flex; align-items: center; gap: 8px; padding: 0 8px; border-radius: 16px; }
.res { display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 12px 0 10px; border-radius: 11px; background: rgba(0, 0, 0, 0.18); border: 1px solid var(--hud-line); }
.res b { font: 400 20px/1 var(--display); font-variant-numeric: tabular-nums; min-width: 2ch; }
.res small { font: 700 10px var(--body); letter-spacing: 0.16em; text-transform: uppercase; color: var(--hud-muted); }
.res-powder { color: #dff3ff; } .res-powder .ico { color: #bfe6ff; }
.res.bump { animation: bump 0.45s ease; }
@keyframes bump { 30% { transform: scale(1.12); } }
.lvl { display: flex; align-items: center; gap: 10px; height: 40px; padding: 0 12px 0 0; flex: 0 1 260px; min-width: 150px; }
.lvl-badge { display: grid; place-items: center; width: 46px; height: 46px; margin: -3px 0; border-radius: 13px; color: var(--ink); background: linear-gradient(180deg, #ffe39a, var(--gold) 45%, var(--gold-2)); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7), 0 3px 0 var(--gold-deep), 0 0 18px rgba(255, 211, 107, 0.35); flex: none; }
.lvl-badge small { font: 800 8.5px/1 var(--body); letter-spacing: 0.14em; margin-bottom: -5px; }
.lvl-badge b { font: 400 22px/1 var(--display); }
.lvl.up .lvl-badge { animation: lvlup 1.2s ease; }
@keyframes lvlup { 20% { transform: scale(1.25) rotate(-6deg); box-shadow: 0 0 0 10px rgba(255, 211, 107, 0.35); } }
.xp { display: grid; gap: 5px; flex: 1; min-width: 0; }
.xpbar { height: 8px; border-radius: 5px; background: rgba(0, 0, 0, 0.3); overflow: hidden; }
.xpbar i { display: block; height: 100%; width: 0; border-radius: 5px; background: linear-gradient(90deg, var(--peach), var(--gold)); transition: width 0.6s ease; }
.xp-t { font: 700 11px var(--body); color: var(--hud-muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.trk-chip { display: flex; align-items: center; gap: 10px; height: 40px; padding: 0 12px; border-radius: 11px; border: 1px solid var(--hud-line); background: rgba(255, 255, 255, 0.06); cursor: pointer; color: inherit; min-width: 0; }
.trk-chip:hover { background: rgba(255, 255, 255, 0.12); }
.trk-sym { font: 400 19px/1 var(--display); }
.trk-meta { display: grid; text-align: left; font: 600 11px/1.25 var(--body); color: var(--hud-muted); white-space: nowrap; }
.trk-meta b { font-weight: 800; font-variant-numeric: tabular-nums; }
.hud-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.hbtn { display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 12px; border-radius: 11px; border: 1px solid var(--hud-line); background: rgba(255, 255, 255, 0.07); cursor: pointer; font: 800 11.5px var(--body); letter-spacing: 0.14em; text-transform: uppercase; color: var(--hud-text); }
.hbtn:hover, .hbtn.on { background: rgba(255, 255, 255, 0.14); border-color: var(--gold); }
.hbtn.linked { color: var(--gold); }
.holder-chip { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px; border-radius: 999px; font: 800 10.5px var(--body); letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink); background: linear-gradient(180deg, #ffe39a, var(--gold-2)); }
.holder-chip.preview { background: rgba(255, 255, 255, 0.14); color: var(--hud-text); box-shadow: inset 0 0 0 1px var(--hud-line); }

/* ── left rail ──────────────────────────────────────────────────────── */
.rail { position: absolute; top: calc(var(--top) + 66px); left: 12px; width: var(--rail-w); padding: 6px; display: flex; flex-direction: column; gap: 4px; border-radius: 18px; transition: opacity 0.3s; }
.rail button { position: relative; display: grid; justify-items: center; gap: 5px; padding: 11px 0 9px; border: 0; border-radius: 13px; background: transparent; color: var(--hud-muted); cursor: pointer; font: 800 9.5px var(--body); letter-spacing: 0.08em; text-transform: uppercase; transition: background 0.15s, color 0.15s; }
.rail button .ico { width: 24px; height: 24px; }
.rail button:hover { background: rgba(255, 255, 255, 0.08); color: var(--hud-text); }
.rail button[aria-current] { background: linear-gradient(180deg, rgba(255, 211, 107, 0.22), rgba(255, 179, 92, 0.12)); color: var(--gold); box-shadow: inset 0 0 0 1px rgba(255, 211, 107, 0.4); }
.rail .dot { position: absolute; top: 8px; right: 14px; width: 8px; height: 8px; border-radius: 50%; background: var(--up); box-shadow: 0 0 0 3px rgba(47, 217, 135, 0.25); }

/* ── panel (cream paper) ────────────────────────────────────────────── */
.panel { position: absolute; top: calc(var(--top) + 66px); left: calc(var(--rail-w) + 22px); bottom: 12px; width: min(420px, calc(100vw - 420px)); min-width: 340px; display: flex; flex-direction: column; overflow: hidden;
  border-radius: 20px; background: rgba(255, 250, 246, 0.95); color: var(--ink); box-shadow: 0 30px 70px -30px rgba(23, 15, 36, 0.7), inset 0 0 0 1px rgba(255, 255, 255, 0.6); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); animation: panelIn 0.22s ease; }
@keyframes panelIn { from { opacity: 0; transform: translateX(-12px); } }
.panel-head { display: flex; align-items: center; gap: 10px; padding: 16px 14px 14px 20px; border-bottom: 1px solid var(--line); background: linear-gradient(180deg, rgba(255, 211, 107, 0.16), transparent); }
.panel-k { font: 800 10.5px var(--body); letter-spacing: 0.2em; text-transform: uppercase; color: var(--gold-deep); margin-bottom: 4px; }
.panel-head h2 { font: 400 30px/1 var(--display); outline: none; }
.panel-x { margin-left: auto; width: 38px; height: 38px; display: grid; place-items: center; border-radius: 11px; border: 0; cursor: pointer; background: rgba(42, 31, 61, 0.07); color: var(--ink); flex: none; }
.panel-x:hover { background: rgba(42, 31, 61, 0.13); }
.panel-body { flex: 1; overflow: auto; padding: 16px 18px 22px; overscroll-behavior: contain; scrollbar-width: thin; }
.note { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 14px; background: rgba(185, 162, 232, 0.22); font-size: 13.5px; line-height: 1.45; margin-bottom: 14px; }
.note .ico { color: var(--ink-2); margin-top: 1px; }
.note.gold { background: rgba(255, 211, 107, 0.3); }
.note b { font-weight: 800; }
.empty { padding: 26px 12px; text-align: center; color: var(--ink-2); font-size: 14px; }
.empty b { display: block; font: 400 20px var(--display); color: var(--ink); margin-bottom: 6px; }
.seg { display: inline-flex; padding: 4px; gap: 4px; border-radius: 12px; background: rgba(42, 31, 61, 0.07); }
.seg button { border: 0; background: transparent; padding: 8px 12px; border-radius: 9px; font: 800 12px var(--body); letter-spacing: 0.08em; cursor: pointer; color: var(--ink-2); }
.seg button[aria-pressed="true"] { background: var(--paper); color: var(--ink); box-shadow: 0 2px 6px -2px rgba(42, 31, 61, 0.35); }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.panel .btn-sm { --bh: 38px; }
.panel .btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; filter: grayscale(0.3); }
.panel { z-index: 5; }
.linkish { border: 0; background: none; padding: 0; font: inherit; font-weight: 800; color: var(--ink); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.lockline { display: inline-flex; align-items: center; gap: 6px; font: 700 12px var(--body); color: var(--ink-2); }
.lockline .ico { width: 15px; height: 15px; }

/* tracks */
.today-card { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 2px 12px; padding: 14px 16px; border-radius: 16px; color: var(--cream); background: linear-gradient(135deg, #4a3a66, #2a1f3d); box-shadow: 0 10px 24px -14px rgba(23, 15, 36, 0.8); }
.today-card .k { color: var(--gold); }
.today-card h4 { font: 400 28px/1 var(--display); margin: 2px 0; }
.today-card p { font-size: 12.5px; color: rgba(255, 244, 230, 0.75); }
.today-card .btn { grid-row: 1 / span 3; grid-column: 2; }
.trk-tools { display: flex; gap: 8px; align-items: center; margin: 16px 0 10px; flex-wrap: wrap; }
.search { flex: 1 1 140px; display: flex; align-items: center; gap: 6px; height: 40px; padding: 0 10px; border-radius: 11px; background: rgba(42, 31, 61, 0.06); box-shadow: inset 0 0 0 1.5px var(--line); }
.search .ico { width: 16px; height: 16px; color: var(--ink-2); }
.search input { flex: 1; min-width: 0; border: 0; background: transparent; font: 600 14px var(--body); color: var(--ink); outline: none; }
.stocks { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 6px; }
.stock { position: relative; display: grid; gap: 1px; padding: 9px 10px; border-radius: 12px; border: 0; text-align: left; cursor: pointer; background: rgba(42, 31, 61, 0.05); box-shadow: inset 0 0 0 1.5px var(--line); color: var(--ink); min-width: 0; }
.stock b { font: 400 15px/1.1 var(--display); }
.stock small { font: 600 10.5px/1.2 var(--body); color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stock:hover { background: rgba(255, 211, 107, 0.25); }
.stock.cur { box-shadow: inset 0 0 0 2px var(--gold-deep); background: rgba(255, 211, 107, 0.3); }
.stock.locked { opacity: 0.6; }
.stock .lk { position: absolute; top: 7px; right: 7px; width: 13px; height: 13px; color: var(--ink-2); }
.pons { display: grid; gap: 8px; }
.pons-row { display: flex; gap: 8px; }
.pons input { flex: 1; min-width: 0; height: 42px; padding: 0 12px; border-radius: 11px; border: 0; background: rgba(42, 31, 61, 0.06); box-shadow: inset 0 0 0 1.5px var(--line); font: 600 13px var(--mono); color: var(--ink); }
.pons input:focus { outline: none; box-shadow: inset 0 0 0 2px var(--gold-deep); }
.pons .err { font-size: 12.5px; color: #c2324f; min-height: 1em; }
.pons p { font-size: 12.5px; color: var(--ink-2); }

/* garage */
.sleds { display: grid; gap: 10px; }
.sled { display: grid; grid-template-columns: 1fr auto; gap: 8px 12px; padding: 14px; border-radius: 16px; background: rgba(42, 31, 61, 0.05); box-shadow: inset 0 0 0 1.5px var(--line); cursor: pointer; transition: box-shadow 0.15s, background 0.15s; }
.sled:hover { background: rgba(255, 211, 107, 0.14); }
.sled.eq { box-shadow: inset 0 0 0 2px var(--gold-deep); background: rgba(255, 211, 107, 0.22); }
.sled.try { box-shadow: inset 0 0 0 2px var(--lilac); }
.sled h4 { font: 400 20px/1 var(--display); }
.sled p { grid-column: 1 / -1; font-size: 13px; color: var(--ink-2); line-height: 1.4; }
.sled .state { align-self: start; font: 800 10.5px var(--body); letter-spacing: 0.14em; text-transform: uppercase; padding: 6px 9px; border-radius: 8px; background: rgba(42, 31, 61, 0.08); white-space: nowrap; }
.sled.eq .state { background: var(--ink); color: var(--gold); }
.stats { grid-column: 1 / -1; display: grid; grid-template-columns: auto 1fr auto 1fr; gap: 6px 10px; align-items: center; font: 700 11px var(--body); color: var(--ink-2); }
.bars { display: flex; gap: 3px; }
.bars i { flex: 1; height: 7px; border-radius: 3px; background: rgba(42, 31, 61, 0.12); }
.bars i.on { background: linear-gradient(90deg, var(--gold-2), var(--gold)); }
.sled .btn-row { grid-column: 1 / -1; margin-top: 2px; }
.outfits { display: grid; gap: 14px; }
.slot h5 { font: 800 11px var(--body); letter-spacing: 0.18em; text-transform: uppercase; color: var(--ink-2); margin: 0 0 8px; }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.sw { position: relative; display: grid; justify-items: center; gap: 4px; width: 78px; padding: 8px 4px 6px; border: 0; border-radius: 13px; cursor: pointer; background: rgba(42, 31, 61, 0.05); box-shadow: inset 0 0 0 1.5px var(--line); color: var(--ink); font: 700 10.5px/1.15 var(--body); text-align: center; }
.sw i { width: 30px; height: 30px; border-radius: 50%; box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.15), 0 0 0 2px rgba(255, 255, 255, 0.85); }
.sw.eq { box-shadow: inset 0 0 0 2px var(--gold-deep); background: rgba(255, 211, 107, 0.22); }
.sw.try { box-shadow: inset 0 0 0 2px var(--lilac); }
.sw.locked { opacity: 0.6; }
.sw small { font: 700 9.5px var(--body); color: var(--ink-2); }
.tryline { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px; margin-top: 12px; border-radius: 12px; background: rgba(185, 162, 232, 0.22); font-size: 13px; font-weight: 600; }

/* quests */
.quests { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.quest { display: grid; grid-template-columns: auto 1fr auto; gap: 6px 12px; align-items: center; padding: 14px; border-radius: 16px; background: rgba(42, 31, 61, 0.05); box-shadow: inset 0 0 0 1.5px var(--line); }
.quest .tick { width: 30px; height: 30px; border-radius: 10px; display: grid; place-items: center; background: rgba(42, 31, 61, 0.08); color: transparent; }
.quest.done .tick { background: var(--up); color: #fff; }
.quest .tick svg { width: 18px; height: 18px; }
.quest h4 { font: 700 15px/1.3 var(--body); }
.quest .rw { font: 800 11.5px var(--body); color: var(--gold-deep); white-space: nowrap; text-align: right; }
.quest .qbar { grid-column: 2 / -1; height: 6px; border-radius: 4px; background: rgba(42, 31, 61, 0.1); overflow: hidden; }
.quest .qbar i { display: block; height: 100%; background: var(--up); }
.qmeta { display: flex; justify-content: space-between; gap: 10px; font: 700 12px var(--body); color: var(--ink-2); margin: 14px 2px 0; }

/* ranks */
.board { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 4px; }
.board li { display: grid; grid-template-columns: 34px 1fr auto; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 12px; background: rgba(42, 31, 61, 0.04); font-size: 14px; }
.board li:nth-child(-n+3) .pos { color: var(--ink); background: linear-gradient(180deg, #ffe39a, var(--gold-2)); }
.board .pos { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 9px; font: 400 13px var(--display); background: rgba(42, 31, 61, 0.08); }
.board .who { display: grid; min-width: 0; }
.board .who b { font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.board .who small { font-size: 11.5px; color: var(--ink-2); }
.board .sc { font: 400 17px var(--display); font-variant-numeric: tabular-nums; }
.board li.me { box-shadow: inset 0 0 0 2px var(--gold-deep); background: rgba(255, 211, 107, 0.2); }

/* trophies */
.tr-intro { font-size: 13.5px; color: var(--ink-2); line-height: 1.5; margin-bottom: 14px; }
.tr-intro b { color: var(--ink); }
.tr-list { display: grid; gap: 10px; }
.tr-card { display: grid; grid-template-columns: 86px 1fr; gap: 14px; align-items: center; padding: 12px; border-radius: 16px; background: rgba(42, 31, 61, 0.05); box-shadow: inset 0 0 0 1.5px var(--line); }
.tr-card h4 { font: 400 19px/1.1 var(--display); margin: 3px 0 2px; }
.tr-card p { font-size: 13px; color: var(--ink-2); }
.tr-card .btn-row { margin-top: 8px; align-items: center; }
.tr-card .btn-row a { font: 700 12.5px var(--body); color: var(--ink-2); }
.tr-art { width: 86px; height: 86px; border-radius: 14px; display: grid; place-items: center; overflow: hidden; background: linear-gradient(160deg, #4a3a66, #2a1f3d); }
.tr-svg { width: 100%; height: 100%; object-fit: cover; }
.tr-hall .pos.silver { background: linear-gradient(180deg, #f1ecff, #b9a2e8); } .tr-hall .pos.bronze { background: linear-gradient(180deg, #ffd9bf, #e59a6e); }
.medal { display: grid; place-items: center; width: 54px; height: 54px; border-radius: 50%; font: 400 24px var(--display); color: var(--ink); background: linear-gradient(180deg, #ffe39a, var(--gold-2)); box-shadow: 0 0 0 5px rgba(255, 211, 107, 0.25), inset 0 -3px 0 rgba(0, 0, 0, 0.15); }
.tr-card.silver .medal, .pos.silver { background: linear-gradient(180deg, #f1ecff, #b9a2e8); }
.tr-card.bronze .medal, .pos.bronze { background: linear-gradient(180deg, #ffd9bf, #e59a6e); }
.tr-ok { display: inline-flex; align-items: center; gap: 5px; font: 800 12px var(--body); letter-spacing: 0.1em; text-transform: uppercase; color: #12895a; }
.tr-ok .ico { width: 15px; height: 15px; }
.tr-hall { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.tr-hall > li { padding: 10px 12px; border-radius: 14px; background: rgba(42, 31, 61, 0.04); }
.tr-g { font: 800 13px var(--body); margin-bottom: 6px; }
.tr-hall ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.tr-hall ol li { display: grid; grid-template-columns: 26px 1fr auto auto; gap: 8px; align-items: center; font-size: 13.5px; }
.tr-hall .pos { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 7px; font: 400 11px var(--display); background: linear-gradient(180deg, #ffe39a, var(--gold-2)); }
.tr-hall .sc { font: 400 14px var(--display); }
.tr-chain { width: 15px; height: 15px; color: #12895a; }

/* wallet + settings */
.wbox { display: grid; gap: 10px; padding: 14px; border-radius: 16px; background: rgba(42, 31, 61, 0.05); box-shadow: inset 0 0 0 1.5px var(--line); margin-bottom: 8px; }
.wbox .addr { font: 600 14px var(--mono); word-break: break-all; }
.wbox p { font-size: 13.5px; color: var(--ink-2); line-height: 1.45; }
.panel .ca { box-shadow: inset 0 0 0 1.5px var(--line); background: rgba(255, 255, 255, 0.6); }
.opt { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.opt p { font-size: 13px; color: var(--ink-2); }
.opt h4 { font: 800 15px var(--body); margin-bottom: 2px; }
.namefield { display: flex; gap: 8px; margin-top: 8px; }
.namefield input { flex: 1; min-width: 0; height: 40px; padding: 0 12px; border-radius: 11px; border: 0; background: rgba(42, 31, 61, 0.06); box-shadow: inset 0 0 0 1.5px var(--line); font: 600 14px var(--body); color: var(--ink); }

/* ── right side: track card + live run ──────────────────────────────── */
.side { position: absolute; top: calc(var(--top) + 66px); right: 12px; width: 268px; display: grid; gap: 10px; }
.side .card { border-radius: 18px; padding: 14px 16px; }
.tc-sym { font: 400 34px/1 var(--display); margin: 6px 0 4px; }
.tc-move { font: 800 14px var(--body); font-variant-numeric: tabular-nums; }
.tc-meta { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 12px 0 0; font-size: 12.5px; }
.tc-meta dt { color: var(--hud-muted); font-weight: 700; }
.tc-meta dd { margin: 0; text-align: right; font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tc-meta a { color: var(--gold); text-decoration: none; }
.tc-meta a:hover { text-decoration: underline; }
.tc-best { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--hud-line); font-size: 12.5px; color: var(--hud-muted); }
.tc-best:empty { display: none; }
.tc-best b { color: var(--gold); font-weight: 800; }
.runcard { display: grid; gap: 10px; transition: box-shadow 0.3s; }
.rc-score { display: flex; align-items: baseline; justify-content: space-between; }
.rc-score b { font: 400 36px/1 var(--display); font-variant-numeric: tabular-nums; }
.rc-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.rc-row > span { display: grid; gap: 2px; }
.rc-row b { font: 800 17px var(--body); font-variant-numeric: tabular-nums; }
.rc-streak { display: flex; align-items: center; justify-content: space-between; }
#streak { display: flex; gap: 5px; }
#streak i { width: 24px; height: 10px; border-radius: 5px; background: rgba(255, 255, 255, 0.16); transition: background 0.2s, box-shadow 0.2s; }
#streak i.on { background: var(--gold); box-shadow: 0 0 12px var(--gold); }
body.boost #streak i.on { background: var(--up); box-shadow: 0 0 14px var(--up); }
body.boost .runcard { box-shadow: 0 0 0 2px rgba(47, 217, 135, 0.6), 0 0 40px -8px rgba(47, 217, 135, 0.6); }

/* ── bottom chart bar (progress on the real chart) ──────────────────── */
.chartbar { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); width: min(560px, calc(100vw - 2 * var(--rail-w) - 80px)); padding: 8px 12px 6px; border-radius: 16px; display: grid; gap: 4px; }
#mini { width: 100%; height: 46px; display: block; }
.timebar { height: 5px; border-radius: 3px; background: rgba(0, 0, 0, 0.3); overflow: hidden; }
.timebar i { display: block; height: 100%; transform-origin: left; background: linear-gradient(90deg, var(--lilac), #fff); }
.cb-labels { display: flex; justify-content: space-between; font: 800 9.5px var(--body); letter-spacing: 0.16em; text-transform: uppercase; color: var(--hud-muted); }
.cb-labels #cb-left { color: var(--hud-text); letter-spacing: 0.04em; font-variant-numeric: tabular-nums; }

/* ── flash words + ticker ───────────────────────────────────────────── */
#flash { position: absolute; left: 50%; top: 36%; transform: translate(-50%, -50%) scale(0.8); font: 400 clamp(40px, 6vw, 72px)/1 var(--display); opacity: 0; pointer-events: none; z-index: 12; color: #fff;
  text-shadow: 0 4px 0 rgba(42, 31, 61, 0.5), 0 10px 30px rgba(42, 31, 61, 0.35); transition: transform 0.18s, opacity 0.18s; white-space: nowrap; }
#flash.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }
#flash.clean { color: var(--gold); } #flash.rough { color: var(--down); } #flash.boost { color: var(--up); } #flash.go { color: #fff; }
.ticker { position: absolute; left: 50%; bottom: 112px; transform: translateX(-50%); pointer-events: none; text-align: center; max-width: calc(100% - 32px); }
.ticker > span { display: inline-block; padding: 8px 14px; border-radius: 11px; background: var(--hud); color: var(--hud-text); font: 600 13px var(--body); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); animation: tick 3.2s ease forwards; white-space: nowrap; }
.ticker > span b { color: var(--gold); }
@keyframes tick { 0% { opacity: 0; transform: translateY(8px); } 10%, 80% { opacity: 1; transform: none; } 100% { opacity: 0; } }

/* boost vignette (CSS, on top of the 3D speed lines) */
.stage::after { content: ''; position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity 0.4s; background: radial-gradient(120% 90% at 50% 50%, transparent 55%, rgba(47, 217, 135, 0.2) 100%); }
body.boost .stage::after { opacity: 1; }

/* ── attract card ───────────────────────────────────────────────────── */
.attract { position: absolute; left: calc(var(--rail-w) + 28px); bottom: 104px; max-width: 520px; padding: 22px 24px 20px; border-radius: 22px; color: var(--ink);
  background: rgba(255, 250, 246, 0.86); box-shadow: 0 30px 60px -30px rgba(23, 15, 36, 0.7), inset 0 0 0 1px rgba(255, 255, 255, 0.7); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.attract h1 { font-size: clamp(34px, 4.2vw, 56px); margin: 8px 0 14px; }
.attract .at-h { color: var(--ink-2); font-size: 0.5em; white-space: nowrap; }
.how { list-style: none; margin: 0 0 18px; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.how li { padding: 8px 12px; border-radius: 11px; background: rgba(42, 31, 61, 0.06); font-size: 14px; font-weight: 600; }
.cta { animation: ctaPulse 1.8s ease-in-out infinite; touch-action: none; }
.cta .ico { width: 18px; height: 18px; }
@keyframes ctaPulse { 50% { transform: translateY(-3px); } }
.attract .hint { margin-top: 10px; font-size: 13px; color: var(--ink-2); font-weight: 600; }

/* ── result slip ────────────────────────────────────────────────────── */
.slip { position: absolute; inset: 0; z-index: 20; display: flex; flex-direction: column; align-items: center; padding: calc(var(--nav-h) + 16px) 16px 16px; background: rgba(42, 31, 61, 0.25); overflow: auto; }
.slip-in { position: relative; flex: none; margin: auto 0; width: min(400px, 100%); padding: 22px 22px 18px; border-radius: 6px 6px 20px 20px; text-align: center; color: var(--ink); background: var(--paper);
  box-shadow: 0 30px 80px -20px rgba(23, 15, 36, 0.6); animation: slipIn 0.35s cubic-bezier(.2, .9, .3, 1.2); }
.slip-in::before { content: ''; position: absolute; left: 0; right: 0; top: -9px; height: 10px; background: radial-gradient(circle at 7px 10px, var(--paper) 6.5px, transparent 7px) 0 0 / 14px 10px repeat-x; }
@keyframes slipIn { from { opacity: 0; transform: translateY(40px) rotate(-1.5deg); } }
.slip .k { color: var(--ink-2); }
.slip-score b { display: block; font: 400 68px/1 var(--display); margin: 8px 0 4px; font-variant-numeric: tabular-nums; }
.verify { display: inline-flex; align-items: center; gap: 6px; font: 800 11px var(--body); letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-2); min-height: 18px; }
.verify.ok { color: #12895a; } .verify.bad { color: #c2324f; }
.verify .ico { width: 15px; height: 15px; }
.slip-end { font-weight: 800; margin: 6px 0 12px; }
.slip-dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; text-align: left; margin: 0 0 12px; padding: 12px 0; border-top: 2px dashed rgba(42, 31, 61, 0.18); border-bottom: 2px dashed rgba(42, 31, 61, 0.18); font-size: 14px; }
.slip-dl dt { font-weight: 700; color: var(--ink-2); } .slip-dl dd { margin: 0; text-align: right; font-weight: 800; font-variant-numeric: tabular-nums; }
.slip-rewards { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; }
.slip-rewards:empty { display: none; }
.rw-pill { display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: 11px; font: 800 14px var(--body); background: rgba(42, 31, 61, 0.06); }
.rw-pill .ico { width: 16px; height: 16px; }
.rw-pill.gold { background: linear-gradient(180deg, #ffe39a, var(--gold-2)); }
.rw-pill.muted { font-weight: 600; font-size: 12.5px; color: var(--ink-2); }
.slip-quests { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 6px; text-align: left; }
.slip-quests:empty { display: none; }
.slip-quests li { display: flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 600; color: var(--ink-2); }
.slip-quests li i { width: 20px; height: 20px; border-radius: 7px; display: grid; place-items: center; background: rgba(42, 31, 61, 0.08); flex: none; color: transparent; }
.slip-quests li.done { color: var(--ink); }
.slip-quests li.done i { background: var(--up); color: #fff; }
.slip-quests li i svg { width: 13px; height: 13px; }
.slip-quests li b { margin-left: auto; color: var(--gold-deep); font-size: 12px; white-space: nowrap; }
.slip-btns { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 16px; }
.slip-btns .btn-gold { flex: 1 1 100%; }
.slip-btns kbd { font-size: 0.7em; }
.slip-btns .ico { width: 16px; height: 16px; }

/* ── modes ──────────────────────────────────────────────────────────── */
body[data-mode="boot"] .hud > :not(.hud-top) { visibility: hidden; }
body:not([data-mode="attract"]) .attract { display: none; }
body[data-mode="attract"] .runcard { display: none; }
body[data-mode="live"] .rail { opacity: 0.35; }
body[data-mode="live"] .rail:hover { opacity: 1; }
body.panel-open .attract { display: none; }
body[data-mode="live"] .panel { display: none; }

/* ── tablet / phone ─────────────────────────────────────────────────── */
@media (max-width: 1100px) {
  .side { width: 230px; }
  .trackcard .tc-meta, .trackcard .tc-best { display: none; }
  .panel { width: min(420px, calc(100vw - var(--rail-w) - 290px)); }
}
@media (max-width: 860px) {
  :root { --rail-w: 0px; }
  .hud-top { height: 50px; top: calc(var(--nav-h) + 6px); left: 8px; right: 8px; gap: 6px; padding: 0 6px; border-radius: 14px; }
  .res { height: 36px; padding: 0 9px 0 8px; } .res small { display: none; } .res b { font-size: 17px; }
  .lvl { flex: 1 1 auto; min-width: 0; } .lvl-badge { width: 38px; height: 38px; border-radius: 11px; } .lvl-badge b { font-size: 18px; }
  .trk-chip { height: 36px; padding: 0 9px; } .trk-sym { font-size: 16px; } .trk-meta { display: none; }
  .hbtn { height: 36px; padding: 0 9px; } .hbtn-t { display: none; } .holder-chip { display: none; }
  .rail { top: auto; bottom: max(8px, env(safe-area-inset-bottom)); left: 8px; right: 8px; width: auto; flex-direction: row; justify-content: space-around; padding: 4px; border-radius: 16px; }
  .rail button { flex: 1; min-width: 0; padding: 8px 0 6px; font-size: 8.5px; letter-spacing: 0.06em; }
  .rail button .ico { width: 22px; height: 22px; }
  .rail .dot { right: calc(50% - 18px); top: 5px; }
  .panel { left: 8px; right: 8px; width: auto; min-width: 0; top: calc(var(--nav-h) + 64px); bottom: calc(78px + env(safe-area-inset-bottom)); border-radius: 18px; animation-name: sheetIn; }
  @keyframes sheetIn { from { opacity: 0; transform: translateY(16px); } }
  .panel-head { padding: 12px 12px 10px 16px; } .panel-head h2 { font-size: 24px; }
  .panel-body { padding: 14px 14px 18px; }
  .side { top: calc(var(--nav-h) + 64px); right: 8px; width: 138px; gap: 6px; }
  .side .k { font-size: 9px; letter-spacing: 0.14em; }
  .trackcard { display: none; }
  .side .card { padding: 10px 12px; border-radius: 14px; }
  .runcard { gap: 5px; } .rc-score b { font-size: 24px; } .rc-row b { font-size: 13px; } .rc-row { gap: 4px; } .rc-row > span { gap: 0; }
  .rc-streak .k { display: none; } #streak { flex: 1; } #streak i { flex: 1; width: auto; }
  .chartbar { bottom: calc(80px + env(safe-area-inset-bottom)); width: calc(100vw - 16px); padding: 6px 10px 4px; border-radius: 14px; }
  #mini { height: 32px; }
  .attract { left: 8px; right: 8px; bottom: calc(152px + env(safe-area-inset-bottom)); max-width: none; padding: 16px 16px 14px; border-radius: 18px; }
  .attract h1 { font-size: 30px; margin: 4px 0 10px; }
  .how { gap: 6px; margin-bottom: 12px; } .how li { font-size: 12.5px; padding: 6px 9px; }
  .attract .btn { width: 100%; }
  .attract .hint { display: none; }
  .ticker { bottom: calc(152px + env(safe-area-inset-bottom)); }
  body[data-mode="live"] .rail { opacity: 0; pointer-events: none; }
  body.panel-open .chartbar, body.panel-open .side { display: none; }
  body[data-mode="live"] .chartbar { bottom: calc(10px + env(safe-area-inset-bottom)); }
  .slip { padding-top: calc(var(--nav-h) + 14px); }
  .slip-score b { font-size: 54px; }
  .slip-dl { font-size: 13px; gap: 4px 10px; }
  .sw { width: calc(33.3% - 6px); }
}
@media (max-width: 400px) {
  .lvl .xp { display: none; } .lvl { flex: 0 0 auto; padding: 0; }
  .trk-chip { flex: 1 1 auto; justify-content: center; }
}
@media (max-height: 560px) and (max-width: 960px) { .attract { display: none !important; } }
