/* ==========================================================================
   Pibono — Sunny Pibono (warm cream + coral, bean mascot)
   ---------------------------------------------------------------------------
   Layers: tokens → reset → base → layout → components → utilities
   No inline styles. No always-on animations. Motion is interaction-only.
   ========================================================================== */

/* ---------- 1. Tokens ----------------------------------------------------- */

:root {
  /* Color (light — "Sunny Pibono") */
  --bg:           oklch(97% 0.024 78);     /* warm cream paper */
  --surface:      oklch(99.4% 0.01 84);
  --surface-2:    oklch(93.5% 0.035 74);
  --surface-felt: oklch(56% 0.085 165);    /* warm table green */
  --ink:          oklch(26% 0.03 55);       /* warm dark brown */
  --ink-muted:    oklch(50% 0.03 60);
  --ink-faint:    oklch(70% 0.025 65);
  --accent:       oklch(62% 0.16 41);       /* punchy coral terracotta */
  --accent-ink:   oklch(99% 0.012 85);
  --accent-soft:  oklch(91% 0.05 60);
  --accent-2:     oklch(80% 0.13 80);       /* sunny gold (secondary CTA) */
  --accent-2-ink: oklch(30% 0.045 60);      /* dark text on gold — AA */
  --danger:       oklch(54% 0.18 25);
  --success:      oklch(50% 0.11 155);
  --border:       oklch(89% 0.025 75);
  --border-strong:oklch(80% 0.03 70);
  --focus:        oklch(62% 0.16 41 / 0.45);
  --pile-outline: oklch(98% 0.012 95 / 0.72);  /* empty-pile chalk outline — high contrast on felt */

  --shadow-1: 0 1px 2px oklch(45% 0.05 60 / 0.10);
  --shadow-2: 0 3px 10px oklch(45% 0.06 55 / 0.13);
  --shadow-3: 0 14px 34px oklch(45% 0.06 55 / 0.16);

  /* Spacing */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 72px;

  /* Radius */
  --radius-1: 4px;
  --radius-2: 10px;
  --radius-3: 14px;
  --radius-4: 20px;
  --radius-full: 9999px;

  /* Type */
  --font-display: 'Newsreader', Georgia, 'Times New Roman', serif;
  --font-brand:   'Fredoka', 'IBM Plex Sans', system-ui, sans-serif;  /* wordmark only */
  --font-ui:      'IBM Plex Sans', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  --font-mono:    'IBM Plex Mono', ui-monospace, 'SF Mono', Consolas, monospace;

  /* Motion */
  --ease:    cubic-bezier(0.2, 0.7, 0.25, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --dur-1: 120ms;
  --dur-2: 200ms;
  --dur-3: 280ms;

  /* Cards */
  --card-w: 84px;
  --card-h: 118px;
  --card-radius: 8px;
  --card-stack-fan: 24px;
  --card-fan-down: 14px;
  --card-shadow: 0 1px 1px oklch(45% 0.05 60 / 0.07), 0 6px 16px oklch(45% 0.06 55 / 0.12);
  --card-red: #b23a2e;
  --card-ink: #1a1f2c;

  /* Game-specific */
  --board-pad: var(--space-5);
  --header-h: 56px;
}

/* Dark theme — applies if user is on dark OS unless [data-theme] forces otherwise */
@media (prefers-color-scheme: dark) {
  :root {
    --bg:           oklch(16% 0.018 250);
    --surface:      oklch(20% 0.02 250);
    --surface-2:    oklch(24% 0.022 250);
    --surface-felt: oklch(26% 0.025 250);
    --ink:          oklch(95% 0.01 60);
    --ink-muted:    oklch(70% 0.015 240);
    --ink-faint:    oklch(50% 0.015 240);
    --accent:       oklch(72% 0.13 50);
    --accent-ink:   oklch(15% 0.018 250);
    --accent-soft:  oklch(30% 0.04 50);
    --border:       oklch(32% 0.018 250);
    --border-strong:oklch(42% 0.02 250);
    --shadow-1: 0 1px 2px oklch(0% 0 0 / 0.4);
    --shadow-2: 0 2px 10px oklch(0% 0 0 / 0.4);
    --shadow-3: 0 12px 32px oklch(0% 0 0 / 0.5);
    --card-shadow: 0 1px 2px oklch(0% 0 0 / 0.5), 0 8px 18px oklch(0% 0 0 / 0.35);
  }
}

[data-theme="light"] {
  color-scheme: light;
  --bg:           oklch(97% 0.024 78);
  --surface:      oklch(99.4% 0.01 84);
  --surface-2:    oklch(93.5% 0.035 74);
  --surface-felt: oklch(56% 0.085 165);
  --ink:          oklch(26% 0.03 55);
  --ink-muted:    oklch(50% 0.03 60);
  --ink-faint:    oklch(70% 0.025 65);
  --border:       oklch(89% 0.025 75);
  --border-strong:oklch(80% 0.03 70);
  --accent-soft:  oklch(91% 0.05 60);
  --shadow-1: 0 1px 2px oklch(45% 0.05 60 / 0.10);
  --shadow-2: 0 3px 10px oklch(45% 0.06 55 / 0.13);
  --shadow-3: 0 14px 34px oklch(45% 0.06 55 / 0.16);
  --card-shadow: 0 1px 1px oklch(45% 0.05 60 / 0.07), 0 6px 16px oklch(45% 0.06 55 / 0.12);
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg:           oklch(16% 0.018 250);
  --surface:      oklch(20% 0.02 250);
  --surface-2:    oklch(24% 0.022 250);
  --surface-felt: oklch(26% 0.025 250);
  --ink:          oklch(95% 0.01 60);
  --ink-muted:    oklch(70% 0.015 240);
  --ink-faint:    oklch(50% 0.015 240);
  --accent:       oklch(72% 0.13 50);
  --accent-ink:   oklch(15% 0.018 250);
  --accent-soft:  oklch(30% 0.04 50);
  --border:       oklch(32% 0.018 250);
  --border-strong:oklch(42% 0.02 250);
  --shadow-1: 0 1px 2px oklch(0% 0 0 / 0.4);
  --shadow-2: 0 2px 10px oklch(0% 0 0 / 0.4);
  --shadow-3: 0 12px 32px oklch(0% 0 0 / 0.5);
  --card-shadow: 0 1px 2px oklch(0% 0 0 / 0.5), 0 8px 18px oklch(0% 0 0 / 0.35);
}

/* Norðurljós — moss-tinted dark with strong aurora-green accent. */
[data-theme="aurora"] {
  color-scheme: dark;
  --bg:           oklch(15% 0.04 175);
  --surface:      oklch(19% 0.045 170);
  --surface-2:    oklch(23% 0.05 168);
  --surface-felt: oklch(21% 0.055 168);
  --ink:          oklch(94% 0.04 155);
  --ink-muted:    oklch(72% 0.06 158);
  --ink-faint:    oklch(52% 0.05 162);
  --accent:       oklch(78% 0.18 158);   /* aurora green */
  --accent-ink:   oklch(13% 0.04 175);
  --accent-soft:  oklch(28% 0.09 158);
  --danger:       oklch(64% 0.2 25);
  --success:      oklch(78% 0.18 158);
  --border:       oklch(32% 0.05 168);
  --border-strong:oklch(44% 0.07 162);
  --focus:        oklch(78% 0.18 158 / 0.5);
  --shadow-1: 0 1px 2px oklch(0% 0 0 / 0.45);
  --shadow-2: 0 4px 14px oklch(10% 0.04 168 / 0.55);
  --shadow-3: 0 14px 36px oklch(6% 0.04 168 / 0.6);
  --card-shadow: 0 1px 2px oklch(0% 0 0 / 0.55), 0 8px 20px oklch(6% 0.04 168 / 0.45);
}

/* Large — high-contrast, bumped sizing for older eyes and low-vision users.
   Same warm light palette as `light` but with: pure-black ink for maximum
   contrast, darker ink-muted (no more pale grey body copy), thicker borders,
   and bumped card / type sizes. Targets WCAG AAA where possible. */
[data-theme="large"] {
  color-scheme: light;
  --bg:           oklch(98% 0.005 235);
  --surface:      oklch(100% 0 0);
  --surface-2:    oklch(94% 0.008 235);
  --surface-felt: oklch(93% 0.012 235);
  --ink:          oklch(12% 0.01 250);   /* near-black */
  --ink-muted:    oklch(28% 0.012 245);  /* much darker than default's 48% */
  --ink-faint:    oklch(48% 0.014 240);  /* much darker than default's 72% */
  --accent:       oklch(50% 0.16 38);    /* darker terracotta — higher contrast on white */
  --accent-ink:   oklch(99% 0 0);
  --accent-soft:  oklch(92% 0.04 50);
  --danger:       oklch(46% 0.21 25);
  --success:      oklch(42% 0.14 155);
  --border:       oklch(72% 0.012 235);  /* much darker borders */
  --border-strong:oklch(56% 0.014 235);
  --focus:        oklch(50% 0.16 38 / 0.55);
  --pile-outline: oklch(34% 0.02 240 / 0.95);  /* dark outline — this theme's felt is light */
  --shadow-1: 0 1px 2px oklch(12% 0.01 250 / 0.10);
  --shadow-2: 0 2px 8px oklch(12% 0.01 250 / 0.12);
  --shadow-3: 0 12px 32px oklch(12% 0.01 250 / 0.18);
  --card-shadow: 0 2px 3px oklch(12% 0.01 250 / 0.14), 0 8px 18px oklch(12% 0.01 250 / 0.14);

  /* Bumped sizing — applies across the design system in this theme. */
  --card-w:  108px;
  --card-h:  152px;
  --card-radius: 10px;
}
[data-theme="large"] body { font-size: 18px; line-height: 1.55; }
[data-theme="large"] h3 { font-size: 1.4rem; }
[data-theme="large"] .btn { padding: 12px 18px; font-size: 1rem; min-height: 44px; }
[data-theme="large"] .btn--icon { width: 44px; height: 44px; }
[data-theme="large"] .btn--icon .icon { width: 22px; height: 22px; }
[data-theme="large"] :focus-visible { outline-width: 3px; outline-offset: 3px; }
[data-theme="large"] .sheet__body { font-size: 1.05rem; }
[data-theme="large"] .prose { font-size: 1.05rem; }
[data-theme="large"] .timer, [data-theme="large"] .balance { font-size: 1rem; }
@media (max-width: 760px) {
  [data-theme="large"] { --card-w: 78px; --card-h: 110px; }
  [data-theme="large"] body { font-size: 17px; }
}

/* ---------- 2. Reset ------------------------------------------------------ */

*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html, body { height: 100%; }
html { -webkit-text-size-adjust: 100%; }
img, svg, video { display: block; max-width: 100%; }
button, input, textarea, select { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }
ul, ol { padding: 0; }
:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: var(--radius-1);
}

/* ---------- 3. Base ------------------------------------------------------- */

body {
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1.15;
  text-wrap: balance;
}

h1 { font-size: clamp(2.4rem, 5vw, 4rem); }
h2 { font-size: clamp(1.6rem, 3vw, 2.2rem); }
h3 { font-size: 1.25rem; }

p { text-wrap: pretty; }

.mono { font-family: var(--font-mono); }

/* Accessibility helper */
.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* ---------- 4. Layout ----------------------------------------------------- */

.app {
  min-height: 100%;
  display: grid;
  grid-template-rows: auto 1fr auto;
}

.container {
  width: 100%;
  max-width: 1200px;
  margin-inline: auto;
  padding-inline: var(--space-5);
}

@media (min-width: 720px) {
  .container { padding-inline: var(--space-6); }
}

/* Header — single compact row on game pages, slightly taller on landing */
.site-header {
  height: var(--header-h);
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 20;
}
.site-header .container {
  height: 100%;
  display: flex;
  align-items: center;
  gap: var(--space-4);
}
.wordmark {
  font-family: var(--font-brand);
  font-style: normal;
  font-weight: 700;
  font-size: 1.4rem;
  letter-spacing: -0.01em;
  color: var(--accent);
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 0.5ch;
}
.wordmark__mark {
  width: auto;
  height: 38px;
  flex-shrink: 0;
  display: block;
}
.btn--gold {
  background: var(--accent-2);
  color: var(--accent-2-ink);
  border-color: transparent;
}

/* 404 / not-found page */
.notfound {
  text-align: center;
  max-width: 36rem;
  margin: var(--space-8) auto;
  padding: 0 var(--space-4);
}
.notfound__mascot { width: 200px; height: auto; margin: 0 auto var(--space-4); display: block; }
.notfound h1 { font-family: var(--font-display); font-size: 2rem; margin: 0 0 var(--space-2); }
.notfound p { color: var(--ink-muted); margin: 0 0 var(--space-5); }

/* Rare cat easter egg (js/easteregg.js) */
.easter-cat {
  position: fixed;
  right: var(--space-5);
  bottom: 0;
  width: 132px;
  height: auto;
  z-index: 60;
  cursor: pointer;
  transform: translateY(110%);
  transition: transform var(--dur-3) var(--ease-out);
  filter: drop-shadow(0 6px 14px oklch(30% 0.04 60 / 0.3));
}
.easter-cat--in { transform: translateY(20%); }
@media (prefers-reduced-motion: reduce) {
  .easter-cat { transition: none; transform: translateY(20%); }
}
.wordmark .sep {
  color: var(--ink-faint);
  font-style: normal;
  font-family: var(--font-ui);
  font-weight: 400;
  font-size: 0.95rem;
  align-self: center;
}
.wordmark .crumb {
  color: var(--ink-muted);
  font-size: 0.95rem;
  font-style: normal;
  font-family: var(--font-ui);
  font-weight: 400;
  align-self: center;
}

.header-meta {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.timer, .balance {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: var(--ink-muted);
  padding-inline: var(--space-3);
  height: 32px;
  display: inline-flex;
  align-items: center;
  border-radius: var(--radius-2);
  background: var(--surface-2);
  border: 1px solid var(--border);
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
}
.balance .label {
  color: var(--ink-faint);
  margin-right: 0.5ch;
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  padding-block: var(--space-5);
  color: var(--ink-muted);
  font-size: 0.85rem;
}
.site-footer .container {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
  align-items: center;
  justify-content: space-between;
}
.site-footer a:hover { color: var(--ink); }

/* Main */
main { display: block; }

/* ---------- 5. Components ------------------------------------------------- */

/* Buttons --------------------------------------------------------------- */
.btn {
  --_bg: var(--surface);
  --_ink: var(--ink);
  --_border: var(--border-strong);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  height: 36px;
  padding-inline: var(--space-4);
  font-family: var(--font-ui);
  font-size: 0.9rem;
  font-weight: 500;
  letter-spacing: 0.005em;
  color: var(--_ink);
  background: var(--_bg);
  border: 1px solid var(--_border);
  border-radius: var(--radius-2);
  cursor: pointer;
  transition: background var(--dur-1) var(--ease),
              border-color var(--dur-1) var(--ease),
              transform var(--dur-1) var(--ease);
  white-space: nowrap;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn[disabled],
.btn[aria-disabled="true"] {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

.btn .icon { width: 16px; height: 16px; }

.btn--primary {
  --_bg: var(--accent);
  --_ink: var(--accent-ink);
  --_border: transparent;
}
.btn--primary:hover { --_bg: oklch(from var(--accent) calc(l - 0.05) c h); }

.btn--ghost {
  --_bg: transparent;
  --_border: transparent;
  color: var(--ink-muted);
}
.btn--ghost:hover { background: var(--surface-2); color: var(--ink); }

.btn--icon {
  width: 36px;
  height: 36px;
  padding: 0;
  --_bg: transparent;
  --_border: transparent;
  color: var(--ink-muted);
  border-radius: var(--radius-2);
}
.btn--icon:hover { background: var(--surface-2); color: var(--ink); }
.btn--icon .icon { width: 18px; height: 18px; }

.btn--lg {
  height: 44px;
  padding-inline: var(--space-5);
  font-size: 0.95rem;
}

.btn--danger { color: var(--danger); }
.btn--danger:hover { background: oklch(54% 0.18 25 / 0.08); }

/* Icons (referenced via <use href="icons.svg#name">) --------------------- */
.icon { display: inline-block; vertical-align: middle; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.icon--solid { fill: currentColor; stroke: none; }

/* Pills (segmented controls) -------------------------------------------- */
.pill-group {
  display: inline-flex;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  padding: 3px;
  gap: 2px;
}
.pill-group input[type="radio"] { position: absolute; opacity: 0; pointer-events: none; }
.pill-group label {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 6px 14px;
  font-size: 0.85rem;
  color: var(--ink-muted);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: background var(--dur-1) var(--ease), color var(--dur-1) var(--ease);
}
.pill-group input[type="radio"]:checked + label,
.pill-group label:has(input:checked) {
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-1);
}
.pill-group label:hover { color: var(--ink); }

.swatch {
  width: 14px; height: 14px; border-radius: 50%;
  border: 1px solid oklch(0% 0 0 / 0.12);
}
.swatch--red  { background: #b23a2e; }
.swatch--blue { background: #2a3a5e; }

/* Theme swatch picker — replaces the pill-group for theme.
   Each swatch shows three colours that preview the theme. */
.theme-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(112px, 1fr));
  gap: var(--space-2);
  width: 100%;
}
.theme-grid input { position: absolute; opacity: 0; pointer-events: none; }
.theme-grid label {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-2);
  background: var(--surface);
  cursor: pointer;
  transition: border-color var(--dur-1) var(--ease), background var(--dur-1) var(--ease);
}
.theme-grid label:hover { border-color: var(--border-strong); }
.theme-grid label:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.theme-grid .swatch-row {
  display: flex;
  gap: 4px;
  height: 24px;
}
.theme-grid .swatch-row span {
  flex: 1;
  border-radius: 4px;
  border: 1px solid oklch(0% 0 0 / 0.08);
}
.theme-grid .name {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--ink);
  line-height: 1.2;
}
.theme-grid .name small {
  display: block;
  font-weight: 400;
  font-size: 0.7rem;
  color: var(--ink-muted);
  margin-top: 2px;
}

.sheet__row--stack {
  flex-direction: column;
  align-items: stretch;
  gap: var(--space-3);
}
.sheet__row--stack > * { width: 100%; }

/* Dialog (help + settings) ---------------------------------------------- */
dialog.sheet {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  border-radius: var(--radius-4);
  padding: 0;
  max-width: 480px;
  width: calc(100% - 32px);
  box-shadow: var(--shadow-3);
}
dialog.sheet::backdrop {
  background: oklch(22% 0.025 250 / 0.35);
}
.sheet__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--border);
}
.sheet__title {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 500;
  font-size: 1.4rem;
}
.sheet__body {
  padding: var(--space-5);
  max-height: 70vh;
  overflow: auto;
}
.sheet__body h3 {
  margin-bottom: var(--space-2);
  margin-top: var(--space-5);
  font-family: var(--font-ui);
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-muted);
}
.sheet__body h3:first-child { margin-top: 0; }
.sheet__body p + p { margin-top: var(--space-3); }
.sheet__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding-block: var(--space-3);
  border-bottom: 1px solid var(--border);
}
.sheet__row:last-child { border-bottom: 0; }
.sheet__row .label {
  display: block;
  font-size: 0.95rem;
  color: var(--ink);
}
.sheet__row .hint {
  font-size: 0.8rem;
  color: var(--ink-muted);
  margin-top: 2px;
}

.kbd {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  padding: 1px 6px;
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 4px;
  background: var(--surface-2);
  color: var(--ink-muted);
}

/* Landing ---------------------------------------------------------------- */
.landing {
  padding-block: var(--space-8) var(--space-7);
}
.landing__intro {
  margin-bottom: var(--space-8);
  max-width: 720px;
}
.landing__intro .eyebrow {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-bottom: var(--space-4);
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
}
.landing__intro .eyebrow::before {
  content: "";
  width: 28px;
  height: 1px;
  background: var(--accent);
  display: inline-block;
}
.landing__intro h1 {
  font-family: var(--font-display);
  font-weight: 400;
}
.landing__intro h1 em {
  font-style: italic;
  color: var(--accent);
}
.landing__intro p.lede {
  margin-top: var(--space-5);
  font-size: 1.05rem;
  color: var(--ink-muted);
  max-width: 52ch;
}

.game-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-5);
}
@media (min-width: 780px) {
  .game-grid { grid-template-columns: 1fr 1fr; gap: var(--space-6); }
}

.game-card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-4);
  padding: var(--space-6);
  transition: border-color var(--dur-2) var(--ease),
              transform var(--dur-2) var(--ease),
              box-shadow var(--dur-2) var(--ease);
  position: relative;
  overflow: hidden;
  min-height: 380px;
}
.game-card::after {
  /* Quiet terracotta wash that fades in on hover */
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 60%, oklch(60% 0.13 42 / 0.05));
  opacity: 0;
  transition: opacity var(--dur-3) var(--ease);
  pointer-events: none;
  border-radius: inherit;
}
.game-card:hover {
  border-color: oklch(60% 0.13 42 / 0.4);
  transform: translateY(-2px);
  box-shadow: var(--shadow-2);
}
.game-card:hover::after { opacity: 1; }
.game-card__preview {
  height: 200px;
  margin-bottom: var(--space-5);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
.game-card__preview .mini {
  width: 70px;
  height: 98px;
  border-radius: 6px;
  box-shadow: var(--card-shadow);
  background-size: cover;
  background-position: center;
  position: absolute;
  transition: transform var(--dur-3) var(--ease);
}
.game-card:hover .game-card__preview .mini { transform: translateY(-4px); }
.game-card__title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.8rem;
  margin-bottom: var(--space-2);
}
.game-card__title em { font-style: italic; color: var(--accent); }
.game-card__desc {
  color: var(--ink-muted);
  margin-bottom: var(--space-5);
  max-width: 32ch;
}
.game-card__cta {
  margin-top: auto;
  align-self: flex-start;
}

/* Card play surface ------------------------------------------------------ */
.board {
  background: var(--surface-felt);
  border-radius: var(--radius-4);
  padding: var(--board-pad);
  margin-block: var(--space-5);
  border: 1px solid var(--border);
}

/* Pile (generic positioned slot) ---------------------------------------- */
.pile {
  position: relative;
  width: var(--card-w);
  height: var(--card-h);
  border-radius: var(--card-radius);
  border: 2px dashed var(--pile-outline);
  background: oklch(from var(--ink) l c h / 0.06);
  flex-shrink: 0;
}
.pile--empty-label {
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--ink-faint);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* Card ------------------------------------------------------------------ */
.card {
  position: absolute;
  width: var(--card-w);
  height: var(--card-h);
  border-radius: var(--card-radius);
  background: #fdfcf8;
  box-shadow: var(--card-shadow);
  user-select: none;
  /* Dragging is handled by Pointer Events (js/drag.js). Native HTML5 drag must
     stay OFF or Blink (Chrome/Brave/Safari) hijacks the mouse gesture — showing
     a translucent partial snapshot and swallowing drops. Firefox ignores it. */
  -webkit-user-drag: none;
  user-drag: none;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  transition: transform var(--dur-2) var(--ease),
              box-shadow var(--dur-2) var(--ease);
  cursor: default;
  /* Slight ink border so the card has a defined edge on any surface */
  outline: 1px solid oklch(22% 0.025 250 / 0.06);
  outline-offset: -1px;
}
.card.face-down { background-color: transparent; }
.card.draggable { cursor: grab; touch-action: none; }
.card.draggable:active { cursor: grabbing; }
.card.is-selected {
  box-shadow: 0 0 0 2px var(--accent), var(--card-shadow);
}
.card.is-dragging {
  transform: scale(1.02);
  box-shadow: 0 0 0 1px var(--accent), 0 12px 28px oklch(22% 0.025 250 / 0.22);
  z-index: 999;
  transition: none;
}
.card.is-flipping { animation: cardFlip 220ms var(--ease) both; }
@keyframes cardFlip {
  0%   { transform: rotateY(90deg); }
  100% { transform: rotateY(0deg); }
}

/* Drop target — only highlight when a drag is in progress */
.pile.drop-ok    { border-color: var(--success); background: oklch(50% 0.11 155 / 0.08); }
.pile.drop-bad   { border-color: var(--danger);  background: oklch(54% 0.18 25 / 0.06); }
.pile.drop-ok::after,
.pile.drop-bad::after {
  content: ""; position: absolute; inset: -2px;
  border-radius: calc(var(--card-radius) + 2px);
  pointer-events: none;
}

/* SOLITAIRE -------------------------------------------------------------- */
.solitaire-board {
  display: grid;
  grid-template-rows: auto 1fr;
  gap: var(--space-5);
}
.top-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
  flex-wrap: wrap;
}
.stock-group, .foundation-group {
  display: flex;
  gap: var(--space-3);
}
.tableau {
  display: grid;
  grid-template-columns: repeat(7, var(--card-w));
  gap: var(--space-3);
  justify-content: space-between;
  width: 100%;
  max-width: calc(7 * var(--card-w) + 6 * var(--space-3));
  margin-inline: auto;
}
.tableau-pile {
  position: relative;
  width: var(--card-w);
  min-height: var(--card-h);
}
.tableau-pile:empty {
  border-radius: var(--card-radius);
  border: 2px dashed var(--pile-outline);
  background: oklch(from var(--ink) l c h / 0.06);
}
.tableau-pile .card { transition: top var(--dur-2) var(--ease), transform var(--dur-2) var(--ease), box-shadow var(--dur-2) var(--ease); }
.tableau-pile.drop-ok::before,
.tableau-pile.drop-bad::before {
  content: "";
  position: absolute;
  inset: 0;
  width: var(--card-w);
  height: var(--card-h);
  border-radius: var(--card-radius);
  border: 1px dashed;
  pointer-events: none;
}
.tableau-pile.drop-ok::before { border-color: var(--success); background: oklch(50% 0.11 155 / 0.08); }
.tableau-pile.drop-bad::before { border-color: var(--danger);  background: oklch(54% 0.18 25 / 0.06); }

.foundation-pile {
  position: relative;
  width: var(--card-w);
  height: var(--card-h);
  border-radius: var(--card-radius);
  border: 2px dashed var(--pile-outline);
  background: oklch(from var(--ink) l c h / 0.06);
  display: flex; align-items: center; justify-content: center;
}
.foundation-pile[data-suit]::before {
  content: attr(data-suit-glyph);
  font-family: var(--font-display);
  font-size: 2.4rem;
  color: var(--pile-outline);
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.foundation-pile[data-suit="hearts"]::before,
.foundation-pile[data-suit="diamonds"]::before {
  color: oklch(62% 0.16 41 / 0.8);
}
.foundation-pile .card { box-shadow: var(--card-shadow); }

.stock-pile, .waste-pile {
  position: relative;
  width: var(--card-w);
  height: var(--card-h);
  border-radius: var(--card-radius);
  border: 2px dashed var(--pile-outline);
  background: oklch(from var(--ink) l c h / 0.06);
  cursor: pointer;
}
.stock-pile.is-empty::after {
  content: "↻";
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  color: var(--ink-faint);
  font-size: 1.4rem;
}

/* Win celebration — short, not infinite */
.win-banner {
  position: absolute;
  inset: auto 0 24px 0;
  margin-inline: auto;
  max-width: 360px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-3);
  padding: var(--space-4) var(--space-5);
  text-align: center;
  box-shadow: var(--shadow-3);
  animation: bannerIn 240ms var(--ease-out) both;
}
.win-banner__close {
  position: absolute;
  top: 6px;
  right: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--ink-muted);
  border-radius: var(--radius-1);
  cursor: pointer;
}
.win-banner__close:hover { background: var(--surface-2); color: var(--ink); }
.win-banner__close:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
@keyframes bannerIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* FREECELL --------------------------------------------------------------- */
.freecell-board {
  display: grid;
  grid-template-rows: auto 1fr;
  gap: var(--space-5);
}
.freecell-board .top-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
  flex-wrap: wrap;
}
.cell-group {
  display: flex;
  gap: var(--space-3);
}
.cell-pile {
  position: relative;
  width: var(--card-w);
  height: var(--card-h);
  border-radius: var(--card-radius);
  border: 2px dashed var(--pile-outline);
  background: oklch(from var(--ink) l c h / 0.06);
}
.cell-pile.drop-ok    { border-color: var(--success); background: oklch(50% 0.11 155 / 0.08); }
.cell-pile.drop-bad   { border-color: var(--danger);  background: oklch(54% 0.18 25 / 0.06); }
.cell-pile .card { box-shadow: var(--card-shadow); }
.cell-pile.is-empty::after {
  content: "";
  position: absolute;
  inset: 8px;
  border-radius: 4px;
  border: 1px dashed oklch(from var(--ink-faint) l c h / 0.35);
  pointer-events: none;
}

.cascades {
  display: grid;
  grid-template-columns: repeat(8, var(--card-w));
  gap: var(--space-3);
  justify-content: space-between;
  width: 100%;
  max-width: calc(8 * var(--card-w) + 7 * var(--space-3));
  margin-inline: auto;
}
.cascade-pile {
  position: relative;
  width: var(--card-w);
  min-height: var(--card-h);
}
.cascade-pile:empty {
  border-radius: var(--card-radius);
  border: 2px dashed var(--pile-outline);
  background: oklch(from var(--ink) l c h / 0.06);
}
.cascade-pile .card { transition: top var(--dur-2) var(--ease), transform var(--dur-2) var(--ease), box-shadow var(--dur-2) var(--ease); }
.cascade-pile.drop-ok::before,
.cascade-pile.drop-bad::before {
  content: "";
  position: absolute;
  inset: 0;
  width: var(--card-w);
  height: var(--card-h);
  border-radius: var(--card-radius);
  border: 1px dashed;
  pointer-events: none;
}
.cascade-pile.drop-ok::before  { border-color: var(--success); background: oklch(50% 0.11 155 / 0.08); }
.cascade-pile.drop-bad::before { border-color: var(--danger);  background: oklch(54% 0.18 25 / 0.06); }

@media (max-width: 760px) {
  .cascades { grid-template-columns: repeat(8, minmax(0, 1fr)); }
  .freecell-board .top-row { gap: var(--space-2); }
  .cell-group, .freecell-board .foundation-group { gap: var(--space-2); }
}

/* SUDOKU ----------------------------------------------------------------- */
.sudoku-layout {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-5);
  padding-block: var(--space-4);
}
@media (min-width: 880px) {
  .sudoku-layout { flex-direction: row; align-items: flex-start; justify-content: center; gap: var(--space-7); }
}
.sudoku-grid {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  width: min(92vw, 540px);
  aspect-ratio: 1 / 1;
  background: var(--surface);
  border: 2px solid var(--ink);
  border-radius: var(--radius-2);
  box-shadow: var(--shadow-2);
  user-select: none;
}
.su-cell {
  position: relative;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-size: clamp(1.2rem, 3vw, 1.8rem);
  color: var(--ink);
  background: var(--surface);
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background var(--dur-1) var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.su-cell[data-col="2"], .su-cell[data-col="5"] { border-right: 2px solid var(--ink); }
.su-cell[data-col="8"] { border-right: 0; }
.su-cell[data-row="2"], .su-cell[data-row="5"] { border-bottom: 2px solid var(--ink); }
.su-cell[data-row="8"] { border-bottom: 0; }
.su-cell.is-given     { color: var(--ink); font-weight: 600; }
.su-cell:not(.is-given) .su-val { color: var(--accent); font-weight: 500; }
.su-cell.is-peer      { background: var(--surface-2); }
.su-cell.is-selected  { background: var(--accent-soft); }
.su-cell.is-match     { background: oklch(from var(--accent) calc(l + 0.2) c h / 0.4); }
.su-cell.is-error .su-val { color: var(--danger); }
.su-cell:hover        { background: var(--surface-2); }
.su-notes {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  width: 100%; height: 100%;
  font-family: var(--font-ui);
  font-size: 10px;
  color: var(--ink-muted);
  padding: 2px;
  line-height: 1;
}
.su-notes span { display: flex; align-items: center; justify-content: center; }

.sudoku-pad {
  display: grid;
  grid-template-columns: repeat(3, minmax(64px, 80px));
  gap: var(--space-2);
  width: min(92vw, 280px);
}
.sudoku-pad button {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: var(--space-2);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-2);
  font-family: var(--font-display);
  font-size: 1.6rem;
  color: var(--ink);
  cursor: pointer;
  transition: background var(--dur-1) var(--ease), border-color var(--dur-1) var(--ease);
  min-height: 56px;
}
.sudoku-pad button:hover { background: var(--surface-2); border-color: var(--ink-muted); }
.sudoku-pad button.is-done { color: var(--ink-faint); background: transparent; cursor: default; }
.sudoku-pad .su-pad-count {
  font-family: var(--font-ui);
  font-size: 0.7rem;
  color: var(--ink-muted);
  margin-top: 2px;
}
.sudoku-pad .su-pad-action {
  flex-direction: row;
  gap: var(--space-1);
  font-size: 0.8rem;
  font-family: var(--font-ui);
  min-height: 48px;
}
.sudoku-pad .su-pad-action.is-active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}
.sudoku-pad .su-pad-label { font-size: 0.85rem; }

@media (max-width: 880px) {
  .sudoku-pad { grid-template-columns: repeat(5, minmax(0, 1fr)); width: min(92vw, 540px); }
  .sudoku-pad button { font-size: 1.4rem; min-height: 48px; }
  .sudoku-pad .su-pad-action { font-size: 0.7rem; min-height: 40px; }
}

.diff-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-3);
}
.diff-tile {
  display: flex; flex-direction: column;
  gap: var(--space-1);
  padding: var(--space-4);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-2);
  cursor: pointer;
  transition: background var(--dur-1) var(--ease), border-color var(--dur-1) var(--ease);
}
.diff-tile:hover { background: var(--surface-2); border-color: var(--accent); }
.diff-tile .name { font-family: var(--font-display); font-size: 1.2rem; color: var(--ink); }
.diff-tile .hint { font-size: 0.85rem; color: var(--ink-muted); }

/* MINESWEEPER ------------------------------------------------------------ */
.ms-grid {
  display: grid;
  gap: 1px;
  background: var(--border-strong);
  padding: 2px;
  border-radius: var(--radius-2);
  border: 1px solid var(--border-strong);
  width: fit-content;
  margin-inline: auto;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.ms-grid[data-difficulty="beginner"]     { --ms-cell: 36px; }
.ms-grid[data-difficulty="intermediate"] { --ms-cell: 28px; }
.ms-grid[data-difficulty="expert"]       { --ms-cell: 24px; }
@media (max-width: 760px) {
  .ms-grid[data-difficulty="beginner"]     { --ms-cell: 32px; }
  .ms-grid[data-difficulty="intermediate"] { --ms-cell: 22px; }
  .ms-grid[data-difficulty="expert"]       { --ms-cell: clamp(14px, calc(92vw / 30), 22px); }
}
.ms-cell {
  width: var(--ms-cell);
  height: var(--ms-cell);
  display: flex; align-items: center; justify-content: center;
  background: var(--surface-2);
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: calc(var(--ms-cell) * 0.55);
  color: var(--ink);
  cursor: pointer;
  transition: background var(--dur-1) var(--ease);
}
.ms-cell:hover:not(.is-revealed):not(.is-flagged) { background: var(--accent-soft); }
.ms-cell.is-revealed {
  background: var(--surface);
  cursor: default;
}
.ms-cell.is-revealed.is-mine { background: oklch(54% 0.18 25 / 0.3); }
.ms-cell.is-flagged { color: var(--accent); }
.ms-cell .ms-mine { color: var(--ink); }
.ms-cell.n1 { color: oklch(50% 0.16 240); }
.ms-cell.n2 { color: oklch(50% 0.13 155); }
.ms-cell.n3 { color: var(--danger); }
.ms-cell.n4 { color: oklch(40% 0.17 280); }
.ms-cell.n5 { color: oklch(50% 0.14 30); }
.ms-cell.n6 { color: oklch(55% 0.12 195); }
.ms-cell.n7 { color: var(--ink); }
.ms-cell.n8 { color: var(--ink-muted); }
.ms-mines {
  font-family: var(--font-mono);
  color: var(--ink-muted);
  margin-right: var(--space-2);
}
.ms-mines .kbd { background: transparent; border: 0; padding: 0; color: var(--accent); }

/* PYRAMID ---------------------------------------------------------------- */
.pyramid-board {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-5);
  padding-block: var(--space-4);
}
.py-pyramid {
  position: relative;
}
.py-pyramid .card {
  position: absolute;
  transition: top var(--dur-2) var(--ease), opacity var(--dur-2) var(--ease);
}
.py-pyramid .card:not(.draggable) {
  cursor: default;
  filter: brightness(0.95) saturate(0.9);
}
.py-bottom {
  display: flex;
  align-items: center;
  gap: var(--space-5);
}
.py-meta {
  color: var(--ink-muted);
  font-size: 0.9rem;
}

@media (max-width: 720px) {
  .py-pyramid {
    transform: scale(0.72);
    transform-origin: top center;
    margin-bottom: calc(var(--card-h) * -1);
  }
}

/* PORTAL TILES (landing) ------------------------------------------------- */
.category-heading {
  margin-top: var(--space-7);
  margin-bottom: var(--space-4);
  font-family: var(--font-display);
  font-size: 1.4rem;
  color: var(--ink);
  position: relative;
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--border);
}
.category-heading::after {
  content: "";
  position: absolute;
  bottom: -1px;
  left: 0;
  width: 48px;
  height: 1px;
  background: var(--accent);
}
.game-tile-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-4);
}
@media (min-width: 580px) {
  .game-tile-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 880px) {
  .game-tile-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 1180px) {
  .game-tile-grid { grid-template-columns: repeat(4, 1fr); }
}
.game-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: var(--space-4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-3);
  text-decoration: none;
  color: inherit;
  overflow: hidden;
  transition: transform var(--dur-2) var(--ease), border-color var(--dur-2) var(--ease), box-shadow var(--dur-2) var(--ease);
}
.game-tile:hover {
  transform: translateY(-2px);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-2);
}
.game-tile.is-soon {
  cursor: default;
  opacity: 0.55;
  pointer-events: none;
}
.game-tile.is-soon::after {
  content: "Soon";
  position: absolute;
  top: var(--space-3);
  right: var(--space-3);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-muted);
  border: 1px solid var(--border-strong);
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

.game-tile__art {
  position: relative;
  height: 80px;
  margin-bottom: var(--space-3);
  display: flex;
  align-items: center;
  justify-content: center;
}
.game-tile__art .mini {
  width: 56px;
  height: 78px;
  background-size: cover;
  background-position: center;
  border-radius: 6px;
  box-shadow: var(--card-shadow);
  position: absolute;
}
.game-tile__title {
  font-family: var(--font-display);
  font-size: 1.15rem;
  margin-bottom: 4px;
  color: var(--ink);
}
.game-tile__title em { font-style: italic; color: var(--accent); }
.game-tile__desc {
  font-size: 0.9rem;
  color: var(--ink-muted);
  line-height: 1.45;
}

.game-tile__art--mini-sudoku { background: transparent; }
.mini-grid {
  display: grid;
  grid-template-columns: repeat(3, 22px);
  grid-template-rows: repeat(3, 22px);
  border: 1.5px solid var(--ink);
  background: var(--surface);
  font-family: var(--font-display);
  font-size: 0.9rem;
  color: var(--accent);
}
.mini-grid span {
  display: flex; align-items: center; justify-content: center;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.mini-grid span:nth-child(3n) { border-right: 0; }
.mini-grid span:nth-child(n+7) { border-bottom: 0; }

.game-tile__art--mini-mines { background: transparent; }
.mini-mines {
  display: grid;
  grid-template-columns: repeat(3, 22px);
  grid-template-rows: repeat(3, 22px);
  gap: 1px;
  background: var(--border-strong);
  padding: 1px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 0.7rem;
}
.mini-mines span {
  display: flex; align-items: center; justify-content: center;
}
.mini-mines .r  { background: var(--surface); }
.mini-mines .r.n1 { color: oklch(50% 0.16 240); }
.mini-mines .r.n2 { color: oklch(50% 0.13 155); }
.mini-mines .r.n3 { color: var(--danger); }
.mini-mines .m  { background: oklch(54% 0.18 25 / 0.3); color: var(--ink); }
.mini-mines .f  { background: var(--surface-2); color: var(--accent); }

.game-tile__art--mini-2048 { background: transparent; }
.mini-2048 {
  display: grid;
  grid-template-columns: repeat(2, 32px);
  grid-template-rows: repeat(2, 32px);
  gap: 4px;
  padding: 4px;
  background: var(--surface-2);
  border-radius: 6px;
}
.mini-2048 span {
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 0.85rem;
  border-radius: 4px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--border);
}
.mini-2048 span[data-v="2"]  { background: oklch(96% 0.02 60); }
.mini-2048 span[data-v="4"]  { background: oklch(94% 0.04 60); }
.mini-2048 span[data-v="8"]  { background: oklch(80% 0.10 50); color: var(--accent-ink); }
.mini-2048 span[data-v="16"] { background: oklch(72% 0.13 45); color: var(--accent-ink); }

/* Even more tile mini-arts */
.game-tile__art--simon { display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; width: 56px; height: 56px; gap: 3px; padding: 3px; background: var(--ink); border-radius: 50%; }
.game-tile__art--simon span { border-radius: 0; }
.game-tile__art--simon span:nth-child(1) { border-top-left-radius: 100%; }
.game-tile__art--simon span:nth-child(2) { border-top-right-radius: 100%; }
.game-tile__art--simon span:nth-child(3) { border-bottom-left-radius: 100%; }
.game-tile__art--simon span:nth-child(4) { border-bottom-right-radius: 100%; }
.game-tile__art--ttt { display: grid; grid-template-columns: repeat(3, 22px); grid-template-rows: repeat(3, 22px); gap: 2px; background: var(--ink); padding: 2px; border-radius: 4px; font-family: var(--font-display); font-size: 0.95rem; }
.game-tile__art--ttt span { display: flex; align-items: center; justify-content: center; background: var(--surface); color: var(--accent); }
.game-tile__art--rv { display: grid; grid-template-columns: repeat(4, 14px); grid-template-rows: repeat(3, 14px); gap: 2px; background: oklch(40% 0.10 145); padding: 3px; border-radius: 4px; }
.game-tile__art--rv span { background: oklch(60% 0.08 145); border-radius: 50%; }
.game-tile__art--rv span.b { background: var(--ink); }
.game-tile__art--rv span.w { background: oklch(98% 0 0); border: 1px solid var(--ink-muted); }
.game-tile__art--c4 { display: grid; grid-template-columns: repeat(4, 14px); grid-template-rows: repeat(3, 14px); gap: 2px; background: oklch(40% 0.14 245); padding: 3px; border-radius: 4px; }
.game-tile__art--c4 span { background: oklch(70% 0.08 245); border-radius: 50%; }
.game-tile__art--c4 span.r { background: oklch(60% 0.22 25); }
.game-tile__art--c4 span.y { background: oklch(80% 0.16 90); }
.game-tile__art--fl { display: flex; gap: 3px; font-family: var(--font-display); font-weight: 600; font-size: 0.9rem; }
.game-tile__art--fl span { width: 22px; height: 22px; display: flex; align-items: center; justify-content: center; color: var(--accent-ink); border-radius: 3px; }
.game-tile__art--fl span.hit { background: oklch(58% 0.16 145); }
.game-tile__art--fl span.present { background: oklch(75% 0.16 80); }
.game-tile__art--fl span.miss { background: oklch(48% 0.012 245); }
.game-tile__art--ws { display: grid; grid-template-columns: repeat(4, 15px); grid-template-rows: repeat(3, 15px); gap: 1px; background: var(--border); padding: 2px; font-family: var(--font-display); font-size: 0.7rem; font-weight: 600; color: var(--ink); }
.game-tile__art--ws span { display: flex; align-items: center; justify-content: center; background: var(--surface); }
.game-tile__art--ws span.hit { background: oklch(58% 0.16 145 / 0.3); color: oklch(38% 0.14 145); }

.game-tile__art--g24 { display: flex; align-items: center; justify-content: center; font-family: var(--font-display); font-weight: 600; font-size: 2.4rem; color: var(--accent); width: 60px; height: 60px; background: var(--surface-2); border-radius: 50%; border: 2px solid var(--accent); }
.game-tile__art--an { display: flex; gap: 3px; }
.game-tile__art--an span { width: 16px; height: 22px; display: flex; align-items: center; justify-content: center; background: var(--surface); border: 1px solid var(--border); border-radius: 2px; font-family: var(--font-display); font-weight: 600; font-size: 0.7rem; color: var(--ink); }
.game-tile__art--wl { display: flex; gap: 6px; align-items: center; font-family: var(--font-mono); font-weight: 600; font-size: 0.7rem; color: var(--ink); }
.game-tile__art--wl span { padding: 4px 6px; background: var(--surface); border: 1px solid var(--border); border-radius: 3px; }
.game-tile__art--wl .wl-arrow-mini { background: transparent; border: 0; color: var(--ink-muted); padding: 0; font-family: var(--font-ui); }
.game-tile__art--bo { display: grid; grid-template-columns: repeat(4, 12px); grid-template-rows: repeat(3, 8px); gap: 1px; position: relative; }
.game-tile__art--bo .r { width: 12px; height: 6px; border-radius: 1px; grid-column: span 1; }
.game-tile__art--bo .ball { position: absolute; bottom: 0; left: 50%; width: 6px; height: 6px; background: var(--ink); border-radius: 50%; transform: translateX(-50%); }
.game-tile__art--md { position: relative; width: 64px; height: 56px; }
.game-tile__art--md .incoming { position: absolute; top: 2px; left: 12px; width: 2px; height: 18px; background: var(--danger); transform: rotate(20deg); }
.game-tile__art--md .incoming.i2 { left: 44px; transform: rotate(-18deg); }
.game-tile__art--md .blast { position: absolute; top: 18px; left: 50%; width: 16px; height: 16px; margin-left: -8px; background: oklch(80% 0.16 90 / 0.6); border-radius: 50%; }
.game-tile__art--md .city { position: absolute; bottom: 0; width: 12px; height: 10px; background: oklch(60% 0.13 245); border-radius: 1px; }
.game-tile__art--md .city:nth-of-type(4) { left: 6px; }
.game-tile__art--md .city:nth-of-type(5) { left: 26px; }
.game-tile__art--md .city:nth-of-type(6) { left: 46px; }
.game-tile__art--ab { position: relative; width: 64px; height: 56px; }
.game-tile__art--ab .rock { position: absolute; width: 18px; height: 18px; border: 1.5px solid var(--ink-muted); border-radius: 40% 60% 55% 45%; top: 4px; left: 6px; }
.game-tile__art--ab .rock.r2 { width: 11px; height: 11px; top: 30px; left: 40px; border-radius: 55% 45% 50% 60%; }
.game-tile__art--ab .ship { position: absolute; top: 26px; left: 22px; width: 0; height: 0; border-left: 12px solid var(--accent); border-top: 7px solid transparent; border-bottom: 7px solid transparent; }

/* New game tile mini-arts ------------------------------------------------ */
.game-tile__art--dice { gap: 4px; font-size: 1.8rem; color: var(--ink); }
.game-tile__art--dice .mini-die { display: inline-block; }
.game-tile__art--ft { display: grid; grid-template-columns: repeat(2, 28px); grid-template-rows: repeat(2, 28px); gap: 3px; }
.game-tile__art--ft span {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 4px; display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-size: 1rem; color: var(--ink);
}
.game-tile__art--lo { display: grid; grid-template-columns: repeat(3, 18px); grid-template-rows: repeat(3, 18px); gap: 3px; }
.game-tile__art--lo span { background: var(--surface-2); border-radius: 3px; }
.game-tile__art--lo span.on { background: var(--accent); }
.game-tile__art--mm { display: flex; gap: 6px; }
.game-tile__art--mm span { width: 16px; height: 16px; border-radius: 50%; box-shadow: inset 0 2px 3px oklch(from var(--ink) l c h / 0.2); }
.game-tile__art--hanoi {
  display: flex; flex-direction: column-reverse; align-items: center; gap: 3px;
  width: 80px; padding-bottom: 8px;
  border-bottom: 2px solid oklch(from var(--ink) l c h / 0.4);
}
.game-tile__art--hanoi span { height: 8px; border-radius: 3px; }
.game-tile__art--ng { display: grid; grid-template-columns: repeat(3, 16px); grid-template-rows: repeat(3, 16px); gap: 2px; }
.game-tile__art--ng span { background: var(--surface); border: 1px solid var(--border); }
.game-tile__art--ng span.f { background: var(--ink); border-color: var(--ink); }
.game-tile__art--hg { font-family: var(--font-mono); font-size: 1.4rem; letter-spacing: 0.2em; color: var(--ink-muted); }
.game-tile__art--hg strong { color: var(--accent); font-weight: 600; }
.game-tile__art--sn { display: grid; grid-template-columns: repeat(4, 16px); grid-template-rows: repeat(2, 16px); gap: 2px; }
.game-tile__art--sn span { background: var(--surface-2); border-radius: 3px; }
.game-tile__art--sn span.on { background: var(--accent); }
.game-tile__art--sn span.head { background: oklch(from var(--accent) calc(l - 0.1) c h); }
.game-tile__art--sn span.food { background: var(--success); border-radius: 50%; transform: scale(0.7); }

/* Lights Out & Snake tiles render as inline SVG (explicit geometry can't
   collapse the way empty grid spans can). Fills via classes so they theme. */
.tile-sq        { fill: var(--surface-2); }
.tile-sq--on    { fill: var(--accent); }
.tile-sq--head  { fill: var(--ink); }
.tile-sq--food  { fill: var(--success); }

/* 2048 ------------------------------------------------------------------- */
.g2048-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(4, 1fr);
  gap: 8px;
  width: min(92vw, 460px);
  aspect-ratio: 1 / 1;
  margin-inline: auto;
  padding: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-3);
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: none;
}
.g2048-cell {
  position: relative;
  background: var(--bg);
  border-radius: var(--radius-2);
}
.g2048-tile {
  position: absolute;
  inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(1.4rem, 5vw, 2.2rem);
  color: var(--ink);
  border-radius: var(--radius-2);
  background: var(--surface);
  border: 1px solid var(--border);
  animation: tileIn 140ms var(--ease-out) both;
}
@keyframes tileIn { from { transform: scale(0.7); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.g2048-tile[data-v="2"]    { background: oklch(96% 0.02 60); }
.g2048-tile[data-v="4"]    { background: oklch(94% 0.04 60); }
.g2048-tile[data-v="8"]    { background: oklch(80% 0.10 50); color: var(--accent-ink); }
.g2048-tile[data-v="16"]   { background: oklch(72% 0.13 45); color: var(--accent-ink); }
.g2048-tile[data-v="32"]   { background: oklch(66% 0.15 40); color: var(--accent-ink); }
.g2048-tile[data-v="64"]   { background: oklch(60% 0.16 35); color: var(--accent-ink); }
.g2048-tile[data-v="128"]  { background: oklch(72% 0.16 90); color: var(--accent-ink); font-size: clamp(1.2rem, 4.4vw, 2rem); }
.g2048-tile[data-v="256"]  { background: oklch(70% 0.17 105); color: var(--accent-ink); font-size: clamp(1.2rem, 4.4vw, 2rem); }
.g2048-tile[data-v="512"]  { background: oklch(68% 0.18 120); color: var(--accent-ink); font-size: clamp(1.2rem, 4.4vw, 2rem); }
.g2048-tile[data-v="1024"] { background: oklch(62% 0.19 135); color: var(--accent-ink); font-size: clamp(1rem, 3.8vw, 1.7rem); }
.g2048-tile[data-v="2048"] { background: var(--accent); color: var(--accent-ink); font-size: clamp(1rem, 3.8vw, 1.7rem); box-shadow: 0 0 0 3px oklch(from var(--accent) l c h / 0.25); }
.g2048-tile[data-v="4096"], .g2048-tile[data-v="8192"], .g2048-tile[data-v="16384"], .g2048-tile[data-v="32768"], .g2048-tile[data-v="65536"] {
  background: var(--ink); color: var(--accent); font-size: clamp(0.9rem, 3.4vw, 1.5rem);
}
.g2048-score {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  font-size: 0.85rem;
  color: var(--ink-muted);
  padding-inline: var(--space-2);
}
.g2048-score strong {
  font-family: var(--font-mono);
  color: var(--ink);
  font-weight: 600;
}
@media (max-width: 480px) {
  .g2048-score { font-size: 0.75rem; padding-inline: 4px; }
}

/* MEMORY ----------------------------------------------------------------- */
.mem-grid {
  display: grid;
  gap: var(--space-2);
  width: 100%;
  max-width: 720px;
  margin-inline: auto;
  padding-block: var(--space-4);
}
.mem-grid .card {
  position: relative !important;
  width: 100%;
  height: auto;
  aspect-ratio: 84 / 118;
  cursor: pointer;
  top: auto !important;
  left: auto !important;
}
.mem-grid .card.is-matched { opacity: 0.45; cursor: default; }
.mem-stat {
  display: inline-flex; align-items: baseline; gap: 4px;
  font-size: 0.85rem; color: var(--ink-muted);
  padding-inline: var(--space-2);
}
.mem-stat .label { font-size: 0.7rem; letter-spacing: 0.08em; text-transform: uppercase; }
.mem-stat span:last-child { font-family: var(--font-mono); color: var(--ink); font-weight: 600; }

/* Clickable stat — used for difficulty selectors in the header */
button.mem-stat--btn {
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-1);
  padding: 4px 10px;
  cursor: pointer;
  display: inline-flex; gap: 4px; align-items: baseline;
  font: inherit; color: inherit;
  transition: background var(--dur-1) var(--ease), border-color var(--dur-1) var(--ease);
}
button.mem-stat--btn:hover { background: var(--surface); border-color: var(--accent); }
button.mem-stat--btn:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* 15 PUZZLE -------------------------------------------------------------- */
.fifteen-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(4, 1fr);
  gap: 4px;
  width: min(92vw, 420px);
  aspect-ratio: 1 / 1;
  margin-inline: auto;
  padding: 4px;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-3);
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: none;
}
.ft-tile {
  display: flex; align-items: center; justify-content: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-2);
  font-family: var(--font-display);
  font-size: clamp(1.4rem, 6vw, 2.4rem);
  color: var(--ink);
  cursor: pointer;
  transition: background var(--dur-1) var(--ease), transform var(--dur-2) var(--ease);
}
.ft-tile:hover { background: var(--surface-2); }
.ft-tile.is-gap { background: transparent; border: 1px dashed oklch(from var(--ink-faint) l c h / 0.4); cursor: default; }
.ft-tile.is-gap:hover { background: transparent; }

/* LIGHTS OUT ------------------------------------------------------------- */
.lo-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  grid-template-rows: repeat(5, 1fr);
  gap: 6px;
  width: min(92vw, 440px);
  aspect-ratio: 1 / 1;
  margin-inline: auto;
  padding: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-3);
  user-select: none; -webkit-tap-highlight-color: transparent;
}
.lo-cell {
  background: var(--surface);
  border-radius: var(--radius-2);
  cursor: pointer;
  transition: background var(--dur-2) var(--ease), box-shadow var(--dur-2) var(--ease);
  border: 1px solid var(--border);
}
.lo-cell:hover { background: var(--surface-2); }
.lo-cell.is-on {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 16px oklch(from var(--accent) l c h / 0.45), inset 0 0 12px oklch(from var(--accent) calc(l + 0.18) c h / 0.4);
}

/* MASTERMIND ------------------------------------------------------------- */
.mm-board {
  display: flex; flex-direction: column; gap: var(--space-4);
  align-items: center;
  padding-block: var(--space-4);
}
.mm-rows {
  display: flex; flex-direction: column; gap: 6px;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-3);
  padding: 10px;
}
.mm-row { display: flex; align-items: center; gap: var(--space-3); }
.mm-row--done { opacity: 0.95; }
.mm-row--future { opacity: 0.35; }
.mm-pegs { display: flex; gap: 6px; }
.mm-peg {
  width: 32px; height: 32px;
  border-radius: 50%;
  border: 1px solid oklch(from var(--ink) l c h / 0.18);
  background: var(--surface);
  box-shadow: inset 0 2px 4px oklch(from var(--ink) l c h / 0.18), 0 1px 1px oklch(from var(--ink) l c h / 0.08);
  cursor: default;
}
.mm-peg--slot { cursor: pointer; transition: transform var(--dur-1) var(--ease); }
.mm-peg--slot:hover { transform: scale(1.06); }
.mm-peg--empty { box-shadow: inset 0 2px 4px oklch(from var(--ink) l c h / 0.12); background: var(--surface-2); }
.mm-peg[data-color="red"]    { background: oklch(60% 0.22 25); }
.mm-peg[data-color="blue"]   { background: oklch(55% 0.18 245); }
.mm-peg[data-color="green"]  { background: oklch(58% 0.16 145); }
.mm-peg[data-color="yellow"] { background: oklch(85% 0.16 95); }
.mm-peg[data-color="purple"] { background: oklch(48% 0.18 305); }
.mm-peg[data-color="orange"] { background: oklch(70% 0.18 55); }
.mm-feedback {
  display: grid; grid-template-columns: repeat(2, 12px); grid-template-rows: repeat(2, 12px); gap: 3px;
  margin-inline-start: var(--space-2);
  padding-inline-start: var(--space-3);
  border-inline-start: 1px solid var(--border);
}
.mm-fb { width: 12px; height: 12px; border-radius: 50%; }
.mm-fb--black { background: var(--ink); }
.mm-fb--white { background: var(--surface); border: 1px solid var(--ink); }
.mm-fb--blank { background: transparent; }
.mm-submit {
  margin-inline-start: var(--space-3);
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--accent); color: var(--accent-ink);
  border: 0; cursor: pointer;
  font-size: 1.2rem; line-height: 1;
}
.mm-submit:disabled { opacity: 0.3; cursor: default; }
.mm-palette {
  display: flex; gap: 10px;
  padding: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-full);
}
.mm-palette-peg {
  width: 40px; height: 40px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: grab;
  touch-action: none;
  transition: transform var(--dur-1) var(--ease);
}
.mm-palette-peg:active { cursor: grabbing; }
.mm-palette-peg.is-dragging { z-index: 1000; }
.mm-palette-peg:hover { transform: scale(1.08); }
.mm-palette-peg.is-active { border-color: var(--accent); transform: scale(1.12); }
.mm-palette-peg[data-color="red"]    { background: oklch(60% 0.22 25); }
.mm-palette-peg[data-color="blue"]   { background: oklch(55% 0.18 245); }
.mm-palette-peg[data-color="green"]  { background: oklch(58% 0.16 145); }
.mm-palette-peg[data-color="yellow"] { background: oklch(85% 0.16 95); }
.mm-palette-peg[data-color="purple"] { background: oklch(48% 0.18 305); }
.mm-palette-peg[data-color="orange"] { background: oklch(70% 0.18 55); }

/* TOWER OF HANOI --------------------------------------------------------- */
.hanoi-board {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-3);
  width: min(96vw, 720px);
  margin-inline: auto;
  padding-block: var(--space-5);
  height: 280px;
}
.hanoi-peg {
  position: relative;
  cursor: pointer;
  border-radius: var(--radius-2);
  transition: background var(--dur-1) var(--ease);
  display: flex;
  flex-direction: column-reverse;
  align-items: center;
  padding-bottom: 8px;
}
.hanoi-peg::after {
  content: ""; position: absolute; bottom: 0; left: 0; right: 0;
  height: 8px; background: oklch(from var(--ink) l c h / 0.4);
  border-radius: 4px;
}
.hanoi-peg.is-selected { background: var(--accent-soft); }
.hanoi-peg:hover { background: oklch(from var(--ink) l c h / 0.04); }
.hanoi-pole {
  position: absolute; bottom: 8px; left: 50%; transform: translateX(-50%);
  width: 6px; height: calc(100% - 16px);
  background: oklch(from var(--ink) l c h / 0.35);
  border-radius: 3px;
  pointer-events: none;
}
.hanoi-stack {
  position: relative;
  display: flex; flex-direction: column-reverse;
  align-items: center;
  width: 100%;
  z-index: 1;
}
.hanoi-disc {
  height: 22px;
  background: var(--accent);
  border-radius: 6px;
  margin-bottom: 3px;
  box-shadow: inset 0 1px 0 oklch(from var(--accent) calc(l + 0.2) c h / 0.5), 0 1px 2px oklch(from var(--ink) l c h / 0.2);
}
.hanoi-disc[data-size="1"] { background: oklch(60% 0.18 25); }
.hanoi-disc[data-size="2"] { background: oklch(65% 0.16 55); }
.hanoi-disc[data-size="3"] { background: oklch(70% 0.15 85); }
.hanoi-disc[data-size="4"] { background: oklch(60% 0.14 145); }
.hanoi-disc[data-size="5"] { background: oklch(55% 0.16 195); }
.hanoi-disc[data-size="6"] { background: oklch(48% 0.16 245); }
.hanoi-disc[data-size="7"] { background: oklch(50% 0.18 285); }
.hanoi-disc[data-size="8"] { background: oklch(55% 0.18 325); }

/* SNAKE ------------------------------------------------------------------ */
.snake-grid {
  display: grid;
  gap: 1px;
  background: var(--border);
  padding: 2px;
  width: min(94vw, 480px);
  aspect-ratio: 1 / 1;
  margin-inline: auto;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-2);
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.sn-cell { background: var(--bg); }
.sn-cell.is-snake { background: var(--accent); }
.sn-cell.is-head { background: oklch(from var(--accent) calc(l - 0.1) c h); }
.sn-cell.is-food {
  background: var(--success);
  border-radius: 50%;
  transform: scale(0.7);
  transition: transform var(--dur-1) var(--ease);
}

/* YAHTZEE ---------------------------------------------------------------- */
.yz-layout {
  display: flex; flex-direction: column;
  gap: var(--space-5);
  align-items: center;
  padding-block: var(--space-4);
}
@media (min-width: 880px) {
  .yz-layout { flex-direction: row; align-items: flex-start; justify-content: center; gap: var(--space-7); }
}
.yz-play { display: flex; flex-direction: column; gap: var(--space-4); align-items: center; }
.yz-dice { display: flex; gap: var(--space-2); }
.yz-die {
  width: 56px; height: 56px;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: var(--radius-2); cursor: pointer;
  font-size: 2.6rem; line-height: 1; color: var(--ink);
  transition: transform var(--dur-1) var(--ease), background var(--dur-1) var(--ease);
  user-select: none;
}
.yz-die:hover { background: var(--surface-2); }
.yz-die.is-held { background: var(--accent-soft); border-color: var(--accent); transform: translateY(4px); }
.yz-sheet {
  display: flex; flex-direction: column;
  gap: 2px;
  min-width: 240px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-2);
  padding: var(--space-3) var(--space-4);
}
.yz-sheet h3 {
  font-family: var(--font-display);
  font-size: 0.95rem;
  color: var(--ink-muted);
  margin-top: var(--space-2);
  margin-bottom: var(--space-1);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.yz-sheet h3:first-child { margin-top: 0; }
.yz-row {
  display: flex; justify-content: space-between;
  padding: 6px 4px;
  border-radius: var(--radius-1);
  font-size: 0.95rem;
}
.yz-row.is-pickable { background: oklch(from var(--accent) calc(l + 0.2) c h / 0.18); cursor: pointer; }
.yz-row.is-pickable:hover { background: oklch(from var(--accent) calc(l + 0.15) c h / 0.32); }
.yz-row.is-locked { color: var(--ink-muted); }
.yz-row.is-locked .yz-val { color: var(--ink); font-family: var(--font-mono); font-weight: 600; }
.yz-row .yz-val { font-family: var(--font-mono); color: var(--ink-faint); }
.yz-row.is-pickable .yz-val { color: var(--accent); font-weight: 600; }
.yz-row--sub { color: var(--ink-muted); font-size: 0.85rem; padding: 4px; border-top: 1px solid var(--border); margin-top: 2px; }
.yz-row--total { font-family: var(--font-display); font-size: 1.2rem; padding: 8px 4px; border-top: 2px solid var(--ink); margin-top: 4px; }

/* HANGMAN ---------------------------------------------------------------- */
.hg-layout {
  display: flex; flex-direction: column; gap: var(--space-5);
  align-items: center;
  padding-block: var(--space-4);
}
@media (min-width: 720px) {
  .hg-layout { flex-direction: row; align-items: flex-start; justify-content: center; gap: var(--space-7); }
}
.hg-figure {
  width: 200px; height: 240px;
  color: var(--ink);
}
.hg-figure .hg-part { opacity: 0; transition: opacity var(--dur-2) var(--ease); }
.hg-figure .hg-part.is-shown { opacity: 1; }
.hg-play { display: flex; flex-direction: column; gap: var(--space-4); align-items: center; }
.hg-word {
  display: flex; flex-wrap: wrap; gap: 8px;
  font-family: var(--font-mono);
  font-size: 1.6rem;
  letter-spacing: 0.05em;
  color: var(--ink);
  justify-content: center;
}
.hg-slot {
  min-width: 24px;
  text-align: center;
  border-bottom: 2px solid var(--ink-muted);
  padding: 4px 2px;
  text-transform: uppercase;
}
.hg-slot--punct { border-bottom: 0; }
.hg-slot--reveal { color: var(--danger); }
.hg-alphabet {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 40px));
  gap: 4px;
}
@media (min-width: 480px) {
  .hg-alphabet { grid-template-columns: repeat(13, minmax(0, 36px)); }
}
.hg-letter {
  height: 40px;
  background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: var(--radius-1);
  font-family: var(--font-display);
  font-size: 1rem;
  color: var(--ink);
  cursor: pointer;
  transition: background var(--dur-1) var(--ease);
}
.hg-letter:hover { background: var(--surface-2); }
.hg-letter:disabled { cursor: default; opacity: 0.7; }
.hg-letter.is-hit  { background: oklch(from var(--success) calc(l + 0.3) c h / 0.4); color: var(--success); }
.hg-letter.is-miss { background: oklch(from var(--danger) calc(l + 0.3) c h / 0.3); color: var(--danger); text-decoration: line-through; }

/* NONOGRAM --------------------------------------------------------------- */
.ng-wrap {
  display: flex; justify-content: center;
  padding-block: var(--space-4);
  overflow-x: auto;
}
.ng-table { border-collapse: collapse; user-select: none; -webkit-tap-highlight-color: transparent; }
.ng-table th, .ng-table td {
  width: 32px; height: 32px;
  border: 1px solid var(--border);
  text-align: center;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--ink-muted);
}
.ng-table .ng-row-hint { font-weight: 600; text-align: right; padding-right: 6px; min-width: 60px; white-space: nowrap; color: var(--ink); border: 0; }
.ng-table .ng-col-hint { font-weight: 600; padding-top: 2px; color: var(--ink); border: 0; }
.ng-table .ng-corner { border: 0; }
.ng-table .ng-cell { cursor: pointer; background: var(--surface); transition: background var(--dur-1) var(--ease); }
.ng-table .ng-cell:hover { background: var(--surface-2); }
.ng-table .ng-cell.is-filled { background: var(--ink); }
.ng-table .ng-cell.is-mark::after { content: "×"; color: var(--ink-muted); font-size: 1.1rem; }
.ng-table .ng-major-right  { border-right-width: 2px; border-right-color: var(--ink-muted); }
.ng-table .ng-major-bottom { border-bottom-width: 2px; border-bottom-color: var(--ink-muted); }

/* SPIDER ----------------------------------------------------------------- */
.spider-board { display: flex; flex-direction: column; gap: var(--space-5); padding-block: var(--space-3); }
.sp-cascades {
  display: grid;
  grid-template-columns: repeat(10, var(--card-w));
  gap: var(--space-2);
  justify-content: center;
}
.sp-cascade {
  position: relative;
  width: var(--card-w);
  min-height: var(--card-h);
}
.sp-cascade:empty {
  border-radius: var(--card-radius);
  border: 2px dashed var(--pile-outline);
  background: oklch(from var(--ink) l c h / 0.06);
}
.sp-cascade .card { transition: top var(--dur-2) var(--ease), transform var(--dur-2) var(--ease), box-shadow var(--dur-2) var(--ease); }
.sp-cascade.drop-ok::before, .sp-cascade.drop-bad::before {
  content: ""; position: absolute; inset: 0;
  width: var(--card-w); height: var(--card-h);
  border-radius: var(--card-radius); border: 1px dashed;
  pointer-events: none;
}
.sp-cascade.drop-ok::before  { border-color: var(--success); background: oklch(50% 0.11 155 / 0.08); }
.sp-cascade.drop-bad::before { border-color: var(--danger);  background: oklch(54% 0.18 25 / 0.06); }

.sp-stock-row { display: flex; justify-content: flex-end; }
.sp-stock {
  position: relative;
  width: calc(var(--card-w) + 30px);
  height: var(--card-h);
  cursor: pointer;
}
.sp-stock::after {
  content: attr(data-deals) "×";
  position: absolute; top: -18px; right: 0;
  font-family: var(--font-mono); font-size: 0.75rem;
  color: var(--ink-muted);
}

@media (max-width: 880px) {
  .spider-board { --card-w: 56px; --card-h: 80px; }
  .sp-cascades { grid-template-columns: repeat(10, minmax(0, 1fr)); }
}

/* FIVE LETTERS ----------------------------------------------------------- */
.fl-board { display: flex; flex-direction: column; align-items: center; gap: var(--space-4); padding-block: var(--space-4); }
.fl-grid { display: flex; flex-direction: column; gap: 5px; }
.fl-row { display: flex; gap: 5px; transition: transform var(--dur-2) var(--ease); }
.fl-row.fl-flash { animation: flShake 350ms; }
@keyframes flShake { 25% { transform: translateX(-6px); } 50% { transform: translateX(6px); } 75% { transform: translateX(-3px); } }
.fl-tile {
  width: 52px; height: 52px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 600;
  font-size: 1.8rem;
  border: 2px solid var(--border-strong);
  background: var(--surface);
  color: var(--ink);
  text-transform: uppercase;
}
.fl-tile--filled { border-color: var(--ink-muted); }
.fl-tile--hit     { background: oklch(58% 0.16 145); border-color: oklch(58% 0.16 145); color: var(--accent-ink); }
.fl-tile--present { background: oklch(75% 0.16 80);  border-color: oklch(75% 0.16 80);  color: var(--accent-ink); }
.fl-tile--miss    { background: oklch(48% 0.012 245); border-color: oklch(48% 0.012 245); color: var(--accent-ink); }
.fl-msg {
  min-height: 24px;
  font-size: 0.9rem; color: var(--danger);
  opacity: 0; transition: opacity var(--dur-1) var(--ease);
}
.fl-msg.fl-msg--show { opacity: 1; }
.fl-keyboard { display: flex; flex-direction: column; gap: 4px; user-select: none; -webkit-tap-highlight-color: transparent; }
.fl-kbd-row { display: flex; justify-content: center; gap: 4px; }
.fl-key {
  min-width: 28px; height: 44px;
  padding: 0 6px;
  background: var(--surface-2); border: 1px solid var(--border-strong);
  border-radius: var(--radius-1);
  font-family: var(--font-display); font-weight: 600;
  font-size: 0.95rem; color: var(--ink); cursor: pointer;
  transition: background var(--dur-1) var(--ease);
}
.fl-key:hover { background: var(--surface); }
.fl-key--wide { min-width: 56px; font-size: 0.8rem; }
.fl-key--hit     { background: oklch(58% 0.16 145); border-color: oklch(58% 0.16 145); color: var(--accent-ink); }
.fl-key--present { background: oklch(75% 0.16 80);  border-color: oklch(75% 0.16 80);  color: var(--accent-ink); }
.fl-key--miss    { background: oklch(48% 0.012 245); border-color: oklch(48% 0.012 245); color: var(--accent-ink); }
@media (max-width: 480px) {
  .fl-tile { width: 42px; height: 42px; font-size: 1.4rem; }
  .fl-key { min-width: 22px; height: 40px; padding: 0 4px; }
  .fl-key--wide { min-width: 48px; }
}

/* YUKON ------------------------------------------------------------------ */
.yk-board { display: grid; grid-template-rows: auto 1fr; gap: var(--space-5); padding-block: var(--space-3); }
.yk-tableau {
  display: grid; grid-template-columns: repeat(7, var(--card-w));
  gap: var(--space-3);
  justify-content: center;
  width: 100%;
  max-width: calc(7 * var(--card-w) + 6 * var(--space-3));
  margin-inline: auto;
}
.yk-tableau-pile {
  position: relative; width: var(--card-w); min-height: var(--card-h);
}
.yk-tableau-pile:empty {
  border-radius: var(--card-radius);
  border: 2px dashed var(--pile-outline);
  background: oklch(from var(--ink) l c h / 0.06);
}
.yk-tableau-pile .card { transition: top var(--dur-2) var(--ease), transform var(--dur-2) var(--ease), box-shadow var(--dur-2) var(--ease); }
.yk-tableau-pile.drop-ok::before, .yk-tableau-pile.drop-bad::before {
  content: ""; position: absolute; inset: 0;
  width: var(--card-w); height: var(--card-h);
  border-radius: var(--card-radius); border: 1px dashed;
  pointer-events: none;
}
.yk-tableau-pile.drop-ok::before  { border-color: var(--success); background: oklch(50% 0.11 155 / 0.08); }
.yk-tableau-pile.drop-bad::before { border-color: var(--danger);  background: oklch(54% 0.18 25 / 0.06); }

/* GOLF ------------------------------------------------------------------- */
.gf-board { display: flex; flex-direction: column; gap: var(--space-5); padding-block: var(--space-3); align-items: center; }
.gf-cols {
  display: grid; grid-template-columns: repeat(7, var(--card-w));
  gap: var(--space-3);
}
.gf-col { position: relative; width: var(--card-w); min-height: var(--card-h); }
.gf-col .card { transition: top var(--dur-2) var(--ease), box-shadow var(--dur-2) var(--ease); cursor: default; }
.gf-col .card.draggable { cursor: pointer; }
.gf-col .card.draggable.gf-playable { box-shadow: 0 0 0 2px var(--success), var(--card-shadow); }
.gf-bottom { display: flex; align-items: center; gap: var(--space-4); }
.gf-meta { color: var(--ink-muted); font-size: 0.85rem; font-family: var(--font-mono); }

/* WORD SEARCH ------------------------------------------------------------ */
.ws-layout {
  display: flex; flex-direction: column; gap: var(--space-4);
  align-items: center; padding-block: var(--space-4);
}
@media (min-width: 880px) {
  .ws-layout { flex-direction: row; align-items: flex-start; justify-content: center; gap: var(--space-7); }
}
.ws-grid {
  display: grid;
  width: min(94vw, 560px);
  aspect-ratio: 1 / 1;
  gap: 2px;
  background: var(--border);
  padding: 3px;
  border-radius: var(--radius-2);
  border: 1px solid var(--border-strong);
  user-select: none; -webkit-tap-highlight-color: transparent;
  touch-action: none;
}
.ws-cell {
  display: flex; align-items: center; justify-content: center;
  background: var(--surface);
  font-family: var(--font-display);
  font-size: clamp(0.8rem, 2.6vw, 1.1rem);
  color: var(--ink);
  cursor: pointer;
}
.ws-cell.is-selecting { background: var(--accent-soft); }
.ws-cell.is-found     { background: oklch(58% 0.16 145 / 0.3); color: oklch(38% 0.14 145); }
.ws-words {
  list-style: none; padding: 0; margin: 0;
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 4px 12px;
  font-family: var(--font-mono); font-size: 0.95rem;
  min-width: 200px;
}
.ws-words li { color: var(--ink); padding: 2px 0; }
.ws-words li.is-found { color: var(--ink-faint); text-decoration: line-through; }

/* SIMON ------------------------------------------------------------------ */
.sm-board { display: flex; flex-direction: column; align-items: center; gap: var(--space-5); padding-block: var(--space-5); }
.sm-status { font-family: var(--font-display); font-size: 1.2rem; color: var(--ink-muted); min-height: 28px; }
.sm-pads {
  display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr;
  width: min(80vw, 320px); aspect-ratio: 1 / 1;
  gap: 8px;
  padding: 16px;
  background: var(--ink); border-radius: 50%;
}
.sm-pad {
  border: 0; cursor: pointer;
  transition: filter var(--dur-1) var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.sm-pad[data-color="red"]    { background: oklch(50% 0.18 25); border-top-left-radius: 100%; }
.sm-pad[data-color="green"]  { background: oklch(48% 0.16 145); border-top-right-radius: 100%; }
.sm-pad[data-color="blue"]   { background: oklch(45% 0.16 245); border-bottom-left-radius: 100%; }
.sm-pad[data-color="yellow"] { background: oklch(65% 0.16 85);  border-bottom-right-radius: 100%; }
.sm-pad.is-active { filter: brightness(1.6); }

/* TIC-TAC-TOE ------------------------------------------------------------ */
.ttt-board { display: flex; flex-direction: column; align-items: center; gap: var(--space-5); padding-block: var(--space-5); }
.ttt-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr);
  width: min(80vw, 360px); aspect-ratio: 1 / 1;
  gap: 4px; padding: 4px;
  background: var(--ink); border-radius: var(--radius-3);
  user-select: none;
}
.ttt-cell {
  display: flex; align-items: center; justify-content: center;
  background: var(--surface);
  font-family: var(--font-display); font-size: clamp(2rem, 8vw, 4rem);
  color: var(--ink); cursor: pointer;
  border-radius: var(--radius-2);
}
.ttt-cell.is-x { color: var(--accent); }
.ttt-cell.is-o { color: oklch(48% 0.16 245); }
.ttt-cell.is-win { background: oklch(58% 0.16 145 / 0.3); }
.ttt-cell:empty:hover { background: var(--surface-2); }
.ttt-mark-pick { display: flex; gap: var(--space-2); }

/* REVERSI ---------------------------------------------------------------- */
.rv-board { display: flex; flex-direction: column; align-items: center; gap: var(--space-4); padding-block: var(--space-5); }
.rv-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr); grid-template-rows: repeat(8, 1fr);
  width: min(92vw, 480px); aspect-ratio: 1 / 1;
  gap: 1px; padding: 1px;
  background: oklch(30% 0.06 145);
  border: 2px solid oklch(20% 0.04 145);
  border-radius: var(--radius-2);
  user-select: none; -webkit-tap-highlight-color: transparent;
}
.rv-cell {
  background: oklch(45% 0.10 145);
  display: flex; align-items: center; justify-content: center;
  cursor: default;
}
.rv-cell.is-legal { cursor: pointer; }
.rv-cell.is-legal::after {
  content: ""; width: 28%; height: 28%; border-radius: 50%;
  background: oklch(55% 0.08 145);
  opacity: 0.7;
}
.rv-disc { width: 80%; height: 80%; border-radius: 50%; box-shadow: 0 2px 3px oklch(0% 0 0 / 0.3); }
.rv-disc--black { background: var(--ink); }
.rv-disc--white { background: oklch(98% 0 0); border: 1px solid var(--ink-muted); }
.rv-pip { display: inline-block; width: 12px; height: 12px; border-radius: 50%; vertical-align: middle; margin-right: 4px; }
.rv-pip--black { background: var(--ink); }
.rv-pip--white { background: oklch(98% 0 0); border: 1px solid var(--ink-muted); }
.rv-colour-pick { display: flex; gap: var(--space-2); }

/* CONNECT FOUR ----------------------------------------------------------- */
.c4-board { display: flex; flex-direction: column; align-items: center; gap: var(--space-4); padding-block: var(--space-5); }
.c4-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  grid-template-rows: repeat(6, 1fr);
  width: min(94vw, 480px); aspect-ratio: 7 / 6;
  gap: 4px; padding: 8px;
  background: oklch(40% 0.14 245);
  border-radius: var(--radius-3);
  user-select: none; -webkit-tap-highlight-color: transparent;
}
.c4-cell {
  background: oklch(70% 0.08 245);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: background var(--dur-1) var(--ease);
}
.c4-cell:hover { background: oklch(78% 0.08 245); }
.c4-disc {
  width: 86%; height: 86%; border-radius: 50%;
  box-shadow: inset 0 -3px 4px oklch(0% 0 0 / 0.2), 0 2px 3px oklch(0% 0 0 / 0.18);
}
.c4-disc--p1 { background: oklch(60% 0.22 25); }
.c4-disc--p2 { background: oklch(80% 0.16 90); }
.c4-disc.is-win { animation: c4Win 1s infinite alternate; }
@keyframes c4Win { from { transform: scale(1); } to { transform: scale(1.12); } }

/* 24 GAME ---------------------------------------------------------------- */
.g24-board { display: flex; flex-direction: column; align-items: center; gap: var(--space-4); padding-block: var(--space-5); max-width: 540px; margin-inline: auto; }
.g24-target { font-family: var(--font-display); font-size: 1.4rem; color: var(--ink-muted); }
.g24-target strong { color: var(--accent); font-size: 1.8rem; }
.g24-digits { display: flex; gap: var(--space-2); flex-wrap: wrap; justify-content: center; }
.g24-digit {
  width: 52px; height: 52px;
  background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: var(--radius-2);
  font-family: var(--font-display); font-size: 1.6rem; color: var(--ink);
  cursor: pointer;
}
.g24-digit:hover { background: var(--surface-2); }
.g24-ops { display: flex; gap: var(--space-1); }
.g24-op {
  width: 44px; height: 44px;
  background: var(--surface-2); border: 1px solid var(--border-strong);
  border-radius: var(--radius-1);
  font-family: var(--font-display); font-size: 1.2rem; color: var(--ink);
  cursor: pointer;
}
.g24-op:hover { background: var(--surface); }
.g24-input {
  width: 100%; max-width: 420px;
  padding: var(--space-3); font-size: 1.2rem;
  font-family: var(--font-mono); background: var(--surface);
  border: 1px solid var(--border-strong); border-radius: var(--radius-2);
  color: var(--ink); text-align: center;
}
.g24-buttons { display: flex; gap: var(--space-2); flex-wrap: wrap; justify-content: center; }
.g24-msg { min-height: 24px; font-family: var(--font-mono); color: var(--ink); }
.g24-msg.is-error { color: var(--danger); }
.g24-msg.is-success { color: var(--success); font-weight: 600; }
.g24-hint { font-size: 0.95rem; color: var(--ink-muted); padding: var(--space-2); background: var(--surface-2); border-radius: var(--radius-1); }
.g24-hint strong { color: var(--accent); font-family: var(--font-mono); }

/* ANAGRAMS --------------------------------------------------------------- */
.an-board { display: flex; flex-direction: column; align-items: center; gap: var(--space-4); padding-block: var(--space-5); max-width: 620px; margin-inline: auto; }
.an-pool { display: flex; gap: var(--space-2); flex-wrap: wrap; justify-content: center; }
.an-tile {
  width: 48px; height: 48px;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: var(--radius-2);
  font-family: var(--font-display); font-weight: 600; font-size: 1.4rem; color: var(--ink);
}
.an-input-row { display: flex; gap: var(--space-2); flex-wrap: wrap; justify-content: center; }
.an-input {
  padding: var(--space-3); font-size: 1.1rem;
  font-family: var(--font-mono); background: var(--surface);
  border: 1px solid var(--border-strong); border-radius: var(--radius-2);
  color: var(--ink); min-width: 180px;
}
.an-found { display: flex; flex-direction: column; gap: 4px; width: 100%; max-width: 480px; }
.an-found-row { display: flex; gap: 6px; flex-wrap: wrap; align-items: baseline; }
.an-found-row .an-len { font-family: var(--font-mono); color: var(--ink-muted); font-size: 0.8rem; min-width: 22px; }
.an-word { font-family: var(--font-mono); padding: 2px 6px; background: var(--surface-2); border-radius: var(--radius-1); color: var(--ink-muted); }
.an-word.is-found { background: oklch(58% 0.16 145 / 0.2); color: oklch(38% 0.14 145); font-weight: 600; }
.an-given { display: flex; gap: 4px; flex-wrap: wrap; justify-content: center; max-width: 480px; }

/* WORD LADDER ------------------------------------------------------------ */
.wl-board { display: flex; flex-direction: column; align-items: center; gap: var(--space-4); padding-block: var(--space-5); max-width: 540px; margin-inline: auto; }
.wl-goal { display: flex; gap: var(--space-3); align-items: center; font-family: var(--font-display); font-size: 1.6rem; }
.wl-goal-w { padding: 8px 14px; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-2); letter-spacing: 0.1em; }
.wl-goal-target { background: var(--accent-soft); border-color: var(--accent); }
.wl-arrow { color: var(--ink-muted); font-size: 1.2rem; }
.wl-chain { display: flex; flex-direction: column; gap: 4px; align-items: center; }
.wl-step { display: flex; gap: 2px; }
.wl-letter { width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-1); font-family: var(--font-display); font-weight: 600; color: var(--accent); }
.wl-letter.is-same { color: var(--ink); background: var(--surface-2); }
.wl-input-row { display: flex; gap: var(--space-2); flex-wrap: wrap; justify-content: center; }
.wl-word { padding: 2px 6px; background: var(--surface-2); border-radius: var(--radius-1); }

/* BREAKOUT --------------------------------------------------------------- */
.bo-board { display: flex; justify-content: center; padding-block: var(--space-4); }
#bo-canvas {
  display: block;
  max-width: 100%;
  border-radius: var(--radius-2);
  border: 1px solid var(--border-strong);
  touch-action: none;
  cursor: none;
}

/* Asteroid Belt on-screen touch controls -------------------------------- */
.touch-pad {
  display: flex;
  justify-content: center;
  gap: var(--space-3);
  padding-block: var(--space-3);
}
.touch-btn {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-full);
  font-size: 1.4rem;
  line-height: 1;
  padding: 0;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}
.touch-btn--fire { color: var(--accent); border-color: var(--accent); }
@media (hover: hover) and (pointer: fine) {
  .touch-pad { display: none; }
}

/* TRI PEAKS -------------------------------------------------------------- */
.tripeaks-board {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-5);
  padding-block: var(--space-4);
}
.tp-peaks {
  position: relative;
}
.tp-peaks .card {
  position: absolute;
  transition: top var(--dur-2) var(--ease), opacity var(--dur-2) var(--ease);
}
.tp-peaks .card:not(.draggable) {
  cursor: default;
}
.tp-bottom {
  display: flex;
  align-items: center;
  gap: var(--space-5);
}
@media (max-width: 900px) {
  .tp-peaks {
    transform: scale(0.6);
    transform-origin: top center;
    margin-bottom: calc(var(--card-h) * -1.4);
  }
}

/* BLACKJACK -------------------------------------------------------------- */
.bj-board {
  display: grid;
  gap: var(--space-6);
  padding-block: var(--space-5);
}
.hand-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
}
.hand-area__label {
  display: flex;
  align-items: baseline;
  gap: var(--space-3);
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 500;
  font-size: 1.4rem;
  color: var(--ink);
}
.hand-area__label .score {
  font-family: var(--font-mono);
  font-style: normal;
  font-size: 0.95rem;
  color: var(--ink-muted);
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 2px 10px;
  border-radius: var(--radius-full);
}
.hand-area__label .score.bust  { color: var(--danger);  border-color: oklch(54% 0.18 25 / 0.4); }
.hand-area__label .score.bj    { color: var(--accent);  border-color: oklch(60% 0.13 42 / 0.5); }

.dealer-cards, .player-cards {
  position: relative;
  min-height: var(--card-h);
  width: 100%;
  max-width: 520px;
  display: flex;
  justify-content: center;
}
.dealer-cards .card, .player-cards .card {
  position: relative;
  margin-inline: -28px;  /* overlap fan */
}
.dealer-cards .card:first-child, .player-cards .card:first-child { margin-inline: 0; }

.result-banner {
  max-width: 520px;
  margin-inline: auto;
  width: 100%;
  text-align: center;
  font-family: var(--font-ui);
  font-size: 0.95rem;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-2);
  border: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  animation: bannerIn 200ms var(--ease-out) both;
}
.result-banner[hidden] { display: none; }
.result-banner .rule { flex: 1; height: 1px; background: var(--border); }
.result-banner .verb { font-weight: 500; }
.result-banner.win  .verb  { color: var(--success); }
.result-banner.lose .verb  { color: var(--danger); }
.result-banner.tie  .verb  { color: var(--ink-muted); }

.bj-controls {
  display: grid;
  gap: var(--space-4);
  max-width: 520px;
  margin-inline: auto;
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-3);
  padding: var(--space-4);
}
.bet-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}
.bet-row .label {
  font-size: 0.85rem;
  color: var(--ink-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.bet-stepper {
  display: inline-flex;
  align-items: center;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  height: 36px;
}
.bet-stepper button {
  width: 32px; height: 100%;
  display: flex; align-items: center; justify-content: center;
  color: var(--ink-muted);
  font-size: 1.1rem;
  border-radius: var(--radius-full);
  transition: background var(--dur-1) var(--ease);
}
.bet-stepper button:hover { background: var(--surface); color: var(--ink); }
.bet-stepper .value {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 0.95rem;
  min-width: 80px;
  text-align: center;
  color: var(--ink);
}
.action-row {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
}
.action-row .btn { flex: 1; min-width: 0; }

/* Privacy page ----------------------------------------------------------- */
.prose {
  max-width: 65ch;
  margin-inline: auto;
  padding-block: var(--space-7);
}
.prose h1 { margin-bottom: var(--space-5); }
.prose h2 { margin-top: var(--space-6); margin-bottom: var(--space-3); font-size: 1.4rem; }
.prose h3 { margin-top: var(--space-5); margin-bottom: var(--space-2); font-size: 1.05rem; }
.prose p,
.prose ul,
.prose ol { margin-bottom: var(--space-4); line-height: 1.7; color: var(--ink); }
.prose ul, .prose ol { padding-left: var(--space-5); }
.prose li + li { margin-top: var(--space-2); }
.prose a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.prose .meta {
  font-size: 0.85rem;
  color: var(--ink-muted);
  margin-bottom: var(--space-6);
  font-family: var(--font-mono);
}

/* Related games — "You might also like" -------------------------------- */
.related {
  margin-block: var(--space-7) var(--space-6);
  padding-top: var(--space-6);
  border-top: 1px solid var(--border);
}
.related__heading {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 500;
  margin-bottom: var(--space-4);
}
.related__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: var(--space-3);
}
.related-tile {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  padding: var(--space-4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-2);
  text-decoration: none;
  color: var(--ink);
  transition: border-color var(--dur-1) var(--ease), transform var(--dur-1) var(--ease);
}
.related-tile:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}
.related-tile__name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.02rem;
}
.related-tile__desc {
  font-size: 0.85rem;
  color: var(--ink-muted);
  line-height: 1.5;
}
[data-theme="large"] .related-tile__desc { font-size: 0.95rem; }

/* Mahjong Solitaire ---------------------------------------------------- */
.mj-wrap { width: 100%; }
.mahjong {
  position: relative;
  margin-inline: auto;
  padding: 0;                 /* override .board's felt padding — tiles are absolutely placed */
  box-sizing: border-box;
  transform-origin: top left;
}
.mj-tile {
  position: absolute;
  width: 46px;
  height: 60px;
  margin: 0;
  padding: 0;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-1);
  background: var(--surface);
  /* right + bottom edge gives a carved, stacked-tile depth */
  box-shadow: 3px 3px 0 0 var(--surface-2), 3px 3px 0 1px var(--border-strong);
  cursor: default;
  transition: transform var(--dur-1) var(--ease), box-shadow var(--dur-1) var(--ease);
  color: var(--ink);
}
.mj-tile__face {
  display: block;
  width: 100%;
  height: 100%;
  transition: opacity var(--dur-1) var(--ease);
}
.mj-face { width: 100%; height: 100%; display: block; }
/* Blocked tiles stay fully OPAQUE — dim only the face artwork so the tiles
   stacked behind never bleed through. Convey state via an opaque muted
   background + softer border. */
.mj-tile.mj-blocked {
  background: var(--surface-2);
  border-color: var(--border);
}
.mj-tile.mj-blocked .mj-tile__face { opacity: 0.4; }
/* "Darken unavailable tiles" off — blocked faces render at full strength.
   The tile body stays opaque either way; only the face artwork is gated. */
.mahjong.mj-no-darken .mj-tile.mj-blocked .mj-tile__face { opacity: 1; }
.mahjong.mj-no-darken .mj-tile.mj-blocked { background: var(--surface); }
/* Free tiles are the clickable ones — keep them full-strength, lift them. */
.mj-tile.mj-free {
  cursor: pointer;
  background: var(--surface);
  border-color: var(--border-strong);
  box-shadow: 3px 3px 0 0 var(--surface-2), 3px 3px 0 1px var(--border-strong),
              0 0 0 1px var(--accent-soft);
}
.mj-tile.mj-free:hover {
  transform: translate(-1px, -1px);
  border-color: var(--accent);
  box-shadow: 4px 4px 0 0 var(--surface-2), 4px 4px 0 1px var(--border-strong),
              0 0 0 1px var(--accent);
}
.mj-tile.mj-selected {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  background: var(--accent-soft);
}
.mj-tile.mj-selected .mj-tile__face { opacity: 1; }
.mj-tile.mj-hint { outline: 2px solid var(--success); outline-offset: 1px; }
.mj-tile.mj-hint .mj-tile__face { opacity: 1; }

/* suit colours — currentColor drives the SVG fills/strokes */
.mj-suit-dots   { color: #2f6f9f; }
.mj-suit-bamboo { color: #3f7d4e; }
.mj-suit-chars,
.mj-suit-wind   { color: var(--ink); }
.mj-drg-red     { color: var(--danger); }
.mj-drg-green   { color: #3f7d4e; }
.mj-drg-white   { color: #6b86b3; }
.mj-bonus-flower { color: #b8567f; }
.mj-bonus-season { color: #c98a2b; }
.mj-bonus-flower .mj-core { fill: #f2d24b; }
.mj-bonus-season line { stroke: currentColor; }
.mj-bonus-flower circle, .mj-bonus-season circle,
.mj-suit-dots circle, .mj-suit-bamboo rect { fill: currentColor; }
.mj-face .mj-num { font-family: var(--font-display); font-weight: 600; font-size: 34px; fill: currentColor; }
.mj-face .mj-tag { font-family: var(--font-ui); font-weight: 600; font-size: 9px; letter-spacing: 0.08em; fill: var(--ink-muted); }
.mj-bonus-flower .mj-tag, .mj-bonus-season .mj-tag { fill: currentColor; }

[data-theme="large"] .mj-tile { border-width: 2px; }

/* Settings: layout picker + darken toggle */
.mj-layout-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
  gap: var(--space-2);
  width: 100%;
}
.mj-layout-tile {
  appearance: none;
  font: inherit;
  text-align: center;
  padding: var(--space-2) var(--space-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-2);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  transition: border-color var(--dur-1) var(--ease), background var(--dur-1) var(--ease);
}
.mj-layout-tile:hover { border-color: var(--accent); }
.mj-layout-tile.is-active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-ink);
}
.mj-layout-tile .name { font-weight: 600; }
.mj-check {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  cursor: pointer;
}
.mj-check input { margin-top: 3px; flex: 0 0 auto; }
.mj-check span { display: flex; flex-direction: column; }

/* Ad slots — four placement experiments ---------------------------------- */
/* Every slot inherits the same restrained card chrome so an empty unsold
   slot looks deliberate, not broken. */
.ad-slot {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-3);
  padding: var(--space-5);
  color: var(--ink);
  font-size: 0.92rem;
  line-height: 1.5;
}
.ad-slot[hidden] { display: none; }
.ad-slot__label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: var(--space-2);
  display: block;
}
.ad-slot__title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.15rem;
  margin-bottom: var(--space-1);
  color: var(--ink);
}
.ad-slot__body { color: var(--ink-muted); }
.ad-slot__cta {
  margin-top: var(--space-3);
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: 0.85rem;
  color: var(--accent);
  font-weight: 500;
}

/* Option 1 — sponsor tile inside the landing's game grid.
   It sits in the same grid track as the game cards so it matches their
   width and height exactly. */
.ad-slot--sponsor {
  display: flex;
  flex-direction: column;
  min-height: 380px;
  padding: var(--space-6);
  transition: border-color var(--dur-2) var(--ease),
              transform var(--dur-2) var(--ease),
              box-shadow var(--dur-2) var(--ease);
}
.ad-slot--sponsor:hover {
  border-color: oklch(60% 0.13 42 / 0.4);
  transform: translateY(-2px);
  box-shadow: var(--shadow-2);
}
.ad-slot--sponsor .ad-art {
  height: 200px;
  margin-bottom: var(--space-5);
  border-radius: var(--radius-2);
  background:
    repeating-linear-gradient(
      45deg,
      oklch(60% 0.13 42 / 0.08) 0 8px,
      transparent 8px 16px
    ),
    var(--accent-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: oklch(60% 0.13 42 / 0.6);
}
.ad-slot--sponsor .ad-slot__cta { margin-top: auto; }

/* Option 2 — inline carbon/ethical-ads-style strip.
   Small, single row, image + text + a link. Lives below the game grid
   on the landing and in a sidebar slot on game pages. */
.ad-slot--inline {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: var(--space-4);
  padding: var(--space-4);
  align-items: center;
  max-width: 560px;
  margin-inline: auto;
  margin-top: var(--space-7);
}
.ad-slot--inline .ad-art {
  width: 96px;
  height: 72px;
  border-radius: var(--radius-2);
  background:
    repeating-linear-gradient(
      -45deg,
      oklch(48% 0.015 240 / 0.1) 0 6px,
      transparent 6px 12px
    ),
    var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--ink-faint);
}
.ad-slot--inline .ad-slot__title { font-size: 1rem; }
.ad-slot--inline .ad-slot__body  { font-size: 0.85rem; }
@media (max-width: 480px) {
  .ad-slot--inline { grid-template-columns: 64px 1fr; padding: var(--space-3); }
  .ad-slot--inline .ad-art { width: 64px; height: 48px; }
}

/* Option 3 — interstitial that appears with the end-of-hand banner.
   Constrained, never blocks play, only shows in a result state. */
.ad-slot--interstitial {
  max-width: 360px;
  margin-inline: auto;
  margin-top: var(--space-4);
  padding: var(--space-4);
  text-align: left;
  background: var(--surface);
  animation: bannerIn 220ms var(--ease-out) both;
}
.ad-slot--interstitial .ad-slot__label { color: var(--accent); }

/* Option 4 — support link in the footer.
   Not really an "ad"; a quiet call to action. */
.support-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--ink-muted);
  transition: color var(--dur-1) var(--ease);
}
.support-link:hover { color: var(--accent); }
.support-link__heart {
  width: 14px;
  height: 14px;
  color: var(--accent);
}
.support-link[hidden] { display: none; }

/* GDPR Banner ------------------------------------------------------------ */
.gdpr-banner {
  position: fixed;
  inset: auto var(--space-4) var(--space-4) var(--space-4);
  max-width: 560px;
  margin-inline: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-3);
  padding: var(--space-4) var(--space-5);
  box-shadow: var(--shadow-3);
  z-index: 50;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3) var(--space-4);
  animation: bannerIn 260ms var(--ease-out) both;
}
.gdpr-banner[hidden] { display: none; }
.gdpr-banner p {
  flex: 1 1 240px;
  font-size: 0.88rem;
  color: var(--ink-muted);
}
.gdpr-banner p strong { color: var(--ink); font-weight: 500; }
.gdpr-banner .actions {
  display: flex; gap: var(--space-2);
}

/* ---------- 6. Utilities -------------------------------------------------- */

.hide-mobile { display: none; }
@media (min-width: 720px) { .hide-mobile { display: initial; } }

.spacer { flex: 1; }

/* .btn sets display:inline-flex, which overrides the UA [hidden] rule, so
   buttons need an explicit hidden rule (same pattern as the component
   [hidden] rules above). */
.btn[hidden] { display: none; }

.text-faint { color: var(--ink-faint); }

/* ---------- 7. Reduced motion -------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* ---------- 8. Mobile tightening ----------------------------------------- */

@media (max-width: 640px) {
  :root {
    --card-w: 56px;
    --card-h: 80px;
    --card-radius: 6px;
    --card-fan-down: 12px;
    --board-pad: var(--space-3);
  }
  .site-header .container { gap: var(--space-2); padding-inline: var(--space-4); }
  .wordmark { font-size: 1.1rem; }
  .wordmark .crumb { display: none; }
  .timer, .balance { font-size: 0.8rem; height: 28px; padding-inline: var(--space-2); }
  .btn--lg { height: 40px; }
  .landing { padding-block: var(--space-6) var(--space-5); }
  .game-card { padding: var(--space-5); min-height: 320px; }
  .tableau {
    grid-template-columns: repeat(7, 1fr);
    gap: var(--space-1);
    max-width: 100%;
  }
  .stock-group, .foundation-group { gap: var(--space-1); }
  .top-row { gap: var(--space-2); }
  .foundation-group .pile.hide-on-cramped { display: none; }
  .dealer-cards .card, .player-cards .card { margin-inline: -18px; }
}

@media (max-width: 380px) {
  :root {
    --card-w: 44px;
    --card-h: 62px;
  }
  .header-meta .btn--icon { width: 32px; height: 32px; }
  .timer { padding-inline: var(--space-2); }
}
