/* Reversi — lacquer, baize and stone. Every colour that changes with the
   look is a custom property set under [data-theme]; discs are two real faces
   in 3D that turn over on a per-direction axis. */

:root {
  --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;
  --ease: cubic-bezier(0.4, 0.1, 0.2, 1);
  --spring: cubic-bezier(0.25, 0.8, 0.3, 1);
  --flip-ms: 440ms;
  --cell: 40px;
  --n: 8;
  --noise: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .5 0 0 0 0 .5 0 0 0 0 .5 0 0 0 .7 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ------------------------------------------------------------- themes */
/* Club: green baize in a walnut frame, classic bevelled discs (light page) */
:root,
[data-theme="club"] {
  color-scheme: light;
  --bg-a: #efe8da;
  --bg-b: #d6cfbd;
  --glow-1: rgba(255, 251, 242, 0.85);
  --glow-2: rgba(47, 115, 82, 0.16);
  --ink: #2a241c;
  --ink-soft: #6d6354;
  --chip-bg: rgba(255, 255, 255, 0.42);
  --chip-line: rgba(255, 255, 255, 0.65);
  --chip-shadow: 0 1px 2px rgba(60, 45, 30, 0.08);
  --active-bg: rgba(255, 255, 255, 0.78);
  --btn-bg: rgba(255, 255, 255, 0.55);
  --btn-hover: rgba(255, 255, 255, 0.85);
  --btn-line: rgba(60, 45, 30, 0.14);
  --primary-a: #357c59;
  --primary-b: #1e5038;
  --primary-line: #143826;
  --primary-ink: #f7f2e5;
  --paper: #f8f4ec;
  --paper-2: #ede6d9;
  --line: rgba(60, 45, 30, 0.13);
  --accent: #2f7352;
  --accent-soft: rgba(47, 115, 82, 0.22);
  --backdrop: rgba(40, 32, 20, 0.4);
  --toast: rgba(36, 30, 22, 0.92);

  --frame-bg: var(--frame-img, #5a3824) center / cover;
  --frame-light: linear-gradient(160deg, rgba(255, 230, 200, 0.22), rgba(255, 255, 255, 0) 38%, rgba(0, 0, 0, 0.28));
  --frame-shadow: 0 26px 50px -20px rgba(40, 25, 12, 0.65), 0 8px 16px -6px rgba(40, 25, 12, 0.4), inset 0 1px 1px rgba(255, 230, 200, 0.35), inset 0 -2px 3px rgba(0, 0, 0, 0.4);
  --inlay: #c6a05a;
  --surface-bg: radial-gradient(120% 100% at 45% 30%, #2f7d57 0%, #236242 55%, #18492f 100%);
  --surface-texture: var(--noise);
  --texture-opacity: 0.32;
  --surface-sheen: radial-gradient(90% 70% at 30% 18%, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0) 60%);
  --surface-inset: inset 0 0 0.9em rgba(0, 0, 0, 0.45), inset 0 2px 3px rgba(0, 0, 0, 0.35);
  --grid-line: rgba(6, 28, 16, 0.6);
  --grid-w: 1.1px;
  --grid-shadow: none;
  --star-1: #12301f;
  --star-2: #0a1d12;
  --dot: rgba(240, 236, 220, 0.42);
  --dot-shadow: 0 1px 1px rgba(0, 0, 0, 0.25);
  --last: #e2533b;
  --focus: rgba(255, 244, 214, 0.9);
  --hint: #ffe7a3;
  --b-face:
    radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0) 0 64%, rgba(255, 255, 255, 0.07) 67%, rgba(255, 255, 255, 0) 71%),
    radial-gradient(circle at 34% 28%, rgba(255, 255, 255, 0.28) 0, rgba(255, 255, 255, 0) 38%),
    radial-gradient(circle at 50% 50%, #2c2d31 0%, #18191c 62%, #0b0b0d 100%);
  --b-bevel: inset 0.03em 0.04em 0.05em rgba(255, 255, 255, 0.2), inset -0.03em -0.05em 0.07em rgba(0, 0, 0, 0.7);
  --w-face:
    radial-gradient(circle at 50% 50%, rgba(0, 0, 0, 0) 0 64%, rgba(90, 80, 60, 0.12) 67%, rgba(0, 0, 0, 0) 71%),
    radial-gradient(circle at 34% 28%, #ffffff 0, rgba(255, 255, 255, 0) 45%),
    radial-gradient(circle at 50% 50%, #f7f5f0 0%, #ebe7de 60%, #d4cfc4 100%);
  --w-bevel: inset 0.03em 0.04em 0.05em rgba(255, 255, 255, 0.9), inset -0.03em -0.05em 0.08em rgba(70, 60, 45, 0.38);
  --edge: #57534c;
  --disc-shadow: rgba(0, 18, 8, 0.62);
}

/* Lacquer: black urushi, vermilion lines, gold leaf; obsidian and mother-of-pearl */
[data-theme="lacquer"] {
  color-scheme: dark;
  --bg-a: #1a120f;
  --bg-b: #080605;
  --glow-1: rgba(201, 69, 44, 0.16);
  --glow-2: rgba(217, 178, 92, 0.09);
  --ink: #f1e8da;
  --ink-soft: rgba(241, 232, 218, 0.6);
  --chip-bg: rgba(255, 236, 214, 0.045);
  --chip-line: rgba(255, 222, 186, 0.09);
  --chip-shadow: none;
  --active-bg: rgba(255, 236, 214, 0.1);
  --btn-bg: rgba(255, 236, 214, 0.06);
  --btn-hover: rgba(255, 236, 214, 0.11);
  --btn-line: rgba(255, 222, 186, 0.13);
  --primary-a: #d0503a;
  --primary-b: #962817;
  --primary-line: #5f170c;
  --primary-ink: #fff4e6;
  --paper: #1d1613;
  --paper-2: #2a201c;
  --line: rgba(255, 222, 186, 0.1);
  --accent: #dcb662;
  --accent-soft: rgba(220, 182, 98, 0.2);
  --backdrop: rgba(4, 2, 2, 0.62);
  --toast: rgba(40, 30, 26, 0.95);

  --frame-bg: var(--flakes-img, none) 0 0 / 260px 260px, radial-gradient(130% 100% at 22% 12%, #2a201b 0%, #110c0a 42%, #050404 100%);
  --frame-light: linear-gradient(150deg, rgba(255, 238, 220, 0.12), rgba(255, 255, 255, 0) 30%, rgba(255, 255, 255, 0) 72%, rgba(255, 220, 190, 0.05));
  --frame-shadow: 0 30px 60px -18px rgba(0, 0, 0, 0.85), 0 8px 18px -6px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 236, 214, 0.16), inset 0 -2px 4px rgba(0, 0, 0, 0.7);
  --inlay: #b8913f;
  --surface-bg:
    linear-gradient(122deg, rgba(255, 255, 255, 0) 22%, rgba(255, 244, 230, 0.07) 33%, rgba(255, 244, 230, 0.025) 40%, rgba(255, 255, 255, 0) 50%),
    linear-gradient(180deg, rgba(255, 236, 214, 0.05), rgba(255, 255, 255, 0) 18%),
    linear-gradient(160deg, #110c0a 0%, #080605 55%, #030202 100%);
  --surface-texture: none;
  --texture-opacity: 0;
  --surface-sheen: none;
  --surface-inset: inset 0 0 1em rgba(0, 0, 0, 0.8), inset 0 1px 0 rgba(255, 236, 214, 0.07);
  --grid-line: rgba(214, 78, 50, 0.78);
  --grid-w: 1.15px;
  --grid-shadow: drop-shadow(0 0 1.5px rgba(214, 78, 50, 0.35));
  --star-1: #f8df92;
  --star-2: #a77a28;
  --dot: rgba(220, 182, 98, 0.5);
  --dot-shadow: 0 0 6px rgba(220, 182, 98, 0.25);
  --last: #ef6a4c;
  --focus: rgba(240, 210, 140, 0.95);
  --hint: #f3d27e;
  --b-face:
    radial-gradient(circle at 33% 27%, rgba(255, 255, 255, 0.62) 0 2.5%, rgba(255, 255, 255, 0.2) 8%, rgba(255, 255, 255, 0) 24%),
    radial-gradient(ellipse 60% 35% at 50% 84%, rgba(150, 172, 205, 0.2) 0, rgba(150, 172, 205, 0) 100%),
    radial-gradient(circle at 46% 40%, #3a3c44 0%, #17181c 50%, #050506 100%);
  --b-bevel: inset 0 0 0 0.012em rgba(255, 255, 255, 0.06), inset 0 0.035em 0.05em rgba(255, 255, 255, 0.16), inset 0 -0.05em 0.09em rgba(0, 0, 0, 0.8);
  --w-face:
    radial-gradient(circle at 33% 27%, rgba(255, 255, 255, 0.98) 0 3%, rgba(255, 255, 255, 0.45) 10%, rgba(255, 255, 255, 0) 28%),
    radial-gradient(circle at 50% 50%, rgba(0, 0, 0, 0) 56%, rgba(96, 76, 66, 0.26) 100%),
    conic-gradient(from 200deg at 54% 52%, #f5ede3, #e1eaf3, #f2e2ec, #ddeee6, #f6ecd9, #e8e3f4, #f5ede3);
  --w-bevel: inset 0 0.035em 0.05em rgba(255, 255, 255, 0.75), inset 0 -0.05em 0.09em rgba(80, 58, 48, 0.4);
  --edge: #3a302b;
  --disc-shadow: rgba(0, 0, 0, 0.82);
}

/* Stone: light marble in a slate frame; slate and alabaster discs */
[data-theme="stone"] {
  color-scheme: light;
  --bg-a: #f0f1f2;
  --bg-b: #d5d9dc;
  --glow-1: rgba(255, 255, 255, 0.95);
  --glow-2: rgba(110, 130, 150, 0.16);
  --ink: #252b32;
  --ink-soft: #66707b;
  --chip-bg: rgba(255, 255, 255, 0.5);
  --chip-line: rgba(255, 255, 255, 0.75);
  --chip-shadow: 0 1px 2px rgba(40, 50, 60, 0.08);
  --active-bg: rgba(255, 255, 255, 0.86);
  --btn-bg: rgba(255, 255, 255, 0.6);
  --btn-hover: rgba(255, 255, 255, 0.9);
  --btn-line: rgba(40, 50, 60, 0.14);
  --primary-a: #66727f;
  --primary-b: #3c4550;
  --primary-line: #2b323a;
  --primary-ink: #f6f3ec;
  --paper: #f8f8f6;
  --paper-2: #eceeee;
  --line: rgba(40, 50, 60, 0.12);
  --accent: #4d5b69;
  --accent-soft: rgba(77, 91, 105, 0.2);
  --backdrop: rgba(30, 36, 44, 0.38);
  --toast: rgba(37, 43, 50, 0.92);

  --frame-bg: var(--frame-img, #555e68) center / cover;
  --frame-light: linear-gradient(155deg, rgba(255, 255, 255, 0.24), rgba(255, 255, 255, 0) 36%, rgba(0, 0, 0, 0.22));
  --frame-shadow: 0 24px 46px -20px rgba(30, 40, 50, 0.55), 0 6px 14px -6px rgba(30, 40, 50, 0.35), inset 0 1px 1px rgba(255, 255, 255, 0.35), inset 0 -2px 3px rgba(0, 0, 0, 0.3);
  --inlay: rgba(255, 255, 255, 0.4);
  --surface-bg: var(--surface-img, #ebe9e4) center / cover;
  --surface-texture: none;
  --texture-opacity: 0;
  --surface-sheen: radial-gradient(100% 80% at 30% 15%, rgba(255, 255, 255, 0.4), rgba(255, 255, 255, 0) 60%);
  --surface-inset: inset 0 0 0.8em rgba(60, 60, 60, 0.18), inset 0 2px 3px rgba(40, 40, 40, 0.18);
  --grid-line: rgba(70, 80, 92, 0.62);
  --grid-w: 1.1px;
  --grid-shadow: drop-shadow(0 1px 0 rgba(255, 255, 255, 0.85));
  --star-1: #6b7581;
  --star-2: #46505b;
  --dot: rgba(60, 72, 86, 0.36);
  --dot-shadow: 0 1px 0 rgba(255, 255, 255, 0.7);
  --last: #c4583c;
  --focus: rgba(60, 72, 86, 0.85);
  --hint: #d08a3c;
  --b-face:
    radial-gradient(circle at 34% 28%, rgba(255, 255, 255, 0.3) 0, rgba(255, 255, 255, 0) 34%),
    radial-gradient(circle at 50% 45%, #66727f 0%, #4a5561 58%, #343d47 100%);
  --b-bevel: inset 0.02em 0.035em 0.04em rgba(255, 255, 255, 0.28), inset -0.02em -0.045em 0.07em rgba(10, 16, 24, 0.55);
  --w-face:
    radial-gradient(circle at 34% 28%, rgba(255, 255, 255, 1) 0, rgba(255, 255, 255, 0) 42%),
    radial-gradient(circle at 60% 66%, rgba(236, 214, 182, 0.4) 0, rgba(236, 214, 182, 0) 50%),
    radial-gradient(circle at 50% 50%, #fbf8f1 0%, #efe8dc 60%, #d9cfbf 100%);
  --w-bevel: inset 0.02em 0.035em 0.04em rgba(255, 255, 255, 0.95), inset -0.02em -0.045em 0.08em rgba(110, 92, 70, 0.32);
  --edge: #8f887d;
  --disc-shadow: rgba(30, 38, 48, 0.5);
}

/* before the script runs, dark mode starts on lacquer (no flash) */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    color-scheme: dark;
    --bg-a: #1a120f;
    --bg-b: #080605;
    --ink: #f1e8da;
    --ink-soft: rgba(241, 232, 218, 0.6);
    --chip-bg: rgba(255, 236, 214, 0.045);
    --chip-line: rgba(255, 222, 186, 0.09);
    --btn-bg: rgba(255, 236, 214, 0.06);
    --btn-line: rgba(255, 222, 186, 0.13);
    --frame-bg: #0d0908;
    --surface-bg: #0d0908;
  }
}

* { 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)) fixed;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  -webkit-text-size-adjust: 100%;
  touch-action: manipulation;
}

/* ---------------------------------------------------------- background */
.bg {
  position: fixed;
  inset: 0;
  overflow: hidden;
  z-index: 0;
  pointer-events: none;
}
.bg .glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  will-change: transform;
}
.bg .g1 { width: 70vmax; height: 70vmax; left: -25vmax; top: -30vmax; background: var(--glow-1); animation: drift 56s ease-in-out infinite alternate; }
.bg .g2 { width: 60vmax; height: 60vmax; right: -25vmax; bottom: -25vmax; background: var(--glow-2); animation: drift 70s ease-in-out infinite alternate-reverse; }
@keyframes drift {
  from { transform: translate(0, 0) scale(1); }
  to { transform: translate(7vmax, 5vmax) scale(1.1); }
}

/* -------------------------------------------------------------- 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;
  gap: 8px;
  padding: 10px 12px 4px 16px;
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand img { width: 40px; height: 40px; flex: 0 0 auto; filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.25)); }
.brand span { display: flex; flex-direction: column; line-height: 1.1; min-width: 0; }
.brand b { font-family: var(--serif); font-weight: 600; font-size: 23px; letter-spacing: 0.02em; }
.brand small {
  font-size: 11px;
  color: var(--ink-soft);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.menu { display: flex; gap: 2px; flex: 0 0 auto; }

.icon-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--ink);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background 0.2s, transform 0.2s;
}
.icon-btn:hover { background: var(--btn-bg); }
.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; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* -------------------------------------------------------------- players */
/* plates and board travel together as one table, centred in the stage */
.table {
  --plates: 58px;
  width: min(100cqw, 100cqh - var(--plates) - 12px);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.players {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.plate {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 6px 12px 6px 6px;
  border-radius: 999px;
  background: var(--chip-bg);
  border: 1px solid var(--chip-line);
  box-shadow: var(--chip-shadow);
  transition: background 0.35s, box-shadow 0.35s, opacity 0.35s;
}
.plate + .plate { flex-direction: row-reverse; padding: 6px 6px 6px 12px; text-align: right; }
.plate::after {
  content: "";
  position: absolute;
  left: 18%;
  right: 18%;
  bottom: -1px;
  height: 2.5px;
  border-radius: 2px;
  background: var(--accent);
  transform: scaleX(0);
  opacity: 0;
  transition: transform 0.4s var(--ease), opacity 0.3s;
}
.plate.active { background: var(--active-bg); }
.plate.active::after { transform: scaleX(1); opacity: 1; }
.plate.won { box-shadow: 0 0 0 1.5px var(--accent), 0 6px 20px -8px var(--accent); }
.chip {
  flex: 0 0 auto;
  display: inline-block;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  font-size: 30px;
}
.chip.c1 { background: var(--b-face); box-shadow: var(--b-bevel), 0 2px 3px rgba(0, 0, 0, 0.3); }
.chip.c2 { background: var(--w-face); box-shadow: var(--w-bevel), 0 2px 3px rgba(0, 0, 0, 0.25); }
/* the live score sits on a disc of its colour */
.token {
  flex: 0 0 auto;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  font-size: 46px;
  display: grid;
  place-items: center;
}
.token.c1 { background: var(--b-face); box-shadow: var(--b-bevel), 0 3px 6px -1px rgba(0, 0, 0, 0.4); color: #f4efe6; }
.token.c2 { background: var(--w-face); box-shadow: var(--w-bevel), 0 3px 6px -1px rgba(0, 0, 0, 0.3); color: #2a231c; }
.token.bump { animation: bump 0.22s var(--ease); }
.who { display: flex; flex-direction: column; min-width: 0; flex: 1; line-height: 1.15; }
.who b { font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who small {
  font-size: 10.5px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--ink-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 3px;
}
.plate.thinking small::after {
  content: "...";
  display: inline-block;
  vertical-align: bottom;
  width: 1.3em;
  text-align: left;
  animation: dots 1.4s steps(4, jump-none) infinite;
  clip-path: inset(0 100% 0 0);
}
.plate + .plate.thinking small::after { margin-right: -1.3em; }
@keyframes dots {
  from { clip-path: inset(0 100% 0 0); }
  to { clip-path: inset(0 0 0 0); }
}
.count {
  font-family: var(--serif);
  font-size: 19px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  letter-spacing: -0.01em;
}
@keyframes bump { 50% { transform: scale(1.1); } }

/* ---------------------------------------------------------------- stage */
.stage {
  flex: 1;
  min-height: 0;
  container-type: size;
  display: grid;
  place-items: center;
  padding: 6px 14px 8px;
  position: relative;
}

.board {
  --pad: 3.4%;
  width: 100%;
  aspect-ratio: 1;
  position: relative;
  border-radius: 2.6%;
  padding: var(--pad);
  background: var(--frame-bg);
  box-shadow: var(--frame-shadow);
}
.board::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: var(--frame-light);
  pointer-events: none;
}
/* gold / brass inlay line between frame and playing surface */
.board::after {
  content: "";
  position: absolute;
  inset: calc(var(--pad) * 0.55);
  border-radius: 1.4%;
  border: 1px solid var(--inlay);
  opacity: 0.75;
  pointer-events: none;
}

.surface {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 0.6%;
  background: var(--surface-bg);
  box-shadow: var(--surface-inset);
  touch-action: none;
  cursor: default;
  z-index: 1;
}
.surface::before,
.surface::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
}
.surface::before { background: var(--surface-texture); opacity: var(--texture-opacity); mix-blend-mode: overlay; }
.surface::after { background: var(--surface-sheen); box-shadow: var(--surface-inset); }

.grid {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  filter: var(--grid-shadow);
}
.grid .lines { fill: none; stroke: var(--grid-line); stroke-width: var(--grid-w); vector-effect: non-scaling-stroke; shape-rendering: geometricPrecision; }
.grid .border { fill: none; stroke: var(--grid-line); stroke-width: calc(var(--grid-w) * 1.8); vector-effect: non-scaling-stroke; }
.grid .star { fill: url(#star-fill); }
.grid .s1 { stop-color: var(--star-1); }
.grid .s2 { stop-color: var(--star-2); }
.grid .leaf { display: none; }
[data-theme="lacquer"] .grid .star { display: none; }
[data-theme="lacquer"] .grid .leaf { display: inline; fill: url(#star-fill); }

.layer { position: absolute; inset: 0; pointer-events: none; }

.disc, .mark, .last-dot, .focus-ring {
  position: absolute;
  left: 0;
  top: 0;
  width: calc(100% / var(--n));
  height: calc(100% / var(--n));
  transform: translate(calc(var(--c) * 100%), calc(var(--r) * 100%));
}

/* ----------------------------------------------------------------- discs */
.disc {
  --ax: 0;
  --ay: 1;
  --delay: 0ms;
  font-size: var(--cell);
  perspective: 2.4em;
}
.disc .shadow {
  position: absolute;
  inset: 9%;
  border-radius: 50%;
  background: radial-gradient(closest-side, var(--disc-shadow) 0%, var(--disc-shadow) 62%, transparent 100%);
  transform: translate(0.03em, 0.07em) scale(1.04);
  opacity: 0.85;
}
.disc .spin {
  position: absolute;
  inset: 9%;
  transform-style: preserve-3d;
}
.face, .core {
  position: absolute;
  inset: 0;
  border-radius: 50%;
}
.face {
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}
.face::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: #000;
  opacity: 0;
}
.face.front { transform: translateZ(0.045em); }
.face.back { transform: rotate3d(var(--ax), var(--ay), 0, 180deg) translateZ(0.045em); }
.core { inset: 1.5%; background: var(--edge); }
.disc.b .front, .disc.w .back { background: var(--b-face); box-shadow: var(--b-bevel); }
.disc.w .front, .disc.b .back { background: var(--w-face); box-shadow: var(--w-bevel); }

/* turning over: a lift, a half turn on the axis across the flip line, and
   the face darkening as it tilts away from the light */
.disc.flip .spin { animation: flip var(--flip-ms) cubic-bezier(0.45, 0.05, 0.3, 1) var(--delay) both; }
.disc.flip .shadow { animation: lift var(--flip-ms) cubic-bezier(0.45, 0.05, 0.3, 1) var(--delay) both; }
.disc.flip .front::after { animation: dim-out var(--flip-ms) linear var(--delay) both; }
.disc.flip .back::after { animation: dim-in var(--flip-ms) linear var(--delay) both; }
@keyframes flip {
  0% { transform: translateY(0) rotate3d(var(--ax), var(--ay), 0, 0deg) scale(1); }
  50% { transform: translateY(-0.06em) rotate3d(var(--ax), var(--ay), 0, 90deg) scale(1.16); }
  100% { transform: translateY(0) rotate3d(var(--ax), var(--ay), 0, 180deg) scale(1); }
}
@keyframes lift {
  0%, 100% { transform: translate(0.03em, 0.07em) scale(1.04); opacity: 0.85; }
  50% { transform: translate(0.1em, 0.2em) scale(1.12); opacity: 0.4; }
}
@keyframes dim-out {
  0% { opacity: 0; }
  50%, 100% { opacity: 0.6; }
}
@keyframes dim-in {
  0%, 50% { opacity: 0.6; }
  100% { opacity: 0; }
}

/* set down: dropped from a little height, a tiny settle */
.disc.drop { animation: fade-in 0.18s ease-out both; }
.disc.drop .spin { animation: drop 0.4s var(--spring) both; }
.disc.drop .shadow { animation: drop-shadow 0.4s var(--spring) both; }
@keyframes fade-in { from { opacity: 0; } }
@keyframes drop {
  0% { transform: translateY(-0.2em) scale(1.3); }
  55% { transform: translateY(0) scale(0.965); }
  78% { transform: translateY(0) scale(1.018); }
  100% { transform: translateY(0) scale(1); }
}
@keyframes drop-shadow {
  0% { transform: translate(0.16em, 0.32em) scale(1.3); opacity: 0; }
  55%, 100% { transform: translate(0.03em, 0.07em) scale(1.04); opacity: 0.85; }
}
.disc.gone { animation: gone 0.28s ease-in both; }
@keyframes gone { to { opacity: 0; transform: translate(calc(var(--c) * 100%), calc(var(--r) * 100% - 12%)) scale(1.1); } }

/* reduced motion: the colour simply changes, with a soft fade */
.disc.swap .spin { animation: swap 0.22s ease-out; }
@keyframes swap { from { opacity: 0.35; } }

/* discs a pressed / hinted move would turn: they tip towards turning */
.disc.would .spin { animation: tip 1.1s ease-in-out infinite; }
@keyframes tip {
  0%, 100% { transform: rotate3d(var(--ax), var(--ay), 0, 0deg) scale(1); }
  50% { transform: rotate3d(var(--ax), var(--ay), 0, 26deg) scale(1.05); }
}

/* end of game: discs gather by colour */
.discs.tally .disc { transition: transform 0.62s cubic-bezier(0.3, 0.7, 0.2, 1) var(--td, 0ms); }
.discs.tally .disc.counted .spin { animation: counted 0.3s var(--ease); }
@keyframes counted { 50% { transform: scale(1.12); } }

/* ----------------------------------------------------------------- marks */
.mark { display: grid; place-items: center; }
.mark.legal::before {
  content: "";
  width: 17%;
  height: 17%;
  border-radius: 50%;
  background: var(--dot);
  box-shadow: var(--dot-shadow);
  animation: dot-in 0.4s var(--ease) both;
}
.marks.quiet .mark.legal::before,
.mark.ghost:not(.hint).legal::before { display: none; }
@keyframes dot-in { from { opacity: 0; transform: scale(0.3); } }
.mark.ghost::after {
  content: "";
  position: absolute;
  inset: 9%;
  border-radius: 50%;
  opacity: 0.55;
  font-size: var(--cell);
}
.mark.ghost.g1::after { background: var(--b-face); box-shadow: var(--b-bevel); }
.mark.ghost.g2::after { background: var(--w-face); box-shadow: var(--w-bevel); }
.mark.hint::before {
  content: "";
  position: absolute;
  inset: 4%;
  border-radius: 50%;
  border: 2px solid var(--hint);
  box-shadow: 0 0 12px var(--hint), inset 0 0 8px var(--hint);
  animation: ring 1.2s ease-in-out infinite;
  width: auto;
  height: auto;
  background: none;
}
@keyframes ring { 50% { opacity: 0.45; transform: scale(0.92); } }
.mark.no::before {
  content: "";
  position: absolute;
  inset: 22%;
  border-radius: 50%;
  border: 2px solid var(--last);
  opacity: 0;
  animation: no 0.5s ease-out;
  width: auto;
  height: auto;
  background: none;
}
@keyframes no {
  0% { opacity: 0.9; transform: translateX(0); }
  25% { transform: translateX(-8%); }
  50% { transform: translateX(7%); }
  75% { transform: translateX(-4%); opacity: 0.6; }
  100% { opacity: 0; transform: translateX(0); }
}

.last-dot::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 13%;
  height: 13%;
  margin: -6.5% 0 0 -6.5%;
  border-radius: 50%;
  background: var(--last);
  box-shadow: 0 0 6px color-mix(in oklab, var(--last) 70%, transparent), 0 1px 1px rgba(0, 0, 0, 0.35);
  animation: dot-in 0.3s var(--ease) both;
}
.focus-ring::before {
  content: "";
  position: absolute;
  inset: 3%;
  border-radius: 18%;
  border: 2px solid var(--focus);
  box-shadow: 0 0 10px color-mix(in oklab, var(--focus) 45%, transparent);
}
.focus-ring { transition: transform 0.14s var(--ease); }

/* ---------------------------------------------------------------- banner */
.banner {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 3;
  width: max-content;
  max-width: min(86%, 380px);
  padding: 11px 18px;
  border-radius: 16px;
  background: var(--toast);
  color: #fff;
  font-size: 14.5px;
  line-height: 1.4;
  text-align: center;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.3);
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.96);
  pointer-events: none;
  transition: opacity 0.3s, transform 0.3s var(--ease);
}
.banner.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.banner.end {
  top: auto;
  bottom: 0;
  transform: translate(-50%, 50%) scale(0.96);
  font-family: var(--serif);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 7px 16px;
  border-radius: 999px;
}
.banner.end.show { transform: translate(-50%, 50%) scale(1); }

/* --------------------------------------------------------------- actions */
.actions {
  display: flex;
  gap: 10px;
  padding: 6px 16px 14px;
}
.btn {
  appearance: none;
  flex: 1;
  border: 1px solid var(--btn-line);
  background: var(--btn-bg);
  color: var(--ink);
  font: 500 15px var(--sans);
  padding: 11px 12px;
  min-height: 46px;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: transform 0.15s, background 0.2s, opacity 0.2s, box-shadow 0.2s;
}
.btn svg { width: 19px; height: 19px; }
.btn:hover { background: var(--btn-hover); }
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.38; cursor: default; transform: none; }
.btn.primary {
  background: linear-gradient(180deg, var(--primary-a), var(--primary-b));
  color: var(--primary-ink);
  border-color: var(--primary-line);
  box-shadow: 0 4px 12px -4px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.22);
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.25);
}
.btn.primary:hover { filter: brightness(1.06); }
.btn.thinking { animation: breathe 0.8s ease-in-out infinite; }
.btn.subtle { flex: 0 0 auto; background: transparent; border-color: transparent; color: var(--ink-soft); font-size: 13.5px; margin: 18px auto 0; display: flex; }
@keyframes breathe { 50% { opacity: 0.62; } }

/* -------------------------------------------------------- sheets, dialogs */
.backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: var(--backdrop);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  animation: fade 0.25s;
}
.backdrop.soft { background: rgba(0, 0, 0, 0.28); backdrop-filter: none; -webkit-backdrop-filter: none; }
@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: 88dvh;
  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.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;
  -webkit-user-select: text;
  user-select: text;
}
.sheet-body h3 { font-family: var(--serif); font-weight: 600; font-size: 17px; margin: 20px 0 8px; color: var(--ink); }
.sheet-body h3:first-child { margin-top: 6px; }
.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: 84dvh;
    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);
  color: var(--ink);
  border-radius: 24px;
  padding: 26px 22px 22px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
  text-align: center;
  animation: popc 0.32s var(--ease);
  overflow: hidden;
}
@keyframes popc { from { opacity: 0; transform: translate(-50%, -46%) scale(0.95); } }
.dialog p { position: relative; margin: 6px 0 18px; color: var(--ink-soft); font-size: 15.5px; line-height: 1.5; }
.dialog .row { position: relative; display: flex; gap: 10px; }
.dialog .row .btn { min-width: 0; }
.result .glow {
  position: absolute;
  inset: -45% -20% auto;
  height: 75%;
  background: radial-gradient(ellipse at 50% 42%, var(--accent-soft), transparent 66%);
  pointer-events: none;
}
.result[data-outcome="win"] .glow, .result[data-outcome="black"] .glow, .result[data-outcome="white"] .glow { background: radial-gradient(ellipse at 50% 42%, color-mix(in oklab, var(--accent) 45%, transparent), transparent 66%); }
.result h2 { position: relative; font-size: 30px; }
.result[data-outcome="win"] h2 { animation: shimmer 2.6s ease-in-out infinite; }
@keyframes shimmer { 50% { text-shadow: 0 0 18px color-mix(in oklab, var(--accent) 70%, transparent); } }
.final {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin: 14px 0 2px;
}
.final .side { display: inline-flex; align-items: center; gap: 10px; }
.final b { font-family: var(--serif); font-size: 46px; font-weight: 600; line-height: 1; font-variant-numeric: tabular-nums; min-width: 1.15em; }
.final .dash { font-family: var(--serif); font-size: 30px; color: var(--ink-soft); }
.final .chip { width: 34px; height: 34px; font-size: 34px; }
.result-stats {
  position: relative;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
  margin: -4px 0 18px;
}
.result-stats > span {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  background: var(--paper-2);
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.result-stats b { font-family: var(--serif); font-size: 16px; font-weight: 600; color: var(--ink); letter-spacing: 0; }
/* phones: the result card sits low, so the gathered discs stay in view */
@media (max-width: 600px) and (min-height: 600px) {
  .dialog.result {
    top: auto;
    bottom: calc(12px + env(safe-area-inset-bottom));
    transform: translateX(-50%);
    padding: 20px 20px 18px;
    animation: popb 0.34s var(--ease);
  }
  .result h2 { font-size: 27px; }
  .final { margin-top: 8px; }
  .final b { font-size: 40px; }
  .dialog.result p { margin: 4px 0 12px; }
}
@keyframes popb { from { opacity: 0; transform: translate(-50%, 24px); } }

/* ------------------------------------------------------------- results */
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: 10.5px; 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.lvl { font-weight: 500; }
td.best { font-family: var(--serif); font-weight: 600; font-size: 15px; }
tr[data-outcome="win"] td.res, tr[data-outcome="black"] td.res, tr[data-outcome="white"] td.res { color: var(--accent); font-weight: 600; }
tr[data-outcome="loss"] td.res { color: var(--ink-soft); }
td.score { font-family: var(--serif); font-weight: 600; font-size: 14.5px; }
td.score .mini { display: inline-block; width: 10px; height: 10px; border-radius: 50%; vertical-align: -1px; margin-right: 5px; font-size: 10px; }
td.score .mini.after { margin: 0 0 0 5px; }
td.score .mini.c1 { background: var(--b-face); box-shadow: var(--b-bevel); }
td.score .mini.c2 { background: var(--w-face); box-shadow: var(--w-bevel), 0 0 0 0.5px rgba(0, 0, 0, 0.25); }
.local-count { margin: 10px 0 0; font-size: 13.5px; }
@media (max-width: 420px) {
  table.recent { font-size: 12.5px; }
  table.recent td, table.recent th { padding-left: 2px; padding-right: 2px; }
  table.recent td.score { font-size: 13.5px; }
  table.recent td.score .mini { display: none; }
}

/* ------------------------------------------------------------- options */
.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;
  min-height: 44px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, transform 0.15s, box-shadow 0.2s;
}
.opt:active { transform: scale(0.97); }
.opt[aria-checked="true"] { border-color: var(--accent); background: var(--paper); box-shadow: 0 0 0 3px var(--accent-soft); }
.opts.plain .opt { padding-left: 16px; padding-right: 16px; min-width: 84px; justify-content: center; }
.opt .chip { width: 22px; height: 22px; font-size: 22px; }
.swatch {
  display: inline-block;
  width: 26px;
  height: 26px;
  border-radius: 7px;
  flex: 0 0 auto;
  position: relative;
  background:
    linear-gradient(var(--sl), var(--sl)) 50% 0 / 1px 100% no-repeat,
    linear-gradient(var(--sl), var(--sl)) 0 50% / 100% 1px no-repeat,
    var(--sb);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.2);
  overflow: hidden;
}
.swatch::before, .swatch::after { content: ""; position: absolute; width: 9px; height: 9px; border-radius: 50%; }
.swatch::before { left: 3.5px; top: 3.5px; background: var(--sdb); box-shadow: 0 1px 1px rgba(0, 0, 0, 0.4); }
.swatch::after { right: 3.5px; bottom: 3.5px; background: var(--sdw); box-shadow: 0 1px 1px rgba(0, 0, 0, 0.4); }
.choices { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.choice {
  appearance: none;
  text-align: left;
  border: 1.5px solid var(--line);
  background: var(--paper-2);
  color: var(--ink);
  font: 500 15px var(--sans);
  padding: 10px 12px 11px;
  border-radius: 14px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 3px;
  line-height: 1.25;
  transition: border-color 0.2s, background 0.2s, transform 0.15s, box-shadow 0.2s;
}
.choice small { font-size: 12.5px; color: var(--ink-soft); font-weight: 400; }
.choice:active { transform: scale(0.98); }
.choice[aria-checked="true"] { border-color: var(--accent); background: var(--paper); box-shadow: 0 0 0 3px var(--accent-soft); }
.choice .pips { display: flex; gap: 3px; margin-bottom: 3px; }
.choice .pips i { width: 7px; height: 7px; border-radius: 50%; background: var(--line); }
.choice .pips i.on { background: var(--accent); }
.choice .pips.two { gap: 0; }
.choice .pips.two .chip { width: 12px; height: 12px; font-size: 12px; margin: -2.5px 0 -2.5px; }
.choice .pips.two .chip + .chip { margin-left: -3px; }
.chip.split { position: relative; background: none; box-shadow: 0 2px 3px rgba(0, 0, 0, 0.3); }
.chip.split::before, .chip.split::after { content: ""; position: absolute; inset: 0; border-radius: 50%; }
.chip.split::before { background: var(--b-face); box-shadow: var(--b-bevel); clip-path: inset(0 50% 0 0); }
.chip.split::after { background: var(--w-face); box-shadow: var(--w-bevel); clip-path: inset(0 0 0 50%); }
@media (max-width: 420px) {
  .opts .opt { padding: 7px 13px 7px 8px; gap: 7px; }
  .opts.plain .opt { min-width: 0; padding: 7px 15px; }
  .choice { padding: 9px 10px 10px; }
  .choice small { font-size: 12px; }
}
.note { font-size: 13px; color: var(--ink-soft); margin: 10px 0 0; }
.start { width: 100%; margin-top: 22px; flex: none; }
.toggle { display: flex; align-items: center; gap: 12px; margin-top: 18px; cursor: pointer; font-size: 15px; line-height: 1.35; min-height: 32px; }
.toggle input { position: absolute; opacity: 0; width: 0; height: 0; }
.toggle .track { flex: 0 0 auto; width: 46px; height: 28px; border-radius: 999px; background: var(--line); position: relative; transition: background 0.25s; box-shadow: inset 0 0 0 1px var(--line); }
.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(86px + env(safe-area-inset-bottom));
  transform: translateX(-50%) translateY(10px);
  z-index: 15;
  background: var(--toast);
  color: #fff;
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 14px;
  width: max-content;
  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: 680px) {
  .top { padding-top: 6px; }
  .brand img { width: 34px; height: 34px; }
  .brand b { font-size: 20px; }
  .plate { padding-top: 5px; padding-bottom: 5px; }
  .table { --plates: 50px; gap: 10px; }
  .token { width: 40px; height: 40px; font-size: 40px; }
  .count { font-size: 17px; }
  .actions { padding-bottom: 10px; }
  .btn { min-height: 44px; padding: 8px 10px; }
}
@media (max-width: 520px) {
  .btn { flex-direction: column; gap: 3px; padding: 7px 6px 6px; font-size: 12.5px; }
  .btn span { white-space: nowrap; }
  .btn svg { width: 21px; height: 21px; }
  .dialog .btn, .sheet .btn { flex-direction: row; font-size: 14.5px; padding: 11px 10px; }
}
@media (max-width: 374px) {
  .top { padding-left: 12px; padding-right: 8px; }
  .players { gap: 8px; }
  .plate { gap: 8px; padding-right: 10px; }
  .plate + .plate { padding-left: 10px; padding-right: 6px; }
  .who b { font-size: 14px; }
  .actions { padding-left: 12px; padding-right: 12px; gap: 8px; }
}

/* short landscape: the board fills the height on the left; header, plates
   and actions stack beside it */
@media (min-aspect-ratio: 5/4) and (max-height: 620px) {
  .app {
    display: grid;
    max-width: none;
    grid-template-columns: auto minmax(240px, 340px);
    grid-template-rows: auto 1fr auto;
    justify-content: center;
    column-gap: 20px;
    padding-left: max(12px, env(safe-area-inset-left));
    padding-right: max(4px, env(safe-area-inset-right));
  }
  .stage, .table { display: contents; }
  .board {
    grid-column: 1;
    grid-row: 1 / -1;
    align-self: center;
    width: auto;
    height: calc(100dvh - 24px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  }
  .top { grid-column: 2; grid-row: 1; padding-left: 0; }
  .players { grid-column: 2; grid-row: 2; grid-template-columns: 1fr; align-content: center; gap: 10px; padding-right: 12px; }
  .plate + .plate { flex-direction: row; text-align: left; padding: 6px 12px 6px 6px; }
  .plate + .plate.thinking small::after { margin-right: 0; }
  .actions { grid-column: 2; grid-row: 3; padding-left: 0; }
  .actions .btn { flex-direction: column; gap: 3px; padding: 7px 6px 6px; font-size: 12.5px; }
  .actions .btn span { white-space: nowrap; }
}

@media (prefers-reduced-motion: reduce) {
  .bg .glow { animation: none; }
  .disc.flip .spin, .disc.flip .shadow, .disc.flip .front::after, .disc.flip .back::after,
  .disc.drop, .disc.drop .spin, .disc.drop .shadow, .disc.would .spin { animation: none; }
  .discs.tally .disc { transition-duration: 0.01s; }
  .sheet, .dialog, .backdrop, .mark.hint::before, .result h2 { animation: none; }
}
