/* Hidato — stone tiles, carved givens, painted numbers, a glowing path.
   Material colours arrive as custom properties from themes.js. */

:root {
  --bg-a: #1c2129;
  --bg-b: #2a323c;
  --blob-a: rgba(120, 150, 190, 0.35);
  --blob-b: rgba(240, 182, 79, 0.18);
  --board: #2a323b;
  --board-rim: #171c22;
  --board-hi: rgba(255, 255, 255, 0.08);
  --tile: #3d4752;
  --tile-hi: #55616e;
  --tile-lo: #262d35;
  --carve: #1f262d;
  --carve-hi: rgba(255, 255, 255, 0.22);
  --carve-lo: rgba(0, 0, 0, 0.5);
  --paint: #ffd27a;
  --paint-glow: rgba(255, 190, 70, 0.55);
  --glow: #f0b64f;
  --ink: #e9edf1;
  --ink-soft: #9aa6b3;
  --paper: #272e37;
  --paper-2: #323a44;
  --line: rgba(255, 255, 255, 0.1);
  --accent: #d9a84a;
  --accent-deep: #9c6f22;
  --accent-ink: #1d1507;
  --bad: #ff6b5b;
  --blocked: #1b2026;
  --grain-img: none;
  --ease: cubic-bezier(0.4, 0.1, 0.2, 1);
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, 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 .blob { position: absolute; border-radius: 50%; filter: blur(70px); will-change: transform; transition: background 0.8s; }
.bg .b1 { width: 60vmax; height: 60vmax; left: -22vmax; top: -28vmax; background: var(--blob-a); animation: drift 52s ease-in-out infinite alternate; }
.bg .b2 { width: 50vmax; height: 50vmax; right: -22vmax; bottom: -22vmax; background: var(--blob-b); animation: drift 64s ease-in-out infinite alternate-reverse; }
.bg .b3 { width: 36vmax; height: 36vmax; left: 32vw; bottom: -22vmax; background: var(--blob-a); opacity: 0.6; animation: drift 76s ease-in-out infinite alternate; }
@keyframes drift {
  from { transform: translate(0, 0) scale(1); }
  to { transform: translate(8vmax, 6vmax) scale(1.14); }
}

/* -------------------------------------------------------------- layout */
.app {
  position: fixed;
  inset: 0;
  z-index: 1;
  display: flex;
  flex-direction: column;
  max-width: 760px;
  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: 10px 16px 4px; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand img { width: 40px; height: 40px; border-radius: 11px; filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.3)); }
.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.03em; }
.brand small { font-size: 11.5px; color: var(--ink-soft); letter-spacing: 0.08em; text-transform: uppercase; margin-top: 2px; }
.menu { display: flex; gap: 4px; }

.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: color-mix(in oklab, var(--ink) 10%, transparent); }
.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: 1fr 1.25fr 1fr 1fr; gap: 8px; padding: 4px 16px 6px; }
.stat {
  appearance: none;
  font-family: inherit;
  background: color-mix(in oklab, var(--paper) 55%, transparent);
  border: 1px solid color-mix(in oklab, var(--ink) 12%, transparent);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
  border-radius: 12px;
  padding: 6px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.15;
  color: var(--ink);
  transition: background 0.4s, border-color 0.4s;
}
.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: 20px; font-weight: 600; font-variant-numeric: tabular-nums; }
.stat.next { cursor: pointer; border-color: color-mix(in oklab, var(--glow) 45%, transparent); box-shadow: 0 0 0 1px color-mix(in oklab, var(--glow) 25%, transparent), 0 1px 2px rgba(0, 0, 0, 0.1); }
.stat.next:active { transform: scale(0.97); }
.stat.next b { display: flex; align-items: center; gap: 5px; color: var(--paint); }
.stat.next em { font-style: normal; transition: transform 0.25s var(--ease); }
.stat.next.bump em { animation: bump 0.3s var(--ease); }
@keyframes bump { 40% { transform: scale(1.25); } }
.stat.next i {
  width: 0; height: 0; border: 5px solid transparent; display: inline-block;
  border-left: 7px solid var(--glow); border-right: 0; opacity: 0.9; transition: transform 0.3s var(--ease);
}
.stat.next i.down { transform: rotate(180deg); }

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

.actions { display: flex; gap: 10px; padding: 6px 16px 14px; }
.btn {
  appearance: none;
  flex: 1;
  border: 1px solid color-mix(in oklab, var(--ink) 14%, transparent);
  background: color-mix(in oklab, var(--paper) 65%, transparent);
  color: var(--ink);
  font: 500 15px var(--sans);
  padding: 11px 12px;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
  transition: transform 0.15s, background 0.2s, opacity 0.2s, box-shadow 0.2s;
}
.btn svg { width: 19px; height: 19px; }
.btn:hover { background: var(--paper); }
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.4; cursor: default; transform: none; }
.btn.primary {
  background: linear-gradient(180deg, color-mix(in oklab, var(--accent) 85%, white), var(--accent-deep));
  color: var(--accent-ink);
  border-color: var(--accent-deep);
  box-shadow: 0 4px 12px -4px color-mix(in oklab, var(--accent-deep) 70%, transparent), inset 0 1px 0 rgba(255, 255, 255, 0.3);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.2);
}
.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; border-color: transparent; }

/* --------------------------------------------------------------- board */
.board {
  --n: 6;
  width: min(100cqw, 100cqh);
  aspect-ratio: 1;
  position: relative;
  border-radius: 6%;
  padding: 3.2%;
  background: var(--grain-img) center / 60% 60%, linear-gradient(145deg, color-mix(in oklab, var(--board) 85%, white), var(--board) 45%, color-mix(in oklab, var(--board) 80%, black));
  box-shadow:
    inset 0 0 0 1px var(--board-hi),
    inset 0 1px 0 var(--board-hi),
    inset 0 -2px 6px rgba(0, 0, 0, 0.3),
    0 0 0 1px var(--board-rim),
    0 28px 48px -20px rgba(0, 0, 0, 0.6),
    0 8px 16px -6px rgba(0, 0, 0, 0.4);
  transition: background 0.6s;
}
.board::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(circle at 25% 15%, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0) 55%);
  pointer-events: none;
  mix-blend-mode: soft-light;
}

.grid {
  position: absolute;
  inset: 3.2%;
  display: grid;
  grid-template-columns: repeat(var(--n), 1fr);
  grid-template-rows: repeat(var(--n), 1fr);
  touch-action: none;
  --cell: 50px;
  transition: opacity 0.3s;
}
.board.loading .grid { opacity: 0.35; }
.board.loading .path { opacity: 0; }
.shimmer {
  position: absolute;
  inset: 3.2%;
  border-radius: 4%;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}
.shimmer::before {
  content: "";
  position: absolute;
  inset: -40% -60%;
  background: linear-gradient(100deg, transparent 35%, color-mix(in oklab, var(--glow) 35%, transparent) 50%, transparent 65%);
  animation: sweep 1.3s linear infinite;
}
.board.loading .shimmer { opacity: 1; }
@keyframes sweep { from { transform: translateX(-45%); } to { transform: translateX(45%); } }

.cell { position: relative; padding: 5%; font-size: var(--cell); }
.cell .tile {
  position: absolute;
  inset: 5%;
  border-radius: 14%;
  background: var(--grain-img) center / 220% 220%, linear-gradient(150deg, var(--tile-hi), var(--tile) 55%, var(--tile-lo));
  box-shadow:
    inset 0 0.03em 0 rgba(255, 255, 255, 0.22),
    inset 0 -0.03em 0 rgba(0, 0, 0, 0.3),
    0 0.05em 0.1em rgba(0, 0, 0, 0.35),
    0 0.02em 0.02em rgba(0, 0, 0, 0.25);
  transition: transform 0.25s var(--ease), box-shadow 0.25s, filter 0.25s;
}
.cell.blocked .tile {
  background: var(--blocked);
  box-shadow: inset 0 0.08em 0.14em rgba(0, 0, 0, 0.55), inset 0 -0.02em 0 rgba(255, 255, 255, 0.1);
}
.cell b {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: grid;
  place-items: center;
  font-family: var(--serif);
  font-weight: 600;
  font-size: 0.42em;
  line-height: 1;
  letter-spacing: -0.01em;
  pointer-events: none;
  transition: color 0.3s, text-shadow 0.3s;
}
.cell.given b { color: var(--carve); text-shadow: 0 0.04em 0 var(--carve-hi), 0 -0.03em 0.02em var(--carve-lo); }
.cell.player b {
  color: var(--paint);
  font-style: italic;
  font-weight: 700;
  text-shadow: 0 0 0.25em var(--paint-glow), 0 0.03em 0.03em rgba(0, 0, 0, 0.45), 0 0 0.05em rgba(0, 0, 0, 0.5);
  transform: rotate(var(--tilt, 0deg));
}
.cell.pop b { animation: pop 0.38s var(--ease); }
@keyframes pop {
  0% { transform: scale(0.3) rotate(var(--tilt, 0deg)); opacity: 0; }
  60% { transform: scale(1.2) rotate(var(--tilt, 0deg)); opacity: 1; }
  100% { transform: scale(1) rotate(var(--tilt, 0deg)); }
}
.cell.pop .tile { animation: press 0.38s var(--ease); }
@keyframes press { 30% { transform: scale(0.94); } }

.cell.target .tile::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 0 0 0.04em color-mix(in oklab, var(--glow) 55%, transparent), inset 0 0 0.35em color-mix(in oklab, var(--glow) 30%, transparent);
  animation: breathe 1.8s ease-in-out infinite;
}
@keyframes breathe { 50% { opacity: 0.45; } }
.cell.cursor .tile {
  transform: translateY(-3%);
  box-shadow:
    0 0 0 0.04em var(--glow),
    0 0 0.4em 0.08em color-mix(in oklab, var(--glow) 60%, transparent),
    0 0.12em 0.2em rgba(0, 0, 0, 0.4),
    inset 0 0.03em 0 rgba(255, 255, 255, 0.25);
}
.cell.mistake .tile { filter: saturate(0.9); box-shadow: inset 0 0 0 0.04em var(--bad), inset 0 0 0.3em color-mix(in oklab, var(--bad) 45%, transparent), 0 0.05em 0.1em rgba(0, 0, 0, 0.35); }
.cell.mistake b { color: var(--bad); text-shadow: 0 0 0.25em color-mix(in oklab, var(--bad) 60%, transparent); }
.cell.hinted .tile::before {
  content: "";
  position: absolute;
  right: 9%;
  top: 9%;
  width: 0.11em;
  height: 0.11em;
  border-radius: 50%;
  background: var(--glow);
  box-shadow: 0 0 0.12em var(--glow);
  opacity: 0.85;
}
.cell.flash .tile { animation: flash 1s var(--ease); }
@keyframes flash {
  0% { box-shadow: 0 0 0 0.04em var(--glow), 0 0 0.2em 0.2em color-mix(in oklab, var(--glow) 90%, transparent); }
  100% { box-shadow: 0 0 0 0 transparent; }
}
.cell.shake .tile { animation: shake 0.32s ease-in-out; }
@keyframes shake { 25% { transform: translateX(-6%); } 50% { transform: translateX(5%); } 75% { transform: translateX(-3%); } }
.cell.solved .tile { animation: solved 0.9s var(--ease) both; animation-delay: calc(var(--k) * 18ms); }
@keyframes solved { 30% { transform: translateY(-8%) scale(1.05); box-shadow: 0 0 0 0.04em var(--glow), 0 0 0.5em 0.1em color-mix(in oklab, var(--glow) 70%, transparent); } }

.path {
  position: absolute;
  inset: 3.2%;
  width: calc(100% - 6.4%);
  height: calc(100% - 6.4%);
  z-index: 2;
  pointer-events: none;
  overflow: visible;
  transition: opacity 0.3s;
}
.path line { stroke-linecap: round; fill: none; transition: stroke-dashoffset 0.32s var(--ease), opacity 0.25s; }
.path .seg .halo { stroke: var(--glow); stroke-width: 0.28; opacity: 0.18; }
.path .seg .core { stroke: var(--glow); stroke-width: 0.12; opacity: 0.85; }
.path .seg.bad .halo { stroke: var(--bad); opacity: 0.15; }
.path .seg.bad .core { stroke: var(--bad); stroke-dasharray: 0.18 0.14 !important; stroke-dashoffset: 0 !important; opacity: 0.8; }
.path .seg.out line { opacity: 0; }

/* -------------------------------------------------------- sheets, dialogs */
.backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: rgba(10, 14, 20, 0.45);
  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);
  color: var(--ink);
  border-radius: 24px 24px 0 0;
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.35);
  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-sheet 0.28s var(--ease); }
}
@keyframes pop-sheet { 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);
  background: var(--paper);
  color: var(--ink);
  border-radius: 24px;
  padding: 26px 24px 22px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
  text-align: center;
  animation: popc 0.3s var(--ease);
  overflow: hidden;
}
@keyframes popc { from { opacity: 0; transform: translate(-50%, -50%) scale(0.94); } }
.dialog p { margin: 8px 0 18px; color: var(--ink-soft); font-size: 15.5px; line-height: 1.5; }
.dialog .row { display: flex; gap: 10px; }
.result .glow {
  position: absolute;
  inset: -40% -20% auto;
  height: 70%;
  background: radial-gradient(ellipse at 50% 40%, color-mix(in oklab, var(--glow) 40%, transparent), transparent 65%);
  pointer-events: none;
}
.result h2 { position: relative; font-size: 30px; animation: shimmer 2.4s ease-in-out infinite; }
@keyframes shimmer { 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(--paint); }

.sizes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 14px; }
.size-btn {
  appearance: none;
  border: 1.5px solid var(--line);
  background: var(--paper-2);
  color: var(--ink);
  border-radius: 16px;
  padding: 12px 8px 10px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  font-family: var(--sans);
  transition: transform 0.15s, border-color 0.2s, box-shadow 0.2s;
}
.size-btn b { font-family: var(--serif); font-size: 24px; font-weight: 600; }
.size-btn span { font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-soft); }
.size-btn:hover { border-color: var(--accent); }
.size-btn:active { transform: scale(0.96); }
.size-btn.current { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in oklab, var(--accent) 25%, 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.pts { font-family: var(--serif); font-weight: 600; font-size: 15px; }
@media (max-width: 420px) { th.undos, td.undos { 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); box-shadow: 0 0 0 3px color-mix(in oklab, var(--accent) 25%, transparent); }
.opts.lang .opt { padding-left: 14px; min-width: 96px; justify-content: center; }
.swatch { display: inline-block; width: 24px; height: 24px; border-radius: 7px; flex: 0 0 auto; background: linear-gradient(150deg, var(--sw), var(--sw2)); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3), 0 1px 2px rgba(0, 0, 0, 0.35); }
.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: color-mix(in oklab, var(--ink) 25%, var(--paper-2)); 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); outline-offset: 2px; }

/* ---------------------------------------------------------------- toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(84px + env(safe-area-inset-bottom));
  transform: translateX(-50%) translateY(10px);
  z-index: 15;
  background: rgba(20, 24, 30, 0.92);
  color: #fff;
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 14px;
  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.3);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ------------------------------------------------------- small screens */
@media (max-height: 640px) {
  .top { padding-top: 6px; }
  .brand small { display: none; }
  .brand b { font-size: 19px; }
  .stat b { font-size: 17px; }
  .stat { padding: 4px 6px; }
  .actions { padding-bottom: 10px; }
  .btn { padding: 9px 10px; }
}
@media (max-width: 520px) {
  .btn { flex-direction: column; gap: 3px; padding: 8px 6px 7px; font-size: 12.5px; }
  .btn span { white-space: nowrap; }
  .btn svg { width: 21px; height: 21px; }
}
@media (min-width: 900px) and (min-height: 700px) {
  .brand b { font-size: 26px; }
  .stage { padding: 14px 16px; }
}

@media (prefers-reduced-motion: reduce) {
  .bg .blob, .shimmer::before, .result h2, .cell.target .tile::after { animation: none; }
  .cell b, .cell .tile, .sheet, .dialog, .backdrop, .path line, .stat.next em { animation: none; transition-duration: 0.01s; }
}
