:root {
  --coral: #ff6b5e;
  --coral-deep: #c9364a;
  --coral-soft: #ffe9e6;
  --coral-faint: #fff5f3;
  --apricot: #ffb37a;
  --apricot-soft: #fff1e4;
  --ink: #2a1d21;
  --muted: #7d6a6f;
  --line: #F0E6E4;
  --bg: #FFFFFF;
  --radius: 18px;
  --font: "Plus Jakarta Sans", system-ui, -apple-system, sans-serif;
  --display: "Bricolage Grotesque", "Plus Jakarta Sans", system-ui, sans-serif;
  --tabloid: "Anton", Impact, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { background: var(--bg); color: var(--ink); font-family: var(--font); -webkit-font-smoothing: antialiased; }
body { min-height: 100dvh; }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; -webkit-tap-highlight-color: transparent; }

#app { max-width: 460px; margin: 0 auto; padding: max(20px, env(safe-area-inset-top)) 20px max(28px, env(safe-area-inset-bottom)); }
.screen { display: flex; flex-direction: column; gap: 14px; min-height: calc(100dvh - 48px); animation: rise .35s ease both; }
.screen.center { justify-content: center; align-items: center; text-align: center; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* Brand */
.brand { display: flex; align-items: center; gap: 10px; margin-bottom: 28px; }
.logo { width: 34px; height: 34px; color: var(--coral); display: inline-flex; }
.logo.sm { width: 22px; height: 22px; }
.wordmark { font-size: 24px; font-weight: 600; letter-spacing: -0.02em; }
.wordmark b, .mini-brand b { font-weight: 800; color: var(--coral); }
.mini-brand { display: inline-flex; align-items: center; gap: 6px; font-size: 16px; font-weight: 600; letter-spacing: -0.01em; }
.badge { font-size: 11px; font-weight: 800; letter-spacing: .08em; color: var(--coral-deep); background: var(--coral-soft); padding: 4px 8px; border-radius: 99px; }
.badge.sm { font-size: 9px; padding: 3px 6px; margin-left: 2px; }

/* Type */
.eyebrow { font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--coral-deep); }
h1, h2, .score, .fact-n, .count { font-family: var(--display); }
h1 { font-size: 40px; line-height: 1.05; letter-spacing: -0.035em; font-weight: 800; }
h2 { font-size: 26px; line-height: 1.15; letter-spacing: -0.025em; font-weight: 800; }
.lede { font-size: 16px; line-height: 1.5; color: var(--muted); }
.fine { font-size: 13px; color: var(--muted); text-align: center; }

/* Landing */
.landing .hero { display: flex; flex-direction: column; gap: 12px; padding: 28px 22px; border-radius: 26px;
  background: radial-gradient(120% 90% at 100% 0%, var(--coral-soft) 0%, var(--coral-faint) 45%, #fff 100%); }
.facts { list-style: none; display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 6px 0 auto; }
.facts li { border: 1px solid var(--line); border-radius: 16px; padding: 14px 10px; display: flex; flex-direction: column; gap: 2px; font-size: 13px; color: var(--muted); }
.fact-n { font-size: 24px; font-weight: 800; color: var(--ink); }

/* Buttons */
.btn { width: 100%; min-height: 56px; border-radius: 16px; font-weight: 700; font-size: 17px; transition: transform .12s ease, background .2s; }
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--coral); color: #fff; box-shadow: 0 10px 24px -12px rgba(232, 90, 77, .7); }
.btn.primary:active { background: var(--coral-deep); }
.btn.ghost { background: var(--coral-faint); color: var(--coral-deep); }

/* Lobby */
.lobby { justify-content: center; }
.lobby .mini-brand { position: absolute; top: max(20px, env(safe-area-inset-top)); }
.room-code { display: flex; justify-content: space-between; align-items: center; padding: 16px 18px; border: 1px dashed #F4C4BE; border-radius: 16px; margin: 8px 0; }
.room-code span { font-size: 13px; color: var(--muted); }
.room-code b { font-size: 22px; letter-spacing: .18em; font-weight: 800; }
.status { display: flex; align-items: center; gap: 8px; justify-content: center; font-size: 14px; color: var(--muted); margin-top: 10px; }

.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #D8CFCD; margin-right: 6px; flex: none; }
.dot.on { background: #2fb67c; }
.dot.pulse { background: var(--coral); animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: .35; transform: scale(.85); } 50% { opacity: 1; transform: scale(1.1); } }

.count { font-size: 120px; font-weight: 800; color: var(--coral); letter-spacing: -0.04em; line-height: 1; margin: 20px 0; }

/* Question */
.topbar { display: flex; justify-content: space-between; align-items: center; }
.counter { font-size: 14px; font-weight: 700; color: var(--muted); }
.progress { height: 6px; border-radius: 99px; background: var(--coral-soft); overflow: hidden; margin: 6px 0 12px; }
.progress span { display: block; height: 100%; background: var(--coral); border-radius: 99px; transition: width .4s ease; }
.q { font-size: 28px; margin-bottom: 6px; }
.options { display: flex; flex-direction: column; gap: 10px; }
.opt { text-align: left; padding: 16px 18px; border: 1.5px solid var(--line); border-radius: 16px; font-size: 16px; font-weight: 600; background: #fff; transition: border-color .15s, background .15s, transform .1s; }
.opt:active { transform: scale(.99); }
.options:not(.locked) .opt:hover { border-color: #F4C4BE; }
.opt.chosen { border-color: var(--coral); background: var(--coral-faint); color: var(--coral-deep); }
.options.locked .opt:not(.chosen) { opacity: .45; }
.players { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: auto; padding-top: 16px; }
.player { display: flex; align-items: center; gap: 10px; padding: 12px; border-radius: 14px; background: var(--coral-faint); font-size: 13px; color: var(--muted); }
.player span:last-child { display: inline-flex; align-items: center; }
.avatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 800; color: #fff; flex: none; }
.avatar.a { background: var(--coral); }
.avatar.b { background: #9A8C90; }
.waiting { display: flex; align-items: center; justify-content: center; font-size: 14px; color: var(--muted); }

.spinner { width: 64px; height: 64px; border-radius: 50%; border: 6px solid var(--coral-soft); border-top-color: var(--coral); animation: spin 0.9s linear infinite; margin-bottom: 12px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Results */
.results { gap: 16px; }
.score-ring { align-self: center; width: 220px; height: 220px; border-radius: 50%; display: grid; place-content: center; text-align: center; margin: 8px 0;
  background: radial-gradient(closest-side, #fff 78%, transparent 79% 100%), conic-gradient(var(--coral) 0 97.3%, var(--coral-soft) 97.3% 100%);
  animation: pop .6s cubic-bezier(.2, 1.4, .4, 1) both; }
@keyframes pop { from { transform: scale(.6); opacity: 0; } to { transform: none; opacity: 1; } }
.score { font-size: 50px; font-weight: 800; letter-spacing: -0.04em; }
.score-label { font-size: 12px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }

.tabloid { border: 2px solid var(--ink); border-radius: 6px; padding: 18px; background: #FFFDF8; display: flex; flex-direction: column; gap: 10px; }
.kicker { align-self: flex-start; background: var(--coral); color: #fff; font-size: 12px; font-weight: 800; letter-spacing: .12em; padding: 4px 10px; }
.headline { font-family: var(--tabloid); font-weight: 400; font-size: 38px; line-height: 1; letter-spacing: 0; text-transform: uppercase; }
.tabloid p { font-size: 15px; line-height: 1.55; }

.section { font-size: 13px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin-top: 8px; }
.callouts { display: flex; flex-direction: column; gap: 10px; }
.callout { padding: 14px 16px; border-left: 4px solid var(--coral); background: var(--coral-faint); border-radius: 0 14px 14px 0; display: flex; flex-direction: column; gap: 4px; }
.cq { font-size: 12px; color: var(--muted); font-weight: 600; }
.ca { font-size: 15px; font-weight: 800; color: var(--coral-deep); }
.cl { font-size: 15px; line-height: 1.45; }

.sbs { border: 1px solid var(--line); border-radius: 16px; overflow: hidden; font-size: 13px; }
.sbs-head, .sbs-row { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 10px; padding: 10px 14px; }
.sbs-head { background: var(--coral-faint); font-weight: 800; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.sbs-head span:first-child { display: none; }
.sbs-row { border-top: 1px solid var(--line); }
.sbs-q { grid-column: 1 / -1; font-size: 12px; color: var(--muted); }
.sbs-row span:not(.sbs-q) { font-weight: 700; }
.sbs-row.match { background: #F3FBF7; }
.sbs-row.match span:not(.sbs-q)::after { content: " \2713"; color: #2FB67C; }

.actions { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }

.toast { position: fixed; left: 50%; bottom: 32px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 99px; font-size: 14px; font-weight: 600; animation: rise .2s ease both; }

@media print {
  .actions, .toast { display: none !important; }
  .screen { min-height: 0; animation: none; }
  .sbs-row { break-inside: avoid; }
}

/* Profile form */
.profile { justify-content: center; }
.profile .mini-brand { position: absolute; top: max(20px, env(safe-area-inset-top)); }
.form { display: flex; flex-direction: column; gap: 14px; margin-top: 8px; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 700; color: var(--muted); }
.field input { width: 100%; min-height: 54px; padding: 0 16px; border: 1.5px solid var(--line); border-radius: 14px; font: inherit; font-size: 16px; font-weight: 600; color: var(--ink); background: #fff; -webkit-appearance: none; appearance: none; }
.field input:focus { outline: none; border-color: var(--coral); background: var(--coral-faint); }
.form-err { font-size: 13px; color: var(--coral-deep); font-weight: 600; }
.names { text-align: center; font-size: 30px; }
.names span { color: var(--coral); }
.signs { text-align: center; font-size: 14px; font-weight: 600; color: var(--muted); margin-top: -8px; }

/* Design assets */
.lockup { height: 30px; width: auto; display: block; }
.lockup.sm { height: 20px; }
.brand { gap: 12px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; }
.ico { display: inline-block; width: 20px; height: 20px; background: currentColor; -webkit-mask: var(--i) center / contain no-repeat; mask: var(--i) center / contain no-repeat; flex: none; }
.fine .ico { width: 14px; height: 14px; vertical-align: -2px; margin-right: 2px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; flex: none; display: block; }
.player { align-items: center; }
.pmeta { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.pmeta b { color: var(--ink); font-size: 13px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pmeta > span { display: inline-flex; align-items: center; font-size: 12px; }
.pair { display: flex; justify-content: center; margin-bottom: -6px; }
.pair img { width: 52px; height: 52px; border-radius: 50%; border: 3px solid #fff; }
.pair img + img { margin-left: -14px; }
.avatar.b, .player .avatar.b { background: none; }
