/* Suloku web app. ©2026 Dr. Ravi E. Dattatreya [2026-11-04 11:30 EST]. Coded with Claude Code.
   Fonts: Libre Franklin and Fraunces, both under the SIL Open Font License. */
@font-face { font-family: "Franklin"; src: url(fonts/librefranklin.woff2) format("woff2");
  font-weight: 400 800; font-display: swap; }
@font-face { font-family: "Fraunces"; src: url(fonts/fraunces.woff2) format("woff2");
  font-weight: 600 800; font-display: swap; }

:root {
  --bg: #ffffff; --ink: #121212; --muted: #5c5c5c; --faint: #8b8b8b;
  --rule: #dcdcdc; --panel: #f4f4f2; --splash: #e8f1f8;
  --cell: #ffffff; --grid: #cfcfcf; --frame: #121212;
  --clue: #ffffff; --chip: #1d3557; --mine: #2b5fd9; --sel: #ffe27a; --dot: #f08a24; --run: #fdf8e6;
  --bad: #d6342c; --good: #2f9a5b; --block: #e9e9e9; --block-stripe: #bdbdbd;
  --path: rgba(43, 95, 217, 0.28); --closing: #d6342c;
  --pill: #121212; --on-pill: #ffffff; --shadow: 0 8px 32px rgba(0, 0, 0, 0.16);
  --display: "Fraunces", Georgia, "Times New Roman", serif;
  --text: "Franklin", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121213; --ink: #f2f2f2; --muted: #a8a8a8; --faint: #7a7a7a;
    --rule: #333336; --panel: #1e1e20; --splash: #18212a;
    --cell: #1a1a1c; --grid: #3a3a3d; --frame: #8a8a8e;
    --clue: #ffffff; --chip: #4a6fb5; --mine: #7fa6ff; --sel: #6a5a17; --dot: #f39b3d; --run: #2a2617;
    --bad: #ff6a60; --good: #57c987; --block: #2a2a2a; --block-stripe: #555555;
    --path: rgba(127, 166, 255, 0.32); --closing: #ff6a60;
    --pill: #f2f2f2; --on-pill: #121213; --shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #121213; --ink: #f2f2f2; --muted: #a8a8a8; --faint: #7a7a7a;
  --rule: #333336; --panel: #1e1e20; --splash: #18212a;
  --cell: #1a1a1c; --grid: #3a3a3d; --frame: #8a8a8e;
  --clue: #ffffff; --chip: #4a6fb5; --mine: #7fa6ff; --sel: #6a5a17; --dot: #f39b3d; --run: #2a2617;
  --bad: #ff6a60; --good: #57c987; --block: #2a2a2a; --block-stripe: #555555;
  --path: rgba(127, 166, 255, 0.32); --closing: #ff6a60;
  --pill: #f2f2f2; --on-pill: #121213; --shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
/* manipulation keeps scrolling and pinch-zoom but turns off Safari's
   double-tap zoom, which fired when a player tapped quickly twice. */
html { background: var(--bg); touch-action: manipulation; -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100svh; background: var(--bg); color: var(--ink);
  font: 16px/1.45 var(--text); -webkit-font-smoothing: antialiased;
  padding: 0 env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
button:focus-visible, input:focus-visible { outline: 2px solid var(--mine); outline-offset: 2px; }
[hidden] { display: none !important; }
svg use, svg path, svg circle { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
svg .fill { fill: currentColor; stroke: none; }

/* ------------------------------------------------------------ the top bar */
.appbar { position: sticky; top: 0; z-index: 5; display: grid; grid-template-columns: 120px 1fr 120px;
  align-items: center; height: calc(52px + env(safe-area-inset-top)); padding: env(safe-area-inset-top) 6px 0;
  background: var(--bg); border-bottom: 1px solid var(--rule); }
.appbar .actions { display: flex; justify-content: flex-end; }
.brand { justify-self: center; font: 700 24px/1 var(--display); letter-spacing: 0.01em; padding: 6px 10px; }
.icon { width: 40px; height: 44px; display: inline-grid; place-items: center; border-radius: 50%; }
.icon svg { width: 24px; height: 24px; }
.icon:hover { background: var(--panel); }
#nav-back { justify-self: start; }

.screen { animation: fade 0.25s ease; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.wrap { max-width: 560px; margin: 0 auto; padding: 16px 16px 32px; }

/* ------------------------------------------------------------ pills */
.pill { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-width: 150px;
  height: 48px; padding: 0 24px; border-radius: 999px; border: 1.5px solid var(--pill);
  font-weight: 600; font-size: 16px; letter-spacing: 0.01em; transition: transform 0.08s; }
.pill:active { transform: scale(0.97); }
.pill.primary { background: var(--pill); color: var(--on-pill); }
.pill.small { min-width: 0; height: 36px; padding: 0 18px; font-size: 15px; }
.pill.wide { width: 100%; }
.pill svg { width: 20px; height: 20px; }

/* ------------------------------------------------------------ the splash */
.splash { min-height: 100svh; display: grid; place-items: center; background: var(--splash);
  padding: calc(24px + env(safe-area-inset-top)) 16px 32px; text-align: center; }
.splash-inner { max-width: 420px; }
.splash-tile { width: 84px; height: 84px; }
.wordmark { font: 700 clamp(40px, 11vw, 54px)/1.05 var(--display); margin: 14px 0 8px; letter-spacing: 0.005em; }
.tagline { font: 500 clamp(20px, 5.4vw, 26px)/1.25 var(--display); margin: 0 auto 28px; max-width: 18em; }
.splash-buttons { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-bottom: 28px; }
.splash-buttons .pill { width: 210px; }
.sp-date { font-weight: 700; margin: 0 0 2px; }
.sp-no, .sp-by { margin: 0; color: var(--muted); font-size: 15px; }
.sp-by { margin-top: 2px; }
.a2hs { position: relative; margin: 26px auto 0; max-width: 340px; padding: 14px 18px 12px; text-align: left;
  background: var(--panel); border: 1px solid var(--rule); border-radius: 14px; font-size: 15px; }
.a2hs-title { margin: 0 28px 6px 0; font-weight: 700; }
.a2hs ol { margin: 0; padding-left: 20px; }
.a2hs li { margin: 3px 0; }
.a2hs-share { display: inline-grid; place-items: center; vertical-align: -4px; }
.a2hs-share svg { width: 18px; height: 18px; color: var(--mine); }
.a2hs-note { margin: 8px 0 0; color: var(--muted); font-size: 14px; }
.a2hs-x { position: absolute; top: 2px; right: 2px; width: 36px; height: 36px; }
.a2hs-x svg { width: 18px; height: 18px; }

/* ------------------------------------------------------------ the library */
.kicker { font: 700 13px/1 var(--text); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted);
  margin: 18px 0 10px; }
.today { width: 100%; display: grid; grid-template-columns: 64px 1fr auto; gap: 14px; align-items: center;
  text-align: left; padding: 14px; border: 1px solid var(--rule); border-radius: 14px; }
.today:hover { background: var(--panel); }
.today img { width: 64px; height: 64px; }
.today-name { display: block; font: 700 20px/1.2 var(--display); }
.today-meta { display: block; color: var(--muted); font-size: 14px; margin-top: 2px; }

.animals { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.animal { display: grid; grid-template-columns: 44px 1fr; gap: 10px; align-items: center; text-align: left;
  padding: 10px; border: 1.5px solid var(--rule); border-radius: 12px; }
.animal img { width: 44px; height: 44px; }
.animal b { display: block; font-size: 16px; }
.animal span { display: block; color: var(--muted); font-size: 12.5px; line-height: 1.3; }
.animal.on { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }

.setup { margin-top: 14px; padding: 14px; background: var(--panel); border-radius: 14px; }
.setup-rule { margin: 0 0 12px; font-size: 14.5px; }
.setup-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.setup-label { font-weight: 600; font-size: 15px; }
.seg { display: inline-flex; padding: 3px; gap: 2px; background: var(--bg); border: 1px solid var(--rule); border-radius: 999px; }
.seg button { padding: 7px 14px; border-radius: 999px; font-size: 14.5px; font-weight: 500; }
.seg button:disabled { opacity: .3; cursor: default; }
.seg button.on { background: var(--pill); color: var(--on-pill); font-weight: 600; }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px;
  font-size: 15px; margin: 4px 0 14px; cursor: pointer; }
.switch { appearance: none; -webkit-appearance: none; flex: none; width: 46px; height: 28px; border-radius: 999px;
  background: var(--grid); position: relative; cursor: pointer; transition: background 0.15s; margin: 0; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3); transition: transform 0.15s; }
.switch:checked { background: var(--good); }
.switch:checked::after { transform: translateX(18px); }
.foot { margin-top: 32px; padding-top: 16px; border-top: 1px solid var(--rule); color: var(--muted);
  font-size: 13px; text-align: center; }
.foot p { margin: 0 0 6px; }

/* ------------------------------------------------------------ the game */
.game-wrap { padding-top: 10px; }
.gamebar { display: grid; grid-template-columns: 40px 1fr auto; gap: 10px; align-items: center; }
.gamebar img { width: 40px; height: 40px; }
.game-name { font: 700 19px/1.15 var(--display); }
.game-meta { color: var(--muted); font-size: 13.5px; }
.clock { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 10px 0 12px;
  border-radius: 999px; background: var(--panel); font-variant-numeric: tabular-nums; font-weight: 600; }
.clock svg { width: 18px; height: 18px; }
.clock.off #clock-text { display: none; }
.rule { margin: 8px 0 0; font-size: 14px; color: var(--muted); }
.status { min-height: 26px; margin: 10px 0 8px; text-align: center; font-weight: 600; font-size: 15px; }
.status.good { color: var(--good); } .status.bad { color: var(--bad); }
.status .aim { display: inline-block; padding: 0 9px; border-radius: 999px; box-shadow: inset 0 0 0 2px var(--dot); }
.status .next { display: inline-block; padding: 2px 10px; border-radius: 999px; background: var(--sel); color: var(--ink); }

.board { --n: 8; position: relative; width: min(100%, 520px, calc(100svh - 330px)); min-width: 260px;
  aspect-ratio: 1; margin: 0 auto; container-type: inline-size; }
.grid { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(var(--n), 1fr);
  grid-template-rows: repeat(var(--n), 1fr);
  gap: 1px; background: var(--grid); border: 2px solid var(--frame); border-radius: 6px; overflow: hidden;
  touch-action: none; user-select: none; -webkit-user-select: none; }
.c { position: relative; display: grid; place-items: center; background: var(--cell); cursor: pointer;
  font-weight: 600; font-variant-numeric: tabular-nums; font-size: calc(100cqi / var(--n) * 0.4); }
/* A given number sits on a navy chip (his pick, 2026-11-12), so it stands
   apart from the blue numbers the player places. isolation keeps the chip
   behind the digit without lifting it above the cell's own background. */
.c.clue { color: var(--clue); font-weight: 800; isolation: isolate; }
.c.clue::before { content: ""; position: absolute; inset: 12%; z-index: -1;
  border-radius: calc(100cqi / var(--n) * 0.14); background: var(--chip); }
.c.mine { color: var(--mine); }
.c.end { background: var(--run); }
/* Striped, not solid dark: a dark square would read as a given number now. */
.c.blocked { background: repeating-linear-gradient(45deg, var(--block-stripe) 0 4px, var(--block) 4px 9px);
  cursor: default; }
.c.sel { background: var(--sel); }
/* The goal: the next number on the board that the current run must reach. */
.c.goal { box-shadow: inset 0 0 0 3px var(--dot); }
.c.bad { color: var(--bad); box-shadow: inset 0 0 0 2px var(--bad); }
.c.dot::after { content: ""; width: 28%; height: 28%; border-radius: 50%; background: var(--dot); opacity: 0.9; }
.c.pop { animation: pop 0.18s ease-out; }
@keyframes pop { 0% { transform: scale(0.6); } 70% { transform: scale(1.08); } 100% { transform: scale(1); } }
.c.wave { animation: wave 0.5s ease both; animation-delay: calc(var(--k) * 18ms); }
@keyframes wave { 0% { transform: scale(1); } 40% { transform: scale(0.82); background: var(--good); color: #fff; }
  100% { transform: scale(1); } }
svg.path { position: absolute; inset: 2px; width: calc(100% - 4px); height: calc(100% - 4px); pointer-events: none; z-index: 2; }
/* Above the path layer: the orange move dots, so a joint never hides one. */
.c.dot::after { position: relative; z-index: 3; }
.overlay { position: absolute; inset: 0; display: none; flex-direction: column; gap: 14px; align-items: center;
  justify-content: center; background: var(--bg); border: 2px solid var(--frame); border-radius: 6px;
  color: var(--muted); font-weight: 600; }
.overlay p { margin: 0; font: 700 26px/1 var(--display); color: var(--ink); }
.board.busy .making, .board.paused .paused { display: flex; }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--rule); border-top-color: var(--ink);
  animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.progress { width: min(100%, 520px); height: 4px; margin: 12px auto 0; border-radius: 4px; background: var(--rule); overflow: hidden; }
.progress-bar { height: 100%; width: 0; background: var(--mine); transition: width 0.25s; }
.gaps { margin: 6px auto 0; max-width: 520px; text-align: center; color: var(--muted); font-size: 13px; min-height: 19px; }
.tools { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; max-width: 520px; margin: 10px auto 0; }
.tools button { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 8px 0 6px;
  border-radius: 12px; font-size: 12.5px; font-weight: 600; color: var(--ink); }
.tools button:hover { background: var(--panel); }
.tools button:active { transform: scale(0.95); }
.tools svg { width: 26px; height: 26px; }
.won-bar { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; margin-top: 14px; }

/* ------------------------------------------------------------ dialogs */
dialog.sheet { width: min(520px, calc(100vw - 24px)); max-height: calc(100svh - 48px); overflow: auto;
  padding: 28px 24px 24px; border: 0; border-radius: 16px; background: var(--bg); color: var(--ink);
  box-shadow: var(--shadow); }
dialog.sheet[open] { animation: rise 0.22s ease-out; }
@keyframes rise { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
dialog:focus { outline: none; }
dialog::backdrop { background: rgba(0, 0, 0, 0.45); }
dialog h2 { font: 700 28px/1.1 var(--display); margin: 0 0 6px; }
dialog h3 { font-size: 13px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); margin: 22px 0 10px; }
.close { position: absolute; top: 10px; right: 10px; }
.lead { font: 500 19px/1.3 var(--display); margin: 0 0 12px; }
.how { padding-left: 20px; margin: 0; }
.how li { margin-bottom: 8px; }
.small { font-size: 14px; color: var(--muted); }
.help-animals { display: grid; grid-template-columns: repeat(7, minmax(0, 46px)); gap: 5px; }
.help-animals button { aspect-ratio: 1; border-radius: 12px; border: 2px solid transparent; padding: 1px; }
.help-animals button.on { border-color: var(--ink); }
.help-animals img { width: 100%; height: 100%; display: block; }
.help-card { margin-top: 10px; padding: 14px; background: var(--panel); border-radius: 12px; }
.help-name { font: 700 18px/1.2 var(--display); }
.help-rule { margin: 4px 0 12px; font-size: 14.5px; }
.diagrams { display: flex; gap: 12px; flex-wrap: wrap; }
.diagram { text-align: center; font-size: 12.5px; color: var(--muted); }
.mini { display: grid; grid-template-columns: repeat(7, 15px); gap: 1px; background: var(--grid);
  border: 1.5px solid var(--frame); margin-bottom: 4px; }
.mini i { width: 15px; height: 15px; background: var(--cell); display: grid; place-items: center; }
.mini i.from { background: var(--sel); }
.mini i.to::after { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--dot); }

.numbers { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; text-align: center; margin: 14px 0 4px; }
.numbers b { display: block; font: 700 30px/1.1 var(--text); font-variant-numeric: tabular-nums; }
.numbers span { font-size: 12.5px; color: var(--muted); line-height: 1.2; display: block; }
.best { display: grid; gap: 6px; }
.best-row { display: grid; grid-template-columns: 30px 1fr auto; gap: 10px; align-items: center; font-size: 14.5px; }
.best-row img { width: 30px; height: 30px; }
.best-row span { color: var(--muted); font-size: 13px; }
.best-row b { font-variant-numeric: tabular-nums; }
.countdown { margin-top: 20px; padding-top: 14px; border-top: 1px solid var(--rule); text-align: center; color: var(--muted); font-size: 14px; }
.countdown b { display: block; color: var(--ink); font: 700 26px/1.2 var(--text); font-variant-numeric: tabular-nums; }
.setting { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 14px 0;
  border-bottom: 1px solid var(--rule); cursor: pointer; }
.setting span { display: block; color: var(--muted); font-size: 13.5px; }
dialog.won { text-align: center; }
.won-tile { width: 72px; height: 72px; }
.won-line { color: var(--muted); margin: 0; }
.won-buttons { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; margin-top: 18px; }

.toast { position: fixed; left: 50%; top: calc(70px + env(safe-area-inset-top)); transform: translateX(-50%);
  z-index: 20; background: var(--pill); color: var(--on-pill); padding: 12px 18px; border-radius: 8px;
  font-weight: 600; font-size: 15px; opacity: 0; transition: opacity 0.2s; pointer-events: none; }
.toast.show { opacity: 1; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
