:root {
  color-scheme: dark;
  --ink: #e7eef8;
  --muted: #91a4ba;
  --panel: rgba(13, 27, 45, .92);
  --line: #263c55;
  --accent: #22c55e;
  --accent-2: #38bdf8;
  --cell: clamp(28px, 6.6vw, 48px);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 15% 0%, rgba(14, 165, 233, .16), transparent 34rem),
    radial-gradient(circle at 100% 30%, rgba(34, 197, 94, .12), transparent 30rem),
    #06101d;
}
button, select, input { font: inherit; }
button, select { color: inherit; }
.shell { width: min(1160px, 100%); margin: auto; padding: 24px clamp(14px, 3vw, 34px) 30px; }
.hero { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.eyebrow { margin: 0 0 7px; color: #70e59a; font: 700 11px/1.2 ui-monospace, monospace; letter-spacing: .14em; }
h1 { margin: 0; font: 800 clamp(25px, 4vw, 42px)/1.05 Georgia, serif; }
.lead { max-width: 680px; margin: 10px 0 0; color: var(--muted); font-size: 14px; line-height: 1.55; }
.hero-mark { width: 82px; height: 82px; display: grid; place-items: center; border-radius: 23px; flex: 0 0 auto; color: #052e16; background: linear-gradient(145deg, #86efac, #22c55e); font-weight: 950; letter-spacing: -.08em; font-size: 29px; transform: rotate(3deg); box-shadow: 0 18px 50px rgba(34,197,94,.22); }

.toolbar { display: grid; grid-template-columns: minmax(180px, 1.5fr) repeat(3, minmax(90px, .55fr)); gap: 10px; margin: 22px 0 16px; }
.theme-picker, .stat { min-height: 60px; padding: 9px 13px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); }
.theme-picker { display: flex; flex-direction: column; color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .08em; }
.theme-picker select { width: 100%; margin-top: 4px; padding: 0; border: 0; outline: 0; background: transparent; color: var(--ink); font-size: 14px; font-weight: 750; text-transform: none; letter-spacing: 0; }
.theme-picker option { color: #07111f; }
.stat { display: flex; flex-direction: column; justify-content: center; }
.stat span { color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .08em; }
.stat strong { margin-top: 2px; font: 800 16px/1.2 ui-monospace, monospace; }

.game-layout { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(260px, .65fr); gap: 16px; align-items: start; }
.board-panel, .clues { min-width: 0; padding: clamp(12px, 2vw, 20px); border: 1px solid var(--line); border-radius: 18px; background: var(--panel); box-shadow: 0 22px 65px rgba(0,0,0,.22); }
.board-panel { overflow: hidden; }
.board { width: 100%; display: grid; grid-template-columns: repeat(var(--cols), var(--cell)); grid-template-rows: repeat(var(--rows), var(--cell)); justify-content: safe center; gap: 2px; overflow-x: auto; overflow-y: hidden; overscroll-behavior-inline: contain; padding: 6px; }
.cell { position: relative; width: var(--cell); height: var(--cell); background: #f8fafc; border-radius: 4px; overflow: hidden; }
.cell.blocked { visibility: hidden; }
.cell.active-word { background: #dff5ff; }
.cell.active-cell { outline: 3px solid var(--accent-2); outline-offset: -3px; z-index: 2; }
.cell.wrong { background: #fee2e2; }
.cell.correct { background: #dcfce7; }
.cell.hinted::after { content: ""; position: absolute; right: 3px; bottom: 3px; width: 5px; height: 5px; border-radius: 50%; background: #f59e0b; pointer-events: none; }
/* The clue number used to be a fixed 8px while the cell scales up to 48px, so on
   a desktop screen it rendered at 16.7% of the cell and was barely readable.
   Tying it to --cell keeps it proportionate at every size; the max() floor stops
   it collapsing on the smallest phones. */
.cell-number { position: absolute; z-index: 2; top: 1px; left: 3px; color: #1e293b;
  font-family: ui-monospace, monospace; font-weight: 800; line-height: 1;
  font-size: max(9px, calc(var(--cell) * 0.27)); pointer-events: none; }
/* Top padding scales with the number above it, so the letter never collides with
   the clue number now that the number grows with the cell. */
.cell input { width: 100%; height: 100%; padding: max(4px, calc(var(--cell) * 0.16)) 0 0; border: 0; outline: 0; color: #0f172a; background: transparent; text-align: center; text-transform: uppercase; font-size: clamp(16px, 4vw, 25px); font-weight: 850; caret-color: transparent; }
.board-scroll-hint { display: none; margin: 5px 3px 0; color: #7890a8; font-size: 10px; }
.active-clue { min-height: 39px; margin: 13px 2px 0; color: #d7e4f2; font-size: 13px; line-height: 1.45; }
.active-clue strong { color: #7dd3fc; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
button { padding: 10px 13px; border: 1px solid #37516d; border-radius: 11px; background: #17283c; cursor: pointer; font-size: 12px; font-weight: 760; transition: transform .15s ease, background .15s ease; }
button:hover { transform: translateY(-1px); background: #20364f; }
button.primary { color: #052e16; border-color: #4ade80; background: #4ade80; }
button.primary:hover { background: #86efac; }
.clues { max-height: 610px; overflow: auto; }
.clue-group + .clue-group { margin-top: 18px; }
.clue-group h2 { margin: 0 0 8px; color: #7dd3fc; font: 800 15px/1.2 Georgia, serif; }
.clue-group ol { display: grid; gap: 5px; margin: 0; padding: 0; list-style: none; }
.clue-item { width: 100%; display: grid; grid-template-columns: 25px 1fr; gap: 5px; padding: 8px; border: 1px solid transparent; background: transparent; text-align: left; color: #bdd0e3; font-weight: 500; line-height: 1.35; }
.clue-item .num { color: #70e59a; font-weight: 850; }
.clue-item.selected { color: white; border-color: #245477; background: #102d45; }
.clue-item.solved { opacity: .56; text-decoration: line-through; }
.result { position: fixed; z-index: 20; inset: 0; display: grid; place-items: center; padding: 20px; background: rgba(3,9,16,.84); backdrop-filter: blur(8px); }
.result.hidden { display: none; }
.result-card { width: min(430px, 100%); padding: 30px; border: 1px solid #296341; border-radius: 24px; text-align: center; background: #0b1a2a; box-shadow: 0 30px 90px #000; }
.result-card h2 { margin: 5px 0; font: 800 25px/1.2 Georgia, serif; }
.result-card p:not(.eyebrow) { color: var(--muted); line-height: 1.55; }
.trophy { font-size: 48px; }
footer { padding: 20px 0 0; color: #637991; text-align: center; font-size: 10px; }

@media (max-width: 760px) {
  :root { --cell: clamp(27px, 8.5vw, 42px); }
  .shell { padding-top: 16px; }
  .hero-mark { width: 62px; height: 62px; border-radius: 17px; font-size: 22px; }
  .toolbar { grid-template-columns: 1fr 1fr 1fr; }
  .theme-picker { grid-column: 1 / -1; }
  .game-layout { grid-template-columns: 1fr; }
  .clues { max-height: none; }
  .board-scroll-hint { display: block; }
}
