:root {
  --paper: #f4ede0;
  --paper-2: #ebe2d1;
  --card: #fffaf0;
  --ink: #1b1712;
  --muted: #5f564c;
  --accent: #ff4d1a;
  --accent-ink: #1b1712;
  --radius: 18px;
  --shadow: 5px 5px 0 var(--ink);
  --font: 'Bricolage Grotesque', ui-rounded, 'Avenir Next', system-ui, sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100dvh; background: var(--paper); color: var(--ink);
  font: 500 16px/1.4 var(--font); font-optical-sizing: auto;
  background-image: radial-gradient(rgba(27, 23, 18, .07) 1px, transparent 1.2px);
  background-size: 14px 14px;
}
a { color: inherit; }
button, input { font: inherit; color: inherit; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 4px solid var(--accent); outline-offset: 3px; border-radius: 8px; }

/* ---------- Logo ---------- */
.logo { display: inline-flex; text-decoration: none; font-weight: 800; letter-spacing: -.01em; line-height: 1; transform: rotate(-2deg); }
.logo b { display: block; padding: .28em .42em .3em; border: 3px solid var(--ink); }
.logo b:first-child { background: var(--ink); color: var(--paper); border-radius: 10px 0 0 10px; }
.logo b:last-child { background: var(--accent); color: var(--ink); border-radius: 0 10px 10px 0; border-left: 0; }
.logo.sm { font-size: 14px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4em;
  min-height: 48px; padding: 10px 20px; border: 3px solid var(--ink); border-radius: 999px;
  background: var(--card); color: var(--ink); font-weight: 800; font-size: 17px; text-decoration: none;
  box-shadow: 3px 3px 0 var(--ink); cursor: pointer; transition: transform .08s, box-shadow .08s;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.btn:hover { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--ink); }
.btn:active { transform: translate(3px, 3px); box-shadow: 0 0 0 var(--ink); }
.btn.primary { background: var(--accent); }
.btn.ink { background: var(--ink); color: var(--paper); }
.btn.big { font-size: 22px; min-height: 64px; padding: 12px 32px; }
.btn.sm { min-height: 40px; font-size: 15px; padding: 6px 14px; }
.btn small { font-weight: 600; font-size: .72em; opacity: .8; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.linkbtn { background: none; border: 0; padding: 0; text-decoration: underline; font-weight: 700; cursor: pointer; }

/* ---------- Common ---------- */
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; max-width: 1200px; margin: 0 auto; }
.pno { font-weight: 800; font-size: 15px; padding: 4px 10px; border: 2.5px solid var(--ink); border-radius: 999px; background: var(--card); }
.fine { color: var(--muted); font-size: 14px; }
.kicker { font-weight: 800; text-transform: uppercase; letter-spacing: .08em; font-size: 13px; margin: 0 0 6px; }
.err { color: #b3260b; font-weight: 700; min-height: 1.4em; }
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 140%); z-index: 50;
  background: var(--ink); color: var(--paper); font-weight: 700; padding: 10px 18px; border-radius: 999px;
  transition: transform .2s, visibility .2s; pointer-events: none; max-width: calc(100vw - 32px); visibility: hidden;
}
.toast.show { transform: translate(-50%, 0); visibility: visible; }
.banner { position: fixed; top: 0; left: 0; right: 0; z-index: 60; background: var(--ink); color: var(--paper); text-align: center; font-weight: 700; padding: 6px; font-size: 14px; }

/* ---------- Portrait cards ---------- */
.card {
  position: relative; margin: 0; background: var(--card); border: 4px solid var(--ink);
  border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden;
}
.card .face-svg, .portrait .face-svg { display: block; width: 100%; height: auto; }
.tag {
  position: absolute; top: 10px; left: 10px; z-index: 2; font-weight: 800; font-size: 13px; text-transform: uppercase;
  letter-spacing: .06em; padding: 4px 10px; border: 2.5px solid var(--ink); border-radius: 999px; background: var(--card);
}
.tag.ink { background: var(--ink); color: var(--paper); }
.tag.accent { background: var(--accent); }
.tag.right { left: auto; right: 10px; }
.card .meta { position: absolute; left: 0; right: 0; bottom: 0; padding: 6px 10px 8px; font-weight: 800; background: linear-gradient(transparent, rgba(255, 250, 240, .96) 40%); text-align: center; }

/* ---------- Landing ---------- */
.landing { min-height: 100dvh; display: flex; flex-direction: column; }
.hero { flex: 1; display: flex; flex-direction: column; align-items: center; text-align: center; padding: 8px 16px 32px; gap: 18px; max-width: 640px; margin: 0 auto; width: 100%; }
.booth { position: relative; width: min(100%, 420px); height: clamp(190px, 52vw, 260px); margin-top: 8px; }
.booth .mini { position: absolute; top: 0; width: 46%; }
.booth .mini figcaption { position: absolute; bottom: 0; left: 0; right: 0; font-weight: 800; font-size: 12px; background: var(--card); border-top: 3px solid var(--ink); padding: 3px 0; }
.booth .m0 { left: 27%; z-index: 3; transform: rotate(1.5deg); }
.booth .m1 { left: 0; top: 8%; transform: rotate(-7deg); z-index: 2; }
.booth .m2 { right: 0; top: 8%; transform: rotate(7deg); z-index: 1; }
.booth .ribbon { position: absolute; z-index: 4; left: 50%; bottom: -6px; transform: translateX(-50%) rotate(-2deg); background: var(--ink); color: var(--paper); font-weight: 800; font-size: 13px; padding: 5px 12px; border-radius: 8px; white-space: nowrap; }
.hero h1 { font-size: clamp(26px, 7vw, 40px); line-height: 1.05; letter-spacing: -.02em; margin: 6px 0 0; font-weight: 800; }
.hero h1 em { font-style: normal; background: var(--accent); padding: 0 .15em; border-radius: 6px; }
.hero .how { margin: 0; font-size: 17px; color: var(--muted); }
.hero .row { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }
.hero .btn.big { width: min(100%, 380px); }
.joinbox { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }

/* ---------- Forms ---------- */
.form-page { max-width: 480px; margin: 0 auto; padding: 0 16px 40px; }
.form-page h1 { font-size: 34px; line-height: 1.05; margin: 18px 0 8px; letter-spacing: -.02em; }
.field { display: grid; gap: 6px; margin: 18px 0; font-weight: 800; }
.field input {
  min-height: 56px; border: 3px solid var(--ink); border-radius: 14px; padding: 10px 14px; font-size: 20px; font-weight: 700;
  background: var(--card); width: 100%;
}
.field input.code { text-transform: uppercase; letter-spacing: .3em; font-size: 28px; text-align: center; }
.stack { display: grid; gap: 12px; }

/* ---------- Play: study ---------- */
.playbar {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 10px; padding: 8px 12px;
  background: var(--paper); border-bottom: 3px solid var(--ink); min-height: 60px;
}
.playbar .grow { flex: 1; }
.phase-name { font-weight: 800; font-size: 18px; }
.study { min-height: 100dvh; display: flex; flex-direction: column; }
.study-stage { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; padding: 16px; }
.study-row { display: flex; align-items: center; justify-content: center; gap: clamp(12px, 3vw, 32px); width: 100%; }
.study .portrait { width: min(80vw, 58dvh, 540px); position: relative; }
.study .portrait .face-svg { visibility: hidden; }
.study.memorize .portrait .face-svg { visibility: visible; }
.curtain {
  position: absolute; inset: 0; display: grid; place-items: center; background: var(--accent); z-index: 3;
  font-weight: 800; font-size: clamp(90px, 30vw, 200px); line-height: 1; text-align: center;
}
.curtain small { display: block; font-size: 18px; text-transform: uppercase; letter-spacing: .1em; text-align: center; }
.study.memorize .curtain { transform: translateY(-102%); }
.curtain { transition: transform .38s cubic-bezier(.6, 0, .3, 1); }
.countdown-side { display: grid; justify-items: center; gap: 2px; min-width: 70px; }
.countdown-side .num { font-size: clamp(56px, 14vw, 120px); font-weight: 800; line-height: .9; font-variant-numeric: tabular-nums; }
.countdown-side .unit { font-weight: 800; text-transform: uppercase; letter-spacing: .08em; font-size: 12px; }
.meter { width: min(80vw, 540px); height: 14px; border: 3px solid var(--ink); border-radius: 999px; overflow: hidden; background: var(--card); }
.meter i { display: block; height: 100%; background: var(--ink); width: 100%; transform-origin: left; }
@media (max-width: 599px) {
  .study-row { flex-direction: column-reverse; }
  .countdown-side { grid-auto-flow: column; align-items: baseline; gap: 8px; }
}

/* ---------- Play: rebuild ---------- */
.rebuild { min-height: 100dvh; }
.timer { display: flex; align-items: center; gap: 8px; font-weight: 800; font-variant-numeric: tabular-nums; }
.timer .t-num { font-size: 26px; min-width: 2.6em; text-align: center; border: 3px solid var(--ink); border-radius: 10px; padding: 0 6px; background: var(--card); line-height: 1.25; }
.timer .t-bar { width: clamp(40px, 14vw, 140px); height: 12px; border: 3px solid var(--ink); border-radius: 999px; overflow: hidden; background: var(--card); }
.timer .t-bar i { display: block; height: 100%; background: var(--ink); transform-origin: left; }
.timer.urgent .t-num { background: var(--ink); color: var(--paper); animation: pulse 1s steps(2, start) infinite; }
.timer.urgent .t-num::after { content: '!'; }
@keyframes pulse { 50% { transform: scale(1.08); } }
.status-chip { font-weight: 800; font-size: 14px; padding: 4px 10px; border: 2.5px solid var(--ink); border-radius: 999px; background: var(--card); white-space: nowrap; }
.editor { max-width: 1100px; margin: 0 auto; }
.portrait-wrap { position: sticky; top: 60px; z-index: 5; background: var(--paper); display: flex; justify-content: center; padding: 10px 16px 8px; border-bottom: 2px dashed rgba(27, 23, 18, .25); }
.portrait-wrap .card { width: min(60vw, 36dvh, 300px); }
.controls { padding: 6px 16px 40px; display: grid; gap: 0; }
.ctl { display: grid; grid-template-columns: 100px 1fr; align-items: center; gap: 8px; min-height: 50px; border: 0; margin: 0; padding: 0; }
.ctl + .ctl { border-top: 1.5px solid rgba(27, 23, 18, .12); }
.ctl .name { font-weight: 800; font-size: 15px; line-height: 1.1; display: block; }
.ctl .val { display: block; font-size: 12.5px; color: var(--muted); font-weight: 600; line-height: 1.15; }
.rng { position: relative; height: 44px; }
.rng .ticks { position: absolute; left: 15px; right: 15px; top: 50%; height: 0; display: flex; justify-content: space-between; pointer-events: none; }
.rng .ticks i { width: 8px; height: 8px; margin: -4px; border-radius: 50%; background: var(--ink); }
.rng input { position: absolute; inset: 0; width: 100%; height: 44px; margin: 0; background: transparent; -webkit-appearance: none; appearance: none; cursor: pointer; touch-action: pan-y; }
.rng input::-webkit-slider-runnable-track { height: 4px; background: var(--ink); border-radius: 4px; }
.rng input::-moz-range-track { height: 4px; background: var(--ink); border-radius: 4px; }
.rng input::-webkit-slider-thumb { -webkit-appearance: none; width: 30px; height: 30px; margin-top: -13px; border-radius: 50%; background: var(--accent); border: 3.5px solid var(--ink); box-shadow: 2px 2px 0 var(--ink); }
.rng input::-moz-range-thumb { width: 24px; height: 24px; border-radius: 50%; background: var(--accent); border: 3.5px solid var(--ink); box-shadow: 2px 2px 0 var(--ink); }
.rng input:focus-visible { outline: none; }
.rng input:focus-visible::-webkit-slider-thumb { outline: 4px solid var(--ink); outline-offset: 2px; }
.rng input:focus-visible::-moz-range-thumb { outline: 4px solid var(--ink); outline-offset: 2px; }
.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 6px 0; }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.seg span { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 52px; border: 3px solid var(--ink); border-radius: 12px; background: var(--card); font-weight: 800; font-size: 13px; line-height: 1; gap: 2px; }
.seg span svg { width: 40px; height: 16px; }
.seg input:checked + span { background: var(--accent); box-shadow: inset 0 0 0 2px var(--ink); }
.seg input:checked + span::before { content: '✓ '; position: absolute; top: 3px; left: 6px; font-size: 11px; }
.seg input:focus-visible + span { outline: 4px solid var(--ink); outline-offset: 2px; }
.lock-foot { display: none; }
@media (min-width: 900px) {
  .editor { display: grid; grid-template-columns: minmax(0, 1fr) 440px; gap: 40px; padding: 28px 24px; align-items: start; }
  .portrait-wrap { top: 88px; border: 0; padding: 0; background: none; }
  .portrait-wrap .card { width: min(100%, 64dvh, 560px); }
  .controls { padding: 0; }
  .ctl { grid-template-columns: 130px 1fr; min-height: 58px; }
}

/* ---------- Waiting / lobby ---------- */
.center-page { min-height: 100dvh; display: flex; flex-direction: column; }
.center-page .body { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 16px; gap: 14px; }
.center-page h1 { font-size: clamp(28px, 7vw, 48px); margin: 0; line-height: 1.05; letter-spacing: -.02em; }
.center-page .card.sm { width: min(52vw, 240px); }
.bigstat { font-size: clamp(40px, 10vw, 72px); font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }

.host-lobby { min-height: 100dvh; display: flex; flex-direction: column; }
.host-grid { flex: 1; display: grid; grid-template-columns: 1fr; gap: 24px; padding: 8px 16px 32px; max-width: 1200px; margin: 0 auto; width: 100%; align-items: center; }
@media (min-width: 900px) { .host-grid { grid-template-columns: 1.1fr 1fr; gap: 48px; padding: 16px 40px 40px; } }
.joinpanel { display: flex; gap: 24px; align-items: center; flex-wrap: wrap; justify-content: center; }
.qr { width: clamp(160px, 24vw, 280px); aspect-ratio: 1; background: #fff; border: 4px solid var(--ink); border-radius: var(--radius); box-shadow: var(--shadow); padding: 8px; display: grid; place-items: center; }
.qr svg { width: 100%; height: 100%; }
.joinurl { font-size: clamp(18px, 2.4vw, 26px); font-weight: 700; margin: 0; word-break: break-all; }
.roomcode { font-size: clamp(64px, 11vw, 140px); font-weight: 800; letter-spacing: .06em; line-height: .95; margin: 4px 0 10px; }
.players-panel h2 { font-size: clamp(26px, 3.4vw, 40px); margin: 0 0 12px; }
.chips { list-style: none; margin: 0 0 20px; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; max-height: 40dvh; overflow: auto; }
.chips li { font-weight: 800; padding: 6px 12px; border: 2.5px solid var(--ink); border-radius: 999px; background: var(--card); }
.chips li.host { background: var(--ink); color: var(--paper); }

/* ---------- Reveal (solo + viewer) ---------- */
.reveal { max-width: 860px; margin: 0 auto; padding: 0 0 40px; }
.reveal-title { text-align: center; font-size: clamp(24px, 6vw, 40px); margin: 0 16px 12px; line-height: 1.05; letter-spacing: -.02em; }
.reveal-title em { font-style: normal; background: var(--accent); padding: 0 .15em; border-radius: 6px; }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(8px, 2.5vw, 24px); padding: 0 12px; }
.verdict { display: flex; align-items: center; gap: 16px; padding: 20px 16px 4px; max-width: 640px; margin: 0 auto; }
.score { flex: none; display: grid; place-items: center; width: 92px; height: 92px; border-radius: 50%; background: var(--ink); color: var(--paper); font-weight: 800; line-height: 1; text-align: center; }
.score b { font-size: 40px; font-variant-numeric: tabular-nums; }
.score small { display: block; font-size: 12px; opacity: .8; }
.obs { margin: 0; font-size: clamp(18px, 4.6vw, 24px); font-weight: 700; line-height: 1.2; }
.rankline { margin: 4px 0 0; font-weight: 800; color: var(--muted); font-size: 15px; }
.share { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; padding: 20px 16px 6px; }
.share-preview { margin: 6px auto 0; max-width: 520px; padding: 10px 14px; border: 2px dashed rgba(27, 23, 18, .35); border-radius: 12px; font: 600 14px/1.4 ui-monospace, Menlo, monospace; white-space: pre-wrap; word-break: break-word; }
.breakdown { max-width: 640px; margin: 14px auto 0; padding: 0 16px; }
.breakdown summary { cursor: pointer; font-weight: 800; padding: 8px 0; }
.breakdown table { width: 100%; border-collapse: collapse; font-size: 14px; }
.breakdown th, .breakdown td { text-align: left; padding: 6px 4px; border-bottom: 1.5px solid rgba(27, 23, 18, .12); }
.breakdown td.m { font-weight: 800; white-space: nowrap; }
.onstream { max-width: 640px; margin: 24px auto 0; padding: 16px; border-top: 3px solid var(--ink); }
.onstream h2 { margin: 0 0 10px; font-size: 22px; }
.onstream .pair { padding: 0; }
.center { text-align: center; }

/* ---------- Host reveal (widescreen) ---------- */
.beat { min-height: 100dvh; display: grid; grid-template-rows: auto 1fr auto; }
.beat-head { display: flex; align-items: center; gap: 16px; padding: 14px 24px; }
.beat-title { font-size: clamp(28px, 4.4vw, 64px); margin: 0; line-height: 1; letter-spacing: -.02em; flex: 1; }
.beat-title em { font-style: normal; background: var(--accent); padding: 0 .12em; border-radius: 8px; }
.beat-body { display: flex; align-items: center; justify-content: center; gap: clamp(12px, 3vw, 48px); padding: 8px 24px; flex-wrap: wrap; }
.beat-body .card { width: min(40vw, 62dvh, 620px); }
.beat-body.trio .card { width: min(29vw, 54dvh, 460px); }
.beat-body.trio .card.orig { width: min(31vw, 58dvh, 500px); }
.vs { font-size: clamp(28px, 4vw, 56px); font-weight: 800; }
.cap { text-align: center; margin-top: 10px; }
.cap .who { font-size: clamp(20px, 2.4vw, 32px); font-weight: 800; line-height: 1.1; }
.cap .sc { font-size: clamp(16px, 1.8vw, 24px); font-weight: 800; color: var(--muted); }
.col { display: flex; flex-direction: column; align-items: center; }
.beat-foot { display: flex; align-items: center; gap: 16px; padding: 14px 24px 20px; flex-wrap: wrap; }
.beat-foot .line { flex: 1; font-size: clamp(18px, 2.2vw, 30px); font-weight: 800; margin: 0; line-height: 1.15; min-width: 240px; }
.fact { display: inline; background: var(--accent); padding: .05em .25em; border-radius: 8px; box-decoration-break: clone; -webkit-box-decoration-break: clone; }
.beat-controls { display: flex; gap: 10px; margin-left: auto; flex-wrap: wrap; }
.lb { list-style: none; padding: 0; margin: 0; display: grid; gap: 4px; font-weight: 800; min-width: 200px; }
.lb li { display: flex; gap: 10px; padding: 4px 10px; border: 2.5px solid var(--ink); border-radius: 10px; background: var(--card); }
.lb li .r { width: 2.2em; }
.lb li .s { margin-left: auto; font-variant-numeric: tabular-nums; }
.count-badge { font-size: clamp(14px, 1.4vw, 20px); font-weight: 800; padding: 4px 12px; border: 3px solid var(--ink); border-radius: 999px; background: var(--card); white-space: nowrap; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- Rooms: extras ---------- */
.top .grow { flex: 1; }
.title-sub { display: inline-block; font-size: .55em; font-weight: 700; color: var(--muted); letter-spacing: 0; }
.cap .title-sub { font-size: clamp(14px, 1.5vw, 20px); }
.pair.one { grid-template-columns: minmax(0, 360px); justify-content: center; }
.card.mystery { width: min(40vw, 62dvh, 560px); aspect-ratio: 272 / 288; display: grid; place-items: center; background: var(--accent); }
.card.mystery .q { font-size: clamp(120px, 18vw, 260px); font-weight: 800; line-height: 1; }
.start-row { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.bestof { display: grid; gap: 2px; font-weight: 800; font-size: 13px; }
.bestof select { font: inherit; font-size: 16px; min-height: 44px; border: 3px solid var(--ink); border-radius: 12px; background: var(--card); padding: 4px 8px; }
.pass-chip { display: inline-flex; gap: 4px; align-items: center; font-size: 14px; font-weight: 700; padding: 5px 12px; border-radius: 999px; background: var(--accent); border: 2.5px solid var(--ink); white-space: nowrap; }
.standings { margin-top: 18px; text-align: left; width: min(100%, 420px); }
.standings h3 { margin: 0 0 8px; font-size: 20px; display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.standings h3 em { font-style: normal; background: var(--accent); padding: 0 .15em; border-radius: 6px; }
.lb li.you { background: var(--accent); }

/* Packs */
.packs { max-width: 1200px; margin: 0 auto; padding: 8px 16px 48px; width: 100%; }
.packs-head { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; margin-bottom: 14px; }
.packs-head h2 { margin: 0; font-size: clamp(24px, 3vw, 36px); }
.pack-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 18px; }
.pack { background: var(--card); border: 4px solid var(--ink); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px; display: flex; flex-direction: column; gap: 6px; }
.pack h3 { margin: 4px 0 0; font-size: 22px; }
.pack p { margin: 0 0 8px; color: var(--muted); font-size: 15px; flex: 1; }
.pack-art { position: relative; height: 150px; }
.pack-art .mini { position: absolute; top: 0; width: 42%; border-width: 3px; box-shadow: 3px 3px 0 var(--ink); }
.pack-art .p0 { left: 29%; z-index: 3; }
.pack-art .p1 { left: 2%; top: 10px; transform: rotate(-6deg); z-index: 2; }
.pack-art .p2 { right: 2%; top: 10px; transform: rotate(6deg); z-index: 1; }
.pack.locked .pack-art::after { content: 'LOCKED'; position: absolute; z-index: 4; left: 50%; bottom: 0; transform: translateX(-50%) rotate(-3deg); background: var(--ink); color: var(--paper); font-weight: 800; font-size: 12px; letter-spacing: .1em; padding: 3px 10px; border-radius: 6px; }
.offer-actions { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin-top: 16px; }

/* Offer after the final reveal */
.offer { display: flex; gap: 18px 28px; align-items: center; flex-wrap: wrap; margin: 0 24px 24px; padding: 18px 22px; border: 4px solid var(--ink); border-radius: var(--radius); background: var(--card); box-shadow: var(--shadow); }
.offer h2 { margin: 0; font-size: clamp(22px, 2.6vw, 34px); }
.offer p { margin: 4px 0 0; font-size: 17px; }
.offer .offer-actions { margin-top: 0; }
.offer.phone { display: block; margin: 22px 16px 0; text-align: center; }
.offer.phone .btn.big { width: 100%; font-size: 19px; margin-top: 12px; }
.offer.phone.asked { background: var(--accent); }
.offer.phone.asked .btn.primary { background: var(--ink); color: var(--paper); }
.giftqr { display: flex; gap: 14px; align-items: center; }
.qr.sm { width: 128px; box-shadow: 3px 3px 0 var(--ink); border-width: 3px; padding: 5px; }
.checkout-note { font-weight: 800; margin: 0; }
.beat.final { grid-template-rows: auto 1fr auto auto; }
.beat.final .beat-body .card { width: min(34vw, 46dvh, 520px); }

/* Checkout sheet */
.sheet { border: 4px solid var(--ink); border-radius: 22px; padding: 0; width: min(480px, calc(100vw - 24px)); background: var(--paper); color: var(--ink); box-shadow: 8px 8px 0 var(--ink); }
.sheet::backdrop { background: rgba(27, 23, 18, .55); }
.sheet-body { padding: 20px; }
.sheet h2 { margin: 0 0 6px; font-size: 28px; line-height: 1.05; }
.sheet .recip { font-size: 17px; margin: 0 0 8px; }
.sheet .incl { margin: 0 0 12px; padding-left: 20px; color: var(--muted); }
.sheet .price { font-size: 34px; font-weight: 800; margin: 8px 0 0; }
.sheet .testnote { font-weight: 800; background: #ffe9a8; border: 2px solid var(--ink); border-radius: 10px; padding: 6px 10px; }
.sheet .check { display: flex; gap: 10px; align-items: center; font-weight: 800; min-height: 44px; }
.sheet .check input { width: 22px; height: 22px; accent-color: var(--ink); }
.field.sm { margin: 4px 0 8px; }
.field.sm input { min-height: 46px; font-size: 17px; }
.sheet-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }

/* Live announcement (everyone's screen) */
.announce { position: fixed; top: 16px; left: 50%; transform: translate(-50%, -160%); z-index: 70; width: max-content; max-width: min(calc(100vw - 32px), 900px);
  background: var(--accent); color: var(--ink); border: 4px solid var(--ink); border-radius: 18px; box-shadow: var(--shadow);
  font-weight: 800; font-size: clamp(18px, 2.6vw, 34px); padding: 12px 22px; text-align: center; transition: transform .3s cubic-bezier(.2, 1.4, .4, 1); }
.announce.show { transform: translate(-50%, 0); }
.announce .spark { display: inline-block; }

@media (min-width: 700px) { .beat-body.trio { flex-wrap: nowrap; align-items: flex-end; } }
@media (max-width: 420px) {
  .tag { top: 6px; left: 6px; font-size: 10.5px; padding: 2px 7px; border-width: 2px; }
  .tag.right { right: 6px; }
  .card { border-width: 3px; box-shadow: 4px 4px 0 var(--ink); }
}

/* ---------- Everyone-first: stats, promo, archive, Face Card ---------- */
.hl { background: var(--accent); padding: 0 .15em; border-radius: 6px; }
.card-chip { display: inline-flex; align-items: center; font-weight: 800; font-size: 13px; padding: 4px 10px; border: 2.5px solid var(--ink); border-radius: 8px; background: var(--ink); color: var(--paper); text-decoration: none; transform: rotate(-2deg); white-space: nowrap; }
.btn.ghost { background: transparent; box-shadow: none; border-width: 2.5px; min-height: 44px; font-size: 15px; }
.btn.ghost:hover { box-shadow: 3px 3px 0 var(--ink); }
.btn .lock, .tile .lock { width: 14px; height: 14px; flex: none; }
.hero .row.more { gap: 8px; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 0; width: min(100%, 380px); }
.stats div { border: 2.5px solid var(--ink); border-radius: 12px; background: var(--card); padding: 6px 4px; }
.stats dt { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.stats dd { margin: 0; font-size: 24px; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.1; }
.promo { display: flex; gap: 14px; align-items: center; text-align: left; width: min(100%, 460px); margin-top: 8px; padding: 14px; border: 3px solid var(--ink); border-radius: var(--radius); background: var(--card); box-shadow: var(--shadow); }
.promo h2 { margin: 0; font-size: 20px; }
.promo p { margin: 2px 0 10px; font-size: 14.5px; color: var(--muted); }
.promo p b { color: var(--ink); }
.promo-card { flex: none; width: 78px; border: 3px solid var(--ink); border-radius: 10px; background: var(--accent); transform: rotate(-5deg); overflow: hidden; box-shadow: 3px 3px 0 var(--ink); }
.promo-card svg { display: block; width: 100%; height: auto; }
.promo-wrap { display: flex; justify-content: center; padding: 8px 16px 0; }
.fc-badge { position: relative; width: 120px; margin: 8px 0 4px; border: 4px solid var(--ink); border-radius: 14px; background: var(--accent); box-shadow: var(--shadow); transform: rotate(-4deg); overflow: hidden; }
.fc-badge svg { display: block; width: 100%; height: auto; }
.fc-badge span { position: absolute; left: 0; right: 0; bottom: 0; background: var(--ink); color: var(--paper); font-weight: 800; font-size: 11px; letter-spacing: .12em; text-align: center; padding: 3px 0; }
.fc-badge.sm { width: 72px; float: right; margin: 0 0 8px 12px; border-width: 3px; box-shadow: 3px 3px 0 var(--ink); }
.fc-badge.sm span { font-size: 8px; }
.incl.big { font-size: 17px; padding-left: 20px; display: grid; gap: 6px; }
.form-page .price { font-size: 34px; font-weight: 800; margin: 12px 0; }
.row-btns { display: flex; gap: 10px; flex-wrap: wrap; }
.list-page { max-width: 1100px; margin: 0 auto; padding: 0 16px 48px; }
.list-page h1 { font-size: clamp(30px, 6vw, 48px); margin: 8px 0 6px; letter-spacing: -.02em; }
.list-page .lede { color: var(--muted); font-size: 17px; margin: 0 0 16px; }
.list-page .pack-grid { margin-top: 16px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 12px; margin-top: 18px; }
.tile { display: block; text-decoration: none; border: 3px solid var(--ink); border-radius: 14px; background: var(--card); box-shadow: 3px 3px 0 var(--ink); overflow: hidden; transition: transform .08s; }
.tile:hover { transform: translate(-1px, -1px); }
.tile-face { display: grid; place-items: center; aspect-ratio: 272 / 288; background: var(--paper-2); }
.tile.done .tile-face { background: var(--card); }
.tile-face svg { display: block; width: 100%; height: auto; }
.tile-face .q { font-size: 40px; font-weight: 800; color: var(--muted); }
.tile-face .q .lock { width: 26px; height: 26px; }
.tile-meta { display: flex; justify-content: space-between; padding: 4px 8px; border-top: 2.5px solid var(--ink); font-size: 14px; }
.tile-meta span { font-weight: 800; background: var(--accent); padding: 0 6px; border-radius: 6px; }
.tile.locked { opacity: .8; }

/* Host screens on a phone (games for everyone: the host is often on a phone too) */
@media (max-width: 699px) {
  .beat { grid-template-rows: auto auto auto; }
  .beat.final { grid-template-rows: auto auto auto auto; }
  .beat-head { flex-wrap: wrap; gap: 8px 10px; padding: 12px 16px; }
  .beat-title { flex-basis: 100%; order: 2; font-size: 30px; }
  .beat-head .count-badge { font-size: 13px; padding: 3px 10px; }
  .beat-body { gap: 10px; padding: 4px 12px; flex-wrap: nowrap; align-items: flex-start; }
  .beat-body .card, .beat.final .beat-body .card { width: 42vw; }
  .beat-body.trio { flex-wrap: wrap; }
  .beat-body.trio .card, .beat-body.trio .card.orig { width: 42vw; }
  .beat-body .card.mystery { width: 60vw; }
  .vs { display: none; }
  .cap .who { font-size: 17px; }
  .cap .sc, .cap .title-sub { font-size: 13px; }
  .beat-foot { padding: 12px 16px; }
  .beat-foot .line { min-width: 0; flex-basis: 100%; font-size: 18px; }
  .beat-controls { margin-left: 0; width: 100%; }
  .beat-controls .btn.big { flex: 1; font-size: 18px; min-height: 54px; }
  .offer { margin: 0 12px 20px; padding: 14px; }
  .offer .offer-actions { width: 100%; }
  .offer .offer-actions .btn.big { width: 100%; font-size: 18px; }
  .giftqr { width: 100%; }
}

/* =========================================================
   Spacing pass: nothing crammed
   ========================================================= */
body { line-height: 1.5; }
h1, h2, h3 { line-height: 1.12; text-wrap: balance; }
p { text-wrap: pretty; }
.top { padding: 16px 20px; }
.top.slim { padding-top: 14px; padding-bottom: 0; }
.hero { gap: 22px; padding: 4px 20px 44px; }
.hero .how { line-height: 1.5; max-width: 34ch; }
.hero .row { gap: 12px; }
.hero .row.more { margin-top: -6px; }
.hero .fine { margin: 4px 0 0; }
.wordmark { margin: 4px 0 0; line-height: 1; }
.logo.xl { font-size: clamp(44px, 14vw, 96px); letter-spacing: -.02em; transform: rotate(-3deg); }
.logo.xl b { border-width: 5px; padding: .16em .3em .2em; }
.logo.xl b:first-child { border-radius: 18px 0 0 18px; box-shadow: 0 0 0 0 var(--ink); }
.logo.xl b:last-child { border-radius: 0 18px 18px 0; border-left: 0; box-shadow: 6px 6px 0 var(--ink); }
.tagline { font-size: clamp(24px, 6.4vw, 38px); font-weight: 800; letter-spacing: -.02em; margin: 4px 0 0; }
.tagline em { font-style: normal; background: var(--accent); padding: 0 .15em; border-radius: 6px; }
.booth { margin-top: 0; }
.stats { gap: 8px; }
.stats div { padding: 8px 4px 6px; }
.stats dt { margin-bottom: 2px; }
.promo { gap: 16px; padding: 16px 18px; }
.promo p { line-height: 1.45; margin: 4px 0 12px; }
.form-page { padding: 0 20px 56px; }
.form-page h1 { margin: 20px 0 12px; }
.form-page > p { line-height: 1.55; margin: 0 0 8px; }
.field { gap: 8px; margin: 20px 0; }
.stack { gap: 14px; }
.center-page .body { gap: 16px; padding: 24px 20px; }
.center-page .body > p { margin: 0; line-height: 1.5; max-width: 36ch; }
.list-page { padding: 0 20px 56px; }
.list-page .lede { line-height: 1.5; margin: 0 0 20px; max-width: 60ch; }
.pack { padding: 16px; gap: 8px; }
.pack h3 { margin: 8px 0 0; }
.pack p { line-height: 1.45; margin: 0 0 12px; }
.pack-grid { gap: 20px; }
.offer p { line-height: 1.45; margin-top: 6px; }
.offer.phone p { margin: 8px 0 4px; }
.verdict { gap: 18px; padding: 22px 20px 6px; }
.obs { line-height: 1.25; }
.rankline { margin-top: 8px; }
.share { gap: 12px; padding: 22px 16px 8px; }
.share-preview { margin: 10px 16px 0; }
@media (min-width: 560px) { .share-preview { margin: 10px auto 0; } }
.reveal .fine.center { margin: 18px 20px 0; line-height: 1.5; }
.reveal-title { margin: 4px 20px 16px; }
.breakdown { margin-top: 18px; padding: 0 20px; }
.breakdown th, .breakdown td { padding: 8px 6px; }
.onstream { margin-top: 28px; padding: 20px; }
.ctl label { padding: 6px 0; }
.ctl .val { margin-top: 2px; }
.players-panel h2 { margin-bottom: 14px; }
.chips { gap: 10px; }
.start-row { gap: 16px; margin-bottom: 10px; }
.standings { margin-top: 22px; }
.lb { gap: 6px; }
.lb li { padding: 6px 12px; }
.sheet-body { padding: 22px 22px 20px; }
.sheet .incl { line-height: 1.45; display: grid; gap: 4px; }
.sheet .recip { line-height: 1.5; }
.incl.big { gap: 10px; line-height: 1.45; }
.beat-foot .line { line-height: 1.3; }
.joinpanel { gap: 28px; }
@media (max-width: 420px) {
  .top { padding: 14px 16px; }
  .hero { padding: 4px 16px 40px; gap: 20px; }
  .ctl { grid-template-columns: 96px 1fr; }
}

/* =========================================================
   Motion. Everything here switches off under prefers-reduced-motion
   (see the global rule earlier in this file).
   ========================================================= */
@keyframes pageIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes rise { from { opacity: 0; transform: translateY(18px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes popIn { 0% { opacity: 0; transform: scale(.6); } 70% { opacity: 1; transform: scale(1.08); } 100% { transform: scale(1); } }
@keyframes slideL { from { opacity: 0; transform: translateX(-40px) rotate(-6deg); } to { opacity: 1; transform: none; } }
@keyframes slideR { from { opacity: 0; transform: translateX(40px) rotate(6deg); } to { opacity: 1; transform: none; } }
@keyframes flipIn { 0% { opacity: 0; transform: perspective(800px) rotateY(80deg); } 60% { opacity: 1; transform: perspective(800px) rotateY(-8deg); } 100% { transform: none; } }
@keyframes bump { 0% { transform: scale(1); } 40% { transform: scale(1.025) rotate(-.6deg); } 100% { transform: scale(1); } }
@keyframes float0 { 0%, 100% { transform: rotate(1.5deg) translateY(0); } 50% { transform: rotate(-.5deg) translateY(-6px); } }
@keyframes float1 { 0%, 100% { transform: rotate(-7deg) translateY(0); } 50% { transform: rotate(-5deg) translateY(-5px); } }
@keyframes float2 { 0%, 100% { transform: rotate(7deg) translateY(0); } 50% { transform: rotate(9deg) translateY(-4px); } }
@keyframes wiggle { 0%, 100% { transform: rotate(-3deg); } 30% { transform: rotate(2deg) scale(1.04); } 60% { transform: rotate(-5deg); } }
@keyframes breathe { 0%, 100% { box-shadow: 3px 3px 0 var(--ink); } 50% { box-shadow: 6px 6px 0 var(--ink); transform: translate(-2px, -2px); } }
@keyframes sweep { from { background-size: 0% 100%; } to { background-size: 100% 100%; } }
@keyframes sheetIn { from { opacity: 0; transform: translateY(30px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* Page entrance (new screens only, not live updates) */
#app.enter > main { animation: pageIn .38s cubic-bezier(.2, .8, .2, 1) both; }
#app.enter .stagger > * { animation: rise .5s cubic-bezier(.2, .8, .2, 1) both; }
#app.enter .stagger > :nth-child(1) { animation-delay: .03s; }
#app.enter .stagger > :nth-child(2) { animation-delay: .08s; }
#app.enter .stagger > :nth-child(3) { animation-delay: .13s; }
#app.enter .stagger > :nth-child(4) { animation-delay: .18s; }
#app.enter .stagger > :nth-child(5) { animation-delay: .23s; }
#app.enter .stagger > :nth-child(6) { animation-delay: .28s; }
#app.enter .stagger > :nth-child(7) { animation-delay: .33s; }
#app.enter .stagger > :nth-child(8) { animation-delay: .38s; }
#app.enter .stagger > :nth-child(n+9) { animation-delay: .42s; }
#app.enter .pack-grid > * { animation: rise .5s cubic-bezier(.2, .8, .2, 1) both; }
#app.enter .pack-grid > :nth-child(2) { animation-delay: .07s; }
#app.enter .pack-grid > :nth-child(3) { animation-delay: .14s; }
#app.enter .pack-grid > :nth-child(4) { animation-delay: .21s; }
#app.enter .pack-grid > :nth-child(5) { animation-delay: .28s; }
#app.enter .pack-grid > :nth-child(6) { animation-delay: .35s; }

/* Home */
#app.enter .logo.xl { animation: wiggle .8s .15s cubic-bezier(.3, 1.6, .5, 1) both; }
.booth .m0 { animation: float0 6s ease-in-out infinite; }
.booth .m1 { animation: float1 7s ease-in-out infinite .6s; }
.booth .m2 { animation: float2 6.5s ease-in-out infinite 1.2s; }
.hero > .btn.primary.big { animation: breathe 2.8s ease-in-out infinite 1.2s; }

/* Study + rebuild */
.pop { display: inline-block; animation: popIn .35s cubic-bezier(.3, 1.6, .5, 1) both; }
.study.memorize .portrait { animation: popIn .4s cubic-bezier(.3, 1.5, .5, 1) both; }
#mine.bump { animation: bump .22s ease-out; }
.timer.urgent .t-num { animation: pulse 1s steps(2, start) infinite; }
.timer .t-bar i, .meter i { transition: transform .12s linear; }

/* Reveal: originals slide in, yours flips over, then the score lands */
#app.enter .reveal .pair > .card:first-child { animation: slideL .5s cubic-bezier(.2, .8, .2, 1) both; }
#app.enter .reveal .pair > .card:last-child { animation: flipIn .7s .25s cubic-bezier(.2, .8, .2, 1) both; }
#app.enter .verdict .score { animation: popIn .5s .6s cubic-bezier(.3, 1.6, .5, 1) both; }
#app.enter .verdict > div:last-child, #app.enter .verdict .obs { animation: rise .5s .75s both; }
#app.enter .share { animation: rise .5s .9s both; }
#app.enter .reveal-title { animation: rise .45s both; }

/* Host beats */
#app.enter .beat-title { animation: rise .45s both; }
#app.enter .beat-body > * { animation: rise .55s cubic-bezier(.2, .8, .2, 1) both; }
#app.enter .beat-body > :nth-child(2) { animation: popIn .4s .2s both; }
#app.enter .beat-body > :nth-child(3) { animation-delay: .32s; }
#app.enter .beat-body .card.mystery { animation: popIn .5s cubic-bezier(.3, 1.6, .5, 1) both; }
.fact { background-image: linear-gradient(var(--accent), var(--accent)); background-repeat: no-repeat; background-color: transparent; }
#app.enter .fact { animation: sweep .7s .55s cubic-bezier(.6, 0, .3, 1) both; }
#app.enter .offer { animation: rise .55s .8s both; }

/* Small interactions */
.pack, .tile, .card.mini { transition: transform .15s ease, box-shadow .15s ease; }
.pack:hover { transform: translate(-2px, -3px) rotate(-.4deg); box-shadow: 8px 8px 0 var(--ink); }
.tile:hover { transform: translate(-2px, -2px) rotate(-1deg); box-shadow: 5px 5px 0 var(--ink); }
.sheet[open] { animation: sheetIn .32s cubic-bezier(.2, .8, .2, 1) both; }
.sheet[open]::backdrop { animation: fadeIn .25s both; }
#app.enter .chips li { animation: popIn .3s cubic-bezier(.3, 1.6, .5, 1) both; }
.seg span { transition: background .12s, transform .12s; }
.seg input:checked + span { transform: translateY(-1px); }
.btn { transition: transform .1s, box-shadow .1s, background .15s; }
.top { width: 100%; }
.logo.xl { font-size: clamp(40px, 12.4vw, 96px); }
.promo .linkbtn { margin-left: 12px; }

/* Sound + vibration toggle, on every screen */
.sound-toggle {
  position: fixed; left: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); z-index: 40;
  width: 42px; height: 42px; border-radius: 50%; border: 2.5px solid var(--ink); background: var(--card); color: var(--ink);
  box-shadow: 2px 2px 0 var(--ink); display: grid; place-items: center; cursor: pointer; padding: 0;
}
.sound-toggle svg { width: 20px; height: 20px; }
.sound-toggle[aria-pressed="false"] { background: var(--paper-2); color: var(--muted); }
.sound-toggle:active { transform: translate(2px, 2px); box-shadow: none; }
.controls { padding-bottom: 80px; }
.reveal, .list-page, .form-page { padding-bottom: 80px; }

/* Host + join: the form sits in the middle of the screen, logo pinned to the top */
.form-page.centered { position: relative; min-height: 100dvh; display: flex; flex-direction: column; justify-content: center; padding-top: 84px; padding-bottom: 84px; }
.form-page.centered > header { position: absolute; top: 0; left: 20px; right: 20px; width: auto; }
.form-page.centered > h1 { margin-top: 0; }

/* ---------- Feature by feature ---------- */
.fb { max-width: 640px; margin: 26px auto 0; padding: 18px 18px 8px; background: var(--card); border: 3px solid var(--ink); border-radius: var(--radius); box-shadow: var(--shadow); }
@media (max-width: 680px) { .fb { margin: 26px 16px 0; } }
.fb-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 6px; }
.fb-head h2 { margin: 0; font-size: 20px; }
.fb-key { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; color: var(--muted); }
.fb-key .fb-dot { position: static; transform: none; margin-left: 6px; }
.fb-list { list-style: none; margin: 0; padding: 0; }
.fb-row { display: grid; grid-template-columns: 96px 1fr 76px; align-items: center; gap: 14px; padding: 12px 0; }
.fb-row + .fb-row { border-top: 1.5px solid rgba(27, 23, 18, .1); }
.fb-label { font-weight: 800; font-size: 14.5px; line-height: 1.2; }
.fb-status { justify-self: end; font-weight: 800; font-size: 12.5px; padding: 3px 9px; border-radius: 999px; border: 2px solid var(--ink); white-space: nowrap; }
.fb-row.ok .fb-status { background: var(--ink); color: var(--paper); }
.fb-row.near .fb-status { background: var(--card); }
.fb-row.miss .fb-status { background: var(--accent); }
.fb-track { position: relative; height: 22px; margin: 0 9px; }
.fb-line { position: absolute; left: 0; right: 0; top: 50%; height: 3px; margin-top: -1.5px; background: rgba(27, 23, 18, .18); border-radius: 3px; }
.fb-track i { position: absolute; top: 50%; width: 5px; height: 5px; margin: -2.5px 0 0 -2.5px; border-radius: 50%; background: rgba(27, 23, 18, .35); }
.fb-track i:nth-of-type(1) { left: 0; } .fb-track i:nth-of-type(2) { left: 16.67%; } .fb-track i:nth-of-type(3) { left: 33.33%; }
.fb-track i:nth-of-type(4) { left: 50%; } .fb-track i:nth-of-type(5) { left: 66.67%; } .fb-track i:nth-of-type(6) { left: 83.33%; } .fb-track i:nth-of-type(7) { left: 100%; }
.fb-dot { position: absolute; top: 50%; width: 16px; height: 16px; transform: translate(-50%, -50%); border-radius: 50%; display: inline-block; }
.fb-dot.his { background: var(--ink); }
.fb-dot.yours { background: var(--accent); border: 2.5px solid var(--ink); width: 18px; height: 18px; }
.fb-dot.both { background: var(--ink); box-shadow: 0 0 0 3px var(--card), 0 0 0 6px var(--accent); }
.fb-words { display: flex; justify-content: space-between; gap: 8px; font-size: 12.5px; color: var(--muted); margin-top: 2px; line-height: 1.3; }
.fb-words .y { color: var(--ink); font-weight: 700; text-align: right; }
.fb-chips { display: flex; gap: 6px; }
.fb-chip { flex: 1; text-align: center; font-size: 12.5px; font-weight: 700; padding: 4px 0; border-radius: 8px; border: 2px solid rgba(27, 23, 18, .2); color: var(--muted); text-transform: capitalize; }
.fb-chip.his { border-color: var(--ink); color: var(--ink); }
.fb-chip.yours { background: var(--accent); border-color: var(--ink); color: var(--ink); }
.fb-chip.his.yours { background: var(--ink); color: var(--paper); box-shadow: 0 0 0 2px var(--card), 0 0 0 4px var(--accent); }
@media (max-width: 420px) { .fb-row { grid-template-columns: 82px 1fr 64px; gap: 10px; } .fb-label { font-size: 13.5px; } }
#app.enter .fb-dot.yours { animation: popIn .4s 1.1s both; }

/* ---------- Share card (spoiler-free preview of what gets shared) ---------- */
.share-card { max-width: 380px; margin: 14px auto 0; padding: 16px 18px 12px; background: var(--ink); color: var(--paper); border-radius: 18px; box-shadow: 5px 5px 0 var(--accent); }
@media (max-width: 420px) { .share-card { margin: 14px 16px 0; } }
.sc-top { display: flex; justify-content: space-between; align-items: center; }
.share-card .logo.sm { font-size: 11px; transform: rotate(-2deg); }
.share-card .logo b:first-child { background: var(--paper); color: var(--ink); border-color: var(--paper); }
.share-card .logo b:last-child { border-color: var(--paper); }
.sc-no { font-weight: 800; font-size: 14px; opacity: .8; }
.sc-main { display: flex; align-items: center; gap: 14px; margin: 12px 0 12px; }
.sc-score { font-size: 46px; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.sc-score small { font-size: 15px; opacity: .7; margin-left: 2px; }
.sc-line { font-weight: 700; font-size: 15px; line-height: 1.3; }
.sc-cells { display: grid; grid-template-columns: repeat(8, 1fr); gap: 5px; }
.sc-cells i { height: 12px; border-radius: 4px; }
.sc-cells .ok { background: var(--paper); }
.sc-cells .near { background: var(--accent); opacity: .65; }
.sc-cells .miss { background: var(--accent); }
.share-card figcaption { margin-top: 12px; font-size: 12.5px; opacity: .7; line-height: 1.4; }

/* Host + join: larger logo above the title */
.form-page.centered { padding-top: 48px; }
.form-logo { margin: 0 0 22px; }
.logo.lg { font-size: clamp(30px, 9vw, 46px); transform: rotate(-3deg); }
.logo.lg b { border-width: 4px; }
.logo.lg b:last-child { box-shadow: 4px 4px 0 var(--ink); }
#app.enter .form-logo .logo { animation: wiggle .8s .1s cubic-bezier(.3, 1.6, .5, 1) both; }

/* ---------- Home hero: one big face melting into a bad memory ---------- */
.hero-morph { margin: 0; width: min(78vw, 300px); position: relative; }
.hero-morph .card { transform: rotate(-2deg); box-shadow: 7px 7px 0 var(--ink); }
.hero-morph .card .face-svg { display: block; width: 100%; height: auto; }
.hero-cap { position: absolute; left: 50%; bottom: -14px; transform: translateX(-50%) rotate(-2deg); background: var(--ink); color: var(--paper); font-weight: 800; font-size: 13px; padding: 5px 12px; border-radius: 8px; white-space: nowrap; }
.hero-morph .tag { transition: background .2s; }

/* ---------- Roast verdict ---------- */
.roast { margin: 0 0 8px; font-size: clamp(22px, 5.6vw, 30px); font-weight: 800; line-height: 1.12; letter-spacing: -.01em; text-wrap: balance; }
.verdict .obs { font-size: clamp(15px, 4vw, 18px); font-weight: 600; color: var(--muted); }
#app.enter .roast { animation: popIn .5s .75s cubic-bezier(.3, 1.6, .5, 1) both; }

/* ---------- Morph slider ---------- */
.morph { display: flex; gap: 18px; align-items: center; max-width: 640px; margin: 24px auto 0; padding: 16px; background: var(--card); border: 3px solid var(--ink); border-radius: var(--radius); box-shadow: var(--shadow); }
@media (max-width: 680px) { .morph { margin: 24px 16px 0; } }
.morph-card { width: 132px; flex: none; box-shadow: 3px 3px 0 var(--ink); border-width: 3px; }
.morph-card .tag { font-size: 10px; padding: 2px 7px; top: 6px; left: 6px; }
.morph-ctl { flex: 1; display: grid; gap: 8px; }
.morph-ctl .kicker { margin: 0; }
.morph-ctl input[type=range] { width: 100%; accent-color: var(--accent); height: 28px; }
.morph-ends { display: flex; justify-content: space-between; font-size: 13px; font-weight: 700; color: var(--muted); }
.morph-ctl .btn { justify-self: start; }

/* ---------- Clip button ---------- */
.clipbtn svg { width: 20px; height: 20px; }
.clipbtn small { font-weight: 600; }

/* Dots sit on the track via margins, so the pop-in animation can't knock them off the line */
.fb-track .fb-dot { transform: none; margin: -8px 0 0 -8px; }
.fb-track .fb-dot.yours { margin: -9px 0 0 -9px; }

/* =========================================================
   Face Card page
   ========================================================= */
.fc-page { max-width: 560px; margin: 0 auto; padding: 0 20px 96px; text-align: center; }
.fc-page > .top { padding-left: 0; padding-right: 0; }
.fc-page h1 { font-size: clamp(34px, 9vw, 48px); margin: 8px 0 6px; letter-spacing: -.02em; }
.fc-sub { margin: 0 0 22px; font-size: 18px; color: var(--muted); font-weight: 600; }
.fc-hero { position: relative; height: 300px; margin: 6px auto 18px; width: min(100%, 360px); }
.fc-big { position: absolute; left: 50%; top: 8px; width: 210px; transform: translateX(-50%) rotate(-3deg); background: var(--accent); border: 4px solid var(--ink); border-radius: 20px; box-shadow: 8px 8px 0 var(--ink); padding: 10px; z-index: 3; }
.fc-big-face { background: var(--card); border: 3px solid var(--ink); border-radius: 12px; overflow: hidden; }
.fc-big-face svg, .fc-fan svg { display: block; width: 100%; height: auto; }
.fc-big-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; font-weight: 800; font-size: 13px; letter-spacing: .1em; }
.fc-big-foot span:last-child { letter-spacing: 0; font-size: 12px; background: var(--ink); color: var(--paper); padding: 2px 8px; border-radius: 6px; }
.fc-fan { position: absolute; top: 40px; width: 150px; border: 3px solid var(--ink); border-radius: 14px; overflow: hidden; background: var(--card); box-shadow: 4px 4px 0 var(--ink); }
.fc-fan.f1 { left: 0; transform: rotate(-12deg); z-index: 1; }
.fc-fan.f2 { right: 0; transform: rotate(10deg); z-index: 2; }
.fc-stamp { position: absolute; right: -16px; top: 18px; transform: rotate(14deg); background: var(--paper); border: 3px solid var(--ink); color: var(--ink); font-weight: 800; letter-spacing: .12em; font-size: 14px; padding: 4px 10px; border-radius: 8px; text-transform: uppercase; }
#app.enter .fc-big { animation: fcIn .7s cubic-bezier(.3, 1.5, .5, 1) both; }
#app.enter .fc-fan.f1 { animation: fanL .7s .15s cubic-bezier(.3, 1.4, .5, 1) both; }
#app.enter .fc-fan.f2 { animation: fanR .7s .15s cubic-bezier(.3, 1.4, .5, 1) both; }
@keyframes fcIn { from { opacity: 0; transform: translateX(-50%) translateY(30px) rotate(6deg) scale(.85); } to { opacity: 1; transform: translateX(-50%) rotate(-3deg); } }
@keyframes fanL { from { opacity: 0; transform: translateX(60px) rotate(0); } to { opacity: 1; transform: rotate(-12deg); } }
@keyframes fanR { from { opacity: 0; transform: translateX(-60px) rotate(0); } to { opacity: 1; transform: rotate(10deg); } }

.fc-perks { list-style: none; margin: 0 0 22px; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; text-align: left; }
.fc-perks li { display: grid; gap: 4px; align-content: start; padding: 14px; background: var(--card); border: 3px solid var(--ink); border-radius: 16px; box-shadow: 3px 3px 0 var(--ink); }
.fc-perks b { font-size: 16px; line-height: 1.2; }
.fc-perks span:last-child { font-size: 14px; color: var(--muted); line-height: 1.4; }
.fc-ic { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 10px; background: var(--accent); border: 2.5px solid var(--ink); margin-bottom: 6px; }
.fc-ic svg { width: 22px; height: 22px; color: var(--ink); }

.fc-buy { display: grid; gap: 12px; justify-items: center; padding: 20px; margin: 0 0 30px; background: var(--ink); color: var(--paper); border-radius: 20px; box-shadow: 6px 6px 0 var(--accent); }
.fc-price { display: flex; align-items: baseline; gap: 10px; }
.fc-price b { font-size: 48px; line-height: 1; }
.fc-price span { font-weight: 700; opacity: .75; }
.fc-buy .btn.big { width: 100%; box-shadow: 3px 3px 0 var(--paper); border-color: var(--paper); }
.fc-buy .fine { color: var(--paper); opacity: .7; margin: 0; }

.fc-h2 { font-size: 20px; margin: 0 0 12px; text-align: left; }
.fc-strip { display: grid; grid-auto-flow: column; grid-auto-columns: 104px; gap: 12px; overflow-x: auto; padding: 4px 4px 14px; margin: 0 -4px 22px; scroll-snap-type: x mandatory; text-align: left; }
.fc-strip figure { margin: 0; scroll-snap-align: start; }
.fc-strip .card { border-width: 3px; box-shadow: 3px 3px 0 var(--ink); border-radius: 12px; }
.fc-strip figcaption { font-size: 12.5px; font-weight: 800; margin-top: 8px; line-height: 1.25; }

.fc-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 0 0 26px; }
.fc-tile { display: grid; justify-items: center; gap: 4px; padding: 16px 8px; background: var(--card); border: 3px solid var(--ink); border-radius: 16px; box-shadow: 3px 3px 0 var(--ink); text-decoration: none; transition: transform .12s, box-shadow .12s; }
.fc-tile:hover { transform: translate(-2px, -2px); box-shadow: 5px 5px 0 var(--ink); }
.fc-tile svg { width: 28px; height: 28px; margin-bottom: 4px; }
.fc-tile b { font-size: 15px; line-height: 1.2; }
.fc-tile span { font-size: 12.5px; color: var(--muted); }

.fc-restore { text-align: left; border: 2.5px dashed rgba(27, 23, 18, .3); border-radius: 16px; padding: 4px 16px; }
.fc-restore summary { cursor: pointer; font-weight: 800; padding: 12px 0; list-style: none; display: flex; justify-content: space-between; align-items: center; }
.fc-restore summary::-webkit-details-marker { display: none; }
.fc-restore summary::after { content: '+'; font-size: 22px; line-height: 1; }
.fc-restore[open] summary::after { content: '–'; }
.fc-form { padding: 0 0 14px; }
.fc-form .fine { margin: 0 0 10px; line-height: 1.45; }
.fc-row { display: flex; gap: 8px; }
.fc-row input { flex: 1; min-width: 0; min-height: 50px; border: 3px solid var(--ink); border-radius: 12px; padding: 8px 12px; font: inherit; font-size: 17px; font-weight: 600; background: var(--card); }
.fc-row .btn { min-height: 50px; }
@media (max-width: 340px) { .fc-perks { grid-template-columns: 1fr; } }
@media (max-width: 400px) { .fc-hero { height: 280px; } .fc-big { width: 190px; } .fc-fan { width: 128px; } .fc-perks li { padding: 12px; } .fc-perks b { font-size: 15px; } .fc-perks span:last-child { font-size: 13px; } }
.fc-price { flex-direction: column; align-items: center; gap: 6px; }
.fc-price span { font-size: 15px; }

/* More breathing room at the top of every page */
.top, .top.slim { padding-top: calc(30px + env(safe-area-inset-top)); }
.form-page.centered { padding-top: calc(64px + env(safe-area-inset-top)); }
@media (min-width: 700px) { .top, .top.slim { padding-top: 40px; } }

.loader { width: 44px; height: 44px; border-radius: 50%; border: 5px solid var(--paper-2); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Legal pages ---------- */
.legal { max-width: 680px; margin: 0 auto; padding: 0 20px 80px; line-height: 1.6; font-size: 16.5px; }
.legal > .top { padding-left: 0; padding-right: 0; }
.legal h1 { font-size: clamp(32px, 8vw, 46px); margin: 14px 0 4px; letter-spacing: -.02em; }
.legal h2 { font-size: 20px; margin: 30px 0 8px; }
.legal p, .legal li { color: #2e2822; }
.legal ul { padding-left: 22px; display: grid; gap: 8px; }
.legal a { font-weight: 700; }
.legal-date { color: var(--muted); font-size: 14px; margin: 0 0 16px; }
.legal-nav { display: flex; gap: 8px; margin: 0 0 24px; flex-wrap: wrap; }
.legal-nav a { text-decoration: none; padding: 6px 14px; border: 2.5px solid var(--ink); border-radius: 999px; background: var(--card); font-size: 14px; }
.legal-nav a[aria-current="page"] { background: var(--ink); color: var(--paper); }
.legal-tldr { background: var(--card); border: 3px solid var(--ink); border-radius: 16px; padding: 14px 16px; box-shadow: 4px 4px 0 var(--ink); }
.legal-foot { margin-top: 36px; }

/* Footer links on the home page, and the terms note in the checkout sheet */
.site-foot { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; font-size: 13.5px; color: var(--muted); padding: 8px 16px 0; }
.site-foot a { color: var(--muted); }
.sheet .legal-note { font-size: 13px; color: var(--muted); margin: 4px 0 10px; line-height: 1.45; }
.sheet .legal-note a { color: var(--ink); font-weight: 700; }
.fc-buy .fine a { color: var(--paper); }

/* Reveal show: progress pips + a bar that runs down to the next beat */
.pips { display: inline-flex; gap: 6px; align-items: center; }
.pips i { width: 12px; height: 12px; border-radius: 50%; border: 2.5px solid var(--ink); background: var(--card); }
.pips i.on { background: var(--accent); }
.beat-timer { flex-basis: 100%; order: 9; height: 6px; margin: 0; background: rgba(27, 23, 18, .12); border-radius: 6px; overflow: hidden; }
.beat-timer i { display: block; height: 100%; background: var(--ink); transform-origin: left; animation: drain linear forwards; }
@keyframes drain { from { transform: scaleX(1); } to { transform: scaleX(0); } }


/* =========================================================
   Friend-game reveal + leaderboard: always fits one screen
   ========================================================= */
.show, .board { height: 100dvh; display: flex; flex-direction: column; overflow: hidden; padding-bottom: 64px; }
.show-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: calc(14px + env(safe-area-inset-top)) 16px 6px; }
.show-head .grow { flex: 1; }
.show-head .beat-timer { flex-basis: 100%; order: 9; }
.show-title { margin: 6px 16px 10px; text-align: center; font-size: clamp(22px, 5.4vw, 44px); line-height: 1.12; letter-spacing: -.02em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.show-title em { font-style: normal; background: var(--accent); padding: 0 .15em; border-radius: 8px; }
.show-pair { flex: 1; min-height: 0; display: flex; gap: clamp(8px, 2.5vw, 28px); justify-content: center; align-items: center; padding: 0 12px; }
.show-pair .card { height: min(100%, 560px); width: auto; aspect-ratio: 272 / 288; max-width: 46vw; }
.show-pair .card .face-svg { width: 100%; height: 100%; }
.show-pair .card.mystery { max-width: 70vw; }
.show-line { display: flex; align-items: center; justify-content: center; gap: 14px; margin: 12px 16px 0; min-height: 60px; text-align: left; }
.show-score { flex: none; font-size: clamp(36px, 8vw, 64px); font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.show-score small { font-size: .38em; opacity: .65; }
.show-roast { font-size: clamp(16px, 3.8vw, 26px); font-weight: 800; line-height: 1.2; max-width: 24ch;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
#app.enter .show-title { animation: rise .4s both; }
#app.enter .show-pair > :first-child { animation: slideL .45s cubic-bezier(.2, .8, .2, 1) both; }
#app.enter .show-pair > :last-child:not(:first-child) { animation: flipIn .6s .15s cubic-bezier(.2, .8, .2, 1) both; }
#app.enter .show-line { animation: popIn .45s .45s cubic-bezier(.3, 1.6, .5, 1) both; }

.board-grid { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 280px) minmax(0, 560px); gap: 20px; justify-content: center; padding: 0 16px; }
.board-orig { align-self: start; }
.board-orig .face-svg { display: block; width: 100%; height: auto; }
.board-cap { text-align: center; font-weight: 800; padding: 6px 10px 10px; }
.board-cap small { display: block; font-weight: 600; color: var(--muted); font-size: 13px; }
.board-list { list-style: none; margin: 0; padding: 2px 4px 8px 0; min-height: 0; overflow-y: auto; display: grid; gap: 8px; align-content: start; }
.board-list li { display: grid; grid-template-columns: 34px 52px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 6px 12px 6px 8px;
  background: var(--card); border: 2.5px solid var(--ink); border-radius: 14px; }
.board-list li.you { background: #ffe1d6; }
.board-list li.empty { display: block; text-align: center; color: var(--muted); }
.lb-rank { font-weight: 800; font-size: 18px; text-align: center; }
.board-list li:first-child .lb-rank { background: var(--accent); border: 2px solid var(--ink); border-radius: 50%; width: 32px; height: 32px; line-height: 28px; }
.lb-face { width: 52px; border-radius: 10px; overflow: hidden; border: 2px solid var(--ink); background: var(--card); }
.lb-face svg { display: block; width: 100%; height: auto; }
.lb-name { min-width: 0; }
.lb-name b, .lb-name small { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lb-name b { font-size: 16px; }
.lb-name small { font-size: 13px; color: var(--muted); font-weight: 600; }
.lb-score { font-size: 24px; font-weight: 800; font-variant-numeric: tabular-nums; }
.board-standing { text-align: center; margin: 8px 0 0; }
.board-actions { display: flex; gap: 10px; justify-content: center; align-items: center; flex-wrap: wrap; padding: 12px 16px 0; }
#app.enter .board-list li { animation: rise .4s both; }
#app.enter .board-list li:nth-child(2) { animation-delay: .06s; } #app.enter .board-list li:nth-child(3) { animation-delay: .12s; }
#app.enter .board-list li:nth-child(4) { animation-delay: .18s; } #app.enter .board-list li:nth-child(n+5) { animation-delay: .24s; }

@media (max-width: 699px) {
  .show-pair .card { max-width: 45vw; height: auto; }
  .show-pair { align-items: center; }
  .board-grid { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); gap: 10px; }
  .board-orig { display: flex; align-items: center; gap: 12px; padding: 6px 12px 6px 6px; }
  .board-orig .tag { display: none; }
  .board-orig .face-svg { width: 64px; flex: none; border-radius: 10px; }
  .board-cap { text-align: left; padding: 0; }
  .board-cap::before { content: 'Original · '; color: var(--muted); font-weight: 700; }
  .board-actions .btn { min-height: 44px; font-size: 15px; padding: 8px 14px; }
}
/* Tall phone screens: stack the original above the guess so both faces are big */
@media (max-aspect-ratio: 4/5) {
  .show-pair { flex-direction: column; gap: 10px; padding: 0 16px; }
  .show-pair .card { height: calc(50% - 5px); width: auto; max-width: 100%; }
  .show-pair .card.mystery { height: min(60%, 360px); }
  #app.enter .show-pair > :first-child { animation-name: rise; }
}
.show-round { text-align: center; margin: 2px 16px 0; font-size: 13px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.board-grid.single { grid-template-columns: minmax(0, 560px); }
.final-board .board-list li { grid-template-columns: 40px minmax(0, 1fr) auto; padding: 10px 14px; }
.final-board .lb-score small { font-size: 13px; color: var(--muted); }
.winner { text-align: center; margin: 0 16px 14px; font-size: clamp(18px, 4.4vw, 26px); font-weight: 700; }
.winner b { background: var(--accent); padding: 0 .2em; border-radius: 6px; }
.trophy { display: inline-block; color: var(--accent); -webkit-text-stroke: 1.5px var(--ink); font-size: 1.2em; }
#app.enter .winner { animation: popIn .5s .3s cubic-bezier(.3, 1.6, .5, 1) both; }
