/* ============ Fonts (self-hosted so nothing gets blocked) ============ */
@font-face { font-family: 'Inter'; src: url(/fonts/inter-latin-400-normal.woff2) format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Inter'; src: url(/fonts/inter-latin-500-normal.woff2) format('woff2'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'Inter'; src: url(/fonts/inter-latin-600-normal.woff2) format('woff2'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'Inter'; src: url(/fonts/inter-latin-700-normal.woff2) format('woff2'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'Inter'; src: url(/fonts/inter-latin-800-normal.woff2) format('woff2'); font-weight: 800; font-display: swap; }
@font-face { font-family: 'Inter'; src: url(/fonts/inter-latin-900-normal.woff2) format('woff2'); font-weight: 900; font-display: swap; }
@font-face { font-family: 'Parkinsans'; src: url(/fonts/parkinsans-latin-400-normal.woff2) format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Parkinsans'; src: url(/fonts/parkinsans-latin-600-normal.woff2) format('woff2'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'Parkinsans'; src: url(/fonts/parkinsans-latin-700-normal.woff2) format('woff2'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'Plus Jakarta Sans'; src: url(/fonts/plus-jakarta-sans-latin-400-normal.woff2) format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Plus Jakarta Sans'; src: url(/fonts/plus-jakarta-sans-latin-500-normal.woff2) format('woff2'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'Plus Jakarta Sans'; src: url(/fonts/plus-jakarta-sans-latin-600-normal.woff2) format('woff2'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'Plus Jakarta Sans'; src: url(/fonts/plus-jakarta-sans-latin-700-normal.woff2) format('woff2'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'Plus Jakarta Sans'; src: url(/fonts/plus-jakarta-sans-latin-800-normal.woff2) format('woff2'); font-weight: 800; font-display: swap; }

/* ============ Themes ============ */
:root,
[data-theme='classic'] {
  --font-head: 'Inter', system-ui, -apple-system, 'Segoe UI', Helvetica, Arial, sans-serif;
  --font-body: 'Inter', system-ui, -apple-system, 'Segoe UI', Helvetica, Arial, sans-serif;
  --head-weight: 800;
  --head-track: -0.025em;
  --bg: #09090b;
  --elev: #141417;
  --elev-2: #1d1d21;
  --line: rgba(255, 255, 255, 0.1);
  --line-strong: rgba(255, 255, 255, 0.22);
  --ink: #f5f5f4;
  --ink-dim: #a1a1aa;
  --ink-faint: #6b6b73;
  --prompt-bg: #000;
  --prompt-ink: #fff;
  --prompt-edge: rgba(255, 255, 255, 0.16);
  --answer-bg: #fafaf9;
  --answer-ink: #0b0b0c;
  --accent: #ffffff;
  --accent-ink: #000;
  --accent-hover-bg: #e7e7e7;
  --accent-hover-ink: #000;
  --hot: #ffd54a;
  --hot-ink: #000;
  --ok: #4ade80;
  --warn: #fbbf24;
  --bad: #f87171;
  --r-btn: 14px;
  --r-card: 18px;
  --r-panel: 22px;
  --pip: #0b0b0c;
  --shadow-card: 0 1px 0 rgba(255, 255, 255, 0.06) inset, 0 24px 48px -18px rgba(0, 0, 0, 0.75), 0 2px 6px rgba(0, 0, 0, 0.4);
}
[data-theme='brand'] {
  --font-head: 'Parkinsans', Tahoma, sans-serif;
  --font-body: 'Plus Jakarta Sans', system-ui, sans-serif;
  --head-weight: 600;
  --head-track: -0.01em;
  --bg: #16003f;
  --elev: rgba(255, 255, 255, 0.07);
  --elev-2: rgba(255, 255, 255, 0.11);
  --line: rgba(242, 206, 214, 0.16);
  --line-strong: rgba(242, 206, 214, 0.34);
  --ink: #ffffff;
  --ink-dim: #f2ced6;
  --ink-faint: #c9a6c0;
  --prompt-bg: linear-gradient(160deg, #16003f 0%, #2d1a52 58%, #4e1235 130%);
  --prompt-ink: #ffffff;
  --prompt-edge: rgba(216, 56, 91, 0.55);
  --answer-bg: #ffffff;
  --answer-ink: #16003f;
  --accent: #d8385b;
  --accent-ink: #ffffff;
  --accent-hover-bg: #ffffff;
  --accent-hover-ink: #16003f;
  --hot: #f0486d;
  --hot-ink: #fff;
  --ok: #42cc80;
  --warn: #f2ced6;
  --bad: #f0486d;
  --r-btn: 999px;
  --r-card: 22px;
  --r-panel: 28px;
  --pip: #d8385b;
  --shadow-card: 0 30px 60px -22px rgba(10, 0, 30, 0.85), 0 2px 8px rgba(10, 0, 30, 0.35);
}

/* ============ Base ============ */
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  transition: background-color 0.6s ease, color 0.6s ease;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--ok); outline-offset: 3px; }
.hidden { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ============ Animated backgrounds (cross-faded per theme) ============ */
.bg { position: fixed; inset: 0; z-index: -2; pointer-events: none; overflow: hidden; }
.bg > div { position: absolute; inset: -20%; transition: opacity 1s ease; }
.bg .classic {
  background:
    radial-gradient(40% 35% at 25% 20%, rgba(255, 255, 255, 0.075), transparent 70%),
    radial-gradient(35% 30% at 80% 75%, rgba(255, 255, 255, 0.045), transparent 70%),
    #09090b;
  animation: drift 28s ease-in-out infinite alternate;
}
.bg .brand {
  opacity: 0;
  background:
    radial-gradient(38% 42% at 18% 22%, rgba(111, 25, 76, 0.95), transparent 70%),
    radial-gradient(34% 38% at 82% 28%, rgba(216, 56, 91, 0.55), transparent 70%),
    radial-gradient(45% 40% at 55% 95%, rgba(140, 71, 112, 0.7), transparent 70%),
    radial-gradient(30% 30% at 70% 60%, rgba(45, 26, 82, 0.9), transparent 70%),
    #16003f;
  animation: drift 22s ease-in-out infinite alternate;
}
[data-theme='brand'] .bg .brand { opacity: 1; }
[data-theme='brand'] .bg .classic { opacity: 0; }
.bg .grain {
  inset: 0;
  opacity: 0.07;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
@keyframes drift {
  0% { transform: translate3d(0, 0, 0) scale(1); }
  50% { transform: translate3d(3%, -2%, 0) scale(1.06); }
  100% { transform: translate3d(-2%, 3%, 0) scale(1.03); }
}

/* ============ Wordmark ============ */
.wordmark { font-family: var(--font-head); font-weight: var(--head-weight); letter-spacing: var(--head-track); line-height: 0.92; }
.wordmark .l1 { display: block; }
.wordmark .l2 { display: block; font-weight: 500; opacity: 0.75; letter-spacing: 0; margin-top: 0.25em; font-size: 0.42em; }
.wordmark .ip { color: var(--hot); font-weight: var(--head-weight); opacity: 1; }
[data-theme='classic'] .wordmark .ip { color: var(--ink); text-decoration: underline; text-decoration-thickness: 0.08em; text-underline-offset: 0.12em; }
.mark { display: inline-grid; width: 1.1em; height: 1.1em; position: relative; vertical-align: -0.15em; }
.mark i { position: absolute; width: 0.62em; height: 0.82em; border-radius: 0.12em; border: 0.08em solid currentColor; }
.mark i:nth-child(1) { left: 0; top: 0.12em; transform: rotate(-12deg); background: var(--prompt-ink); opacity: 0.35; }
.mark i:nth-child(2) { left: 0.38em; top: 0.06em; transform: rotate(10deg); background: var(--bg); }

/* ============ Top bar ============ */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 16px;
  padding: 12px clamp(14px, 2.4vw, 28px);
  backdrop-filter: blur(14px) saturate(1.2);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  background: color-mix(in srgb, var(--bg) 55%, transparent);
  border-bottom: 1px solid var(--line);
}
.topbar .brandline { display: flex; align-items: center; gap: 10px; font-family: var(--font-head); font-weight: var(--head-weight); letter-spacing: var(--head-track); font-size: 15px; white-space: nowrap; }
.topbar .spacer { flex: 1; }
.pill { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 999px; background: var(--elev); border: 1px solid var(--line); font-size: 13px; font-weight: 600; white-space: nowrap; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ink-faint); box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 0%, transparent); }
.dot.live { background: var(--ok); box-shadow: 0 0 10px var(--ok); }
.dot.backup { background: var(--warn); }
.dot.down { background: var(--bad); animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: 0.25; } }
.iconbtn { width: 36px; height: 36px; display: inline-grid; place-items: center; border-radius: 50%; border: 1px solid var(--line); background: var(--elev); transition: background 0.2s, transform 0.15s; }
.iconbtn:hover { background: var(--elev-2); transform: translateY(-1px); }
.iconbtn svg { width: 18px; height: 18px; }

/* ============ Buttons & inputs ============ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  font-family: var(--font-head); font-weight: 700; letter-spacing: -0.01em; font-size: 16px;
  padding: 14px 24px; min-height: 50px;
  border-radius: var(--r-btn); border: 1px solid transparent;
  background: var(--accent); color: var(--accent-ink);
  transition: transform 0.15s ease, background 0.25s ease, color 0.25s ease, box-shadow 0.25s ease, opacity 0.2s;
  box-shadow: 0 10px 30px -12px color-mix(in srgb, var(--accent) 70%, transparent);
}
.btn:hover:not(:disabled) { transform: translateY(-2px); background: var(--accent-hover-bg); color: var(--accent-hover-ink); }
.btn:active:not(:disabled) { transform: translateY(0) scale(0.98); }
.btn:disabled { opacity: 0.35; cursor: not-allowed; box-shadow: none; }
.btn.big { font-size: 20px; padding: 18px 34px; min-height: 64px; }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line-strong); box-shadow: none; }
.btn.ghost:hover:not(:disabled) { background: var(--elev-2); color: var(--ink); }
.btn.small { font-size: 13px; padding: 8px 14px; min-height: 36px; }
.btn.danger { background: transparent; color: var(--bad); border-color: color-mix(in srgb, var(--bad) 50%, transparent); box-shadow: none; }

.field { display: grid; gap: 8px; }
.field label { font-size: 13px; font-weight: 600; color: var(--ink-dim); letter-spacing: 0.02em; text-transform: uppercase; }
.input {
  width: 100%; padding: 16px 18px; font-size: 18px; font-weight: 600;
  border-radius: 14px; border: 1px solid var(--line-strong);
  background: color-mix(in srgb, var(--bg) 60%, transparent); color: var(--ink);
  outline: none; transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}
[data-theme='brand'] .input { border-radius: 16px; }
.input:focus { border-color: var(--ink); box-shadow: 0 0 0 4px color-mix(in srgb, var(--ink) 14%, transparent); }
.input.code { text-transform: uppercase; letter-spacing: 0.35em; font-family: var(--font-head); font-weight: var(--head-weight); text-align: center; font-size: 30px; }
.err { color: var(--bad); font-weight: 600; font-size: 14px; min-height: 1.2em; }

.seg { display: inline-flex; padding: 4px; border-radius: 999px; background: var(--elev); border: 1px solid var(--line); gap: 2px; }
.seg button { border: 0; background: transparent; padding: 8px 14px; border-radius: 999px; font-weight: 700; font-size: 14px; color: var(--ink-dim); transition: background 0.2s, color 0.2s; }
.seg button.on { background: var(--ink); color: var(--bg); }

/* ============ Cards ============ */
.card {
  position: relative;
  border-radius: var(--r-card);
  padding: 22px 22px 54px;
  font-family: var(--font-head);
  font-weight: 700;
  letter-spacing: -0.012em;
  line-height: 1.2;
  box-shadow: var(--shadow-card);
  overflow-wrap: anywhere;
  transition: transform 0.35s cubic-bezier(0.2, 0.9, 0.3, 1.2), box-shadow 0.3s ease, outline-color 0.2s, background 0.6s ease, color 0.6s ease;
}
.card.prompt { background: var(--prompt-bg); color: var(--prompt-ink); border: 1px solid var(--prompt-edge); }
.card.answer { background: var(--answer-bg); color: var(--answer-ink); }
[data-theme='brand'] .card.prompt::before {
  content: ''; position: absolute; left: 22px; right: 22px; top: 0; height: 4px; border-radius: 0 0 4px 4px;
  background: linear-gradient(90deg, #d8385b, #f0486d 60%, #8c4770);
}
[data-theme='brand'] .card.answer::after {
  content: ''; position: absolute; right: 18px; top: 18px; width: 10px; height: 10px; border-radius: 50%; background: var(--pip);
}
.card .foot {
  position: absolute; left: 22px; right: 22px; bottom: 16px;
  display: flex; align-items: center; gap: 8px;
  font-size: 11px; font-weight: 700; letter-spacing: 0.01em; opacity: 0.8; font-family: var(--font-head);
}
.card .foot .mark { font-size: 14px; }
.card .foot .tag { margin-left: auto; padding: 3px 8px; border-radius: 999px; border: 1px solid currentColor; font-size: 10px; letter-spacing: 0.06em; text-transform: uppercase; }
.blank { display: inline-block; min-width: 4.2em; height: 0.95em; border-bottom: 0.11em solid currentColor; vertical-align: baseline; margin: 0 0.08em; opacity: 0.9; }
.fill { color: var(--hot); }
[data-theme='classic'] .card.prompt .fill { color: var(--hot); }
.card.answer .num { display: inline-grid; place-items: center; width: 1.5em; height: 1.5em; font-size: 0.6em; border-radius: 50%; background: var(--answer-ink); color: var(--answer-bg); margin-right: 0.4em; vertical-align: 0.25em; }

/* Deal & flip animations */
.deal { animation: deal 0.6s cubic-bezier(0.2, 0.9, 0.25, 1.15) both; animation-delay: calc(var(--i, 0) * 70ms); }
@keyframes deal {
  from { opacity: 0; transform: translate3d(0, 60px, 0) rotate(var(--r, -6deg)) scale(0.9); }
  to { opacity: 1; transform: none; }
}
.flip { animation: flip 0.7s cubic-bezier(0.3, 0.7, 0.2, 1.1) both; animation-delay: calc(var(--i, 0) * 120ms); backface-visibility: hidden; }
@keyframes flip {
  0% { opacity: 0; transform: perspective(900px) rotateY(-95deg) translateY(20px); }
  60% { opacity: 1; }
  100% { opacity: 1; transform: perspective(900px) rotateY(0); }
}
.pop { animation: pop 0.5s cubic-bezier(0.2, 1.4, 0.4, 1) both; animation-delay: calc(var(--i, 0) * 60ms); }
@keyframes pop {
  0% { opacity: 0; transform: scale(0.5); }
  100% { opacity: 1; transform: scale(1); }
}
.rise { animation: rise 0.8s cubic-bezier(0.2, 0.9, 0.2, 1) both; animation-delay: calc(var(--i, 0) * 90ms); }
@keyframes rise {
  from { opacity: 0; transform: translateY(28px); filter: blur(6px); }
  to { opacity: 1; transform: none; filter: none; }
}
.winner-glow { animation: glow 2.2s ease-in-out infinite; }
@keyframes glow {
  0%, 100% { box-shadow: var(--shadow-card), 0 0 0 3px var(--hot), 0 0 40px -6px var(--hot); }
  50% { box-shadow: var(--shadow-card), 0 0 0 3px var(--hot), 0 0 80px 6px color-mix(in srgb, var(--hot) 60%, transparent); }
}

/* ============ Chips / players ============ */
.chips { display: flex; flex-wrap: wrap; gap: 10px; }
.chip {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 6px 14px 6px 6px; border-radius: 999px;
  background: var(--elev); border: 1px solid var(--line);
  font-weight: 700; font-size: 15px; transition: background 0.3s, border-color 0.3s, opacity 0.3s, transform 0.3s;
}
.chip .av { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 800; color: #fff; font-family: var(--font-head); }
.chip.off { opacity: 0.4; }
.chip.in { border-color: color-mix(in srgb, var(--ok) 70%, transparent); background: color-mix(in srgb, var(--ok) 14%, var(--elev)); }
.chip .st { margin-left: 2px; font-size: 13px; color: var(--ink-dim); display: inline-flex; }
.chip.in .st { color: var(--ok); }
.chip .score { margin-left: 4px; font-variant-numeric: tabular-nums; opacity: 0.8; }
.chip button.x { margin-left: 4px; border: 0; background: transparent; color: var(--ink-faint); font-size: 16px; padding: 0 2px; display: none; }
.host-ui .chip:hover button.x { display: inline; }
.thinking i { display: inline-block; width: 4px; height: 4px; margin: 0 1px; border-radius: 50%; background: currentColor; animation: think 1.2s infinite; }
.thinking i:nth-child(2) { animation-delay: 0.15s; }
.thinking i:nth-child(3) { animation-delay: 0.3s; }
@keyframes think { 0%, 60%, 100% { transform: translateY(0); opacity: 0.4; } 30% { transform: translateY(-4px); opacity: 1; } }

/* ============ Timer ring ============ */
.timer { position: relative; width: var(--size, 76px); height: var(--size, 76px); flex: none; }
.timer svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.timer circle { fill: none; stroke-width: 7; }
.timer .track { stroke: var(--line); }
.timer .bar { stroke: var(--ink); stroke-linecap: round; transition: stroke-dashoffset 0.25s linear, stroke 0.3s; }
.timer .num { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--font-head); font-weight: var(--head-weight); font-variant-numeric: tabular-nums; font-size: calc(var(--size, 76px) * 0.32); }
.timer.low .bar { stroke: var(--bad); }
.timer.low { animation: throb 1s ease-in-out infinite; }
@keyframes throb { 50% { transform: scale(1.06); } }

/* ============ Panels & layout ============ */
.panel { background: var(--elev); border: 1px solid var(--line); border-radius: var(--r-panel); padding: clamp(18px, 2.2vw, 30px); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.kicker { font-size: 12px; font-weight: 800; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-dim); }
.h1 { font-family: var(--font-head); font-weight: var(--head-weight); letter-spacing: var(--head-track); line-height: 1.02; margin: 0; }
.muted { color: var(--ink-dim); }
.row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.stack { display: grid; gap: 14px; }

/* ============ Toasts / overlays ============ */
.toasts { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); display: grid; gap: 8px; z-index: 80; pointer-events: none; width: min(560px, calc(100vw - 32px)); }
.toast { justify-self: center; padding: 12px 18px; border-radius: 14px; background: var(--ink); color: var(--bg); font-weight: 700; font-size: 15px; box-shadow: 0 20px 40px -12px rgba(0, 0, 0, 0.6); animation: toastIn 0.4s cubic-bezier(0.2, 1.2, 0.3, 1) both; }
.toast.bad { background: var(--bad); color: #fff; }
.toast.out { animation: toastOut 0.35s ease both; }
@keyframes toastIn { from { opacity: 0; transform: translateY(16px) scale(0.96); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateY(10px) scale(0.97); } }

.unlock {
  position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; text-align: center;
  pointer-events: none; animation: unlockFade 2.6s ease both;
}
.unlock .inner { display: grid; gap: 14px; transform-origin: center; animation: unlockZoom 2.6s cubic-bezier(0.2, 0.9, 0.2, 1) both; }
.unlock .k { font-family: 'Plus Jakarta Sans', sans-serif; font-weight: 800; letter-spacing: 0.4em; font-size: clamp(12px, 1.2vw, 16px); color: #42cc80; }
.unlock .t { font-family: 'Parkinsans', sans-serif; font-weight: 700; font-size: clamp(54px, 10vw, 180px); line-height: 0.9; color: #fff; letter-spacing: -0.02em; text-shadow: 0 10px 60px rgba(216, 56, 91, 0.6); }
.unlock .t b { color: #f0486d; font-weight: 700; }
.unlock .s { font-family: 'Plus Jakarta Sans', sans-serif; font-weight: 600; font-size: clamp(16px, 1.6vw, 24px); color: #f2ced6; }
.unlock.classic .t { font-family: 'Inter', sans-serif; font-weight: 900; text-shadow: none; }
.unlock.classic .t b { color: #fff; }
.unlock.classic .k { color: #a1a1aa; }
.unlock.classic .s { font-family: 'Inter', sans-serif; color: #a1a1aa; }
@keyframes unlockFade { 0% { opacity: 0; } 10% { opacity: 1; } 78% { opacity: 1; } 100% { opacity: 0; } }
@keyframes unlockZoom { 0% { transform: scale(0.85); filter: blur(10px); } 18% { transform: scale(1); filter: none; } 100% { transform: scale(1.06); } }

/* View-transition circle reveal for the theme switch */
::view-transition-old(root) { animation: none; }
::view-transition-new(root) { animation: reveal 1.1s cubic-bezier(0.7, 0, 0.25, 1) both; }
@keyframes reveal { from { clip-path: circle(0% at var(--vx, 50%) var(--vy, 50%)); } to { clip-path: circle(150% at var(--vx, 50%) var(--vy, 50%)); } }

.banner {
  position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; pointer-events: none;
  font-family: var(--font-head); font-weight: var(--head-weight); letter-spacing: var(--head-track);
  font-size: clamp(60px, 12vw, 220px); animation: bannerIn 1.5s cubic-bezier(0.2, 0.9, 0.2, 1) both;
}
.banner span { display: block; text-shadow: 0 20px 80px rgba(0, 0, 0, 0.5); }
.banner small { display: block; text-align: center; font-size: 0.16em; letter-spacing: 0.3em; text-transform: uppercase; color: var(--ink-dim); font-weight: 800; margin-bottom: 0.4em; }
@keyframes bannerIn {
  0% { opacity: 0; transform: translateX(-12%) skewX(8deg); filter: blur(12px); }
  25% { opacity: 1; transform: none; filter: none; }
  75% { opacity: 1; transform: none; }
  100% { opacity: 0; transform: translateX(10%) skewX(-6deg); filter: blur(10px); }
}

#confetti { position: fixed; inset: 0; z-index: 85; pointer-events: none; }

/* ============ Landing ============ */
.landing { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 0.9fr; align-items: center; gap: clamp(24px, 5vw, 80px); padding: clamp(24px, 5vw, 80px); max-width: 1400px; margin: 0 auto; }
.hero-cards { position: relative; height: min(66vh, 620px); }
.hero-cards .card { position: absolute; width: min(30vw, 360px); aspect-ratio: 5 / 7; font-size: clamp(22px, 2.4vw, 34px); }
.hero-cards .c1 { left: 6%; top: 8%; transform: rotate(-9deg); animation: float1 7s ease-in-out infinite; }
.hero-cards .c2 { left: 34%; top: 2%; transform: rotate(6deg); animation: float2 8s ease-in-out infinite; z-index: 1; }
.hero-cards .c3 { left: 20%; top: 26%; transform: rotate(-2deg); z-index: 2; animation: float3 6.5s ease-in-out infinite; }
@keyframes float1 { 50% { transform: rotate(-11deg) translateY(-14px); } }
@keyframes float2 { 50% { transform: rotate(8deg) translateY(12px); } }
@keyframes float3 { 50% { transform: rotate(-1deg) translateY(-8px); } }
.hero-cards .c3 .wordmark { font-size: clamp(36px, 4.2vw, 62px); }
.join-panel { display: grid; gap: 18px; max-width: 460px; width: 100%; }
.join-panel .or { display: flex; align-items: center; gap: 12px; color: var(--ink-faint); font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.14em; }
.join-panel .or::before, .join-panel .or::after { content: ''; flex: 1; height: 1px; background: var(--line); }
@media (max-width: 900px) {
  .landing { grid-template-columns: 1fr; }
  .hero-cards { height: 360px; }
  .hero-cards .card { width: 220px; font-size: 20px; }
  .hero-cards .c3 .wordmark { font-size: 32px; }
}

/* ============ Player screens ============ */
.play { max-width: 1180px; margin: 0 auto; padding: clamp(14px, 2.4vw, 30px) clamp(14px, 2.4vw, 30px) 130px; }
.play .prompt-wrap { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 18px; align-items: start; margin-bottom: 22px; }
.play .prompt-wrap .card.prompt { font-size: clamp(22px, 2.6vw, 34px); min-height: 180px; padding: 26px 28px 58px; }
.hand { display: grid; grid-template-columns: repeat(auto-fill, minmax(176px, 1fr)); gap: 16px; perspective: 1200px; }
.hand .card.answer { aspect-ratio: 5 / 6.4; font-size: clamp(17px, 1.5vw, 20px); cursor: pointer; user-select: none; transform-style: preserve-3d; }
.hand .card.answer:hover { transform: translateY(-8px) rotateX(var(--tx, 0deg)) rotateY(var(--ty, 0deg)); }
.hand .card.answer.sel { transform: translateY(-14px) scale(1.03); outline: 3px solid var(--hot); outline-offset: 4px; }
.hand .card.answer .badge { position: absolute; top: -12px; right: -12px; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--hot); color: var(--hot-ink); font-weight: 900; font-size: 16px; box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4); animation: pop 0.35s cubic-bezier(0.2, 1.4, 0.4, 1) both; }
.hand .card.answer.blankcard { background: repeating-linear-gradient(-45deg, var(--answer-bg), var(--answer-bg) 12px, color-mix(in srgb, var(--answer-ink) 5%, var(--answer-bg)) 12px, color-mix(in srgb, var(--answer-ink) 5%, var(--answer-bg)) 24px); }
.hand .card.answer textarea { width: 100%; height: 70%; resize: none; border: 2px dashed color-mix(in srgb, var(--answer-ink) 30%, transparent); border-radius: 10px; background: transparent; color: var(--answer-ink); font: inherit; padding: 8px; outline: none; }
.hand .card.answer textarea:focus { border-color: var(--answer-ink); }
.actionbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap;
  padding: 14px 18px calc(14px + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--bg) 70%, transparent); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--line);
}
.actionbar .hint { color: var(--ink-dim); font-weight: 600; }
.waiting { text-align: center; padding: 30px 10px; display: grid; gap: 18px; justify-items: center; }
.waiting .h1 { font-size: clamp(36px, 5vw, 64px); }
.waiting .quip { color: var(--ink-dim); font-weight: 600; min-height: 1.5em; transition: opacity 0.4s; }
.played { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; }
.played .card { width: 220px; aspect-ratio: 5 / 6; font-size: 19px; }
.votes { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.votes .card.answer { min-height: 200px; font-size: clamp(17px, 1.5vw, 21px); cursor: pointer; }
.votes .card.answer:hover:not(.mine) { transform: translateY(-6px); }
.votes .card.answer.voted { outline: 3px solid var(--hot); outline-offset: 4px; transform: translateY(-6px); }
.votes .card.answer.mine { opacity: 0.55; cursor: default; }
.votes .card .stamp { position: absolute; top: 14px; right: 14px; padding: 4px 10px; border-radius: 999px; font-size: 11px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; background: var(--answer-ink); color: var(--answer-bg); }
.votes .card.voted .stamp { background: var(--hot); color: var(--hot-ink); }
.sentence { font-size: 13px; font-weight: 600; opacity: 0.7; margin-top: 10px; font-family: var(--font-body); letter-spacing: 0; line-height: 1.35; }
.result-hero { display: grid; gap: 18px; justify-items: center; text-align: center; padding: 10px 0 26px; }
.result-hero .card.prompt { width: min(760px, 100%); font-size: clamp(22px, 2.8vw, 36px); text-align: left; }
.byline { display: inline-flex; align-items: center; gap: 10px; font-family: var(--font-head); font-weight: var(--head-weight); font-size: clamp(20px, 2.4vw, 30px); }
.trophy { font-size: 1.2em; }
.scoreboard { display: grid; gap: 8px; }
.sb-row { display: grid; grid-template-columns: 28px 1fr auto; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 14px; background: var(--elev); border: 1px solid var(--line); position: relative; overflow: hidden; transition: transform 0.6s cubic-bezier(0.2, 0.9, 0.2, 1); }
.sb-row .bar { position: absolute; inset: 0 auto 0 0; background: color-mix(in srgb, var(--hot) 22%, transparent); width: 0; transition: width 1.2s cubic-bezier(0.2, 0.9, 0.2, 1); z-index: 0; }
.sb-row > *:not(.bar) { position: relative; z-index: 1; }
.sb-row .rank { font-weight: 900; color: var(--ink-dim); font-variant-numeric: tabular-nums; }
.sb-row .nm { font-weight: 700; }
.sb-row .pts { font-family: var(--font-head); font-weight: var(--head-weight); font-size: 20px; font-variant-numeric: tabular-nums; }
.sb-row.me { border-color: var(--line-strong); }
.sb-row .plus { color: var(--ok); font-weight: 800; margin-left: 8px; font-size: 14px; animation: pop 0.5s both 0.6s; }

/* ============ Host screens (built for screen-sharing in Teams) ============ */
.host { min-height: 100vh; display: grid; grid-template-rows: auto 1fr; }
.host main { padding: clamp(16px, 2.2vw, 36px); display: grid; min-height: 0; }
.host .lobby { display: grid; grid-template-columns: 1.15fr 0.85fr; gap: clamp(20px, 3vw, 48px); align-items: start; }
.join-big { display: grid; gap: 18px; }
.join-big .url { font-family: var(--font-head); font-weight: var(--head-weight); letter-spacing: var(--head-track); font-size: clamp(28px, 3.4vw, 58px); line-height: 1.05; word-break: break-all; }
.code-tiles { display: flex; gap: clamp(8px, 1vw, 16px); }
.code-tiles .card { width: clamp(70px, 7.4vw, 140px); aspect-ratio: 5 / 7; padding: 0; display: grid; place-items: center; font-size: clamp(44px, 5vw, 96px); font-weight: 900; }
.steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-top: 8px; }
.steps .s { padding: 16px; border-radius: 16px; background: var(--elev); border: 1px solid var(--line); }
.steps .s b { display: block; font-family: var(--font-head); font-weight: var(--head-weight); font-size: 28px; line-height: 1; margin-bottom: 8px; color: var(--hot); }
.steps .s span { font-size: 14px; font-weight: 600; color: var(--ink-dim); }
.settings { display: grid; gap: 14px; }
.settings .row { justify-content: space-between; }
.host .round { display: grid; grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr); gap: clamp(20px, 3vw, 48px); align-items: center; }
.host .round .card.prompt { font-size: clamp(30px, 3.4vw, 64px); aspect-ratio: 5 / 6.2; max-height: 76vh; padding: clamp(26px, 2.6vw, 44px) clamp(26px, 2.6vw, 44px) 70px; display: flex; align-items: flex-start; }
.host .round .card.prompt .foot { font-size: 14px; bottom: 24px; left: 32px; right: 32px; }
.pickbadge { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 999px; background: var(--hot); color: var(--hot-ink); font-weight: 900; font-size: 15px; letter-spacing: 0.06em; text-transform: uppercase; }
.side { display: grid; gap: 22px; align-content: center; }
.side .count { font-family: var(--font-head); font-weight: var(--head-weight); font-size: clamp(56px, 7vw, 130px); line-height: 0.9; letter-spacing: var(--head-track); font-variant-numeric: tabular-nums; }
.side .count small { font-size: 0.32em; color: var(--ink-dim); font-weight: 700; letter-spacing: 0; }
.pile { position: relative; height: 140px; }
.pile .card { position: absolute; width: 100px; height: 136px; padding: 0; left: 0; transform: translateX(calc(var(--i) * 22px)) rotate(calc(var(--rot) * 1deg)); animation: drop 0.6s cubic-bezier(0.2, 1.2, 0.3, 1) both; display: grid; place-items: center; }
.pile .card .mark { font-size: 34px; color: var(--answer-ink); }
@keyframes drop { from { opacity: 0; transform: translateX(calc(var(--i) * 22px)) translateY(-120px) rotate(30deg); } }
.vote-grid { display: grid; gap: clamp(12px, 1.2vw, 20px); grid-template-columns: repeat(var(--cols, 4), minmax(0, 1fr)); }
.vote-grid .card.answer { font-size: clamp(16px, 1.45vw, 28px); min-height: clamp(140px, 17vh, 240px); padding-bottom: 48px; }
.vote-grid .card .hidebtn { position: absolute; top: 10px; right: 10px; display: none; }
.vote-grid .card:hover .hidebtn { display: inline-flex; }
.vote-grid .card.is-hidden { opacity: 0.25; filter: grayscale(1); }
.vote-grid .card .who { position: absolute; left: 22px; bottom: 16px; right: 22px; display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 800; font-family: var(--font-body); }
.vote-grid .card .who .vc { margin-left: auto; padding: 3px 10px; border-radius: 999px; background: var(--answer-ink); color: var(--answer-bg); font-size: 13px; }
.vote-grid .card.win { transform: translateY(-4px); }
.vote-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 24px; align-items: center; margin-bottom: clamp(14px, 2vh, 26px); }
.vote-head .card.prompt { font-size: clamp(24px, 2.4vw, 46px); padding: 24px 30px 24px; }
.vote-head .card.prompt .foot { display: none; }
.results { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(280px, 0.5fr); gap: clamp(20px, 3vw, 40px); align-items: start; }
.results .card.prompt.hero { font-size: clamp(30px, 3.6vw, 70px); padding: clamp(28px, 3vw, 52px) clamp(28px, 3vw, 52px) 80px; }
.results .card.prompt.hero .foot { font-size: 14px; bottom: 26px; left: 34px; right: 34px; }
.results .winner-line { display: flex; align-items: center; gap: 16px; margin: 22px 0 26px; font-family: var(--font-head); font-weight: var(--head-weight); font-size: clamp(28px, 3vw, 54px); letter-spacing: var(--head-track); }
.results .others { --cols: 3; }
.hostbar { position: fixed; right: 18px; bottom: 18px; z-index: 50; display: flex; gap: 8px; padding: 8px; border-radius: 999px; background: color-mix(in srgb, var(--bg) 70%, transparent); border: 1px solid var(--line); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); opacity: 0.35; transition: opacity 0.3s; }
.hostbar:hover, .hostbar:focus-within { opacity: 1; }
.final { display: grid; gap: clamp(20px, 3vh, 40px); justify-items: center; }
.podium { display: grid; grid-template-columns: repeat(3, minmax(160px, 260px)); align-items: end; gap: clamp(12px, 2vw, 30px); }
.podium .p { display: grid; gap: 12px; justify-items: center; text-align: center; }
.podium .p .nm { font-family: var(--font-head); font-weight: var(--head-weight); font-size: clamp(20px, 2.2vw, 36px); letter-spacing: var(--head-track); }
.podium .p .pts { color: var(--ink-dim); font-weight: 700; }
.podium .block { width: 100%; border-radius: 18px 18px 6px 6px; display: grid; place-items: center; font-family: var(--font-head); font-weight: 900; font-size: clamp(40px, 5vw, 90px); background: var(--prompt-bg); color: var(--prompt-ink); border: 1px solid var(--prompt-edge); transform-origin: bottom; animation: grow 1.1s cubic-bezier(0.2, 0.9, 0.2, 1.05) both; animation-delay: var(--d, 0s); }
.podium .first .block { height: 260px; background: var(--hot); color: var(--hot-ink); border: 0; }
.podium .second .block { height: 190px; }
.podium .third .block { height: 140px; }
@keyframes grow { from { transform: scaleY(0); } }
.awards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; width: min(1300px, 100%); }
.awards .card.answer { padding-bottom: 22px; }
.awards .card .t { font-size: 13px; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; opacity: 0.6; font-family: var(--font-body); }
.awards .card .n { font-size: 26px; margin: 6px 0; }
.awards .card .d { font-size: 14px; font-weight: 600; opacity: 0.7; font-family: var(--font-body); letter-spacing: 0; }

@media (max-width: 1100px) {
  .host .lobby, .host .round, .results { grid-template-columns: 1fr; }
  .steps { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .play .prompt-wrap { grid-template-columns: 1fr; }
  .hand { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .hand .card.answer { font-size: 15px; padding: 16px 16px 44px; }
  .podium { grid-template-columns: repeat(3, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

/* ============ Polish pass ============ */
.btn svg { width: 20px; height: 20px; flex: none; }
.pill svg { width: 14px; height: 14px; flex: none; }
.toasts { top: 76px; bottom: auto; }
.card .foot span:not(.tag) { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.votes .card.answer { padding-top: 46px; }
.votes .card.answer:has(.stamp)::after { display: none; }
.vote-grid.few .card.answer { font-size: clamp(22px, 2.1vw, 40px); min-height: clamp(200px, 30vh, 360px); }
.join-big .wordmark { font-size: clamp(44px, 5.4vw, 104px) !important; }
.code-tiles .card { width: clamp(62px, 6vw, 118px); font-size: clamp(40px, 4.2vw, 84px); }
.final .h1 { font-size: clamp(44px, 5.6vw, 110px) !important; }
.podium .first .block { height: 200px; }
.podium .second .block { height: 150px; }
.podium .third .block { height: 110px; }
.host .round .card.prompt > div:first-child { width: 100%; }
html { overflow-x: hidden; }
@media (max-width: 700px) {
  .topbar { gap: 8px; padding: 10px 12px; }
  .topbar .brandline span { display: none; }
  .topbar .pill { padding: 5px 9px; font-size: 12px; }
  .topbar .pill.opt { display: none; }
  .play { padding-bottom: 150px; }
  .actionbar { gap: 8px; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); }
  .actionbar .hint { width: 100%; text-align: center; font-size: 14px; }
  .actionbar .btn.small { font-size: 12px; }
  .result-hero .card.prompt { font-size: 22px; }
  .podium .first .block { height: 130px; }
  .podium .second .block { height: 95px; }
  .podium .third .block { height: 70px; }
}
.unlock .t.long { font-size: clamp(40px, 6.4vw, 120px); max-width: 92vw; }
.unlock { background: radial-gradient(60% 60% at 50% 50%, rgba(0, 0, 0, 0.82), rgba(0, 0, 0, 0.6)); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.unlock:not(.classic) { background: radial-gradient(60% 60% at 50% 50%, rgba(22, 0, 63, 0.9), rgba(22, 0, 63, 0.65)); }
.unlock.classic .t b { color: #ffd54a; }
.unlock .inner { padding: 0 4vw; }
