/* Sudoku — notebook & ink. Theme colours arrive as custom properties from
   themes.js; the defaults below are the Paper theme so the first paint
   already looks right. */

:root {
  --bg-a: #efe6d6;
  --bg-b: #d9cfbd;
  --paper: #fbf7ee;
  --paper-2: #f0e9db;
  --ink: #2a2520;
  --ink-soft: #776c5e;
  --ink-rgb: 42, 37, 32;
  --pen: #2c4f8a;
  --pencil: #8f8679;
  --line: rgba(60, 45, 30, 0.18);
  --line-bold: #4a3f33;
  --hl: rgba(214, 160, 74, 0.16);
  --hl-strong: rgba(214, 160, 74, 0.38);
  --sel: rgba(214, 160, 74, 0.5);
  --wrong: #b8392b;
  --wrong-bg: rgba(184, 57, 43, 0.12);
  --glow: #e3b45a;
  --accent: #2c4f8a;
  --accent-2: #4a74b8;
  --accent-ink: #f6f1e6;
  --blob1: rgba(255, 250, 240, 0.9);
  --blob2: rgba(227, 180, 90, 0.35);
  --blob3: rgba(44, 79, 138, 0.16);
  --shade: rgba(40, 30, 16, 0.4);
  --paper-img: none;
  --radius: 18px;
  --ease: cubic-bezier(0.4, 0.1, 0.2, 1);
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  height: 100%;
  margin: 0;
  overflow: hidden;
  overscroll-behavior: none;
}

body {
  font-family: var(--sans);
  color: var(--ink);
  background: linear-gradient(165deg, var(--bg-a), var(--bg-b));
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
  transition: background 0.8s, color 0.4s;
}

/* ---------------------------------------------------------- background */
.bg { position: fixed; inset: 0; overflow: hidden; z-index: 0; pointer-events: none; }
.bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--paper-img);
  opacity: 0.7;
  mix-blend-mode: multiply;
}
.bg .blob { position: absolute; border-radius: 50%; filter: blur(60px); opacity: 0.6; will-change: transform; transition: background 0.8s; }
.bg .b1 { width: 60vmax; height: 60vmax; left: -20vmax; top: -25vmax; background: var(--blob1); animation: drift 48s ease-in-out infinite alternate; }
.bg .b2 { width: 50vmax; height: 50vmax; right: -20vmax; bottom: -20vmax; background: var(--blob2); animation: drift 60s ease-in-out infinite alternate-reverse; }
.bg .b3 { width: 40vmax; height: 40vmax; left: 30vw; bottom: -25vmax; background: var(--blob3); animation: drift 72s ease-in-out infinite alternate; }
@keyframes drift {
  from { transform: translate(0, 0) scale(1); }
  to { transform: translate(8vmax, 6vmax) scale(1.12); }
}

/* -------------------------------------------------------------- layout */
.app {
  position: fixed;
  inset: 0;
  z-index: 1;
  display: flex;
  flex-direction: column;
  max-width: 720px;
  margin: 0 auto;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

.top { display: flex; align-items: center; justify-content: space-between; padding: 8px 16px 2px; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand img { width: 40px; height: 40px; border-radius: 10px; box-shadow: 0 2px 6px rgba(var(--ink-rgb), 0.25); }
.brand span { display: flex; flex-direction: column; line-height: 1.1; }
.brand b { font-family: var(--serif); font-weight: 600; font-size: 22px; letter-spacing: 0.02em; }
.brand small { font-size: 11px; color: var(--ink-soft); letter-spacing: 0.08em; text-transform: uppercase; margin-top: 2px; }
.menu { display: flex; gap: 2px; }

.icon-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--ink);
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background 0.2s, transform 0.2s;
}
.icon-btn:hover { background: rgba(var(--ink-rgb), 0.08); }
.icon-btn:active { transform: scale(0.92); }
.icon-btn svg, .btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; padding: 4px 16px 4px; }
.stat {
  background: rgba(255, 255, 255, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.45);
  box-shadow: 0 1px 2px rgba(var(--ink-rgb), 0.06);
  border-radius: 12px;
  padding: 5px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.15;
}
[data-theme="night"] .stat { background: rgba(255, 255, 255, 0.05); border-color: rgba(255, 255, 255, 0.1); }
.stat span { font-size: 10.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-soft); }
.stat b { font-family: var(--serif); font-size: 19px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }

.stage { flex: 1; min-height: 0; container-type: size; display: grid; place-items: center; padding: 6px 16px; }

/* ---------------------------------------------------------------- pad */
.pad { display: grid; grid-template-columns: repeat(9, 1fr); gap: 6px; padding: 2px 16px 4px; }
.key {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--paper);
  background-image: var(--paper-img);
  color: var(--pen);
  border-radius: 10px;
  padding: 3px 0 2px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  cursor: pointer;
  font-family: var(--serif);
  line-height: 1;
  box-shadow: 0 1px 2px rgba(var(--ink-rgb), 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.5);
  transition: transform 0.12s, background 0.2s, opacity 0.25s, color 0.2s;
  min-height: 44px;
}
[data-theme="night"] .key { box-shadow: 0 1px 2px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.06); }
.key b { font-size: 24px; font-weight: 600; transition: font-size 0.2s, color 0.2s; }
.key small { font-size: 10px; color: var(--ink-soft); font-family: var(--sans); margin-top: 1px; font-variant-numeric: tabular-nums; }
.key:active { transform: scale(0.94); }
.key.done { opacity: 0.32; }
.pad.pencil .key { color: var(--pencil); }
.pad.pencil .key b { font-size: 18px; font-weight: 500; }
.pad.pencil .key small { visibility: hidden; }

/* ------------------------------------------------------------ actions */
.actions { display: flex; gap: 8px; padding: 4px 16px 12px; }
.btn {
  appearance: none;
  flex: 1;
  border: 1px solid rgba(var(--ink-rgb), 0.14);
  background: rgba(255, 255, 255, 0.5);
  color: var(--ink);
  font: 500 14.5px var(--sans);
  padding: 10px 10px;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(var(--ink-rgb), 0.08);
  transition: transform 0.15s, background 0.2s, opacity 0.2s, box-shadow 0.2s, color 0.2s;
}
[data-theme="night"] .btn { background: rgba(255, 255, 255, 0.07); }
.btn svg { width: 19px; height: 19px; }
.btn:hover { background: rgba(255, 255, 255, 0.75); }
[data-theme="night"] .btn:hover { background: rgba(255, 255, 255, 0.12); }
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.4; cursor: default; transform: none; }
.btn[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.btn.primary {
  background: linear-gradient(180deg, var(--accent-2), var(--accent));
  color: var(--accent-ink);
  border-color: transparent;
  box-shadow: 0 4px 12px -4px rgba(var(--ink-rgb), 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}
.btn.primary:hover { filter: brightness(1.06); }
.btn.subtle { flex: 0 0 auto; background: transparent; box-shadow: none; color: var(--ink-soft); font-size: 13.5px; margin: 18px auto 0; display: flex; }

/* --------------------------------------------------------------- board */
.board {
  width: min(100cqw, 100cqh);
  aspect-ratio: 1;
  position: relative;
  padding: 2%;
  border-radius: 10px;
  background: var(--paper-img), var(--paper);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.6) inset,
    0 22px 40px -18px rgba(var(--ink-rgb), 0.5),
    0 6px 14px -6px rgba(var(--ink-rgb), 0.3),
    0 0 0 1px rgba(var(--ink-rgb), 0.08);
  transition: background 0.6s, box-shadow 0.6s;
}
[data-theme="night"] .board { box-shadow: 0 1px 0 rgba(255, 255, 255, 0.06) inset, 0 22px 40px -14px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.06); }
.board::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.35), rgba(255, 255, 255, 0) 40%, rgba(var(--ink-rgb), 0.04));
  pointer-events: none;
}

.grid {
  position: relative;
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  grid-template-rows: repeat(9, 1fr);
  width: 100%;
  aspect-ratio: 1;
  border: 2px solid var(--line-bold);
  border-radius: 3px;
  touch-action: none;
  overflow: hidden;
  --cell: 36px;
  font-size: var(--cell);
}
.cell {
  position: relative;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background 0.18s;
}
.cell.bc { border-right: 2px solid var(--line-bold); }
.cell.br { border-bottom: 2px solid var(--line-bold); }
.cell.lc { border-right: 0; }
.cell.lr { border-bottom: 0; }
.cell.peer { background: var(--hl); }
.cell.same { background: var(--hl-strong); }
.cell.sel { background: var(--sel); box-shadow: inset 0 0 0 2px var(--glow); z-index: 1; }
.cell.wrong { background: var(--wrong-bg); }
.cell.wrong.sel { background: var(--sel); }

.val {
  font-family: var(--serif);
  font-size: 0.56em;
  line-height: 1;
  color: var(--ink);
  font-weight: 600;
  transform-origin: center;
}
.cell.user .val { color: var(--pen); font-weight: 500; }
.cell.wrong .val { color: var(--wrong); }
.val.drop { animation: drop 0.26s var(--ease); }
@keyframes drop {
  from { transform: scale(1.5) translateY(-12%); opacity: 0; }
  60% { transform: scale(0.96); opacity: 1; }
}
.cell.hinted .val { animation: hinted 1.2s ease-out; }
@keyframes hinted {
  0%, 15% { text-shadow: 0 0 0.3em var(--glow); color: var(--accent-2); }
}
.cell.shake { animation: shake 0.3s ease-in-out; }
@keyframes shake {
  25% { transform: translateX(-6%); }
  50% { transform: translateX(5%); }
  75% { transform: translateX(-3%); }
}

.notes {
  position: absolute;
  inset: 4%;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
}
.cell.has-notes .notes { opacity: 1; }
.notes i {
  font-style: normal;
  font-family: var(--serif);
  font-size: 0.24em;
  line-height: 1;
  color: var(--pencil);
  display: grid;
  place-items: center;
  visibility: hidden;
  border-radius: 25%;
}
.notes i.on { visibility: visible; animation: noteIn 0.2s var(--ease); }
.notes i.hi { color: var(--pen); font-weight: 700; background: var(--hl-strong); }
@keyframes noteIn { from { transform: scale(0.4); opacity: 0; } }

/* glow sweep across a finished row/column/box, and the final wave */
.cell.sweep::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--glow);
  opacity: 0;
  pointer-events: none;
  animation: sweep 0.75s ease-out var(--delay, 0ms);
}
@keyframes sweep {
  0% { opacity: 0; }
  35% { opacity: 0.6; }
  100% { opacity: 0; }
}

/* shimmer while a new puzzle is written */
.board.generating .cell > * { opacity: 0; }
.board.generating .cell { background: transparent; }
.grid::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  opacity: 0;
  background: linear-gradient(100deg, transparent 30%, rgba(255, 255, 255, 0.55) 50%, transparent 70%);
  background-size: 220% 100%;
  transition: opacity 0.25s;
}
[data-theme="night"] .grid::before { background: linear-gradient(100deg, transparent 30%, rgba(255, 255, 255, 0.12) 50%, transparent 70%); background-size: 220% 100%; }
.board.generating .grid::before { opacity: 1; animation: shimmer 1.1s linear infinite; }
@keyframes shimmer { from { background-position: 120% 0; } to { background-position: -120% 0; } }
.board.written .cell.given .val { animation: write 0.4s var(--ease) both; animation-delay: var(--delay, 0ms); }
@keyframes write {
  from { opacity: 0; transform: scale(1.3) translateY(-10%); }
}

/* -------------------------------------------------------- sheets, dialogs */
.backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: var(--shade);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  animation: fade 0.25s;
}
@keyframes fade { from { opacity: 0; } }

.sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  margin: 0 auto;
  z-index: 21;
  max-width: 560px;
  max-height: 86dvh;
  display: flex;
  flex-direction: column;
  background: var(--paper-img), var(--paper);
  color: var(--ink);
  border-radius: 24px 24px 0 0;
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.25);
  padding-bottom: env(safe-area-inset-bottom);
  animation: rise 0.32s var(--ease);
}
@keyframes rise { from { transform: translateY(40px); opacity: 0; } }
.sheet header { display: flex; align-items: center; justify-content: space-between; padding: 14px 12px 6px 22px; flex: 0 0 auto; }
.sheet h2, .dialog h2 { font-family: var(--serif); font-weight: 600; font-size: 24px; margin: 0; letter-spacing: 0.01em; }
.sheet-body { overflow: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; padding: 2px 22px 26px; font-size: 15px; line-height: 1.55; }
.sheet-body h3 { font-family: var(--serif); font-weight: 600; font-size: 17px; margin: 20px 0 8px; color: var(--ink); }
.prose p { margin: 0 0 12px; }
.prose ul { margin: 0; padding-left: 20px; }
.prose li { margin: 4px 0; }
.muted { color: var(--ink-soft); }
.about { font-size: 13px; margin-top: 22px; text-align: center; }

@media (min-width: 700px) and (min-height: 560px) {
  .sheet { bottom: auto; top: 50%; transform: translateY(-50%); border-radius: 24px; max-height: 80dvh; animation: pop 0.28s var(--ease); }
}
@keyframes pop { from { opacity: 0; transform: translateY(-50%) scale(0.96); } }

.dialog {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 22;
  width: min(92vw, 400px);
  max-height: 92dvh;
  overflow: auto;
  background: var(--paper-img), var(--paper);
  color: var(--ink);
  border-radius: 24px;
  padding: 26px 24px 22px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
  text-align: center;
  animation: popc 0.3s var(--ease);
}
@keyframes popc { from { opacity: 0; transform: translate(-50%, -50%) scale(0.94); } }
.dialog p { margin: 8px 0 18px; color: var(--ink-soft); font-size: 15px; line-height: 1.5; }
.dialog .row { display: flex; gap: 10px; }
.result { overflow: hidden; }
.result .glow {
  position: absolute;
  inset: -40% -20% auto;
  height: 70%;
  background: radial-gradient(ellipse at 50% 40%, color-mix(in oklab, var(--glow) 45%, transparent), transparent 65%);
  pointer-events: none;
  opacity: 0.8;
}
.result h2 { position: relative; font-size: 30px; animation: shimmerText 2.4s ease-in-out infinite; }
@keyframes shimmerText { 50% { text-shadow: 0 0 18px color-mix(in oklab, var(--glow) 80%, white); } }
.result-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 12px; }
.result-stats div, .summary div { display: flex; flex-direction: column; align-items: center; background: var(--paper-2); border-radius: 12px; padding: 8px 4px; line-height: 1.2; }
.result-stats span, .summary span { font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-soft); }
.result-stats b, .summary b { font-family: var(--serif); font-size: 19px; font-weight: 600; }
.score { display: flex; flex-direction: column; align-items: center; margin: 4px 0 18px; }
.score span { font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-soft); }
.score b { font-family: var(--serif); font-size: 44px; font-weight: 600; line-height: 1.05; color: var(--pen); }

.levels { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.level {
  appearance: none;
  border: 1.5px solid var(--line);
  background: var(--paper-2);
  color: var(--ink);
  border-radius: 14px;
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  gap: 2px;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, transform 0.15s;
}
.level:hover { background: var(--paper); }
.level:active { transform: scale(0.98); }
.level b { font-family: var(--serif); font-size: 18px; font-weight: 600; }
.level small { font-size: 12.5px; color: var(--ink-soft); }
.level[aria-current="true"] { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in oklab, var(--accent) 22%, transparent); }

/* ------------------------------------------------------------- results */
.summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 8px; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; font-variant-numeric: tabular-nums; }
th { text-align: left; vertical-align: bottom; font-weight: 500; color: var(--ink-soft); font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; padding: 4px 4px; border-bottom: 1px solid var(--line); }
td { padding: 7px 4px; border-bottom: 1px solid var(--line); white-space: nowrap; vertical-align: middle; }
th.num, td.num { text-align: right; }
td.score { font-family: var(--serif); font-weight: 600; font-size: 15px; color: var(--pen); }
td.lvl { font-weight: 600; }
@media (max-width: 420px) { th.hints, td.hints { display: none; } td { padding: 7px 3px; } }

/* ------------------------------------------------------------- settings */
.opts { display: flex; flex-wrap: wrap; gap: 8px; }
.opt {
  appearance: none;
  border: 1.5px solid var(--line);
  background: var(--paper-2);
  color: var(--ink);
  font: 500 14px var(--sans);
  padding: 8px 14px 8px 10px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, transform 0.15s;
}
.opt:active { transform: scale(0.97); }
.opt[aria-checked="true"] { border-color: var(--accent); background: var(--paper); box-shadow: 0 0 0 3px color-mix(in oklab, var(--accent) 22%, transparent); }
.opts.lang .opt { padding-left: 14px; min-width: 96px; justify-content: center; }
.swatch { display: inline-block; width: 24px; height: 24px; border-radius: 50%; flex: 0 0 auto; background: linear-gradient(135deg, var(--sw) 50%, var(--sw2) 50%); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.2); }
.toggle { display: flex; align-items: center; gap: 12px; margin-top: 18px; cursor: pointer; font-size: 15px; line-height: 1.35; }
.toggle input { position: absolute; opacity: 0; width: 0; height: 0; }
.toggle .track { flex: 0 0 auto; width: 46px; height: 28px; border-radius: 999px; background: rgba(var(--ink-rgb), 0.22); position: relative; transition: background 0.25s; }
.toggle .track::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.25s var(--ease); }
.toggle input:checked + .track { background: var(--accent); }
.toggle input:checked + .track::after { transform: translateX(18px); }
.toggle input:focus-visible + .track { outline: 2px solid var(--accent-2); outline-offset: 2px; }

/* ---------------------------------------------------------------- toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(140px + env(safe-area-inset-bottom));
  transform: translateX(-50%) translateY(10px);
  z-index: 15;
  background: rgba(var(--ink-rgb), 0.92);
  color: var(--paper);
  padding: 10px 16px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.4;
  max-width: min(88vw, 420px);
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s, transform 0.25s;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ------------------------------------------------------------- confetti */
.confetti { position: fixed; inset: 0; z-index: 23; pointer-events: none; overflow: hidden; }
.confetti i {
  position: absolute;
  top: -14px;
  left: var(--x);
  width: 7px;
  height: 11px;
  border-radius: 2px;
  background: var(--c);
  opacity: 0;
  animation: fall var(--dur, 2.8s) cubic-bezier(0.3, 0.2, 0.6, 1) var(--delay, 0s) both;
}
@keyframes fall {
  0% { transform: translate(0, 0) rotate(0deg); opacity: 0; }
  8% { opacity: 0.9; }
  100% { transform: translate(var(--dx), 104vh) rotate(var(--rot)); opacity: 0.6; }
}

/* ------------------------------------------------------- small screens */
@media (max-height: 660px) {
  .top { padding-top: 4px; }
  .brand small { display: none; }
  .brand b { font-size: 19px; }
  .brand img { width: 32px; height: 32px; }
  .icon-btn { width: 38px; height: 38px; }
  .stats { padding-top: 2px; padding-bottom: 2px; gap: 6px; }
  .stat { padding: 3px 6px; }
  .stat b { font-size: 16px; }
  .stage { padding: 4px 16px; }
  .key { min-height: 38px; padding: 2px 0 1px; }
  .key b { font-size: 20px; }
  .actions { padding-bottom: 8px; }
  .btn { padding: 7px 6px 6px; }
  .toast { bottom: calc(120px + env(safe-area-inset-bottom)); }
}
@media (max-width: 560px) {
  .btn { flex-direction: column; gap: 3px; padding: 7px 4px 6px; font-size: 12px; }
  .btn span { white-space: nowrap; }
  .btn svg { width: 21px; height: 21px; }
  .actions { gap: 6px; }
}
@media (min-width: 900px) and (min-height: 760px) {
  .brand b { font-size: 26px; }
  .stage { padding: 12px 16px; }
  .key b { font-size: 26px; }
}

@media (prefers-reduced-motion: reduce) {
  .bg .blob { animation: none; }
  .sheet, .dialog, .backdrop, .val, .notes i, .cell.sweep::after, .board.written .cell.given .val, .cell.hinted .val, .result h2 { animation: none !important; }
  .cell, .key, .btn, .toast { transition-duration: 0.01s; }
  .confetti { display: none; }
  .board.generating .grid::before { animation: none; opacity: 0.5; }
}
