/* Digi Puzzles — sweep engine. One copy serves every sweep page in reports/.
   Extracted 2026-10-15 from 2027-08-16-logic-sweep.html by tools/engine-shells.js.
   The page supplies its puzzle as window.DN_PUZZLE before loading this file.
   Edit here to change every sweep; keep element ids and localStorage keys
   stable (dn-track.js and players' saved progress depend on them). */
/* shared sheets first, so dark mode and the finish sheet are right from the first paint (18 Oct 2026) */
@import url("finish.css");
@import url("house.css");

/* ---------- Digi Puzzles house style (shared chrome, unchanged) ---------- */
:root{
  --paper:#EDEEF2; --card:#FFFFFF; --ink:#141726; --ink-soft:#5A5F73;
  --line:#141726; --brand:#2E5BFF; --brand-deep:#1B3B9E;
  --active:#FFD54A; --active-word:#FFF0B8; --good:#1F9E6B; --bad:#E4483B;
  --block:#141726; --radius:14px;
  --mono:"Space Mono",ui-monospace,Menlo,Consolas,monospace;
  --sans:"Space Grotesk",system-ui,-apple-system,Segoe UI,Roboto,sans-serif;
}
*{box-sizing:border-box}
html,body{margin:0}
body{background:var(--paper);color:var(--ink);font-family:var(--sans);
  line-height:1.45;-webkit-font-smoothing:antialiased;padding:18px;display:flex;justify-content:center}
.app{width:100%;max-width:560px}
header{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:12px;border-bottom:2px solid var(--ink);padding-bottom:11px}
.masthead{display:flex;align-items:center;gap:10px}
.mono-mark{flex:0 0 auto;width:32px;height:32px;border-radius:7px;background:var(--brand);color:#fff;
  font-family:var(--mono);font-weight:700;font-size:13px;letter-spacing:.04em;
  display:flex;align-items:center;justify-content:center;
  box-shadow:inset 0 0 0 1.5px rgba(255,255,255,.18),0 1.5px 0 var(--brand-deep)}
.mh-text{display:flex;flex-direction:column;line-height:1.05}
.mh-name{font-family:var(--sans);font-size:20px;font-weight:700;letter-spacing:-.01em;color:var(--ink)}
.mh-name .accent{color:var(--brand)}
.mh-eyebrow{font-family:var(--mono);font-size:9.5px;letter-spacing:.18em;text-transform:uppercase;color:var(--ink-soft);margin-top:2px}
.streakbox{font-family:var(--mono);font-size:13px;color:var(--ink-soft);background:var(--card);border:1.5px solid var(--ink);border-radius:999px;padding:4px 12px}
.streakbox b{color:var(--ink)}
.meta{font-family:var(--mono);font-size:12px;color:var(--ink-soft);letter-spacing:.06em;margin-bottom:14px;display:flex;gap:10px;align-items:center}
.tag{background:var(--brand);color:#fff;border-radius:5px;padding:1px 7px;text-transform:uppercase;font-weight:700;font-size:11px}
#timer{margin-left:auto;color:var(--ink);font-weight:700}
#rank{font-size:11px;letter-spacing:.12em;text-transform:uppercase;color:var(--bad);font-weight:700}
main{position:relative;display:flex;flex-direction:column;align-items:center;gap:14px}
/* ---------- grid (shared geometry, Sweep cell states) ---------- */
.grid{--n:6;display:grid;grid-template-columns:repeat(6,1fr);grid-template-rows:repeat(6,1fr);gap:0;width:min(100%,336px);aspect-ratio:1;
  border:3px solid var(--line);background:var(--line);border-radius:10px;overflow:hidden}
.cell{position:relative;min-width:0;min-height:0;background:var(--card);border:1px solid #cfd3dc;display:flex;align-items:center;justify-content:center;
  cursor:pointer;user-select:none;-webkit-user-select:none;-webkit-tap-highlight-color:transparent;transition:background .12s;touch-action:none}
/* hidden cell: the one raised surface in the house — it asks to be pressed */
.cell.hid{background:#DDE1EA;box-shadow:inset 0 0 0 1.5px rgba(255,255,255,.75),inset 0 -3px 0 rgba(20,23,38,.10)}
.cell.hid:hover{background:#E7EAF1}
.cell.hid:active{box-shadow:inset 0 0 0 1.5px rgba(255,255,255,.4)}
/* locked: every cell but the start, before the player has dug it. Visibly
   inert — dimmed and not-allowed — so the one live cell reads as the only
   live cell, not just by luck of a brighter dot. */
.cell.hid.locked{background:#CBD0DC;cursor:not-allowed}
.cell.hid.locked:hover{background:#CBD0DC}
.cell.hid.locked:active{box-shadow:none}
.cell.open{background:var(--card);cursor:default}
.cell .val{font-family:var(--mono);font-weight:700;font-size:min(5.6vw,22px);line-height:1}
.cell .val[data-n="1"]{color:var(--brand)}
.cell .val[data-n="2"]{color:var(--good)}
.cell .val[data-n="3"]{color:var(--bad)}
.cell .val[data-n="4"]{color:var(--brand-deep)}
.cell .val[data-n="5"]{color:#9A6B00}
.cell.flag{background:var(--active)}
.cell.boom{background:var(--bad)}
/* the house flag: the masthead's cobalt tile, planted on a pole. Same lift
   (a brand-deep edge below) and same inner white hairline as .mono-mark. */
.cell .glyph{width:min(5.4vw,22px);height:min(5.4vw,22px);display:block}
/* a number touching more flags than it says is impossible — say so. The Doku
   greens a run that is right; Sweep reddens a number that cannot be. */
.cell .val.over{color:var(--bad);text-decoration:line-through;text-decoration-thickness:2px}
.cell.hint{animation:hintpulse 1.1s ease 2}
/* the numbers Hint's line talks about (19 Oct 2026), ringed until your next move */
.cell.why{outline:3px solid var(--why,var(--brand));outline-offset:-3px}
@media (prefers-color-scheme:dark){html.dn-house:not([data-theme="light"]) .cell.why{--why:var(--brand-deep)}}
html.dn-house[data-theme="dark"] .cell.why{--why:var(--brand-deep)}
@keyframes hintpulse{0%,100%{background:#DDE1EA}50%{background:var(--active)}}
/* the start cell: proven safe, and the only live cell until it's dug. Pulses
   continuously — not a decoration to notice once, an affordance to act on. */
.cell.start.hid{animation:startpulse 1.4s ease-in-out infinite;cursor:pointer}
@keyframes startpulse{0%,100%{background:#DDE1EA}50%{background:var(--active)}}
/* ---------- the mode bar (Sweep's cluebox seam) ---------- */
.modebox{display:flex;align-items:stretch;gap:8px;width:min(100%,340px)}
.modebtn{flex:1;font-family:var(--sans);font-size:15px;font-weight:700;min-height:48px;
  border:1.5px solid var(--ink);background:var(--card);color:var(--ink);border-radius:10px;cursor:pointer;display:flex;align-items:center;justify-content:center;gap:8px}
.modebtn.on{background:var(--brand);color:#fff;border-color:var(--brand)}
.modebtn.on.flagmode{background:var(--active);color:var(--ink);border-color:var(--ink)}
.counter{flex:0 0 auto;min-width:74px;font-family:var(--mono);font-weight:700;font-size:15px;
  border:1.5px solid var(--ink);background:var(--card);border-radius:10px;display:flex;align-items:center;justify-content:center;gap:5px}
.counter b{color:var(--bad)}
.counter b.neg{background:var(--bad);color:#fff;border-radius:4px;padding:0 5px}
/* ---------- controls ---------- */
.msg{min-height:22px;margin:14px 0 6px;font-size:15px;color:var(--brand-deep)}
.controls{display:flex;flex-wrap:wrap;gap:8px;align-items:center;margin-bottom:14px}
button,select{font-family:var(--sans);font-size:13px;font-weight:500;border:1.5px solid var(--ink);background:var(--card);color:var(--ink);border-radius:9px;padding:8px 12px;cursor:pointer}
button:hover{background:#e3e6ee}
button.primary{background:var(--brand);color:#fff;border-color:var(--brand)}
button.primary:hover{background:var(--brand-deep)}
.spacer{flex:1}
:focus-visible{outline:3px solid var(--brand);outline-offset:2px}
.rules{width:min(100%,340px);font-size:13.5px;color:var(--ink-soft);border-top:1.5px solid #d5d9e2;padding-top:10px}
.rules b{color:var(--ink)}
/* ---------- win celebration (shared, unchanged) ---------- */
.grid.celebrate .cell{animation:cellwin .6s ease both}
@keyframes cellwin{0%{transform:scale(1)}35%{transform:scale(1.14);background:var(--active)}70%{background:var(--active-word)}100%{transform:scale(1)}}
.confetti{position:fixed;inset:0;width:100%;height:100%;pointer-events:none;z-index:60;display:none}
.confetti.on{display:block}
.modal{position:fixed;inset:0;z-index:70;display:none;align-items:center;justify-content:center;padding:20px;
  background:rgba(20,23,38,.42);-webkit-backdrop-filter:blur(2px);backdrop-filter:blur(2px)}
.modal.on{display:flex}
.modalcard{width:100%;max-width:340px;background:var(--card);border:2px solid var(--ink);border-radius:16px;
  padding:22px 20px 18px;text-align:center;box-shadow:0 10px 0 var(--brand-deep),0 26px 44px rgba(20,23,38,.30);
  animation:rise .48s cubic-bezier(.2,.9,.25,1.12)}
@keyframes rise{from{transform:translateY(22px) scale(.94);opacity:0}to{transform:none;opacity:1}}
.modalcard .check.miss{background:var(--bad)}
.modalcard .check{width:52px;height:52px;margin:0 auto 10px;border-radius:50%;background:var(--good);color:#fff;
  font-size:28px;font-weight:700;display:flex;align-items:center;justify-content:center}
.modalcard h2{margin:0 0 2px;font-size:24px;letter-spacing:-.01em}
.modalcard .sub{font-family:var(--mono);font-size:11px;letter-spacing:.1em;text-transform:uppercase;color:var(--ink-soft);margin-bottom:14px}
.statrow{display:flex;gap:8px;margin-bottom:16px}
.stat{flex:1;border:1.5px solid #d5d9e2;border-radius:10px;padding:8px 4px}
.stat b{display:block;font-family:var(--mono);font-size:21px;color:var(--ink);line-height:1.15}
.stat span{font-family:var(--mono);font-size:9px;letter-spacing:.14em;text-transform:uppercase;color:var(--ink-soft)}
.modalbtns{display:flex;gap:8px}
.modalbtns button{flex:1;margin:0}
@media(prefers-reduced-motion:reduce){.grid.celebrate .cell{animation:none}.modalcard{animation:none}.cell.hint{animation:none;outline:3px solid var(--active);outline-offset:-3px}.cell.flag.hint{outline-color:#141726}.cell.start.hid{animation:none;outline:3px solid var(--active);outline-offset:-3px}}
footer{font-family:var(--mono);font-size:11px;color:var(--ink-soft);letter-spacing:.05em;margin-top:6px;text-align:center}
.gridwrap{display:contents}
/* ---------- APP MODE — no keyboard to fit, so the board takes the room ---------- */
html.app-mode,html.app-mode body{height:100%;overflow:hidden;overscroll-behavior:none}
html.app-mode body{padding:0;display:block}
html.app-mode .app{
  height:100vh;height:100dvh;height:100svh;height:var(--dn-vh,100svh);
  max-width:520px;margin:0 auto;
  display:flex;flex-direction:column;
  padding:calc(6px + var(--dn-top,env(safe-area-inset-top,0px))) 12px calc(8px + var(--dn-bot,env(safe-area-inset-bottom,0px)));
}
html.app-mode header{margin-bottom:8px;padding-bottom:8px}
html.app-mode .mono-mark{width:28px;height:28px;font-size:12px}
html.app-mode .mh-name{font-size:17px}
html.app-mode .streakbox{font-size:12px;padding:3px 10px}
html.app-mode .meta{margin-bottom:8px;font-size:11px}
html.app-mode main{flex:1 1 auto;min-height:0;width:100%;gap:10px;justify-content:flex-start}
html.app-mode .gridwrap{order:1;display:flex;flex:1 1 auto;min-height:0;width:100%;align-items:center;justify-content:center}
html.app-mode .grid{width:var(--side,320px);height:var(--side,320px);max-width:100%}
html.app-mode .cell .val{font-size:calc(var(--cell,60px)*.44)}
html.app-mode .cell .glyph{width:calc(var(--cell,60px)*.44);height:calc(var(--cell,60px)*.44)}
html.app-mode .modebox{order:2;width:100%;max-width:none;flex:0 0 auto}
html.app-mode .rules,html.app-mode footer{display:none}
html.app-mode .msg{order:4;min-height:0;margin:4px 0 0;font-size:12px;line-height:1.4;text-align:center;text-wrap:pretty}
html.app-mode .controls{order:5;flex-wrap:nowrap;overflow-x:auto;gap:6px;margin:6px 0 0;padding:1px 0;
  -webkit-overflow-scrolling:touch;scrollbar-width:none}
html.app-mode .controls::-webkit-scrollbar{display:none}
html.app-mode .controls button,html.app-mode .controls select{flex:0 0 auto;padding:6px 10px;font-size:12px;white-space:nowrap}
html.app-mode .controls .spacer{display:none}
@media (max-height:660px){
  html.app-mode header{margin-bottom:5px;padding-bottom:5px}
  html.app-mode .mh-eyebrow{display:none}
  html.app-mode .meta{margin-bottom:5px}
  html.app-mode .modebtn{min-height:44px}
}

/* 15 Oct 2026 — trimmed controls (Alec): one daily puzzle, nothing extra.
   Hidden rather than deleted: the engine binds to these ids, and the markup
   lives in each puzzle page, so the elements stay in the HTML but never show.
   The footer was a build note ("SHELL vN · … code, not eye") meant for us, not players.
   Gone: Reveal all (giving up), Restart, and the Flag check toggle (it stays on). */
#revealAll,#reset,#flagCheck,footer{display:none!important}

/* Landscape: reserve one full-height column for the six-by-six board. */
@media (pointer:coarse) and (hover:none) and (orientation:landscape) and (max-height:500px){
  html.app-mode .app{max-width:900px;padding-left:max(12px,env(safe-area-inset-left,0px));padding-right:max(12px,env(safe-area-inset-right,0px));display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);
    grid-template-rows:auto minmax(0,1fr) auto auto;gap:6px 16px;
    grid-template-areas:"bar bar" "board modes" "board message" "board tools"}
  html.app-mode .dn-bar{grid-area:bar;margin:0}
  html.app-mode main{display:contents}
  html.app-mode .gridwrap{grid-area:board;height:100%}
  html.app-mode .modebox{grid-area:modes;align-self:center}
  html.app-mode .msg{grid-area:message;margin:0}
  html.app-mode .controls{grid-area:tools;margin:0;flex-wrap:wrap}
}
