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

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

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;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.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;
}

.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;
}

.pager {
  font-family: ui-monospace, "JetBrains Mono", Consolas, monospace;
  color: var(--cyan);
  letter-spacing: 2px;
  font-size: 15px;
}
.pager i { font-style: normal; color: var(--muted); margin: 0 4px; }

/* ---------- deck / slides ---------- */
main {
  flex: 1;
  position: relative;
}

.slide {
  position: absolute;
  inset: 0;
  padding: 34px 56px 40px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(18px);
  transition: opacity 0.45s ease, transform 0.45s ease;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.slide.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.slide-head {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 26px;
  flex-shrink: 0;
}

.slide-index {
  font-family: ui-monospace, Consolas, monospace;
  color: var(--cyan);
  border: 1px solid var(--line);
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 15px;
  background: var(--panel);
  box-shadow: 0 0 14px rgba(34, 211, 238, 0.15);
}

.slide-head h2 {
  font-size: 30px;
  letter-spacing: 3px;
  background: linear-gradient(90deg, var(--text), var(--cyan));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ---------- cover ---------- */
.cover-slide {
  justify-content: center;
  align-items: center;
  text-align: center;
}

.cover-grid-bg {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(59,130,246,0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(59,130,246,0.08) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse at center, #000 30%, transparent 72%);
}

.cover-inner {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 46px;
  flex-wrap: wrap;
  justify-content: center;
}

.cover-avatar {
  width: 190px;
  height: 190px;
  border-radius: 18px;
  border: 2px solid var(--cyan);
  box-shadow: 0 0 34px rgba(34, 211, 238, 0.4), inset 0 0 24px rgba(34,211,238,0.15);
  background: var(--panel);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 64px;
  color: var(--cyan);
  overflow: hidden;
  flex-shrink: 0;
}

.cover-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cover-text { max-width: 640px; text-align: left; }

.tagline {
  display: inline-block;
  color: var(--cyan);
  letter-spacing: 6px;
  font-size: 14px;
  border: 1px solid var(--line);
  padding: 6px 16px;
  border-radius: 999px;
  margin-bottom: 18px;
  background: rgba(34, 211, 238, 0.08);
}

#personName {
  font-size: 58px;
  line-height: 1.15;
  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: 10px;
}

.subtitle {
  color: var(--cyan);
  font-size: 19px;
  letter-spacing: 2px;
  margin-bottom: 18px;
}

.intro {
  color: var(--muted);
  font-size: 17px;
  line-height: 1.9;
}

.cover-tags {
  margin-top: 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.cover-tags span {
  font-size: 13px;
  border: 1px solid var(--line);
  color: var(--blue);
  background: rgba(59, 130, 246, 0.1);
  padding: 5px 14px;
  border-radius: 999px;
}

.start-btn {
  position: relative;
  z-index: 3;
  margin-top: 40px;
  font-size: 19px;
  padding: 14px 42px;
  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);
}

.cover-actions {
  position: relative;
  z-index: 3;
  margin-top: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
}

.cover-actions .start-btn { margin-top: 0; }

.quiz-entry-btn {
  font-size: 17px;
  padding: 13px 34px;
  border-radius: 999px;
  border: 1px solid var(--violet);
  background: rgba(167, 139, 250, 0.12);
  color: var(--violet);
  cursor: pointer;
  letter-spacing: 3px;
  text-decoration: none;
  box-shadow: 0 0 18px rgba(167, 139, 250, 0.25);
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.quiz-entry-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 30px rgba(167, 139, 250, 0.5);
  background: rgba(167, 139, 250, 0.22);
}

/* ---------- stats ---------- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 20px;
  align-content: center;
  flex: 1;
}

.stat-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 26px 24px;
  position: relative;
  overflow: hidden;
  transition: transform 0.2s ease;
}

.stat-card:hover { transform: translateY(-4px); }

.stat-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--cyan), var(--violet));
}

.stat-num {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 46px;
  font-weight: 700;
  color: var(--cyan);
  text-shadow: 0 0 18px rgba(34, 211, 238, 0.45);
}

.stat-unit { font-size: 22px; color: var(--violet); margin-left: 4px; }

.stat-label { color: var(--muted); font-size: 15px; margin-top: 8px; letter-spacing: 1px; }

.stat-desc { color: var(--text); font-size: 14px; margin-top: 10px; line-height: 1.6; opacity: 0.85; }

/* ---------- timeline ---------- */
.timeline {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 18px;
  justify-content: center;
  max-width: 980px;
  margin: 0 auto;
  width: 100%;
}

.timeline-item {
  display: flex;
  gap: 22px;
  align-items: flex-start;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px 24px;
  position: relative;
}

.timeline-year {
  font-family: ui-monospace, Consolas, monospace;
  color: var(--cyan);
  font-size: 24px;
  font-weight: 700;
  min-width: 108px;
  border-right: 1px dashed var(--line);
  padding-right: 18px;
  text-shadow: 0 0 12px rgba(34, 211, 238, 0.4);
}

.timeline-text { font-size: 16px; line-height: 1.75; color: var(--text); }

.timeline-text b { color: var(--blue); }

/* ---------- story ---------- */
.story-body {
  flex: 1;
  max-width: 980px;
  margin: 0 auto;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 22px;
  justify-content: center;
}

.story-para {
  font-size: 18px;
  line-height: 2.05;
  text-align: justify;
  color: var(--text);
  padding: 20px 26px;
  background: var(--panel);
  border-left: 4px solid var(--cyan);
  border-radius: 0 12px 12px 0;
}

.story-para:nth-child(2n) { border-left-color: var(--violet); }

/* ---------- quote ---------- */
.quote-slide {
  justify-content: center;
  align-items: center;
  text-align: center;
}

.quote-wrap {
  position: relative;
  max-width: 900px;
  padding: 40px 30px 30px;
}

.quote-mark {
  font-family: Georgia, serif;
  font-size: 120px;
  color: var(--cyan);
  opacity: 0.55;
  line-height: 1;
  display: block;
  height: 60px;
  text-shadow: 0 0 26px rgba(34, 211, 238, 0.6);
}

.quote-text {
  font-size: 38px;
  line-height: 1.6;
  letter-spacing: 2px;
  background: linear-gradient(120deg, #fff, var(--cyan));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  margin: 10px 0 24px;
}

.quote-author { color: var(--violet); font-size: 18px; letter-spacing: 3px; }

/* ---------- end ---------- */
.end-slide {
  justify-content: center;
  align-items: center;
  text-align: center;
}

.end-inner { max-width: 760px; }

.end-inner h2 {
  font-size: 44px;
  letter-spacing: 5px;
  margin-bottom: 22px;
  background: linear-gradient(100deg, var(--cyan), var(--violet));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.end-inner p { font-size: 20px; line-height: 2; color: var(--muted); }

.end-sign {
  margin-top: 44px;
  font-family: ui-monospace, Consolas, monospace;
  color: var(--cyan);
  letter-spacing: 4px;
  font-size: 13px;
  opacity: 0.7;
}

/* ---------- control bar ---------- */
.controlbar {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
  padding: 12px 26px;
  border-top: 1px solid var(--line);
  background: rgba(7, 11, 22, 0.6);
  backdrop-filter: blur(6px);
  z-index: 50;
}

.nav-btns { display: flex; 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;
  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);
}

.cbtn.playing { border-color: var(--ok); color: var(--ok); }

.speech-controls {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  font-size: 13px;
  color: var(--muted);
}

.speech-controls label { display: flex; align-items: center; gap: 8px; }

.speech-controls input[type="range"] { width: 92px; accent-color: var(--cyan); }

#voiceSelect {
  background: var(--bg2);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px 8px;
  font-size: 13px;
  max-width: 220px;
}

.voice-btns {
  display: flex;
  gap: 6px;
}

.vbtn.active {
  border-color: var(--violet);
  color: var(--violet);
  background: rgba(167, 139, 250, 0.18);
  box-shadow: 0 0 12px rgba(167, 139, 250, 0.3);
}

.lang-btn {
  border-color: var(--cyan);
  color: var(--cyan);
  background: rgba(34, 211, 238, 0.1);
  letter-spacing: 1px;
}

.lang-btn:hover { background: rgba(34, 211, 238, 0.2); }

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

.qr-btn {
  border-color: var(--violet);
  color: var(--violet);
  background: rgba(167, 139, 250, 0.1);
  font-size: 13px;
  padding: 7px 14px;
}

.qr-btn:hover { background: rgba(167, 139, 250, 0.2); }

.qr-modal {
  position: fixed;
  inset: 0;
  background: rgba(3, 6, 14, 0.72);
  backdrop-filter: blur(3px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 200;
}

.qr-modal.show { display: flex; }

.qr-modal-box {
  background: #fff;
  padding: 26px 32px 22px;
  border-radius: 16px;
  text-align: center;
  max-width: 90vw;
  box-shadow: 0 0 40px rgba(34, 211, 238, 0.25);
}

.qr-modal-box h3 {
  color: #0b1226;
  font-size: 18px;
  letter-spacing: 2px;
  margin-bottom: 16px;
}

.qr-modal-box img {
  width: 260px;
  height: 260px;
  display: block;
  margin: 0 auto;
}

.qr-modal-box p {
  color: #44506b;
  font-size: 11px;
  margin: 12px 0 16px;
  word-break: break-all;
  max-width: 300px;
}

.status {
  margin-left: auto;
  font-size: 13px;
  color: var(--muted);
  font-family: ui-monospace, Consolas, monospace;
  letter-spacing: 1px;
}

.status.on { color: var(--ok); }
.status.err { color: var(--danger); }

/* ---------- responsive ---------- */
@media (max-width: 820px) {
  .slide { padding: 22px 22px 30px; }
  .cover-inner { flex-direction: column; gap: 20px; }
  .cover-text { text-align: center; }
  #personName { font-size: 40px; }
  .quote-text { font-size: 26px; }
  .controlbar { gap: 12px; }
  .speech-controls { display: none; }
}
