@font-face { font-family: 'Barlow Condensed'; font-weight: 600; font-style: normal; font-display: swap; src: url('../fonts/barlow-condensed-latin-600-normal.woff2') format('woff2'); }
@font-face { font-family: 'Barlow Condensed'; font-weight: 600; font-style: italic; font-display: swap; src: url('../fonts/barlow-condensed-latin-600-italic.woff2') format('woff2'); }
@font-face { font-family: 'Barlow Condensed'; font-weight: 700; font-style: normal; font-display: swap; src: url('../fonts/barlow-condensed-latin-700-normal.woff2') format('woff2'); }
@font-face { font-family: 'Barlow Condensed'; font-weight: 700; font-style: italic; font-display: swap; src: url('../fonts/barlow-condensed-latin-700-italic.woff2') format('woff2'); }
@font-face { font-family: 'Barlow Condensed'; font-weight: 800; font-style: normal; font-display: swap; src: url('../fonts/barlow-condensed-latin-800-normal.woff2') format('woff2'); }
@font-face { font-family: 'Barlow Condensed'; font-weight: 800; font-style: italic; font-display: swap; src: url('../fonts/barlow-condensed-latin-800-italic.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-weight: 400; font-display: swap; src: url('../fonts/inter-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-weight: 500; font-display: swap; src: url('../fonts/inter-latin-500-normal.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-weight: 600; font-display: swap; src: url('../fonts/inter-latin-600-normal.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-weight: 700; font-display: swap; src: url('../fonts/inter-latin-700-normal.woff2') format('woff2'); }

/* Broadcast-style UI: dark glass panels, condensed italic display type, one warm accent. */
:root {
  --ink: #f4f1ec;
  --dim: rgba(244, 241, 236, 0.62);
  --faint: rgba(244, 241, 236, 0.14);
  --glass: rgba(14, 13, 16, 0.62);
  --glass2: rgba(24, 22, 27, 0.78);
  --line: rgba(255, 255, 255, 0.12);
  --accent: #ffb547;
  --accent2: #ff8a3d;
  --red: #ff4d3d;
  --green: #3ddc84;
  --blue: #4aa3ff;
  --r0: #a9b2bc;
  --r1: #4aa3ff;
  --r2: #b47cff;
  --r3: #ffc94d;
  --display: 'Barlow Condensed', 'Arial Narrow', system-ui, sans-serif;
  --body: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --blur: blur(16px) saturate(1.2);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #1a1714; color: var(--ink); font-family: var(--body); font-weight: 500; user-select: none; -webkit-user-select: none; touch-action: none; -webkit-font-smoothing: antialiased; }
canvas#gl { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; }
.hidden { display: none !important; }
.dim { color: var(--dim); }
kbd { display: inline-block; padding: 1px 6px; border-radius: 4px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.08); font: 600 0.78em var(--body); }
button { font: inherit; color: inherit; cursor: pointer; }
input, select { font: inherit; color: var(--ink); }
h2, h3 { font-family: var(--display); font-style: italic; font-weight: 800; text-transform: uppercase; letter-spacing: 0.02em; margin: 0; }
h2 { font-size: 2rem; line-height: 1; }
h3 { font-size: 1.1rem; color: var(--dim); }

/* ---------- panels & buttons ---------- */
.panel { background: var(--glass2); border: 1px solid var(--line); border-radius: 14px; backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur); box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45); }
.btn { position: relative; border: 1px solid var(--line); border-radius: 10px; padding: 11px 20px; font: italic 800 1.1rem var(--display); letter-spacing: 0.06em; text-transform: uppercase; background: rgba(255, 255, 255, 0.07); color: var(--ink); display: inline-flex; align-items: center; justify-content: center; gap: 8px; transition: background 0.15s, transform 0.08s, border-color 0.15s; }
.btn:hover { background: rgba(255, 255, 255, 0.14); border-color: rgba(255, 255, 255, 0.28); }
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.4; cursor: default; }
.btn.yellow { background: var(--accent); color: #1a1208; border-color: transparent; }
.btn.yellow:hover { background: #ffc46a; }
.btn.blue, .btn.green, .btn.pink { background: rgba(255, 255, 255, 0.1); }
.btn.ghost { background: transparent; }
.btn.big { width: 100%; font-size: 1.4rem; flex-direction: column; gap: 0; }
.btn.tiny { padding: 6px 12px; font-size: 0.9rem; border-radius: 8px; }
.round { width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--line); background: var(--glass); backdrop-filter: var(--blur); font-size: 1.05rem; color: var(--ink); }
.badge { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--accent); color: #1a1208; font: 700 0.7rem var(--body); }
.row2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.row3 { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.col { display: flex; flex-direction: column; gap: 10px; }
.kicker { font: italic 700 0.85rem var(--display); letter-spacing: 0.32em; color: var(--accent); }
.wordmark { font: italic 800 clamp(3.4rem, 8.5vw, 7rem) / 0.86 var(--display); letter-spacing: -0.01em; color: #fff; text-transform: uppercase; text-shadow: 0 8px 40px rgba(0, 0, 0, 0.45); margin: 6px 0 0; }

/* ---------- screens ---------- */
#screens { position: fixed; inset: 0; pointer-events: none; z-index: 20; }
.screen { position: absolute; inset: 0; display: grid; grid-template-columns: minmax(0, 1fr); place-items: center; padding: calc(16px + var(--safe-t)) 16px calc(16px + var(--safe-b)); pointer-events: auto; overflow-y: auto; }
.screen.overlay { background: radial-gradient(ellipse at center, rgba(10, 9, 12, 0.35), rgba(10, 9, 12, 0.75)); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
#s-loading { background: radial-gradient(ellipse at 30% 40%, #3a2e22, #120f0d 70%); }
.loading { width: min(520px, 90vw); }
.loading .wordmark { font-size: clamp(2.6rem, 7vw, 4.4rem); }
.loadbar { height: 2px; background: var(--faint); margin: 22px 0 12px; overflow: hidden; }
.loadbar i { display: block; height: 100%; width: 35%; background: var(--accent); animation: load 1.2s ease-in-out infinite; }
@keyframes load { from { transform: translateX(-100%); } to { transform: translateX(300%); } }
#loading-text { color: var(--dim); font-size: 0.92rem; margin: 0; }

/* menu: brand and actions on the left over the live race */
#s-menu { place-items: center start; background: linear-gradient(90deg, rgba(8, 7, 9, 0.82) 0%, rgba(8, 7, 9, 0.55) 34%, rgba(8, 7, 9, 0) 62%); padding-left: clamp(16px, 6vw, 96px); }
.menu-wrap { width: min(440px, 100%); display: flex; flex-direction: column; gap: 22px; }
.brand .tagline { color: var(--dim); font-size: 0.98rem; line-height: 1.5; margin: 14px 0 0; max-width: 400px; }
.menu-card { display: flex; flex-direction: column; gap: 10px; }
.who { display: flex; gap: 8px; }
.who input { flex: 1; min-width: 0; border: 1px solid var(--line); border-radius: 10px; padding: 11px 14px; font-size: 1rem; background: rgba(255, 255, 255, 0.06); font-weight: 600; outline: none; }
.who input:focus { border-color: var(--accent); }
.who input::placeholder { color: rgba(255, 255, 255, 0.35); }
.skin-chip { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 10px; background: rgba(255, 255, 255, 0.06); padding: 6px 12px 6px 7px; font-weight: 600; font-size: 0.9rem; max-width: 46%; }
.skin-chip:hover { border-color: rgba(255, 255, 255, 0.3); }
.skin-chip span:last-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dot { width: 26px; height: 26px; flex: 0 0 26px; border-radius: 50%; box-shadow: inset -3px -4px 6px rgba(0, 0, 0, 0.45), inset 3px 3px 5px rgba(255, 255, 255, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.15); }
.mbtn { position: relative; display: flex; align-items: baseline; justify-content: space-between; gap: 12px; width: 100%; padding: 14px 18px; border: 1px solid var(--line); border-radius: 10px; background: rgba(255, 255, 255, 0.06); text-align: left; transition: background 0.15s, border-color 0.15s, transform 0.15s; overflow: hidden; }
.mbtn span { font: italic 800 1.6rem/1 var(--display); text-transform: uppercase; letter-spacing: 0.03em; }
.mbtn small { color: var(--dim); font-size: 0.8rem; }
.mbtn:hover { background: rgba(255, 255, 255, 0.12); border-color: rgba(255, 255, 255, 0.3); transform: translateX(4px); }
.mbtn.primary { background: var(--accent); color: #1a1208; border-color: transparent; }
.mbtn.primary small { color: rgba(26, 18, 8, 0.7); }
.mbtn.primary:hover { background: #ffc46a; }
.mbtn.small { padding: 11px 14px; justify-content: center; }
.mbtn.small span { font-size: 1.15rem; }
.links { display: flex; gap: 18px; padding-top: 4px; }
.link { background: none; border: none; padding: 4px 0; color: var(--dim); font: 600 0.9rem var(--body); display: inline-flex; gap: 6px; align-items: center; border-bottom: 1px solid transparent; }
.link:hover { color: var(--ink); border-bottom-color: var(--accent); }
.menu-foot { display: flex; gap: 22px; flex-wrap: wrap; }
.stat { display: flex; flex-direction: column; line-height: 1; }
.stat small { font: 700 0.62rem var(--body); letter-spacing: 0.16em; color: var(--dim); }
.stat b { font: italic 800 1.7rem var(--display); margin-top: 3px; }
.stat.live { justify-content: flex-end; color: var(--green); font-size: 0.8rem; font-weight: 600; }
.stat.live:empty { display: none; }
.back { color: var(--dim); font-size: 0.82rem; text-decoration: none; }
.back::before { content: '← '; }
.back:hover { color: var(--ink); }

/* dialogs */
.dialog { padding: 26px; width: min(440px, 100%); text-align: center; display: flex; flex-direction: column; gap: 16px; }
.dialog.wide { width: min(780px, 100%); }
.code-input { text-align: center; font: italic 800 2.6rem var(--display); letter-spacing: 0.4em; text-transform: uppercase; border: 1px solid var(--line); border-radius: 10px; padding: 8px; background: rgba(255, 255, 255, 0.06); outline: none; }
.code-input:focus { border-color: var(--accent); }

/* lobby */
.lobby { width: min(820px, 100%); padding: 24px; display: flex; flex-direction: column; gap: 14px; max-height: 92vh; }
.lobby-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.lobby-head p { margin: 6px 0 0; }
.lobby-code { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.lobby-code small { font-size: 0.65rem; letter-spacing: 0.2em; color: var(--dim); }
.lobby-code b { font: italic 800 2.4rem/1 var(--display); letter-spacing: 0.2em; color: var(--accent); }
.lobby-count { font-size: 0.95rem; color: var(--dim); }
.lobby-count b { color: var(--ink); font: italic 800 1.3rem var(--display); }
#l-players { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 6px; overflow-y: auto; min-height: 120px; }
#l-players li { display: flex; align-items: center; gap: 8px; background: rgba(255, 255, 255, 0.05); border: 1px solid var(--line); border-radius: 8px; padding: 6px 9px; font-size: 0.88rem; white-space: nowrap; overflow: hidden; }
#l-players li .dot { width: 20px; height: 20px; flex-basis: 20px; }
#l-players li .nm { overflow: hidden; text-overflow: ellipsis; flex: 1; font-weight: 600; }
#l-players li.ready { border-color: rgba(61, 220, 132, 0.5); }
#l-players li .tag { font: 700 0.62rem var(--body); letter-spacing: 0.1em; color: #1a1208; background: var(--accent); border-radius: 4px; padding: 1px 5px; }
.lobby-foot { display: flex; gap: 10px; align-items: center; justify-content: flex-end; flex-wrap: wrap; }
.lobby-timer { margin-right: auto; font: italic 800 1.5rem var(--display); text-transform: uppercase; }
#l-ready.on { background: var(--green); color: #07210f; }

/* ---------- cards ---------- */
.cards { display: flex; gap: 18px; justify-content: center; flex-wrap: wrap; perspective: 1200px; }
.card { --rc: var(--r0); --rc2: #5c636b; position: relative; width: 206px; min-height: 290px; border-radius: 14px; padding: 2px; background: linear-gradient(150deg, var(--rc), var(--rc2) 45%, var(--rc) 100%); box-shadow: 0 24px 50px rgba(0, 0, 0, 0.55); cursor: pointer; transition: transform 0.2s cubic-bezier(0.2, 0.9, 0.3, 1.2), box-shadow 0.2s; color: var(--ink); }
.card > .inner { position: relative; height: 100%; min-height: inherit; border-radius: 12px; background: radial-gradient(ellipse at 50% 18%, color-mix(in srgb, var(--rc) 38%, #17151a), #121114 68%); padding: 14px 14px 12px; display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; overflow: hidden; }
.card.r1 { --rc: var(--r1); --rc2: #1d4f8c; }
.card.r2 { --rc: var(--r2); --rc2: #4d2a8a; }
.card.r3 { --rc: var(--r3); --rc2: #9a5c00; }
.card.r3 > .inner::after, .card.r2 > .inner::after { content: ''; position: absolute; inset: -50%; background: linear-gradient(115deg, transparent 42%, rgba(255, 255, 255, 0.16) 50%, transparent 58%); animation: shine 3.2s infinite; pointer-events: none; }
@keyframes shine { 0% { transform: translateX(-60%); } 55%, 100% { transform: translateX(60%); } }
.card:hover { transform: translateY(-8px); box-shadow: 0 34px 60px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.2); }
.ico { width: 1em; height: 1em; display: inline-block; vertical-align: -0.14em; flex: none; }
.card .icon .ico { stroke-width: 1.6; }
.medal .ico { vertical-align: -0.18em; }
.medal.m0 { color: #f5c542; } .medal.m1 { color: #c9d1d9; } .medal.m2 { color: #d08a52; }
.live { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #3ddc84; margin-right: 6px; box-shadow: 0 0 8px #3ddc84; vertical-align: 0.05em; }
.card .icon { font-size: 3.4rem; height: 96px; display: grid; place-items: center; margin-top: 8px; filter: brightness(0) invert(1) drop-shadow(0 0 18px color-mix(in srgb, var(--rc) 80%, transparent)); }
.card .name { font: italic 800 1.45rem/1 var(--display); text-transform: uppercase; letter-spacing: 0.02em; }
.card .desc { font-size: 0.84rem; line-height: 1.35; color: var(--dim); flex: 1; }
.card .foot { display: flex; justify-content: space-between; width: 100%; font-size: 0.66rem; align-items: center; border-top: 1px solid var(--line); padding-top: 8px; }
.card .rar { font: 700 0.62rem var(--body); letter-spacing: 0.16em; color: var(--rc); }
.card .stars { color: var(--accent); letter-spacing: 2px; font-size: 0.78rem; }
.card .kind { position: absolute; top: 10px; left: 12px; font: 700 0.58rem var(--body); letter-spacing: 0.16em; color: var(--dim); }
.card .count { position: absolute; top: 9px; right: 11px; font: italic 800 0.95rem var(--display); color: var(--ink); }
.card.deal { animation: deal 0.6s cubic-bezier(0.2, 1.2, 0.35, 1) both; }
.card.deal:nth-child(2) { animation-delay: 0.1s; }
.card.deal:nth-child(3) { animation-delay: 0.2s; }
@keyframes deal { from { transform: translateY(80px) rotateY(80deg) scale(0.85); opacity: 0; } to { transform: none; opacity: 1; } }
.card.picked, .card.picked:hover { transform: translateY(-14px) scale(1.05); box-shadow: 0 0 0 2px var(--accent), 0 30px 70px rgba(0, 0, 0, 0.6), 0 0 60px rgba(255, 181, 71, 0.35); }
.card.dull { opacity: 0.3; transform: scale(0.95); }
.card.small { width: 156px; min-height: 214px; }
.card.small > .inner { padding: 10px 10px 9px; gap: 5px; }
.card.small .icon { font-size: 2.4rem; height: 62px; margin-top: 8px; }
.card.small .name { font-size: 1.12rem; }
.card.small .desc { font-size: 0.72rem; }
.card.locked { cursor: default; background: linear-gradient(150deg, #3a3740, #24222a); }
.card.locked > .inner > * { visibility: hidden; }
.card.locked > .inner::before { content: 'LOCKED'; position: absolute; inset: 0; display: grid; place-items: center; font: italic 800 1.1rem var(--display); letter-spacing: 0.24em; color: rgba(255, 255, 255, 0.25); background: repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.025) 0 8px, transparent 8px 16px); }
.card.out { opacity: 0.45; }
.card.out > .inner::before { content: 'NOT IN DECK'; position: absolute; z-index: 2; top: 44%; left: -10%; right: -10%; background: rgba(0, 0, 0, 0.75); color: var(--dim); font: 700 0.62rem var(--body); letter-spacing: 0.2em; padding: 4px; transform: rotate(-10deg); }
.card .replaces { font: 700 0.62rem var(--body); letter-spacing: 0.08em; color: var(--accent); text-transform: uppercase; }
.card .infield { position: absolute; top: 9px; right: 10px; font: 700 0.56rem var(--body); letter-spacing: 0.08em; color: var(--dim); text-transform: uppercase; }
.mini-hand { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.mini { display: inline-flex; align-items: center; gap: 5px; padding: 4px 9px 4px 6px; border-radius: 6px; border: 1px solid var(--line); background: var(--glass); backdrop-filter: var(--blur); font-size: 0.72rem; font-weight: 600; color: var(--ink); }
.mini b { font-size: 0.95rem; filter: brightness(0) invert(1); }
.mini.r1 { border-color: color-mix(in srgb, var(--r1) 60%, transparent); }
.mini.r2 { border-color: color-mix(in srgb, var(--r2) 60%, transparent); }
.mini.r3 { border-color: color-mix(in srgb, var(--r3) 70%, transparent); }

/* draft */
.draft { width: min(780px, 100%); display: flex; flex-direction: column; align-items: center; gap: 12px; }
.draft h2 { font-size: 2.6rem; color: #fff; text-shadow: 0 6px 30px rgba(0, 0, 0, 0.5); }
.draft > p { margin: 0 0 6px; color: var(--dim); }
/* Opening draft: six perks in two rows, keep three. */
.draft.six { width: min(720px, 100%); }
.draft.six .cards { display: grid; grid-template-columns: repeat(3, 186px); gap: 14px; justify-content: center; }
.draft.six .card { width: 186px; min-height: 232px; }
.draft.six .card .icon { font-size: 2.5rem; height: 60px; margin-top: 6px; }
.draft.six .card .desc { font-size: 0.78rem; }
#w-card.cards { flex-wrap: nowrap; gap: 12px; }
.draft .count { display: inline-flex; gap: 6px; margin-left: 10px; vertical-align: middle; }
.draft .count i { width: 10px; height: 10px; border-radius: 50%; border: 1.5px solid var(--accent); }
.draft .count i.on { background: var(--accent); }
.draft-foot { display: flex; gap: 12px; align-items: center; width: min(520px, 100%); margin-top: 12px; }
.draft-timer { flex: 1; height: 3px; background: var(--faint); overflow: hidden; }
.draft-timer i { display: block; height: 100%; width: 100%; background: var(--accent); transform-origin: left; }

.elim-icon { font: italic 800 4.6rem/1 var(--display); color: var(--red); }
.elim-icon::before { content: 'OUT'; }
.elim-icon { font-size: 0; }
.elim-icon::before { font-size: 4.2rem; }

/* results */
.results { width: min(860px, 100%); padding: 26px; display: flex; flex-direction: column; gap: 16px; max-height: 94vh; overflow-y: auto; }
.r-place { font: italic 800 5.6rem/0.9 var(--display); color: var(--accent); }
.podium { display: flex; justify-content: center; align-items: flex-end; gap: 6px; }
.podium .step { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 0.82rem; width: 130px; text-align: center; }
.podium .step .blk { width: 100%; border-radius: 6px 6px 0 0; display: grid; place-items: center; font: italic 800 1.8rem var(--display); color: #1a1208; }
.podium .p1 .blk { height: 84px; background: linear-gradient(#ffd27a, #e59a1e); }
.podium .p2 .blk { height: 60px; background: linear-gradient(#e7ecf1, #9aa5b0); }
.podium .p3 .blk { height: 44px; background: linear-gradient(#f0b07c, #b4693a); }
.podium .nm { max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.r-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
.r-grid h3 { margin: 0 0 10px; }
.lines { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.lines li { display: flex; justify-content: space-between; padding: 7px 2px; border-bottom: 1px solid var(--line); font-size: 0.9rem; }
.lines li b { font-weight: 700; }
.lines li.total { border-bottom: none; color: var(--accent); font: italic 800 1.4rem var(--display); text-transform: uppercase; }
.lines.small li { font-size: 0.82rem; }
.xpbar { margin-top: 12px; display: flex; align-items: center; gap: 12px; font: italic 800 1rem var(--display); }
.xpbar .bar { flex: 1; height: 4px; background: var(--faint); overflow: hidden; }
.xpbar .bar i { display: block; height: 100%; width: 0; background: var(--green); transition: width 1.2s ease-out; }
.levelup { margin-top: 10px; color: var(--accent); font: italic 800 1.1rem var(--display); text-transform: uppercase; animation: pop 0.5s; }
@keyframes pop { 0% { transform: scale(0.7); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }

/* toy box */
.toybox { width: min(1000px, 100%); height: min(92vh, 900px); padding: 22px; display: flex; flex-direction: column; gap: 14px; }
.tb-head { display: flex; align-items: center; gap: 14px; }
.tb-head h2 { flex: 1; }
.tb-wallet { font: italic 800 1.4rem var(--display); color: var(--accent); }
.tb-wallet::after { content: ' STICKERS'; font-size: 0.7rem; letter-spacing: 0.14em; color: var(--dim); font-style: normal; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); }
.tab { border: none; background: none; padding: 10px 16px; font: italic 800 1.05rem var(--display); letter-spacing: 0.06em; color: var(--dim); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab.on { color: var(--ink); border-bottom-color: var(--accent); }
.tab-body { flex: 1; overflow-y: auto; padding: 4px; }
.tab-body > p { margin: 4px 0 14px; color: var(--dim); font-size: 0.9rem; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(156px, 1fr)); gap: 16px; justify-items: center; padding-bottom: 16px; }
.pack-area { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 26px; padding: 14px; min-height: 300px; }
.pack-area .cards { flex: 1 1 480px; }
.pack { width: 180px; height: 252px; flex: 0 0 auto; border-radius: 14px; background: linear-gradient(150deg, #ffd27a, #ff8a3d 40%, #b4426b 75%, #4a2a7a); box-shadow: 0 30px 60px rgba(0, 0, 0, 0.55), inset 0 0 0 1px rgba(255, 255, 255, 0.25); display: grid; place-items: center; cursor: pointer; transition: transform 0.2s; }
.pack:hover { transform: rotate(-2deg) translateY(-6px); }
.pack.shake { animation: shake 0.5s; }
@keyframes shake { 0%, 100% { transform: none; } 20% { transform: rotate(-5deg); } 40% { transform: rotate(5deg); } 60% { transform: rotate(-3deg); } 80% { transform: rotate(2deg); } }
.pack-face { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; color: #fff; }
.pack-face span { font-size: 3.4rem; filter: brightness(0) invert(1); }
.pack-face b { font: italic 800 1.7rem/1 var(--display); text-transform: uppercase; }
.pack-face small { font-size: 0.6rem; letter-spacing: 0.08em; opacity: 0.85; max-width: 140px; line-height: 1.4; }
.pack-buy { display: flex; justify-content: center; padding: 8px; }
.new-tag { position: absolute; z-index: 3; top: -9px; left: 50%; transform: translateX(-50%); background: var(--accent); color: #1a1208; border-radius: 4px; padding: 2px 8px; font: 700 0.62rem var(--body); letter-spacing: 0.14em; white-space: nowrap; }
.skin-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.skin { border: 1px solid var(--line); border-radius: 12px; background: rgba(255, 255, 255, 0.04); padding: 14px 10px; display: flex; flex-direction: column; align-items: center; gap: 8px; cursor: pointer; text-align: center; font-size: 0.85rem; font-weight: 600; transition: border-color 0.15s, background 0.15s; }
.skin:hover { border-color: rgba(255, 255, 255, 0.3); }
.skin small { color: var(--dim); font-size: 0.7rem; font-weight: 500; }
.skin .ball { width: 66px; height: 66px; border-radius: 50%; box-shadow: inset -7px -9px 14px rgba(0, 0, 0, 0.45), inset 7px 7px 12px rgba(255, 255, 255, 0.6), 0 10px 20px rgba(0, 0, 0, 0.4); }
.skin.on { border-color: var(--accent); background: rgba(255, 181, 71, 0.08); }
.skin .price { font: italic 800 0.95rem var(--display); color: var(--accent); }
.skin.lock .ball { filter: saturate(0.4) brightness(0.7); }
.ups { display: grid; gap: 10px; }
.up { display: flex; align-items: center; gap: 16px; background: rgba(255, 255, 255, 0.04); border: 1px solid var(--line); border-radius: 12px; padding: 14px; }
.up .ic { font-size: 1.8rem; filter: brightness(0) invert(1); opacity: 0.8; }
.up .tx { flex: 1; color: var(--dim); font-size: 0.88rem; }
.up .tx b { display: block; font: italic 800 1.2rem var(--display); text-transform: uppercase; color: var(--ink); margin-bottom: 2px; }

/* help */
.help { width: min(880px, 100%); padding: 26px; display: flex; flex-direction: column; gap: 16px; }
.help-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.help-grid > div { border-top: 1px solid var(--line); padding-top: 12px; }
.help-grid b { font: italic 800 1.2rem var(--display); text-transform: uppercase; }
.help-grid p { margin: 6px 0 0; line-height: 1.45; color: var(--dim); font-size: 0.9rem; }
.keys { display: flex; flex-wrap: wrap; gap: 8px 18px; justify-content: center; font-size: 0.82rem; color: var(--dim); }

/* settings */
.settings label { display: flex; justify-content: space-between; align-items: center; gap: 12px; text-align: left; font-size: 0.92rem; }
.settings input[type='range'] { width: 55%; accent-color: var(--accent); }
.settings select { border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; background: #222026; }
.settings input[type='checkbox'] { width: 18px; height: 18px; accent-color: var(--accent); }
.settings .check { justify-content: flex-start; }
/* Sound mixer & radio */
.mixer { width: min(520px, 100%); gap: 14px; max-height: calc(100vh - 40px); overflow-y: auto; }
.mixer .stations { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.mixer .stations button { border: 1px solid var(--line); background: rgba(255, 255, 255, 0.04); color: var(--ink); border-radius: 999px; padding: 7px 13px; font: 600 0.82rem/1 Inter, system-ui, sans-serif; cursor: pointer; }
.mixer .stations button.on { background: var(--accent); border-color: var(--accent); color: #1a1408; }
.mixer .now { display: flex; align-items: center; justify-content: space-between; gap: 12px; text-align: left; margin-top: 10px; padding: 10px 12px; border-radius: 10px; background: rgba(255, 255, 255, 0.04); min-height: 54px; }
.mixer .now small { display: block; font: 700 0.62rem/1.2 Inter, system-ui, sans-serif; letter-spacing: 0.14em; color: var(--accent); text-transform: uppercase; }
.mixer .now b { display: block; font-size: 0.95rem; }
.mixer .now span { display: block; font-size: 0.78rem; }
.mixer .sliders { display: grid; gap: 9px; }
.mixer .sliders label { display: grid; grid-template-columns: 1fr 52% 34px; align-items: center; gap: 10px; text-align: left; font-size: 0.86rem; }
.mixer .sliders input { width: 100%; accent-color: var(--accent); }
.mixer .sliders output { font: 600 0.75rem/1 Inter, system-ui, sans-serif; color: var(--dim); text-align: right; }
.mixer .row { display: flex; gap: 10px; justify-content: center; }
#radio-toast { position: fixed; left: 14px; bottom: calc(38px + var(--safe-b, 0px)); transform: translate(0, 12px); opacity: 0; transition: opacity 0.4s, transform 0.4s; pointer-events: none; z-index: 7; padding: 7px 14px; border-radius: 999px; background: rgba(12, 11, 14, 0.72); backdrop-filter: blur(8px); font: 600 0.78rem/1.2 Inter, system-ui, sans-serif; color: var(--ink); white-space: nowrap; max-width: calc(100vw - 32px); overflow: hidden; text-overflow: ellipsis; }
#radio-toast.on { opacity: 1; transform: translate(0, 0); }
#radio-toast i { font-style: normal; color: var(--accent); margin-right: 6px; }

/* Marble showroom: the 3D shelf fills the screen behind this. */
body.showroom-open #labels, body.showroom-open #radio-toast { display: none; }
.screen.showroom { display: flex; flex-direction: column; justify-content: space-between; align-items: stretch; place-items: initial; padding: calc(14px + var(--safe-t)) 18px calc(14px + var(--safe-b)); background: linear-gradient(180deg, rgba(10, 9, 12, 0.55), transparent 18%, transparent 62%, rgba(10, 9, 12, 0.7)); overflow: hidden; }
.sr-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.sr-top h2 { font-size: 2rem; margin: 0; }
.sr-wallet { margin-left: auto; font: italic 800 1rem var(--display); letter-spacing: 0.08em; color: var(--dim); text-transform: uppercase; }
.sr-wallet b { color: var(--accent); font-size: 1.3rem; }
.sr-arrow { position: absolute; top: 46%; width: 54px; height: 54px; border-radius: 50%; border: 1px solid var(--line); background: rgba(14, 13, 16, 0.6); color: var(--ink); font-size: 1.7rem; display: grid; place-items: center; transform: translateY(-50%); cursor: pointer; }
.sr-arrow.left { left: 18px; }
.sr-arrow.right { right: 18px; }
.sr-arrow:disabled { opacity: 0.25; cursor: default; }
.sr-bottom { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.sr-info { display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; }
.sr-info small { font: 700 0.72rem var(--body); letter-spacing: 0.2em; color: var(--accent); text-transform: uppercase; }
.sr-info h3 { margin: 0 0 8px; font: italic 800 2.4rem/1 var(--display); text-transform: uppercase; color: #fff; text-shadow: 0 4px 24px rgba(0, 0, 0, 0.6); }
.sr-info .btn { min-width: 220px; }
.sr-info .btn.equipped { background: rgba(61, 220, 132, 0.16); border-color: var(--green); color: var(--green); }
.sr-strip { display: flex; gap: 10px; overflow-x: auto; max-width: 100%; padding: 6px 4px 8px; scroll-behavior: smooth; scrollbar-width: none; }
.sr-strip::-webkit-scrollbar { display: none; }
.sr-strip button { flex: 0 0 auto; width: 44px; height: 44px; border-radius: 50%; border: 2px solid transparent; padding: 0; position: relative; cursor: pointer; box-shadow: inset -5px -6px 10px rgba(0, 0, 0, 0.45), inset 5px 5px 8px rgba(255, 255, 255, 0.5); }
.sr-strip button.on { border-color: var(--accent); transform: scale(1.12); }
.sr-strip button.lock { filter: saturate(0.35) brightness(0.6); }
.sr-strip button .ico { position: absolute; right: -3px; bottom: -3px; width: 16px; height: 16px; padding: 2px; border-radius: 50%; background: #111; color: var(--ink); }
.sr-strip button.eq .ico { background: var(--green); color: #08210f; }

/* ---------- HUD ---------- */
/* Over the live 3D view a backdrop blur is recomputed every frame for every panel, so the race HUD uses solid
   tinted glass instead. */
#hud .panel, #hud .round, #hud .mini, #hud-feed div, #touch-jump, #touch-ability, #touch-coach, #radio-toast {
  backdrop-filter: none; -webkit-backdrop-filter: none;
}
#hud .panel { background: rgba(20, 18, 23, 0.84); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3); }
#hud .round, #hud .mini, #hud-feed div { background: rgba(14, 13, 16, 0.78); }
#touch-coach, #radio-toast { background: rgba(12, 11, 14, 0.82); }
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 10; font-family: var(--body); }
.hud-top { position: absolute; top: calc(14px + var(--safe-t)); left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 6px; }
.pill { font: italic 800 0.9rem var(--display); letter-spacing: 0.14em; text-transform: uppercase; color: var(--dim); white-space: nowrap; text-shadow: 0 1px 8px rgba(0, 0, 0, 0.6); }
.pill.small { font: 700 1rem var(--body); letter-spacing: 0.04em; color: var(--ink); font-variant-numeric: tabular-nums; }
.pill.small:empty { display: none; }
#hud-qual { padding: 7px 16px 9px; min-width: 260px; border-radius: 10px; box-shadow: none; background: var(--glass); }
.qual-label { text-align: center; font: italic 800 1.05rem var(--display); letter-spacing: 0.08em; color: var(--dim); }
.qual-label b, .qual-label #hud-quota { color: var(--ink); font-size: 1.4rem; }
.qual-bar { height: 3px; background: var(--faint); overflow: hidden; margin-top: 5px; }
.qual-bar i { display: block; height: 100%; width: 0; background: var(--green); transition: width 0.3s; }
#hud-rank { position: absolute; top: calc(14px + var(--safe-t)); left: 14px; display: flex; align-items: center; gap: 12px; padding: 8px 16px 8px 14px; border-radius: 10px; box-shadow: none; background: var(--glass); }
.rank-num { font: italic 800 3.2rem/0.9 var(--display); min-width: 56px; text-align: right; font-variant-numeric: tabular-nums; }
.rank-num sup { font-size: 1.1rem; vertical-align: top; margin-left: 2px; color: var(--dim); }
.rank-of { font: 600 0.78rem var(--body); color: var(--dim); }
.chip { display: inline-block; margin-top: 5px; padding: 3px 8px; border-radius: 4px; font: italic 800 0.85rem var(--display); letter-spacing: 0.12em; background: var(--green); color: #052b14; transform: skewX(-10deg); }
.chip.danger { background: var(--red); color: #fff; animation: pulse 0.9s infinite; }
.chip.done { background: var(--accent); color: #1a1208; }
.chip.out { background: #555; color: #ddd; }
@keyframes pulse { 50% { opacity: 0.6; } }
#hud-board { position: absolute; top: calc(14px + var(--safe-t)); right: 14px; margin: 0; padding: 6px 0; list-style: none; min-width: 210px; font-size: 0.82rem; border-radius: 10px; box-shadow: none; background: var(--glass); overflow: hidden; }
#hud-board li { display: flex; align-items: center; gap: 8px; padding: 3px 12px 3px 0; white-space: nowrap; font-weight: 600; }
#hud-board li .p { width: 30px; text-align: center; font: italic 800 1rem var(--display); color: var(--dim); }
#hud-board li .dot { width: 12px; height: 12px; flex-basis: 12px; box-shadow: none; }
#hud-board li .nm { overflow: hidden; text-overflow: ellipsis; max-width: 130px; flex: 1; }
#hud-board li .q { font-size: 0.7rem; color: var(--green); }
#hud-board li.me { background: linear-gradient(90deg, rgba(255, 181, 71, 0.35), rgba(255, 181, 71, 0.05)); }
#hud-board li.me .p { color: var(--accent); }
#hud-board li.cut { border-top: 1px solid var(--red); margin-top: 3px; padding-top: 4px; }
#hud-board li.cut::after { content: 'CUT'; position: absolute; right: 8px; margin-top: -14px; font: 700 0.55rem var(--body); letter-spacing: 0.14em; color: var(--red); }
#hud-board li.gap { color: var(--dim); justify-content: center; padding: 0; line-height: 0.8; }
#hud-progress { position: absolute; left: 26px; top: 26%; bottom: 28%; width: 14px; }
#hud-progress .track { position: absolute; left: 6px; top: 0; bottom: 0; width: 2px; background: rgba(255, 255, 255, 0.25); }
#hud-cutline { position: absolute; left: -7px; right: -7px; height: 2px; background: var(--red); }
#hud-progress::before { content: 'FINISH'; position: absolute; top: -20px; left: -6px; font: italic 800 0.65rem var(--display); letter-spacing: 0.14em; color: var(--dim); }
#hud-dots i { position: absolute; left: 3px; width: 8px; height: 8px; margin-top: -4px; border-radius: 50%; background: #fff; opacity: 0.7; }
#hud-dots i.me { left: -1px; width: 16px; height: 16px; margin-top: -8px; opacity: 1; z-index: 2; box-shadow: 0 0 0 2px var(--accent), 0 0 12px var(--accent); }
#hud-feed { position: absolute; right: 14px; bottom: calc(110px + var(--safe-b)); display: flex; flex-direction: column; align-items: flex-end; gap: 4px; max-width: 46vw; }
#hud-feed div { background: var(--glass); backdrop-filter: var(--blur); padding: 5px 12px; border-radius: 6px; font-size: 0.8rem; animation: feedin 0.25s; border-left: 2px solid var(--accent); }
@keyframes feedin { from { transform: translateX(30px); opacity: 0; } }
#hud-bottom { position: absolute; left: 50%; bottom: calc(16px + var(--safe-b)); transform: translateX(-50%); display: flex; align-items: flex-end; gap: 14px; }
#hud-hand { display: flex; gap: 4px; flex-wrap: wrap; max-width: 46vw; justify-content: center; }
#hud-ability { position: relative; width: 70px; height: 70px; }
#hud-ability > svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ab-bg { fill: rgba(14, 13, 16, 0.7); stroke: rgba(255, 255, 255, 0.15); stroke-width: 2; }
.ab-arc { fill: none; stroke: var(--accent); stroke-width: 4; stroke-linecap: round; stroke-dasharray: 176; stroke-dashoffset: 0; }
#ab-icon { position: absolute; inset: 0; display: grid; place-items: center; font-size: 1.8rem; filter: brightness(0) invert(1); }
#hud-ability.cool #ab-icon { opacity: 0.35; }
#hud-ability.ready .ab-bg { stroke: var(--accent); }
.ab-key { position: absolute; bottom: -8px; left: 50%; transform: translateX(-50%); font: 700 0.58rem var(--body); letter-spacing: 0.12em; background: var(--accent); color: #1a1208; border-radius: 3px; padding: 1px 5px; }
#hud-center { position: absolute; top: 34%; left: 0; right: 0; text-align: center; font: italic 800 clamp(3rem, 11vw, 7.5rem)/1 var(--display); text-transform: uppercase; color: #fff; text-shadow: 0 10px 50px rgba(0, 0, 0, 0.45); pointer-events: none; letter-spacing: 0.01em; }
#hud-center.pop { animation: bigpop 0.5s cubic-bezier(0.2, 1.3, 0.4, 1); }
@keyframes bigpop { from { transform: scale(1.4); opacity: 0; filter: blur(8px); } }
#hud-center .gold { color: var(--accent); }
#hud-center .red { color: var(--red); }
#hud-sub { position: absolute; top: calc(34% + clamp(3.4rem, 12vw, 8rem)); left: 0; right: 0; text-align: center; font-size: 1.05rem; font-weight: 600; color: #fff; text-shadow: 0 2px 12px rgba(0, 0, 0, 0.8); }
#hud-spectate { position: absolute; bottom: calc(104px + var(--safe-b)); left: 50%; transform: translateX(-50%); background: var(--glass); backdrop-filter: var(--blur); padding: 8px 16px; border-radius: 8px; pointer-events: auto; cursor: pointer; white-space: nowrap; font-size: 0.85rem; }
#hud-spectate span { color: var(--dim); }
#hud-spectate b { font: italic 800 1.1rem var(--display); text-transform: uppercase; margin: 0 6px; }
#hud-spectate small { color: var(--dim); }
#hud-hint { position: absolute; left: 14px; bottom: calc(12px + var(--safe-b)); font-size: 0.72rem; color: rgba(255, 255, 255, 0.55); text-shadow: 0 1px 4px rgba(0, 0, 0, 0.8); max-width: calc(50% - 250px); line-height: 1.4; }
#hud-menu { position: absolute; top: calc(108px + var(--safe-t)); left: 14px; pointer-events: auto; }
#hud-cam { position: absolute; top: calc(160px + var(--safe-t)); left: 14px; pointer-events: auto; font: 700 0.72rem/1 var(--font-ui, Inter, system-ui, sans-serif); letter-spacing: 0.08em; }
#hud-cam.on { color: var(--accent); border-color: var(--accent); }
#net-warn { position: absolute; top: 45%; left: 50%; transform: translateX(-50%); background: var(--red); color: #fff; border-radius: 8px; padding: 8px 16px; font-weight: 700; }

/* stage title card */
.stage-card { display: inline-flex; flex-direction: column; align-items: center; text-shadow: none; }
.stage-card small { font: italic 800 1rem var(--display); letter-spacing: 0.36em; color: var(--accent); }
.stage-card div { font: italic 800 clamp(3rem, 9vw, 6.4rem)/0.95 var(--display); color: #fff; text-shadow: 0 10px 50px rgba(0, 0, 0, 0.5); }
.stage-card em { font: 600 1rem var(--body); font-style: normal; color: rgba(255, 255, 255, 0.85); text-transform: none; letter-spacing: 0; margin-top: 10px; background: var(--glass); padding: 6px 14px; border-radius: 6px; }

/* labels above marbles */
#labels { position: fixed; inset: 0; pointer-events: none; z-index: 5; overflow: hidden; }
.nametag { position: absolute; transform: translate(-50%, -100%); white-space: nowrap; font: 600 0.72rem var(--body); color: #fff; background: rgba(12, 11, 14, 0.55); padding: 2px 7px; border-radius: 4px; will-change: transform; }
.nametag.me { background: var(--accent); color: #1a1208; font: italic 800 0.85rem var(--display); letter-spacing: 0.1em; padding: 1px 8px; }
.nametag.human { background: rgba(74, 163, 255, 0.75); }
.emote { position: absolute; transform: translate(-50%, -100%); font-size: 1.8rem; color: #fff; animation: emote 2s forwards; filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.5)); }
@keyframes emote { 0% { transform: translate(-50%, -60%) scale(0.2); } 15% { transform: translate(-50%, -100%) scale(1.15); } 25% { transform: translate(-50%, -100%) scale(1); } 85% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -160%); } }

/* touch */
#touch-layer { position: fixed; inset: 0; z-index: 8; touch-action: none; }
#touch-stick { position: absolute; left: 40px; bottom: 60px; width: 120px; height: 120px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, 0.35); background: rgba(12, 11, 14, 0.25); opacity: 0.5; pointer-events: none; }
#touch-stick.active { opacity: 1; }
#touch-knob { position: absolute; left: 35px; top: 35px; width: 48px; height: 48px; border-radius: 50%; background: rgba(255, 255, 255, 0.85); }
#touch-jump, #touch-ability { position: absolute; border-radius: 50%; border: 1px solid rgba(255, 255, 255, 0.3); font: italic 800 1rem var(--display); letter-spacing: 0.1em; color: #fff; }
#touch-jump { right: 26px; bottom: calc(40px + var(--safe-b)); width: 92px; height: 92px; background: rgba(255, 181, 71, 0.85); color: #1a1208; }
#touch-ability { right: 128px; bottom: calc(28px + var(--safe-b)); width: 70px; height: 70px; background: rgba(12, 11, 14, 0.55); font-size: 1.6rem; }
#touch-ability span { filter: brightness(0) invert(1); }
#touch-jump.down, #touch-ability.down { transform: scale(0.94); }
body.touch #hud-hint, body.touch #hud-hand, body.touch #hud-progress { display: none; }
body.touch #hud-ability { display: none; }
body.touch #touch-ability.none { display: none; }
/* One-hand touch scheme */
#touch-steer { position: absolute; width: 132px; height: 34px; margin: -17px 0 0 -66px; opacity: 0; transition: opacity 0.15s; pointer-events: none; --off: 0; }
#touch-steer::before { content: ''; position: absolute; left: 0; right: 0; top: 15px; height: 4px; border-radius: 2px; background: rgba(255, 255, 255, 0.28); box-shadow: 0 1px 6px rgba(0, 0, 0, 0.4); }
#touch-steer i { position: absolute; left: 50%; top: 3px; width: 28px; height: 28px; margin-left: -14px; border-radius: 50%; background: rgba(255, 255, 255, 0.9); box-shadow: 0 2px 10px rgba(0, 0, 0, 0.45); transform: translateX(calc(var(--off) * 52px)); }
#touch-steer.active { opacity: 1; }
body:not(.one-hand) #touch-steer, body:not(.one-hand) #touch-coach { display: none; }
body.one-hand #touch-stick, body.one-hand #touch-jump { display: none; }
body.one-hand #touch-ability { right: 22px; bottom: calc(26px + var(--safe-b)); width: 64px; height: 64px; }
#touch-coach { position: absolute; left: 50%; bottom: calc(22% + var(--safe-b)); transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 12px 18px; border-radius: 14px; background: rgba(12, 11, 14, 0.62); text-align: center; font: 600 0.9rem/1.25 Inter, system-ui, sans-serif; color: var(--ink); opacity: 0; transition: opacity 0.5s; pointer-events: none; }
#touch-coach b { font: italic 800 1.05rem/1.2 var(--display); letter-spacing: 0.06em; color: var(--accent); text-transform: uppercase; }
#touch-coach.on { opacity: 1; }
.settings .touch-only { display: none; }
body.touch .settings .touch-only { display: flex; }

/* toast & flash */
#toast { position: fixed; left: 50%; bottom: calc(30px + var(--safe-b)); transform: translateX(-50%) translateY(140%); opacity: 0; background: var(--glass2); backdrop-filter: var(--blur); border: 1px solid var(--line); color: var(--ink); padding: 10px 18px; border-radius: 8px; z-index: 50; transition: transform 0.25s, opacity 0.25s; max-width: 90vw; text-align: center; pointer-events: none; font-size: 0.9rem; }
#toast.on { transform: translateX(-50%) translateY(0); opacity: 1; }
#toast:empty { display: none; }
#flash { position: fixed; inset: 0; pointer-events: none; z-index: 6; background: radial-gradient(circle, rgba(255, 77, 61, 0) 45%, rgba(255, 77, 61, 0.4)); opacity: 0; transition: opacity 0.4s; }
#flash.on { opacity: 1; transition: none; }

@media (max-width: 760px) {
  #s-menu { place-items: end center; padding-left: 16px; background: linear-gradient(0deg, rgba(8, 7, 9, 0.88) 0%, rgba(8, 7, 9, 0.5) 60%, rgba(8, 7, 9, 0.1)); }
  .r-grid, .help-grid { grid-template-columns: 1fr; }
  .card { width: 160px; min-height: 236px; }
  .card .icon { font-size: 2.6rem; height: 70px; }
  .cards { gap: 10px; }
  #hud-board { display: none; }
  #hud-rank { padding: 6px 10px; }
  .rank-num { font-size: 2.4rem; min-width: 40px; }
  #hud-qual { min-width: 190px; }
  .hud-top { top: calc(78px + var(--safe-t)); }
  #hud-progress { display: none; }
  #hud-menu { left: auto; right: 14px; top: calc(14px + var(--safe-t)); }
  #hud-cam { left: auto; right: 14px; top: calc(66px + var(--safe-t)); }
  .draft.six .cards { grid-template-columns: repeat(2, minmax(0, 168px)); gap: 8px; }
  .draft.six .card { width: auto; min-height: 168px; }
  .draft.six .card .icon { font-size: 1.9rem; height: 40px; margin-top: 2px; }
  .draft.six .card .name { font-size: 1.05rem; }
  .draft.six .card .desc { font-size: 0.7rem; }
  .draft.six h2 { font-size: 1.8rem; }
  #w-card.cards { flex-wrap: wrap; gap: 8px; }
  #w-card.cards .card.small { width: 104px; min-height: 150px; }
  #w-card.cards .card.small .icon { font-size: 1.6rem; height: 34px; margin-top: 2px; }
  #w-card.cards .card.small .name { font-size: 0.86rem; }
  #w-card.cards .card.small .desc, #w-card.cards .card.small .kind { display: none; }
}
/* Phones in portrait: tighter type, three perks across, a compact race HUD. */
@media (max-width: 520px) {
  .sr-arrow { width: 44px; height: 44px; top: 40%; }
  .sr-arrow.left { left: 8px; }
  .sr-arrow.right { right: 8px; }
  .sr-info h3 { font-size: 1.9rem; }
  .sr-top h2 { font-size: 1.6rem; }
  .mbtn.small { padding: 11px 8px; }
  .mbtn.small span { font-size: 1rem; }
  #s-menu { padding-bottom: calc(52px + var(--safe-b)); }
  #radio-toast { left: 50%; bottom: calc(10px + var(--safe-b)); transform: translate(-50%, 12px); }
  #radio-toast.on { transform: translate(-50%, 0); }
  .draft { gap: 8px; }
  .draft h2 { font-size: 1.9rem; text-align: center; line-height: 1; }
  .draft > p { font-size: 0.85rem; text-align: center; }
  .draft:not(.six) #d-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; width: 100%; }
  .draft:not(.six) .card { width: auto; min-height: 210px; }
  .draft:not(.six) .card > .inner { padding: 22px 8px 9px; gap: 6px; }
  .draft:not(.six) .card .icon { font-size: 2rem; height: 46px; margin-top: 4px; }
  .draft:not(.six) .card .name { font-size: 1rem; }
  .draft:not(.six) .card .desc { font-size: 0.7rem; }
  .draft:not(.six) .card .kind { top: 8px; left: 9px; font-size: 0.5rem; }
  .draft:not(.six) .card .infield { top: 8px; right: 8px; font-size: 0.5rem; }
  .draft:not(.six) .card .stars { font-size: 0.6rem; letter-spacing: 0; }
  .draft:not(.six) .card .rar { font-size: 0.52rem; letter-spacing: 0.1em; }
  .draft .card .foot { flex-wrap: wrap; justify-content: center; gap: 2px 6px; }
  .toybox { padding: 16px 12px; }
  .tab { padding: 8px 8px; font-size: 0.92rem; }
  .card-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .card-grid .card { width: 100%; min-height: 176px; }
  .card-grid .card > .inner { padding: 20px 7px 8px; gap: 4px; }
  .card-grid .card .icon { font-size: 1.7rem; height: 40px; margin-top: 2px; }
  .card-grid .card .name { font-size: 0.88rem; }
  .card-grid .card .desc { font-size: 0.64rem; }
  .card-grid .card .kind { top: 7px; left: 8px; font-size: 0.48rem; }
  .card-grid .card .count { top: 5px; right: 7px; font-size: 0.8rem; }
  .card-grid .card .foot { flex-direction: column; gap: 2px; font-size: 0.5rem; padding-top: 5px; }
  .card-grid .card .stars { font-size: 0.6rem; letter-spacing: 0; }
  .card-grid .card .rar { font-size: 0.5rem; }
  #hud-rank { padding: 5px 10px 5px 8px; gap: 8px; }
  .rank-num { font-size: 2rem; min-width: 30px; }
  .rank-num sup { font-size: 0.8rem; }
  .hud-top { top: calc(70px + var(--safe-t)); gap: 3px; }
  .hud-top .pill { font-size: 0.7rem; }
  #hud-qual { min-width: 150px; padding: 4px 12px 6px; }
  .qual-label { font-size: 0.82rem; }
  .qual-label b, .qual-label #hud-quota { font-size: 1.05rem; }
  .pill.small { font-size: 0.85rem; }
  #hud-menu, #hud-cam { transform: scale(0.85); transform-origin: top right; }
  #hud-cam { top: calc(58px + var(--safe-t)); }
  #touch-coach { bottom: calc(14px + var(--safe-b)); font-size: 0.78rem; padding: 8px 14px; gap: 2px; }
}
@media (max-height: 560px) {
  .menu-wrap { gap: 12px; }
  .wordmark { font-size: clamp(2.4rem, 13vh, 4.4rem); }
  .brand .tagline { display: none; }
  .mbtn { padding: 9px 14px; }
  .mbtn span { font-size: 1.25rem; }
  .menu-foot, .back { display: none; }
  #hud-board { display: none; }
  .hud-top { top: calc(8px + var(--safe-t)); }
  .card { width: 150px; min-height: 200px; }
  .card .icon { font-size: 2.2rem; height: 54px; margin-top: 2px; }
  .card .name { font-size: 1.1rem; }
  .card .desc { font-size: 0.72rem; }
  .draft h2 { font-size: 1.6rem; }
  .draft > p, .draft .mini-hand { display: none; }
  .draft.six .cards { grid-template-columns: repeat(6, minmax(0, 140px)); gap: 8px; }
  .draft.six .card { width: auto; min-height: 180px; }
}

