/* ==========================================================================
   Spilaborg — Nordic Editorial
   ---------------------------------------------------------------------------
   Layers: tokens → reset → base → layout → components → utilities
   No inline styles. No always-on animations. Motion is interaction-only.
   ========================================================================== */

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

:root {
  /* Color (light) */
  --bg:           oklch(98% 0.005 235);
  --surface:      oklch(100% 0 0);
  --surface-2:    oklch(95.5% 0.008 235);
  --surface-felt: oklch(94% 0.012 235);
  --ink:          oklch(22% 0.025 250);
  --ink-muted:    oklch(48% 0.015 240);
  --ink-faint:    oklch(72% 0.012 240);
  --accent:       oklch(60% 0.13 42);     /* burnt terracotta */
  --accent-ink:   oklch(98% 0.008 60);
  --accent-soft:  oklch(94% 0.025 50);
  --danger:       oklch(54% 0.18 25);
  --success:      oklch(50% 0.11 155);
  --border:       oklch(88% 0.008 235);
  --border-strong:oklch(78% 0.012 235);
  --focus:        oklch(60% 0.13 42 / 0.45);

  --shadow-1: 0 1px 2px oklch(22% 0.025 250 / 0.06);
  --shadow-2: 0 2px 8px oklch(22% 0.025 250 / 0.08);
  --shadow-3: 0 12px 32px oklch(22% 0.025 250 / 0.12);

  /* 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: 8px;
  --radius-3: 12px;
  --radius-4: 18px;
  --radius-full: 9999px;

  /* Type */
  --font-display: 'Newsreader', Georgia, 'Times New Roman', serif;
  --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(22% 0.025 250 / 0.06), 0 6px 14px oklch(22% 0.025 250 / 0.08);
  --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(98% 0.005 235);
  --surface:      oklch(100% 0 0);
  --surface-2:    oklch(95.5% 0.008 235);
  --surface-felt: oklch(94% 0.012 235);
  --ink:          oklch(22% 0.025 250);
  --ink-muted:    oklch(48% 0.015 240);
  --ink-faint:    oklch(72% 0.012 240);
  --border:       oklch(88% 0.008 235);
  --border-strong:oklch(78% 0.012 235);
  --accent-soft:  oklch(94% 0.025 50);
  --shadow-1: 0 1px 2px oklch(22% 0.025 250 / 0.06);
  --shadow-2: 0 2px 8px oklch(22% 0.025 250 / 0.08);
  --shadow-3: 0 12px 32px oklch(22% 0.025 250 / 0.12);
  --card-shadow: 0 1px 1px oklch(22% 0.025 250 / 0.06), 0 6px 14px oklch(22% 0.025 250 / 0.08);
}

[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);
}

/* Lakkrís — paper-cream, ink-black, rhubarb-pink. High-contrast editorial. */
[data-theme="lakkris"] {
  color-scheme: light;
  --bg:           oklch(97% 0.005 80);
  --surface:      oklch(100% 0 0);
  --surface-2:    oklch(94% 0.008 80);
  --surface-felt: oklch(95.5% 0.01 70);
  --ink:          oklch(14% 0.01 280);   /* near-black */
  --ink-muted:    oklch(40% 0.01 280);
  --ink-faint:    oklch(70% 0.008 280);
  --accent:       oklch(60% 0.21 12);    /* rhubarb pink */
  --accent-ink:   oklch(99% 0 0);
  --accent-soft:  oklch(94% 0.04 10);
  --danger:       oklch(54% 0.21 22);
  --success:      oklch(48% 0.13 155);
  --border:       oklch(85% 0.005 280);
  --border-strong:oklch(70% 0.008 280);
  --focus:        oklch(60% 0.21 12 / 0.45);
  --shadow-1: 0 1px 2px oklch(14% 0.01 280 / 0.08);
  --shadow-2: 0 4px 14px oklch(14% 0.01 280 / 0.10);
  --shadow-3: 0 14px 36px oklch(14% 0.01 280 / 0.14);
  --card-shadow: 0 1px 1px oklch(14% 0.01 280 / 0.08), 0 6px 16px oklch(14% 0.01 280 / 0.10);
}

/* ---------- 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-display);
  font-style: italic;
  font-weight: 500;
  font-size: 1.35rem;
  letter-spacing: -0.01em;
  color: var(--ink);
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 0.5ch;
}
.wordmark__mark {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  color: var(--accent);
  display: block;
}
.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: 1px dashed oklch(from var(--ink-faint) l c h / 0.5);
  background: oklch(from var(--ink) l c h / 0.02);
  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;
  -webkit-user-drag: element;
  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; }
.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: 1px dashed oklch(from var(--ink-faint) l c h / 0.5);
  background: oklch(from var(--ink) l c h / 0.02);
}
.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: 1px dashed oklch(from var(--ink-faint) l c h / 0.5);
  background: oklch(from var(--ink) l c h / 0.02);
  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: 2rem;
  color: var(--ink-faint);
  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(60% 0.13 42 / 0.45);
}
.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: 1px dashed oklch(from var(--ink-faint) l c h / 0.5);
  background: oklch(from var(--ink) l c h / 0.02);
  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;
}
@keyframes bannerIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* 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);
}

/* 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; }

/* ---------- 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); }
}
