/* ============ 闪电跟读 v2 · 简约亮色投屏版 ============ */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg: #FBF9F4;
  --card: #FFFFFF;
  --line: #ECE6DA;
  --ink: #26262E;
  --dim: #9A97A0;
  --accent: #E89B0C;
  --g1: #E8604C;
  --g2: #4A90D9;
  --g3: #EE9B2E;
  --g4: #46A87E;
  --g5: #8E6BC0;
  --g6: #E26CA6;
  --g7: #3AA6A6;
  --g8: #8D6E63;
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
  overflow: hidden;
}

#app { height: 100vh; }

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
  -webkit-tap-highlight-color: transparent;
}

/* ================= 设置页 ================= */
.setup {
  height: 100vh;
  overflow-y: auto;
  max-width: 900px;
  margin: 0 auto;
  padding: 5vh 28px 60px;
}
.setup-head { text-align: center; margin-bottom: 4vh; }
.setup-head h1 {
  font-family: "ZCOOL KuaiLe", "PingFang SC", sans-serif;
  font-size: clamp(40px, 6vw, 60px);
  letter-spacing: 8px;
}
.setup-head h1 .bolt { color: var(--accent); }
.setup-head p { margin-top: 8px; color: var(--dim); letter-spacing: 3px; font-size: 15px; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 22px 26px;
  margin-bottom: 18px;
}
.card h3 {
  font-size: 17px;
  margin-bottom: 14px;
  color: var(--ink);
  letter-spacing: 2px;
}
.card h3 .dot { color: var(--accent); margin-right: 6px; }

.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.seg button {
  padding: 10px 26px;
  font-size: 16px;
  color: var(--dim);
  background: transparent;
}
.seg button.on { background: var(--accent); color: #fff; font-weight: 700; }

.pills { display: flex; flex-wrap: wrap; gap: 10px; }
.pill {
  padding: 9px 18px;
  font-size: 15px;
  border-radius: 999px;
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--dim);
}
.pill.on {
  background: #F7E8C8;
  border-color: var(--accent);
  color: var(--ink);
  font-weight: 700;
}
.pill .cnt { font-size: 12px; margin-left: 4px; opacity: 0.75; }

.unit-group { margin-bottom: 14px; }
.unit-group .ug-label { font-size: 15px; color: var(--dim); margin-bottom: 8px; }

.slider-row { display: flex; align-items: center; gap: 16px; margin: 16px 0; }
.slider-row label { width: 120px; color: var(--dim); font-size: 16px; flex: none; }
.slider-row output { width: 90px; text-align: right; font-weight: 800; color: var(--accent); font-size: 19px; flex: none; }
input[type="range"] {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  border-radius: 3px;
  border: none;
  background: linear-gradient(90deg, var(--accent) var(--fill, 50%), var(--line) var(--fill, 50%));
  padding: 0;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--accent);
}
input[type="range"]::-moz-range-thumb {
  width: 20px; height: 20px; border-radius: 50%;
  background: #fff; border: 2px solid var(--accent);
}

.switch-row { display: flex; align-items: center; gap: 14px; margin-top: 6px; }
.switch { position: relative; width: 52px; height: 28px; flex: none; }
.switch input { opacity: 0; width: 100%; height: 100%; position: absolute; cursor: pointer; z-index: 1; margin: 0; padding: 0; }
.switch i {
  position: absolute; inset: 0; border-radius: 14px;
  background: var(--line);
  transition: background 0.15s;
}
.switch i::after {
  content: ""; position: absolute; top: 3px; left: 3px;
  width: 22px; height: 22px; border-radius: 50%;
  background: #fff; transition: transform 0.15s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.switch input:checked + i { background: var(--accent); }
.switch input:checked + i::after { transform: translateX(24px); }
.switch-row span { font-size: 16px; color: var(--dim); }

textarea {
  width: 100%;
  min-height: 170px;
  resize: vertical;
  font-size: 16px;
  line-height: 1.9;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
  color: var(--ink);
  outline: none;
  font-family: inherit;
}
textarea:focus { border-color: var(--accent); }

.wordcount { font-size: 15px; color: var(--accent); font-weight: 700; margin-top: 10px; }

.setup-foot { display: flex; justify-content: center; gap: 16px; margin-top: 30px; flex-wrap: wrap; }
.btn {
  padding: 15px 40px;
  font-size: 20px;
  font-weight: 700;
  border-radius: 999px;
  transition: transform 0.12s ease;
}
.btn:active { transform: scale(0.95); }
.btn-primary { background: var(--accent); color: #fff; box-shadow: 0 4px 16px rgba(232,155,12,0.35); }
.btn-ghost { background: var(--card); border: 1px solid var(--line); color: var(--ink); }
.btn-small { padding: 10px 22px; font-size: 16px; }
.sync-msg { text-align: center; font-size: 14px; color: var(--dim); margin-top: 14px; min-height: 20px; }

/* ================= 舞台 ================= */
.stage {
  position: relative;
  height: 100vh;
  display: flex;
  flex-direction: column;
  user-select: none;
  overflow: hidden;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 34px 0;
  flex: none;
}
.brand { display: flex; align-items: center; gap: 10px; flex: none; }
.brand svg { width: 22px; height: 22px; fill: var(--accent); }
.brand span { font-size: 20px; font-weight: 800; letter-spacing: 3px; }
.round-dots { display: flex; align-items: center; gap: 9px; margin-left: 26px; }
.round-dots .rdot { width: 11px; height: 11px; border-radius: 50%; background: var(--line); transition: all 0.3s; }
.round-dots .rdot.on { background: var(--accent); transform: scale(1.35); }
.round-dots .rdot.done { background: #D8CBAF; }

.chips { display: flex; gap: 8px; flex-wrap: nowrap; }
.chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px 8px 12px;
  border-radius: 999px;
  background: var(--card);
  border: 1px solid var(--line);
  transition: border-color 0.2s, transform 0.2s;
}
.chip .cdot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.chip .cscore { font-size: 20px; font-weight: 800; min-width: 24px; text-align: center; font-family: "Arial", "Segoe UI", "Microsoft YaHei", sans-serif; }
.chip.active { border-width: 2px; }
.chip.active .cscore { transform: scale(1.12); }
.chip.bump { animation: bump 0.4s ease; }
@keyframes bump {
  0% { transform: scale(1); }
  40% { transform: scale(1.22); }
  100% { transform: scale(1); }
}

.banner {
  align-self: center;
  margin-top: 2.2vh;
  padding: 1.4vh 4.5vw;
  border-radius: 999px;
  color: #fff;
  font-size: clamp(34px, 4.6vw, 56px);
  font-weight: 800;
  letter-spacing: 6px;
  flex: none;
  opacity: 0;
  transform: scale(0.8);
  transition: opacity 0.22s ease, transform 0.22s ease;
}
.banner.show { opacity: 1; transform: scale(1); }

.stage-main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4vw;
  padding: 0 6vw 2vh;
  min-height: 0;
}
.wordblock { flex: 1 1 56%; min-width: 0; max-width: 60%; }
.word-en {
  font-family: "Arial", "Segoe UI", "Microsoft YaHei", sans-serif;
  font-weight: 800;
  font-size: clamp(72px, 12vw, 170px);
  line-height: 1.05;
  letter-spacing: 0.01em;
  word-break: break-word;
  overflow-wrap: anywhere;
  animation: wordIn 0.3s ease;
}
@keyframes wordIn {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: none; }
}
.word-phonetic {
  margin-top: 1.6vh;
  font-size: clamp(20px, 2.4vw, 32px);
  color: var(--dim);
  font-family: Georgia, serif;
}
.word-meaning {
  margin-top: 0.8vh;
  font-size: clamp(26px, 3.2vw, 44px);
  font-weight: 700;
}
.word-progress { margin-top: 2.4vh; font-size: clamp(16px, 1.6vw, 21px); color: var(--dim); font-family: "Arial", "Segoe UI", "Microsoft YaHei", sans-serif; }

.ring-wrap { position: relative; flex: none; width: clamp(200px, 24vw, 320px); height: clamp(200px, 24vw, 320px); }
.ring-wrap svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: #EDE7DB; stroke-width: 13; }
.ring-fg {
  fill: none;
  stroke-width: 13;
  stroke-linecap: round;
  transition: stroke 0.3s;
}
.ring-num {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-family: "Arial", "Segoe UI", "Microsoft YaHei", sans-serif;
  font-weight: 800;
  font-size: clamp(64px, 8vw, 120px);
  font-variant-numeric: tabular-nums;
}
.ring-wrap.danger .ring-num { animation: pulse 0.5s ease infinite; }
@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.1); opacity: 0.75; }
}

/* ---------- 动作层 ---------- */
.action-layer {
  position: absolute; inset: 0;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5;
}
.action-layer.hidden, .count-layer.hidden, .feedback.hidden, .result-layer.hidden { display: none; }
.action-box { position: relative; text-align: center; }
.action-box .pulse {
  position: absolute; left: 50%; top: 50%;
  width: 46vmin; height: 46vmin;
  border: 2px solid #F0E4C8;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  animation: pulseRing 1s ease-out infinite;
}
.action-box .pulse.p2 { animation-delay: 0.5s; }
@keyframes pulseRing {
  0% { transform: translate(-50%, -50%) scale(0.85); opacity: 0.9; }
  100% { transform: translate(-50%, -50%) scale(1.18); opacity: 0.2; }
}
.action-text {
  position: relative;
  font-family: "ZCOOL KuaiLe", "PingFang SC", sans-serif;
  font-size: clamp(72px, 13vw, 150px);
  font-weight: 800;
  letter-spacing: 4px;
  animation: actionBlink 2s linear infinite;
}
/* 2 秒内闪烁两下，与动作停留时长一致 */
@keyframes actionBlink {
  0%, 50%, 100% { opacity: 1; }
  25%, 75% { opacity: 0.15; }
}
.action-bar {
  position: relative;
  margin: 4vh auto 0;
  width: 220px; height: 7px;
  border-radius: 4px;
  background: var(--line);
  overflow: hidden;
}
.action-bar i {
  display: block; height: 100%; width: 100%;
  background: var(--accent);
  border-radius: 4px;
}

/* ---------- 轮次倒计时层 ---------- */
.count-layer {
  position: absolute; inset: 0;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 6;
}
.count-title { font-size: clamp(34px, 4.5vw, 54px); font-weight: 800; letter-spacing: 8px; }
.count-num {
  font-family: "Arial", "Segoe UI", "Microsoft YaHei", sans-serif;
  font-weight: 800;
  font-size: clamp(160px, 26vw, 300px);
  color: var(--accent);
  line-height: 1.1;
  animation: countIn 0.9s ease infinite;
}
@keyframes countIn {
  0% { transform: scale(1.25); opacity: 0.3; }
  20% { transform: scale(1); opacity: 1; }
  90% { opacity: 1; }
  100% { opacity: 0.45; }
}

/* ---------- 反馈（✓ / ✗） ---------- */
.feedback {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  z-index: 7;
  pointer-events: none;
}
.feedback .fb {
  font-family: "Arial", "Segoe UI", "Microsoft YaHei", "ZCOOL KuaiLe", sans-serif;
  font-weight: 800;
  font-size: clamp(90px, 15vw, 190px);
  animation: fbIn 0.45s ease;
}
.feedback .fb.ok { color: var(--accent); }
.feedback .fb.no { color: #C9C2B4; }
.feedback .fb .plus { font-size: 0.5em; margin-left: 12px; }
@keyframes fbIn {
  0% { transform: scale(0.5); opacity: 0; }
  40% { transform: scale(1.12); opacity: 1; }
  100% { transform: scale(1); }
}

/* ---------- 老师控制按钮 ---------- */
.controls {
  position: absolute;
  right: 34px; bottom: 30px;
  display: flex;
  align-items: center;
  gap: 14px;
  z-index: 8;
}
.cbtn {
  width: 48px; height: 48px;
  border-radius: 50%;
  background: var(--card);
  border: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center;
  transition: transform 0.1s;
}
.cbtn:active { transform: scale(0.92); }
.cbtn svg { width: 20px; height: 20px; fill: var(--dim); }
.cbtn-score {
  width: 68px; height: 68px;
  background: var(--accent);
  border: none;
  box-shadow: 0 4px 18px rgba(232,155,12,0.4);
}
.cbtn-score svg { width: 30px; height: 30px; fill: #fff; }
.cbtn-score:disabled { opacity: 0.45; box-shadow: none; }

/* ---------- 结算层 ---------- */
.result-layer {
  position: absolute; inset: 0;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 9;
  padding: 20px;
}
.result-layer .trophy { width: clamp(44px, 6vw, 60px); height: clamp(44px, 6vw, 60px); fill: var(--accent); }
.winner-text {
  margin-top: 1.6vh;
  font-family: "ZCOOL KuaiLe", "PingFang SC", sans-serif;
  font-size: clamp(40px, 6vw, 72px);
  font-weight: 800;
  letter-spacing: 4px;
}
.score-grid {
  margin-top: 3.5vh;
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 190px));
  gap: 14px;
  max-width: 860px;
}
.score-cell {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 10px 12px;
  text-align: center;
}
.score-cell.winner { border-width: 2px; }
.score-cell .sc-name {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 19px; font-weight: 700;
}
.score-cell .sc-name i { width: 11px; height: 11px; border-radius: 50%; display: inline-block; }
.score-cell .sc-val {
  margin-top: 4px;
  font-family: "Arial", "Segoe UI", "Microsoft YaHei", sans-serif;
  font-weight: 800;
  font-size: 36px;
}
.result-btns { margin-top: 4vh; display: flex; gap: 16px; }

/* ---------- 暂停 ---------- */
.stage.paused .stage-main,
.stage.paused .banner { opacity: 0.3; filter: grayscale(0.5); }
.pause-mask {
  display: none;
  position: fixed; inset: 0; z-index: 10;
  background: rgba(251,249,244,0.72);
  align-items: center; justify-content: center;
}
.stage.paused .pause-mask { display: flex; }
.pause-mask .pm {
  font-family: "ZCOOL KuaiLe", sans-serif;
  font-size: clamp(48px, 7vw, 84px);
  letter-spacing: 10px;
  color: var(--ink);
  background: var(--card);
  border: 1px solid var(--line);
  padding: 3vh 6vw;
  border-radius: 24px;
}

/* 小屏兜底 */
@media (max-width: 900px) {
  .topbar { padding: 10px 14px 0; gap: 8px; flex-wrap: wrap; }
  .brand { gap: 7px; }
  .brand svg { width: 18px; height: 18px; }
  .brand span { font-size: 16px; letter-spacing: 2px; }
  .round-dots { margin-left: 10px; gap: 6px; }
  .round-dots .rdot { width: 8px; height: 8px; }

  .chips { flex-wrap: wrap; gap: 5px; justify-content: flex-start; }
  .chip { padding: 4px 10px 4px 8px; gap: 5px; }
  .chip .cdot { width: 8px; height: 8px; }
  .chip .cscore { font-size: 16px; min-width: 18px; }

  .banner { margin-top: 1.2vh; padding: 1vh 6vw; font-size: clamp(24px, 7vw, 36px); letter-spacing: 3px; }

  .stage-main {
    flex-direction: column;
    justify-content: center;
    gap: 1.6vh;
    padding: 1vh 5vw 2vh;
    overflow-y: auto;
  }
  .wordblock { flex: none; width: 100%; max-width: 100%; text-align: center; }
  .word-en { font-size: clamp(44px, 13vw, 84px); }
  .word-phonetic { margin-top: 0.8vh; font-size: clamp(16px, 4.5vw, 22px); }
  .word-meaning { margin-top: 0.4vh; font-size: clamp(20px, 5.5vw, 28px); }
  .word-progress { margin-top: 1vh; font-size: 15px; }

  .ring-wrap { width: clamp(150px, 46vw, 220px); height: clamp(150px, 46vw, 220px); }
  .ring-num { font-size: clamp(44px, 14vw, 76px); }

  .action-text { font-size: clamp(48px, 14vw, 90px); letter-spacing: 2px; }
  .action-box .pulse { width: 60vmin; height: 60vmin; }
  .action-bar { width: 160px; }

  .count-title { font-size: clamp(24px, 7vw, 36px); letter-spacing: 4px; }
  .count-num { font-size: clamp(110px, 34vw, 200px); }

  .feedback .fb { font-size: clamp(64px, 20vw, 120px); }

  .controls { right: 14px; bottom: 16px; gap: 10px; }
  .cbtn { width: 44px; height: 44px; }
  .cbtn svg { width: 18px; height: 18px; }
  .cbtn-score { width: 62px; height: 62px; }
  .cbtn-score svg { width: 26px; height: 26px; }

  .winner-text { font-size: clamp(30px, 9vw, 48px); }
  .score-grid { grid-template-columns: repeat(2, minmax(120px, 1fr)); max-width: 100%; width: 100%; }
  .score-cell .sc-val { font-size: 28px; }
  .trophy { width: 40px; height: 40px; }

  .pause-mask .pm { font-size: clamp(32px, 10vw, 56px); letter-spacing: 6px; padding: 2.4vh 8vw; }

  .setup { padding: 4.5vh 14px 44px; }
  .card { padding: 16px 16px; border-radius: 14px; }
  .card h3 { font-size: 15px; margin-bottom: 10px; }
  .seg button { padding: 9px 16px; font-size: 15px; }
  .pill { padding: 8px 14px; font-size: 14px; }
  .slider-row { gap: 10px; margin: 12px 0; }
  .slider-row label { width: 76px; font-size: 14px; }
  .slider-row output { width: 64px; font-size: 16px; }
  textarea { min-height: 130px; font-size: 15px; }
  .btn { padding: 13px 28px; font-size: 18px; }
  .btn-huge {
    padding: 18px 36px;
    font-size: clamp(20px, 5.5vw, 26px);
    letter-spacing: 2px;
    white-space: nowrap;
    max-width: 92vw;
  }
  .launcher { gap: 1.8vh; }
  .launcher h1 { font-size: clamp(34px, 10vw, 48px); letter-spacing: 5px; }
  .launcher-foot { flex-wrap: wrap; justify-content: center; }
  .back-btn { left: 12px; top: 12px; padding: 8px 14px; font-size: 14px; }
}

/* ================= 启动屏 ================= */
.launcher {
  height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2.2vh;
  padding: 24px;
  text-align: center;
}
.launcher-icon {
  width: clamp(120px, 18vmin, 180px);
  height: clamp(120px, 18vmin, 180px);
  border-radius: 26%;
  box-shadow: 0 12px 32px rgba(38,38,46,0.14);
}
.launcher h1 {
  font-family: "ZCOOL KuaiLe", "PingFang SC", sans-serif;
  font-size: clamp(40px, 6vw, 62px);
  letter-spacing: 8px;
}
.btn-huge {
  margin-top: 1.5vh;
  padding: 22px 84px;
  font-size: clamp(26px, 3vw, 34px);
  letter-spacing: 6px;
  border-radius: 999px;
}
.launcher-foot { display: flex; gap: 14px; margin-top: 0.5vh; }
.launcher-vol { display: flex; align-items: center; gap: 12px; margin-top: 0.5vh; }
.vol-label { font-size: 16px; font-weight: 800; color: var(--accent); min-width: 46px; text-align: center; font-variant-numeric: tabular-nums; }

.back-btn {
  position: absolute;
  left: 28px;
  top: 24px;
  padding: 9px 18px;
  font-size: 15px;
  border-radius: 999px;
  background: var(--card);
  border: 1px solid var(--line);
  color: var(--dim);
}
.back-btn:hover { color: var(--ink); }
.setup { position: relative; }
