/* ==========================================================
   QuizClash — design tokens + components.
   Dark-first, one accent (electric cyan), Inter, rounded-2xl cards.
   A few Tailwind-style layout utilities live at the end (Utilities).
   ========================================================== */

:root,
[data-theme="dark"] {
  --bg:          #0a0b10;
  --bg-glow:     rgba(34, 211, 238, .07);
  --surface:     #12141c;
  --surface-2:   #191c27;
  --surface-3:   #222635;
  --line:        rgba(255, 255, 255, .07);
  --line-2:      rgba(255, 255, 255, .13);
  --text:        #eef0f6;
  --text-2:      #a7aec0;
  --text-3:      #6f7790;

  --accent:      #22d3ee;
  --accent-ink:  #03222b;
  --accent-soft: rgba(34, 211, 238, .13);
  --accent-ring: rgba(34, 211, 238, .45);

  --good:        #15803d;   /* white text 5.0:1 */
  --good-text:   #4ade80;
  --good-glow:   rgba(22, 163, 74, .5);
  --bad:         #dc2626;   /* white text 4.8:1 */
  --bad-text:    #f87171;
  --warn:        #f97316;

  --shadow-sm:   0 1px 2px rgba(0, 0, 0, .35);
  --shadow:      0 1px 0 rgba(255, 255, 255, .04) inset, 0 12px 32px -14px rgba(0, 0, 0, .7);
  --shadow-lg:   0 24px 60px -20px rgba(0, 0, 0, .8);

  color-scheme: dark;
}

[data-theme="light"] {
  --bg:          #f4f6fb;
  --bg-glow:     rgba(8, 145, 178, .08);
  --surface:     #ffffff;
  --surface-2:   #f1f4f9;
  --surface-3:   #e5e9f2;
  --line:        rgba(15, 23, 42, .08);
  --line-2:      rgba(15, 23, 42, .15);
  --text:        #0f172a;
  --text-2:      #475569;
  --text-3:      #8590a6;

  --accent:      #0e7490;
  --accent-ink:  #ffffff;
  --accent-soft: rgba(14, 116, 144, .1);
  --accent-ring: rgba(14, 116, 144, .4);

  --good-text:   #15803d;
  --good-glow:   rgba(22, 163, 74, .35);
  --bad-text:    #b91c1c;

  --shadow-sm:   0 1px 2px rgba(15, 23, 42, .06);
  --shadow:      0 1px 2px rgba(15, 23, 42, .04), 0 10px 30px -14px rgba(15, 23, 42, .18);
  --shadow-lg:   0 24px 60px -24px rgba(15, 23, 42, .3);

  color-scheme: light;
}

/* ---------- Base / reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background:
    radial-gradient(1200px 600px at 50% -200px, var(--bg-glow), transparent 70%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}
h1, h2, h3, p, ol, ul, dl, dd, figure { margin: 0; }
ol, ul { padding: 0; list-style: none; }
img, svg { display: block; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
code { font-family: "JetBrains Mono", ui-monospace, monospace; font-size: .88em; background: var(--surface-2); padding: .1em .35em; border-radius: 6px; }
kbd { font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 11px; padding: 1px 5px; border-radius: 5px; border: 1px solid var(--line-2); background: var(--surface-2); color: var(--text-2); }
svg { width: 1.15em; height: 1.15em; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.g-logo { stroke: none; }
[hidden] { display: none !important; }

:focus-visible { outline: 2.5px solid var(--accent); outline-offset: 3px; border-radius: 10px; }
::selection { background: var(--accent-soft); }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: 12px; top: -60px; z-index: 100; background: var(--accent); color: var(--accent-ink); padding: 8px 14px; border-radius: 10px; font-weight: 600; }
.skip-link:focus { top: 12px; }

/* ---------- Type ---------- */
.display { font-size: clamp(2.4rem, 7vw, 3.6rem); font-weight: 800; letter-spacing: -.035em; line-height: 1.05; }
.h1 { font-size: clamp(1.6rem, 4vw, 2.1rem); font-weight: 750; letter-spacing: -.025em; line-height: 1.15; }
.h2 { font-size: 1.25rem; font-weight: 700; letter-spacing: -.015em; }
.h3 { font-size: 1.05rem; font-weight: 650; letter-spacing: -.01em; }
.eyebrow { font-size: .78rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); margin-bottom: .4rem; }
.lede { color: var(--text-2); font-size: 1.08rem; }
.muted { color: var(--text-2); }
.fine { font-size: .82rem; color: var(--text-3); margin-top: .75rem; }
.accent { color: var(--accent); }
.mono { font-family: "JetBrains Mono", ui-monospace, monospace; font-variant-numeric: tabular-nums; }
.link { color: var(--accent); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.good { color: var(--good-text); }
.bad { color: var(--bad-text); }

/* ---------- Layout ---------- */
.appbar {
  position: sticky; top: 0; z-index: 40;
  padding-top: env(safe-area-inset-top);
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid var(--line);
}
.appbar-inner { max-width: 1080px; margin: 0 auto; height: 60px; padding: 0 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: -.02em; font-size: 1.1rem; }
.brand-mark { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; background: var(--accent); color: var(--accent-ink); box-shadow: 0 6px 18px -6px var(--accent-ring); }
.brand-mark svg { width: 18px; height: 18px; fill: currentColor; stroke: none; }
.appbar-actions { display: flex; align-items: center; gap: 8px; }
.appbar-avatar { display: block; border-radius: 999px; }
#appbar-user { display: flex; align-items: center; gap: 4px; }
@media (max-width: 400px) {
  .appbar-inner { padding: 0 12px; gap: 8px; }
  .appbar-actions { gap: 2px; }
  .appbar .icon-btn { width: 34px; height: 34px; }
  .brand { gap: 8px; font-size: 1rem; }
  .demo-badge { padding: 3px 6px; font-size: 10px; }
}
.demo-badge { display: none; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; padding: 4px 9px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); }
body[data-mode="demo"] .demo-badge { display: inline-block; }

.view { outline: none; padding-bottom: calc(48px + env(safe-area-inset-bottom)); }
/* fill-mode backwards: no transform remains afterwards, so position:fixed children (countdown, banners) stay viewport-fixed */
.view-enter { animation: viewIn .28s ease-out backwards; }
.page { max-width: 1080px; margin: 0 auto; padding: 28px 16px 0; }
.page-narrow { max-width: 680px; }
.page-head { margin-bottom: 24px; }
.center-screen { min-height: calc(100dvh - 120px); display: grid; place-items: center; padding: 24px 16px; }
.narrow { max-width: 440px; }
.splash { min-height: 70vh; display: grid; place-items: center; }
.back { display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); font-weight: 550; font-size: .92rem; margin-bottom: 18px; padding: 6px 2px; }
.back:hover { color: var(--text); }

/* ---------- Cards ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow); }
.card-pad { padding: 22px; }
.skeleton { background: linear-gradient(90deg, var(--surface) 0%, var(--surface-2) 50%, var(--surface) 100%); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; border-radius: 20px; min-height: 64px; }

/* ---------- Buttons / inputs ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 48px; padding: 0 20px; border-radius: 14px; font-weight: 650; font-size: .98rem;
  border: 1px solid transparent; white-space: nowrap;
  transition: transform .15s ease-out, background-color .2s ease-out, border-color .2s ease-out, box-shadow .2s ease-out, opacity .2s;
}
.btn:active:not(:disabled) { transform: scale(.97); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-sm { height: 38px; padding: 0 14px; font-size: .88rem; border-radius: 12px; }
.btn-lg { height: 54px; padding: 0 24px; border-radius: 16px; }
.btn-xl { height: 62px; padding: 0 26px; border-radius: 18px; font-size: 1.05rem; }
.btn-primary { background: var(--accent); color: var(--accent-ink); box-shadow: 0 10px 28px -12px var(--accent-ring); }
.btn-primary:hover:not(:disabled) { box-shadow: 0 14px 34px -10px var(--accent-ring); filter: brightness(1.05); }
.btn-secondary { background: var(--surface-2); border-color: var(--line-2); }
.btn-secondary:hover:not(:disabled) { border-color: var(--accent); }
.btn-ghost { color: var(--text-2); }
.btn-ghost:hover { color: var(--text); background: var(--surface-2); }
.btn-google { background: #fff; color: #1f2937; border-color: #dadce0; box-shadow: var(--shadow-sm); }
.btn-google:hover { box-shadow: 0 6px 20px -8px rgba(0, 0, 0, .35); }
.btn.is-loading { pointer-events: none; opacity: .7; }
.w-full { width: 100%; }

.icon-btn { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; color: var(--text-2); transition: background-color .2s, color .2s; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn-sm { width: 32px; height: 32px; border-radius: 10px; }
.q-meta-left { display: inline-flex; align-items: center; gap: 6px; }

.input {
  width: 100%; height: 48px; padding: 0 14px; border-radius: 14px;
  background: var(--surface-2); border: 1px solid var(--line-2); color: var(--text);
  transition: border-color .2s, box-shadow .2s;
}
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.input-sm { height: 38px; font-size: .82rem; border-radius: 12px; }
.input-code { font-family: "JetBrains Mono", monospace; letter-spacing: .3em; text-transform: uppercase; font-weight: 700; text-align: center; }
.field-label { display: block; font-size: .8rem; font-weight: 650; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); margin-bottom: 10px; }

/* ---------- Pills ---------- */
.pill { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 999px; font-size: .78rem; font-weight: 650; white-space: nowrap; }
.pill svg { width: 14px; height: 14px; }
.pill-lg { height: 34px; padding: 0 14px; font-size: .9rem; }
.pill-muted { background: var(--surface-2); color: var(--text-2); }
.pill-accent { background: var(--accent-soft); color: var(--accent); }
.pill-good, .pill-win { background: rgba(22, 163, 74, .15); color: var(--good-text); }
.pill-bad, .pill-loss { background: rgba(220, 38, 38, .15); color: var(--bad-text); }
.pill-draw { background: var(--surface-2); color: var(--text-2); }

/* ---------- Avatars ---------- */
.avatar { width: 36px; height: 36px; border-radius: 999px; object-fit: cover; flex: none; background: var(--surface-3); }
.avatar-initials { display: inline-grid; place-items: center; font-weight: 700; font-size: .8rem; color: #fff; background: hsl(var(--h) 55% 42%); letter-spacing: .02em; }
.avatar-xs { width: 22px; height: 22px; font-size: 9px; box-shadow: 0 0 0 2px var(--surface); }
.avatar-sm { width: 32px; height: 32px; font-size: .72rem; }
.avatar-md { width: 40px; height: 40px; }
.avatar-lg { width: 52px; height: 52px; font-size: 1rem; }
.avatar-xl { width: 72px; height: 72px; font-size: 1.4rem; }
.avatar-ghost { border: 2px dashed var(--line-2); background: transparent; animation: breathe 1.8s ease-in-out infinite; }
.avatar-wrap { position: relative; display: inline-block; flex: none; }
.dot { position: absolute; right: 0; bottom: 0; width: 13px; height: 13px; border-radius: 999px; border: 2.5px solid var(--surface); }
.dot-on { background: #22c55e; }
.dot-off { background: var(--text-3); }

/* ---------- Logo / login ---------- */
.logo-mark { width: 56px; height: 56px; border-radius: 18px; display: grid; place-items: center; background: var(--accent); color: var(--accent-ink); box-shadow: 0 16px 40px -12px var(--accent-ring); }
.logo-mark svg { width: 28px; height: 28px; fill: currentColor; stroke: none; }
.logo-lg { width: 72px; height: 72px; border-radius: 22px; margin: 0 auto 24px; }
.logo-lg svg { width: 36px; height: 36px; }
.logo-pulse { animation: breathe 1.4s ease-in-out infinite; }
.login { width: 100%; max-width: 400px; text-align: center; }
.login .lede { margin: 10px 0 18px; }
.login-points { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-bottom: 28px; }
.login-points span { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); color: var(--text-2); font-size: .85rem; font-weight: 550; }
.login-form { text-align: left; display: grid; gap: 12px; }
.login-form .field-label { margin-bottom: -4px; }

/* ---------- Home ---------- */
.topic-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); margin-bottom: 20px; }
.topic-card {
  display: flex; flex-direction: column; gap: 6px; padding: 22px; min-height: 210px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow);
  transition: transform .2s ease-out, border-color .2s ease-out, box-shadow .2s ease-out;
}
a.topic-card:hover { transform: translateY(-3px); border-color: var(--accent-ring); box-shadow: var(--shadow-lg); }
a.topic-card:active { transform: scale(.985); }
.topic-top { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 8px; }
.topic-emoji { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; font-size: 26px; background: var(--surface-2); border: 1px solid var(--line); }
.topic-emoji-lg { width: 64px; height: 64px; font-size: 34px; border-radius: 18px; flex: none; }
.topic-emoji { overflow: hidden; flex: none; }
.topic-emoji img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 40%; }
.topic-emoji-sm { width: 28px; height: 28px; font-size: 16px; border-radius: 8px; display: inline-grid; vertical-align: middle; }
.hs-topic { display: inline-flex; align-items: center; gap: 10px; }
.topic-go { width: 36px; height: 36px; border-radius: 999px; display: grid; place-items: center; background: var(--surface-2); color: var(--text-2); transition: background-color .2s, color .2s, transform .2s ease-out; }
a.topic-card:hover .topic-go { background: var(--accent); color: var(--accent-ink); transform: translateX(2px); }
.topic-desc { flex: 1; }
.mini-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }
.mini-stat { background: var(--surface-2); border-radius: 12px; padding: 8px 10px; }
.mini-label { display: block; font-size: .7rem; font-weight: 650; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); }
.mini-val { font-family: "JetBrains Mono", monospace; font-weight: 700; font-size: .95rem; font-variant-numeric: tabular-nums; }
.join-card { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; }
.join-form { display: flex; gap: 10px; flex: 1 1 260px; max-width: 360px; }
.join-form .input { flex: 1; min-width: 0; }

/* ---------- Setup ---------- */
.setup-hero { display: flex; gap: 16px; align-items: center; margin-bottom: 30px; }
.setup-block { margin-bottom: 26px; }
.seg { display: grid; gap: 10px; }
.seg-3 { grid-template-columns: repeat(3, 1fr); }
.seg-2 { grid-template-columns: repeat(2, 1fr); }
.seg-btn {
  display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 2px;
  min-height: 76px; padding: 14px 16px; border-radius: 18px; text-align: left;
  background: var(--surface); border: 1.5px solid var(--line-2);
  transition: transform .15s ease-out, border-color .2s, background-color .2s, box-shadow .2s;
}
.seg-btn:hover { border-color: var(--accent-ring); }
.seg-btn:active { transform: scale(.97); }
.seg-btn.is-on { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 3px var(--accent-soft); }
.seg-title { display: block; font-weight: 700; font-size: 1.02rem; }
.seg-sub { display: block; font-size: .8rem; color: var(--text-2); }
.seg-icon { flex-direction: row; align-items: center; justify-content: flex-start; gap: 12px; }
.seg-ic { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--surface-2); color: var(--text-2); flex: none; transition: background-color .2s, color .2s; }
.seg-ic svg { width: 22px; height: 22px; }
.seg-btn.is-on .seg-ic { background: var(--accent); color: var(--accent-ink); }
.setup-cta { margin-top: 8px; }
.or { display: flex; align-items: center; gap: 12px; color: var(--text-3); font-size: .82rem; margin: 18px 0 14px; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line-2); }
.setup-cta .join-form { max-width: none; }

/* ---------- Lobby ---------- */
.code-card { margin-bottom: 18px; }
.code-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.room-code { display: flex; gap: 6px; }
.room-code span { width: clamp(36px, 10vw, 48px); height: clamp(46px, 12vw, 58px); display: grid; place-items: center; font-size: clamp(1.3rem, 5vw, 1.7rem); font-weight: 700; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line-2); color: var(--accent); }
.link-row { display: flex; gap: 8px; }
.topic-card { margin-bottom: 18px; }
.topic-row { display: flex; gap: 8px; }
.topic-row .input { flex: 1; min-width: 0; }
.topic-row .topic-level { flex: 0 0 auto; width: 9.5rem; }
.link-row .input { flex: 1; min-width: 0; color: var(--text-2); }
.players { display: grid; gap: 10px; margin-bottom: 22px; position: relative; }
.player-slot { display: flex; align-items: center; gap: 14px; padding: 16px; border-radius: 18px; background: var(--surface); border: 1.5px solid var(--line); transition: border-color .25s, background-color .25s; }
.player-slot.is-ready { border-color: rgba(34, 197, 94, .45); }
.player-slot.is-empty { border-style: dashed; border-color: var(--line-2); background: transparent; }
.player-slot .min-w-0 { flex: 1; }
.slot-name { font-weight: 650; }
.vs-badge { justify-self: center; font-size: .75rem; font-weight: 800; letter-spacing: .1em; color: var(--text-3); padding: 4px 10px; border-radius: 999px; background: var(--surface-2); }
.players.is-group { gap: 8px; }
.players.is-group .player-slot { padding: 12px 14px; }
.lobby-count { font-size: .5em; font-weight: 600; color: var(--text-3); vertical-align: middle; margin-left: 6px; }
.slot-kick { flex: none; color: var(--text-3); }

/* ---------- Game ---------- */
body[data-route="play"] .appbar { display: none; }
.game { min-height: 100dvh; display: flex; flex-direction: column; }
.game-bar {
  position: sticky; top: 0; z-index: 30;
  padding-top: env(safe-area-inset-top);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid var(--line);
}
.game-bar-inner { max-width: 880px; margin: 0 auto; padding: 10px 16px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; }
.gb-player { display: flex; align-items: center; gap: 10px; min-width: 0; }
.gb-right { justify-content: flex-end; }
.gb-name { font-size: .78rem; font-weight: 600; color: var(--text-2); max-width: 22vw; }
.gb-score-wrap { position: relative; display: flex; align-items: center; gap: 6px; }
.gb-right .gb-score-wrap { justify-content: flex-end; }
.gb-score { font-family: "JetBrains Mono", monospace; font-variant-numeric: tabular-nums; font-weight: 700; font-size: 1.25rem; line-height: 1.2; display: inline-block; }
.gb-score.bump { animation: bump .45s ease-out; }
.gb-best { color: var(--text-2); }
.gb-trophy { width: 40px; height: 40px; border-radius: 999px; display: grid; place-items: center; background: var(--surface-2); color: var(--accent); }
.gb-float { position: absolute; top: 60%; font-size: .78rem; font-weight: 800; color: var(--good-text); opacity: 0; pointer-events: none; white-space: nowrap; }
.gb-player:not(.gb-right) .gb-float { left: 0; }
.gb-right .gb-float { right: 0; }
.gb-float.go { animation: floatUp 1.2s ease-out both; }
.gb-center { text-align: center; min-width: 0; }
.gb-count { font-weight: 700; font-size: 1rem; }
.gb-label { font-size: .72rem; color: var(--text-3); font-weight: 550; max-width: 34vw; }
.answered-chip { position: absolute; right: -4px; bottom: -4px; width: 20px; height: 20px; border-radius: 999px; display: grid; place-items: center; background: var(--accent); color: var(--accent-ink); border: 2px solid var(--bg); animation: popIn .25s ease-out; }
.answered-chip svg { width: 12px; height: 12px; stroke-width: 3; }

/* Group games: the other players in a strip under the bar. Column chips so 7 fit at 375 px. */
.gb-strip { max-width: 880px; margin: 0 auto; padding: 0 12px 8px; display: flex; justify-content: center; gap: 3px; overflow-x: auto; scrollbar-width: none; }
.gb-strip::-webkit-scrollbar { display: none; }
.gb-mini { flex: none; width: 44px; display: flex; flex-direction: column; align-items: center; gap: 2px; padding-top: 4px; transition: opacity .25s; }
.gb-mini.is-off { opacity: .4; }
.gb-mini .answered-chip { width: 16px; height: 16px; right: -5px; bottom: -3px; }
.gb-mini .answered-chip svg { width: 10px; height: 10px; }
.gb-mini-text { display: flex; flex-direction: column; align-items: center; min-width: 0; max-width: 100%; }
.gb-mini-name { display: none; font-size: .68rem; font-weight: 600; color: var(--text-2); max-width: 100%; }
.gb-mini-score { font-size: .74rem; font-weight: 700; font-variant-numeric: tabular-nums; display: inline-block; }
.gb-mini-score.bump { animation: bump .45s ease-out; }
.gb-mini .gb-score-wrap { justify-content: center; }
.gb-mini .gb-float { top: auto; bottom: 100%; left: 50%; margin-left: -1.2em; font-size: .7rem; }
@media (min-width: 640px) {
  .gb-strip { gap: 10px; }
  .gb-mini { width: 72px; }
  .gb-mini-name { display: block; }
}

.timer { height: 5px; background: var(--surface-2); overflow: hidden; }
.timer-fill { height: 100%; width: 100%; background: var(--accent); transform-origin: left center; will-change: transform; }
.timer.is-urgent .timer-fill { background: var(--bad); }

.game-body { width: 100%; max-width: 880px; margin: 0 auto; padding: 26px 16px calc(28px + env(safe-area-inset-bottom)); flex: 1; display: flex; flex-direction: column; }
.q-meta { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; min-height: 26px; }
.q-meta .pill { transition: background-color .3s, color .3s; }
.q-status { font-size: .9rem; font-weight: 600; color: var(--text-2); text-align: right; }
.q-text { font-size: clamp(1.25rem, 3.6vw, 1.75rem); font-weight: 700; letter-spacing: -.02em; line-height: 1.3; margin-bottom: 26px; text-wrap: balance; }
.q-alt { margin: -14px 0 24px; color: var(--text-2); font-size: clamp(.98rem, 2.6vw, 1.1rem); font-weight: 500; line-height: 1.4; }
.q-enter { animation: qIn .3s ease-out both; }

.options { display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (min-width: 640px) { .options { grid-template-columns: 1fr 1fr; gap: 14px; } }

.opt {
  position: relative; display: flex; align-items: center; gap: 14px;
  width: 100%; min-height: 64px; padding: 14px 16px; border-radius: 18px; text-align: left;
  background: var(--surface); border: 1.5px solid var(--line-2); color: var(--text);
  font-size: 1rem; font-weight: 550; line-height: 1.35;
  box-shadow: var(--shadow-sm);
  animation: optIn .3s ease-out both; animation-delay: var(--d, 0ms);
  transition: transform .15s ease-out, background-color .22s ease-out, border-color .22s ease-out, box-shadow .25s ease-out, opacity .25s ease-out, color .2s;
}
@media (min-width: 640px) { .opt { min-height: 76px; } }
.opt:hover:not([aria-disabled="true"]) { border-color: var(--accent-ring); background: var(--surface-2); }
.opt:active:not([aria-disabled="true"]), .opt.is-pressed:not([aria-disabled="true"]) { transform: scale(.97); }
.options.is-locked .opt { cursor: default; }
.opt-letter { flex: none; width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-2); color: var(--text-2); font-weight: 750; font-size: .88rem; transition: background-color .2s, color .2s; }
.opt-text { flex: 1; min-width: 0; }
.opt-chips { display: flex; align-items: center; gap: 4px; }
.opt-chips:empty { display: none; }
.opt-mark { flex: none; width: 26px; height: 26px; border-radius: 999px; display: grid; place-items: center; }
.opt-mark:empty { display: none; }
.opt-mark svg { width: 16px; height: 16px; stroke-width: 3; }

/* selected (locked in, before reveal) — neutral, not right/wrong */
.opt.is-selected { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 3px var(--accent-soft); }
.opt.is-selected .opt-letter { background: var(--accent); color: var(--accent-ink); }
.opt.is-selected .opt-mark { background: var(--accent); color: var(--accent-ink); animation: checkPulse .45s ease-out; }
.options.is-locked .opt:not(.is-selected):not(.is-correct):not(.is-wrong) { opacity: .62; }

/* reveal */
.opt.is-correct { background: var(--good); border-color: var(--good); color: #fff; opacity: 1; animation: popGood .38s ease-out both; box-shadow: 0 0 0 4px var(--good-glow), 0 16px 36px -12px var(--good-glow); }
.opt.is-correct .opt-letter, .opt.is-wrong .opt-letter { background: rgba(255, 255, 255, .2); color: #fff; }
.opt.is-correct .opt-mark, .opt.is-wrong .opt-mark { background: #fff; }
.opt.is-correct .opt-mark { color: var(--good); }
.opt.is-wrong { background: var(--bad); border-color: var(--bad); color: #fff; opacity: 1; animation: shake .4s ease-out both; }
.opt.is-wrong .opt-mark { color: var(--bad); }
.opt.is-dim { opacity: .4 !important; }

.pick-chip { position: relative; display: inline-flex; }
.opt-chips.is-crowd { gap: 0; }
.opt-chips.is-crowd .pick-chip + .pick-chip { margin-left: -9px; }
.float-pts { position: absolute; right: 0; bottom: 100%; font-size: .8rem; font-weight: 800; color: #fff; text-shadow: 0 1px 6px rgba(0, 0, 0, .4); white-space: nowrap; animation: floatUp 1.3s ease-out both; pointer-events: none; }

.kbd-hint { margin-top: auto; padding-top: 28px; text-align: center; font-size: .78rem; color: var(--text-3); }
@media (hover: none) { .kbd-hint { display: none; } }

.countdown { position: fixed; inset: 0; z-index: 50; display: grid; place-content: center; text-align: center; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.countdown-num { font-size: clamp(6rem, 24vw, 10rem); font-weight: 800; line-height: 1; color: var(--accent); font-variant-numeric: tabular-nums; }
.countdown-num.pop { animation: countPop .5s ease-out both; }
.countdown-sub { margin-top: 12px; font-weight: 600; color: var(--text-2); letter-spacing: .1em; text-transform: uppercase; font-size: .85rem; }

.away-banner { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 45; display: flex; align-items: center; gap: 10px; padding: 12px 18px; border-radius: 999px; background: var(--surface-3); border: 1px solid var(--line-2); box-shadow: var(--shadow-lg); font-weight: 600; font-size: .9rem; white-space: nowrap; max-width: calc(100vw - 32px); overflow: hidden; text-overflow: ellipsis; animation: slideUp .25s ease-out; }

/* ---------- About ---------- */
.about-hero { display: flex; align-items: center; gap: 16px; margin-bottom: 28px; }
.about-hero .logo-mark { flex: none; }
.about-sec { margin-bottom: 26px; }
.about-sec .h3 { margin-bottom: 10px; }
.about-steps { list-style: decimal; padding-left: 1.3em; display: grid; gap: 8px; color: var(--text-2); }
.about-steps strong, .about-list strong { color: var(--text); }
.about-list { list-style: disc; padding-left: 1.3em; display: grid; gap: 8px; color: var(--text-2); }
.about-formula { margin: 12px 0; padding: 12px 14px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); color: var(--accent); font-size: .9rem; overflow-x: auto; }
.about-table { width: 100%; border-collapse: collapse; margin-bottom: 8px; font-size: .92rem; }
.about-table th, .about-table td { text-align: left; padding: 8px 4px; border-bottom: 1px solid var(--line); }
.about-table th { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); font-weight: 650; }
.about-table td:last-child, .about-table th:last-child { text-align: right; }

/* ---------- Leaderboard ---------- */
.lb-link { display: inline-flex; align-items: center; gap: 6px; margin-top: 6px; }
.seg-tab { min-height: 48px; align-items: center; font-weight: 700; }
.lb-list { display: grid; gap: 8px; }
.lb-row { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); }
.lb-row.is-me { border-color: var(--accent); background: var(--accent-soft); }
.lb-rank { width: 28px; text-align: center; font-size: 1.2rem; font-weight: 700; color: var(--text-2); flex: none; }
.lb-rank .mono { font-size: .95rem; }
.lb-name { flex: 1; min-width: 0; font-weight: 600; }
.lb-score { font-weight: 700; font-size: 1.05rem; }
a.hs-topic:hover { color: var(--accent); }

/* ---------- Quiz guide ---------- */
.guide { margin-bottom: 18px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface-2); padding: 0 16px; }
.guide summary { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; padding: 14px 0; list-style: none; }
.guide summary::-webkit-details-marker { display: none; }
.guide summary::before { content: "▸"; color: var(--accent); transition: transform .2s; }
.guide[open] summary::before { transform: rotate(90deg); }
.guide-steps { list-style: decimal; padding-left: 1.3em; display: grid; gap: 6px; color: var(--text-2); font-size: .92rem; }
.guide-steps strong, .guide-tips strong { color: var(--text); }
.guide-example { margin: 14px 0; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); overflow: hidden; }
.guide-example-head { display: flex; align-items: center; justify-content: space-between; padding: 6px 6px 0 12px; }
.guide-example-head .field-label { margin: 0; }
.guide-example pre { margin: 0; padding: 8px 14px 14px; font-size: .8rem; line-height: 1.55; white-space: pre-wrap; color: var(--text-2); overflow-x: auto; }
.guide-tips { display: grid; gap: 6px; padding-bottom: 16px; font-size: .88rem; color: var(--text-2); }

/* ---------- Contribute ---------- */
.contrib-card { margin-top: 12px; }
.file-drop-sm { padding: 12px 14px; }
.sub-list { display: grid; gap: 8px; }
.sub-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 16px; background: var(--surface-2); }
.sub-row > .min-w-0 { flex: 1 1 auto; min-width: 0; }
.sub-side { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex: none; }
.sub-side .btn-sm { height: 30px; padding: 0 10px; }
.sub-note { margin-top: 4px; color: var(--text-2); font-style: italic; }
.review-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.review-actions .input { flex: 1 1 220px; }

/* ---------- Admin ---------- */
.admin-btn { position: relative; }
.badge { position: absolute; top: 2px; right: 0; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--bad); color: #fff; font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; border: 2px solid var(--bg); }
.review-list { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.review-card .ai-q-head { gap: 10px; flex-wrap: wrap; }
.review-who { display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); }
.review-card-actions .input { flex: 1 1 200px; }
.review-icons { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 6px 0; }
.admin-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 8px 16px; }
.admin-tabs { display: flex; gap: 6px; padding: 4px; margin-bottom: 16px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.admin-tabs::-webkit-scrollbar { display: none; }
.admin-tab { flex: 1 1 0; min-width: 0; height: 40px; padding: 0 8px; border-radius: 12px; font-weight: 650; font-size: .9rem; color: var(--text-2); white-space: nowrap; transition: background-color .2s, color .2s; }
.admin-tab:hover { color: var(--text); }
.admin-tab.is-on { background: var(--accent); color: var(--accent-ink); }
.tab-short { display: none; }
@media (max-width: 480px) { .tab-long { display: none; } .tab-short { display: inline; } }
.admin-home-link { display: inline-flex; align-items: center; gap: 6px; margin-top: 8px; }
.admin-sub { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
.file-drop { display: flex; align-items: center; gap: 14px; padding: 18px; margin-bottom: 8px; border: 1.5px dashed var(--line-2); border-radius: 16px; cursor: pointer; transition: border-color .2s, background-color .2s; }
.file-drop:hover, .file-drop:focus-within { border-color: var(--accent); background: var(--accent-soft); }
.file-drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.file-drop-ic { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--surface-2); color: var(--accent); flex: none; }
select.input { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--text-2) 50%), linear-gradient(135deg, var(--text-2) 50%, transparent 50%); background-position: calc(100% - 20px) 50%, calc(100% - 15px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 36px; }
.textarea { height: auto; min-height: 220px; padding: 12px 14px; line-height: 1.5; resize: vertical; font-size: .92rem; }
.admin-new-topic { display: grid; grid-template-columns: 1fr 72px; gap: 10px; }
.admin-new-topic .admin-wide { grid-column: 1 / -1; }
.input-emoji { text-align: center; font-size: 1.3rem; }
.admin-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.admin-list { display: grid; gap: 8px; }
.admin-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; border-radius: 14px; background: var(--surface-2); }
.admin-row > span { display: inline-flex; align-items: center; gap: 10px; min-width: 0; }
.admin-topic-row { flex-wrap: wrap; }
.admin-row-actions { display: inline-flex; flex-wrap: wrap; gap: 6px; margin-left: auto; }
.ai-summary { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.ai-levels { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.ai-warn { margin-top: 12px; padding: 10px 12px; border-radius: 12px; background: rgba(249, 115, 22, .12); color: var(--text); font-size: .88rem; }
.ai-list { display: grid; gap: 10px; }
.ai-q { padding: 16px 18px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); }
.ai-q-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.ai-q-text { font-weight: 600; }
.ai-opts { display: grid; gap: 4px; margin: 10px 0 0; font-size: .9rem; color: var(--text-2); }
.ai-opts li { display: flex; align-items: center; gap: 8px; }
.ai-opts li.is-answer { color: var(--good-text); font-weight: 600; }
.ai-q .bd-exp { margin-left: 0; }
.ai-skip { display: grid; gap: 10px; margin-top: 12px; font-size: .9rem; }
details summary { cursor: pointer; }
.mt-4 { margin-top: 16px; }
.edit-filters { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.edit-filters .admin-wide { grid-column: 1 / -1; }
.edit-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; }
.edit-form { border-color: var(--accent); }
.edit-level { width: auto; min-width: 120px; }
.textarea-sm { min-height: 76px; }
.edit-opts { display: grid; gap: 8px; }
.edit-opt { display: flex; align-items: center; gap: 10px; }
.edit-opt input[type="radio"] { width: 20px; height: 20px; accent-color: var(--good); flex: none; }
.edit-opt .input { flex: 1; min-width: 0; }
.edit-opt:has(input[type="radio"]:checked) .opt-letter { background: var(--good); color: #fff; }
.btn-danger { background: var(--bad); color: #fff; }
.flex-1 { flex: 1; }

/* ---------- Results ---------- */
.result-hero { text-align: center; padding: 18px 0 8px; margin-bottom: 18px; }
.big-score { font-size: clamp(3.6rem, 14vw, 5.5rem); font-weight: 700; letter-spacing: -.04em; line-height: 1.05; margin: 6px 0 14px; color: var(--accent); }
.result-title { margin: 4px 0 10px; }
.result-win { color: var(--good-text); }
.result-loss { color: var(--bad-text); }
.final-players { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; margin-top: 22px; }
.final-player { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 18px 10px; border-radius: 20px; background: var(--surface); border: 1.5px solid var(--line); min-width: 0; }
.final-player .slot-name { max-width: 100%; }
.final-player.is-winner { border-color: rgba(34, 197, 94, .55); box-shadow: 0 0 0 4px rgba(34, 197, 94, .12); }
.final-score { font-size: 1.6rem; font-weight: 700; }
.standings { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; margin: 22px auto 0; max-width: 460px; text-align: left; }
.standing { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 16px; background: var(--surface); border: 1.5px solid var(--line); min-width: 0; }
.standing .slot-name { flex: 1; min-width: 0; }
.standing .final-score { font-size: 1.15rem; }
.standing.is-me { border-color: var(--accent); }
.standing.is-winner { border-color: rgba(34, 197, 94, .55); box-shadow: 0 0 0 4px rgba(34, 197, 94, .12); }
.standing-rank { flex: none; width: 28px; text-align: center; font-size: 1.15rem; color: var(--text-3); font-weight: 700; }
.avatar-group { display: inline-grid; place-items: center; font-weight: 700; color: var(--accent); background: var(--accent-soft); }
.result-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-bottom: 34px; }
.bd-list { display: grid; gap: 12px; }
.bd-item { padding: 16px 18px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); }
.bd-item.is-skipped { opacity: .6; }
.bd-head { display: flex; gap: 12px; align-items: flex-start; }
.bd-num { flex: none; width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; font-size: .78rem; font-weight: 700; background: var(--surface-2); color: var(--text-2); }
.bd-q { flex: 1; font-weight: 600; }
.bd-alt { display: block; margin-top: 2px; font-weight: 450; font-size: .88rem; color: var(--text-2); }
.bd-pts { font-weight: 700; }
.bd-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px 16px; margin: 12px 0 0 38px; font-size: .88rem; }
.bd-grid dt { font-size: .7rem; font-weight: 650; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); }
.bd-ans { display: inline-flex; align-items: flex-start; gap: 4px; }
.bd-ans svg { margin-top: 2px; stroke-width: 3; }
.bd-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 10px 0 0 38px; font-size: .82rem; }
.bd-credit { color: var(--text-2); }
.link-btn { color: var(--text-3); font-size: .82rem; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.link-btn:hover { color: var(--accent); }
.bd-fix { display: grid; gap: 8px; margin: 10px 0 0 38px; padding: 12px; border-radius: 14px; background: var(--surface-2); }
@media (max-width: 480px) { .bd-foot, .bd-fix { margin-left: 0; } }
.bd-exp { margin: 12px 0 0 38px; font-size: .86rem; color: var(--text-2); padding-left: 12px; border-left: 2px solid var(--accent-ring); }
@media (max-width: 480px) { .bd-grid, .bd-exp { margin-left: 0; } }

/* ---------- Profile ---------- */
.profile-head { display: flex; align-items: center; gap: 16px; margin-bottom: 30px; }
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
@media (max-width: 520px) { .stat-grid { grid-template-columns: repeat(2, 1fr); } }
.stat-tile { padding: 16px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); }
.stat-val { font-size: 1.6rem; font-weight: 700; }
.stat-label { font-size: .78rem; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: .06em; }
.stat-tile.good .stat-val { color: var(--good-text); }
.stat-tile.bad .stat-val { color: var(--bad-text); }
.stat-tile.accent .stat-val { color: var(--accent); }
.table-wrap { overflow-x: auto; }
.hs-table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.hs-table th, .hs-table td { padding: 14px 16px; text-align: right; border-bottom: 1px solid var(--line); white-space: nowrap; }
.hs-table th:first-child { text-align: left; }
.hs-table thead th { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); font-weight: 650; }
.hs-table tbody tr:last-child th, .hs-table tbody tr:last-child td { border-bottom: 0; }
.hs-table tbody th { font-weight: 600; }
.match-list { display: grid; gap: 8px; }
.match-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); }

/* Grid lists: let rows shrink below their content so long titles truncate instead of overflowing. */
.sub-list, .match-list, .lb-list, .ai-list, .bd-list, .admin-list { grid-template-columns: minmax(0, 1fr); }

/* ---------- Toasts / spinner ---------- */
.toasts { position: fixed; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 80; display: grid; gap: 8px; width: min(420px, calc(100vw - 32px)); pointer-events: none; }
.toast { padding: 12px 16px; border-radius: 14px; background: var(--surface-3); border: 1px solid var(--line-2); box-shadow: var(--shadow-lg); font-weight: 550; font-size: .9rem; animation: slideUp .22s ease-out; }
.toast-error { border-color: rgba(220, 38, 38, .5); }
.toast-out { opacity: 0; transform: translateY(6px); transition: opacity .3s, transform .3s; }
.spinner { width: 28px; height: 28px; border-radius: 999px; border: 3px solid var(--surface-3); border-top-color: var(--accent); animation: spin .8s linear infinite; }
.spinner-sm { width: 16px; height: 16px; border-width: 2px; flex: none; }

/* ---------- Keyframes ---------- */
@keyframes viewIn     { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes qIn        { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes optIn      { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes popGood    { 0% { transform: scale(1); } 45% { transform: scale(1.035); } 100% { transform: scale(1); } }
@keyframes shake      { 0%, 100% { transform: translateX(0); } 20% { transform: translateX(-6px); } 40% { transform: translateX(5px); } 60% { transform: translateX(-3px); } 80% { transform: translateX(2px); } }
@keyframes checkPulse { 0% { transform: scale(.4); opacity: 0; } 60% { transform: scale(1.15); opacity: 1; } 100% { transform: scale(1); } }
@keyframes floatUp    { 0% { opacity: 0; transform: translateY(6px); } 15% { opacity: 1; } 70% { opacity: 1; } 100% { opacity: 0; transform: translateY(-22px); } }
@keyframes bump       { 0% { transform: scale(1); } 35% { transform: scale(1.14); color: var(--good-text); } 100% { transform: scale(1); } }
@keyframes popIn      { from { transform: scale(.3); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes countPop   { 0% { transform: scale(1.5); opacity: 0; } 60% { opacity: 1; } 100% { transform: scale(1); opacity: 1; } }
@keyframes slideUp    { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }
.toast { animation-name: toastIn; }
@keyframes toastIn    { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes breathe    { 0%, 100% { opacity: 1; } 50% { opacity: .55; } }
@keyframes shimmer    { to { background-position: -200% 0; } }
@keyframes spin       { to { transform: rotate(360deg); } }

/* Reduced motion: drop decorative motion, keep the timer bar (it carries information). */
@media (prefers-reduced-motion: reduce) {
  *:not(.timer-fill), *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
  .gb-float, .float-pts { animation: none !important; opacity: 1; }
}

/* ---------- Install hint (Home): slim, dismissible, never blocks play ---------- */
button.link { background: none; border: 0; padding: 0; font: inherit; font-weight: 600; cursor: pointer; }
.install-hint {
  display: flex; align-items: center; gap: 12px; margin-top: 16px;
  padding: 10px 10px 10px 14px; border-radius: 14px;
  border: 1px dashed var(--line-2); background: var(--surface);
  animation: install-in .35s ease-out backwards .6s;
}
.install-ic { flex: none; width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.install-ic svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.install-text { flex: 1; min-width: 0; margin: 0; font-size: .88rem; line-height: 1.4; }
.install-how { flex: none; font-size: .8rem; color: var(--text-2); display: inline-flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.install-how svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.install-x { flex: none; color: var(--text-3); }
@keyframes install-in { from { opacity: 0; transform: translateY(6px); } }
@media (prefers-reduced-motion: reduce) { .install-hint { animation: none; } }
@media (max-width: 520px) {
  .install-hint { flex-wrap: wrap; }
  .install-text { flex: 1 1 calc(100% - 92px); }
  .install-x { order: 1; align-self: flex-start; }
  .install-hint > .btn, .install-how { order: 2; margin-left: 44px; }
  .install-how { flex-basis: calc(100% - 44px); }
}

/* ---------- Utilities ----------
   The few Tailwind-named helpers the templates use, with Tailwind's values.
   Kept last so they win over component rules, as the old Play CDN's did. */
.text-sm { font-size: .875rem; line-height: 1.25rem; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.min-w-0 { min-width: 0; }
.mx-auto { margin-left: auto; margin-right: auto; }
.mt-1 { margin-top: .25rem; }
.mb-1 { margin-bottom: .25rem; }
.mb-2 { margin-bottom: .5rem; }
.mb-3 { margin-bottom: .75rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-5 { margin-bottom: 1.25rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mb-8 { margin-bottom: 2rem; }
.h-16 { height: 4rem; }
.h-64 { height: 16rem; }
.rounded-2xl { border-radius: 1rem; }
