/* 星穹闯关 · 王者金克制版：近黑底 + 单一金色强调 + 字号撑气场
 * 设计纪律：一个强调色（金）、一个面板色、两层文字色；
 * 常态零动画，动效只出现在关键时刻（晋级/答错/倒计时告急）。 */
:root {
  --bg: #0a0c12;
  --panel: #12151f;
  --panel-2: #171b28;
  --line: #232838;
  --line-soft: #1b2030;
  --text: #f5f6fa;
  --dim: #8b90a5;
  --gold: #f7c948;
  --gold-2: #ffe08a;
  --gold-deep: #b8860b;
  --ok: #34d399;
  --bad: #f87171;
  --r: 16px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }

.quiz-body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", system-ui, sans-serif;
  overflow-x: hidden;
}
/* 唯一的背景处理：极淡的中央聚光，制造舞台感 */
.quiz-body::before {
  content: ""; position: fixed; inset: 0; pointer-events: none;
  background: radial-gradient(52% 42% at 50% 30%, rgba(247, 201, 72, .05), transparent 70%);
}

/* 星穹背景画布：金色星尘缓慢上浮 + 偶发流星，克制不抢戏 */
#cosmos { position: fixed; inset: 0; z-index: 0; pointer-events: none; }
#cosmos { z-index: 1; }
/* 3D 背景激活时粒子层轻叠加，保留流星层次但不喧宾夺主 */
.quiz-gate, .quiz-arena, .quiz-footer { position: relative; z-index: 2; }
@media (prefers-reduced-motion: reduce) { #cosmos { display: none; } }

/* 轮回主题：背景聚光色随主题变化（JS 设置 --cosmos-tint） */
.quiz-body::before { background: radial-gradient(52% 42% at 50% 30%, var(--cosmos-tint, rgba(247, 201, 72, .05)), transparent 70%); }
/* 虚空暗涌主题：加深四角 */
body.is-vignette::after {
  content: ""; position: fixed; inset: 0; z-index: 1; pointer-events: none;
  background: radial-gradient(120% 100% at 50% 45%, transparent 55%, rgba(6, 4, 24, .55) 100%);
}

/* ============ 入场 ============ */
.quiz-gate {
  position: relative; z-index: 2;
  min-height: calc(100dvh - 54px); /* 扣除底部 footer，保证整页一屏 */
  display: grid; place-items: center;
  padding: 40px 22px;
}
.quiz-gate[hidden] { display: none; }

/* ============ 出征门（已登录）：紧凑单屏作战面板，不滚动 ============ */
#gate-ready { padding: 12px 22px; min-height: calc(100dvh - 54px); }
#gate-ready .gate-crown { display: none; }
#gate-ready .gate-title span {
  font-size: clamp(38px, 6vw, 56px);
  text-shadow: 0 0 30px rgba(247, 201, 72, .35);
}
#gate-ready .gate-title span::after { text-shadow: 0 0 30px rgba(247, 201, 72, .4); }
#gate-ready .gate-sub { margin-top: 2px; font-size: 11px; }
#gate-ready .ready-card { margin-top: 14px; padding: 16px 20px 18px; }
#gate-ready .ready-title { font-size: 20px; letter-spacing: 3px; }
#gate-ready .ready-nick-row { margin: 3px 0 10px; }
#gate-ready .ready-grid { margin-bottom: 12px; gap: 6px; }
#gate-ready .ready-grid div { padding: 7px 6px; }
#gate-ready .ready-grid i { margin-bottom: 2px; }
#gate-ready .ready-grid b { font-size: 15px; }
#gate-ready .gate-go { height: 46px; font-size: 15px; }
#gate-ready .auth-logout { margin-top: 7px; padding: 6px 0; font-size: 12px; }
#gate-ready .gate-stats { margin-top: 14px; }
#gate-ready .gate-stats .gs-item { padding: 7px 13px 9px; min-width: 74px; }
#gate-ready .gate-stats .gs-item b { font-size: clamp(18px, 2.4vw, 23px); }
#gate-ready .gate-rules { display: none; } /* 规则详情在登录页完整展示，出征门不重复 */

.gate-core { position: relative; text-align: center; max-width: 680px; width: 100%; }
.gate-crown { font-size: 44px; margin-bottom: 6px; }

.gate-title { margin: 0; display: flex; justify-content: center; gap: clamp(4px, 1.6vw, 16px); }
.gate-title span {
  position: relative;
  font-size: clamp(56px, 12vw, 116px);
  font-weight: 900; line-height: 1.08; letter-spacing: .02em;
  background: linear-gradient(180deg, #fff 0%, var(--gold-2) 46%, var(--gold) 74%, var(--gold-deep));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: titleIn .6s cubic-bezier(.2,.9,.3,1.35) both;
}
/* 标题底层金色光晕：气势来自光 */
.gate-title span::after {
  content: attr(data-glow);
  position: absolute; inset: 0; z-index: -1;
  color: transparent;
  -webkit-text-stroke: 0;
  text-shadow: 0 0 42px rgba(247, 201, 72, .55), 0 0 96px rgba(247, 201, 72, .28);
  filter: blur(2px);
}
.gate-title span:nth-child(2) { animation-delay: .07s; }
.gate-title span:nth-child(3) { animation-delay: .14s; }
.gate-title span:nth-child(4) { animation-delay: .21s; }
@keyframes titleIn { from { opacity: 0; transform: translateY(30px); } to { opacity: 1; transform: none; } }

.gate-sub {
  margin-top: 4px; font-size: 12px; letter-spacing: clamp(3px, 1vw, 8px);
  color: var(--dim); text-transform: uppercase;
}
.gate-sub::before, .gate-sub::after { content: "·"; margin: 0 10px; color: var(--line); }

.gate-desc { margin: 26px 0 30px; font-size: 16px; line-height: 2; color: var(--dim); }
.gate-desc b { color: var(--gold); font-weight: 700; }

.gate-form { display: flex; gap: 12px; max-width: 560px; margin: 0 auto; }
#quiz-nickname {
  flex: 1; min-width: 0; height: 56px; padding: 0 18px;
  background: var(--panel); color: var(--text);
  border: 1px solid var(--line); border-radius: 14px; outline: none;
  font-size: 16px; text-align: center;
  transition: border-color .2s;
}
#quiz-nickname:focus { border-color: var(--gold); }

.gate-go {
  height: 56px; padding: 0 34px; border: none; border-radius: 14px; cursor: pointer;
  font-size: 16px; font-weight: 800; letter-spacing: .25em; color: #2a1c00;
  background: linear-gradient(135deg, #ffd964, var(--gold) 55%, #e8ab2d);
  box-shadow: 0 4px 22px rgba(247, 201, 72, .38), 0 1px 0 rgba(255, 255, 255, .5) inset;
  animation: gatePulse 3s ease-in-out infinite;
  transition: transform .15s, box-shadow .2s;
}
.gate-go:hover { transform: translateY(-2px); box-shadow: 0 6px 30px rgba(247, 201, 72, .55), 0 1px 0 rgba(255, 255, 255, .5) inset; }
.gate-go:active { transform: translateY(0); }
@keyframes gatePulse {
  0%, 100% { box-shadow: 0 4px 22px rgba(247, 201, 72, .38), 0 1px 0 rgba(255, 255, 255, .5) inset; }
  50% { box-shadow: 0 4px 34px rgba(247, 201, 72, .6), 0 1px 0 rgba(255, 255, 255, .5) inset; }
}

/* 出征数据带：大数字气势 */
.gate-stats {
  display: flex; justify-content: center; gap: clamp(10px, 3vw, 30px);
  margin-top: 26px; flex-wrap: wrap;
}
.gs-item {
  min-width: 88px; padding: 10px 16px 12px;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 14px; text-align: center;
  position: relative; overflow: hidden;
}
.gs-item::before {
  content: ""; position: absolute; top: 0; left: 12%; right: 12%; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(247, 201, 72, .6), transparent);
}
.gs-item b {
  display: block; font-size: clamp(22px, 3.4vw, 30px); font-weight: 900; line-height: 1.15;
  background: linear-gradient(180deg, var(--gold-2), var(--gold));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  font-variant-numeric: tabular-nums;
}
.gs-item span { font-size: 11.5px; color: var(--dim); letter-spacing: 2px; }
.gate-error { color: var(--bad); font-size: 13px; margin-top: 12px; min-height: 18px; }

.gate-rules { display: flex; justify-content: center; gap: 26px; flex-wrap: wrap; margin-top: 34px; }
.rule-chip { display: flex; align-items: baseline; gap: 8px; }
.rule-chip b { font-size: 19px; color: var(--gold); font-weight: 800; }
.rule-chip span { font-size: 12.5px; color: var(--dim); }

.quiz-back {
  position: fixed; left: 16px; top: 16px; z-index: 5;
  color: var(--dim); text-decoration: none; font-size: 13px;
  background: var(--panel); border: 1px solid var(--line);
  padding: 8px 14px; border-radius: 10px;
  transition: color .2s, border-color .2s;
}
.quiz-back:hover { color: var(--gold); border-color: var(--gold-deep); }

/* ============ 主战场 ============ */
.quiz-arena {
  position: relative; z-index: 2;
  display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px;
  max-width: 1720px; margin: 0 auto; padding: 0 14px 60px;
  align-items: start;
}
.quiz-arena[hidden] { display: none; }

.arena-bar {
  position: sticky; top: 0; z-index: 6;
  grid-column: 1 / -1;
  display: flex; align-items: center; gap: 14px;
  padding: 14px 4px; margin-bottom: 6px;
  background: rgba(10, 12, 18, .92); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line-soft);
}
.arena-bar .quiz-back { position: static; padding: 6px 10px; background: none; border: none; }
.bar-title { font-size: 17px; font-weight: 800; letter-spacing: 3px; color: var(--gold); }
.bar-stats { margin-left: auto; display: flex; gap: 22px; }
.bar-stat { text-align: right; }
.bar-stat i { display: block; font-style: normal; font-size: 10px; color: var(--dim); letter-spacing: 2px; }
.bar-stat b { font-size: 18px; font-variant-numeric: tabular-nums; color: var(--gold-2); }
.bar-stat.bar-clock { color: var(--dim); font-variant-numeric: tabular-nums; align-self: center; font-size: 13px; }

.arena-stage {
  --panel-w: min(1060px, 100%);
  position: relative; padding-top: 16px;
  display: flex; flex-direction: column; align-items: center;
}

/* 关卡水印：低存在感的背景秩序 */
.level-watermark {
  position: absolute; left: 50%; top: -34px; z-index: -1;
  transform: translateX(calc(var(--panel-w) / 2 - 100%));
  font-size: clamp(160px, 26vw, 300px); font-weight: 900; line-height: 1;
  color: transparent; -webkit-text-stroke: 1.5px rgba(139, 144, 165, .1);
  font-variant-numeric: tabular-nums; user-select: none; pointer-events: none;
}

/* HUD 行 */
.stage-head { width: var(--panel-w); display: flex; align-items: center; gap: 14px; margin-bottom: 12px; }
.level-badge { display: flex; align-items: baseline; gap: 7px; }
.level-badge i { font-style: normal; font-size: 10px; letter-spacing: 3px; color: var(--dim); }
.level-badge b {
  font-size: 38px; font-weight: 900; line-height: 1;
  color: var(--gold); font-variant-numeric: tabular-nums;
  text-shadow: 0 0 18px rgba(247, 201, 72, .45), 0 0 42px rgba(247, 201, 72, .2);
}

.level-track {
  flex: 1; min-width: 120px;
  display: flex; gap: 5px; align-items: center; overflow: hidden;
  height: 12px;
}
.track-node { width: 8px; height: 8px; border-radius: 50%; background: var(--line); flex: 0 0 auto; transition: all .3s; }
.track-node.done { background: var(--gold-deep); }
.track-node.current { width: 14px; height: 14px; background: var(--gold); animation: nodeBlink 1.2s infinite alternate; }
.track-more { color: var(--gold); font-size: 12px; font-weight: 700; margin-right: 8px; white-space: nowrap; }
@keyframes nodeBlink { from { opacity: .55; } to { opacity: 1; } }

.hud-combo {
  padding: 6px 12px; border-radius: 10px;
  color: var(--gold); font-weight: 800; font-size: 14px;
  background: rgba(247, 201, 72, .09); border: 1px solid rgba(247, 201, 72, .35);
}

/* ---------- 答题面板（绝对主角） ---------- */
.answer-panel {
  position: relative;
  width: var(--panel-w);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: clamp(18px, 2.2vw, 26px) clamp(20px, 2.6vw, 32px) clamp(20px, 2.4vw, 28px);
}
/* 顶部一道金色细线：唯一的面板装饰 */
.answer-panel::before {
  content: ""; position: absolute; top: -1px; left: 32px; right: 32px; height: 2px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  opacity: .8;
}

.question-head {
  display: flex; align-items: center; gap: 12px;
  padding-bottom: 16px; margin-bottom: 18px;
  border-bottom: 1px solid var(--line-soft);
}
.q-category { font-size: 12px; padding: 4px 12px; border-radius: 999px; color: var(--gold); border: 1px solid rgba(247, 201, 72, .35); letter-spacing: 1px; }
.q-difficulty { color: var(--gold); font-size: 14px; letter-spacing: 2px; }
/* 题干区：金色细滚动条 + 溢出时上下渐隐（内容放得下时无任何痕迹） */
.question-text {
  font-size: clamp(17px, 1.8vw, 21px); line-height: 1.65; font-weight: 800;
  min-height: 52px; display: flex; flex-direction: column;
  justify-content: center; gap: 8px;
  max-height: 40vh; overflow-y: auto;
  padding-right: 10px;
  scrollbar-width: thin;
  scrollbar-color: rgba(247, 201, 72, .3) transparent;
}
.question-text::-webkit-scrollbar { width: 5px; }
.question-text::-webkit-scrollbar-track { background: transparent; }
.question-text::-webkit-scrollbar-thumb {
  background: rgba(247, 201, 72, .28); border-radius: 4px;
}
.question-text::-webkit-scrollbar-thumb:hover { background: rgba(247, 201, 72, .55); }
.question-text.is-scrollable {
  -webkit-mask-image: linear-gradient(180deg, transparent 0, #000 16px, #000 calc(100% - 16px), transparent 100%);
  mask-image: linear-gradient(180deg, transparent 0, #000 16px, #000 calc(100% - 16px), transparent 100%);
}
/* 长题自动缩字号，保证一屏读得完 */
.question-text.is-long { font-size: clamp(15px, 1.5vw, 17px); min-height: 44px; }
.question-text.is-verylong { font-size: clamp(14px, 1.3vw, 15.5px); line-height: 1.75; min-height: 40px; }

/* 判断题：题干 + 说法引用块 */
.q-stem { font-size: clamp(15.5px, 1.6vw, 18px); font-weight: 800; line-height: 1.6; }
.q-claim {
  font-size: 14px; font-weight: 500; line-height: 1.85; color: var(--text);
  background: var(--panel-2);
  border-left: 3px solid var(--gold-deep);
  padding: 9px 13px; border-radius: 8px;
  white-space: pre-wrap; word-break: break-word;
}

/* 答题时锁定页面滚动：题干内部滚、页面不动，选项始终可见 */
body.quiz-locked { overflow: hidden; height: 100dvh; }
body.quiz-locked .quiz-arena {
  height: 100dvh; overflow: hidden;
  display: grid; grid-template-rows: auto 1fr; grid-template-columns: minmax(0, 1fr) 288px;
}
body.quiz-locked .arena-stage { min-height: 0; }
body.quiz-locked .arena-board { overflow-y: auto; max-height: calc(100dvh - 90px); }

/* 进阶关（轮回末关 boss）：面板金框脉冲，仪式感拉满 */
.answer-panel.is-advanced {
  border-color: rgba(247, 201, 72, .55);
  animation: advancedPulse 2.2s ease-in-out infinite;
}
.answer-panel.is-advanced::before {
  height: 3px; opacity: 1;
  background: linear-gradient(90deg, transparent, var(--gold-2), var(--gold), var(--gold-2), transparent);
}
@keyframes advancedPulse {
  0%, 100% { box-shadow: 0 0 0 1px rgba(247, 201, 72, .18), 0 0 26px rgba(247, 201, 72, .10); }
  50% { box-shadow: 0 0 0 1px rgba(247, 201, 72, .38), 0 0 44px rgba(247, 201, 72, .22); }
}

/* 选项 hover 光泽扫过 */
.option { position: relative; overflow: hidden; }
.option::after {
  content: ""; position: absolute; top: 0; bottom: 0; left: -60%; width: 40%;
  background: linear-gradient(105deg, transparent, rgba(255, 236, 180, .07), transparent);
  transform: skewX(-18deg); transition: left .45s ease; pointer-events: none;
}
.option:hover:not(:disabled)::after { left: 130%; }

/* 选项：干净的满宽横条 */
.options { display: grid; grid-template-columns: 1fr; gap: 10px; margin-top: 18px; }
.option {
  display: flex; align-items: center; gap: 14px; text-align: left;
  min-height: 52px; padding: 10px 16px 10px 12px; cursor: pointer;
  background: var(--panel-2); color: var(--text);
  font-size: clamp(14px, 1.3vw, 15.5px); line-height: 1.5; font-weight: 500;
  border: 1px solid var(--line); border-radius: 12px;
  transition: border-color .18s, background .18s, transform .15s;
}
.option b {
  flex: 0 0 auto; width: 32px; height: 32px; border-radius: 9px;
  display: grid; place-items: center; font-size: 14px;
  background: rgba(247, 201, 72, .1); color: var(--gold);
  border: 1px solid rgba(247, 201, 72, .25);
  transition: all .18s;
}
.option span { min-width: 0; word-break: break-word; }
.option:hover:not(:disabled) {
  border-color: var(--gold);
  background: #1a1f2e;
  transform: translateY(-1px);
}
.option:hover:not(:disabled) b { background: var(--gold); color: #2a1c00; border-color: var(--gold); }
.option:disabled { cursor: default; opacity: .55; }
.option.correct {
  border-color: var(--ok); background: rgba(52, 211, 153, .08); opacity: 1;
}
.option.correct b { background: var(--ok); color: #04281a; border-color: var(--ok); }
.option.wrong { border-color: var(--bad); background: rgba(248, 113, 113, .08); animation: shake .45s; opacity: 1; }
.option.wrong b { background: var(--bad); color: #330606; border-color: var(--bad); }

/* 倒计时（并入题头右侧） */
.timer-wrap { position: relative; width: 52px; height: 52px; flex: 0 0 auto; margin-left: auto; }
.q-timer { width: 52px; height: 52px; transform: rotate(-90deg); }
.q-timer-bg { fill: none; stroke: var(--line); stroke-width: 3.5; }
.q-timer-ring { fill: none; stroke: var(--gold); stroke-width: 3.5; stroke-linecap: round; stroke-dasharray: 150.8; stroke-dashoffset: 0; transition: stroke-dashoffset 1s linear, stroke .3s; }
.timer-wrap b { position: absolute; inset: 0; display: grid; place-items: center; font-size: 16px; font-variant-numeric: tabular-nums; }

/* ---------- 排行榜（配角） ---------- */
.arena-board { display: grid; gap: 14px; position: sticky; top: 78px; }
.board-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r); padding: 16px;
}
.board-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; gap: 8px; }
.board-title { font-weight: 700; font-size: 13px; letter-spacing: 2px; color: var(--gold); }
.board-refresh { font-size: 10px; color: var(--dim); text-align: right; }
.board-list {
  list-style: none; margin: 0; padding: 0 4px 0 0;
  max-height: 42vh; overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(247, 201, 72, .3) transparent;
}
.board-list::-webkit-scrollbar { width: 5px; }
.board-list::-webkit-scrollbar-track { background: transparent; }
.board-list::-webkit-scrollbar-thumb { background: rgba(247, 201, 72, .28); border-radius: 4px; }
.board-list::-webkit-scrollbar-thumb:hover { background: rgba(247, 201, 72, .55); }
.board-list li {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 6px; border-radius: 8px; font-size: 13px;
}
.board-list li.is-top { background: rgba(247, 201, 72, .06); }
.board-list li:nth-child(1) { box-shadow: 0 0 0 1px rgba(247, 201, 72, .28) inset; }
.board-rank {
  width: 24px; height: 24px; flex: 0 0 auto; border-radius: 7px;
  display: grid; place-items: center; font-weight: 800; font-size: 11.5px;
  color: var(--dim); background: var(--panel-2);
}
.board-list li:nth-child(1) .board-rank { background: linear-gradient(135deg, #ffd964, var(--gold)); color: #2a1c00; box-shadow: 0 0 12px rgba(247, 201, 72, .5); }
.board-list li:nth-child(2) .board-rank { background: linear-gradient(135deg, #e6e8f0, #c8cede); color: #2c3244; }
.board-list li:nth-child(3) .board-rank { background: linear-gradient(135deg, #e0a878, #c98a5a); color: #33170a; }
.board-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board-name.is-me { color: var(--gold); }
.board-level { color: var(--gold); font-weight: 700; white-space: nowrap; }
.board-score { color: var(--dim); font-variant-numeric: tabular-nums; font-size: 11.5px; white-space: nowrap; }
.board-empty { color: var(--dim); justify-content: center; padding: 22px 0 !important; }
.board-manual {
  width: 100%; margin-top: 10px; padding: 8px 0; cursor: pointer;
  background: none; color: var(--dim);
  border: 1px solid var(--line); border-radius: 8px; font-size: 12px;
  transition: color .2s, border-color .2s;
}
.board-manual:hover { color: var(--gold); border-color: var(--gold-deep); }

.me-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; }
.me-title { font-size: 11px; color: var(--dim); letter-spacing: 3px; margin-bottom: 10px; }
.me-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.me-grid div { background: var(--panel-2); border-radius: 8px; padding: 8px 12px; }
.me-grid i { font-style: normal; font-size: 10.5px; color: var(--dim); display: block; }
.me-grid b { font-size: 16px; font-variant-numeric: tabular-nums; }

/* ---------- 晋级横扫（关键时刻之一） ---------- */
.sweep {
  position: fixed; inset: 0; z-index: 45; pointer-events: none;
  display: grid; place-items: center; opacity: 0;
  background: rgba(10, 12, 18, .55);
}
.sweep::before {
  content: ""; position: absolute; top: -20%; bottom: -20%; left: -35%; width: 55%;
  background: linear-gradient(100deg, transparent, rgba(247, 201, 72, .13), transparent);
  transform: skewX(-14deg);
}
.sweep.run { animation: sweepBy .9s cubic-bezier(.2,.8,.3,1) both; }
.sweep.run::before { animation: sweepLight .9s cubic-bezier(.2,.8,.3,1) both; }
.sweep span {
  font-size: clamp(40px, 8vw, 84px); font-weight: 900; letter-spacing: .1em;
  color: var(--gold-2);
  text-shadow: 0 0 42px rgba(247, 201, 72, .55), 0 2px 0 rgba(184, 134, 11, .8), 0 0 90px rgba(247, 201, 72, .3);
}
@keyframes sweepLight {
  0% { left: -35%; }
  60% { left: 90%; }
  100% { left: 110%; }
}
@keyframes sweepBy {
  0% { opacity: 0; clip-path: inset(0 0 100% 0); }
  20% { opacity: 1; clip-path: inset(0 0 0 0); }
  75% { opacity: 1; }
  100% { opacity: 0; }
}

/* ---------- 反馈 ---------- */
.quiz-flash { position: fixed; inset: 0; z-index: 40; pointer-events: none; opacity: 0; }
.quiz-flash.ok { background: radial-gradient(60% 60% at 50% 50%, rgba(52, 211, 153, .14), transparent 70%); animation: flash .5s; }
.quiz-flash.bad { background: radial-gradient(60% 60% at 50% 50%, rgba(248, 113, 113, .18), transparent 70%); animation: flash .6s; }
.float-layer { position: fixed; inset: 0; z-index: 41; pointer-events: none; }
.float-score {
  position: absolute; left: 50%; top: 36%;
  transform: translateX(-50%);
  font-size: 34px; font-weight: 900; color: var(--gold);
  animation: floatUp 1.1s ease-out forwards;
}
.quiz-body.shaking { animation: shake .45s; }

/* ---------- 结算弹层 ---------- */
.overlay { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; background: rgba(6, 7, 12, .8); backdrop-filter: blur(8px); }
.overlay[hidden] { display: none; }
.overlay-card {
  width: min(480px, calc(100vw - 48px)); text-align: center;
  max-height: calc(100dvh - 64px);
  display: flex; flex-direction: column;
  padding: 36px 30px 28px;
  background: var(--panel);
  border: 1px solid var(--line); border-radius: 20px;
  animation: rise .3s ease-out;
}
.overlay-art { font-size: 46px; margin-bottom: 10px; flex: 0 0 auto; }
.overlay-card.ok .overlay-art { color: var(--ok); }
.overlay-card.bad .overlay-art { color: var(--bad); }
.overlay-card.milestone .overlay-art { color: var(--gold); }
/* 称号晋升：金光缩放入场；答错：摇头入场 */
.overlay-card.milestone { animation: zoomInGold .45s cubic-bezier(.2,.9,.3,1.3) both; }
@keyframes zoomInGold {
  0% { opacity: 0; transform: scale(.72); box-shadow: 0 0 0 rgba(247, 201, 72, 0); }
  60% { opacity: 1; transform: scale(1.04); box-shadow: 0 0 60px rgba(247, 201, 72, .35); }
  100% { opacity: 1; transform: scale(1); box-shadow: 0 0 36px rgba(247, 201, 72, .22); }
}
.overlay-card.bad { animation: headShake .5s ease-out both, rise .3s ease-out both; }
@keyframes headShake {
  0%, 100% { transform: translateX(0); }
  15% { transform: translateX(-14px); }
  35% { transform: translateX(11px); }
  55% { transform: translateX(-7px); }
  78% { transform: translateX(4px); }
}

/* 音效开关 */
.sound-toggle {
  margin-left: 4px; flex: 0 0 auto;
  width: 34px; height: 34px; cursor: pointer;
  display: grid; place-items: center; font-size: 16px;
  background: none; border: 1px solid var(--line); border-radius: 9px;
  transition: border-color .2s, opacity .2s;
}
.sound-toggle:hover { border-color: var(--gold-deep); }
.sound-toggle.is-muted { opacity: .5; }
.overlay-card.milestone .overlay-title { color: var(--gold); }
.overlay-desc {
  color: var(--dim); font-size: 14px; line-height: 1.9; white-space: pre-wrap;
  overflow-y: auto; flex: 1 1 auto; min-height: 0;
  padding: 2px 8px 2px 4px;
  scrollbar-width: thin;
  scrollbar-color: rgba(247, 201, 72, .3) transparent;
}
.overlay-desc::-webkit-scrollbar { width: 5px; }
.overlay-desc::-webkit-scrollbar-track { background: transparent; }
.overlay-desc::-webkit-scrollbar-thumb { background: rgba(247, 201, 72, .28); border-radius: 4px; }
.overlay-desc::-webkit-scrollbar-thumb:hover { background: rgba(247, 201, 72, .55); }
.overlay-go { flex: 0 0 auto; margin-top: 20px; }
.overlay-go {
  margin-top: 24px; padding: 13px 38px; cursor: pointer;
  border: none; border-radius: 12px;
  font-size: 15px; font-weight: 800; letter-spacing: .2em; color: #2a1c00;
  background: var(--gold);
  transition: background .2s, transform .15s;
}
.overlay-go:hover { background: var(--gold-2); transform: translateY(-2px); }

.quiz-footer {
  position: relative; z-index: 2; text-align: center;
  padding: 18px; color: var(--dim); font-size: 12px;
  border-top: 1px solid var(--line-soft);
}

/* ---------- 动画 ---------- */
@keyframes rise { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
@keyframes flash { 0% { opacity: 1; } 100% { opacity: 0; } }
@keyframes floatUp { 0% { opacity: 0; transform: translate(-50%, 16px); } 25% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -60px); } }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-10px); } 40% { transform: translateX(9px); }
  60% { transform: translateX(-6px); } 80% { transform: translateX(4px); }
}

/* ---------- 响应式 ---------- */
@media (max-width: 1020px) {
  .quiz-arena { grid-template-columns: 1fr; }
  .arena-board { position: static; }
  .level-watermark { font-size: clamp(120px, 34vw, 200px); top: -20px; left: auto; right: 0; transform: none; }
  /* 小屏不锁整页（榜单在下方需要滚动），题干内滚保证选项可见；
     必须同时清掉锁定的双列网格，否则主列被压成几十像素、题目选项全成窄条 */
  body.quiz-locked { overflow: auto; height: auto; }
  body.quiz-locked .quiz-arena { height: auto; overflow: visible; grid-template-rows: none; grid-template-columns: 1fr; }
  body.quiz-locked .arena-board { overflow: visible; max-height: none; }
  .question-text { max-height: 24vh; }
}
@media (max-width: 640px) {
  .gate-form { flex-direction: column; }
  .bar-stats .bar-stat:nth-child(2) { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ---------- 服务未就绪 ---------- */
.quiz-unavailable { text-align: center; padding: 26px 8px 10px; }
.ua-title { font-size: 20px; font-weight: 800; color: var(--bad); margin-bottom: 14px; }
.ua-desc { color: var(--dim); font-size: 14px; line-height: 2; text-align: left; max-width: 460px; margin: 0 auto; }
.ua-desc b { color: var(--gold); }
.ua-retry {
  margin-top: 20px; padding: 10px 30px; cursor: pointer;
  border: 1px solid var(--gold-deep); border-radius: 10px;
  background: none; color: var(--gold); font-size: 14px; font-weight: 600;
  transition: background .2s;
}
.ua-retry:hover { background: rgba(247, 201, 72, .09); }
.answer-panel.is-unavailable .question-text,
.answer-panel.is-unavailable .question-head,
.answer-panel.is-unavailable .options { display: none; }

/* ============ v5：登录 / 注册 / 公平规则 ============ */
.auth-form { display: flex; flex-direction: column; gap: 10px; max-width: 400px; margin: 26px auto 0; }
.auth-tabs { display: flex; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.auth-tab {
  flex: 1; padding: 10px 0; cursor: pointer; font-size: 14px; font-weight: 700;
  background: none; border: none; color: var(--dim); transition: all .2s;
}
.auth-tab.is-active { background: var(--panel-2); color: var(--gold); }
.auth-form input {
  height: 46px; padding: 0 16px; outline: none;
  background: var(--panel); color: var(--text);
  border: 1px solid var(--line); border-radius: 12px; font-size: 15px;
  transition: border-color .2s;
}
.auth-form input:focus { border-color: var(--gold); }
.auth-go {
  height: 46px; border: none; border-radius: 12px; cursor: pointer;
  font-size: 15px; font-weight: 800; letter-spacing: .2em; color: #2a1c00;
  background: var(--gold); transition: background .2s, transform .15s;
}
.auth-go:hover { background: var(--gold-2); transform: translateY(-1px); }
.auth-go:disabled { opacity: .6; cursor: default; transform: none; }
.auth-hint { margin: 4px 0 0; font-size: 12px; color: var(--dim); text-align: center; }

.fair-check {
  display: flex; gap: 10px; align-items: flex-start; text-align: left;
  max-width: 560px; margin: 22px auto 0; cursor: pointer;
  font-size: 12.5px; line-height: 1.8; color: var(--dim);
}
.fair-check input { margin-top: 5px; accent-color: var(--gold); width: 16px; height: 16px; flex: 0 0 auto; }
.fair-check b { color: var(--gold); }
.fair-details { max-width: 560px; margin: 14px auto 0; font-size: 12.5px; color: var(--dim); }
.fair-details summary { cursor: pointer; color: var(--gold-deep); text-align: center; }
.fair-body { line-height: 1.9; padding: 8px 4px; }
.fair-body p { margin: 0 0 8px; }

/* ============ v5：出征门 ============ */
.ready-card {
  max-width: 480px; margin: 26px auto 0; padding: 26px 28px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 20px;
}
.ready-title { font-size: 26px; font-weight: 900; color: var(--gold); letter-spacing: 4px; }
.ready-nick-row { display: flex; align-items: center; gap: 12px; margin: 6px 0 18px; }
.ready-nick { font-size: 16px; color: var(--text); font-weight: 700; }
.nick-edit {
  padding: 4px 12px; cursor: pointer; font-size: 12px;
  background: none; color: var(--dim); border: 1px solid var(--line); border-radius: 8px;
  transition: color .2s, border-color .2s;
}
.nick-edit:hover { color: var(--gold); border-color: var(--gold-deep); }
.nick-form { display: flex; gap: 8px; margin: 0 0 16px; }
.nick-form input {
  flex: 1; height: 40px; padding: 0 12px; outline: none;
  background: var(--panel-2); color: var(--text);
  border: 1px solid var(--line); border-radius: 10px; font-size: 14px;
}
.nick-form button {
  padding: 0 18px; cursor: pointer; border: 1px solid var(--gold-deep); border-radius: 10px;
  background: none; color: var(--gold); font-size: 13px; font-weight: 700;
}
.ready-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 20px; }
.ready-grid div { background: var(--panel-2); border-radius: 10px; padding: 10px 8px; }
.ready-grid i { font-style: normal; font-size: 10.5px; color: var(--dim); display: block; margin-bottom: 4px; }
.ready-grid b { font-size: 18px; color: var(--gold-2); font-variant-numeric: tabular-nums; }
.ready-card .gate-go { width: 100%; margin-top: 0; }
.auth-logout {
  width: 100%; margin-top: 10px; padding: 9px 0; cursor: pointer;
  background: none; color: var(--dim); border: 1px solid var(--line); border-radius: 12px;
  font-size: 13px; transition: color .2s;
}
.auth-logout:hover { color: var(--bad); border-color: var(--bad); }

/* ============ v5：轮回 / 错题计 / 护盾 ============ */
.cycle-chip {
  padding: 5px 12px; border-radius: 999px; flex: 0 0 auto;
  font-size: 12px; font-weight: 700; letter-spacing: 1px;
  color: var(--text); background: var(--panel-2); border: 1px solid var(--line);
}
.mistake-meter {
  width: var(--panel-w); display: flex; align-items: center; gap: 10px;
  margin: 0 0 12px; padding: 7px 12px;
  background: var(--panel); border: 1px solid var(--line-soft); border-radius: 12px;
}
.mm-label { font-size: 11px; color: var(--dim); letter-spacing: 2px; flex: 0 0 auto; }
.mm-bar { flex: 1; height: 6px; border-radius: 3px; background: var(--line-soft); overflow: hidden; }
.mm-bar i { display: block; height: 100%; width: 0; border-radius: 3px; background: var(--bad); transition: width .4s; }
.mm-num { font-size: 12px; color: var(--dim); font-variant-numeric: tabular-nums; flex: 0 0 auto; }
.mm-num b { color: var(--bad); font-size: 14px; }
.combo-chip {
  flex: 0 0 auto; padding: 4px 12px; border-radius: 999px;
  font-size: 12px; font-weight: 800; letter-spacing: 1px;
  color: var(--ok); background: rgba(52, 211, 153, .1); border: 1px solid rgba(52, 211, 153, .35);
}
.combo-chip b { font-size: 13px; }
.shield-btn {
  flex: 0 0 auto; display: flex; align-items: center; gap: 6px;
  padding: 6px 14px; cursor: pointer; font-size: 12.5px; font-weight: 700;
  color: var(--dim); background: none; border: 1px solid var(--line); border-radius: 999px;
  transition: all .2s;
}
.shield-btn b { color: var(--gold); font-size: 14px; }
.shield-btn.is-armed {
  color: var(--gold); border-color: var(--gold);
  background: rgba(247, 201, 72, .12);
  box-shadow: 0 0 0 1px rgba(247, 201, 72, .25) inset;
}
.shield-btn:disabled { opacity: .4; cursor: default; }
.shield-tip {
  margin-top: 12px; padding: 8px 14px; border-radius: 10px;
  font-size: 12.5px; color: var(--gold-2); text-align: center;
  background: rgba(247, 201, 72, .07); border: 1px dashed rgba(247, 201, 72, .4);
}

/* 进阶关徽标 */
.q-advanced {
  padding: 4px 10px; border-radius: 8px; font-size: 11px; font-weight: 800; letter-spacing: 2px;
  color: #2a1c00; background: linear-gradient(120deg, var(--gold), var(--gold-2));
}

/* 排行榜称号列 */
.board-title-col { color: var(--dim); font-size: 10.5px; white-space: nowrap; }

/* 调试工具威慑条 */
.devtools-warn {
  position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 60;
  padding: 10px 22px; border-radius: 12px; font-size: 13px; font-weight: 700;
  color: var(--bad); background: rgba(20, 8, 8, .92); border: 1px solid var(--bad);
  max-width: 92vw; text-align: center;
}

/* 判断题选项宽度收敛 */
.option.judge { max-width: 340px; }

/* ============ v5：移动端 ============ */
@media (max-width: 640px) {
  .gate-desc br { display: none; }
  .ready-grid { grid-template-columns: repeat(2, 1fr); }
  .mistake-meter { flex-wrap: wrap; row-gap: 8px; }
  .mm-bar { flex-basis: 100%; order: 3; }
  .stage-head { flex-wrap: wrap; row-gap: 10px; }
  .question-text { font-size: 16px; min-height: 44px; max-height: 26vh; }
  .q-claim { font-size: 13.5px; padding: 8px 11px; }
  .option { min-height: 48px; font-size: 14px; }
  .board-list li { font-size: 12px; }
  .board-title-col { display: none; }
  .devtools-warn { font-size: 11.5px; }

  /* ---- 移动端紧凑 HUD：把屏幅还给题目 ---- */
  .arena-bar { padding: 8px 4px; margin-bottom: 4px; gap: 8px; }
  .bar-title { font-size: 15px; letter-spacing: 1px; }
  .bar-stats { gap: 12px; }
  .bar-stat i { font-size: 9px; letter-spacing: 1px; }
  .bar-stat b { font-size: 14px; }
  .bar-stat.bar-clock { font-size: 11px; }
  .sound-toggle { width: 30px; height: 30px; font-size: 14px; }
  .stage-head { margin-bottom: 8px; gap: 10px; }
  .level-badge b { font-size: 24px; text-shadow: 0 0 12px rgba(247, 201, 72, .4); }
  .level-badge i { font-size: 9px; letter-spacing: 2px; }
  .cycle-chip { font-size: 10px; padding: 3px 9px; }
  .level-track { height: 8px; gap: 4px; }
  .track-node { width: 5px; height: 5px; }
  .track-node.current { width: 9px; height: 9px; }
  .arena-stage { padding-top: 10px; }
  .mistake-meter { margin-bottom: 8px; padding: 5px 10px; gap: 8px; }
  .mm-label { font-size: 10px; letter-spacing: 1px; }
  .mm-num { font-size: 11px; }
  .shield-btn { padding: 4px 10px; font-size: 11px; }
  .shield-btn b { font-size: 12px; }
  .answer-panel { padding: 14px 14px 16px; border-radius: 14px; }
  .question-head { padding-bottom: 10px; margin-bottom: 12px; }
  .q-category { font-size: 10px; padding: 3px 9px; }
  .q-difficulty { font-size: 12px; }
  .timer-wrap { width: 40px; height: 40px; }
  .q-timer { width: 40px; height: 40px; }
  .q-timer-bg, .q-timer-ring { stroke-width: 3; }
  .timer-wrap b { font-size: 13px; }
  .options { gap: 8px; margin-top: 14px; }
  .option { min-height: 46px; padding: 8px 12px 8px 10px; border-radius: 10px; }
  .option b { width: 27px; height: 27px; font-size: 12px; border-radius: 7px; }
  .quiz-footer { font-size: 10.5px; padding: 12px; }
}

