/* Anagram Rush: a TV game-show studio. The studio is dark by default; the selector list matches the shared dark-theme specificity so these win. */
:root, :root:not([data-theme="light"]) {
  --studio: #0b1f4b; --studio-2: #132b63; --studio-3: #1c3a7e; --spot: rgb(255 255 255 / .10); --tile: #fff7e6; --tile-ink: #0b1f4b; --tile-edge: #d9c9a3; --gold: #facc15; --pink: #db2777; --ink: #f4f6ff; --ink-2: #aab4d6; --line: #2a4a8f;
  --bg: var(--studio); --surface: var(--studio-2); --surface-2: var(--studio-3); --ok: #34d399; --warn: var(--gold); --bad: #fb7185; --info: #60a5fa; --accent: var(--pink); --accent-ink: #fff;
  --font-display: "Archivo Black", "Archivo", Impact, sans-serif; --font-ui: "Archivo", "Inter", system-ui, sans-serif;
  color-scheme: dark;
}
:root[data-theme="light"] { --studio: #e8edfb; --studio-2: #f7f9ff; --studio-3: #dfe6fa; --spot: rgb(255 255 255 / .6); --ink: #0b1f4b; --ink-2: #4b5a86; --line: #b9c6ea; --tile: #ffffff; --tile-edge: #b9c6ea; }
:root[data-colorblind="1"] { --pink: #e69f00; --gold: #56b4e9; }
body { background-image: radial-gradient(ellipse 70% 45% at 50% 0%, var(--spot), transparent 70%); }
.screen { gap: 14px; max-width: 520px; margin-inline: auto; }
.topbar { display: flex; align-items: center; gap: 6px; min-height: 44px; }
.screen-title { font-size: 1.8rem; font-weight: 400; margin-left: 6px; text-transform: uppercase; }
.btn { font-weight: 700; } .cta { font-family: var(--font-display); font-size: 1.15rem; min-height: 54px; letter-spacing: .04em; text-transform: uppercase; }
.hero { text-align: center; padding-top: 8px; }
.marquee { display: flex; justify-content: center; flex-wrap: wrap; gap: 5px; max-width: 320px; margin: 0 auto; }
.marquee span { width: 34px; height: 40px; border-radius: 6px; background: var(--tile); color: var(--tile-ink); font-family: var(--font-display); font-size: 1.3rem; display: inline-flex; align-items: center; justify-content: center; box-shadow: 0 3px 0 var(--tile-edge), 0 6px 14px rgb(0 0 0 / .35); animation: tumble .7s var(--ease-spring) both; animation-delay: calc(var(--i) * 60ms); }
.marquee span.sp { width: 12px; background: transparent; box-shadow: none; }
@keyframes tumble { from { transform: translateY(-40px) rotate(-12deg); opacity: 0; } }
.tagline { color: var(--ink-2); margin-top: 10px; font-weight: 500; }
.modes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.mode { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 10px 12px; min-height: 68px; border-radius: 12px; background: var(--surface); color: var(--ink); text-align: left; box-shadow: var(--shadow-1); border: 2px solid transparent; }
.mode b { font-family: var(--font-display); font-size: 1.1rem; font-weight: 400; text-transform: uppercase; } .mode span { color: var(--ink-2); font-size: .8rem; line-height: 1.2; } .mode[aria-pressed="true"] { border-color: var(--pink); }
.seg-line { display: flex; background: var(--surface); border-radius: var(--r-pill); padding: 3px; box-shadow: var(--shadow-1); }
.seg-line button { flex: 1; height: 42px; border-radius: var(--r-pill); color: var(--ink-2); font-weight: 700; font-size: .95rem; } .seg-line button[aria-checked="true"] { background: var(--tile); color: var(--tile-ink); }
.opt-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; padding: 0 4px; font-weight: 500; } .opt-row small { display: block; color: var(--ink-2); font-size: .82rem; font-weight: 400; }
.home-actions { display: flex; gap: 8px; } .home-actions .cta { flex: 2; } .home-actions > .btn:not(.cta) { flex: 1; background: var(--surface); box-shadow: var(--shadow-1); }

/* Play */
.screen[data-screen="play"] { height: 100dvh; min-height: 0; overflow: hidden; gap: 6px; }
.hud-title { font-family: var(--font-display); font-size: clamp(.95rem, 4vw, 1.15rem); text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; } .hud-note { color: var(--ink-2); font-weight: 700; white-space: nowrap; }
.run-timer[urgent] { color: var(--bad); animation: pulse .8s infinite; border-radius: 6px; padding: 0 4px; }
.scoreline { display: flex; align-items: center; justify-content: center; gap: 12px; min-height: 44px; }
.points { font-family: var(--font-display); font-size: 2rem; line-height: 1; }
.combo { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; height: 32px; padding: 0 10px; border-radius: 16px; background: var(--surface-2); color: var(--ink-2); font-family: var(--font-display); font-size: 1rem; transition: transform var(--t-base) var(--ease-spring), background var(--t-base); }
.combo[data-level="2"] { background: var(--pink); color: #fff; } .combo[data-level="3"] { background: var(--pink); color: #fff; transform: scale(1.1); } .combo[data-level="4"] { background: var(--gold); color: #0b1f4b; transform: scale(1.2); } .combo[data-level="5"] { background: var(--gold); color: #0b1f4b; transform: scale(1.3); box-shadow: 0 0 18px var(--gold); }
.combo.anim-bounce { animation: bounce .6s var(--ease-out); }
.ghost-mark { font-size: .85rem; color: var(--ink-2); font-weight: 700; }
.clock-wrap { position: relative; flex: 1 1 auto; min-height: 0; display: flex; align-items: center; justify-content: center; }
.clock { height: min(100%, 36vh, 220px); aspect-ratio: 1; }
.clock-bg { fill: var(--surface); stroke: var(--line); stroke-width: 2; }
.clock-arc { fill: none; stroke: var(--gold); stroke-width: 6; stroke-linecap: round; transform: rotate(-90deg); transform-origin: 50% 50%; stroke-dasharray: 276.5; stroke-dashoffset: 0; transition: stroke .3s; }
.clock[data-urgent="true"] .clock-arc { stroke: var(--bad); } .clock[data-zen="true"] { visibility: hidden; }
.clock-hand { stroke: var(--ink); stroke-width: 2.5; stroke-linecap: round; transform-origin: 50% 50%; } .clock-pin { fill: var(--pink); }
.clock-msg { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-family: var(--font-display); font-size: clamp(1.1rem, 5vw, 1.5rem); color: var(--gold); text-align: center; pointer-events: none; text-shadow: 0 2px 8px rgb(0 0 0 / .5); }
.clock-msg[data-tone="bad"] { color: var(--bad); }
.slots, .tray { display: flex; justify-content: center; gap: 6px; --n: 5; --t: min(52px, calc((100cqw - 6px * (var(--n) - 1)) / var(--n))); }
.slots { padding: 8px 0; } .tray { padding: 4px 0 8px; min-height: calc(var(--t) + 12px); }
.slot, .letter { width: var(--t); height: calc(var(--t) * 1.12); border-radius: 8px; font-family: var(--font-display); font-size: calc(var(--t) * .55); text-transform: uppercase; display: inline-flex; align-items: center; justify-content: center; }
.slot { background: transparent; border: 2px dashed var(--line); color: var(--tile-ink); }
.slot[data-filled="true"] { background: var(--tile); border: 0; box-shadow: 0 3px 0 var(--tile-edge), 0 6px 14px rgb(0 0 0 / .35); animation: pop var(--t-fast) var(--ease-spring); }
.slot[data-locked="true"] { background: var(--gold); box-shadow: 0 3px 0 #b8940a; }
.slots[data-state="correct"] .slot { background: var(--ok); color: #05301f; box-shadow: 0 3px 0 #1c7a52; animation: pop var(--t-slow) var(--ease-spring); animation-delay: calc(var(--i) * 40ms); }
.slots[data-state="wrong"] .slot { border-color: var(--bad); animation: shake-x var(--t-slow); }
.letter { background: var(--tile); color: var(--tile-ink); box-shadow: 0 3px 0 var(--tile-edge), 0 6px 14px rgb(0 0 0 / .35); transition: transform var(--t-fast), opacity var(--t-fast); animation: tumble .5s var(--ease-spring) both; animation-delay: calc(var(--i) * 50ms); }
.letter:active { transform: scale(.94); } .letter[data-placed="true"] { opacity: .18; box-shadow: none; transform: scale(.9); pointer-events: none; }
.tools { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; padding-bottom: env(safe-area-inset-bottom); }
.tool { flex-direction: column; gap: 2px; height: 56px; border-radius: 10px; background: var(--surface); font-size: .78rem; box-shadow: var(--shadow-1); } .tool .icon { width: 20px; height: 20px; } .tool:disabled { opacity: .4; }
@media (max-height: 640px) { .clock { height: min(100%, 30vh, 180px); } .tool { height: 50px; } }
@media (min-width: 640px) { .screen[data-screen="play"] { max-width: 600px; } }
.screen[data-screen="play"] { container-type: inline-size; }

/* Result */
.result-verdict { font-family: var(--font-display); font-size: clamp(2rem, 9vw, 2.8rem); text-align: center; line-height: 1.05; text-transform: uppercase; }
.result-sub { text-align: center; color: var(--ink-2); font-weight: 500; }
.solved-list summary { cursor: pointer; font-weight: 700; color: var(--ink-2); margin: 4px 0 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; } .chips span { padding: 5px 10px; border-radius: 8px; background: var(--surface-2); font-weight: 700; text-transform: uppercase; font-size: .85rem; }
.result-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 6px; } .result-actions .cta { grid-column: 1 / -1; }
