@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700;800;900&display=swap');

/* =========================================================
   1. Tokens
   ========================================================= */
:root {
  --navy: #101A35;
  --navy-2: #16234A;
  --navy-3: #1F2E5E;
  --ink: #141B33;
  --cream: #FFF9F0;
  --cream-2: #F6EEDF;
  --muted: rgba(255, 249, 240, .72);

  --orange: #F15A24;
  --gold: #FDB813;
  --turquoise: #35C8C5;
  --teal: #0099B5;
  --purple: #7138A5;
  --green: #22B26E;

  --font: 'Outfit', 'Segoe UI', system-ui, -apple-system, Roboto, Arial, sans-serif;
  --pad: clamp(16px, 3.4vw, 56px);
  --ease-out: cubic-bezier(.22, 1, .36, 1);

  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .55 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* Deck themes: used by decks, card backs, the reveal and buttons */
[data-deck="question"] {
  --c: #F15A24; --c-dark: #C23F12; --c-deep: #7A2307; --c-light: #FFE3D6;
  --c-glow: #FF8F63; --c-text: #A8360C; --c-on: #FFF9F0; --c-rgb: 241, 90, 36;
  --e-a: #FFF9F0; --e-b: #F15A24; --e-c: #FDB813; --e-line: #7A2307;
}
[data-deck="challenge"] {
  --c: #35C8C5; --c-dark: #0F959A; --c-deep: #06555E; --c-light: #D8F6F4;
  --c-glow: #6BE3DF; --c-text: #08707A; --c-on: #0B2A33; --c-rgb: 53, 200, 197;
  --e-a: #FFF9F0; --e-b: #F15A24; --e-c: #FDB813; --e-line: #06555E;
}
[data-deck="culture"] {
  --c: #7138A5; --c-dark: #50217F; --c-deep: #2C0E4C; --c-light: #EEE2FA;
  --c-glow: #BD94EC; --c-text: #6A2EA3; --c-on: #FFF9F0; --c-rgb: 113, 56, 165;
  --e-a: #35C8C5; --e-b: #FDB813; --e-c: #7DE39A; --e-line: #22093D;
}
[data-deck="wild"] {
  --c: #22B26E; --c-dark: #0E8553; --c-deep: #064530; --c-light: #DAF5E7;
  --c-glow: #5EDB9D; --c-text: #0B7349; --c-on: #FFF9F0; --c-rgb: 34, 178, 110;
  --e-a: #FDB813; --e-b: #FFF9F0; --e-c: #0E8553; --e-line: rgba(255, 249, 240, .75);
}

/* =========================================================
   2. Base
   ========================================================= */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; background: var(--navy); overflow-x: hidden; }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: var(--font);
  color: var(--cream);
  background: var(--navy);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.4;
}
body.is-locked { overflow: hidden; }

img { max-width: 100%; display: block; }
button { font: inherit; color: inherit; }
h1, h2, p { margin: 0; }

.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }

/* Hide the welcome content until the intro animation is ready (with a safety fallback) */
html.preload .welcome { visibility: hidden; animation: unhide 0s linear 2.5s forwards; }
@keyframes unhide { to { visibility: visible; } }

.noscript {
  position: fixed; inset: auto 0 0 0; z-index: 200;
  padding: 16px; text-align: center; background: var(--orange); color: #fff; font-weight: 700;
}

/* =========================================================
   3. Stage background
   ========================================================= */
.stage-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
  background:
    radial-gradient(60vmax 42vmax at 8% 4%, rgba(0, 153, 181, .26), transparent 62%),
    radial-gradient(55vmax 45vmax at 96% 96%, rgba(113, 56, 165, .30), transparent 62%),
    radial-gradient(38vmax 28vmax at 88% 6%, rgba(241, 90, 36, .10), transparent 62%),
    linear-gradient(180deg, #0C1430 0%, #101A35 50%, #121D3F 100%);
}

.bg-stars {
  position: absolute;
  inset: 0;
  opacity: .55;
  background-image:
    radial-gradient(1.4px 1.4px at 22px 34px, #fff 50%, transparent 100%),
    radial-gradient(1px 1px at 90px 140px, #fff 50%, transparent 100%),
    radial-gradient(1.2px 1.2px at 160px 70px, #cfe9ff 50%, transparent 100%),
    radial-gradient(1px 1px at 210px 200px, #fff 50%, transparent 100%),
    radial-gradient(1.6px 1.6px at 250px 20px, #ffe9c2 50%, transparent 100%),
    radial-gradient(1px 1px at 40px 230px, #fff 50%, transparent 100%);
  background-size: 280px 260px;
}
.bg-stars--far {
  opacity: .35;
  background-size: 430px 390px;
  background-position: 120px 60px;
  animation: twinkle 9s ease-in-out infinite alternate;
}
@keyframes twinkle { from { opacity: .18; } to { opacity: .45; } }

.bg-orbits span {
  position: absolute;
  left: 50%;
  top: 58%;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, .055);
  transform: translate(-50%, -50%);
}
.bg-orbits span:nth-child(1) { width: 68vmax; height: 68vmax; }
.bg-orbits span:nth-child(2) {
  width: 104vmax; height: 104vmax;
  border-style: dashed;
  border-color: rgba(53, 200, 197, .08);
  animation: orbit 220s linear infinite;
}
.bg-orbits span:nth-child(2)::after {
  content: "";
  position: absolute;
  top: -4px; left: 50%;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--turquoise);
  box-shadow: 0 0 14px 3px rgba(53, 200, 197, .55);
}
.bg-orbits span:nth-child(3) { width: 140vmax; height: 140vmax; border-color: rgba(255, 255, 255, .035); }
@keyframes orbit {
  from { transform: translate(-50%, -50%) rotate(0deg); }
  to { transform: translate(-50%, -50%) rotate(360deg); }
}

.bg-planet {
  position: absolute;
  left: 50%;
  bottom: -104vmin;
  width: 128vmin;
  height: 128vmin;
  transform: translateX(-50%);
  border-radius: 50%;
  background: radial-gradient(circle at 50% 0%, rgba(53, 200, 197, .16), rgba(16, 26, 53, 0) 55%);
  box-shadow: 0 -14px 90px rgba(53, 200, 197, .10);
}
.bg-planet svg { width: 100%; height: 100%; display: block; }
.bg-planet svg * { fill: none; stroke: rgba(53, 200, 197, .13); stroke-width: .25; }
.bg-planet svg circle { stroke: rgba(107, 227, 223, .28); stroke-width: .35; }

/* =========================================================
   4. Buttons
   ========================================================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .55em;
  min-height: 44px;
  padding: .7em 1.25em;
  border: 0;
  border-radius: 999px;
  font-weight: 800;
  font-size: .9rem;
  letter-spacing: .07em;
  text-transform: uppercase;
  line-height: 1.1;
  cursor: pointer;
  transition: transform .18s var(--ease-out), box-shadow .2s ease, background-color .2s ease, color .2s ease, border-color .2s ease;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  white-space: nowrap;
}
.btn svg { width: 1.25em; height: 1.25em; flex: none; }
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0) scale(.96); }
.btn[aria-disabled="true"], .btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }

.btn--play {
  font-size: clamp(1.1rem, 1.5vw, 1.35rem);
  padding: 1em 2.1em;
  color: #fff;
  background: linear-gradient(135deg, #F7742F 0%, var(--orange) 45%, #D9450F 100%);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .18) inset, 0 12px 30px rgba(241, 90, 36, .45), 0 0 60px rgba(241, 90, 36, .25);
  text-shadow: 0 1px 2px rgba(122, 35, 7, .45);
}
.btn--play:hover { box-shadow: 0 0 0 1px rgba(255, 255, 255, .25) inset, 0 16px 40px rgba(241, 90, 36, .55), 0 0 80px rgba(241, 90, 36, .35); }
.btn--play svg { transition: transform .25s var(--ease-out); }
.btn--play:hover svg { transform: translateX(4px); }

.btn--gold {
  color: var(--navy);
  background: linear-gradient(135deg, #FFD15A, var(--gold));
  box-shadow: 0 6px 18px rgba(253, 184, 19, .3), 0 0 0 1px rgba(255, 255, 255, .3) inset;
}
.btn--gold:hover { box-shadow: 0 10px 26px rgba(253, 184, 19, .42), 0 0 0 1px rgba(255, 255, 255, .4) inset; }

.btn--ghost {
  color: var(--cream);
  background: rgba(255, 255, 255, .05);
  box-shadow: 0 0 0 1.5px rgba(255, 255, 255, .2) inset;
}
.btn--ghost:hover { background: rgba(255, 255, 255, .1); box-shadow: 0 0 0 1.5px rgba(255, 255, 255, .35) inset; }

#sound-btn .icon-sound-on { display: none; }
#sound-btn[aria-pressed="true"] .icon-sound-on { display: block; }
#sound-btn[aria-pressed="true"] .icon-sound-off { display: none; }
#sound-btn[aria-pressed="true"] { color: var(--turquoise); box-shadow: 0 0 0 1.5px rgba(53, 200, 197, .6) inset; background: rgba(53, 200, 197, .1); }

/* =========================================================
   5. Logo plates
   ========================================================= */
.logo-plate {
  background: #fff;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 9% 8% 8%;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .7) inset, 0 18px 46px rgba(0, 0, 0, .38);
}
.logo-plate img {
  width: 100%;
  height: auto;
  object-fit: contain;
  object-position: center;
}
.logo-plate--hero {
  width: clamp(200px, 22vw, 320px);
  border-radius: clamp(16px, 1.6vw, 24px);
}
.logo-plate--small {
  width: clamp(76px, 7.2vw, 108px);
  border-radius: 12px;
  flex: none;
  padding: 8% 7% 7%;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .7) inset, 0 6px 18px rgba(0, 0, 0, .3);
}

/* =========================================================
   6. Welcome screen
   ========================================================= */
.welcome {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  min-height: 100dvh;
  max-width: 1480px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(0, .92fr);
  align-items: center;
  gap: clamp(24px, 4vw, 72px);
  padding: clamp(24px, 5vh, 64px) clamp(20px, 6vw, 104px);
}

.welcome-inner {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: clamp(10px, 1.9vh, 20px);
}

.welcome-brand { position: relative; margin-bottom: clamp(4px, 1.5vh, 14px); }

.welcome-badge {
  position: absolute;
  right: clamp(-92px, -6.4vw, -64px);
  bottom: clamp(-46px, -3vw, -28px);
  width: clamp(96px, 9.2vw, 142px);
  height: auto;
  border-radius: 13%;
  transform: rotate(9deg);
  box-shadow: 0 14px 30px rgba(0, 0, 0, .4);
}

.eyebrow {
  font-size: clamp(.78rem, .95vw, .92rem);
  font-weight: 700;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--turquoise);
}

.welcome-title {
  font-size: clamp(2.3rem, 4.7vw, 4.6rem);
  line-height: .98;
  font-weight: 900;
  letter-spacing: -.012em;
  text-transform: uppercase;
  text-wrap: balance;
}
.wt-line { display: block; }
.wt-four {
  display: inline-block;
  color: var(--gold);
  text-shadow: 0 0 34px rgba(253, 184, 19, .45);
}

.deck-bars { display: flex; gap: 8px; }
.deck-bars span {
  width: clamp(34px, 3.4vw, 54px);
  height: 6px;
  border-radius: 6px;
  background: var(--c);
  box-shadow: 0 0 14px rgba(var(--c-rgb), .55);
}

.welcome-sub {
  font-size: clamp(1.25rem, 2.1vw, 1.9rem);
  font-weight: 800;
  letter-spacing: .01em;
}
.ws-word { display: inline-block; }
.ws-word--1 { color: #FF8F63; }
.ws-word--2 { color: var(--turquoise); }
.ws-word--3 { color: #C29BF0; }

.welcome-desc {
  max-width: 34ch;
  font-size: clamp(1.02rem, 1.3vw, 1.25rem);
  color: var(--muted);
  font-weight: 500;
}

.welcome-cta {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 14px;
  margin-top: clamp(6px, 1.4vh, 14px);
}
.welcome-hint {
  font-size: clamp(.85rem, .95vw, .95rem);
  color: rgba(255, 249, 240, .6);
  max-width: 44ch;
}

/* Fanned cards on the welcome screen */
.welcome-fan {
  --fw: clamp(150px, 14.5vw, 232px);
  position: relative;
  height: calc(var(--fw) * 2.15);
  isolation: isolate;
}
.welcome-fan::before {
  content: "";
  position: absolute;
  left: 50%; top: 52%;
  width: calc(var(--fw) * 3.2);
  height: calc(var(--fw) * 3.2);
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(53, 200, 197, .22), rgba(113, 56, 165, .12) 55%, transparent 100%);
  z-index: -1;
}
.fan-card {
  position: absolute;
  left: calc(50% - var(--fw) / 2);
  top: calc(50% - var(--fw) * .78);
  width: var(--fw);
  aspect-ratio: 5 / 7;
  transform-origin: 50% 135%;
  transform: rotate(var(--rot));
  --r: clamp(12px, 1.2vw, 18px);
  filter: drop-shadow(0 18px 24px rgba(0, 0, 0, .4));
}

/* =========================================================
   7. Card back (shared by decks, welcome fan and reveal)
   ========================================================= */
.card-back {
  position: absolute;
  inset: 0;
  display: block;
  border-radius: var(--r, 16px);
  overflow: hidden;
  container-type: inline-size;
  color: var(--c-on);
  background: linear-gradient(158deg, var(--c) 0%, var(--c-dark) 78%, var(--c-deep) 100%);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, .22) inset,
    0 1px 0 rgba(255, 255, 255, .35) inset,
    0 2px 0 rgba(0, 0, 0, .12),
    0 14px 26px rgba(4, 8, 22, .38);
}
.card-back::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: var(--grain);
  opacity: .22;
  pointer-events: none;
}

.cb-pattern { position: absolute; inset: 0; opacity: .9; }
[data-deck="question"] .cb-pattern {
  background:
    radial-gradient(circle at 50% 46%, rgba(255, 220, 160, .38), transparent 42%),
    repeating-conic-gradient(from 0deg at 50% 46%, rgba(255, 249, 240, .1) 0deg 7deg, transparent 7deg 15deg);
}
[data-deck="challenge"] .cb-pattern {
  background:
    radial-gradient(circle at 50% 46%, rgba(255, 255, 255, .3), transparent 44%),
    repeating-linear-gradient(-45deg, rgba(6, 85, 94, .16) 0 6px, transparent 6px 15px);
}
[data-deck="culture"] .cb-pattern {
  background:
    radial-gradient(circle at 50% 46%, rgba(53, 200, 197, .3), transparent 40%),
    repeating-radial-gradient(circle at 50% 46%, rgba(255, 255, 255, .1) 0 1.5px, transparent 1.5px 11px);
}
[data-deck="wild"] .cb-pattern {
  background:
    radial-gradient(circle at 50% 46%, rgba(253, 184, 19, .3), transparent 42%),
    radial-gradient(rgba(255, 249, 240, .2) 1.2px, transparent 1.6px) 0 0 / 12px 12px;
}

.cb-frame {
  position: absolute;
  inset: 5.5cqi;
  border: max(1.5px, .9cqi) solid rgba(255, 249, 240, .82);
  border-radius: calc(var(--r, 16px) * .62);
}
.cb-frame::before {
  content: "";
  position: absolute;
  inset: 2cqi;
  border: 1px solid rgba(255, 249, 240, .45);
  border-radius: calc(var(--r, 16px) * .4);
}
[data-deck="challenge"] .cb-frame { border-color: rgba(11, 42, 51, .7); }
[data-deck="challenge"] .cb-frame::before { border-color: rgba(11, 42, 51, .35); }

.cb-star {
  position: absolute;
  width: 6.5cqi;
  height: 6.5cqi;
  background: rgba(255, 249, 240, .92);
  clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%);
}
[data-deck="challenge"] .cb-star { background: rgba(11, 42, 51, .8); }
.cb-star--tl { top: 2.3cqi; left: 2.3cqi; }
.cb-star--tr { top: 2.3cqi; right: 2.3cqi; }
.cb-star--bl { bottom: 2.3cqi; left: 2.3cqi; }
.cb-star--br { bottom: 2.3cqi; right: 2.3cqi; }

.cb-content {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 12cqi 9cqi 11cqi;
  text-align: center;
}
.cb-top {
  font-size: 5cqi;
  font-weight: 800;
  letter-spacing: .24em;
  text-transform: uppercase;
  opacity: .92;
  display: flex;
  align-items: center;
  gap: 2cqi;
}
.cb-top i {
  width: 1.6cqi; height: 1.6cqi;
  border-radius: 50%;
  background: currentColor;
  display: inline-block;
}
.cb-medallion {
  width: 56cqi;
  aspect-ratio: 1;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 38% 30%, rgba(255, 255, 255, .26), rgba(0, 0, 0, .14) 75%);
  box-shadow:
    0 0 0 max(1.5px, 1cqi) rgba(255, 249, 240, .85),
    0 0 0 max(3px, 2.4cqi) rgba(0, 0, 0, .12),
    0 8cqi 12cqi rgba(0, 0, 0, .2);
}
[data-deck="challenge"] .cb-medallion { box-shadow: 0 0 0 max(1.5px, 1cqi) rgba(11, 42, 51, .75), 0 0 0 max(3px, 2.4cqi) rgba(0, 0, 0, .08), 0 8cqi 12cqi rgba(0, 0, 0, .16); }
.cb-medallion svg { width: 72%; height: 72%; overflow: visible; }

.cb-label { display: flex; flex-direction: column; align-items: center; gap: 2.4cqi; }
.cb-name {
  font-size: 9.6cqi;
  font-weight: 900;
  letter-spacing: .06em;
  text-transform: uppercase;
  line-height: 1;
  padding: 2.6cqi 5cqi;
  border-radius: 2.4cqi;
  background: rgba(10, 16, 36, .32);
  color: #FFF9F0;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .2) inset;
  white-space: nowrap;
}
.cb-tag {
  font-size: 4.2cqi;
  font-weight: 700;
  letter-spacing: .2em;
  text-transform: uppercase;
  opacity: .9;
  white-space: nowrap;
}

/* Emblem SVG colours (driven by deck theme variables) */
.e-a { fill: var(--e-a); }
.e-b { fill: var(--e-b); }
.e-c { fill: var(--e-c); }
.e-s { fill: none; stroke: var(--e-b); }
.e-line { fill: none; stroke: var(--e-line); }
.e-arrow { fill: none; stroke: var(--e-b); }

/* =========================================================
   8. Game layout
   ========================================================= */
html:has(#game:not([hidden])),
body:has(#game:not([hidden])) {
  height: 100%;
  overflow: hidden;
}

.game {
  position: relative;
  z-index: 1;
  height: 100vh;
  height: 100dvh;
  max-height: 100vh;
  max-height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.game-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px 20px;
  flex: none;
  padding: clamp(8px, 1.4vh, 16px) var(--pad);
  background: linear-gradient(180deg, rgba(12, 20, 46, .85), rgba(16, 26, 53, .35));
  border-bottom: 1px solid rgba(255, 255, 255, .07);
}
.brand { display: flex; align-items: center; gap: clamp(10px, 1.2vw, 18px); min-width: 0; }
.game-title {
  font-size: clamp(1rem, 1.55vw, 1.55rem);
  font-weight: 900;
  letter-spacing: .02em;
  text-transform: uppercase;
  line-height: 1.08;
}
.game-title:focus { outline: none; }
.event-label {
  margin-top: 5px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 3px 10px 3px 3px;
  border-radius: 999px;
  background: rgba(113, 56, 165, .28);
  box-shadow: 0 0 0 1px rgba(189, 148, 236, .35) inset;
  font-size: clamp(.68rem, .75vw, .78rem);
  font-weight: 800;
  letter-spacing: .16em;
  color: #E4D2FA;
}
.event-label img { width: 22px; height: 22px; border-radius: 22%; object-fit: contain; background: #fff; }

.controls { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; }

.table {
  --gap: clamp(18px, 2.4vw, 48px);
  /* Fallback uses the viewport; container units below use the real table size. */
  --card-w: clamp(168px, min(
    calc((100vw - 2 * var(--pad) - 3 * var(--gap)) / 4),
    calc((100dvh - 15rem) * 5 / 7)
  ), 340px);
  container-type: size;
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(10px, 1.8vh, 22px);
  padding: clamp(12px, 2.2vh, 32px) var(--pad) clamp(10px, 1.8vh, 20px);
}
@supports (width: 1cqh) {
  .table {
    --card-w: clamp(168px, min(
      calc((100cqi - 3 * var(--gap)) / 4),
      calc((100cqh - 7.5rem) * 5 / 7)
    ), 340px);
  }
}

.game-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  flex: none;
  gap: 8px 16px;
  padding: 8px var(--pad) max(10px, env(safe-area-inset-bottom));
  border-top: 1px solid rgba(255, 255, 255, .08);
  background: linear-gradient(0deg, rgba(10, 16, 36, .88), rgba(16, 26, 53, .2));
}
.footer-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.footer-logo {
  height: clamp(36px, 4.2vw, 44px);
  width: auto;
  object-fit: contain;
  object-position: center;
  flex: none;
  background: #fff;
  border-radius: 10px;
  padding: 4px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .18);
}
.footer-credit {
  font-size: clamp(.78rem, .92vw, .92rem);
  font-weight: 600;
  color: rgba(255, 249, 240, .62);
  letter-spacing: .01em;
}
.footer-heart { color: #F15A24; font-style: normal; }
.footer-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 4px;
}
.footer-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 11px;
  border-radius: 999px;
  color: rgba(255, 249, 240, .7);
  text-decoration: none;
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  transition: color .18s ease, background-color .18s ease, box-shadow .18s ease;
}
.footer-link svg { width: 15px; height: 15px; flex: none; }
.footer-link:hover {
  color: var(--cream);
  background: rgba(255, 255, 255, .06);
}
.footer-link:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.footer-links .footer-link + .footer-link { box-shadow: none; }
.footer-links .footer-link:not(:last-child)::after {
  content: "";
  width: 1px;
  height: 12px;
  margin-left: 6px;
  background: rgba(255, 255, 255, .16);
}

.decks {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(4, var(--card-w));
  gap: var(--gap);
  justify-content: center;
}

.table-hint {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: clamp(1rem, 1.3vw, 1.25rem);
  font-weight: 600;
  color: var(--cream);
  padding: 8px 18px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .04);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .08) inset;
  text-align: center;
}
.table-hint svg { width: 18px; height: 18px; color: var(--gold); flex: none; }

.key-hint { font-size: .8rem; color: rgba(255, 249, 240, .5); text-align: center; }
kbd {
  font-family: inherit;
  font-weight: 700;
  font-size: .75rem;
  padding: 1px 6px;
  border-radius: 5px;
  background: rgba(255, 255, 255, .08);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .14) inset, 0 1px 0 rgba(0, 0, 0, .3);
  color: var(--cream);
}

/* =========================================================
   9. Decks
   ========================================================= */
.deck {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: var(--card-w);
}

.deck-slot {
  --r: calc(var(--card-w) * .065);
  position: relative;
  width: 100%;
  aspect-ratio: 5 / 7;
  isolation: isolate;
}
/* Soft table shadow beneath the stack */
.deck-slot::before {
  content: "";
  position: absolute;
  left: 4%; right: 4%;
  bottom: -30px;
  height: 40px;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(0, 0, 0, .55), transparent);
  z-index: -2;
}
/* Coloured halo shown on hover / focus / selection */
.deck-slot::after {
  content: "";
  position: absolute;
  inset: -18% -22%;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(var(--c-rgb), .55), transparent);
  opacity: 0;
  transition: opacity .35s ease;
  z-index: -1;
  pointer-events: none;
}
.deck:hover .deck-slot::after,
.deck:focus-within .deck-slot::after,
.deck.is-selected .deck-slot::after { opacity: .75; }

.deck-stack {
  position: absolute;
  inset: 0;
  padding: 0;
  border: 0;
  background: none;
  border-radius: var(--r);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.deck-stack:focus-visible { outline: 3px solid var(--gold); outline-offset: 8px; }

.deck-layer {
  position: absolute;
  top: calc(var(--i) * 4px);
  left: calc(var(--i) * 1px);
  width: 100%;
  height: 100%;
  border-radius: var(--r);
  background:
    linear-gradient(158deg, var(--c-dark), var(--c-deep));
  box-shadow:
    0 0 0 1px rgba(255, 249, 240, .32) inset,
    0 0 0 calc(var(--card-w) * .03) rgba(var(--c-rgb), .9) inset,
    0 2px 5px rgba(0, 0, 0, .35);
}
.deck-layer::after {
  content: "";
  position: absolute;
  inset: 7%;
  border-radius: calc(var(--r) * .6);
  border: 1.5px solid rgba(255, 249, 240, .35);
}

.deck-top {
  position: absolute;
  inset: 0;
  z-index: 5;
  transition: transform .3s var(--ease-out);
}
.deck-stack:hover .deck-top,
.deck-stack:focus-visible .deck-top { transform: translateY(-10px) rotate(-1.2deg); }
.table.is-busy .deck-stack { cursor: progress; }
.table.is-busy .deck-stack:hover .deck-top { transform: none; }

.deck-empty {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(6px, 1.2vh, 12px);
  padding: 10%;
  text-align: center;
  border-radius: var(--r);
  border: 2px dashed rgba(var(--c-rgb), .6);
  background: radial-gradient(circle at 50% 35%, rgba(var(--c-rgb), .16), rgba(255, 255, 255, .02) 70%);
}
.deck-empty-icon { width: 34%; aspect-ratio: 1; opacity: .9; }
.deck-empty-icon svg { width: 100%; height: 100%; }
.deck-empty-title { font-weight: 800; font-size: clamp(.95rem, 1.2vw, 1.2rem); }
.deck-empty-text { font-size: clamp(.78rem, .9vw, .9rem); color: var(--muted); }

.btn--small { min-height: 40px; font-size: .74rem; padding: .7em 1em; white-space: normal; text-align: center; }
.btn--reshuffle {
  color: var(--c-on);
  background: var(--c);
  box-shadow: 0 6px 18px rgba(var(--c-rgb), .4);
}
[data-deck="culture"] .btn--reshuffle { background: #8A4DC2; }

.deck-meta {
  margin-top: clamp(10px, 1.8vh, 20px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  text-align: center;
}
.deck-name {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: clamp(.95rem, 1.35vw, 1.3rem);
  font-weight: 900;
  letter-spacing: .09em;
  text-transform: uppercase;
  line-height: 1.1;
}
.deck-name::before {
  content: "";
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--c);
  box-shadow: 0 0 10px 1px rgba(var(--c-rgb), .8);
  flex: none;
}
.deck-desc { font-size: clamp(.82rem, 1vw, 1rem); color: var(--muted); font-weight: 500; }
.deck-count {
  margin-top: 6px;
  padding: 3px 12px;
  border-radius: 999px;
  font-size: clamp(.72rem, .8vw, .82rem);
  font-weight: 700;
  letter-spacing: .04em;
  color: var(--c-glow);
  background: rgba(var(--c-rgb), .1);
  box-shadow: 0 0 0 1px rgba(var(--c-rgb), .45) inset;
  font-variant-numeric: tabular-nums;
}
.deck-count strong { color: #fff; font-size: 1.12em; }

/* =========================================================
   10. Card reveal
   ========================================================= */
.reveal {
  position: fixed;
  inset: 0;
  z-index: 50;
  overflow: hidden;
}
.reveal-backdrop {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 50%, rgba(10, 16, 38, .82), rgba(5, 9, 24, .94));
}
.reveal-glow {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 115vmin;
  height: 115vmin;
  margin: -57.5vmin 0 0 -57.5vmin;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(var(--c-rgb), .5), rgba(var(--c-rgb), .14) 55%, transparent 100%);
  pointer-events: none;
}
.reveal-scroll {
  position: absolute;
  inset: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  display: flex;
  padding: clamp(12px, 2.5vh, 24px) 12px;
}
.reveal-card {
  --reveal-w: clamp(290px, min(92vw, calc((100vh - 56px) * .714)), 590px);
  margin: auto;
  width: var(--reveal-w);
  perspective: 1800px;
  container-type: inline-size;
}
@supports (height: 100dvh) {
  .reveal-card { --reveal-w: clamp(290px, min(92vw, calc((100dvh - 56px) * .714)), 590px); }
}

.reveal-flipper {
  position: relative;
  transform-style: preserve-3d;
}
.reveal-face {
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}
.reveal-back {
  position: absolute;
  inset: 0;
  --r: 26px;
}
.reveal-front {
  position: relative;
  transform: rotateY(180deg);
  min-height: calc(var(--reveal-w) * 1.4);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(8px, 2.1cqi, 14px);
  padding: clamp(26px, 7cqi, 44px) clamp(24px, 7.4cqi, 48px) clamp(22px, 5.6cqi, 34px);
  border-radius: 26px;
  color: var(--ink);
  text-align: center;
  background:
    radial-gradient(circle at 50% 0%, rgba(var(--c-rgb), .14), transparent 55%),
    radial-gradient(circle at 50% 100%, rgba(var(--c-rgb), .1), transparent 50%),
    var(--cream);
  box-shadow:
    0 0 0 clamp(6px, 1.6cqi, 10px) var(--c) inset,
    0 0 0 calc(clamp(6px, 1.6cqi, 10px) + 1.5px) rgba(255, 255, 255, .5) inset,
    0 40px 90px rgba(0, 0, 0, .55),
    0 0 0 1px rgba(255, 255, 255, .18);
}
.reveal-front::before {
  content: "";
  position: absolute;
  inset: clamp(13px, 3.4cqi, 20px);
  border: 1.5px solid rgba(var(--c-rgb), .55);
  border-radius: 16px;
  pointer-events: none;
}
.reveal-front::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background-image: var(--grain);
  opacity: .08;
  pointer-events: none;
}
.reveal-front > * { position: relative; z-index: 1; }

/* Once the flip finishes, flatten the 3D transforms for crisp text */
.reveal.is-settled .reveal-flipper { transform: none !important; }
.reveal.is-settled .reveal-front { transform: none; }
.reveal.is-settled .reveal-back { visibility: hidden; }

.rf-corner {
  position: absolute !important;
  width: clamp(12px, 3cqi, 18px);
  height: clamp(12px, 3cqi, 18px);
  background: var(--c);
  clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%);
}
.rf-corner--tl { top: clamp(20px, 5cqi, 30px); left: clamp(20px, 5cqi, 30px); }
.rf-corner--tr { top: clamp(20px, 5cqi, 30px); right: clamp(20px, 5cqi, 30px); }
.rf-corner--bl { bottom: clamp(20px, 5cqi, 30px); left: clamp(20px, 5cqi, 30px); }
.rf-corner--br { bottom: clamp(20px, 5cqi, 30px); right: clamp(20px, 5cqi, 30px); }

.rf-head {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 clamp(12px, 4cqi, 26px);
  font-size: max(11px, 2.3cqi);
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
}
.rf-event { display: inline-flex; align-items: center; gap: 7px; color: #4B2A78; }
.rf-event img { width: max(20px, 5cqi); height: max(20px, 5cqi); border-radius: 22%; object-fit: contain; background: #fff; }
.rf-number {
  padding: 4px 10px;
  border-radius: 999px;
  color: var(--c-text);
  background: rgba(var(--c-rgb), .13);
  box-shadow: 0 0 0 1px rgba(var(--c-rgb), .4) inset;
  font-variant-numeric: tabular-nums;
}

.rf-emblem {
  width: clamp(54px, 14cqi, 84px);
  aspect-ratio: 1;
  margin-top: clamp(2px, 1cqi, 8px);
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 35% 30%, rgba(255, 255, 255, .3), transparent 60%), var(--c);
  box-shadow: 0 0 0 4px var(--cream), 0 0 0 5.5px rgba(var(--c-rgb), .55), 0 10px 22px rgba(var(--c-rgb), .35);
}
.rf-emblem svg { width: 68%; height: 68%; overflow: visible; }

.rf-deck {
  font-size: max(12px, 2.6cqi);
  font-weight: 800;
  letter-spacing: .24em;
  text-transform: uppercase;
  color: var(--c-text);
}
.rf-type { color: rgba(20, 27, 51, .55); }

.rf-title {
  font-size: clamp(24px, 6.7cqi, 40px);
  font-weight: 900;
  line-height: 1.05;
  letter-spacing: -.005em;
  color: var(--ink);
  text-wrap: balance;
}
.rf-title:focus { outline: none; }

.rf-divider {
  width: 42%;
  height: 2px;
  margin: 2px 0;
  background: linear-gradient(90deg, transparent, var(--c), transparent);
}
.rf-divider::after {
  content: "";
  position: absolute;
  left: 50%; top: 50%;
  width: 9px; height: 9px;
  background: var(--c);
  transform: translate(-50%, -50%) rotate(45deg);
  box-shadow: 0 0 0 3px var(--cream);
}

.rf-text {
  font-size: clamp(19px, 5cqi, 30px);
  font-weight: 600;
  line-height: 1.28;
  color: #1A2142;
  text-wrap: pretty;
  max-width: 24ch;
}
.rf-text.is-long { font-size: clamp(18px, 4.3cqi, 26px); max-width: 28ch; }

.rf-instructions {
  font-size: clamp(14.5px, 3.05cqi, 18px);
  line-height: 1.4;
  font-weight: 500;
  color: #2A3157;
  padding: 10px 16px;
  border-radius: 14px;
  background: rgba(var(--c-rgb), .1);
  box-shadow: 0 0 0 1px rgba(var(--c-rgb), .3) inset;
  max-width: 34ch;
  text-wrap: pretty;
}

.rf-last {
  font-size: max(13px, 2.6cqi);
  font-weight: 800;
  letter-spacing: .06em;
  color: #fff;
  background: var(--ink);
  padding: 5px 14px;
  border-radius: 999px;
}
.rf-note {
  font-size: max(12.5px, 2.5cqi);
  font-weight: 600;
  color: rgba(20, 27, 51, .62);
  margin-top: auto;
}

.rf-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  width: 100%;
}
.rf-actions .btn { flex: 1 1 0; min-width: 0; max-width: 240px; font-size: max(13px, 2.55cqi); }

.btn--deck {
  color: #fff;
  background: var(--c-text);
  box-shadow: 0 8px 20px rgba(var(--c-rgb), .35);
}
.btn--deck:hover { box-shadow: 0 12px 26px rgba(var(--c-rgb), .45); }
.btn--outline {
  color: var(--ink);
  background: transparent;
  box-shadow: 0 0 0 2px rgba(20, 27, 51, .8) inset;
}
.btn--outline:hover { background: rgba(20, 27, 51, .06); }
.reveal .btn:focus-visible { outline-color: var(--ink); }

/* =========================================================
   10b. Challenge race ("Who will do it first?")
   ========================================================= */
.reveal.is-race .rf-title {
  text-transform: uppercase;
  letter-spacing: .045em;
  font-size: clamp(22px, 5.8cqi, 34px);
  color: var(--c-text);
}
.reveal.is-race .rf-text {
  font-size: clamp(20px, 5.2cqi, 32px);
  max-width: 22ch;
}

.race {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: 100%;
}
.race-live {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: 100%;
}
.race-go {
  font-size: clamp(22px, 6.2cqi, 36px);
  font-weight: 900;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--c-text);
  text-shadow: 0 0 18px rgba(var(--c-rgb), .28);
}
.reveal.is-racing .race-go { animation: race-go-pulse 1.1s ease-in-out infinite; }
@keyframes race-go-pulse { 50% { transform: scale(1.05); } }
#race-start { min-width: min(100%, 240px); font-size: max(14px, 2.7cqi); padding: .85em 1.4em; }
.race-host-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  width: 100%;
}
.race-host-actions .btn { flex: 1 1 0; min-width: 0; max-width: 260px; font-size: max(12.5px, 2.45cqi); }
.race-result {
  font-size: clamp(18px, 4.4cqi, 26px);
  font-weight: 900;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--c-text);
  padding: 10px 18px;
  border-radius: 16px;
  background: rgba(var(--c-rgb), .12);
  box-shadow: 0 0 0 1.5px rgba(var(--c-rgb), .4) inset;
}
.reveal.is-won .race-result { animation: race-pop .45s var(--ease-out) both; }
@keyframes race-pop {
  from { transform: scale(.92); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.race-overlay {
  position: absolute;
  inset: 0;
  z-index: 12;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 50% 45%, rgba(16, 26, 53, .28), rgba(8, 12, 28, .62));
  pointer-events: none;
}
.race-count {
  font-size: clamp(7rem, 24vmin, 12.5rem);
  font-weight: 900;
  line-height: .9;
  letter-spacing: .04em;
  color: #fff;
  text-shadow: 0 0 40px rgba(53, 200, 197, .55), 0 12px 40px rgba(0, 0, 0, .35);
}
.race-overlay.is-go .race-count {
  font-size: clamp(4.4rem, 16vmin, 9rem);
  color: var(--gold);
  letter-spacing: .16em;
  text-shadow: 0 0 50px rgba(253, 184, 19, .65), 0 12px 40px rgba(0, 0, 0, .35);
}

/* =========================================================
   11. Timer
   ========================================================= */
.timer {
  display: flex;
  align-items: center;
  gap: clamp(12px, 3cqi, 20px);
  padding: 8px 16px 8px 8px;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 0 0 1.5px rgba(var(--c-rgb), .45) inset, 0 6px 16px rgba(20, 27, 51, .08);
}
.timer-ring {
  position: relative;
  width: clamp(64px, 15cqi, 84px);
  aspect-ratio: 1;
  flex: none;
}
.timer-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.timer-track { fill: none; stroke: rgba(20, 27, 51, .1); stroke-width: 9; }
.timer-progress {
  fill: none;
  stroke: var(--c);
  stroke-width: 9;
  stroke-linecap: round;
  stroke-dasharray: 326.73;
  stroke-dashoffset: 0;
  transition: stroke-dashoffset .12s linear, stroke .3s ease;
}
.timer-display {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: clamp(17px, 4.4cqi, 24px);
  font-weight: 900;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.timer-side { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.timer-status { font-size: max(12.5px, 2.5cqi); font-weight: 700; color: #3A4166; }
.timer-btns { display: flex; gap: 8px; }
.btn--timer {
  min-height: 38px;
  padding: .55em 1em;
  font-size: max(12px, 2.3cqi);
  color: #fff;
  background: var(--ink);
}
.btn--timer-ghost { color: var(--ink); background: transparent; box-shadow: 0 0 0 1.5px rgba(20, 27, 51, .45) inset; }

.timer.is-warning .timer-progress { stroke: #E5322B; }
.timer.is-warning .timer-display { color: #C4231C; }
.timer.is-warning .timer-ring { animation: timer-pulse 1s ease-in-out infinite; }
@keyframes timer-pulse { 50% { transform: scale(1.06); } }
.timer.is-done { box-shadow: 0 0 0 2px var(--c) inset, 0 0 0 6px rgba(var(--c-rgb), .18), 0 6px 16px rgba(20, 27, 51, .08); }
.timer.is-done .timer-status { color: var(--c-text); font-size: max(15px, 3.1cqi); font-weight: 900; letter-spacing: .06em; }

/* =========================================================
   12. Toast, dialog, effects canvas
   ========================================================= */
.toast {
  position: fixed;
  left: 50%;
  bottom: max(18px, env(safe-area-inset-bottom));
  z-index: 70;
  max-width: min(560px, calc(100vw - 32px));
  padding: 12px 20px;
  border-radius: 16px;
  background: rgba(22, 35, 74, .96);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .14) inset, 0 16px 40px rgba(0, 0, 0, .45);
  font-weight: 600;
  font-size: .95rem;
  text-align: center;
  opacity: 0;
  transform: translate(-50%, 16px);
  transition: opacity .25s ease, transform .35s var(--ease-out);
  pointer-events: none;
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }
.toast:empty { display: none; }

.confirm {
  border: 0;
  padding: 0;
  border-radius: 22px;
  color: var(--cream);
  background: linear-gradient(160deg, #1C2B5A, #141F45);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .12) inset, 0 30px 80px rgba(0, 0, 0, .6);
  width: min(460px, calc(100vw - 32px));
}
.confirm::backdrop { background: rgba(4, 8, 22, .72); }
.confirm-inner { padding: 28px 28px 24px; display: flex; flex-direction: column; gap: 12px; }
.confirm h2 { font-size: 1.45rem; font-weight: 900; }
.confirm p { color: var(--muted); font-size: 1rem; }
.confirm-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 10px; margin-top: 10px; }

.fx-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 80;
  pointer-events: none;
}

/* Simple fade used when GSAP is unavailable or motion is reduced */
.reveal.is-fading-in .reveal-scroll,
.reveal.is-fading-in .reveal-backdrop,
.reveal.is-fading-in .reveal-glow { animation: fade-in .22s ease both; }
.reveal.is-fading-out .reveal-scroll,
.reveal.is-fading-out .reveal-backdrop,
.reveal.is-fading-out .reveal-glow { animation: fade-out .18s ease both; }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes fade-out { from { opacity: 1; } to { opacity: 0; } }

/* =========================================================
   13. Responsive
   ========================================================= */
@media (max-width: 1100px) {
  .controls .btn { padding: .65em 1em; font-size: .8rem; }
}

@media (max-width: 920px) {
  .welcome {
    grid-template-columns: 1fr;
    text-align: center;
    gap: 8px;
    padding-top: clamp(28px, 6vh, 56px);
  }
  .welcome-inner, .welcome-cta { align-items: center; }
  .welcome-brand { margin-bottom: 30px; }
  .welcome-badge { right: -56px; bottom: -30px; width: 92px; }
  .welcome-fan { --fw: clamp(104px, 24vw, 160px); margin-top: 12px; }

  .table {
    --card-w: clamp(140px, min(
      calc((100vw - 2 * var(--pad) - var(--gap)) / 2),
      240px
    ), 240px);
    justify-content: flex-start;
  }
  @supports (width: 1cqh) {
    .table {
      --card-w: clamp(140px, min(
        calc((100cqi - var(--gap)) / 2),
        calc((100cqh - 8.5rem) * 5 / 14)
      ), 240px);
    }
  }
  .decks { grid-template-columns: repeat(2, var(--card-w)); row-gap: clamp(28px, 5vw, 44px); }
  .key-hint { display: none; }
}

@media (max-width: 720px) {
  .game-header { flex-direction: column; align-items: stretch; }
  .brand { justify-content: center; }
  .controls { justify-content: center; }
  .game-footer { justify-content: center; text-align: center; }
  .footer-brand { justify-content: center; flex-wrap: wrap; }
  .footer-links { justify-content: center; }
}

@media (max-width: 520px) {
  .controls .btn-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .controls .btn { min-width: 46px; }
  .controls #shuffle-btn { flex: 1; }
  .welcome { padding-top: 20px; padding-bottom: 16px; gap: 4px; }
  .welcome-inner { gap: 8px; }
  .welcome-badge { right: -28px; bottom: -22px; width: 72px; }
  .welcome-fan { --fw: clamp(84px, 22vw, 110px); height: calc(var(--fw) * 1.9); }
  .logo-plate--hero { width: min(62vw, 220px); }
  .reveal-front { min-height: 0; }
  .rf-head { padding: 0 6px; letter-spacing: .1em; }
  .timer { border-radius: 22px; padding: 10px 12px; }
}

@media (max-width: 340px) {
  .table { --card-w: min(72vw, 230px); }
  .decks { grid-template-columns: var(--card-w); }
  .rf-event { display: none; }
  .rf-head { justify-content: center; }
}

/* Short laptop screens: tighten the vertical rhythm */
@media (min-width: 921px) and (max-height: 860px) {
  .table { gap: 8px; padding-top: 10px; padding-bottom: 8px; }
  .deck-meta { margin-top: 12px; }
  .key-hint { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
  html.preload .welcome { animation-duration: 0s !important; }
}
