/* Theme — swap this block to reskin (New Year, Valentine's, ...). */
:root {
  --bg: #0d3b2c;
  --bg2: #082519;
  --card: #145240;
  --ink: #fff8ec;
  --muted: #b9d3c4;
  --accent: #e23b3b;
  --accent-ink: #fff;
  --gold: #f5c84c;
  --line: rgba(255, 255, 255, .14);
  --font: "Trebuchet MS", "Segoe UI", system-ui, sans-serif;
  --display: "Georgia", "Times New Roman", serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font); color: var(--ink);
  background: radial-gradient(ellipse at top, var(--bg) 0%, var(--bg2) 100%) fixed var(--bg2);
  -webkit-tap-highlight-color: transparent;
}
body::before { /* drifting snow */
  content: ""; position: fixed; inset: -100px 0 0; pointer-events: none; z-index: 0; opacity: .35;
  background-image: radial-gradient(2px 2px at 20px 30px, #fff 50%, transparent 51%), radial-gradient(3px 3px at 120px 80px, #fff 50%, transparent 51%),
    radial-gradient(2px 2px at 200px 150px, #fff 50%, transparent 51%), radial-gradient(1.5px 1.5px at 60px 190px, #fff 50%, transparent 51%);
  background-size: 240px 240px; animation: snow 14s linear infinite;
}
@keyframes snow { to { transform: translateY(240px); } }
@media (prefers-reduced-motion: reduce) { body::before { animation: none; } }
#app, main { position: relative; z-index: 1; }
a { color: var(--gold); }
button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { opacity: .45; cursor: default; }

header { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; }
.logo { font-family: var(--display); font-style: italic; font-weight: bold; color: var(--gold); font-size: 1.4rem; letter-spacing: .02em; }
.logo::before { content: "🛷 "; font-style: normal; }
body.offline header::after { content: "Reconnecting…"; background: var(--accent); padding: 4px 10px; border-radius: 99px; font-size: .85rem; }

/* Review-only Chinese subtitles (see z() in ui.js) */
.zh { display: none; }
body.zh-on .zh {
  display: block; font-size: max(.7em, 13px); font-weight: normal; font-style: normal; letter-spacing: 0; text-transform: none;
  color: #9fe0c0; margin-top: .15em; line-height: 1.3;
}
body.zh-on .zh em { color: inherit; }
body.zh-on.offline header::after { content: "Reconnecting… 重新连接中"; }

.center { text-align: center; padding: 16px; max-width: 560px; margin: 0 auto; }
.hint { color: var(--muted); }
.warn { color: var(--gold); font-size: .9em; }
.err { color: #ff9a9a; min-height: 1.2em; }
.meta { color: var(--muted); text-transform: uppercase; letter-spacing: .12em; font-size: .8em; }
.prompt { font-family: var(--display); font-weight: normal; line-height: 1.2; margin: .3em 0 .5em; }
.prompt em { color: var(--gold); font-style: italic; }
.av { font-size: 1.3em; line-height: 1; margin-right: .3em; }
.pop { animation: pop .5s cubic-bezier(.2, 1.6, .4, 1); }
@keyframes pop { from { transform: scale(.4); opacity: 0; } }

input {
  font: inherit; font-size: 1.2rem; width: 100%; padding: 14px 16px; border-radius: 12px;
  border: 2px solid var(--line); background: rgba(0, 0, 0, .25); color: var(--ink); margin: 6px 0 12px;
}
input:focus { outline: none; border-color: var(--gold); }
.codein { text-align: center; letter-spacing: .4em; font-size: 1.8rem; text-transform: uppercase; }
.start {
  display: block; width: 100%; border: 0; border-radius: 14px; padding: 16px; font-size: 1.2rem; font-weight: bold;
  background: var(--accent); color: var(--accent-ink); box-shadow: 0 4px 0 #8e1b1b;
}
.start:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 1px 0 #8e1b1b; }
.card { background: rgba(255, 255, 255, .06); border: 1px solid var(--line); border-radius: 18px; padding: 16px 20px; margin: 16px 0; text-align: left; }
.card h2 { margin: 0 0 6px; font-size: 1.15rem; }
.hero { font-family: var(--display); font-weight: normal; font-size: clamp(1.6rem, 6vw, 2.6rem); line-height: 1.15; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.chip { background: var(--card); border-radius: 99px; padding: 6px 14px 6px 10px; display: inline-flex; align-items: center; border: 2px solid transparent; }
.chip.off { opacity: .4; }
.chip.done { border-color: var(--gold); }
.chip .x { border: 0; background: none; color: var(--muted); margin-left: 6px; font-size: 1.1em; padding: 0 2px; opacity: 0; }
.chip:hover .x { opacity: 1; }

.hostbar { margin-top: 1.5em; }
.hostbar button { border: 0; border-radius: 99px; padding: .6em 1.6em; font-size: 1em; font-weight: bold; background: var(--accent); color: var(--accent-ink); }
.hostbar button.ghost { background: transparent; border: 2px solid var(--line); color: var(--muted); font-weight: normal; }

.award { background: var(--card); border-radius: 18px; padding: 16px; display: flex; flex-direction: column; align-items: center; gap: 4px; border: 2px solid var(--line); }
.award .av { font-size: 2.4em; margin: 0; }
.award .title { color: var(--gold); font-family: var(--display); font-style: italic; font-size: 1.15em; text-align: center; }
.award small { color: var(--muted); text-align: center; }
.award.champ { border-color: var(--gold); box-shadow: 0 0 40px rgba(245, 200, 76, .25); }
.award .brand { margin-top: 8px; opacity: .7; }

/* ---------- TV (big screen, read from the couch) ---------- */
body.tv { font-size: clamp(16px, 1.6vw, 40px); min-height: 100vh; }
.tv header { padding: .6em 1.2em; }
.tv .logo { font-size: 1.6em; }
.tv .lobby { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); gap: 2em; padding: 0 2em 2em; align-items: start; }
.tv .joinbig { text-align: center; }
.tv .joinbig .qr { width: min(28vw, 60vh); margin: 0 auto; background: #fff; border-radius: 16px; padding: .4em; }
.tv .qr svg { display: block; width: 100%; height: auto; }
.tv .joinbig .code { font-size: 4em; font-weight: bold; letter-spacing: .25em; color: var(--gold); margin-left: .25em; }
.tv .roster h2 { margin-top: 0; }
.tv .roster h3 { margin: 1.2em 0 .4em; color: var(--muted); font-weight: normal; text-transform: uppercase; letter-spacing: .1em; font-size: .8em; }
.tv .roster .chips { justify-content: flex-start; min-height: 2.5em; }
.tv .options { display: flex; gap: .6em; flex-wrap: wrap; }
.tv .opt { flex: 1 1 0; min-width: 8em; text-align: left; background: rgba(255, 255, 255, .05); border: 2px solid var(--line); border-radius: 14px; padding: .6em .8em; }
.tv .opt b, .tv .opt small { display: block; }
.tv .opt small { color: var(--muted); font-size: .75em; margin-top: .2em; }
.tv .opt.on { border-color: var(--gold); background: rgba(245, 200, 76, .12); }
.tv .start { margin-top: 1.2em; font-size: 1.2em; }
.tv .stage { text-align: center; padding: 0 6vw 2em; }
.tv .stage .prompt { font-size: 3em; max-width: 22em; margin-left: auto; margin-right: auto; }
.tv .stage .prompt.small { font-size: 2em; }
.tv .joininfo { position: fixed; top: .5em; right: .8em; display: flex; align-items: center; gap: .5em; background: rgba(0, 0, 0, .3); border-radius: 12px; padding: .3em .6em .3em .3em; z-index: 2; }
.tv .joininfo .qr { width: 4em; background: #fff; border-radius: 6px; padding: 2px; }
.tv .joininfo .code { font-weight: bold; letter-spacing: .15em; color: var(--gold); font-size: 1.3em; }
.tv .joininfo .url { color: var(--muted); font-size: .7em; }
.timer { font-size: 3em; font-weight: bold; color: var(--gold); }
.timer.urgent { color: var(--accent); }
.timer.sm { font-size: 1em; }
.drum { color: var(--gold); font-size: 1.4em; display: inline-block; animation: drum .25s ease-in-out infinite alternate; }
@keyframes drum { to { transform: scale(1.08) rotate(-2deg); } }
.winners { display: flex; justify-content: center; gap: 2em; margin: .5em 0 1em; }
.winner { display: flex; flex-direction: column; align-items: center; font-size: 1.6em; }
.winner .av { font-size: 3em; margin: 0; }
.bars { max-width: 34em; margin: 0 auto; display: grid; gap: .4em; }
.bar { display: grid; grid-template-columns: 9em 1fr 2em; align-items: center; gap: .6em; text-align: left; }
.bar .who { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar .track { background: rgba(255, 255, 255, .08); border-radius: 99px; height: .9em; overflow: hidden; }
.bar .fill { display: block; height: 100%; background: var(--gold); border-radius: 99px; animation: grow .8s ease-out; }
@keyframes grow { from { width: 0 !important; } }
.awards { display: grid; grid-template-columns: repeat(auto-fill, minmax(12em, 1fr)); gap: 1em; margin-top: 1.2em; }
.freebar { position: fixed; left: 0; right: 0; bottom: 0; text-align: center; padding: .4em; background: rgba(0, 0, 0, .35); color: var(--muted); font-size: .8em; z-index: 2; }
.freebar b { color: var(--gold); }
.freenote { background: rgba(245, 200, 76, .12); border: 1px solid rgba(245, 200, 76, .4); border-radius: 12px; padding: .5em .8em; font-size: .85em; }
.upsell { display: flex; gap: 1em; align-items: center; justify-content: center; text-align: left; margin: 1.5em auto 0; max-width: 30em; background: rgba(255, 255, 255, .06); border-radius: 16px; padding: .8em; }
.upsell .qr { width: 6em; flex: none; background: #fff; border-radius: 8px; padding: 3px; }
.upsell p { margin: .3em 0 0; color: var(--muted); font-size: .85em; }
.tv .award.champ { max-width: 22em; margin: 0 auto; font-size: 1.3em; }

/* ---------- Phone ---------- */
body.phone { font-size: 17px; padding-bottom: env(safe-area-inset-bottom); }
.phone .me { background: var(--card); border-radius: 99px; padding: 4px 12px; font-weight: bold; }
.phone .stage { padding: 0 16px 24px; text-align: center; }
.phone .prompt { font-size: 1.5rem; }
.phone .prompt.small { font-size: 1.2rem; }
.join { padding: 0 16px; max-width: 480px; margin: 0 auto; }
.avatars { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 16px; }
.avatars button { font-size: 2rem; padding: 8px 0; border-radius: 14px; border: 2px solid transparent; background: rgba(255, 255, 255, .06); }
.avatars button.on { border-color: var(--gold); background: rgba(245, 200, 76, .15); }
.pick { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pick button {
  background: var(--card); border: 2px solid transparent; border-radius: 14px; padding: 14px 8px; font-size: 1.05rem;
  display: flex; flex-direction: column; align-items: center; gap: 4px; overflow-wrap: anywhere;
}
.pick button .av { font-size: 2rem; margin: 0; }
.pick button.on { border-color: var(--gold); background: rgba(245, 200, 76, .2); }
.huge { font-size: 5rem; }
.big { font-size: 1.6rem; margin: 12px 0; }
.verdict { font-size: 1.2rem; padding: 12px; border-radius: 12px; background: rgba(255, 255, 255, .06); }
.verdict.good { background: rgba(245, 200, 76, .2); color: var(--gold); font-weight: bold; }
.phone .award { margin: 16px auto; max-width: 340px; font-size: 1.2rem; }
