/* Slide Puzzle — ceramic and stone tiles. Theme colours live under
   :root[data-theme=…]; everything else derives from them. */

:root {
  --bg-a: #e3e8ec;
  --bg-b: #c6d2d9;
  --blob-a: rgba(255, 255, 255, 0.9);
  --blob-b: rgba(47, 141, 156, 0.35);
  --blob-c: rgba(126, 170, 190, 0.35);
  --tray: #a9b8c3;
  --tray-deep: #8ea0ad;
  --tile-hi: #fffdf9;
  --tile-lo: #e3ddd2;
  --tile-ink: #2f4a62;
  --tile-edge: rgba(255, 255, 255, 0.85);
  --tile-shade: rgba(40, 55, 70, 0.14);
  --ink: #233140;
  --ink-soft: #62717f;
  --paper: #f8f8f6;
  --paper-2: #eceeee;
  --line: rgba(35, 49, 64, 0.12);
  --accent: #2a7f8f;
  --accent-ink: #f6fdfd;
  --glow: #7fd8e3;
  --shadow-ink: rgba(20, 35, 50, 0.3);
  --radius: 18px;
  --ease: cubic-bezier(0.4, 0.1, 0.2, 1);
  --slide: cubic-bezier(0.3, 0.75, 0.25, 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;
  color-scheme: light;
}
:root[data-theme="basalt"] {
  --bg-a: #262a30;
  --bg-b: #121417;
  --blob-a: rgba(90, 100, 115, 0.5);
  --blob-b: rgba(217, 160, 102, 0.22);
  --blob-c: rgba(80, 120, 140, 0.3);
  --tray: #0c0e11;
  --tray-deep: #050607;
  --tile-hi: #4d535c;
  --tile-lo: #2b3036;
  --tile-ink: #f1ece2;
  --tile-edge: rgba(255, 255, 255, 0.22);
  --tile-shade: rgba(0, 0, 0, 0.45);
  --ink: #ece8e0;
  --ink-soft: #a7a398;
  --paper: #2a2e34;
  --paper-2: #363b42;
  --line: rgba(255, 255, 255, 0.1);
  --accent: #d9a066;
  --accent-ink: #1d1710;
  --glow: #f0c68e;
  --shadow-ink: rgba(0, 0, 0, 0.6);
  color-scheme: dark;
}
:root[data-theme="terracotta"] {
  --bg-a: #f3e5d3;
  --bg-b: #dcc3a4;
  --blob-a: rgba(255, 250, 240, 0.9);
  --blob-b: rgba(217, 138, 95, 0.35);
  --blob-c: rgba(138, 75, 46, 0.22);
  --tray: #7d4530;
  --tray-deep: #5a2f20;
  --tile-hi: #e39a6e;
  --tile-lo: #b85f39;
  --tile-ink: #fff4e8;
  --tile-edge: rgba(255, 232, 210, 0.7);
  --tile-shade: rgba(70, 30, 15, 0.3);
  --ink: #3b2a20;
  --ink-soft: #7a5f4e;
  --paper: #fbf4ea;
  --paper-2: #f1e5d6;
  --line: rgba(59, 42, 32, 0.12);
  --accent: #8a4b2e;
  --accent-ink: #fff6ee;
  --glow: #ffb98a;
  --shadow-ink: rgba(60, 30, 15, 0.35);
}

* { 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(60px); opacity: 0.6; will-change: transform; transition: background 0.8s; }
.bg .b1 { width: 60vmax; height: 60vmax; left: -20vmax; top: -25vmax; background: var(--blob-a); animation: drift 48s ease-in-out infinite alternate; }
.bg .b2 { width: 50vmax; height: 50vmax; right: -20vmax; bottom: -20vmax; background: var(--blob-b); animation: drift 60s ease-in-out infinite alternate-reverse; }
.bg .b3 { width: 40vmax; height: 40vmax; left: 30vw; bottom: -25vmax; background: var(--blob-c); 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: 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 2px; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand img { width: 40px; height: 40px; border-radius: 10px; filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 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: 11.5px; 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: color-mix(in oklab, var(--ink) 8%, 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; }

.bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px 4px;
}
.seg {
  display: inline-flex;
  background: color-mix(in oklab, var(--ink) 9%, transparent);
  border-radius: 999px;
  padding: 3px;
  flex: 0 0 auto;
}
.seg button {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--ink-soft);
  font: 600 13px var(--sans);
  letter-spacing: 0.02em;
  padding: 6px 11px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.25s, color 0.25s, box-shadow 0.25s;
}
.seg button[aria-checked="true"] { background: var(--paper); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18); }

.stats { display: flex; gap: 6px; flex: 1; justify-content: flex-end; min-width: 0; }
.stat {
  background: color-mix(in oklab, var(--paper) 55%, transparent);
  border: 1px solid color-mix(in oklab, var(--paper) 70%, transparent);
  box-shadow: 0 1px 2px var(--shadow-ink);
  border-radius: 12px;
  padding: 4px 9px;
  min-width: 58px;
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.15;
}
.stat span { font-size: 9.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-soft); white-space: nowrap; }
.stat b { font-family: var(--serif); font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; }
.peek { width: 38px; height: 38px; flex: 0 0 auto; }
.peek[aria-pressed="true"] { background: color-mix(in oklab, var(--accent) 22%, transparent); color: var(--accent); }

.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 var(--line);
  background: color-mix(in oklab, var(--paper) 70%, 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 var(--shadow-ink);
  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.45; cursor: default; transform: none; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; box-shadow: 0 3px 10px color-mix(in oklab, var(--accent) 40%, transparent); }
.btn.primary:hover { filter: brightness(1.07); }
.btn.subtle { flex: 0 0 auto; background: transparent; box-shadow: none; margin-top: 22px; width: 100%; color: var(--ink-soft); }
.btn.thinking { animation: think 0.9s ease-in-out infinite; }
@keyframes think { 50% { opacity: 0.55; } }

/* --------------------------------------------------------------- board */
.board {
  width: min(100cqw, 100cqh);
  aspect-ratio: 1;
  position: relative;
}
.grid {
  position: absolute;
  inset: 0;
  --gap: 2.4%;
  padding: var(--gap);
  border-radius: calc(var(--radius) * 1.05);
  background: linear-gradient(180deg, var(--tray-deep), var(--tray));
  box-shadow:
    inset 0 3px 8px rgba(0, 0, 0, 0.35),
    inset 0 -1px 0 rgba(255, 255, 255, 0.15),
    0 1px 0 rgba(255, 255, 255, 0.35),
    0 18px 40px -18px var(--shadow-ink);
  touch-action: none;
  overflow: hidden;
  transition: background 0.6s;
}
.cells {
  position: relative;
  width: 100%;
  height: 100%;
  container-type: size;
}
.tile {
  position: absolute;
  top: 0;
  left: 0;
  width: calc(100% / var(--n));
  height: calc(100% / var(--n));
  padding: calc(var(--gap) * 1.3 / var(--n) * 2);
  transform: translate(calc(var(--c) * 100%), calc(var(--r) * 100%));
  transition: transform 0.24s var(--slide);
  will-change: transform;
  cursor: pointer;
  z-index: 1;
}
.cells.instant .tile { transition: none; }
.face {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: calc(6cqw / var(--n) + 4px);
  background: linear-gradient(160deg, var(--tile-hi), var(--tile-lo));
  background-repeat: no-repeat;
  color: var(--tile-ink);
  display: grid;
  place-items: center;
  overflow: hidden;
  box-shadow:
    inset 0 1.5px 0 var(--tile-edge),
    inset 0 -2px 0 var(--tile-shade),
    inset 1.5px 0 0 color-mix(in oklab, var(--tile-edge) 50%, transparent),
    inset -1.5px 0 0 color-mix(in oklab, var(--tile-shade) 60%, transparent),
    0 1.5px 2px var(--shadow-ink),
    0 3px 6px -1px var(--shadow-ink);
  transition: box-shadow 0.24s var(--slide), transform 0.24s var(--slide);
  transform: translateZ(0);
}
.face::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(175deg, rgba(255, 255, 255, 0.38), rgba(255, 255, 255, 0.05) 42%, rgba(0, 0, 0, 0) 60%, rgba(0, 0, 0, 0.07));
  pointer-events: none;
}
.num {
  font-family: var(--serif);
  font-weight: 600;
  font-size: calc(42cqw / var(--n));
  line-height: 1;
  letter-spacing: -0.02em;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.35);
  position: relative;
  font-variant-numeric: tabular-nums;
}
.cells.pic .face { color: #fff; }
.cells.pic .num {
  position: absolute;
  left: 6%;
  top: 6%;
  font-family: var(--sans);
  font-weight: 600;
  font-size: calc(12cqw / var(--n) + 4px);
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  text-shadow: none;
  padding: 0.1em 0.45em;
  border-radius: 999px;
  backdrop-filter: blur(2px);
}
.cells.pic:not(.nums) .num { display: none; }
.cells.pic .face::before { background: linear-gradient(175deg, rgba(255, 255, 255, 0.3), rgba(255, 255, 255, 0.02) 40%, rgba(0, 0, 0, 0) 60%, rgba(0, 0, 0, 0.12)); }

.tile.sliding { z-index: 3; }
.tile.sliding .face {
  transform: translateZ(0) scale(1.035);
  box-shadow:
    inset 0 1.5px 0 var(--tile-edge),
    inset 0 -2px 0 var(--tile-shade),
    0 6px 10px -2px var(--shadow-ink),
    0 14px 26px -6px var(--shadow-ink);
}
.tile.hint { z-index: 2; }
.tile.hint .face {
  animation: pulse 1.1s ease-in-out infinite;
  box-shadow:
    inset 0 1.5px 0 var(--tile-edge),
    inset 0 -2px 0 var(--tile-shade),
    0 0 0 3px var(--accent),
    0 0 22px color-mix(in oklab, var(--glow) 80%, transparent),
    0 4px 8px var(--shadow-ink);
}
@keyframes pulse { 50% { transform: translateZ(0) scale(1.05); } }
.tile.nudge .face { animation: nudge 0.32s var(--ease); }
@keyframes nudge { 30% { transform: translateZ(0) scale(0.95); } 60% { transform: translateZ(0) scale(1.02); } }

.tile.last { opacity: 0; pointer-events: none; z-index: 0; transition: opacity 0.9s 0.35s; }
.board.won .tile.last { opacity: 1; }
.board.won .tile { cursor: default; }
.board.won .face::after {
  content: "";
  position: absolute;
  inset: -60% -40%;
  background: linear-gradient(110deg, transparent 38%, rgba(255, 255, 255, 0.55) 50%, transparent 62%);
  transform: translateX(-70%);
  animation: sweep 1.5s ease-in-out 0.25s 2;
  pointer-events: none;
}
@keyframes sweep { to { transform: translateX(70%); } }
.board.won .grid { animation: settle 0.7s var(--ease); }
@keyframes settle { 30% { transform: scale(1.015); } }

.preview {
  position: absolute;
  inset: var(--gap);
  border-radius: calc(var(--radius) * 0.6);
  background-size: cover;
  background-position: center;
  z-index: 5;
  box-shadow: 0 10px 30px var(--shadow-ink);
  animation: fade 0.25s;
  pointer-events: none;
}

/* -------------------------------------------------------- sheets, dialogs */
.backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: rgba(15, 25, 35, 0.4);
  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 var(--shadow-ink);
  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);
  background: var(--paper);
  border-radius: 24px;
  padding: 26px 24px 22px;
  box-shadow: 0 20px 60px var(--shadow-ink);
  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) 45%, transparent), transparent 65%);
  pointer-events: none;
  opacity: 0.8;
}
.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; }

/* ------------------------------------------------------------- results */
.summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }
.sheet-body .seg { margin-top: 6px; }
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.moves, th.time, th.hints, th.score, td.moves, td.time, td.hints, td.score { text-align: right; }
td.score { font-family: var(--serif); font-weight: 600; font-size: 15px; }
td.mode { color: var(--ink-soft); }
@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) 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(135deg, var(--sw) 50%, var(--sw2) 50%); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12); }

.pics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.picopt {
  appearance: none;
  border: 2px solid transparent;
  padding: 0;
  aspect-ratio: 1;
  border-radius: 16px;
  background: var(--paper-2) center / cover no-repeat;
  color: var(--ink);
  cursor: pointer;
  position: relative;
  overflow: hidden;
  display: grid;
  place-items: center;
  box-shadow: 0 1px 3px var(--shadow-ink);
  transition: transform 0.15s, border-color 0.2s, box-shadow 0.2s;
}
.picopt:active { transform: scale(0.97); }
.picopt[aria-checked="true"] { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in oklab, var(--accent) 30%, transparent); }
.picopt .label {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 14px 8px 6px;
  font: 600 12px var(--sans);
  text-align: center;
  color: #fff;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.6));
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}
.picopt.plain .label { color: var(--ink); background: none; text-shadow: none; }
.picopt .big { font-family: var(--serif); font-weight: 600; font-size: 34px; margin-bottom: 14px; }
.picopt svg { width: 32px; height: 32px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; margin-bottom: 14px; }

.toggle { display: flex; align-items: center; gap: 12px; margin-top: 18px; cursor: pointer; font-size: 15px; }
.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%, transparent); 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(25, 32, 40, 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.25);
}
.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; }
  .brand img { width: 32px; height: 32px; }
  .bar { padding-top: 2px; }
  .stat { padding: 3px 8px; }
  .stat b { font-size: 16px; }
  .stage { padding: 6px 16px; }
  .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; }
  .seg button { padding: 6px 9px; font-size: 12.5px; }
  .stat { min-width: 52px; padding: 4px 6px; }
}
@media (min-width: 900px) and (min-height: 700px) {
  .brand b { font-size: 26px; }
  .stage { padding: 14px 16px; }
}

@media (prefers-reduced-motion: reduce) {
  .bg .blob { animation: none; }
  .tile, .face, .sheet, .dialog, .backdrop, .preview, .grid { animation: none !important; transition-duration: 0.01s !important; }
  .board.won .face::after { display: none; }
}
