:root {
  --bg: #090b12;
  --bg-soft: #101522;
  --panel: rgba(18, 23, 35, 0.82);
  --panel-strong: rgba(14, 18, 28, 0.94);
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.14);
  --text: #f2f5fb;
  --text-soft: #b8c0d5;
  --text-mute: #77809a;
  --violet: #a78bfa;
  --cyan: #68e1fd;
  --gold: #ffd27a;
  --rose: #ff8ec7;
  --green: #74f4bf;
  --danger: #ff7a97;
  --shadow: 0 32px 80px rgba(0, 0, 0, 0.38);
  --radius: 24px;
  --radius-sm: 16px;
  --shell: min(1180px, calc(100vw - 32px));
  --font: Inter, -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(circle at 15% 20%, rgba(104, 225, 253, 0.14), transparent 28%),
    radial-gradient(circle at 85% 15%, rgba(167, 139, 250, 0.16), transparent 34%),
    radial-gradient(circle at 50% 110%, rgba(255, 210, 122, 0.12), transparent 28%),
    linear-gradient(180deg, #090b12 0%, #0b1020 54%, #080a11 100%);
  overflow-x: hidden;
}
button, input { font: inherit; }
button { cursor: pointer; }
a { color: inherit; }

.shell {
  width: var(--shell);
  margin: 0 auto;
}

.screen {
  display: none;
}
.screen.active {
  display: block;
}

.boot-loader {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 100;
  pointer-events: none;
  transition: opacity 0.45s ease, visibility 0.45s ease;
}
.boot-loader.hidden {
  opacity: 0;
  visibility: hidden;
}
.boot-card {
  width: min(340px, calc(100vw - 32px));
  padding: 18px 18px 16px;
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(18,24,38,0.9), rgba(11,15,24,0.86));
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.28);
}
.boot-brand {
  color: var(--cyan);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  font-size: 12px;
  margin-bottom: 10px;
}
.boot-title {
  font-size: clamp(24px, 4vw, 34px);
  font-weight: 800;
}
.boot-sub {
  margin-top: 10px;
  color: var(--text-soft);
  line-height: 1.7;
}
.boot-progress {
  margin-top: 24px;
  height: 12px;
  border-radius: 999px;
  background: rgba(255,255,255,0.08);
  overflow: hidden;
}
.boot-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--cyan), var(--violet), var(--gold));
  border-radius: inherit;
  transition: width 0.2s ease;
}
.boot-text {
  margin-top: 14px;
  color: var(--text-soft);
  font-size: 14px;
}

.ambient,
.noise {
  position: fixed;
  inset: 0;
  pointer-events: none;
}
.ambient-a {
  background: radial-gradient(circle at 18% 22%, rgba(104,225,253,0.15), transparent 26%);
}
.ambient-b {
  background: radial-gradient(circle at 82% 18%, rgba(167,139,250,0.18), transparent 28%);
}
.noise {
  opacity: 0.08;
  background-image:
    linear-gradient(rgba(255,255,255,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.03) 1px, transparent 1px);
  background-size: 20px 20px;
  mask-image: radial-gradient(circle at center, black, transparent 95%);
}

.topbar {
  padding: 20px 0 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}
.brand-wrap {
  display: flex;
  align-items: center;
  gap: 14px;
}
.brand-mark {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  font-weight: 800;
  letter-spacing: 0.06em;
  background: linear-gradient(135deg, rgba(104,225,253,0.24), rgba(167,139,250,0.28));
  border: 1px solid rgba(255,255,255,0.12);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.06);
}
.brand-name {
  font-weight: 800;
  font-size: 18px;
}
.brand-sub {
  color: var(--text-soft);
  font-size: 13px;
  margin-top: 4px;
}
.top-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.main-shell {
  padding: 12px 0 40px;
}
.hero-grid,
.quiz-grid,
.result-grid {
  display: grid;
  gap: 20px;
}
.hero-grid {
  grid-template-columns: minmax(0, 1.65fr) minmax(320px, 0.85fr);
}
.quiz-grid {
  grid-template-columns: 0.92fr 1.08fr;
}
.result-grid {
  grid-template-columns: 0.95fr 1.05fr;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}
.panel-hero {
  padding: 34px;
  overflow: hidden;
  position: relative;
}
.panel-hero::after {
  content: "";
  position: absolute;
  width: 360px;
  height: 360px;
  right: -110px;
  top: -100px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(167,139,250,0.24), transparent 70%);
}
.hero-side,
.player-panel,
.choices-panel,
.result-main,
.result-side,
.round-panel {
  padding: 28px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--cyan);
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 11px;
  font-weight: 700;
}
.eyebrow.small {
  font-size: 10px;
}

h1, h2, h3, p { margin: 0; }
h1 {
  margin-top: 18px;
  max-width: 13ch;
  font-size: clamp(38px, 6vw, 72px);
  line-height: 0.98;
  letter-spacing: -0.04em;
}
h1 span {
  background: linear-gradient(90deg, var(--text), var(--gold));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.hero-desc {
  margin-top: 20px;
  max-width: 720px;
  font-size: 17px;
  line-height: 1.85;
  color: var(--text-soft);
}
.stat-row {
  margin-top: 26px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}
.stat-card,
.mini-stat {
  padding: 18px 16px;
  border-radius: 20px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.06);
}
.stat-num,
.mini-stat span {
  display: block;
  font-size: clamp(24px, 4vw, 34px);
  font-weight: 800;
}
.stat-label,
.mini-stat small {
  display: block;
  margin-top: 6px;
  color: var(--text-soft);
}
.hero-tags {
  margin-top: 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.hero-tags span,
.period-hint,
.question-badge,
.score-chip {
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
  color: var(--text-soft);
}
.hero-actions,
.result-actions {
  margin-top: 26px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.side-title {
  font-size: 20px;
  font-weight: 800;
  margin-bottom: 14px;
}
.rule-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 12px;
}
.rule-list li {
  color: var(--text-soft);
  line-height: 1.75;
  padding-left: 18px;
  position: relative;
}
.rule-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 11px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--cyan), var(--violet));
}
.rule-list.compact li { line-height: 1.65; }
.side-divider {
  height: 1px;
  background: var(--line);
  margin: 20px 0;
}

.primary-btn,
.secondary-btn,
.ghost-btn,
.play-btn,
.icon-btn {
  border: none;
  transition: transform 0.18s ease, background 0.18s ease, border-color 0.18s ease, opacity 0.18s ease;
}
.primary-btn:hover,
.secondary-btn:hover,
.ghost-btn:hover,
.play-btn:hover,
.icon-btn:hover {
  transform: translateY(-1px);
}
.primary-btn:active,
.secondary-btn:active,
.ghost-btn:active,
.play-btn:active,
.icon-btn:active {
  transform: translateY(0);
}
.primary-btn {
  min-height: 52px;
  padding: 0 22px;
  border-radius: 18px;
  color: #071018;
  font-weight: 800;
  background: linear-gradient(90deg, var(--gold), #fff0b9);
}
.primary-btn.wide { width: 100%; justify-content: center; }
.secondary-btn {
  min-height: 52px;
  padding: 0 22px;
  border-radius: 18px;
  color: var(--text);
  font-weight: 700;
  background: linear-gradient(135deg, rgba(104,225,253,0.18), rgba(167,139,250,0.18));
  border: 1px solid rgba(255,255,255,0.08);
}
.ghost-btn {
  min-height: 44px;
  padding: 0 16px;
  border-radius: 14px;
  background: rgba(255,255,255,0.03);
  color: var(--text-soft);
  border: 1px solid rgba(255,255,255,0.08);
}
.icon-btn {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: rgba(255,255,255,0.05);
  color: var(--text);
  font-size: 24px;
}
.btn-arrow {
  margin-left: 10px;
}

.quiz-stack {
  display: grid;
  gap: 20px;
}
.round-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}
.round-title {
  margin-top: 6px;
  font-size: 26px;
  font-weight: 800;
}
.round-progress,
.result-score-bar,
.clip-progress {
  width: 100%;
  height: 12px;
  border-radius: 999px;
  background: rgba(255,255,255,0.06);
  overflow: hidden;
}
.round-progress { margin-top: 18px; }
.round-fill,
.result-score-fill,
.clip-fill {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  transition: width 0.25s ease;
}
.round-fill {
  background: linear-gradient(90deg, var(--cyan), var(--violet));
}
.clip-fill {
  background: linear-gradient(90deg, var(--gold), var(--rose));
}
.result-score-fill {
  background: linear-gradient(90deg, var(--green), var(--cyan));
}

.player-panel {
  display: grid;
  gap: 24px;
  align-content: start;
}
.record-shell {
  display: grid;
  place-items: center;
  min-height: 320px;
  border-radius: 24px;
  background: radial-gradient(circle at 50% 50%, rgba(255,255,255,0.06), rgba(255,255,255,0.02));
  border: 1px solid rgba(255,255,255,0.06);
}
.record-disc {
  position: relative;
  width: min(260px, 72vw);
  aspect-ratio: 1;
  border-radius: 50%;
  background:
    radial-gradient(circle at center, #151822 0 18%, #090b12 18% 22%, transparent 22%),
    repeating-radial-gradient(circle at center, rgba(255,255,255,0.1) 0 2px, rgba(17,19,28,0.95) 2px 10px);
  border: 1px solid rgba(255,255,255,0.14);
  box-shadow: inset 0 0 0 12px rgba(255,255,255,0.02), 0 24px 60px rgba(0,0,0,0.32);
}
.record-disc.playing {
  animation: spin 3.2s linear infinite;
}
.disc-center {
  position: absolute;
  inset: 50%;
  width: 54px;
  height: 54px;
  margin: -27px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold), #ffeeb8);
  box-shadow: 0 0 0 12px rgba(9,11,18,0.9);
}
.disc-ring {
  position: absolute;
  inset: 10%;
  border-radius: 50%;
  border: 1px dashed rgba(255,255,255,0.14);
}
.ring-b { inset: 24%; }
@keyframes spin { from { transform: rotate(0deg);} to { transform: rotate(360deg);} }

.audio-area {
  display: grid;
  gap: 18px;
}
.audio-head,
.choices-head,
.feedback-head,
.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}
.audio-title,
.choices-head h2 {
  margin-top: 6px;
  font-size: clamp(24px, 4vw, 34px);
  line-height: 1.12;
}
.play-btn {
  width: 84px;
  height: 84px;
  justify-self: center;
  border-radius: 50%;
  font-size: 30px;
  color: #071018;
  background: linear-gradient(135deg, var(--cyan), var(--gold));
  box-shadow: 0 18px 34px rgba(104, 225, 253, 0.25);
}
.play-btn:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}
.audio-meta-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  color: var(--text-soft);
  font-size: 14px;
}
.audio-loading-bar {
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(104,225,253,0.15), rgba(255,255,255,0.3), rgba(167,139,250,0.15));
  background-size: 240% 100%;
  animation: shimmer 1s linear infinite;
}
.hidden { display: none !important; }
@keyframes shimmer {
  from { background-position: 0% 0; }
  to { background-position: 240% 0; }
}

.choices-panel {
  display: grid;
  gap: 22px;
  align-content: start;
}
.choices-box {
  display: grid;
  gap: 12px;
}
.choice-btn {
  width: 100%;
  text-align: left;
  padding: 18px 18px 18px 20px;
  border-radius: 18px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.08);
  color: var(--text);
}
.choice-btn:hover {
  background: rgba(255,255,255,0.06);
  border-color: rgba(255,255,255,0.14);
}
.choice-btn strong {
  display: block;
  font-size: 18px;
}
.choice-btn small {
  display: block;
  margin-top: 6px;
  color: var(--text-soft);
}
.choice-btn.correct {
  background: rgba(116, 244, 191, 0.12);
  border-color: rgba(116, 244, 191, 0.55);
}
.choice-btn.wrong {
  background: rgba(255, 122, 151, 0.12);
  border-color: rgba(255, 122, 151, 0.48);
}
.choice-btn.locked {
  opacity: 0.74;
  cursor: default;
}

.feedback-card {
  padding: 22px;
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(255,255,255,0.05), rgba(255,255,255,0.025));
  border: 1px solid rgba(255,255,255,0.08);
}
.feedback-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  font-size: 20px;
  font-weight: 900;
  color: #071018;
  background: linear-gradient(135deg, var(--green), #b8ffe6);
}
.feedback-mark.bad {
  background: linear-gradient(135deg, var(--danger), #ffcfda);
}
.feedback-title {
  font-size: 20px;
  font-weight: 800;
}
.feedback-subtitle {
  margin-top: 4px;
  color: var(--text-soft);
}
.feedback-body {
  margin-top: 16px;
  display: grid;
  gap: 10px;
}
.feedback-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  color: var(--text-soft);
}
.feedback-row strong {
  color: var(--text);
  text-align: right;
}
.feedback-note {
  margin-top: 10px;
  color: var(--text-soft);
  line-height: 1.8;
}

.result-main,
.result-side {
  align-content: start;
}
.result-summary {
  margin-top: 14px;
  color: var(--text-soft);
  line-height: 1.8;
}
.result-score-wrap {
  margin-top: 28px;
}
.result-score {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}
.result-score span {
  font-size: clamp(64px, 10vw, 110px);
  line-height: 0.9;
  font-weight: 900;
}
.result-score small {
  font-size: 28px;
  color: var(--text-soft);
  padding-bottom: 12px;
}
.result-score-bar {
  margin-top: 18px;
}
.beat-text {
  margin-top: 18px;
  font-size: 18px;
  font-weight: 700;
  color: var(--gold);
}
.review-list {
  margin-top: 16px;
  display: grid;
  gap: 12px;
}
.review-item {
  padding: 16px;
  border-radius: 18px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.07);
}
.review-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}
.review-top strong { font-size: 16px; }
.review-tag {
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  border: 1px solid rgba(255,255,255,0.08);
}
.review-tag.good { color: var(--green); }
.review-tag.bad { color: var(--danger); }
.review-meta,
.review-desc {
  margin-top: 8px;
  color: var(--text-soft);
  line-height: 1.7;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(5, 7, 12, 0.72);
  backdrop-filter: blur(14px);
}
.modal.active { display: flex; }
.modal-card {
  width: min(680px, calc(100vw - 24px));
  max-height: min(86vh, 920px);
  overflow: auto;
  padding: 24px;
  border-radius: 24px;
  background: var(--panel-strong);
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow: var(--shadow);
}
.modal-card.large { width: min(900px, calc(100vw - 24px)); }
.modal-card.small { width: min(460px, calc(100vw - 24px)); }
.modal-copy {
  margin-top: 16px;
  color: var(--text-soft);
  line-height: 1.85;
}
.modal-copy ul { padding-left: 18px; }
.board-stats {
  margin-top: 18px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0,1fr));
  gap: 12px;
}
.board-list,
.source-list {
  margin-top: 18px;
  display: grid;
  gap: 10px;
}
.board-item,
.source-item {
  padding: 16px;
  border-radius: 18px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.06);
}
.board-item {
  display: grid;
  grid-template-columns: 64px 1fr auto;
  align-items: center;
  gap: 12px;
}
.board-rank {
  font-size: 24px;
  font-weight: 900;
  color: var(--gold);
}
.board-name {
  font-weight: 700;
}
.board-meta,
.source-item small {
  display: block;
  margin-top: 4px;
  color: var(--text-soft);
}
.board-score {
  font-size: 28px;
  font-weight: 900;
}
.source-item strong {
  display: block;
  margin-bottom: 6px;
}
.name-input {
  width: 100%;
  margin: 12px 0 14px;
  min-height: 52px;
  padding: 0 16px;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.04);
  color: var(--text);
}
.name-input:focus {
  outline: none;
  border-color: rgba(104,225,253,0.65);
  box-shadow: 0 0 0 4px rgba(104,225,253,0.12);
}

@media (max-width: 980px) {
  .hero-grid,
  .quiz-grid,
  .result-grid {
    grid-template-columns: 1fr;
  }
  .panel-hero,
  .hero-side,
  .player-panel,
  .choices-panel,
  .result-main,
  .result-side,
  .round-panel {
    padding: 22px;
  }
  .topbar {
    flex-direction: column;
    align-items: stretch;
  }
  .top-actions {
    justify-content: flex-start;
  }
  .record-shell {
    min-height: 260px;
  }
}

@media (max-width: 640px) {
  :root { --shell: calc(100vw - 20px); }
  .stat-row,
  .board-stats {
    grid-template-columns: 1fr;
  }
  .round-top,
  .audio-head,
  .choices-head,
  .feedback-head,
  .modal-head,
  .board-item,
  .feedback-row {
    grid-template-columns: 1fr;
    display: grid;
  }
  .hero-actions,
  .result-actions {
    flex-direction: column;
  }
  .primary-btn,
  .secondary-btn,
  .ghost-btn {
    width: 100%;
  }
  .board-item {
    grid-template-columns: 1fr;
  }
  .board-score {
    font-size: 22px;
  }
}
