/* ============================================================
   Ben & Emma — Wedding Quiz
   Aesthetic: romantic golden-hour game-show
   Deep wine/aubergine ground · warm gold · blush (Emma) · teal (Ben)
   ============================================================ */

:root {
  /* ground */
  --bg-0: #1c0e18;
  --bg-1: #2a1322;
  --bg-2: #3a1a2c;

  /* ink */
  --cream: #f8efe2;
  --cream-soft: #e7d6c4;
  --muted: #b89a92;

  /* metals + accents */
  --gold: #e0b15e;
  --gold-bright: #f6d488;
  --gold-deep: #b9883c;

  --emma: #ef869c;       /* blush rose */
  --emma-deep: #c95a72;
  --ben: #46c0b0;        /* teal */
  --ben-deep: #2c8a7d;

  --good: #74c97a;
  --bad: #e0748a;

  --radius: 22px;
  --radius-lg: 30px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --ease-back: cubic-bezier(.34, 1.56, .64, 1);

  --shadow-soft: 0 18px 50px -18px rgba(0,0,0,.65);
  --shadow-pop: 0 26px 70px -20px rgba(0,0,0,.7);

  --font-display: "Fraunces", "Times New Roman", serif;
  --font-ui: "Hanken Grotesk", system-ui, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  width: 100%;
  overflow: hidden;
}

body {
  font-family: var(--font-ui);
  color: var(--cream);
  background: var(--bg-0);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  /* touch hygiene */
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  user-select: none;
  -webkit-user-select: none;
  overscroll-behavior: none;
  position: fixed;
  inset: 0;
}

/* ----------------------------- atmosphere ----------------------------- */

.bg-glow {
  position: fixed; inset: 0; z-index: -2;
  background:
    radial-gradient(120% 90% at 18% 8%, rgba(239,134,156,.22), transparent 55%),
    radial-gradient(110% 90% at 88% 18%, rgba(70,192,176,.16), transparent 55%),
    radial-gradient(140% 120% at 50% 120%, rgba(224,177,94,.20), transparent 60%),
    linear-gradient(160deg, var(--bg-1), var(--bg-0) 60%, #160a13);
}

.bg-grain {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  opacity: .055; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ----------------------------- stage / screens ----------------------------- */

.stage {
  position: relative;
  height: 100%;
  width: 100%;
  display: grid;
  align-items: stretch;     /* stretch the active screen to full height so its
                               own overflow-y can scroll (centering screens to
                               content height broke scrolling on phones) */
  justify-items: center;
  padding: clamp(14px, 3vh, 34px);
}

.screen {
  display: none;
  width: 100%;
  max-width: 1100px;
  height: 100%;
  min-height: 0;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(14px, 2.6vh, 26px);
}

body[data-screen="pin"]    .screen[data-for="pin"],
body[data-screen="title"]  .screen[data-for="title"],
body[data-screen="pick"]   .screen[data-for="pick"],
body[data-screen="teams"]  .screen[data-for="teams"],
body[data-screen="quiz"]   .screen[data-for="quiz"],
body[data-screen="winner"] .screen[data-for="winner"] {
  display: flex;
  animation: screenIn .5s var(--ease) both;
}

/* hide the reset control on the PIN gate */
body[data-screen="pin"] .reset-btn { display: none; }

@keyframes screenIn {
  from { opacity: 0; transform: translateY(10px) scale(.99); }
  to   { opacity: 1; transform: none; }
}

.screen-heading {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(1.6rem, 4.4vw, 2.8rem);
  letter-spacing: .01em;
  color: var(--cream);
  text-align: center;
}

/* ----------------------------- buttons ----------------------------- */

.btn {
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: clamp(1rem, 2.2vw, 1.25rem);
  letter-spacing: .01em;
  color: var(--bg-0);
  background: var(--cream);
  border: none;
  border-radius: 999px;
  padding: clamp(15px, 2.4vh, 20px) clamp(30px, 5vw, 48px);
  min-height: 60px;
  cursor: pointer;
  transition: transform .14s var(--ease), box-shadow .2s var(--ease), background .2s;
  box-shadow: var(--shadow-soft);
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: translateY(2px) scale(.985); }

.btn-primary {
  background: linear-gradient(180deg, var(--gold-bright), var(--gold));
  color: #3a230a;
  box-shadow: 0 16px 40px -14px rgba(224,177,94,.65), inset 0 1px 0 rgba(255,255,255,.4);
}
.btn-ghost {
  background: transparent;
  color: var(--cream-soft);
  border: 1.5px solid rgba(248,239,226,.28);
  box-shadow: none;
  font-weight: 600;
}
.btn-ghost:active { background: rgba(248,239,226,.06); }
.btn-emma { background: linear-gradient(180deg, var(--emma), var(--emma-deep)); color: #2a0c14; }
.btn-ben  { background: linear-gradient(180deg, var(--ben), var(--ben-deep)); color: #04241f; }
.btn-danger { background: linear-gradient(180deg, #ef7a8e, var(--emma-deep)); color: #2a0c14; }

/* ----------------------------- PIN GATE ----------------------------- */

.screen-pin { text-align: center; }
.pin-inner { display: flex; flex-direction: column; align-items: center; gap: clamp(10px, 2vh, 18px); }
.pin-title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(2rem, 6vw, 3.4rem);
  color: var(--cream);
}
.pin-dots { display: flex; gap: 16px; height: 22px; align-items: center; }
.pin-dot {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid var(--gold);
  background: transparent;
  transition: background .15s var(--ease), transform .15s var(--ease-back);
}
.pin-dot.filled { background: var(--gold); transform: scale(1.12); }
.pin-dots.shake { animation: shake .4s; }
@keyframes shake {
  10%, 90% { transform: translateX(-2px); }
  20%, 80% { transform: translateX(4px); }
  30%, 50%, 70% { transform: translateX(-8px); }
  40%, 60% { transform: translateX(8px); }
}
.pin-error {
  min-height: 1.2em;
  color: var(--bad);
  font-weight: 600;
  font-size: clamp(.85rem, 2vw, 1rem);
  opacity: 0;
  transition: opacity .2s;
}
.pin-error.show { opacity: 1; }

.pin-pad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(10px, 1.8vw, 16px);
  margin-top: clamp(6px, 1.5vh, 14px);
}
.pin-key {
  width: clamp(64px, 9vw, 86px);
  height: clamp(64px, 9vw, 86px);
  border-radius: 50%;
  border: 1.5px solid rgba(248,239,226,.2);
  background: rgba(255,255,255,.05);
  color: var(--cream);
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(1.5rem, 3.6vw, 2.1rem);
  cursor: pointer;
  display: grid; place-items: center;
  transition: transform .1s var(--ease), background .15s;
  -webkit-tap-highlight-color: transparent;
}
.pin-key:active { transform: scale(.92); background: rgba(224,177,94,.18); }
.pin-key.pin-key-blank { visibility: hidden; pointer-events: none; }
.pin-key-del { font-size: clamp(1.4rem, 3vw, 1.8rem); border-color: transparent; background: transparent; }

/* ----------------------------- TITLE ----------------------------- */

.screen-title { text-align: center; }
.title-inner { display: flex; flex-direction: column; align-items: center; gap: clamp(10px, 2vh, 20px); }

.eyebrow {
  font-size: clamp(.8rem, 1.8vw, 1rem);
  letter-spacing: .42em;
  text-transform: uppercase;
  color: var(--gold);
  font-weight: 600;
  padding-left: .42em;
}

.couple {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(3.6rem, 13vw, 8rem);
  line-height: .92;
  letter-spacing: -.01em;
  color: var(--cream);
  text-shadow: 0 8px 40px rgba(0,0,0,.4);
}
.couple .amp {
  font-style: italic;
  color: var(--gold);
  font-weight: 400;
  padding: 0 .08em;
}

.subtitle {
  font-family: var(--font-display);
  font-style: italic;
  font-size: clamp(1.1rem, 3vw, 1.7rem);
  color: var(--cream-soft);
}

.title-foot {
  position: absolute;
  bottom: clamp(18px, 4vh, 40px);
  font-size: clamp(.75rem, 1.7vw, .95rem);
  letter-spacing: .28em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}

/* staggered entrance */
.reveal-up { opacity: 0; animation: revealUp .7s var(--ease) forwards; animation-delay: var(--d, 0s); }
@keyframes revealUp { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }

/* ----------------------------- GUEST PICKER ----------------------------- */

.screen-pick {
  justify-content: flex-start;
  gap: clamp(10px, 1.8vh, 18px);
  padding-top: clamp(10px, 2vh, 20px);
}
.pick-head {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex: 0 0 auto;
  padding: clamp(12px, 2vh, 18px) clamp(16px, 3vw, 26px);
  border-radius: var(--radius);
  border: 1px solid transparent;
  transition: background .35s, border-color .35s, box-shadow .35s;
}
.pick-head.phase-emma {
  background: linear-gradient(100deg, rgba(239,134,156,.30), rgba(201,90,114,.14));
  border-color: rgba(239,134,156,.6);
  box-shadow: 0 16px 44px -22px rgba(239,134,156,.6);
}
.pick-head.phase-ben {
  background: linear-gradient(100deg, rgba(70,192,176,.28), rgba(44,138,125,.14));
  border-color: rgba(70,192,176,.6);
  box-shadow: 0 16px 44px -22px rgba(70,192,176,.6);
}
.pick-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(1.5rem, 4.4vw, 2.6rem);
  line-height: 1.05;
}
.pick-head.phase-emma .pick-title { color: #ffd9e1; }
.pick-head.phase-ben  .pick-title { color: #c9fff5; }
.pick-counter {
  flex: 0 0 auto;
  font-family: var(--font-display);
  font-size: clamp(1.1rem, 2.8vw, 1.7rem);
  font-weight: 500;
  color: var(--cream-soft);
  white-space: nowrap;
}
.pick-counter-sep { color: var(--muted); padding: 0 2px; }

.guest-grid {
  width: 100%;
  flex: 1 1 auto;
  min-height: 0;                 /* allow the grid to shrink so it scrolls
                                    internally instead of overflowing */
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  display: grid;
  grid-template-columns: repeat(auto-fill, 156px);   /* fixed — no track collapse */
  grid-auto-rows: 195px;                              /* fixed row height — stops
                                                         rows shrinking & clipping */
  justify-content: center;
  align-content: start;
  gap: clamp(8px, 1.3vw, 14px);
  padding: 4px 4px 8px;
}
.guest-card {
  position: relative;
  display: block;            /* simple block stack — no flex/aspect-ratio
                                sizing games that break across monitors/DPI */
  border-radius: 16px;
  overflow: hidden;
  border: 3px solid transparent;
  background: rgba(255,255,255,.05);
  cursor: pointer;
  padding: 0;
  transition: transform .14s var(--ease), border-color .2s, box-shadow .2s, opacity .25s;
  -webkit-tap-highlight-color: transparent;
}
.guest-card:active { transform: scale(.97); }
.guest-canvas {
  display: block;
  width: 100%;
  height: 189px;             /* EXPLICIT height — a canvas with height:auto
                                collapses inside a grid track and clips the
                                name plate. Fixed height = nothing to miscompute. */
  background: var(--bg-2);
}
.guest-check {
  position: absolute; top: 8px; right: 8px;
  width: clamp(30px, 4.5vw, 42px); height: clamp(30px, 4.5vw, 42px);
  border-radius: 50%;
  display: grid; place-items: center;
  opacity: 0; transform: scale(.5);
  transition: opacity .2s var(--ease-back), transform .2s var(--ease-back);
  color: #fff;
}
.guest-card.sel-emma { border-color: var(--emma); box-shadow: 0 0 0 2px var(--emma), 0 0 36px -6px rgba(239,134,156,.8); }
.guest-card.sel-ben  { border-color: var(--ben);  box-shadow: 0 0 0 2px var(--ben),  0 0 36px -6px rgba(70,192,176,.8); }
.guest-card.sel-emma .guest-check,
.guest-card.sel-ben  .guest-check { opacity: 1; transform: scale(1); }
.guest-card.sel-emma .guest-check { background: var(--emma-deep); }
.guest-card.sel-ben  .guest-check { background: var(--ben-deep); }
.guest-check::after {
  content: ""; width: 60%; height: 60%;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M9 16.2l-3.5-3.5L4 14.2 9 19.2 20 8.2l-1.5-1.5z'/%3E%3C/svg%3E") center/contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M9 16.2l-3.5-3.5L4 14.2 9 19.2 20 8.2l-1.5-1.5z'/%3E%3C/svg%3E") center/contain no-repeat;
  background: #fff;
}
.guest-card.taken { opacity: .34; cursor: not-allowed; pointer-events: none; }
.guest-tag {
  position: absolute; top: 8px; left: 8px;
  padding: 4px 10px; border-radius: 999px;
  font-size: clamp(.6rem, 1.3vw, .78rem);
  font-weight: 800; letter-spacing: .04em;
  text-transform: uppercase;
  display: none;
}
.guest-card.taken .guest-tag { display: block; }
.guest-card.taken-emma .guest-tag { background: var(--emma); color: #2a0c14; }
.guest-card.taken-ben  .guest-tag { background: var(--ben);  color: #04241f; }

.pick-actions { display: flex; gap: 14px; justify-content: center; flex: 0 0 auto; }
.btn:disabled { opacity: .4; pointer-events: none; }

/* ----------------------------- TEAMS ----------------------------- */

/* scroll if the stacked teams are taller than the screen (e.g. a phone in
   portrait) so the action buttons are always reachable. 'safe center' keeps
   it centred when it fits, but aligns to the top (scrollable) when it doesn't. */
.screen-teams {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  justify-content: flex-start;   /* top-aligned + scroll: every browser can
                                    reach the buttons by scrolling down */
  padding-block: clamp(10px, 2vh, 24px);
}

.teams-wrap {
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: clamp(12px, 2.5vw, 30px);
  width: 100%;
}
.team {
  flex: 1 1 0;
  max-width: 440px;
  background: rgba(255,255,255,.035);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: var(--radius-lg);
  padding: clamp(14px, 2.4vh, 22px);
  backdrop-filter: blur(6px);
  box-shadow: var(--shadow-soft);
}
.team-emma { border-top: 3px solid var(--emma); }
.team-ben  { border-top: 3px solid var(--ben); }

.team-banner { text-align: center; margin-bottom: clamp(10px, 2vh, 18px); }
.team-name {
  font-family: var(--font-display);
  font-size: clamp(1.3rem, 3.4vw, 2rem);
  font-weight: 500;
}
.team-emma .team-name { color: var(--emma); }
.team-ben  .team-name { color: var(--ben); }

.versus {
  align-self: center;
  font-family: var(--font-display);
  font-style: italic;
  font-size: clamp(1.2rem, 3vw, 2rem);
  color: var(--gold);
  flex: 0 0 auto;
}

.roster {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(64px, 1fr));
  gap: clamp(8px, 1.6vw, 16px);
  justify-items: center;
}
.player { display: flex; flex-direction: column; align-items: center; gap: 7px; width: 100%; }

.avatar {
  width: clamp(54px, 8.5vw, 84px);
  height: clamp(54px, 8.5vw, 84px);
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(1.1rem, 2.6vw, 1.7rem);
  color: var(--bg-0);
  background-size: cover;
  background-position: center;
  box-shadow: 0 10px 24px -10px rgba(0,0,0,.6), inset 0 0 0 2px rgba(255,255,255,.18);
}
.team-emma .avatar { box-shadow: 0 10px 24px -10px rgba(0,0,0,.6), inset 0 0 0 2px rgba(239,134,156,.5); }
.team-ben  .avatar { box-shadow: 0 10px 24px -10px rgba(0,0,0,.6), inset 0 0 0 2px rgba(70,192,176,.5); }

.player-name {
  font-size: clamp(.7rem, 1.5vw, .9rem);
  color: var(--cream-soft);
  font-weight: 600;
  text-align: center;
  max-width: 11ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* shuffle animation */
.roster.shuffling .player { animation: shuffle .6s var(--ease); }
@keyframes shuffle {
  0%   { transform: translateY(0) rotate(0); }
  30%  { transform: translateY(-14px) rotate(-6deg); }
  60%  { transform: translateY(10px) rotate(5deg); }
  100% { transform: translateY(0) rotate(0); }
}
.player.pop-in { animation: popIn .5s var(--ease-back) both; }
@keyframes popIn { from { opacity: 0; transform: scale(.4); } to { opacity: 1; transform: scale(1); } }

.teams-actions { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; }

/* ----------------------------- QUIZ ----------------------------- */

.screen-quiz { justify-content: flex-start; padding-top: clamp(8px, 2vh, 18px); gap: clamp(10px, 1.8vh, 18px); overflow-y: auto; -webkit-overflow-scrolling: touch; }

/* ---- big team turn banner ---- */
.turn-banner {
  width: 100%;
  display: flex;
  align-items: center;
  gap: clamp(12px, 2vw, 20px);
  padding: clamp(12px, 2vh, 18px) clamp(16px, 3vw, 26px);
  border-radius: var(--radius);
  border: 1px solid transparent;
  box-shadow: var(--shadow-soft);
  transition: background .35s var(--ease), border-color .35s, box-shadow .35s;
}
.turn-banner.turn-emma {
  background: linear-gradient(100deg, rgba(239,134,156,.32), rgba(201,90,114,.16));
  border-color: rgba(239,134,156,.6);
  box-shadow: 0 0 0 1px rgba(239,134,156,.25), 0 16px 44px -20px rgba(239,134,156,.6);
}
.turn-banner.turn-ben {
  background: linear-gradient(100deg, rgba(70,192,176,.30), rgba(44,138,125,.16));
  border-color: rgba(70,192,176,.6);
  box-shadow: 0 0 0 1px rgba(70,192,176,.25), 0 16px 44px -20px rgba(70,192,176,.6);
}
.turn-banner.sudden {
  background: linear-gradient(100deg, rgba(224,177,94,.34), rgba(185,136,60,.16));
  border-color: rgba(224,177,94,.7);
  box-shadow: 0 0 0 1px rgba(224,177,94,.3), 0 16px 44px -20px rgba(224,177,94,.6);
  animation: pulseGold 1.6s var(--ease) infinite;
}
@keyframes pulseGold { 0%,100% { box-shadow: 0 0 0 1px rgba(224,177,94,.3), 0 16px 44px -20px rgba(224,177,94,.5); } 50% { box-shadow: 0 0 0 1px rgba(224,177,94,.55), 0 16px 56px -16px rgba(224,177,94,.85); } }

.turn-faces { display: flex; flex: 0 0 auto; }
.turn-faces .tface {
  width: clamp(38px, 5.6vw, 52px);
  height: clamp(38px, 5.6vw, 52px);
  border-radius: 50%;
  margin-left: -12px;
  background-size: cover; background-position: center;
  display: grid; place-items: center;
  font-family: var(--font-display); font-weight: 600;
  font-size: clamp(.85rem, 1.8vw, 1.1rem);
  color: var(--bg-0);
  box-shadow: 0 0 0 3px var(--bg-1), 0 6px 16px -6px rgba(0,0,0,.6);
}
.turn-faces .tface:first-child { margin-left: 0; }

.turn-copy { display: flex; flex-direction: column; line-height: 1.05; }
.turn-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(1.5rem, 4.6vw, 2.6rem);
}
.turn-banner.turn-emma .turn-name { color: #ffd9e1; }
.turn-banner.turn-ben  .turn-name { color: #c9fff5; }
.turn-banner.sudden    .turn-name { color: var(--gold-bright); }
.turn-sub {
  font-size: clamp(.75rem, 1.7vw, .95rem);
  letter-spacing: .2em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--cream-soft);
  opacity: .8;
}

/* ---- progress pips ---- */
.progress-row {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}
.pips { display: flex; gap: clamp(5px, 1vw, 9px); flex-wrap: wrap; flex: 1 1 auto; }
.pip {
  height: 10px;
  flex: 1 1 0;
  min-width: 10px;
  max-width: 46px;
  border-radius: 999px;
  background: rgba(255,255,255,.12);
  transition: background .3s, transform .3s;
}
.pip.done-emma { background: var(--emma); }
.pip.done-ben  { background: var(--ben); }
.pip.current {
  background: var(--gold);
  transform: scaleY(1.6);
  box-shadow: 0 0 14px rgba(224,177,94,.7);
}
.progress-label {
  flex: 0 0 auto;
  font-family: var(--font-display);
  font-size: clamp(.95rem, 2.2vw, 1.25rem);
  font-weight: 500;
  color: var(--cream-soft);
  white-space: nowrap;
}
.progress-label.final { color: var(--gold-bright); }
.progress-label.sudden { color: var(--gold-bright); font-style: italic; }
.progress-row.hide-pips .pips { display: none; }

/* scorebar */
.scorebar {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 14px;
}
.score { display: flex; align-items: baseline; gap: 8px; flex: 0 0 auto; }
.score-label { font-size: clamp(.7rem, 1.6vw, .9rem); text-transform: uppercase; letter-spacing: .18em; color: var(--muted); font-weight: 700; }
.score-val { font-family: var(--font-display); font-size: clamp(1.8rem, 4.5vw, 2.6rem); font-weight: 600; line-height: 1; min-width: 1.4ch; text-align: center; transition: transform .3s var(--ease-back); }
.score-emma .score-val { color: var(--emma); }
.score-ben .score-val { color: var(--ben); }
.score-val.bump { transform: scale(1.4); }

.score-track {
  flex: 1 1 auto;
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--ben-deep), var(--ben));
  overflow: hidden;
  position: relative;
  border: 1px solid rgba(255,255,255,.08);
}
.score-fill {
  position: absolute; inset: 0;
  width: 50%;
  background: linear-gradient(90deg, var(--emma), var(--emma-deep));
  border-right: 2px solid var(--cream);
  transition: width .5s var(--ease);
}

/* question card */
.question-card {
  width: 100%;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(14px, 2.6vh, 26px);
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.09);
  border-radius: var(--radius-lg);
  padding: clamp(18px, 3.4vh, 40px) clamp(18px, 4vw, 48px);
  box-shadow: var(--shadow-soft);
  text-align: center;
  position: relative;
  animation: cardIn .45s var(--ease-back) both;
}
@keyframes cardIn { from { opacity: 0; transform: translateY(16px) scale(.985); } to { opacity: 1; transform: none; } }
.question-card.turn-emma { border-color: rgba(239,134,156,.4); box-shadow: var(--shadow-soft), inset 0 3px 0 rgba(239,134,156,.5); }
.question-card.turn-ben  { border-color: rgba(70,192,176,.4);  box-shadow: var(--shadow-soft), inset 0 3px 0 rgba(70,192,176,.5); }
.question-card.sudden    { border-color: rgba(224,177,94,.45); box-shadow: var(--shadow-soft), inset 0 3px 0 rgba(224,177,94,.6); }

.q-type {
  font-size: clamp(.72rem, 1.7vw, .92rem);
  letter-spacing: .24em;
  text-transform: uppercase;
  color: var(--gold);
  font-weight: 700;
}
.q-text {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(1.5rem, 4.6vw, 3rem);
  line-height: 1.1;
  letter-spacing: -.005em;
  max-width: 18ch;
}

/* options */
.options {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(12px, 2.4vw, 22px);
}
.option {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-height: clamp(74px, 12vh, 108px);
  padding: clamp(14px, 2.4vh, 22px) clamp(16px, 2.6vw, 28px);
  border-radius: var(--radius);
  border: 2px solid rgba(255,255,255,.14);
  background: rgba(255,255,255,.05);
  color: var(--cream);
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: clamp(1.1rem, 3vw, 1.7rem);
  cursor: pointer;
  text-align: left;
  transition: transform .14s var(--ease), border-color .2s, background .2s, box-shadow .2s, opacity .3s;
  -webkit-tap-highlight-color: transparent;
}
.option:active { transform: scale(.98); }
.option-key {
  flex: 0 0 auto;
  width: clamp(34px, 5vw, 46px);
  height: clamp(34px, 5vw, 46px);
  border-radius: 12px;
  display: grid; place-items: center;
  background: rgba(224,177,94,.16);
  color: var(--gold-bright);
  font-family: var(--font-display);
  font-weight: 600;
}
.option-text { flex: 1 1 auto; }
.option-mark {
  flex: 0 0 auto; width: 30px; height: 30px; opacity: 0;
  transition: opacity .25s;
}

/* pre-confirm selection */
.option.selected {
  border-color: var(--gold);
  background: rgba(224,177,94,.18);
  box-shadow: 0 0 0 2px rgba(224,177,94,.55), 0 0 34px -8px rgba(224,177,94,.7);
}
.option.selected .option-key { background: var(--gold); color: #3a230a; }

/* reveal states */
.option.is-correct {
  border-color: var(--good);
  background: rgba(116,201,122,.18);
  box-shadow: 0 0 0 2px rgba(116,201,122,.5), 0 0 40px -6px rgba(116,201,122,.6);
}
.option.is-correct .option-mark {
  opacity: 1;
  background: var(--good);
  border-radius: 50%;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M9 16.2l-3.5-3.5L4 14.2 9 19.2 20 8.2l-1.5-1.5z'/%3E%3C/svg%3E") center/70% no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M9 16.2l-3.5-3.5L4 14.2 9 19.2 20 8.2l-1.5-1.5z'/%3E%3C/svg%3E") center/70% no-repeat;
}
.option.is-wrong {
  border-color: var(--bad);
  background: rgba(224,116,138,.14);
  opacity: .85;
}
.option.is-wrong .option-mark {
  opacity: 1;
  background: var(--bad);
  border-radius: 50%;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M18.3 5.7L12 12l6.3 6.3-1.4 1.4L10.6 13.4 5.7 18.3 4.3 16.9 10.6 12 4.3 5.7 5.7 4.3 12 10.6l4.9-4.9z'/%3E%3C/svg%3E") center/68% no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M18.3 5.7L12 12l6.3 6.3-1.4 1.4L10.6 13.4 5.7 18.3 4.3 16.9 10.6 12 4.3 5.7 5.7 4.3 12 10.6l4.9-4.9z'/%3E%3C/svg%3E") center/68% no-repeat;
}
.option.is-dim { opacity: .4; }
.options.revealed .option { cursor: default; }

/* reveal line */
.reveal-line { animation: revealUp .4s var(--ease) both; }
.reveal-result {
  font-family: var(--font-display);
  font-size: clamp(1.3rem, 3.4vw, 2rem);
  font-weight: 600;
}
.reveal-result.good { color: var(--good); }
.reveal-result.bad  { color: var(--bad); }
.reveal-note { color: var(--cream-soft); font-style: italic; font-family: var(--font-display); font-size: clamp(.95rem, 2.2vw, 1.25rem); margin-top: 4px; }

.quiz-foot { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 8px; min-height: 64px; justify-content: center; }
.quiz-hint { color: var(--muted); font-size: clamp(.8rem, 1.8vw, 1rem); font-style: italic; }

/* ----------------------------- WINNER ----------------------------- */
.screen-winner { position: relative; text-align: center; }
.confetti { position: fixed; inset: 0; z-index: 0; pointer-events: none; width: 100%; height: 100%; }
.winner-inner { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; gap: clamp(10px, 2.4vh, 22px); }
.winner-name {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(3rem, 12vw, 7rem);
  line-height: .95;
  animation: winnerIn .8s var(--ease-back) both;
}
.winner-name.win-emma { color: var(--emma); text-shadow: 0 0 50px rgba(239,134,156,.5); }
.winner-name.win-ben  { color: var(--ben);  text-shadow: 0 0 50px rgba(70,192,176,.5); }
.winner-name.win-tie  { color: var(--gold); }
@keyframes winnerIn { from { opacity: 0; transform: scale(.7) translateY(20px); } to { opacity: 1; transform: none; } }
.winner-score {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 5vw, 3rem);
  font-weight: 500;
  color: var(--cream-soft);
  letter-spacing: .04em;
}

/* ----------------------------- RESULT OVERLAY ----------------------------- */
.result-overlay {
  position: fixed; inset: 0; z-index: 60;
  display: grid; place-items: center;
  text-align: center;
  padding: 6vw;
  animation: resultIn .28s var(--ease) both;
}
.result-overlay[hidden] { display: none; }
.result-overlay.correct {
  background:
    radial-gradient(120% 100% at 50% 0%, rgba(116,201,122,.5), transparent 60%),
    linear-gradient(160deg, #143a1c, #0c2413 70%, #0a1c10);
}
.result-overlay.wrong {
  background:
    radial-gradient(120% 100% at 50% 0%, rgba(224,116,138,.5), transparent 60%),
    linear-gradient(160deg, #45131f, #2c0c14 70%, #220a10);
}
@keyframes resultIn { from { opacity: 0; transform: scale(.98); } to { opacity: 1; transform: none; } }

.result-inner { display: flex; flex-direction: column; align-items: center; gap: clamp(10px, 2.4vh, 22px); }
.result-icon {
  width: clamp(110px, 18vh, 180px);
  height: clamp(110px, 18vh, 180px);
  border-radius: 50%;
  display: grid; place-items: center;
  animation: popIn .45s var(--ease-back) both;
}
.result-overlay.correct .result-icon { background: rgba(116,201,122,.2); border: 4px solid var(--good); }
.result-overlay.wrong   .result-icon { background: rgba(224,116,138,.2); border: 4px solid var(--bad); }
.result-icon::after {
  content: ""; width: 56%; height: 56%;
  background: #fff;
  -webkit-mask-position: center; mask-position: center;
  -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
  -webkit-mask-size: contain; mask-size: contain;
}
.result-overlay.correct .result-icon::after {
  background: var(--good);
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M9 16.2l-3.5-3.5L4 14.2 9 19.2 20 8.2l-1.5-1.5z'/%3E%3C/svg%3E");
          mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M9 16.2l-3.5-3.5L4 14.2 9 19.2 20 8.2l-1.5-1.5z'/%3E%3C/svg%3E");
}
.result-overlay.wrong .result-icon::after {
  background: var(--bad);
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M18.3 5.7L12 12l6.3 6.3-1.4 1.4L10.6 13.4 5.7 18.3 4.3 16.9 10.6 12 4.3 5.7 5.7 4.3 12 10.6l4.9-4.9z'/%3E%3C/svg%3E");
          mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M18.3 5.7L12 12l6.3 6.3-1.4 1.4L10.6 13.4 5.7 18.3 4.3 16.9 10.6 12 4.3 5.7 5.7 4.3 12 10.6l4.9-4.9z'/%3E%3C/svg%3E");
}
.result-headline {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(2.8rem, 11vw, 6rem);
  line-height: .95;
  color: var(--cream);
}
.result-overlay.correct .result-headline { color: #c9f5cf; text-shadow: 0 0 50px rgba(116,201,122,.6); }
.result-overlay.wrong   .result-headline { color: #ffd2db; text-shadow: 0 0 50px rgba(224,116,138,.6); }
.result-answer {
  font-family: var(--font-display);
  font-size: clamp(1.3rem, 4vw, 2.2rem);
  font-weight: 500;
  color: var(--cream);
}
.result-note {
  font-family: var(--font-display);
  font-style: italic;
  font-size: clamp(1rem, 2.6vw, 1.4rem);
  color: var(--cream-soft);
  max-width: 22ch;
}

/* ----------------------------- RESET ----------------------------- */
.reset-btn {
  position: fixed;
  top: max(14px, env(safe-area-inset-top));
  right: max(14px, env(safe-area-inset-right));
  z-index: 40;
  width: 48px; height: 48px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.12);
  color: var(--cream-soft);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background .2s, transform .1s;
}
.reset-btn:active { transform: scale(.94); }
.reset-ring {
  position: absolute; inset: 0; width: 48px; height: 48px;
  transform: rotate(-90deg);
  pointer-events: none;
}
.reset-ring circle {
  fill: none;
  stroke: var(--gold);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-dasharray: 132;
  stroke-dashoffset: 132;
}
.reset-btn.holding .reset-ring circle {
  transition: stroke-dashoffset 2s linear;
  stroke-dashoffset: 0;
}

/* ----------------------------- MODAL ----------------------------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 50;
  display: grid; place-items: center;
  background: rgba(12,6,11,.6);
  backdrop-filter: blur(5px);
  animation: fade .2s var(--ease);
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal[hidden], .modal-backdrop[hidden] { display: none; }
.modal {
  width: min(440px, 88vw);
  background: linear-gradient(180deg, var(--bg-2), var(--bg-1));
  border: 1px solid rgba(255,255,255,.12);
  border-radius: var(--radius-lg);
  padding: clamp(22px, 4vw, 34px);
  text-align: center;
  box-shadow: var(--shadow-pop);
  animation: modalIn .35s var(--ease-back) both;
}
@keyframes modalIn { from { opacity: 0; transform: scale(.9) translateY(10px); } to { opacity: 1; transform: none; } }
.modal h3 { font-family: var(--font-display); font-weight: 500; font-size: clamp(1.4rem, 4vw, 2rem); margin-bottom: 8px; }
.modal p { color: var(--cream-soft); margin-bottom: 22px; }
.modal-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* ----------------------------- responsive ----------------------------- */
@media (max-width: 560px) {
  .options { grid-template-columns: 1fr; }
  .teams-wrap { flex-direction: column; align-items: center; }
  .versus { padding: 4px 0; }
}
@media (orientation: portrait) and (min-width: 561px) {
  .q-text { max-width: 22ch; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .08s !important; }
}
