/* Base, themes and the board. Layout of the desk is in desk.css, the title screen in title.css.
   Art slots: --art-desk, --art-board and --art-title are `none` until the painted plates are wired in. */
:root{
  color-scheme:dark;
  --bg:#0b1024;--bg2:#171234;--panel:rgba(20,24,52,.88);--panel-solid:#151936;--ink:#f7f3ea;--muted:#b4b8cd;
  --gold:#f3c86b;--gold2:#d99f35;--blue:#6fc8ff;--plum:#ba80ff;--line:rgba(231,225,255,.16);--cell:#f6f2e9;--cell-ink:#1c2031;
  --given:#121629;--selected:#f6cb67;--peer:#dce8fb;--same:#c9dcff;--danger:#b62e4c;--ok:#9fe4c0;--shadow:0 28px 70px rgba(0,0,0,.38);
  --art-desk:none;--art-board:none;--art-title:none;
  font-family:Inter,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",var(--sbg-font-fallback,sans-serif);
}
body[data-theme="paper"]{--bg:#30211c;--bg2:#5b3830;--panel:rgba(67,45,38,.92);--panel-solid:#4a3029;--ink:#fff7e8;--muted:#dbc8ba;--gold:#f4cf76;--blue:#9ab9c6;--plum:#c99189;--line:rgba(255,240,222,.2);--cell:#f6ead4;--cell-ink:#382f2a;--given:#2f2925;--selected:#f2bd62;--peer:#e9d7bd;--same:#dec9a6}
body[data-theme="ocean"]{--bg:#061c27;--bg2:#103c4a;--panel:rgba(9,45,58,.9);--panel-solid:#0c3443;--ink:#efffff;--muted:#a9ced4;--gold:#f1d77a;--blue:#68d8de;--plum:#75b7de;--line:rgba(181,240,243,.2);--cell:#e8f5f2;--cell-ink:#133039;--given:#14323a;--selected:#f0d66d;--peer:#cce8e7;--same:#b5dfe0}

*{box-sizing:border-box}
html{min-height:100%;background:var(--bg)}
body{min-height:100vh;margin:0;color:var(--ink);background:radial-gradient(circle at 10% 0%,rgba(93,71,170,.24),transparent 32rem),linear-gradient(135deg,var(--bg),var(--bg2));overflow-x:hidden}
button{font:inherit;color:inherit}
button:focus-visible,a:focus-visible,input:focus-visible,summary:focus-visible{outline:3px solid var(--gold);outline-offset:2px}
.ambient{position:fixed;border-radius:50%;filter:blur(90px);opacity:.18;pointer-events:none}
.ambient-a{width:420px;height:420px;background:#598fff;right:-130px;top:90px}
.ambient-b{width:360px;height:360px;background:#aa5df3;left:-140px;bottom:40px}
[hidden]{display:none!important}

/* ---- board ---- */
.board-wrap{position:relative;container-type:inline-size;width:min(100%,var(--board-max,620px));margin:0 auto}
.board{width:100%;border-radius:14px;overflow:hidden;box-shadow:0 16px 35px rgba(0,0,0,.28);background:#0b0d18;background-image:var(--art-board);background-size:cover}
.sudoku-board{display:grid;border:3px solid #0f1325}
.sudoku-cell,.kakuro-cell{position:relative;padding:0;aspect-ratio:1;border:0;background:var(--cell);color:var(--cell-ink);cursor:pointer;font-weight:650;font-variant-numeric:tabular-nums}
.sudoku-cell{border-right:1px solid rgba(21,25,43,.28);border-bottom:1px solid rgba(21,25,43,.28);font-size:clamp(1.05rem,7.4cqw,2.1rem)}
.sudoku-cell.given{font-weight:900;color:var(--given)}
.sudoku-cell.box-right{border-right:3px solid #1c2139}
.sudoku-cell.box-bottom{border-bottom:3px solid #1c2139}
.kakuro-board{display:grid;border:3px solid #101325}
.kakuro-cell,.kakuro-clue{border-right:1px solid rgba(18,22,36,.35);border-bottom:1px solid rgba(18,22,36,.35)}
.kakuro-cell{font-size:calc(var(--bw,100cqw) / var(--cols,9) * .56)}
.kakuro-clue{position:relative;aspect-ratio:1;background:#111624;color:#fff}
.kakuro-clue.has-clue::after{content:"";position:absolute;inset:0;background:linear-gradient(to top right,transparent 49%,rgba(255,255,255,.62) 50%,transparent 51%);pointer-events:none}
/* clue digits are never under 12 px, even on the 11 by 11 board on a phone (cells of 33 px) */
.clue-down,.clue-right{position:absolute;z-index:1;font-weight:850;line-height:1;font-size:max(12px,calc(var(--bw,100cqw) / var(--cols,9) * .3))}
.clue-down{left:9%;bottom:8%}
.clue-right{right:9%;top:8%}

/* selection and marks never rely on colour alone: selected = thick ring, same digit = dashed ring, wrong = hatching and a corner flag */
.peer,.run-peer{background:var(--peer)}
.same{background:var(--same);box-shadow:inset 0 0 0 3px rgba(40,70,140,.55)}
.selected{background:var(--selected)!important;box-shadow:inset 0 0 0 4px #5f410f}
.wrong{color:var(--danger);background-image:repeating-linear-gradient(135deg,rgba(182,46,76,.22) 0 5px,transparent 5px 10px)}
.wrong::before{content:"";position:absolute;top:0;right:0;border-style:solid;border-width:0 .9em .9em 0;border-color:transparent var(--danger) transparent transparent}
.kakuro-cell.wrong{background-color:#ffdce2}
.notes-grid{position:absolute;inset:7%;display:grid;grid-template-columns:repeat(3,1fr);grid-template-rows:repeat(3,1fr);font-size:clamp(.55rem,3cqw,.9rem);font-weight:800;color:#3f4f6e;line-height:1}
.kakuro-cell .notes-grid{font-size:calc(var(--bw,100cqw) / var(--cols,9) * .22)}
.notes-grid span{display:grid;place-items:center}

/* ---- Kakuro close-up (phones): the Zoom button swaps the whole board for 48 px cells that scroll inside the same frame ---- */
#zoomButton{display:none}
.board-wrap.is-zoomed .board-scroll{overflow:auto;aspect-ratio:var(--cols)/var(--rows);overscroll-behavior:contain;touch-action:pan-x pan-y;border-radius:14px;scrollbar-width:thin;scrollbar-color:rgba(243,200,107,.65) transparent}
.board-wrap.is-zoomed .kakuro-board{--zoom-cell:48px;--bw:calc(var(--cols) * var(--zoom-cell));width:calc(var(--bw) + 6px);max-width:none;aspect-ratio:auto;border-radius:0}

.pause-cover{position:absolute;inset:0;border-radius:14px;background:rgba(10,12,28,.95);backdrop-filter:blur(10px);display:grid;place-content:center;justify-items:center;text-align:center;z-index:8}
.pause-cover span{color:var(--gold);font-size:.72rem;letter-spacing:.16em;text-transform:uppercase;font-weight:900;padding:0 12px}
.pause-cover strong{font:700 2rem Georgia,serif;margin:8px 0 18px}
.pause-cover button{border:0;border-radius:12px;background:var(--gold);color:#171728;padding:12px 22px;font-weight:900;cursor:pointer;min-height:44px}

/* ---- buttons that belong to the desk ---- */
.tool-row{display:grid;grid-template-columns:repeat(auto-fit,minmax(46px,1fr));gap:7px}
/* game.js writes how many tools are showing: six fit one row, more go to two rows of four so no button is left alone on a row */
.tool-row[data-tools="7"],.tool-row[data-tools="8"]{grid-template-columns:repeat(4,1fr)}
.tool-row button{min-height:56px;border:1px solid var(--line);background:rgba(255,255,255,.04);border-radius:13px;padding:8px 4px;cursor:pointer}
.tool-row span,.tool-row small{display:block}
.tool-row span{font-size:1.2rem;height:22px}
.tool-row small{font-size:.66rem;color:var(--muted);font-weight:800;margin-top:3px}
.tool-row button[aria-pressed="true"]{background:rgba(243,200,107,.16);border-color:rgba(243,200,107,.55)}
.tool-row button[aria-pressed="true"] small{color:var(--gold)}
.tool-row button:disabled{opacity:.5}
.number-pad{display:grid;grid-template-columns:repeat(3,1fr);gap:7px;margin-top:12px}
.number-pad button{min-height:50px;border:1px solid rgba(243,200,107,.3);background:linear-gradient(160deg,rgba(255,255,255,.08),rgba(255,255,255,.02));border-radius:12px;font-size:1.3rem;font-weight:850;cursor:pointer}
.number-pad button:hover{border-color:var(--gold);background:rgba(243,200,107,.13)}
.number-pad button:active{transform:translateY(1px)}
.status-line{min-height:1.3em;margin:10px 0 0;text-align:center;font-size:.8rem;color:var(--muted)}
.status-line[data-tone="bad"]{color:#ff9bad}
.status-line[data-tone="good"]{color:var(--ok)}
.keyboard-tip{text-align:center;color:var(--muted);font-size:.7rem;margin:8px 0 0}

body.reduced-motion *,body.reduced-motion *::before,body.reduced-motion *::after{scroll-behavior:auto!important;animation:none!important;transition:none!important}
@media(prefers-reduced-motion:reduce){body:not([data-motion="full"]) *{scroll-behavior:auto!important;animation:none!important;transition:none!important}}
