*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  background: var(--bg);
  color: var(--text);
  transition: background .45s ease, color .45s ease;
}
button, input { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, a:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 3px;
}
:root, [data-theme="neon"] {
  --bg: #070b18; --bg2: #0d1428;
  --surface: rgba(255,255,255,.055); --surface2: rgba(255,255,255,.10);
  --border: rgba(255,255,255,.13);
  --text: #eaf1ff; --muted: #8ea3c9;
  --accent: #5ee7ff; --accent2: #a78bfa; --accent3: #ff5ea8;
  --glow: 0 0 42px rgba(94,231,255,.32);
  --radius: 18px;
}
[data-theme="light"] {
  --bg: #f3f7fd; --bg2: #ffffff;
  --surface: #ffffff; --surface2: #e9f0fb;
  --border: rgba(16,24,40,.11);
  --text: #101828; --muted: #667085;
  --accent: #185fa5; --accent2: #7c3aed; --accent3: #d94f7a;
  --glow: 0 10px 34px rgba(24,95,165,.14);
  --radius: 16px;
}
[data-theme="playful"] {
  --bg: #fff4e4; --bg2: #fffdf8;
  --surface: #ffffff; --surface2: #ffead0;
  --border: rgba(120,72,20,.16);
  --text: #3a2410; --muted: #96683a;
  --accent: #ff7a45; --accent2: #18b9a0; --accent3: #7c5cff;
  --glow: 0 8px 0 rgba(255,122,69,.16);
  --radius: 26px;
}

.vl-toast {
  position: fixed; left: 50%; bottom: 32px; transform: translate(-50%, 18px);
  padding: 12px 22px; border-radius: 999px; z-index: 999;
  background: var(--surface2); color: var(--text); border: 1px solid var(--border);
  box-shadow: var(--glow); opacity: 0; pointer-events: none;
  transition: opacity .25s ease, transform .25s ease; font-size: 14px;
}
.vl-toast.show { opacity: 1; transform: translate(-50%, 0); }
.vl-toast[data-kind="error"] { color: var(--accent3); }

.badge {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 14px; border-radius: 999px; font-size: 12px; letter-spacing: .08em;
  background: var(--surface); border: 1px solid var(--border); color: var(--muted);
}
.badge .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 12px var(--accent); }
.btn {
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  padding: 12px 20px; border-radius: 14px; font-size: 15px; font-weight: 500;
  transition: transform .16s ease, background .2s ease, box-shadow .2s ease;
}
.btn:hover { background: var(--surface2); transform: translateY(-2px); }
.btn:active { transform: translateY(0) scale(.98); }
.btn.primary { background: var(--accent); color: #06121e; border-color: transparent; box-shadow: var(--glow); }
[data-theme="light"] .btn.primary, [data-theme="playful"] .btn.primary { color: #fff; }
.btn.danger { color: var(--accent3); }
.btn:disabled { opacity: .42; cursor: not-allowed; transform: none; }
.field {
  width: 100%; padding: 12px 14px; border-radius: 12px;
  background: var(--surface); border: 1px solid var(--border); color: var(--text); font-size: 15px;
}
.field::placeholder { color: var(--muted); }

/* ---------- 学员投票页（手机） ---------- */
.vote-wrap { max-width: 520px; margin: 0 auto; min-height: 100vh; padding: 30px 22px 44px; display: flex; flex-direction: column; }
.vote-head { text-align: center; margin-bottom: 26px; }
.vote-head h1 { font-size: clamp(22px, 6vw, 30px); line-height: 1.35; margin: 18px 0 10px; font-weight: 600; }
.vote-status { font-size: 14px; color: var(--muted); min-height: 22px; }
.vote-status.live { color: var(--accent); }
.vote-status.closed { color: var(--accent3); }
.score-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(64px, 1fr)); gap: 10px; }
.score-btn {
  aspect-ratio: 1; border-radius: var(--radius); border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font-size: 24px; font-weight: 600;
  display: grid; place-items: center; position: relative;
  transition: transform .18s cubic-bezier(.2,1.6,.4,1), background .2s ease, box-shadow .2s ease;
}
.score-btn:hover:not(:disabled) { transform: translateY(-4px) scale(1.04); background: var(--surface2); }
.score-btn.picked { background: var(--accent); color: #06121e; border-color: transparent; box-shadow: var(--glow); transform: scale(1.06); }
[data-theme="light"] .score-btn.picked, [data-theme="playful"] .score-btn.picked { color: #fff; }
.score-btn:disabled { opacity: .35; }
.score-btn.pop { animation: pop .42s ease; }
@keyframes pop { 0% { transform: scale(.8); } 55% { transform: scale(1.16); } 100% { transform: scale(1.06); } }
.vote-my { margin-top: 24px; text-align: center; font-size: 16px; min-height: 26px; }
.vote-my b { color: var(--accent); font-size: 20px; }
.vote-foot { margin-top: auto; padding-top: 34px; text-align: center; color: var(--muted); font-size: 13px; line-height: 1.9; }
.vote-foot .count { color: var(--text); font-weight: 600; }

/* ---------- 投影大屏 ---------- */
.screen { position: relative; height: 100vh; overflow: hidden; padding: 3.2vh 3.6vw; display: flex; flex-direction: column; background: var(--bg); }
.ambient { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.ambient i { position: absolute; display: block; border-radius: 50%; filter: blur(90px); opacity: .26; }
.ambient i:nth-child(1) { width: 44vw; height: 44vw; left: -12vw; top: -16vw; background: var(--accent); }
.ambient i:nth-child(2) { width: 38vw; height: 38vw; right: -10vw; bottom: -14vw; background: var(--accent2); }
.ambient i:nth-child(3) { width: 26vw; height: 26vw; left: 46%; top: 34%; background: var(--accent3); opacity: .14; }
[data-theme="light"] .ambient i, [data-theme="playful"] .ambient i { opacity: .12; }
.screen > *:not(.ambient):not(#fx) { position: relative; z-index: 2; }
.screen-head { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.screen-head h1 { font-size: clamp(24px, 2.6vw, 46px); margin: 0; font-weight: 600; letter-spacing: -.01em; }
.q-num { font-size: clamp(12px, 1vw, 18px); color: var(--muted); padding: 8px 16px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); }
.live-pill { margin-left: auto; display: inline-flex; align-items: center; gap: 10px; font-size: clamp(12px, 1vw, 18px); padding: 9px 20px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); }
.live-pill .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent3); }
.live-pill.on .dot { background: #3ddc97; box-shadow: 0 0 16px #3ddc97; animation: breathe 1.6s infinite; }
@keyframes breathe { 50% { opacity: .35; } }
.screen-main { flex: 1; display: grid; grid-template-columns: minmax(280px, 34%) 1fr; gap: 3.4vw; align-items: center; min-height: 0; padding: 2vh 0; }
.avg-card { padding: 3.4vh 2.4vw; background: var(--surface); border: 1px solid var(--border); border-radius: calc(var(--radius) + 8px); box-shadow: var(--glow); }
.avg-label { font-size: clamp(13px, 1.1vw, 20px); color: var(--muted); letter-spacing: .1em; }
.avg-line { display: flex; align-items: baseline; gap: 10px; margin-top: 1vh; }
.avg-value { font-size: clamp(80px, 12vw, 210px); font-weight: 700; line-height: 1; letter-spacing: -.05em; font-variant-numeric: tabular-nums; color: var(--accent); text-shadow: 0 0 60px color-mix(in srgb, var(--accent) 45%, transparent); }
.avg-scale { font-size: clamp(20px, 2.4vw, 44px); color: var(--muted); font-weight: 500; }
.avg-sub { margin-top: 2.2vh; font-size: clamp(14px, 1.2vw, 22px); color: var(--muted); }
.avg-sub b { color: var(--text); font-size: 1.35em; font-variant-numeric: tabular-nums; }
.avg-extra { margin-top: 1.4vh; display: flex; gap: 18px; font-size: clamp(12px, 1vw, 18px); color: var(--muted); }
.chart-card { height: 100%; min-height: 0; display: flex; flex-direction: column; padding: 2.4vh 1.6vw 1vh; background: var(--surface); border: 1px solid var(--border); border-radius: calc(var(--radius) + 8px); }
.chart-title { font-size: clamp(13px, 1.1vw, 20px); color: var(--muted); letter-spacing: .08em; margin-bottom: 2vh; }
.bars { flex: 1; display: flex; align-items: flex-end; gap: clamp(6px, .8vw, 16px); min-height: 0; }
.bar-col { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 8px; min-width: 0; }
.bar-count { font-size: clamp(12px, 1vw, 20px); font-weight: 600; font-variant-numeric: tabular-nums; color: var(--text); }
.bar-track { width: 100%; flex: 1; display: flex; align-items: flex-end; border-radius: 10px 10px 0 0; overflow: hidden; }
.bar-fill {
  width: 100%; height: 0%; border-radius: 10px 10px 0 0;
  background: linear-gradient(180deg, var(--accent), var(--accent2));
  transition: height .75s cubic-bezier(.2,.9,.25,1);
  box-shadow: 0 0 26px color-mix(in srgb, var(--accent) 40%, transparent);
}
[data-theme="playful"] .bar-fill { border-radius: 14px 14px 6px 6px; }
.bar-label { font-size: clamp(12px, 1vw, 20px); color: var(--muted); font-variant-numeric: tabular-nums; padding-bottom: 4px; }
.bar-col.lead .bar-fill { background: linear-gradient(180deg, var(--accent3), var(--accent)); }
.bar-col.lead .bar-label { color: var(--accent3); font-weight: 600; }
.screen-foot { display: flex; align-items: center; gap: 20px; min-height: 8vh; border-top: 1px solid var(--border); padding-top: 1.4vh; }
.bubbles { flex: 1; display: flex; gap: 10px; align-items: center; overflow: hidden; height: 8vh; }
.bubble {
  flex: none; min-width: 46px; height: 46px; padding: 0 12px; border-radius: 999px;
  display: grid; place-items: center; font-size: 18px; font-weight: 600;
  background: var(--surface2); border: 1px solid var(--border); color: var(--accent);
  animation: bubbleIn 5.5s ease forwards;
}
@keyframes bubbleIn {
  0% { opacity: 0; transform: translateY(26px) scale(.6); }
  12% { opacity: 1; transform: translateY(0) scale(1); }
  75% { opacity: 1; }
  100% { opacity: 0; transform: translateY(-18px) scale(.85); }
}
.screen-hint { font-size: clamp(12px, 1vw, 18px); color: var(--muted); white-space: nowrap; }
#fx { position: absolute; inset: 0; z-index: 5; pointer-events: none; }
.reveal-flash {
  position: absolute; inset: 0; z-index: 6; pointer-events: none; opacity: 0;
  background: radial-gradient(circle at 50% 50%, color-mix(in srgb, var(--accent) 30%, transparent), transparent 62%);
}
.reveal-flash.go { animation: flash 1.5s ease; }
@keyframes flash { 0% { opacity: 0; } 25% { opacity: 1; } 100% { opacity: 0; } }
.screen.revealed .avg-value { animation: avgPop 1.1s cubic-bezier(.2,1.5,.4,1); }
@keyframes avgPop { 0% { transform: scale(1); } 45% { transform: scale(1.22); } 100% { transform: scale(1); } }
.fullscreen-btn { position: absolute; right: 3.6vw; bottom: 2vh; z-index: 8; font-size: 13px; padding: 8px 16px; opacity: .5; }
.fullscreen-btn:hover { opacity: 1; }

/* ---------- 主持控制台 ---------- */
.control-wrap { max-width: 1080px; margin: 0 auto; padding: 32px 24px 60px; }
.control-top { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 24px; }
.control-top h1 { font-size: 24px; margin: 0; font-weight: 600; }
.control-top .spacer { flex: 1; }
.control-top a { color: var(--accent); font-size: 14px; }
.stat-strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 24px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; }
.stat .k { font-size: 12px; color: var(--muted); }
.stat .v { font-size: 28px; font-weight: 600; margin-top: 6px; font-variant-numeric: tabular-nums; }
.stat .v.accent { color: var(--accent); }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: calc(var(--radius) + 4px); padding: 22px; margin-bottom: 18px; }
.panel h2 { font-size: 14px; font-weight: 500; color: var(--muted); margin: 0 0 16px; letter-spacing: .05em; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row .grow { flex: 1; min-width: 200px; }
.big-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.big-actions .btn { padding: 20px; font-size: 17px; border-radius: var(--radius); }
.segmented { display: inline-flex; padding: 4px; gap: 4px; background: var(--surface2); border-radius: 14px; border: 1px solid var(--border); }
.segmented button { border: 0; background: transparent; color: var(--muted); padding: 9px 18px; border-radius: 10px; font-size: 14px; }
.segmented button.active { background: var(--accent); color: #06121e; font-weight: 600; }
[data-theme="light"] .segmented button.active, [data-theme="playful"] .segmented button.active { color: #fff; }
.link-box { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.link-box code { flex: 1; min-width: 240px; padding: 12px 14px; border-radius: 12px; background: var(--surface2); border: 1px solid var(--border); font-size: 14px; overflow-wrap: anywhere; }
.tip { font-size: 12px; color: var(--muted); line-height: 1.8; margin-top: 14px; }
.key-bar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* ---------- 现场操作速查页 ---------- */
.guide-wrap { max-width: 860px; margin: 0 auto; padding: 40px 28px 70px; }
.guide-wrap h1 { font-size: 30px; margin: 0 0 8px; }
.guide-wrap .lead { color: var(--muted); margin: 0 0 32px; font-size: 15px; }
.guide-step { display: flex; gap: 18px; padding: 18px 0; border-bottom: 1px solid var(--border); }
.guide-step .n { flex: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: #06121e; font-weight: 700; }
[data-theme="light"] .guide-step .n, [data-theme="playful"] .guide-step .n { color: #fff; }
.guide-step h3 { margin: 4px 0 6px; font-size: 17px; }
.guide-step p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.8; }
.guide-box { margin-top: 32px; padding: 22px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); }
.guide-box h2 { font-size: 16px; margin: 0 0 12px; }
.guide-box li { color: var(--muted); font-size: 14px; line-height: 2; }
@media print { .guide-wrap { padding: 0; } body { background: #fff; } }

@media (max-width: 860px) {
  .screen-main { grid-template-columns: 1fr; grid-template-rows: auto 1fr; gap: 1.4vh; }
  .avg-card { padding: 1.6vh 4vw; }
  .avg-value { font-size: 15vw; }
  .stat-strip { grid-template-columns: repeat(2, 1fr); }
}
