/* ==========================================================================
   TwisterSpin.com — shared styles
   Tokens: vinyl white, printed navy ink, and the four game colors.
   Each mode owns one color: Yoga = blue, Workout = red,
   Classroom = yellow, Custom = green, Twister = all four.
   ========================================================================== */

@font-face {
  font-family: "Unbounded";
  src: url("/assets/fonts/unbounded.woff2") format("woff2");
  font-weight: 200 900;
  font-display: swap;
}
@font-face {
  font-family: "Atkinson Hyperlegible";
  src: url("/assets/fonts/atkinson-400.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Atkinson Hyperlegible";
  src: url("/assets/fonts/atkinson-700.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}

:root {
  --bg: #F4F6FA;
  --surface: #FFFFFF;
  --surface-2: #EDF0F6;
  --ink: #15172B;
  --ink-2: #33385A;
  --muted: #596079;
  --line: #DCE1EC;
  --line-2: #C3CADB;

  --red: #E8342E;
  --blue: #1E5BE6;
  --yellow: #FFC61A;
  --green: #12A150;

  --focus: #1E5BE6;
  --board: #FFFFFF;
  --board-rim: #15172B;

  --font-display: "Unbounded", ui-rounded, system-ui, sans-serif;
  --font-body: "Atkinson Hyperlegible", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --r-panel: 22px;
  --r-input: 12px;
  --wrap: 1180px;
  --gutter: clamp(16px, 4vw, 32px);

  color-scheme: light;
}

/* Dark theme: a soft slate rather than near-black. Follows the device unless the
   visitor picks Light or Dark in the footer (stored as data-theme on <html>). */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1C2032;
    --surface: #252A40;
    --surface-2: #2E344D;
    --ink: #E3E6F0;
    --ink-2: #C2C7DA;
    --muted: #A0A6C0;
    --line: #363D5A;
    --line-2: #474F72;
    --focus: #8FB0FF;
    --board: #E9ECF4;
    --board-rim: #12142A;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #1C2032;
  --surface: #252A40;
  --surface-2: #2E344D;
  --ink: #E3E6F0;
  --ink-2: #C2C7DA;
  --muted: #A0A6C0;
  --line: #363D5A;
  --line-2: #474F72;
  --focus: #8FB0FF;
  --board: #E9ECF4;
  --board-rim: #12142A;
  color-scheme: dark;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
img, svg { display: block; max-width: 100%; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }

.wrap { width: 100%; max-width: var(--wrap); margin-inline: auto; padding-inline: var(--gutter); }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: 12px; top: -60px; z-index: 100;
  background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 10px;
  text-decoration: none; font-weight: 700;
}
.skip-link:focus { top: 12px; }

h1, h2, h3 { margin: 0; color: var(--ink); }
h1 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.45rem, 0.95rem + 2.6vw, 2.85rem);
  line-height: 1.08;
  letter-spacing: -0.02em;
  max-width: 22ch;
}
h2 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(1.3rem, 1.05rem + 1vw, 1.7rem);
  line-height: 1.2;
  letter-spacing: -0.01em;
}
h3 { font-size: 1.15rem; line-height: 1.3; font-weight: 700; }
p { margin: 0; }

/* ---------- mode dots (color = meaning) ---------- */
.dot {
  display: inline-block; flex: none;
  width: 0.7em; height: 0.7em; border-radius: 50%;
  background: var(--dot, var(--ink));
}
.dot-twister {
  width: 0.9em; height: 0.9em; border-radius: 0;
  background:
    radial-gradient(circle at 25% 25%, var(--red) 0 22%, transparent 23%),
    radial-gradient(circle at 75% 25%, var(--blue) 0 22%, transparent 23%),
    radial-gradient(circle at 25% 75%, var(--yellow) 0 22%, transparent 23%),
    radial-gradient(circle at 75% 75%, var(--green) 0 22%, transparent 23%);
}
.dot-yoga { --dot: var(--blue); }
.dot-workout { --dot: var(--red); }
.dot-kids { --dot: var(--yellow); }
.dot-custom { --dot: var(--green); }
.dot-guide { --dot: transparent; box-shadow: inset 0 0 0 2px var(--ink-2); }

/* ---------- header ---------- */
.site-header { background: var(--bg); border-bottom: 1px solid var(--line); }
.header-inner {
  display: flex; align-items: center; gap: 24px;
  min-height: 68px;
}
.brand {
  display: inline-flex; align-items: center; gap: 10px;
  text-decoration: none; flex: none;
}
.brand-mark { width: 30px; height: 30px; }
.wordmark {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.2rem;
  letter-spacing: -0.03em;
}
.site-nav {
  display: flex; gap: 4px; margin-left: auto;
  overflow-x: auto; scrollbar-width: none;
}
.site-nav::-webkit-scrollbar { display: none; }
.site-nav a {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 12px; border-radius: 999px;
  text-decoration: none; white-space: nowrap;
  color: var(--ink-2); font-weight: 700; font-size: 0.95rem;
}
.site-nav a:hover { background: var(--surface-2); color: var(--ink); }
.site-nav a[aria-current="page"] { background: var(--ink); color: var(--bg); }
.site-nav a[aria-current="page"] .dot-guide { box-shadow: inset 0 0 0 2px var(--bg); }

@media (max-width: 860px) {
  .header-inner { flex-wrap: wrap; gap: 6px 16px; padding-block: 10px; min-height: 0; }
  .site-nav { order: 3; width: 100%; margin-left: calc(var(--gutter) * -1); margin-right: calc(var(--gutter) * -1); padding-inline: var(--gutter); width: calc(100% + var(--gutter) * 2); }
  .header-lang { margin-left: auto; }
  body:has(#app) .site-nav { order: 0; width: auto; margin: 0 0 0 auto; padding: 0; }
  body:has(#app) .site-nav a:not(:last-child) { display: none; }
  body:has(#app) .header-lang { margin-left: 0; }
  body:has(#app) .header-inner { flex-wrap: nowrap; }
}
@media (max-width: 420px) {
  body:has(#app) .wordmark { font-size: 1.05rem; }
  body:has(#app) .site-nav a, body:has(#app) .header-lang { font-size: 0.85rem; padding: 6px 9px; }
  body:has(#app) .site-nav .dot { display: none; }
}
.header-lang {
  font-size: 0.9rem; font-weight: 700; color: var(--muted);
  text-decoration: none; padding: 6px 10px; border-radius: 999px; border: 1.5px solid var(--line);
}
.header-lang:hover { color: var(--ink); border-color: var(--line-2); }

/* ---------- hero ---------- */
.hero { padding-block: clamp(16px, 4vw, 44px) clamp(12px, 2.5vw, 26px); }
@media (max-width: 600px) { .hero .lede { font-size: 0.98rem; line-height: 1.5; margin-top: 8px; } }
.hero .lede {
  margin-top: 12px; max-width: 60ch;
  color: var(--muted); font-size: clamp(1rem, 0.95rem + 0.3vw, 1.15rem);
}
.breadcrumb { font-size: 0.9rem; color: var(--muted); margin-bottom: 10px; }
.breadcrumb a { color: var(--muted); }
.breadcrumb a:hover { color: var(--ink); }

/* ==========================================================================
   TOOL
   ========================================================================== */
.tool { padding-bottom: 8px; }
.tool-loading {
  min-height: 420px; display: grid; place-items: center;
  border: 1.5px dashed var(--line-2); border-radius: var(--r-panel);
  color: var(--muted);
}

.mode-tabs {
  display: flex; gap: 6px; margin-bottom: 18px;
  overflow-x: auto; scrollbar-width: none; padding: 2px;
}
.mode-tabs::-webkit-scrollbar { display: none; }
.tab {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 10px 16px; border-radius: 999px;
  border: 1.5px solid var(--line-2); background: var(--surface);
  font-weight: 700; font-size: 0.98rem; white-space: nowrap; color: var(--ink-2);
}
.tab:hover { border-color: var(--ink-2); color: var(--ink); }
.tab[aria-selected="true"] { background: var(--ink); border-color: var(--ink); color: var(--bg); }

.stage {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(320px, 0.92fr);
  gap: clamp(20px, 3vw, 40px);
  align-items: start;
}
@media (max-width: 880px) { .stage { grid-template-columns: 1fr; } }

/* ---------- board ---------- */
.board-col { position: relative; }
.board-wrap {
  width: min(100%, 580px); aspect-ratio: 1 / 1; margin-inline: auto;
  position: relative;
}
@media (min-width: 881px) { .board-wrap { position: sticky; top: 20px; } }
.board {
  width: 100%; height: 100%;
  cursor: pointer; touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  filter: drop-shadow(0 14px 28px rgba(21, 23, 43, 0.18)) drop-shadow(0 3px 6px rgba(21, 23, 43, 0.12));
}
.board:focus-visible { outline: none; }
.board:focus-visible .board-rim { stroke: var(--focus); }
.board-rim { fill: var(--board); stroke: var(--board-rim); stroke-width: 14; }
.board .board-hub { fill: var(--board); }
.board .q-label { stroke: var(--board); stroke-width: 6px; stroke-linejoin: round; paint-order: stroke; }
.board .q-glyph { stroke: var(--board); stroke-width: 2.6px; stroke-linejoin: round; paint-order: stroke; }
.board-hub-text, .q-label { font-family: var(--font-display); }
.board text { pointer-events: none; user-select: none; }
.board .spot { transition: transform 0.25s ease; transform-box: fill-box; transform-origin: center; }
.board .spot-ring { fill: none; stroke: var(--board-rim); stroke-width: 5; opacity: 0; transform-box: fill-box; transform-origin: center; }
.board .is-win .spot-ring { animation: ring 1.2s ease-out 1 both; }
.board .is-win .spot { animation: pop 0.6s cubic-bezier(.2,1.6,.4,1) 1; }
.board .wedge.is-win { animation: wedgeflash 1.2s ease-out 1; }
@keyframes ring { 0% { opacity: 1; transform: scale(1); } 100% { opacity: 0; transform: scale(1.7); } }
@keyframes pop { 0% { transform: scale(1); } 40% { transform: scale(1.22); } 100% { transform: scale(1); } }
@keyframes wedgeflash { 0%, 30%, 60% { filter: brightness(1.25) saturate(1.1); } 15%, 45%, 100% { filter: none; } }
.arrow { will-change: transform; }

/* ---------- call panel ---------- */
.side-col { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.call {
  --call: var(--line-2);
  position: relative; overflow: hidden;
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: var(--r-panel);
  padding: 20px 22px 18px;
  min-height: 170px;
}
@supports (background: color-mix(in srgb, red 10%, white)) {
  .call { background: color-mix(in srgb, var(--call) 11%, var(--surface)); }
}
.call::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 10px;
  background: var(--call); transition: background-color 0.2s;
}
.call-who { color: var(--muted); font-weight: 700; font-size: 0.98rem; margin-top: 4px; }
.call-who b { color: var(--ink); }
.call-text {
  display: block; margin-top: 6px;
  font-family: var(--font-display); font-weight: 700;
  font-size: clamp(1.6rem, 1.1rem + 2.2vw, 2.4rem);
  line-height: 1.08; letter-spacing: -0.02em;
  overflow-wrap: anywhere;
}
.call-text.is-idle { font-size: clamp(1.15rem, 1rem + 0.8vw, 1.45rem); font-weight: 600; color: var(--ink-2); }
.call-chip {
  display: inline-flex; align-items: center; gap: 10px; margin-top: 12px;
  padding: 6px 14px 6px 6px; border-radius: 999px;
  background: var(--surface); border: 1.5px solid var(--line-2);
  font-weight: 700; font-size: 1.1rem;
}
.call-chip i { width: 28px; height: 28px; border-radius: 50%; background: var(--call); box-shadow: inset 0 0 0 2px rgba(0,0,0,0.08); }
.call.is-fresh .call-text, .call.is-fresh .call-chip { animation: callin 0.42s cubic-bezier(.2,1.3,.4,1) both; }
@keyframes callin { from { transform: translateY(8px) scale(0.98); opacity: 0; } to { transform: none; opacity: 1; } }

.countdown { margin-top: 16px; }
.cd-track { height: 10px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.cd-fill { height: 100%; width: 100%; background: var(--ink); border-radius: inherit; transform-origin: left center; }
.cd-text { margin-top: 8px; font-weight: 700; color: var(--ink-2); font-size: 0.98rem; font-variant-numeric: tabular-nums; }

/* ---------- history ---------- */
.history { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; min-height: 34px; }
.history:empty::before { content: attr(data-empty); color: var(--muted); font-size: 0.92rem; padding-top: 6px; }
.history li {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 5px 11px 5px 7px; border-radius: 999px;
  background: var(--surface); border: 1.5px solid var(--line);
  font-size: 0.88rem; font-weight: 700; color: var(--ink-2); max-width: 100%;
}
.history li:first-child { border-color: var(--ink-2); color: var(--ink); }
.history li i { width: 14px; height: 14px; border-radius: 50%; flex: none; }
.history li span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- actions ---------- */
.actions { display: flex; gap: 10px; align-items: stretch; }
@media (min-width: 881px) { .side-col > .actions { order: -1; } }
@media (max-width: 880px) {
  .actions {
    position: sticky; bottom: 0; z-index: 20;
    margin-inline: calc(var(--gutter) * -1);
    padding: 10px var(--gutter) calc(10px + env(safe-area-inset-bottom));
    background: color-mix(in srgb, var(--bg) 92%, transparent);
    -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
    border-top: 1px solid var(--line);
  }
}
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 56px; padding: 0 22px; border-radius: 999px;
  border: 2px solid transparent;
  font-family: var(--font-display); font-weight: 700; font-size: 1.02rem; letter-spacing: -0.01em;
  transition: transform 0.12s ease, background-color 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.btn:active { transform: scale(0.97); }
.btn svg { width: 22px; height: 22px; flex: none; }
.btn-primary { flex: 1.3; background: var(--ink); color: var(--bg); }
.btn-primary:hover { background: var(--ink-2); }
.btn-primary:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }
.btn-secondary { flex: 1; background: var(--surface); color: var(--ink); border-color: var(--ink); }
.btn-secondary:hover { background: var(--surface-2); }
.btn-secondary[aria-pressed="true"] { background: var(--red); border-color: var(--red); color: #fff; }
.btn-icon { width: 56px; padding: 0; flex: none; background: var(--surface); border-color: var(--line-2); color: var(--ink); }
.btn-icon:hover { border-color: var(--ink); }
.btn-small {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 40px; padding: 0 16px; font-family: var(--font-body); font-weight: 700; font-size: 0.95rem;
  border-radius: 999px; border: 1.5px solid var(--line-2); background: var(--surface); color: var(--ink);
}
.btn-small:hover { border-color: var(--ink); }
.btn-small.is-done { background: var(--green); border-color: var(--green); color: #fff; }
.btn-link { background: none; border: 0; padding: 4px 2px; color: var(--muted); font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
.btn-link:hover { color: var(--ink); }
@media (max-width: 400px) {
  .btn { padding: 0 14px; font-size: 0.95rem; }
  .btn svg { width: 19px; height: 19px; }
}

/* ---------- settings panels ---------- */
.panels { display: flex; flex-direction: column; gap: 10px; }
.panel { background: var(--surface); border: 1.5px solid var(--line); border-radius: 18px; }
.panel > summary {
  list-style: none; cursor: pointer;
  display: flex; align-items: center; gap: 12px;
  padding: 15px 18px; font-weight: 700; font-size: 1.02rem;
}
.panel > summary::-webkit-details-marker { display: none; }
.panel > summary .sum-icon { width: 22px; height: 22px; color: var(--ink-2); flex: none; }
.panel > summary .sum-note { margin-left: auto; color: var(--muted); font-weight: 400; font-size: 0.92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.panel > summary::after {
  content: ""; width: 10px; height: 10px; flex: none;
  border-right: 2.5px solid var(--ink-2); border-bottom: 2.5px solid var(--ink-2);
  transform: rotate(45deg) translate(-2px, -2px); transition: transform 0.2s;
}
.panel[open] > summary::after { transform: rotate(-135deg) translate(-2px, -2px); }
.panel > summary .sum-note + * { margin-left: 0; }
.panel-body { padding: 4px 18px 18px; display: flex; flex-direction: column; gap: 16px; }
.hint { color: var(--muted); font-size: 0.93rem; line-height: 1.5; }

.field { display: flex; flex-direction: column; gap: 8px; }
.field-row { display: flex; align-items: center; gap: 12px; }
.field-row .value { margin-left: auto; }
.field-label { font-weight: 700; font-size: 0.97rem; }
.value { font-family: var(--font-display); font-weight: 600; font-size: 0.98rem; min-width: 64px; text-align: right; font-variant-numeric: tabular-nums; }

input[type="range"] {
  -webkit-appearance: none; appearance: none; flex: 1; min-width: 0;
  height: 30px; background: transparent; margin: 0;
}
input[type="range"]::-webkit-slider-runnable-track { height: 8px; border-radius: 999px; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); }
input[type="range"]::-moz-range-track { height: 8px; border-radius: 999px; background: var(--surface-2); }
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; margin-top: -9px;
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--surface); border: 3px solid var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
input[type="range"]::-moz-range-thumb {
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--surface); border: 3px solid var(--ink);
}
input[type="range"]:focus-visible { outline: none; }
input[type="range"]:focus-visible::-webkit-slider-thumb { outline: 3px solid var(--focus); outline-offset: 2px; }

.switch { display: flex; align-items: center; justify-content: space-between; gap: 14px; cursor: pointer; }
.switch-text { display: flex; flex-direction: column; gap: 2px; }
.switch-text b { font-size: 0.97rem; }
.switch-text small { color: var(--muted); font-size: 0.88rem; line-height: 1.4; }
.switch input {
  -webkit-appearance: none; appearance: none; flex: none; margin: 0;
  width: 50px; height: 30px; border-radius: 999px;
  background: var(--line-2); position: relative; transition: background-color 0.15s; cursor: pointer;
}
.switch input::after {
  content: ""; position: absolute; top: 3px; left: 3px;
  width: 24px; height: 24px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform 0.18s ease;
}
.switch input:checked { background: var(--ink); }
.switch input:checked::after { transform: translateX(20px); }

.select, .text-input {
  width: 100%; min-height: 44px; padding: 8px 12px;
  border: 1.5px solid var(--line-2); border-radius: var(--r-input);
  background: var(--surface); font-size: 1rem;
}
.select { padding-right: 32px; appearance: none; -webkit-appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-2) 50%), linear-gradient(135deg, var(--ink-2) 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 12px) 50%;
  background-size: 6px 6px; background-repeat: no-repeat;
}
.select:focus, .text-input:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 25%, transparent); }
.inline { display: flex; gap: 8px; align-items: center; }
.inline .select, .inline .text-input { flex: 1; min-width: 0; }

input[type="color"] {
  -webkit-appearance: none; appearance: none; flex: none;
  width: 44px; height: 44px; padding: 3px; border-radius: 50%;
  border: 1.5px solid var(--line-2); background: var(--surface); cursor: pointer;
}
input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
input[type="color"]::-webkit-color-swatch { border: none; border-radius: 50%; }
input[type="color"]::-moz-color-swatch { border: none; border-radius: 50%; }

.item-list { display: flex; flex-direction: column; gap: 8px; }
.item-list:has(.item-times) { gap: 18px; }
.item-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.item-times { flex-basis: 100%; display: flex; gap: 10px; padding-left: 52px; margin-top: -2px; }
.mini { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: stretch; gap: 3px; font-size: 0.8rem; font-weight: 700; color: var(--muted); }
.select-sm { min-height: 38px; padding: 4px 26px 4px 10px; font-size: 0.9rem; width: 100%; min-width: 0; }
@media (max-width: 420px) { .item-times { padding-left: 0; } }
.timed-fields { padding: 4px 0 6px; gap: 10px; }
#timedBox { display: flex; flex-direction: column; gap: 14px; padding-bottom: 14px; border-bottom: 1.5px solid var(--line); }
.item-row .text-input { flex: 1; min-width: 0; }
.icon-btn {
  flex: none; width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center;
  background: transparent; border: 1.5px solid transparent; color: var(--muted);
}
.icon-btn:hover { color: var(--red); border-color: var(--line); }
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn:disabled { opacity: 0.3; cursor: not-allowed; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
@media (max-width: 420px) { .grid-2 { grid-template-columns: 1fr; } }
.subhead { font-weight: 700; font-size: 0.95rem; color: var(--ink-2); }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* players */
.player-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.player-chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 4px 4px 12px; border-radius: 999px;
  background: var(--surface-2); border: 1.5px solid var(--line);
  font-weight: 700; font-size: 0.95rem;
}
.player-chip.is-turn { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.player-chip.is-out { opacity: 0.55; }
.player-chip.is-out .pc-name { text-decoration: line-through; }
.player-chip .pc-name { padding: 4px 4px 4px 0; font-size: 0.95rem; }
.player-chip .pc-name:hover { background: transparent; text-decoration: underline; }
.player-chip button {
  border: 0; background: transparent; color: inherit; border-radius: 999px;
  padding: 4px 9px; font-size: 0.85rem; font-weight: 700;
}
.player-chip button:hover { background: rgba(127,127,127,0.18); }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom)); z-index: 300;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--ink); color: var(--bg); padding: 12px 20px; border-radius: 999px;
  font-weight: 700; transition: opacity 0.2s, transform 0.2s; max-width: calc(100vw - 32px);
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* ==========================================================================
   PARTY MODE
   ========================================================================== */
.party {
  --pc: var(--ink); --pt: #fff;
  position: fixed; inset: 0; z-index: 200;
  display: flex; flex-direction: column;
  background: var(--pc); color: var(--pt);
  transition: background-color 0.12s linear, color 0.12s linear;
  padding: calc(14px + env(safe-area-inset-top)) calc(16px + env(safe-area-inset-right)) calc(16px + env(safe-area-inset-bottom)) calc(16px + env(safe-area-inset-left));
}
.party-top { display: flex; align-items: center; gap: 12px; min-height: 52px; }
.party-brand { font-family: var(--font-display); font-weight: 800; letter-spacing: -0.03em; opacity: 0.85; display: flex; align-items: center; gap: 8px; }
.party-brand svg { width: 24px; height: 24px; }
.party-players { display: flex; gap: 6px; overflow-x: auto; flex: 1; scrollbar-width: none; justify-content: center; }
.party-players button {
  flex: none; border-radius: 999px; padding: 7px 14px; font-weight: 700; font-size: 0.98rem;
  border: 2px solid currentColor; background: transparent; color: inherit; opacity: 0.8;
}
.party-players button.is-turn { background: var(--pt); color: var(--pc); opacity: 1; border-color: var(--pt); }
.party-players button.is-out { text-decoration: line-through; opacity: 0.4; }
.party-x {
  margin-left: auto; width: 52px; height: 52px; border-radius: 50%; flex: none;
  border: 2px solid currentColor; background: transparent; color: inherit; display: grid; place-items: center;
}
.party-x svg { width: 22px; height: 22px; }
.party-stage {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; gap: 2vh; border: 0; background: transparent; color: inherit; padding: 2vh 2vw;
  -webkit-tap-highlight-color: transparent;
}
.party-who { font-family: var(--font-display); font-weight: 600; font-size: clamp(1.3rem, 4.2vmin, 3rem); opacity: 0.9; min-height: 1.2em; }
.party-text {
  font-family: var(--font-display); font-weight: 800;
  font-size: clamp(2.6rem, 13vmin, 11rem); line-height: 0.98; letter-spacing: -0.035em;
  max-width: 95vw; overflow-wrap: anywhere;
}
.party-sub { font-variant-numeric: tabular-nums; font-family: var(--font-display); font-weight: 700; font-size: clamp(1.8rem, 9vmin, 7rem); line-height: 1; letter-spacing: -0.03em; opacity: 0.95; min-height: 1em; }
.party.is-spinning .party-text { opacity: 0.85; }
.party-bottom { display: flex; flex-direction: column; gap: 12px; }
.party .cd-track { background: rgba(0,0,0,0.2); height: 14px; }
.party .cd-fill { background: var(--pt); }
.party-controls { display: flex; gap: 10px; justify-content: center; align-items: center; }
.party-controls .btn { min-width: 150px; border-color: var(--pt); }
.party .btn-primary { background: var(--pt); color: var(--pc); flex: none; }
.party .btn-secondary { background: transparent; color: var(--pt); flex: none; }
.party .btn-secondary[aria-pressed="true"] { background: var(--pt); color: var(--pc); }
.party-cd { font-family: var(--font-display); font-weight: 700; font-variant-numeric: tabular-nums; font-size: 1.1rem; min-width: 4ch; text-align: center; }
.party-hint { text-align: center; opacity: 0.75; font-size: 0.95rem; }

/* winner */
.winner {
  position: fixed; inset: 0; z-index: 260; display: grid; place-items: center;
  background: rgba(14, 17, 34, 0.72); padding: 20px;
}
.winner-card {
  background: var(--surface); color: var(--ink); border-radius: 28px; padding: 30px 28px 24px;
  width: min(420px, 100%); text-align: center; position: relative; z-index: 2;
}
.winner-card svg { width: 72px; height: 72px; margin: 0 auto 10px; }
.winner-card h2 { font-size: clamp(1.6rem, 6vw, 2.2rem); }
.winner-card p { color: var(--muted); margin-top: 6px; }
.winner-card .btn-row { justify-content: center; margin-top: 20px; }
.confetti { position: fixed; inset: 0; z-index: 1; pointer-events: none; width: 100%; height: 100%; }

/* ==========================================================================
   CONTENT
   ========================================================================== */
.content { padding-block: clamp(36px, 6vw, 72px) clamp(40px, 6vw, 80px); }
.hero + .content { padding-top: clamp(12px, 2vw, 24px); }
.content > * + * { margin-top: clamp(44px, 6vw, 72px); }
.section { max-width: 760px; }
.section-wide { max-width: none; }
.section h2 { margin-bottom: 14px; }
.section h3 { margin-top: 22px; margin-bottom: 6px; }
.section p + p, .section p + ul, .section ul + p, .section p + ol, .section ol + p { margin-top: 12px; }
.section ul, .section ol { padding-left: 1.3em; margin: 0; }
.section li + li { margin-top: 6px; }
.section a { text-decoration-thickness: 1.5px; text-underline-offset: 3px; }
.section a:hover { text-decoration-color: var(--blue); }
.prose { max-width: 70ch; }
.prose h2 { margin-top: 40px; margin-bottom: 12px; }
.prose h2:first-child { margin-top: 0; }
.prose h3 { margin-top: 26px; margin-bottom: 6px; }
.prose p, .prose ul, .prose ol { margin-top: 12px; }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose li + li { margin-top: 6px; }
.prose a { text-decoration-thickness: 1.5px; text-underline-offset: 3px; }
.prose table { width: 100%; border-collapse: collapse; margin-top: 14px; font-size: 0.98rem; }
.prose th, .prose td { text-align: left; padding: 10px 12px; border-bottom: 1.5px solid var(--line); vertical-align: top; }
.prose th { font-weight: 700; color: var(--ink-2); }
.updated { color: var(--muted); font-size: 0.95rem; margin-top: 8px; }

.steps { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 28px; counter-reset: step; }
.steps li { counter-increment: step; }
.steps li::before {
  content: counter(step); display: grid; place-items: center;
  width: 40px; height: 40px; border-radius: 50%; margin-bottom: 12px;
  background: var(--ink); color: var(--bg); font-family: var(--font-display); font-weight: 700;
}
.steps h3 { margin: 0 0 6px; }
.steps p { color: var(--ink-2); }
@media (max-width: 760px) { .steps { grid-template-columns: 1fr; gap: 22px; } }
.prose .steps { padding-left: 0; }
.prose .steps li + li { margin-top: 0; }

.features { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 26px 40px; margin: 0; }
.features div { display: grid; grid-template-columns: 36px 1fr; gap: 0 12px; }
.features dt { grid-column: 2; font-weight: 700; font-size: 1.08rem; }
.features dd { grid-column: 2; margin: 4px 0 0; color: var(--ink-2); }
.features .f-icon { grid-row: 1 / span 2; grid-column: 1; width: 34px; height: 34px; color: var(--ink); }
@media (max-width: 720px) { .features { grid-template-columns: 1fr; } }

.spinner-links { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.spinner-link {
  display: flex; flex-direction: column; gap: 6px; padding: 18px 18px 16px;
  background: var(--surface); border: 1.5px solid var(--line); border-radius: 18px;
  text-decoration: none;
}
.spinner-link:hover { border-color: var(--ink); }
.spinner-link b { display: flex; align-items: center; gap: 10px; font-size: 1.08rem; }
.spinner-link span { color: var(--muted); font-size: 0.95rem; line-height: 1.45; }

.callout {
  border-left: 6px solid var(--ink); background: var(--surface);
  padding: 16px 20px; border-radius: 0 16px 16px 0; margin-top: 18px;
}
.callout p + p { margin-top: 8px; }
.callout-yellow { border-color: var(--yellow); }
.callout-blue { border-color: var(--blue); }
.callout-red { border-color: var(--red); }
.callout-green { border-color: var(--green); }

.faq { display: flex; flex-direction: column; border-top: 1.5px solid var(--line); }
.faq details { border-bottom: 1.5px solid var(--line); }
.faq summary {
  list-style: none; cursor: pointer; padding: 18px 40px 18px 0; position: relative;
  font-weight: 700; font-size: 1.08rem;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "+"; position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  font-family: var(--font-display); font-weight: 600; font-size: 1.4rem; color: var(--ink-2);
}
.faq details[open] summary::after { content: "–"; }
.faq details > div { padding: 0 0 18px; color: var(--ink-2); max-width: 70ch; }
.faq details > div p + p { margin-top: 10px; }

.mat-diagram { width: 100%; max-width: 520px; margin-top: 18px; }
.figure-note { color: var(--muted); font-size: 0.92rem; margin-top: 8px; }

/* ---------- footer ---------- */
.site-footer { background: #15172B; color: #E7E9F4; padding-block: 48px 36px; margin-top: 24px; }
.footer-grid { display: grid; grid-template-columns: 1.4fr repeat(3, 1fr); gap: 32px; }
.site-footer .brand { color: #fff; }
.site-footer .footer-about { margin-top: 12px; color: #B6BAD3; font-size: 0.95rem; max-width: 34ch; }
.site-footer h2 { font-family: var(--font-body); font-size: 1rem; font-weight: 700; color: #fff; margin-bottom: 10px; letter-spacing: 0; }
.site-footer ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 7px; }
.site-footer a { color: #C9CDE3; text-decoration: none; font-size: 0.97rem; }
.site-footer a:hover { color: #fff; text-decoration: underline; text-underline-offset: 3px; }
.footer-legal { margin-top: 36px; padding-top: 20px; border-top: 1px solid #2C3152; color: #9DA2C0; font-size: 0.88rem; line-height: 1.55; display: flex; flex-direction: column; gap: 6px; }
.theme-switch { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 6px; }
.theme-switch span { margin-right: 4px; }
.theme-switch button { background: transparent; color: #C9CDE3; border: 1.5px solid #4A5180; border-radius: 999px; padding: 4px 12px; font-size: 0.86rem; font-weight: 700; }
.theme-switch button:hover { border-color: #fff; color: #fff; }
.theme-switch button[aria-pressed="true"] { background: #fff; color: #15172B; border-color: #fff; }
.install-btn { margin-top: 16px; background: transparent; color: #fff; border: 1.5px solid #4A5180; border-radius: 999px; padding: 9px 16px; font-weight: 700; }
.install-btn:hover { border-color: #fff; }
@media (max-width: 860px) { .footer-grid { grid-template-columns: 1fr 1fr; } .footer-grid > :first-child { grid-column: 1 / -1; } }

/* ---------- printable ---------- */
.print-sheet { background: #fff; border: 1.5px solid var(--line); border-radius: 18px; padding: 20px; max-width: 640px; }
.print-sheet svg { width: 100%; height: auto; }
@media print {
  .site-header, .site-footer, .no-print, .skip-link, .toast { display: none !important; }
  body { background: #fff; color: #000; }
  .print-sheet { border: 0; padding: 0; max-width: none; }
  .content { padding: 0; }
}

/* ---------- motion preferences ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
