/* Quizmena: clean minimal dark. All colours come from the variables below, so themes switch instantly. */

html {
  --bg: #0E0E10;
  --card: #18181B;
  --raise: #202024;
  --border: #2A2A2F;
  --text: #F4F4F5;
  --muted: #8B8B93;
  --on-accent: #111111;
  --good: #2FBF71;
  --good-text: #4ADE80;
  --bad: #F05252;
  --bad-text: #F87171;
  --r: 12px;
  --col: 560px;
  --accent: #F5D90A; --accent-text: #F5D90A; --rival: #4F8CFF; --rival-text: #4F8CFF;
  color-scheme: dark;
}
html[data-accent="mint"]   { --accent: #3EE6B4; --accent-text: #3EE6B4; --rival: #FF7A59; --rival-text: #FF7A59; }
html[data-accent="violet"] { --accent: #9B7BFF; --accent-text: #9B7BFF; --rival: #FF9F43; --rival-text: #FF9F43; }
html[data-accent="pink"]   { --accent: #FF4D8D; --accent-text: #FF4D8D; --rival: #2EC4B6; --rival-text: #2EC4B6; }

/* Light mode: bright accents stay as fills behind dark text; text and links use a darker shade. */
html[data-mode="light"] {
  --bg: #F7F7F4; --card: #FFFFFF; --raise: #F1F1EE; --border: #E4E4E0; --text: #111113; --muted: #5F5F68;
  --good-text: #15803D; --bad-text: #C81E1E;
  --accent-text: #7A6400; --rival-text: #1D5BD6;
  color-scheme: light;
}
html[data-mode="light"][data-accent="mint"]   { --accent-text: #047857; --rival-text: #C2410C; }
html[data-mode="light"][data-accent="violet"] { --accent-text: #6941D8; --rival-text: #B45309; }
html[data-mode="light"][data-accent="pink"]   { --accent-text: #C0185A; --rival-text: #0F766E; }

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
a { color: var(--accent-text); }
button, input, textarea { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; line-height: 1.2; letter-spacing: -0.01em; }
h1 { font-size: 26px; }
h2 { font-size: 21px; }
h3 { font-size: 16px; }
p { margin: 0; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.center { text-align: center; }
.stack > * + * { margin-top: 12px; }
.gap-l { margin-top: 28px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---- layout ---- */
#app { max-width: var(--col); margin: 0 auto; padding: 0 16px calc(96px + env(safe-area-inset-bottom)); min-height: 100vh; }
#app.playing { padding-bottom: 32px; }

.top { display: flex; align-items: center; gap: 8px; height: 60px; }
.wordmark { font-size: 22px; font-weight: 800; letter-spacing: -0.03em; color: var(--text); text-decoration: none; margin-right: auto; }
.wordmark span { color: var(--accent-text); }
.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 10px;
  background: transparent; border: 1px solid var(--border); color: var(--text); cursor: pointer; padding: 0;
}
.icon-btn svg { width: 20px; height: 20px; }
.signin { height: 40px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--border); background: var(--card);
  color: var(--text); font-size: 14px; font-weight: 600; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; }

.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabs nav { max-width: var(--col); margin: 0 auto; display: grid; grid-template-columns: repeat(3, 1fr); }
.tabs a {
  display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px 0 8px;
  color: var(--muted); text-decoration: none; font-size: 12px; font-weight: 600;
}
.tabs a svg { width: 22px; height: 22px; }
.tabs a.on { color: var(--accent-text); }

.foot { margin-top: 40px; padding: 20px 0 8px; border-top: 1px solid var(--border); font-size: 13px; color: var(--muted);
  display: flex; flex-wrap: wrap; gap: 6px 14px; }
.foot a { color: var(--muted); }
.foot span { flex-basis: 100%; }

/* ---- basic pieces ---- */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--r); padding: 16px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin: 28px 0 12px; }
.section-head h2 { font-size: 18px; }
.section-head .muted { font-size: 13px; }

.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 52px; padding: 12px 18px;
  border-radius: var(--r); border: 1px solid transparent; background: var(--accent); color: var(--on-accent);
  font-weight: 700; font-size: 16px; text-decoration: none; cursor: pointer; transition: transform .08s ease, opacity .15s;
}
.btn:active { transform: scale(.985); }
.btn:disabled { opacity: .45; cursor: default; transform: none; }
.btn.secondary { background: var(--card); color: var(--text); border-color: var(--border); }
.btn.quiet { background: transparent; color: var(--text); border-color: var(--border); }
.btn.small { min-height: 42px; font-size: 14px; padding: 8px 14px; width: auto; }
.btn svg { width: 18px; height: 18px; }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; }
.link-btn { background: none; border: 0; padding: 4px 0; color: var(--accent-text); font-weight: 600; cursor: pointer; font-size: 14px; }
.text-btn { background: none; border: 0; padding: 6px 0; color: var(--muted); cursor: pointer; font-size: 13px; text-decoration: underline; text-underline-offset: 3px; }

.badge { display: inline-block; font-size: 12px; font-weight: 700; padding: 3px 8px; border-radius: 999px; background: var(--accent); color: var(--on-accent); white-space: nowrap; }
.badge.plain { background: var(--raise); color: var(--muted); border: 1px solid var(--border); }
.rank { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 8px; font-weight: 800; font-size: 14px;
  background: var(--raise); border: 1px solid var(--border); color: var(--text); }
.rank.S { background: var(--accent); color: var(--on-accent); border-color: transparent; }

.error { color: var(--bad-text); font-size: 14px; min-height: 0; }
.error:empty { display: none; }
.note { font-size: 14px; color: var(--muted); background: var(--raise); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; }

input[type="search"], input[type="text"], textarea {
  width: 100%; background: var(--card); border: 1px solid var(--border); border-radius: var(--r);
  padding: 13px 14px; font-size: 16px; outline: none;
}
input:focus, textarea:focus { border-color: var(--accent); }
textarea { resize: none; min-height: 96px; }
input::placeholder, textarea::placeholder { color: var(--muted); }
label.field { display: block; font-size: 14px; font-weight: 600; margin-bottom: 6px; }

.search { position: relative; margin-top: 4px; }
.search svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--muted); }
.search input { padding-left: 42px; }

.chips { display: flex; gap: 8px; overflow-x: auto; padding: 14px 16px 2px; margin: 0 -16px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; border: 1px solid var(--border); background: var(--card); color: var(--text); border-radius: 999px;
  padding: 7px 14px; font-size: 14px; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.chip.on { background: var(--accent); color: var(--on-accent); border-color: transparent; }
.chips.wrap { flex-wrap: wrap; overflow: visible; padding: 10px 0 0; margin: 0; }

/* ---- solo home ---- */
.create-card { display: flex; align-items: center; gap: 14px; margin-top: 18px; text-decoration: none; color: var(--text); cursor: pointer; width: 100%; text-align: left; }
.create-card .plus { flex: none; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 10px; background: var(--accent); color: var(--on-accent); }
.create-card .plus svg { width: 22px; height: 22px; }
.create-card .grow { flex: 1; min-width: 0; }
.create-card p { color: var(--muted); font-size: 14px; }

.banner { display: flex; align-items: center; gap: 12px; margin-top: 14px; }
.banner .grow { flex: 1; min-width: 0; }
.banner b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 520px) { .grid { grid-template-columns: repeat(3, 1fr); } }
.quiz-card {
  display: flex; flex-direction: column; gap: 6px; min-height: 112px; padding: 14px; text-align: left; cursor: pointer;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--r); color: var(--text);
}
.quiz-card:hover { border-color: color-mix(in srgb, var(--text) 25%, var(--border)); }
.quiz-card .cat { font-size: 12px; color: var(--muted); font-weight: 600; }
.quiz-card .title { font-weight: 700; font-size: 15px; line-height: 1.25; flex: 1; }
.quiz-card .meta { display: flex; align-items: center; justify-content: space-between; font-size: 12px; color: var(--muted); }
.quiz-card .rank { width: 22px; height: 22px; font-size: 12px; border-radius: 6px; }
.empty { padding: 24px 16px; text-align: center; color: var(--muted); font-size: 14px; }

.scroller { display: flex; gap: 10px; overflow-x: auto; margin: 0 -16px; padding: 0 16px 4px; scrollbar-width: none; }
.scroller::-webkit-scrollbar { display: none; }
.scroller .quiz-card { flex: none; width: 168px; }

/* ---- favourites ---- */
.star-btn { flex: none; display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; padding: 0; cursor: pointer;
  background: transparent; border: 1px solid var(--border); color: var(--muted); vertical-align: middle; }
.star-btn svg { width: 20px; height: 20px; fill: none; }
.star-btn.on { color: var(--accent-text); border-color: var(--accent); }
.star-btn.on svg { fill: var(--accent); stroke: var(--accent); }
.kicker-star { display: flex; align-items: center; justify-content: center; gap: 8px; }
.kicker-star .star-btn { width: 32px; height: 32px; }
.kicker-star .star-btn svg { width: 16px; height: 16px; }
.star-mini svg { width: 14px; height: 14px; fill: var(--accent); stroke: var(--accent); vertical-align: -2px; }
.sheet-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.fav-open { background: none; border: 0; padding: 0; text-align: left; cursor: pointer; color: var(--text); }

/* ---- bottom sheet ---- */
.sheet-back { position: fixed; inset: 0; z-index: 40; background: rgb(0 0 0 / .55); display: flex; align-items: flex-end; justify-content: center; animation: fade .15s ease; }
.sheet {
  width: 100%; max-width: var(--col); max-height: 88vh; overflow-y: auto; background: var(--card); border: 1px solid var(--border);
  border-bottom: 0; border-radius: 18px 18px 0 0; padding: 10px 20px calc(24px + env(safe-area-inset-bottom)); animation: up .2s ease;
}
.sheet .grab { width: 40px; height: 4px; border-radius: 4px; background: var(--border); margin: 0 auto 16px; }
.sheet h2 { font-size: 22px; }
@media (min-width: 640px) { .sheet-back { align-items: center; } .sheet { border-radius: 18px; border-bottom: 1px solid var(--border); } }
@keyframes fade { from { opacity: 0; } }
@keyframes up { from { transform: translateY(24px); opacity: 0; } }

.facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.facts div { background: var(--raise); border: 1px solid var(--border); border-radius: 10px; padding: 10px; text-align: center; }
.facts b { display: block; font-size: 18px; }
.facts span { font-size: 12px; color: var(--muted); }

.board-list { list-style: none; margin: 0; padding: 0; }
.board-list li { display: flex; gap: 10px; padding: 8px 0; border-top: 1px solid var(--border); }
.board-list li:first-child { border-top: 0; }

/* ---- settings ---- */
.seg { display: grid; grid-template-columns: 1fr 1fr 1.6fr; background: var(--raise); border: 1px solid var(--border); border-radius: 10px; padding: 3px; gap: 3px; }
.seg button { border: 0; background: transparent; border-radius: 8px; padding: 9px 4px; font-size: 14px; font-weight: 600; color: var(--muted); cursor: pointer; }
.seg button.on { background: var(--card); color: var(--text); box-shadow: 0 0 0 1px var(--border); }
.swatches { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.swatch { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 4px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--raise); cursor: pointer; font-size: 12px; font-weight: 600; color: var(--text); }
.swatch.on { border-color: var(--text); }
.swatch .dots { display: flex; }
.swatch .dots i { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--raise); }
.swatch .dots i + i { margin-left: -6px; }

.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--border); }
.list li:first-child { border-top: 0; padding-top: 2px; }
.list .grow { flex: 1; min-width: 0; }
.list .grow b { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list .grow span { font-size: 13px; color: var(--muted); }
.list a.grow { color: var(--text); text-decoration: none; }

.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; cursor: pointer; }
.check input { width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--accent); flex: none; }
.toggle { display: flex; align-items: center; justify-content: space-between; gap: 12px; cursor: pointer; }
.toggle input { appearance: none; -webkit-appearance: none; flex: none; width: 46px; height: 28px; border-radius: 999px; background: var(--raise);
  border: 1px solid var(--border); position: relative; cursor: pointer; transition: background .15s; }
.toggle input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: var(--muted); transition: transform .15s, background .15s; }
.toggle input:checked { background: var(--accent); border-color: transparent; }
.toggle input:checked::after { transform: translateX(18px); background: var(--on-accent); }

.google { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; min-height: 50px; border-radius: var(--r);
  background: #fff; color: #1f1f1f; border: 1px solid #dadce0; font-weight: 600; cursor: pointer; }
.google:disabled, .google[aria-disabled="true"] { opacity: .6; cursor: default; }
.google svg { width: 20px; height: 20px; }
.google-slot { min-height: 50px; display: flex; justify-content: center; }
.google-slot > div { width: 100%; display: flex; justify-content: center; }
.avatar { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; flex: none;
  background: var(--accent); color: var(--on-accent); font-weight: 800; font-size: 17px; text-decoration: none; }
.avatar.big { width: 52px; height: 52px; font-size: 22px; }
.profile { display: flex; align-items: center; gap: 14px; }
.profile .grow { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.profile .grow b { font-size: 18px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile .grow span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gap-s { margin-top: 10px; }
.btn.bad { background: var(--bad); border-color: var(--bad); color: #fff; }
.danger-text { color: var(--bad-text); align-self: center; }
.perks { margin: 0; padding-left: 18px; color: var(--muted); font-size: 14px; }
.perks li + li { margin-top: 4px; }

/* ---- play ---- */
.hud { display: flex; align-items: center; gap: 12px; height: 60px; }
.hud .count { font-weight: 800; font-size: 18px; }
.hud .count small { color: var(--muted); font-weight: 600; font-size: 14px; }
.hud .name { flex: 1; min-width: 0; font-size: 14px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hud .score { text-align: right; }
.hud .score small { display: block; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-weight: 700; }
.hud .score b { font-size: 20px; }
.quit, .hud .sound-btn { width: 36px; height: 36px; flex: none; }
.hud .sound-btn svg { width: 18px; height: 18px; }

.timer { display: flex; align-items: center; gap: 12px; margin-top: 4px; }
.track { flex: 1; height: 8px; border-radius: 8px; background: var(--raise); overflow: hidden; }
.fill { height: 100%; background: var(--accent); transform-origin: left; border-radius: 8px; }
.danger .fill { background: var(--bad); }
.points-now { text-align: right; min-width: 70px; }
.points-now b { font-size: 22px; font-weight: 800; color: var(--accent-text); }
.points-now small { display: block; font-size: 11px; color: var(--muted); margin-top: -2px; }

.question { margin: 22px 0 18px; }
.final-flag { display: inline-block; margin-bottom: 10px; }
.question p { font-size: 22px; font-weight: 700; line-height: 1.3; }

.answers { display: grid; gap: 10px; }
.ans {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 58px; padding: 12px 14px; text-align: left; cursor: pointer;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--r); font-size: 16px; font-weight: 600; transition: border-color .12s, opacity .2s;
}
.ans:hover:not(:disabled) { border-color: color-mix(in srgb, var(--text) 30%, var(--border)); }
.ans .key { flex: none; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 7px; background: var(--raise); color: var(--muted); font-size: 13px; font-weight: 700; }
.ans .txt { flex: 1; }
.ans .tags { display: flex; gap: 4px; }
.ans:disabled { cursor: default; color: var(--text); }
.ans.correct { border-color: var(--good); background: color-mix(in srgb, var(--good) 14%, var(--card)); }
.ans.correct .key { background: var(--good); color: #fff; }
.ans.wrong { border-color: var(--bad); background: color-mix(in srgb, var(--bad) 12%, var(--card)); }
.ans.wrong .key { background: var(--bad); color: #fff; }
.ans.dim { opacity: .5; }
.tag { font-size: 11px; font-weight: 800; padding: 2px 7px; border-radius: 999px; }
.tag.me { background: var(--accent); color: var(--on-accent); }
.tag.them { background: var(--rival); color: #111; }

.verdict { margin-top: 16px; }
.verdict-top { display: flex; align-items: center; gap: 12px; }
.verdict-top .big { font-size: 26px; font-weight: 800; }
.verdict-top .grow { flex: 1; }
.verdict-top .label { font-weight: 700; }
.verdict.good .label { color: var(--good-text); }
.verdict.bad .label { color: var(--bad-text); }
.verdict .fact { margin-top: 10px; color: var(--muted); font-size: 15px; }
.opp-line { margin-top: 10px; font-size: 15px; }
.opp-line b { color: var(--rival-text); }
.report-row { display: flex; justify-content: center; gap: 18px; margin-top: 6px; }

.countdown { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; background: var(--bg); }
.countdown p { font-size: 16px; font-weight: 600; }
.countdown b { display: block; font-size: 120px; line-height: 1.1; font-weight: 800; color: var(--accent-text); animation: pop .6s ease; }
@keyframes pop { from { transform: scale(.6); opacity: 0; } }

/* ---- results ---- */
.result-head { text-align: center; padding: 18px 0 6px; }
.result-head .kicker { font-size: 14px; color: var(--muted); font-weight: 600; }
.result-head .total { font-size: 64px; font-weight: 800; line-height: 1.05; margin-top: 6px; }
.result-head .rank { width: 44px; height: 44px; font-size: 24px; border-radius: 12px; margin-top: 10px; }
.result-head h1 { margin-top: 6px; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stats .card { padding: 12px 14px; }
.stats small { display: block; font-size: 12px; color: var(--muted); font-weight: 600; }
.stats b { display: block; margin-top: 2px; font-size: 15px; line-height: 1.3; }

.versus { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; text-align: center; }
.versus .side { padding: 14px 8px; border-radius: var(--r); background: var(--card); border: 1px solid var(--border); }
.versus .side span { display: block; font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.versus .side b { font-size: 30px; font-weight: 800; }
.versus .me { border-color: var(--accent); }
.versus .me b { color: var(--accent-text); }
.versus .them { border-color: var(--rival); }
.versus .them b { color: var(--rival-text); }
.versus .vs { color: var(--muted); font-weight: 700; font-size: 14px; }
/* live match scoreboard under the play HUD: You 245 · Rahul 190 */
.versus.mini { grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 10px; text-align: left; }
.versus.mini .side { display: flex; align-items: center; gap: 8px; padding: 7px 12px; min-width: 0; }
.versus.mini .side span { flex: 1; min-width: 0; font-size: 13px; }
.versus.mini .side span small { display: block; font-size: 11px; font-weight: 600; color: var(--muted); min-height: 14px; }
.versus.mini .side b { font-size: 20px; }
.opp-line .dot { display: inline-block; margin-right: 6px; vertical-align: 1px; }
.next-in { margin-top: 10px; text-align: center; font-size: 14px; font-weight: 600; color: var(--muted); }

.review { margin: 0; padding: 0; list-style: none; }
.review li { padding: 12px 0; border-top: 1px solid var(--border); }
.review li:first-child { border-top: 0; }
.review .q { font-weight: 600; }
.review .a { font-size: 14px; color: var(--muted); margin-top: 2px; }
.review .a b { color: var(--text); }
.review .picks { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.pick { font-size: 13px; font-weight: 600; padding: 3px 9px; border-radius: 999px; border: 1px solid var(--border); background: var(--raise); }
.pick.me { border-color: var(--accent); }
.pick.them { border-color: var(--rival); }
.pick.miss { color: var(--muted); }
.review .voided { opacity: .55; }
details > summary { cursor: pointer; font-weight: 600; list-style: none; display: flex; justify-content: space-between; }
details > summary::-webkit-details-marker { display: none; }
details > summary::after { content: "+"; color: var(--muted); font-size: 20px; line-height: 1; }
details[open] > summary::after { content: "–"; }

/* ---- friends / lobby ---- */
.big-choice { display: flex; align-items: center; gap: 14px; width: 100%; text-align: left; cursor: pointer; color: var(--text); text-decoration: none; padding: 18px 16px; }
.big-choice .ico { flex: none; display: grid; place-items: center; width: 48px; height: 48px; border-radius: 12px; background: var(--raise); border: 1px solid var(--border); }
.big-choice .ico svg { width: 24px; height: 24px; }
.big-choice .grow { flex: 1; }
.big-choice p { font-size: 14px; color: var(--muted); }
.big-choice + .big-choice { margin-top: 10px; }

.link-box { display: flex; align-items: center; gap: 8px; background: var(--raise); border: 1px solid var(--border); border-radius: 10px; padding: 6px 6px 6px 12px; }
.link-box code { flex: 1; min-width: 0; font: 600 14px ui-monospace, SFMono-Regular, Menlo, monospace; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qr { width: 168px; margin: 0 auto; border-radius: 10px; overflow: hidden; }
.qr svg { display: block; width: 100%; height: auto; }
.status { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--muted); flex: none; }
.dot.live { background: var(--accent); animation: pulse 1.4s ease-in-out infinite; }
.dot.ready { background: var(--good); }
@keyframes pulse { 50% { opacity: .35; } }
.players { display: grid; gap: 8px; }
.player { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 10px; background: var(--raise); border: 1px solid var(--border); }
.player .grow { flex: 1; min-width: 0; font-weight: 600; }
.player .who { width: 10px; height: 10px; border-radius: 50%; }
.player .who.me { background: var(--accent); }
.player .who.them { background: var(--rival); }

.room-code { display: flex; flex-direction: column; align-items: center; gap: 2px; text-align: center; margin-bottom: 14px; }
.room-code small { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.room-code b { font: 800 40px/1.1 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .18em; color: var(--accent-text); }
.join-box { cursor: default; }
.join-box input { text-transform: uppercase; letter-spacing: .12em; font-weight: 700; min-width: 0; }

/* live scoreboard: everyone's score */
.scoreboard { display: flex; gap: 8px; overflow-x: auto; margin: 4px -16px 10px; padding: 0 16px; scrollbar-width: none; }
.scoreboard::-webkit-scrollbar { display: none; }
.sb-chip { flex: 1 0 auto; min-width: 96px; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 8px 12px; border-radius: 10px; background: var(--card); border: 1px solid var(--border); }
.sb-chip.me { border-color: var(--accent); }
.sb-chip.them { border-color: color-mix(in srgb, var(--rival) 60%, var(--border)); }
.sb-chip .sb-name { font-size: 13px; font-weight: 600; max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-chip .sb-name small { display: block; font-size: 11px; font-weight: 500; color: var(--muted); min-height: 14px; }
.sb-chip b { font-size: 18px; }
.sb-chip.me b { color: var(--accent-text); }
.sb-chip.them b { color: var(--rival-text); }
.opp-lines .opp-line { margin-top: 6px; }
.opp-lines .opp-line:first-child { margin-top: 10px; }

/* group results */
.ranking { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.ranking li { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 10px; background: var(--card); border: 1px solid var(--border); }
.ranking li.me { border-color: var(--accent); }
.ranking .place { width: 38px; font-weight: 800; color: var(--muted); }
.ranking li:first-child .place { color: var(--accent-text); }
.ranking .grow { flex: 1; min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ranking b { font-size: 18px; }

/* ---- building ---- */
.building { text-align: center; padding: 40px 0 8px; }
.building .bar { height: 8px; border-radius: 8px; background: var(--raise); overflow: hidden; margin: 22px 0 10px; }
.building .bar i { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 8px; transition: width .5s linear; }

/* ---- misc ---- */
.notice { position: fixed; left: 12px; right: 12px; bottom: calc(76px + env(safe-area-inset-bottom)); z-index: 30; max-width: calc(var(--col) - 8px); margin: 0 auto;
  display: flex; gap: 12px; align-items: center; background: var(--raise); border: 1px solid var(--border); border-radius: var(--r); padding: 12px 14px; font-size: 13px; color: var(--muted); }
.notice .btn { width: auto; min-height: 38px; font-size: 14px; flex: none; }
.toast { position: fixed; left: 50%; bottom: calc(90px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 60; background: var(--text); color: var(--bg);
  padding: 10px 16px; border-radius: 999px; font-size: 14px; font-weight: 600; animation: fade .15s ease; white-space: nowrap; }
.ts-slot:empty { display: none; }

/* ---- legal pages ---- */
.legal { max-width: 720px; margin: 0 auto; padding: 0 16px 60px; }
.legal h1 { margin: 20px 0 12px; }
.legal h2 { font-size: 18px; margin: 26px 0 8px; }
.legal p, .legal li { color: var(--text); margin: 8px 0; }
.demo-note { margin-top: 10px; font-size: 14px; background: var(--raise); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; color: var(--muted); }

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

/* host: remove a player from the room */
.link-btn.kick { color: var(--bad-text); margin-left: 4px; }
.seg.two { grid-template-columns: 1fr 1fr; }
input[type="email"], input[type="password"] { width: 100%; background: var(--card); border: 1px solid var(--border); border-radius: var(--r); padding: 13px 14px; font-size: 16px; outline: none; color: var(--text); }

/* friends */
.tabs a { position: relative; }
.tab-dot { position: absolute; top: 8px; left: calc(50% + 8px); width: 9px; height: 9px; border-radius: 50%; background: var(--bad); }
.avatar { flex: none; display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--raise); border: 1px solid var(--border); font-weight: 700; }
.list li .btn.small { width: auto; min-height: 36px; }
.invite { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-color: var(--accent); }
.invite .grow { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.invite .btn.small { width: auto; }
.invite .icon-btn { width: 32px; height: 32px; }
.h2h { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; text-align: center; margin-top: 14px; }
.h2h div { background: var(--raise); border: 1px solid var(--border); border-radius: 10px; padding: 12px 6px; }
.h2h b { display: block; font-size: 28px; font-weight: 800; }
.h2h div:first-child b { color: var(--accent-text); }
.h2h div:last-child b { color: var(--rival-text); }
.h2h span { font-size: 12px; color: var(--muted); }
.gap-s { margin-top: 10px; }

/* little logo, bottom right of the footer: an R (Playfair Display, OFL licence in static/fonts) that flips into a heart and back */
@font-face { font-family: "Quizmena Logo"; font-style: italic; font-weight: 900; font-display: block;
  src: url("/static/fonts/logo-r.woff2") format("woff2"); unicode-range: U+52; }
.foot-logo { margin-left: auto; display: block; width: 44px; height: 44px; padding: 0; border: 0; background: none;
  color: var(--text); cursor: pointer; perspective: 220px; -webkit-tap-highlight-color: transparent; }
.foot-logo .flip { position: relative; display: block; width: 100%; height: 100%; transform-style: preserve-3d;
  animation: qm-flip 8s ease-in-out infinite; }
.foot-logo .face { position: absolute; inset: 0; display: grid; place-items: center;
  backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.foot-logo .face-r { font: italic 900 42px/1 "Quizmena Logo", Georgia, "Times New Roman", serif; padding-right: 2px; }
.foot-logo .face-heart { transform: rotateY(180deg); }
.foot-logo .face-heart svg { width: 74%; height: 74%; animation: qm-beat 1.4s ease-in-out infinite; }
.foot-logo.whirl .flip { animation: qm-flip-now 1.6s ease-in-out; }
/* R for a while, flip to the heart, heart for a while, flip on round back to the R */
@keyframes qm-flip { 0%, 42% { transform: rotateY(0); } 50%, 84% { transform: rotateY(180deg); } 92%, 100% { transform: rotateY(360deg); } }
@keyframes qm-flip-now { 0% { transform: rotateY(0); } 30%, 70% { transform: rotateY(180deg); } 100% { transform: rotateY(360deg); } }
@keyframes qm-beat { 0%, 60%, 100% { transform: scale(1); } 12% { transform: scale(1.14); } 24% { transform: scale(1); } 36% { transform: scale(1.08); } }
