/* Buzzword. Phone first: the play screen is one fixed column (score, board, clue, keyboard) that never scrolls. */
:root {
  --bg: #070a24; --bg2: #0e1340; --panel: #131a52; --line: rgba(255, 255, 255, .13);
  --tile: #2032ad; --tile2: #16227e; --tile-on: #5870ff; --tile-on2: #3a52e4;
  --gold: #ffd166; --gold2: #ff9f1c; --ink: #f6f7ff; --muted: #9ea7dc;
  --bad: #ff6274; --bad2: #7c1d33; --fin: #7a4be0; --fin2: #4a2aa0; --good: #5fe3a1;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  background:
    radial-gradient(80vmax 60vmax at 0% 0%, rgba(96, 72, 255, .30), transparent 65%),
    radial-gradient(70vmax 60vmax at 100% 100%, rgba(36, 120, 255, .20), transparent 65%),
    linear-gradient(165deg, #121a5c, #070a24 60%);
  background-attachment: fixed;
  color: var(--ink);
  font-family: var(--sans);
  line-height: 1.4;
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; padding: 0; touch-action: manipulation; -webkit-user-select: none; user-select: none; }
button:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; display: block; }
svg circle { fill: currentColor; stroke: none; }

.screen { position: fixed; inset: 0; height: 100dvh; width: 100%; max-width: 520px; margin: 0 auto; }

/* ================= home ================= */
#home { overflow-y: auto; }
.home-inner { min-height: 100%; display: flex; flex-direction: column; justify-content: center; padding: max(28px, env(safe-area-inset-top)) 20px max(28px, env(safe-area-inset-bottom)); }
.logo { margin: 0 auto 14px; font-size: 0; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.logo .row { display: flex; gap: 6px; }
.logo b {
  width: 62px; height: 62px; border-radius: 12px; display: grid; place-items: center;
  font: 900 38px/1 var(--sans); color: #2a1800;
  background: linear-gradient(180deg, #ffe08a, var(--gold2)); box-shadow: 0 6px 0 #b86a00, 0 14px 28px rgba(255, 159, 28, .3);
  animation: drop .6s cubic-bezier(.2, 1.4, .4, 1) backwards;
}
.logo .alt b { color: var(--gold); background: linear-gradient(180deg, var(--tile-on), var(--tile2)); box-shadow: 0 6px 0 #101a66, 0 14px 28px rgba(36, 57, 196, .4); }
.logo .row b:nth-child(2) { animation-delay: .06s; } .logo .row b:nth-child(3) { animation-delay: .12s; } .logo .row b:nth-child(4) { animation-delay: .18s; }
.logo .alt b { animation-delay: .24s; } .logo .alt b:nth-child(2) { animation-delay: .3s; } .logo .alt b:nth-child(3) { animation-delay: .36s; } .logo .alt b:nth-child(4) { animation-delay: .42s; }
@keyframes drop { from { transform: translateY(-40px) rotate(-8deg); opacity: 0; } }
.tag { text-align: center; color: var(--muted); margin: 14px 0 26px; font-size: 1.02rem; }
.tag em { color: var(--ink); font-family: var(--serif); }

.card {
  position: relative; display: grid; grid-template-columns: 1fr auto; gap: 2px 14px; align-items: center; text-align: left; width: 100%;
  padding: 18px 18px 18px 20px; margin-bottom: 14px; border-radius: 20px; border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(34, 44, 130, .92), rgba(17, 23, 78, .92)); box-shadow: 0 16px 36px rgba(0, 0, 0, .35); overflow: hidden;
  transition: transform .12s;
}
.card:active { transform: scale(.985); }
.card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: linear-gradient(180deg, var(--gold), var(--gold2)); }
.card.practice::before { background: linear-gradient(180deg, #6f8cff, #3550e6); }
.kicker { grid-column: 1; font-size: .72rem; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; color: var(--gold); }
.card.practice .kicker { color: #9fb2ff; }
.card-title { grid-column: 1; font-size: 1.45rem; font-weight: 900; line-height: 1.15; }
.card-sub { grid-column: 1; color: var(--muted); font-size: .92rem; }
.cta { grid-column: 2; grid-row: 1 / span 3; padding: 12px 20px; border-radius: 999px; font-weight: 900; color: #2a1800; background: linear-gradient(180deg, #ffe08a, var(--gold2)); box-shadow: 0 6px 16px rgba(255, 159, 28, .3); white-space: nowrap; }
.card.practice .cta { color: #fff; background: linear-gradient(180deg, #5a74ff, #2f46d8); box-shadow: 0 6px 16px rgba(53, 80, 230, .35); }
.card.done .cta { background: none; box-shadow: none; color: var(--gold); border: 1px solid rgba(255, 209, 102, .5); }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 10px 0 18px; }
.stat { text-align: center; padding: 12px 4px; border-radius: 14px; background: rgba(255, 255, 255, .05); border: 1px solid var(--line); }
.stat b { display: block; font-size: 1.12rem; font-weight: 900; color: var(--gold); font-variant-numeric: tabular-nums; }
.stat span { font-size: .68rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.link { display: block; margin: 0 auto; padding: 12px 16px; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; font-size: .95rem; }

/* ================= game ================= */
#game { display: grid; grid-template-rows: auto auto minmax(0, 1fr) auto auto; padding-top: env(safe-area-inset-top); }
.bar { display: grid; grid-template-columns: 44px 68px 1fr 44px 44px; align-items: center; padding: 6px 8px 4px; }
.bar .scorebox { grid-column: 3; text-align: center; padding-right: 24px; }
.final-pill { justify-self: start; height: 32px; padding: 0 11px; border-radius: 999px; font-size: .8rem; font-weight: 900; letter-spacing: .04em; color: #fff; background: linear-gradient(180deg, var(--fin), var(--fin2)); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25), 0 2px 0 rgba(0, 0, 0, .35); white-space: nowrap; }
.final-pill:active { filter: brightness(1.25); }
.final-pill.off { visibility: hidden; }
.icon { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; color: var(--muted); }
.icon:active { background: rgba(255, 255, 255, .08); }
.score { font-size: 1.7rem; font-weight: 900; line-height: 1; color: var(--gold); text-shadow: 0 2px 14px rgba(255, 159, 28, .35); font-variant-numeric: tabular-nums; transition: color .2s; }
.score.neg { color: var(--bad); text-shadow: none; }
.score.bump { animation: bump .45s; }
@keyframes bump { 40% { transform: scale(1.22); } }
.scorebox .sub { font-size: .68rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin-top: 3px; }
.progress { height: 3px; margin: 0 14px; background: rgba(255, 255, 255, .08); border-radius: 3px; overflow: hidden; }
.progress i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--gold), var(--gold2)); transition: width .4s; }

#boardWrap { position: relative; display: grid; place-items: center; min-height: 0; padding: 8px; overflow: hidden; }
#board { --cell: 28px; position: relative; display: grid; gap: 2px; grid-auto-rows: var(--cell); }
.cell, .gap { width: var(--cell); height: var(--cell); }
.cell {
  position: relative; display: grid; place-items: center; border-radius: calc(var(--cell) * .17);
  background: linear-gradient(180deg, var(--tile), var(--tile2));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .16), 0 2px 0 rgba(0, 0, 0, .35);
  -webkit-user-select: none; user-select: none; cursor: pointer;
}
.cell b { font: 800 calc(var(--cell) * .6)/1 var(--sans); padding-top: calc(var(--cell) * .1); color: #fff; text-shadow: 0 1px 0 rgba(0, 0, 0, .35); }
.cell .n { position: absolute; top: 1px; left: 2px; font: 700 max(7px, calc(var(--cell) * .27))/1 var(--sans); font-style: normal; color: rgba(255, 255, 255, .62); }
.cell.on { background: linear-gradient(180deg, var(--tile-on), var(--tile-on2)); box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, .42), 0 2px 0 rgba(0, 0, 0, .35); }
.cell.cur { background: linear-gradient(180deg, #6f86ff, #4860f2); box-shadow: 0 0 0 2.5px var(--gold), 0 0 16px rgba(255, 209, 102, .55); z-index: 2; }
.cell.fin { background: linear-gradient(180deg, var(--fin), var(--fin2)); }
.cell.fin.solo::after { content: "\2605"; font-size: calc(var(--cell) * .36); color: rgba(255, 255, 255, .28); }
.cell.fin.on { background: linear-gradient(180deg, #9a70ff, #6a43d6); }
.cell.ok { background: linear-gradient(180deg, #2a2360, #1a1647); box-shadow: inset 0 0 0 1.5px rgba(255, 209, 102, .55), 0 2px 0 rgba(0, 0, 0, .35); }
.cell.ok b { color: var(--gold); }
.cell.miss { background: linear-gradient(180deg, #5a1830, #3a0f22); box-shadow: inset 0 0 0 1.5px rgba(255, 98, 116, .5), 0 2px 0 rgba(0, 0, 0, .35); }
.cell.miss b { color: #ff9aa6; }
.cell.split { background: linear-gradient(135deg, #2a2360 50%, #5a1830 50%); box-shadow: inset 0 0 0 1.5px rgba(255, 209, 102, .4), 0 2px 0 rgba(0, 0, 0, .35); }
.cell.split b { color: var(--gold); }
.cell.shown { background: linear-gradient(180deg, #23284f, #181c3b); box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, .14); }
.cell.shown b { color: #aab1d8; }
.cell.ok.on, .cell.miss.on, .cell.shown.on, .cell.split.on { filter: brightness(1.35); }
.cell.ok.cur, .cell.miss.cur, .cell.shown.cur, .cell.split.cur { box-shadow: 0 0 0 2.5px var(--gold); }

.cell.pop b { animation: pop .14s; }
@keyframes pop { from { transform: scale(1.35); } }
.cell.flip { animation: flip .5s var(--d, 0s) backwards; }
@keyframes flip { 0% { transform: rotateX(0) scale(1); filter: brightness(1); } 45% { transform: rotateX(90deg) scale(1.12); filter: brightness(2.2); } 100% { transform: rotateX(0) scale(1); } }
.cell.shake { animation: shake .5s; }
@keyframes shake { 15%, 55% { transform: translateX(-5px); } 35%, 75% { transform: translateX(5px); } }
.cell.nudge { animation: nudge .3s; }
@keyframes nudge { 30% { transform: translateY(-3px); } 60% { transform: translateY(2px); } }
.delta { position: absolute; z-index: 5; transform: translate(-50%, -50%); font: 900 1.7rem/1 var(--sans); color: var(--gold); text-shadow: 0 2px 0 rgba(0, 0, 0, .5), 0 0 22px rgba(255, 159, 28, .7); pointer-events: none; animation: rise 1.25s ease-out forwards; white-space: nowrap; }
.delta.bad { color: var(--bad); text-shadow: 0 2px 0 rgba(0, 0, 0, .5), 0 0 22px rgba(255, 98, 116, .6); }
@keyframes rise { 0% { opacity: 0; transform: translate(-50%, -20%) scale(.6); } 18% { opacity: 1; transform: translate(-50%, -60%) scale(1.15); } 70% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -190%) scale(1); } }

/* ---------- clue card ---------- */
#clueRow { display: grid; grid-template-columns: 36px 1fr 36px; align-items: stretch; gap: 4px; padding: 4px 6px 8px; }
.step { border-radius: 12px; display: grid; place-items: center; color: var(--muted); background: rgba(255, 255, 255, .05); }
.step:active { background: rgba(255, 255, 255, .13); }
.step svg { width: 20px; height: 20px; }
#clueCard {
  position: relative; height: 7.7rem; padding: 7px 12px 6px; border-radius: 14px; overflow: hidden;
  display: grid; grid-template-rows: auto 1fr auto; gap: 4px;
  background: linear-gradient(180deg, #2238c0, #131f86); border: 1px solid rgba(255, 255, 255, .16);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .18), 0 10px 24px rgba(0, 0, 0, .35);
}
#clueCard.final { background: linear-gradient(180deg, #6b41d4, #3a1f8c); }
#clueCard.flash-ok { animation: flashOk .7s; } #clueCard.flash-bad { animation: flashBad .7s; }
@keyframes flashOk { 0% { box-shadow: 0 0 0 3px var(--gold), 0 0 40px rgba(255, 209, 102, .8); } }
@keyframes flashBad { 0% { box-shadow: 0 0 0 3px var(--bad), 0 0 40px rgba(255, 98, 116, .8); } }
.c-top { display: flex; align-items: center; gap: 8px; min-width: 0; }
.c-cat { flex: 1; min-width: 0; font-size: .74rem; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; color: var(--gold); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.c-val { flex: none; padding: 3px 9px; border-radius: 999px; font-size: .82rem; font-weight: 900; color: #2a1800; background: linear-gradient(180deg, #ffe08a, var(--gold2)); font-variant-numeric: tabular-nums; }
.c-val.ok { background: var(--good); color: #05301c; } .c-val.bad { background: var(--bad); color: #3a0010; } .c-val.nil { background: rgba(255, 255, 255, .18); color: var(--ink); }
.c-val.star { background: linear-gradient(180deg, #fff, #d9ccff); color: #2c1470; }
.c-in { margin: auto 0; }
.c-text { scrollbar-width: none; } .c-text::-webkit-scrollbar { display: none; }
.c-text { min-height: 0; display: flex; flex-direction: column; font-family: var(--serif); font-weight: 600; font-size: 1rem; line-height: 1.25; text-shadow: 0 1px 0 rgba(0, 0, 0, .4); text-wrap: pretty; overflow: hidden auto; }
.c-text.m { font-size: .93rem; } .c-text.s { font-size: .86rem; line-height: 1.2; } .c-text.xs { font-size: .8rem; line-height: 1.18; }
.c-text i { display: block; margin-bottom: 2px; font: italic 500 .8em/1.2 var(--sans); color: rgba(255, 255, 255, .72); text-shadow: none; }
.c-meta { font-size: .7rem; letter-spacing: .05em; color: rgba(255, 255, 255, .66); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.c-meta b { color: #fff; font-weight: 700; }

/* ---------- keyboard ---------- */
#kb { padding: 0 4px max(8px, env(safe-area-inset-bottom)); display: grid; gap: 6px; }
.kb-row { display: flex; justify-content: center; gap: 5px; }
.key { flex: 1 1 0; max-width: 46px; height: 44px; border-radius: 9px; font-size: 1.12rem; font-weight: 700; background: linear-gradient(180deg, #3a4284, #2b3270); box-shadow: 0 2px 0 #151a45; display: grid; place-items: center; }
.key.down { transform: translateY(2px); background: #5b66c0; box-shadow: none; }
.key.wide { flex: 1.6 1 0; max-width: 78px; font-size: .78rem; font-weight: 900; letter-spacing: .08em; }
.key.buzz { color: var(--muted); }
.key.buzz.ready { color: #2a1800; background: linear-gradient(180deg, #ffe08a, var(--gold2)); box-shadow: 0 2px 0 #b86a00, 0 0 18px rgba(255, 159, 28, .55); animation: ready 1.4s ease-in-out infinite; }
@keyframes ready { 50% { box-shadow: 0 2px 0 #b86a00, 0 0 28px rgba(255, 190, 60, .95); } }
.key svg { width: 22px; height: 22px; }
.kb-done { padding: 6px 8px 10px; }

/* ================= buttons ================= */
.primary, .ghost { display: block; width: 100%; min-height: 54px; padding: 12px 18px; border-radius: 16px; font-size: 1.08rem; font-weight: 900; }
.primary { color: #2a1800; background: linear-gradient(180deg, #ffe08a, var(--gold2)); box-shadow: 0 4px 0 #b86a00, 0 12px 26px rgba(255, 159, 28, .3); }
.primary:active { transform: translateY(3px); box-shadow: 0 1px 0 #b86a00; }
.ghost { border: 1px solid var(--line); background: rgba(255, 255, 255, .06); }
.ghost:active { background: rgba(255, 255, 255, .14); }
.ghost.danger { color: var(--bad); }

/* ================= overlays ================= */
.overlay { position: fixed; inset: 0; z-index: 20; background: rgba(4, 6, 24, .72); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); display: grid; animation: fade .2s; }
@keyframes fade { from { opacity: 0; } }
#sheet { align-items: end; justify-items: center; }
.sheet-body { width: 100%; max-width: 520px; max-height: 86dvh; overflow-y: auto; overscroll-behavior: contain; padding: 8px 16px max(18px, env(safe-area-inset-bottom)); border-radius: 22px 22px 0 0; background: linear-gradient(180deg, #1a2268, #0e1340); border-top: 1px solid var(--line); animation: up .28s cubic-bezier(.2, .9, .3, 1); }
@keyframes up { from { transform: translateY(100%); } }
.sheet-body::before { content: ""; display: block; width: 42px; height: 4px; margin: 2px auto 12px; border-radius: 4px; background: rgba(255, 255, 255, .25); }
.sheet-body h2 { margin: 0 0 12px; font-size: 1.25rem; font-weight: 900; }
.sheet-body h3 { margin: 16px 0 6px; font-size: .72rem; letter-spacing: .16em; text-transform: uppercase; color: var(--gold); }
.sheet-body .ghost, .sheet-body .primary { margin-bottom: 10px; }
.cl { display: grid; grid-template-columns: 30px 1fr auto; gap: 2px 8px; width: 100%; text-align: left; padding: 10px 10px; border-radius: 12px; align-items: baseline; }
.cl + .cl { border-top: 1px solid rgba(255, 255, 255, .06); }
.cl:active, .cl.sel { background: rgba(255, 255, 255, .08); }
.cl .num { font-weight: 900; color: var(--muted); }
.cl .cat { font-size: .72rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--gold); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cl .val { font-weight: 900; font-size: .85rem; font-variant-numeric: tabular-nums; }
.cl .txt { grid-column: 2 / span 2; font-family: var(--serif); font-size: .95rem; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cl.ok .val { color: var(--good); } .cl.bad .val { color: var(--bad); } .cl.nil .val { color: var(--muted); }
.cl.ok .txt, .cl.bad .txt, .cl.nil .txt { color: var(--muted); }
.how { margin: 0; padding: 0; list-style: none; counter-reset: how; }
.how li { position: relative; padding: 0 0 14px 42px; counter-increment: how; color: #d5d9f7; }
.how li::before { content: counter(how); position: absolute; left: 0; top: 0; width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; font-weight: 900; color: #2a1800; background: linear-gradient(180deg, #ffe08a, var(--gold2)); }
.how b { color: #fff; }
.fine { font-size: .8rem; color: var(--muted); margin: 16px 0 0 !important; }

#modal { place-items: center; padding: 18px; }
.modal-body { width: 100%; max-width: 420px; max-height: 92dvh; overflow: hidden auto; padding: 24px 20px 20px; border-radius: 24px; text-align: center; background: linear-gradient(180deg, #2238c0, #101a70); border: 1px solid rgba(255, 255, 255, .2); box-shadow: 0 30px 80px rgba(0, 0, 0, .6); animation: zoom .35s cubic-bezier(.2, 1.3, .4, 1); }
.modal-body.final { background: linear-gradient(180deg, #6b41d4, #2c1470); }
@keyframes zoom { from { transform: scale(.7); opacity: 0; } }
.modal-body h2 { margin: 0 0 6px; font-size: 1.3rem; font-weight: 900; }
.modal-body p { margin: 0 0 14px; color: #d5d9f7; }
.modal-body .ghost { margin-top: 10px; }
.splash { font: 900 2.7rem/.92 var(--sans); letter-spacing: .02em; text-transform: uppercase; color: var(--gold); text-shadow: 0 4px 0 #8a4b00, 0 0 40px rgba(255, 190, 60, .8); margin: 4px 0 14px; animation: splash .7s cubic-bezier(.2, 1.5, .4, 1); }
.final .splash { color: #fff; text-shadow: 0 4px 0 #2c1470, 0 0 40px rgba(190, 160, 255, .9); }
@keyframes splash { from { transform: scale(2.6) rotate(-10deg); opacity: 0; } }
.m-cat { font-size: .78rem; letter-spacing: .14em; text-transform: uppercase; color: rgba(255, 255, 255, .7); margin-bottom: 2px; }
.m-catname { font: 700 1.3rem/1.2 var(--serif); margin-bottom: 12px; }
.pattern { display: flex; justify-content: center; gap: 4px; margin: 0 0 16px; }
.pattern span { width: 28px; height: 32px; border-radius: 6px; display: grid; place-items: center; font-weight: 800; background: rgba(0, 0, 0, .28); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .16); }
.pattern span.k { color: var(--gold); background: rgba(0, 0, 0, .45); }
.wager { margin: 0 0 16px; padding: 14px 12px 12px; border-radius: 18px; background: rgba(0, 0, 0, .25); }
.w-row { display: grid; grid-template-columns: 48px 1fr 48px; align-items: center; }
.w-row button { width: 48px; height: 48px; border-radius: 50%; font-size: 1.6rem; font-weight: 700; background: rgba(255, 255, 255, .12); }
.w-row button:active { background: rgba(255, 255, 255, .25); }
.w-amt { font: 900 2.5rem/1 var(--sans); color: var(--gold); font-variant-numeric: tabular-nums; }
.w-of { font-size: .78rem; color: rgba(255, 255, 255, .7); margin: 4px 0 8px; }
.wager input[type=range] { width: 100%; height: 32px; margin: 0; accent-color: var(--gold2); }
.chips { display: flex; gap: 6px; margin-top: 6px; }
.chips button { flex: 1; padding: 9px 2px; border-radius: 999px; font-size: .82rem; font-weight: 800; background: rgba(255, 255, 255, .12); }
.chips button:active { background: rgba(255, 255, 255, .28); }

#toast { position: fixed; left: 50%; bottom: 46%; z-index: 40; transform: translateX(-50%) translateY(10px); padding: 10px 16px; border-radius: 999px; font-weight: 700; font-size: .92rem; background: rgba(8, 10, 34, .94); border: 1px solid var(--line); box-shadow: 0 10px 30px rgba(0, 0, 0, .5); opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; white-space: nowrap; max-width: 92vw; overflow: hidden; text-overflow: ellipsis; }
#toast.show { opacity: 1; transform: translateX(-50%); }

/* ================= results ================= */
#results { overflow-y: auto; }
.results-inner { position: relative; padding: max(34px, env(safe-area-inset-top)) 20px max(30px, env(safe-area-inset-bottom)); text-align: center; }
.res-score { font: 900 4.2rem/1 var(--sans); color: var(--gold); text-shadow: 0 4px 0 #8a4b00, 0 0 50px rgba(255, 180, 60, .55); margin: 8px 0 8px; font-variant-numeric: tabular-nums; }
.res-score.neg { color: var(--bad); text-shadow: 0 4px 0 #5a0f22; }
.res-line { font: 600 1.2rem/1.3 var(--serif); margin-bottom: 18px; }
.res-facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 20px; }
.res-actions { display: grid; gap: 10px; }
.recap-h { margin: 26px 0 8px; text-align: left; font-size: .72rem; letter-spacing: .16em; text-transform: uppercase; color: var(--gold); }
.recap { text-align: left; border-radius: 16px; background: rgba(255, 255, 255, .04); border: 1px solid var(--line); padding: 4px; }
.rc { display: grid; grid-template-columns: 1fr auto; gap: 1px 10px; padding: 10px 10px; }
.rc + .rc { border-top: 1px solid rgba(255, 255, 255, .06); }
.rc .ans { font-weight: 900; letter-spacing: .06em; }
.rc .amt { font-weight: 900; font-variant-numeric: tabular-nums; }
.rc .cat { grid-column: 1 / span 2; font-size: .7rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.rc .txt { grid-column: 1 / span 2; font-family: var(--serif); font-size: .92rem; color: #cfd4f5; }
.rc.ok .amt { color: var(--good); } .rc.bad .amt { color: var(--bad); } .rc.nil .amt { color: var(--muted); }
.rc.bad .ans { color: #ff9aa6; } .rc.nil .ans { color: #aab1d8; }
.confetti { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 1; }
.confetti i { position: absolute; top: -20px; width: 9px; height: 14px; border-radius: 2px; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(110vh) rotate(720deg); } }

/* short phones: tighten the clue card and keys so the board keeps its room */
@media (max-height: 640px) {
  #clueCard { height: 6.3rem; padding: 6px 12px 6px; }
  .key { height: 40px; }
  .bar { padding: 2px 8px 2px; }
  #kb { gap: 5px; }
  .score { font-size: 1.45rem; }
}
@media (min-height: 800px) {
  .key { height: 48px; }
  #clueCard { height: 8.4rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01s !important; animation-delay: 0s !important; transition-duration: .01s !important; }
}

/* ================= names and leaderboards ================= */
.home-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 4px; }
.home-row .ghost { min-height: 48px; font-size: .98rem; }
.name-input { display: block; width: 100%; height: 56px; margin: 0 0 14px; padding: 0 16px; border-radius: 14px; border: 1px solid rgba(255, 255, 255, .3); background: rgba(0, 0, 0, .3); color: #fff; font: 800 1.3rem var(--sans); text-align: center; }
.name-input:focus { outline: 2px solid var(--gold); outline-offset: 1px; }
.tabs { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; padding: 4px; margin-bottom: 10px; border-radius: 14px; background: rgba(0, 0, 0, .28); }
.tabs button { padding: 10px 4px; border-radius: 10px; font-weight: 800; font-size: .9rem; color: var(--muted); }
.tabs button.on { color: #2a1800; background: linear-gradient(180deg, #ffe08a, var(--gold2)); }
.tabs.small button { padding: 7px 4px; font-size: .78rem; }
.tabs.small button.on { color: #fff; background: rgba(255, 255, 255, .16); }
.lb-row { display: grid; grid-template-columns: 30px 1fr auto; gap: 0 8px; align-items: center; padding: 9px 10px; border-radius: 10px; }
.lb-row + .lb-row { border-top: 1px solid rgba(255, 255, 255, .06); }
.lb-row.me { background: rgba(255, 209, 102, .12); box-shadow: inset 0 0 0 1px rgba(255, 209, 102, .35); border-top-color: transparent; }
.lb-row .rk { font-weight: 900; color: var(--muted); text-align: center; }
.lb-row:nth-child(1) .rk { color: var(--gold); } .lb-row:nth-child(2) .rk { color: #d8def5; } .lb-row:nth-child(3) .rk { color: #e0a070; }
.lb-row .nm { font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lb-row .sc { font-weight: 900; color: var(--gold); font-variant-numeric: tabular-nums; }
.lb-row .sc.neg { color: var(--bad); }
.lb-row .sub { grid-column: 2 / span 2; font-size: .72rem; color: var(--muted); }
.lb-note { padding: 16px 12px; text-align: center; color: var(--muted); font-size: .92rem; }
.lb-note .primary { margin-top: 12px; min-height: 46px; font-size: 1rem; }
