* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg: #070b16;
  --panel: rgba(20, 30, 55, 0.72);
  --line: rgba(64, 128, 255, 0.28);
  --cyan: #22d3ee;
  --blue: #3b82f6;
  --violet: #a78bfa;
  --text: #eaf2ff;
  --muted: #8ba0c8;
  --ok: #34d399;
  --danger: #f87171;
}

html, body {
  height: 100%;
}

body {
  background: radial-gradient(1200px 700px at 70% -10%, #12244a 0%, var(--bg) 55%) fixed;
  color: var(--text);
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.scanlines {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 60;
  background: repeating-linear-gradient(0deg, rgba(255,255,255,0.015) 0 1px, transparent 1px 3px);
  mix-blend-mode: overlay;
}

/* ---------- top bar ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 26px;
  border-bottom: 1px solid var(--line);
  background: rgba(7, 11, 22, 0.55);
  backdrop-filter: blur(6px);
  z-index: 50;
  flex-wrap: wrap;
  gap: 10px;
}

.brand {
  font-weight: 700;
  letter-spacing: 2px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 16px;
}

.brand-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 12px var(--cyan);
  animation: pulse 1.6s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

.brand em {
  font-style: normal;
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 3px;
}

.topbar-right { display: flex; align-items: center; gap: 10px; }

.cbtn {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  padding: 9px 18px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  letter-spacing: 1px;
  text-decoration: none;
  display: inline-block;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.cbtn:hover { border-color: var(--cyan); background: rgba(34, 211, 238, 0.12); }

.cbtn.primary {
  border-color: var(--cyan);
  color: #fff;
  background: linear-gradient(90deg, rgba(34,211,238,0.3), rgba(59,130,246,0.3));
  box-shadow: 0 0 14px rgba(34, 211, 238, 0.25);
}

.qr-btn { border-color: var(--violet); color: var(--violet); background: rgba(167,139,250,0.1); }
.qr-btn:hover { background: rgba(167, 139, 250, 0.2); }
.back-btn { border-color: var(--cyan); color: var(--cyan); }

/* ---------- main ---------- */
main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 30px 24px;
  position: relative;
}

.quiz-page { width: 100%; max-width: 820px; }

.hidden { display: none !important; }

/* ---------- start ---------- */
.start-box {
  text-align: center;
  padding: 50px 30px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 0 40px rgba(34, 211, 238, 0.12);
}

.quiz-badge {
  width: 72px;
  height: 72px;
  margin: 0 auto 20px;
  border-radius: 18px;
  border: 2px solid var(--cyan);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 1px;
  color: var(--cyan);
  text-shadow: 0 0 16px rgba(34, 211, 238, 0.6);
  box-shadow: 0 0 22px rgba(34, 211, 238, 0.35);
}

.start-box h1 {
  font-size: 38px;
  letter-spacing: 4px;
  background: linear-gradient(100deg, #fff 20%, var(--cyan) 60%, var(--violet));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  margin-bottom: 14px;
}

.quiz-subtitle { color: var(--muted); font-size: 16px; letter-spacing: 1px; }
.quiz-hint { color: var(--cyan); font-size: 13px; margin: 12px 0 30px; letter-spacing: 2px; }

.start-btn {
  font-size: 19px;
  padding: 14px 46px;
  border-radius: 999px;
  border: 1px solid var(--cyan);
  background: linear-gradient(90deg, rgba(34,211,238,0.25), rgba(59,130,246,0.25));
  color: #fff;
  cursor: pointer;
  letter-spacing: 4px;
  box-shadow: 0 0 22px rgba(34, 211, 238, 0.35);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.start-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 34px rgba(34, 211, 238, 0.55);
}

/* ---------- quiz ---------- */
.quiz-progress {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 22px;
}

.quiz-progress span {
  font-family: ui-monospace, Consolas, monospace;
  color: var(--cyan);
  font-size: 15px;
  min-width: 52px;
}

.progress-bar {
  flex: 1;
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--cyan), var(--violet));
  box-shadow: 0 0 10px rgba(34, 211, 238, 0.6);
  transition: width 0.4s ease;
}

.question-box {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 34px 36px;
}

.question-text {
  font-size: 24px;
  line-height: 1.6;
  letter-spacing: 1px;
  margin-bottom: 24px;
}

.options {
  display: grid;
  gap: 14px;
}

.option {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 15px 20px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  cursor: pointer;
  font-size: 16px;
  color: var(--text);
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.1s ease;
  text-align: left;
}

.option:hover { border-color: var(--cyan); background: rgba(34, 211, 238, 0.08); }

.option .opt-key {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: ui-monospace, Consolas, monospace;
  font-size: 14px;
  color: var(--cyan);
  flex-shrink: 0;
}

.option.selected { border-color: var(--cyan); background: rgba(34, 211, 238, 0.12); }

.option.correct {
  border-color: var(--ok);
  background: rgba(52, 211, 153, 0.12);
  box-shadow: 0 0 14px rgba(52, 211, 153, 0.25);
}
.option.correct .opt-key { color: var(--ok); border-color: var(--ok); }

.option.wrong {
  border-color: var(--danger);
  background: rgba(248, 113, 113, 0.1);
}
.option.wrong .opt-key { color: var(--danger); border-color: var(--danger); }

.option.disabled { pointer-events: none; }

.explain {
  margin-top: 20px;
  padding: 14px 18px;
  border-left: 4px solid var(--violet);
  border-radius: 0 10px 10px 0;
  background: rgba(167, 139, 250, 0.08);
  color: var(--muted);
  font-size: 14px;
  line-height: 1.8;
}

.quiz-actions {
  margin-top: 24px;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

/* ---------- result ---------- */
.result-box {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 40px 36px;
  text-align: center;
}

.result-box h1 {
  font-size: 46px;
  font-family: ui-monospace, Consolas, monospace;
  color: var(--cyan);
  text-shadow: 0 0 20px rgba(34, 211, 238, 0.5);
}

.verdict {
  font-size: 18px;
  color: var(--text);
  letter-spacing: 1px;
  margin: 14px 0 28px;
}

.review {
  text-align: left;
  display: grid;
  gap: 12px;
  margin-bottom: 30px;
  max-height: 46vh;
  overflow-y: auto;
}

.review-item {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px 18px;
  background: rgba(255, 255, 255, 0.03);
}

.review-item .r-q { font-size: 15px; color: var(--text); margin-bottom: 8px; line-height: 1.6; }

.review-item .r-line {
  font-size: 13px;
  line-height: 1.8;
  color: var(--muted);
}

.review-item .r-line b { color: var(--ok); }
.review-item .r-line .miss { color: var(--danger); }

.result-actions {
  display: flex;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
}

/* ---------- responsive ---------- */
@media (max-width: 720px) {
  .start-box h1 { font-size: 28px; }
  .question-box { padding: 24px 20px; }
  .question-text { font-size: 19px; }
  .topbar { padding: 10px 16px; }
}
