/* Golden Record — two colours per side: Side A ink + gold, Side B alpine blue + white. One motif: the record. */
:root {
  --ink: #080a1a;
  --accent: #f5c542;
  --accent-d: #b07d1a;
  --text: #f6efd9;
  --muted: rgba(246, 239, 217, 0.62);
  --panel: rgba(8, 10, 26, 0.86);
  --edge: #f5c542;
  --p1: #f5c542;
  --p2: #ff8fb1;
  --px: 3px;
  --vvh: 100vh;
  --f-display: 'Pixelify Sans', ui-monospace, monospace;
  --f-label: 'VT323', ui-monospace, monospace;
  --f-text: 'VT323', ui-monospace, monospace;
  color-scheme: dark;
}
body[data-theme="b"] {
  --ink: #0d2a5e;
  --accent: #ffffff;
  --accent-d: #9fc0ee;
  --text: #0d2a5e;
  --muted: rgba(13, 42, 94, 0.62);
  --panel: rgba(255, 255, 255, 0.93);
  --edge: #1f5fc4;
  --p1: #d8343f;
  --p2: #2f6fd6;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--ink); }
body {
  font-family: var(--f-label);
  font-weight: 500;
  color: var(--text);
  -webkit-font-smoothing: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  user-select: none;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

#stage { position: fixed; inset: 0; overflow: hidden; }
#world { position: absolute; left: 0; top: 0; image-rendering: pixelated; image-rendering: crisp-edges; }
#marks { position: absolute; inset: 0; pointer-events: none; }
.mark {
  position: absolute; top: 0; font-family: var(--f-label); font-size: 14px; letter-spacing: 0.04em;
  color: rgba(214, 218, 236, 0.8); white-space: nowrap; transform-origin: 0 0; margin-top: -16px;
  text-shadow: 0 1px 0 #000;
}
.mark.left { left: 10px; }
.mark.right { right: 10px; text-align: right; }
.mark.gold { color: var(--accent); }
.mark.alp { color: #ffffff; text-shadow: 0 1px 0 rgba(13, 42, 94, 0.8); }
.mark.alp.gold { color: #ffe58a; }

/* ---------- pixel panel: notched corners, flat frame ---------- */
.px-panel {
  background: var(--panel);
  box-shadow:
    0 calc(var(--px) * -1) 0 0 var(--edge),
    0 var(--px) 0 0 var(--edge),
    calc(var(--px) * -1) 0 0 0 var(--edge),
    var(--px) 0 0 0 var(--edge),
    0 calc(var(--px) * 3) 0 0 rgba(0, 0, 0, 0.35);
}
body[data-theme="a"] .px-panel { backdrop-filter: blur(2px); }

.btn {
  font-family: var(--f-label); font-size: 14px; letter-spacing: 0.04em; text-transform: uppercase;
  padding: 12px 18px; border: 0; background: transparent; color: var(--text);
  box-shadow: 0 -2px 0 0 currentColor, 0 2px 0 0 currentColor, -2px 0 0 0 currentColor, 2px 0 0 0 currentColor;
  opacity: 0.88;
}
.btn:hover, .btn:focus-visible { opacity: 1; outline: none; background: rgba(255, 255, 255, 0.06); }
.btn-gold { background: var(--accent); color: var(--ink); opacity: 1; box-shadow: 0 -2px 0 0 var(--accent), 0 2px 0 0 var(--accent), -2px 0 0 0 var(--accent), 2px 0 0 0 var(--accent), 0 5px 0 0 var(--accent-d); }
body[data-theme="b"] .btn-gold { background: var(--edge); color: #fff; box-shadow: 0 -2px 0 0 var(--edge), 0 2px 0 0 var(--edge), -2px 0 0 0 var(--edge), 2px 0 0 0 var(--edge), 0 5px 0 0 #0d2a5e; }
.btn-gold:hover, .btn-gold:focus-visible { background: #ffd967; }
body[data-theme="b"] .btn-gold:hover { background: #2f6fd6; }
.btn:active { transform: translateY(2px); }
.link { background: none; border: 0; font-family: var(--f-label); font-size: 14px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); padding: 6px 0; }
.link:hover { color: var(--text); }

.icon-btn {
  position: fixed; z-index: 30; width: 38px; height: 38px; border: 0; padding: 9px;
  background: rgba(8, 10, 26, 0.6); color: #f6efd9;
  box-shadow: 0 -2px 0 0 rgba(246, 239, 217, 0.25), 0 2px 0 0 rgba(246, 239, 217, 0.25), -2px 0 0 0 rgba(246, 239, 217, 0.25), 2px 0 0 0 rgba(246, 239, 217, 0.25);
}
.icon-btn svg { width: 100%; height: 100%; fill: currentColor; display: block; }
#btn-home { top: max(12px, env(safe-area-inset-top)); left: 12px; }
.corner-right { position: fixed; z-index: 30; top: max(12px, env(safe-area-inset-top)); right: 12px; display: flex; flex-direction: column; gap: 10px; }
.corner-right .icon-btn { position: static; }
#btn-lang span { font-family: var(--f-label); font-size: 14px; }

/* ---------- title ---------- */
.screen { position: fixed; inset: 0; z-index: 10; display: flex; align-items: center; justify-content: center; padding: 16px; }
#screen-title { flex-direction: column; overflow-y: auto; justify-content: flex-start; padding-top: max(7vh, 46px); }
.title-wrap { display: flex; flex-direction: column; align-items: center; text-align: center; width: min(720px, 100%); }
.disc { width: 124px; height: 124px; image-rendering: pixelated; margin-bottom: 4px; filter: drop-shadow(0 6px 0 rgba(0, 0, 0, 0.35)); }
.logo { font-family: var(--f-display);
  margin: 0; line-height: 0.86; font-weight: 700; font-size: clamp(54px, 13vw, 116px); letter-spacing: 0.02em; text-transform: uppercase;
  color: #f5c542;
  text-shadow: 0 4px 0 #b07d1a, 0 8px 0 #5a3d0a, 0 10px 0 rgba(0, 0, 0, 0.45);
  display: flex; flex-direction: column; align-items: center;
}
body[data-theme="b"] .logo { color: #ffffff; text-shadow: 0 4px 0 #1f5fc4, 0 8px 0 #0d2a5e, 0 11px 0 rgba(13, 42, 94, 0.35); }
.logo-l2 { margin-top: 6px; }
.tagline { font-family: var(--f-label); font-size: 14px; letter-spacing: 0.04em; color: var(--muted); margin: 22px 0 18px; }
body[data-theme="b"] .tagline { color: #ffffff; text-shadow: 0 1px 0 rgba(13, 42, 94, 0.7); }
.players { display: flex; gap: 0; margin-bottom: 12px; }
.seg {
  font-family: var(--f-label); font-size: 14px; letter-spacing: 0.04em; text-transform: uppercase; padding: 8px 16px; border: 0;
  background: rgba(8, 10, 26, 0.55); color: rgba(246, 239, 217, 0.7);
  box-shadow: inset 0 0 0 2px rgba(246, 239, 217, 0.25);
}
.seg.on { background: var(--accent); color: var(--ink); box-shadow: inset 0 0 0 2px var(--accent); }
body[data-theme="b"] .seg.on { background: var(--edge); color: #fff; box-shadow: inset 0 0 0 2px var(--edge); }
.names { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.names input {
  width: 128px; padding: 8px 10px; border: 0; background: rgba(8, 10, 26, 0.7); color: #f6efd9; text-align: center;
  box-shadow: inset 0 0 0 2px rgba(246, 239, 217, 0.3); font-size: 16px; user-select: text;
}
.names input:focus { outline: none; box-shadow: inset 0 0 0 2px var(--accent); }
.heart { color: #ff8fb1; font-size: 18px; }
.modes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; width: 100%; margin-top: 6px; }
.mode {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 14px 10px 14px; border: 0;
  background: var(--panel); color: var(--text);
  box-shadow: 0 -3px 0 0 var(--edge), 0 3px 0 0 var(--edge), -3px 0 0 0 var(--edge), 3px 0 0 0 var(--edge), 0 8px 0 0 rgba(0, 0, 0, 0.35);
  transition: transform 0.12s steps(2);
}
.mode:hover, .mode:focus-visible { transform: translateY(-3px); outline: none; }
.mode:active { transform: translateY(1px); }
.mode-art { width: 75px; height: 63px; image-rendering: pixelated; object-fit: contain; margin-bottom: 4px; }
.mode-b .mode-art { width: 51px; height: 48px; margin: 8px 0 11px; }
.mode-c .mode-art { width: 75px; height: 45px; margin: 9px 0 13px; }
.mode-side { font-family: var(--f-label); font-size: 14px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
.mode-name { font-family: var(--f-display); font-size: 26px; font-weight: 700; line-height: 1.05; }
.mode-meta { font-family: var(--f-label); font-size: 14px; letter-spacing: 0.04em; color: var(--muted); min-height: 13px; }
.title-foot { margin-top: 18px; display: flex; gap: 16px; align-items: center; }
#challenge-card { margin: 0 0 22px; padding: 14px 20px; width: min(460px, 100%); text-align: center; }
#challenge-card:not([hidden]) ~ .players, #challenge-card:not([hidden]) ~ .names { display: none !important; }
.ch-k { font-family: var(--f-display); font-size: 20px; font-weight: 700; }
.ch-v { font-family: var(--f-label); font-size: 14px; color: var(--muted); margin: 6px 0 14px; letter-spacing: 0.04em; }
.ch-actions { display: flex; gap: 14px; justify-content: center; }

/* ---------- HUD ---------- */
#hud {
  position: fixed; z-index: 20; top: max(12px, env(safe-area-inset-top)); left: 62px; right: 62px;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: start; gap: 10px; pointer-events: none;
}
.hud-box { display: flex; flex-direction: column; gap: 1px; padding: 7px 10px; background: rgba(8, 10, 26, 0.62); justify-self: start; min-width: 120px; color: #f6efd9; }
.hud-box.right { justify-self: end; text-align: right; align-items: flex-end; }
body[data-theme="b"] .hud-box { background: rgba(13, 42, 94, 0.72); }
.hud-k { font-family: var(--f-label); font-size: 14px; letter-spacing: 0.04em; text-transform: uppercase; opacity: 0.65; }
.hud-box b { font-family: var(--f-display); font-size: 20px; line-height: 1.1; color: #f5c542; white-space: nowrap; }
body[data-theme="b"] .hud-box b { color: #ffffff; }
.hud-sub { font-family: var(--f-label); font-size: 14px; letter-spacing: 0.04em; opacity: 0.7; white-space: nowrap; }
.hud-mid { display: flex; flex-direction: column; align-items: center; gap: 5px; padding-top: 6px; color: #f6efd9; }
#dots { display: flex; gap: 6px; }
.dot { width: 10px; height: 10px; background: rgba(246, 239, 217, 0.18); display: block; clip-path: polygon(30% 0, 70% 0, 100% 30%, 100% 70%, 70% 100%, 30% 100%, 0 70%, 0 30%); }
.dot.now { background: #f6efd9; }
.dot.t1 { background: #b8d86a; } .dot.t2 { background: #7fd4ff; } .dot.t3 { background: #e0513f; } .dot.t4 { background: #ff9a3c; }
.dot.t5 { background: #ff8fb1; } .dot.t6 { background: #f5c542; } .dot.t7 { background: #b0743a; } .dot.t0, .dot.t8 { background: #3b3e52; }

/* ---------- prompt ---------- */
#prompt {
  position: fixed; z-index: 15; top: calc(max(12px, env(safe-area-inset-top)) + 76px); left: 50%; transform: translateX(-50%);
  width: min(640px, calc(100% - 32px)); padding: 16px 22px 18px; text-align: left;
}
#prompt.in { animation: drop-in 0.32s steps(5) both; }
#prompt.veiled h2, #prompt.veiled .prompt-sub { filter: blur(9px); opacity: 0.5; }
#prompt.under { visibility: hidden; }
.res-q { font-family: var(--f-label); font-size: 14px; letter-spacing: 0.05em; color: var(--muted); margin: -4px 0 12px; }
.prompt-k { font-family: var(--f-label); font-size: 14px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--accent); }
body[data-theme="b"] .prompt-k { color: var(--edge); }
#prompt h2 { font-family: var(--f-text); margin: 8px 0 0; font-size: clamp(22px, 4.2vw, 32px); line-height: 1.25; font-weight: 400; }
.prompt-sub { margin-top: 6px; font-family: var(--f-label); font-size: 14px; color: var(--muted); letter-spacing: 0.03em; }
.prompt-sub:empty { display: none; }
@keyframes drop-in { from { transform: translate(-50%, -14px); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }

/* ---------- answer bar ---------- */
#answer {
  position: fixed; z-index: 16; left: 50%; transform: translateX(-50%);
  bottom: calc(100vh - var(--vvh) + max(18px, env(safe-area-inset-bottom)));
  width: min(640px, calc(100% - 32px)); display: flex; align-items: center; gap: 12px;
}
#timer { position: relative; width: 44px; height: 44px; flex: none; }
#timer-c { width: 44px; height: 44px; image-rendering: pixelated; display: block; }
#timer-v { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--f-label); font-size: 14px; color: #f6efd9; }
body[data-theme="b"] #timer-v { color: #0d2a5e; }
#timer.urgent #timer-v { color: #ff5a5a; animation: blink 0.5s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0.3; } }
#answer-in {
  flex: 1; min-width: 0; height: 48px; padding: 0 14px; border: 0; font-size: 20px; user-select: text;
  background: var(--panel); color: var(--text);
  box-shadow: 0 -3px 0 0 var(--edge), 0 3px 0 0 var(--edge), -3px 0 0 0 var(--edge), 3px 0 0 0 var(--edge);
}
#answer.p1 #answer-in { --edge: var(--p2); }
#answer-in:focus { outline: none; }
#answer-in::placeholder { color: var(--muted); }
#answer-go { height: 48px; }
#countdown {
  position: fixed; z-index: 16; left: 50%; transform: translateX(-50%); bottom: calc(100vh - var(--vvh) + max(30px, env(safe-area-inset-bottom)));
  font-family: var(--f-label); font-size: 14px; letter-spacing: 0.04em; padding: 9px 14px; background: rgba(8, 10, 26, 0.75); color: #f6efd9;
}
#answer-tag { position: fixed; z-index: 14; left: 0; right: 0; top: 52%; display: flex; justify-content: center; gap: 22px; pointer-events: none; }
.tag {
  font-size: clamp(20px, 4vw, 30px); padding: 8px 16px; color: #f5c542; background: rgba(8, 10, 26, 0.86); max-width: 44vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  box-shadow: 0 -2px 0 0 currentColor, 0 2px 0 0 currentColor, -2px 0 0 0 currentColor, 2px 0 0 0 currentColor;
  animation: tag-in 0.4s steps(4) both;
}
.tag.p1 { color: var(--p2); }
body[data-theme="b"] .tag { color: #d8343f; background: rgba(255, 255, 255, 0.94); }
body[data-theme="b"] .tag.p1 { color: #2f6fd6; }
.tag.checking { animation: tag-in 0.4s steps(4) both, blink 0.9s steps(2) 0.4s infinite; }
@keyframes tag-in { from { transform: scale(0.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* ---------- result ---------- */
#result {
  position: fixed; z-index: 18; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: min(560px, calc(100% - 32px)); max-height: calc(var(--vvh) - 140px); overflow-y: auto; padding: 22px 22px 18px; text-align: center;
}
#result.in { animation: pop 0.34s steps(5) both; }
@keyframes pop { from { transform: translate(-50%, -46%); opacity: 0; } to { transform: translate(-50%, -50%); opacity: 1; } }
.res-cols { display: grid; gap: 18px; }
.res-cols.n2 { grid-template-columns: 1fr 1fr; }
.res-col { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.res-who { font-family: var(--f-label); font-size: 14px; letter-spacing: 0.04em; text-transform: uppercase; }
.res-who.p0 { color: var(--p1); } .res-who.p1 { color: var(--p2); }
.ticon { width: 16px; height: 16px; image-rendering: pixelated; flex: none; }
.ticon.big { width: 64px; height: 64px; margin: 2px 0 4px; animation: spin-in 0.6s steps(6) both; }
@keyframes spin-in { from { transform: rotate(-120deg) scale(0.4); } to { transform: none; } }
.res-tier { font-family: var(--f-display); font-size: 30px; font-weight: 700; color: var(--accent); line-height: 1; letter-spacing: 0.02em; }
body[data-theme="b"] .res-tier { color: var(--edge); }
.res-col.t6 .res-tier { color: #f5c542; text-shadow: 0 2px 0 #b07d1a; }
.res-col.t0 .res-tier, .res-col.t8 .res-tier { color: var(--muted); }
.res-cols.n2 .res-tier { font-size: 22px; }
.res-ans { font-size: 19px; margin-top: 2px; word-break: break-word; }
.res-pts { font-family: var(--f-label); font-size: 14px; letter-spacing: 0.04em; color: var(--accent); min-height: 14px; }
body[data-theme="b"] .res-pts { color: var(--edge); }
.res-flav { font-family: var(--f-label); font-size: 14px; color: var(--muted); letter-spacing: 0.04em; }
.res-jinx { font-family: var(--f-display); margin-top: 12px; color: #ff8fb1; font-size: 18px; }
.res-list { margin-top: 16px; text-align: left; }
.res-list-k { font-family: var(--f-label); font-size: 14px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.res-items { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 8px 4px 5px; font-size: 15px; background: rgba(246, 239, 217, 0.07); }
body[data-theme="b"] .chip { background: rgba(13, 42, 94, 0.07); }
.chip.picked { box-shadow: inset 0 0 0 2px var(--accent); }
body[data-theme="b"] .chip.picked { box-shadow: inset 0 0 0 2px var(--edge); }
.result-actions { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; margin-top: 18px; }

/* ---------- handoff / veil sheets ---------- */
.veil { z-index: 40; background: rgba(5, 6, 15, 0.82); }
body[data-theme="b"] .veil { background: rgba(13, 42, 94, 0.72); }
.handoff-in { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 14px; color: #f6efd9; }
.handoff-k { font-family: var(--f-label); font-size: 14px; letter-spacing: 0.04em; text-transform: uppercase; opacity: 0.7; }
.handoff-name { font-family: var(--f-display); font-size: clamp(36px, 8vw, 64px); font-weight: 700; }
.handoff-name.p0 { color: var(--p1); } .handoff-name.p1 { color: var(--p2); }
body[data-theme="b"] .handoff-name.p0 { color: #ff6b74; } body[data-theme="b"] .handoff-name.p1 { color: #9ec8ff; }
.sheet { width: min(520px, 100%); padding: 22px; max-height: calc(var(--vvh) - 40px); overflow-y: auto; }
.sheet.wide { width: min(680px, 100%); }
.sheet.small { width: min(300px, 100%); display: flex; flex-direction: column; gap: 14px; }
.sheet h2 { font-family: var(--f-display); margin: 0 0 8px; font-size: 30px; font-weight: 700; color: var(--accent); }
body[data-theme="b"] .sheet h2 { color: var(--edge); }
.sheet-sub, .end-sub { font-family: var(--f-label); font-size: 14px; color: var(--muted); letter-spacing: 0.04em; margin: 0 0 14px; }
.sheet ol { margin: 0 0 16px; padding-left: 20px; font-size: 17px; line-height: 1.35; }
.sheet ol li { margin-bottom: 6px; }
.sheet-actions { display: flex; flex-wrap: wrap; gap: 14px; justify-content: flex-end; margin-top: 18px; }
.how-tiers { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 16px; }
.how-tier { display: flex; align-items: center; gap: 6px; font-size: 14px; }
.how-tier b { margin-left: auto; color: var(--accent); font-family: var(--f-label); font-size: 14px; }
.how-tier .ticon { width: 32px; height: 32px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.chip-btn { border: 0; padding: 8px 12px; font-size: 15px; background: rgba(246, 239, 217, 0.08); color: var(--text); }
.chip-btn.small { font-size: 14px; padding: 6px 10px; }
.chip-btn.on { background: var(--accent); color: var(--ink); }
body[data-theme="b"] .chip-btn.on { background: var(--edge); color: #fff; }
.cats { max-height: 180px; overflow-y: auto; }

/* ---------- end ---------- */
#screen-end { z-index: 19; background: rgba(5, 6, 15, 0.4); }
.end-totals { display: grid; gap: 14px; margin-bottom: 8px; }
.end-totals.n2 { grid-template-columns: 1fr 1fr; }
.end-total { display: flex; flex-direction: column; padding: 10px 12px; background: rgba(246, 239, 217, 0.06); }
.end-total .k { font-family: var(--f-label); font-size: 14px; letter-spacing: 0.04em; text-transform: uppercase; }
.end-total b { font-family: var(--f-display); font-size: 44px; line-height: 1; color: var(--accent); }
body[data-theme="b"] .end-total b { color: var(--edge); }
.end-total.p1 b { color: var(--p2); }
.end-total .z { font-family: var(--f-label); font-size: 14px; color: var(--muted); }
.end-winner { font-family: var(--f-display); font-size: 22px; text-align: center; margin: 10px 0 4px; color: #ff8fb1; }
.end-tracks { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.end-row { display: flex; flex-direction: column; gap: 4px; padding-bottom: 8px; border-bottom: 2px dashed rgba(246, 239, 217, 0.12); }
body[data-theme="b"] .end-row { border-color: rgba(13, 42, 94, 0.12); }
.end-q { font-family: var(--f-label); font-size: 14px; letter-spacing: 0.03em; color: var(--muted); }
.end-cells { display: flex; gap: 10px; }
.end-cell { flex: 1; display: flex; align-items: center; gap: 8px; font-size: 16px; min-width: 0; }
.end-cell span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.end-cell b { margin-left: auto; font-family: var(--f-label); font-size: 14px; color: var(--accent); }
body[data-theme="b"] .end-cell b { color: var(--edge); }
.end-cell.p1 b { color: var(--p2); }

.end-strip { display: flex; flex-direction: column; gap: 6px; margin: 12px 0 4px; }
.end-strip > div { display: flex; flex-wrap: wrap; gap: 3px; }
.end-strip .ticon { width: 20px; height: 20px; }

/* ---------- toast ---------- */
#toast {
  position: fixed; z-index: 50; left: 50%; top: calc(max(12px, env(safe-area-inset-top)) + 70px); transform: translateX(-50%);
  padding: 8px 14px; font-family: var(--f-label); font-size: 14px; letter-spacing: 0.04em; background: #f5c542; color: #080a1a; white-space: nowrap; max-width: calc(100% - 32px); overflow: hidden; text-overflow: ellipsis;
}
#toast.pass { top: auto; bottom: calc(100vh - var(--vvh) + 90px); background: rgba(8, 10, 26, 0.86); color: #f5c542; box-shadow: inset 0 0 0 2px #f5c542; }
body[data-theme="b"] #toast.pass { background: rgba(255, 255, 255, 0.95); color: #0d2a5e; box-shadow: inset 0 0 0 2px #1f5fc4; }
#toast.in { animation: tag-in 0.3s steps(3) both; }

/* ---------- small screens ---------- */
@media (max-width: 640px) {
  .modes { grid-template-columns: 1fr; gap: 14px; }
  .mode { flex-direction: row; justify-content: flex-start; text-align: left; padding: 10px 14px; gap: 12px; }
  .mode-art, .mode-b .mode-art, .mode-c .mode-art { width: 50px; height: 42px; margin: 0; }
  .mode > span { display: block; }
  .mode { display: grid; grid-template-columns: 56px 1fr; grid-template-rows: auto auto auto; column-gap: 12px; row-gap: 0; align-items: center; }
  .mode-art { grid-row: 1 / 4; }
  .mode-name { font-size: 22px; }
  .disc { width: 92px; height: 92px; }
  #hud { left: 58px; right: 58px; gap: 6px; grid-template-columns: 1fr 1fr; }
  .hud-box { min-width: 0; padding: 5px 7px; }
  .hud-box b { font-size: 15px; }
  .hud-mid { display: none; }
  #prompt { top: calc(max(12px, env(safe-area-inset-top)) + 64px); padding: 12px 14px 14px; }
  .mark { font-size: 14px; }
  #prompt h2 { font-size: 22px; }
  .how-tiers { grid-template-columns: repeat(2, 1fr); }
  .res-cols.n2 { gap: 10px; }
  .end-cells { flex-direction: column; gap: 4px; }
}
@media (max-height: 720px) {
  #screen-title { padding-top: 34px; }
  .disc { width: 84px; height: 84px; }
  .logo { font-size: clamp(44px, 10vh, 84px); }
  .tagline { margin: 14px 0 12px; }
  .mode-art { width: 50px; height: 42px; }
  .mode-b .mode-art { width: 34px; height: 32px; margin: 5px 0 5px; }
  .mode-c .mode-art { width: 50px; height: 30px; margin: 6px 0 6px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition: none !important; }
}

/* ---------- transitions ---------- */
#wipe { position: fixed; inset: 0; z-index: 60; pointer-events: none; image-rendering: pixelated; width: 100%; height: 100%; }
#flash { position: fixed; inset: 0; z-index: 17; pointer-events: none; background: radial-gradient(circle at 50% 55%, rgba(255, 242, 176, 0.55), rgba(245, 197, 66, 0.15) 45%, transparent 70%); animation: flash 0.9s steps(6) both; }
#flash.rare { background: radial-gradient(circle at 50% 55%, rgba(255, 156, 204, 0.45), rgba(210, 77, 138, 0.12) 45%, transparent 70%); }
@keyframes flash { 0% { opacity: 0; } 15% { opacity: 1; } 100% { opacity: 0; } }
.logo .ch { display: inline-block; animation: ch-drop 0.5s steps(5) both; }
@keyframes ch-drop { from { transform: translateY(-40px); opacity: 0; } to { transform: none; opacity: 1; } }
/* link-preview render mode (?og) */
body.og .players, body.og .names, body.og .modes, body.og .title-foot, body.og .corner-right, body.og #challenge-card { display: none !important; }
body.og #screen-title { justify-content: center; padding-top: 0; }
body.og .tagline { font-size: 18px; color: #f6efd9; }

/* ---------- settings ---------- */
.icon-btn#btn-settings { padding: 10px; }
body.playing #btn-sound, body.playing #btn-settings { display: none; }
.set-row { display: flex; flex-direction: column; gap: 6px; margin: 14px 0 0; }
.set-row.set-sub { margin-top: 8px; }
.set-k { font-size: 14px; color: var(--muted); }
.set-seg { display: flex; flex-wrap: wrap; gap: 6px; }
.set-seg .chip-btn { font-size: 15px; padding: 8px 12px; }
.set-sum { margin: 8px 0 0; font-size: 14px; color: var(--accent); }
body[data-theme="b"] .set-sum { color: var(--edge); }
#settings .sheet { max-width: 560px; }
#title-diff { color: var(--accent); opacity: 0.85; }
body[data-theme="b"] #title-diff { color: #ffffff; }
#timer.free #timer-v { font-size: 18px; }

/* ---------- themes ---------- */
#theme-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-top: 6px; }
.theme-tile {
  display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 12px; border: 0; text-align: left;
  background: rgba(246, 239, 217, 0.06); color: var(--text);
  box-shadow: inset 0 0 0 2px rgba(246, 239, 217, 0.14);
  transition: transform 0.15s steps(3), box-shadow 0.15s steps(3);
}
.theme-tile:hover, .theme-tile:focus-visible { transform: translateY(-2px); box-shadow: inset 0 0 0 2px var(--accent); outline: none; }
.theme-ic { width: 48px; height: 48px; image-rendering: pixelated; }
.theme-name { font-family: var(--f-display); font-size: 19px; line-height: 1.1; }
.theme-count { font-size: 14px; color: var(--muted); }
.mode-d .mode-art { width: 51px; height: 51px; margin: 6px 0 6px; }

/* ---------- 4 modes on the title ---------- */
.modes { grid-template-columns: repeat(3, 1fr); gap: 12px; }
.mode { padding: 10px 10px 12px; }
.mode-b .mode-art { width: 28px; height: 40px; margin: 4px 0 6px; }
#btn-season canvas { width: 18px; height: 18px; image-rendering: pixelated; display: block; margin: auto; }
.mode-e .mode-art { width: 48px; height: 48px; margin: 7px 0 8px; }
.title-wrap { width: min(860px, 100%); }
@media (max-width: 760px) and (min-width: 641px) { .modes { grid-template-columns: repeat(2, 1fr); } }
body.playing #btn-season:not([hidden]) { display: block; }

/* ---------- smoother screen changes ---------- */
.screen:not(.veil) > * { transition: opacity 0.28s ease, transform 0.28s ease; }
body.leaving .screen:not(.veil) > *, body.leaving #hud, body.leaving #prompt, body.leaving #result { opacity: 0; transform: translateY(-10px) scale(0.985); }
body.leaving #prompt, body.leaving #result { transform: translate(-50%, -10px) scale(0.985); }
#hud { transition: opacity 0.3s ease; }
#screen-title .title-wrap > *, #screen-themes .sheet, #screen-endless .sheet, #screen-end .sheet { animation: rise 0.45s cubic-bezier(.2,.8,.2,1) both; }
#screen-title .title-wrap > *:nth-child(2) { animation-delay: 0.04s; } #screen-title .title-wrap > *:nth-child(3) { animation-delay: 0.08s; }
#screen-title .title-wrap > *:nth-child(4) { animation-delay: 0.12s; } #screen-title .title-wrap > *:nth-child(5) { animation-delay: 0.16s; }
#screen-title .title-wrap > *:nth-child(6) { animation-delay: 0.2s; } #screen-title .title-wrap > *:nth-child(7) { animation-delay: 0.24s; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
#hud:not([hidden]) { animation: fade-down 0.5s cubic-bezier(.2,.8,.2,1) both; }
@keyframes fade-down { from { opacity: 0; transform: translateY(-12px); } to { opacity: 1; transform: none; } }
#prompt.in { animation: drop-in 0.5s cubic-bezier(.2,.8,.2,1) both; }
#result.in { animation: pop 0.45s cubic-bezier(.2,.8,.2,1) both; }
#answer:not([hidden]) { animation: bar-up 0.4s cubic-bezier(.2,.8,.2,1) both; }
@keyframes bar-up { from { opacity: 0; transform: translate(-50%, 16px); } to { opacity: 1; transform: translate(-50%, 0); } }
.veil:not([hidden]) { animation: veil-in 0.25s ease both; }
.veil:not([hidden]) > * { animation: rise 0.35s cubic-bezier(.2,.8,.2,1) both; }
@keyframes veil-in { from { opacity: 0; } to { opacity: 1; } }

@media (max-width: 640px) {
  #theme-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .theme-ic { width: 40px; height: 40px; }
  .theme-name { font-size: 17px; }
  .mode-d .mode-art { width: 42px; height: 42px; margin: 0; }
}
@media (max-width: 640px) {
  .modes { grid-template-columns: 1fr; gap: 12px; }
  #screen-themes, #screen-endless, #screen-end { padding-top: 62px; align-items: flex-start; }
  #settings { padding-top: 20px; align-items: flex-start; }
}
.title-foot { padding: 6px 12px; background: rgba(8, 10, 26, 0.62); }
body[data-theme="b"] .title-foot { background: rgba(13, 42, 94, 0.55); }
body[data-theme="b"] .title-foot .link { color: #ffffff; }
/* labels in themed worlds: small signs that ride with the scene */
.mark.stage { left: 0; top: 0; margin-top: 0; padding: 3px 7px; font-size: 14px; color: #f6efd9; background: rgba(8, 10, 26, 0.72); text-shadow: none; white-space: nowrap; }
.mark.stage.gold { color: #080a1a; background: #f5c542; }

/* chunkier labels: Pixelify at readable sizes, a touch of weight */
.seg, .mode-side, .mode-meta, .btn, .link, .hud-k, .hud-sub, .prompt-k, .tagline, .chip-btn, .set-k, .res-who, .res-pts, .res-flav, .res-list-k, .end-q, .end-total .k, .end-total .z, .handoff-k, #countdown, #toast, .theme-count, .ch-v, .sheet-sub, .end-sub, .mark { font-family: var(--f-label); font-weight: 500; }
.seg { font-size: 15px; padding: 8px 18px; }
.mode-side { font-size: 14px; letter-spacing: 0.06em; }
.mode-meta { font-size: 14px; }
.btn { font-size: 15px; }
.hud-k, .hud-sub { font-size: 13px; }
.tagline { font-size: 16px; }
.mark { font-size: 14px; }
.sheet ol { font-family: var(--f-label); font-size: 17px; }
#answer-in { font-family: var(--f-label); font-size: 21px; }
@media (max-width: 640px) {
  .mark { font-size: 13px; }
  .hud-k, .hud-sub { font-size: 12px; }
  .mode-side, .mode-meta { font-size: 13px; }
}
@media (max-height: 920px) and (min-width: 641px) {
  #screen-title { padding-top: 28px; }
  .disc { width: 76px; height: 76px; }
  .logo { font-size: clamp(44px, 8.5vh, 92px); }
  .tagline { margin: 12px 0 10px; }
  .players { margin-bottom: 10px; }
  .mode-art { width: 54px; height: 45px; margin-bottom: 0; }
  .mode-b .mode-art { width: 21px; height: 30px; margin: 2px 0 4px; }
  .mode-f .mode-art { width: 34px; height: 32px; margin: 3px 0 4px; }
  .mode-d .mode-art, .mode-e .mode-art { width: 36px; height: 36px; margin: 2px 0 4px; }
  .mode-c .mode-art { width: 50px; height: 30px; margin: 4px 0 6px; }
  .mode-name { font-size: 23px; }
}

/* ---------- readable text, Krillion-style: VT323, bigger, tracked caps for labels ---------- */
body { font-size: 20px; font-weight: 400; }
.seg, .mode-side, .mode-meta, .btn, .link, .hud-k, .hud-sub, .prompt-k, .tagline, .chip-btn, .set-k, .res-who, .res-pts, .res-flav, .res-list-k, .end-q, .end-total .k, .end-total .z, .handoff-k, #countdown, #toast, .theme-count, .ch-v, .sheet-sub, .end-sub, .mark, .chip, .res-q, .res-ans, .end-cell, .sheet ol, .set-sum, .how-tier, #answer-in, #timer-v, .prompt-sub, .tag { font-family: var(--f-label); font-weight: 400; }
.seg { font-size: 21px; letter-spacing: 0.12em; padding: 6px 18px; }
.mode-side { font-size: 18px; letter-spacing: 0.14em; }
.mode-meta { font-size: 19px; letter-spacing: 0.04em; }
.btn { font-size: 21px; letter-spacing: 0.12em; padding: 10px 18px; }
.link { font-size: 19px; letter-spacing: 0.12em; }
.tagline { font-size: 23px; letter-spacing: 0.06em; }
.hud-k { font-size: 17px; letter-spacing: 0.14em; }
.hud-sub { font-size: 17px; letter-spacing: 0.04em; }
.prompt-k { font-size: 18px; letter-spacing: 0.14em; }
#prompt h2 { font-size: clamp(30px, 5vw, 44px); line-height: 1.02; letter-spacing: 0.01em; }
.prompt-sub { font-size: 20px; }
#answer-in { font-size: 28px; }
#countdown { font-size: 21px; letter-spacing: 0.1em; }
.tag { font-size: clamp(26px, 4.6vw, 36px); }
.res-q { font-size: 19px; letter-spacing: 0.04em; }
.res-ans { font-size: 28px; }
.res-pts { font-size: 21px; letter-spacing: 0.06em; }
.res-flav { font-size: 20px; }
.res-list-k { font-size: 17px; letter-spacing: 0.14em; }
.chip { font-size: 21px; }
.handoff-k { font-size: 19px; letter-spacing: 0.14em; }
.sheet ol { font-size: 23px; line-height: 1.15; }
.sheet-sub, .end-sub { font-size: 20px; }
.set-k { font-size: 20px; }
.set-seg .chip-btn, .chip-btn { font-size: 21px; }
.chip-btn.small { font-size: 19px; }
.set-sum { font-size: 21px; }
.theme-count { font-size: 19px; }
.end-q { font-size: 18px; letter-spacing: 0.03em; }
.end-cell { font-size: 22px; }
.end-total .k, .end-total .z { font-size: 18px; letter-spacing: 0.08em; }
.how-tier { font-size: 21px; }
#toast { font-size: 20px; letter-spacing: 0.06em; }
.ch-v { font-size: 20px; }
.mark { font-size: 18px; letter-spacing: 0.04em; }
.mark.stage { font-size: 18px; padding: 2px 8px; }
#timer-v { font-size: 18px; }
@media (max-width: 640px) {
  #prompt h2 { font-size: 28px; }
  .mark, .mark.stage { font-size: 16px; }
  .hud-k, .hud-sub { font-size: 15px; }
  .hud-box b { font-size: 17px; }
  .mode-side { font-size: 16px; } .mode-meta { font-size: 17px; }
  .tagline { font-size: 20px; }
  #answer-in { font-size: 24px; }
  .res-ans { font-size: 24px; }
}

/* ---------- online ---------- */
.mode-g { grid-column: 1 / -1; display: grid; grid-template-columns: auto auto; grid-template-rows: auto auto auto; column-gap: 16px; row-gap: 0; justify-content: center; align-items: center; text-align: left; padding: 10px 18px 12px; }
.mode-g .mode-art { grid-row: 1 / 4; width: 75px; height: 45px; margin: 0; }
.on-k { font-size: 18px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); margin: 12px 0 6px; display: block; }
.on-input { width: 100%; border: 0; padding: 10px 12px; font-family: var(--f-label); font-size: 26px; background: rgba(246, 239, 217, 0.08); color: var(--text); user-select: text; }
body[data-theme="b"] .on-input { background: rgba(13, 42, 94, 0.08); }
.on-input:focus { outline: none; box-shadow: inset 0 0 0 2px var(--accent); }
body[data-theme="b"] .on-input:focus { box-shadow: inset 0 0 0 2px var(--edge); }
.on-create { width: 100%; margin-top: 16px; }
.on-or { text-align: center; color: var(--muted); font-size: 19px; letter-spacing: 0.08em; margin: 18px 0 8px; }
.on-join { display: flex; gap: 12px; }
.on-code { text-transform: uppercase; letter-spacing: 0.4em; text-align: center; font-size: 30px; }
.lobby-top { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; }
.lobby-top .on-k { margin-top: 0; }
.lobby-code { font-family: var(--f-display); font-weight: 700; font-size: clamp(48px, 11vw, 72px); line-height: 0.9; letter-spacing: 0.12em; color: var(--accent); user-select: text; }
body[data-theme="b"] .lobby-code { color: var(--edge); }
.lobby-players { list-style: none; padding: 0; margin: 0 0 6px; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 6px; }
.lobby-players li { display: flex; align-items: center; gap: 10px; padding: 6px 10px; font-size: 23px; background: rgba(246, 239, 217, 0.06); animation: rise 0.35s cubic-bezier(.2,.8,.2,1) both; }
body[data-theme="b"] .lobby-players li { background: rgba(13, 42, 94, 0.06); }
.lobby-players li.off { opacity: 0.45; }
.lobby-players .sw { width: 14px; height: 14px; flex: none; box-shadow: 0 2px 0 rgba(0, 0, 0, 0.35); }
.lobby-players .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lobby-players .tg { margin-left: auto; font-size: 17px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); white-space: nowrap; }
.lobby-players .kick { border: 0; background: none; color: var(--muted); font-size: 22px; padding: 0 2px; }
.lobby-players .kick:hover { color: #ff5a5a; }
.lobby-sum { font-size: 22px; margin: 12px 0 0; color: var(--accent); }
body[data-theme="b"] .lobby-sum { color: var(--edge); }
.lobby-wait { font-size: 20px; color: var(--muted); margin: 10px 0 0; min-height: 0; }
.lobby-wait:empty { display: none; }
#lobby-cfg .set-row:first-child { margin-top: 10px; }
#on-wait { position: fixed; z-index: 16; left: 50%; transform: translateX(-50%); bottom: calc(100vh - var(--vvh) + max(18px, env(safe-area-inset-bottom))); width: min(640px, calc(100% - 32px)); padding: 12px 16px 14px; text-align: center; animation: bar-up 0.4s cubic-bezier(.2,.8,.2,1) both; }
.on-wait-k { font-size: 18px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
.on-wait-ans { font-size: 28px; margin: 2px 0 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.on-wait-ans.checking { animation: blink 0.9s steps(2) infinite; }
.on-wait-list { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.on-wait-list span { font-size: 19px; padding: 2px 8px; background: rgba(246, 239, 217, 0.06); color: var(--muted); }
body[data-theme="b"] .on-wait-list span { background: rgba(13, 42, 94, 0.06); }
.on-wait-list span.done { color: var(--ink); background: var(--c); }
.on-wait-list span.off { opacity: 0.4; }
/* online reveal + standings */
.on-table { margin-top: 14px; display: flex; flex-direction: column; gap: 4px; text-align: left; }
.on-row { display: grid; grid-template-columns: 22px minmax(60px, 0.8fr) minmax(0, 1.4fr) auto 58px; align-items: center; gap: 8px; padding: 5px 8px; font-size: 21px; background: rgba(246, 239, 217, 0.05); animation: rise 0.4s cubic-bezier(.2,.8,.2,1) both; }
body[data-theme="b"] .on-row { background: rgba(13, 42, 94, 0.05); }
.on-row.me { box-shadow: inset 0 0 0 2px var(--c); }
.on-row .rk { font-size: 18px; color: var(--muted); text-align: right; }
.on-row .nm { color: var(--c); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
body[data-theme="b"] .on-row .nm { color: var(--ink); text-decoration: underline 3px var(--c); text-underline-offset: 3px; }
.on-row .an { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; align-items: center; gap: 6px; }
.on-row .an span { overflow: hidden; text-overflow: ellipsis; }
.on-row .an.checking { animation: blink 0.9s steps(2) infinite; }
.on-row .pt { font-size: 19px; color: var(--accent); white-space: nowrap; }
body[data-theme="b"] .on-row .pt { color: var(--edge); }
.on-row .tt { font-family: var(--f-display); font-weight: 700; font-size: 20px; text-align: right; }
.on-head { display: grid; grid-template-columns: 22px minmax(60px, 0.8fr) minmax(0, 1.4fr) auto 58px; gap: 8px; padding: 0 8px; font-size: 16px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.on-head span:last-child { text-align: right; }
.on-next { font-size: 19px; color: var(--muted); letter-spacing: 0.06em; align-self: center; }
.podium { display: flex; align-items: flex-end; justify-content: center; gap: 10px; margin: 10px 0 14px; }
.podium > div { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; width: 31%; max-width: 170px; }
.podium .pn { font-size: 22px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--c); }
body[data-theme="b"] .podium .pn { color: var(--ink); }
.podium .ps { font-family: var(--f-display); font-weight: 700; font-size: 30px; line-height: 1; margin: 2px 0 6px; }
.podium .pb { width: 100%; background: var(--c); color: rgba(8, 10, 26, 0.75); font-family: var(--f-display); font-weight: 700; font-size: 34px; display: grid; place-items: start center; padding-top: 4px; box-shadow: inset 0 -6px 0 rgba(0, 0, 0, 0.22); transform-origin: bottom; animation: grow-up 0.7s cubic-bezier(.2,.8,.2,1) both; }
.podium .p1 .pb { height: 96px; animation-delay: 0.5s; } .podium .p2 .pb { height: 68px; animation-delay: 0.25s; } .podium .p3 .pb { height: 46px; }
@keyframes grow-up { from { transform: scaleY(0); } to { transform: scaleY(1); } }
.on-best { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
@media (max-width: 640px) {
  .mode-g { grid-template-columns: 56px 1fr; justify-content: stretch; padding: 10px 14px; column-gap: 12px; }
  .mode-g .mode-art { width: 50px; height: 30px; }
  #screen-online, #screen-lobby { padding-top: 62px; align-items: flex-start; }
  .on-row, .on-head { grid-template-columns: 18px minmax(48px, 0.7fr) minmax(0, 1.3fr) auto 44px; gap: 6px; font-size: 19px; }
  .on-row .pt { font-size: 17px; }
  .on-row .tt { font-size: 17px; }
  .lobby-players { grid-template-columns: 1fr 1fr; }
  .lobby-players li { font-size: 20px; }
}
#screen-online .sheet, #screen-lobby .sheet { animation: rise 0.45s cubic-bezier(.2,.8,.2,1) both; }
.sheet .lobby-players { padding: 0; margin: 0 0 6px; }
.end-cell b { font-size: 20px; }
@media (max-width: 640px) {
  /* reveal rows: name + total on top, answer + tier underneath */
  .on-row { grid-template-columns: 20px minmax(0, 1fr) auto; grid-template-areas: "rk nm tt" "rk an pt"; row-gap: 0; padding: 6px 10px; }
  .on-row .rk { grid-area: rk; } .on-row .nm { grid-area: nm; } .on-row .an { grid-area: an; } .on-row .pt { grid-area: pt; } .on-row .tt { grid-area: tt; }
  .on-head { display: none; }
}
@media (max-width: 640px) {
  .lobby-top { flex-direction: column; align-items: stretch; gap: 10px; }
  .lobby-top .on-k { margin-right: 52px; }
}

/* ---------- reveal: stamped tier names, popping icons, a shaking world on the big one ---------- */
.ticon.big { animation: icon-pop 0.5s steps(6) both; }
@keyframes icon-pop { 0% { transform: scale(0.2); opacity: 0; } 60% { transform: scale(1.25); opacity: 1; } 100% { transform: scale(1); opacity: 1; } }
.res-col.t6 .ticon.big { animation: icon-pop 0.5s steps(6) both, wobble 1.4s steps(4) 0.7s infinite; }
.res-col.t5 .ticon.big { animation: icon-pop 0.5s steps(6) both, hop 1s steps(4) 0.7s infinite; }
.res-col.t1 .ticon.big, .res-col.t0 .ticon.big { animation: icon-pop 0.5s steps(6) both, gag 0.5s steps(3) 0.55s 2; }
@keyframes wobble { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-9deg); } 75% { transform: rotate(9deg); } }
@keyframes hop { 0%, 100% { transform: translateY(0); } 40% { transform: translateY(-6px); } }
@keyframes gag { 0%, 100% { transform: translateX(0); } 33% { transform: translateX(-3px); } 66% { transform: translateX(3px); } }
.res-tier { animation: stamp 0.5s cubic-bezier(.17,1.5,.4,1) 0.16s both; transform-origin: 50% 60%; }
@keyframes stamp { 0% { transform: scale(2.4); opacity: 0; } 50% { opacity: 1; } 100% { transform: scale(1); opacity: 1; } }
.res-ans { animation: rise 0.4s cubic-bezier(.2,.8,.2,1) 0.3s both; }
.res-pts, .res-flav { animation: rise 0.4s cubic-bezier(.2,.8,.2,1) 0.42s both; }
#stage.shake { animation: shake 0.55s steps(9) both; }
@keyframes shake { 0%, 100% { transform: none; } 15% { transform: translate(-7px, 3px); } 30% { transform: translate(6px, -4px); } 45% { transform: translate(-5px, -2px); } 60% { transform: translate(4px, 4px); } 75% { transform: translate(-2px, 2px); } }
#hud-score { position: relative; }
.hud-plus { position: absolute; right: 8px; top: calc(100% + 4px); font-family: var(--f-display); font-weight: 700; font-size: 24px; color: #f5c542; text-shadow: 0 2px 0 rgba(0, 0, 0, 0.45); pointer-events: none; animation: plus-up 1.2s cubic-bezier(.2,.8,.2,1) both; }
body[data-theme="b"] .hud-plus { color: #ffffff; text-shadow: 0 2px 0 #0d2a5e; }
@keyframes plus-up { 0% { transform: translateY(12px) scale(0.6); opacity: 0; } 18% { transform: translateY(0) scale(1.15); opacity: 1; } 70% { opacity: 1; } 100% { transform: translateY(-18px) scale(1); opacity: 0; } }
/* toasts wrap instead of running off a phone */
#toast { white-space: normal; text-align: center; width: max-content; max-width: min(560px, calc(100% - 32px)); line-height: 1.1; }
/* how to play: short, a rarity ladder, the OK button always visible */
#how .sheet { display: flex; flex-direction: column; padding-bottom: 16px; }
#how .sheet ol { margin-bottom: 10px; }
.how-k { font-size: 18px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); margin: 4px 0 8px; }
.how-ladder { display: flex; flex-direction: column; gap: 4px; }
.how-step { display: grid; grid-template-columns: 34px minmax(0, auto) 1fr auto; align-items: center; gap: 10px; padding: 3px 8px 3px 4px; background: rgba(246, 239, 217, 0.05); animation: rise 0.4s cubic-bezier(.2,.8,.2,1) both; }
body[data-theme="b"] .how-step { background: rgba(13, 42, 94, 0.05); }
.how-step .ticon { width: 32px; height: 32px; }
.how-step .hn { font-family: var(--f-display); font-weight: 700; font-size: 20px; white-space: nowrap; }
.how-step .hf { font-size: 18px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.how-step .hp { font-family: var(--f-display); font-weight: 700; font-size: 20px; color: var(--accent); }
body[data-theme="b"] .how-step .hp { color: var(--edge); }
.how-foot { font-size: 18px; color: var(--muted); margin: 10px 0 0; }
#how .sheet-actions { position: sticky; bottom: -16px; margin: 12px -22px -16px; padding: 12px 22px 16px; background: var(--panel); }
@media (max-width: 640px) {
  .how-step { grid-template-columns: 34px 1fr auto; }
  .how-step .hf { display: none; }
  #how { align-items: flex-start; padding-top: 20px; }
}
#how .sheet-actions { background: #0c0e21; box-shadow: 0 -10px 12px -6px #0c0e21; }
body[data-theme="b"] #how .sheet-actions { background: #f7f8fb; box-shadow: 0 -10px 12px -6px #f7f8fb; }
@media (max-width: 640px) { #how .sheet ol { font-size: 20px; } }
