:root {
  --bg: #08060c;
  --gold: #e8c36b;
  --cyan: #00f5ff;
  --magenta: #ff007f;
  --acid: #ccff00;
  --ivory: #f6f1e7;
  --hud-bg: rgba(10, 8, 18, 0.86);
  --font-serif: "Songti SC", "STSong", "SimSun", Georgia, serif;
  --font-sans: "PingFang SC", "Microsoft YaHei", "Segoe UI", system-ui, sans-serif;
  --font-mono: "Consolas", "Cascadia Code", monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  width: 100%;
  height: 100%;
  height: 100dvh;
  overflow: hidden;
  background: var(--bg);
  color: var(--ivory);
  font-family: var(--font-sans);
  user-select: none;
  -webkit-font-smoothing: antialiased;
}

#app {
  position: relative;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background: #08060c;
}

#stage {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: manipulation;
}

.film-vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 4;
  background: radial-gradient(circle at 50% 50%, rgba(0, 0, 0, 0) 64%, rgba(4, 2, 8, 0.42) 100%);
}

/* 顶部状态微件 */
.top-bar {
  position: absolute;
  top: max(10px, env(safe-area-inset-top));
  left: 14px;
  right: 14px;
  z-index: 12;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  transition: opacity 0.45s ease;
}

.top-bar.dimmed {
  opacity: 0.28;
}

.top-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 10px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  background: rgba(10, 8, 18, 0.74);
  border: 1px solid rgba(232, 195, 107, 0.42);
  color: var(--gold);
  backdrop-filter: blur(8px);
  white-space: nowrap;
}

.top-chip-audio {
  border-color: rgba(204, 255, 0, 0.45);
  color: var(--acid);
}

.rec-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--magenta);
  box-shadow: 0 0 8px var(--magenta);
  animation: recBlink 1s infinite alternate;
}

@keyframes recBlink {
  from { opacity: 0.45; }
  to { opacity: 1; }
}

/* 开机博物馆极繁启动封面（桌面+手机全屏优雅适配） */
.launch-overlay {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  overflow-y: auto;
  background: radial-gradient(circle at center, rgba(24, 16, 36, 0.78) 0%, rgba(6, 4, 10, 0.94) 100%);
  backdrop-filter: blur(8px);
  transition: opacity 0.45s ease, transform 0.45s ease;
}

.launch-overlay.closing {
  opacity: 0;
  transform: scale(1.04);
  pointer-events: none;
}

.launch-overlay.hidden {
  display: none;
}

.launch-card {
  position: relative;
  width: min(780px, 95vw);
  margin: auto;
  padding: 28px 32px 22px;
  background: linear-gradient(155deg, rgba(22, 16, 30, 0.96), rgba(10, 7, 16, 0.98));
  border: 2px solid var(--gold);
  box-shadow:
    0 0 0 1px rgba(255, 0, 127, 0.35),
    6px 6px 0 var(--magenta),
    -5px -5px 0 var(--cyan),
    0 24px 64px rgba(0, 0, 0, 0.85);
  text-align: center;
  overflow: hidden;
}

.museum-tape {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 7px;
  background: repeating-linear-gradient(
    -45deg,
    var(--gold),
    var(--gold) 12px,
    #120b1c 12px,
    #120b1c 24px
  );
}

.launch-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.badge-gold {
  padding: 3px 10px;
  background: var(--gold);
  color: #0b0710;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.06em;
}

.badge-mono {
  font-family: var(--font-mono);
  font-size: 11px;
  color: rgba(246, 241, 231, 0.72);
}

.title-block {
  position: relative;
  margin: 8px 0 12px;
}

.title-67-bg {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -52%);
  font-family: "Arial Black", Impact, sans-serif;
  font-size: clamp(72px, 16vw, 150px);
  font-weight: 900;
  color: rgba(232, 195, 107, 0.08);
  pointer-events: none;
  line-height: 1;
}

.title-main {
  position: relative;
  font-family: var(--font-serif);
  font-size: clamp(26px, 5.5vw, 52px);
  font-weight: 900;
  letter-spacing: 0.05em;
  line-height: 1.2;
  background: linear-gradient(90deg, #fff8e7 0%, var(--gold) 45%, var(--cyan) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.title-en {
  position: relative;
  margin-top: 6px;
  font-family: var(--font-mono);
  font-size: clamp(10px, 1.5vw, 13px);
  letter-spacing: 0.12em;
  color: var(--cyan);
}

.launch-desc {
  max-width: 650px;
  margin: 0 auto 16px;
  font-size: 13.5px;
  line-height: 1.68;
  color: rgba(246, 241, 231, 0.88);
}

.launch-desc strong {
  color: var(--acid);
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 18px;
}

.feat-item {
  padding: 8px 6px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(232, 195, 107, 0.25);
  font-size: 11.5px;
  color: rgba(246, 241, 231, 0.82);
}

.feat-item b {
  display: block;
  margin-bottom: 2px;
  font-size: 12.5px;
  color: var(--gold);
}

.launch-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.btn-launch {
  width: min(100%, 480px);
  padding: 13px 22px;
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 800;
  color: #09060e;
  background: linear-gradient(90deg, var(--gold), #fff1b8, var(--cyan));
  border: 2px solid #ffffff;
  box-shadow: 0 0 28px rgba(232, 195, 107, 0.45), 4px 4px 0 var(--magenta);
  cursor: pointer;
  transition: transform 0.14s ease, box-shadow 0.14s ease;
}

.btn-launch:hover {
  transform: translate(-2px, -2px);
  box-shadow: 0 0 36px rgba(0, 245, 255, 0.65), 6px 6px 0 var(--magenta);
}

.btn-sub-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 700;
  color: var(--cyan);
  text-decoration: none;
  border: 1px solid rgba(0, 245, 255, 0.42);
  background: rgba(0, 245, 255, 0.08);
}

.btn-sub-link:hover {
  background: rgba(0, 245, 255, 0.2);
}

.launch-keys {
  margin-top: 14px;
  font-size: 11.5px;
  color: rgba(246, 241, 231, 0.6);
}

.launch-keys kbd {
  display: inline-block;
  padding: 1px 6px;
  margin: 0 2px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--gold);
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(232, 195, 107, 0.35);
}

/* 结语浮层操作栏 */
.finale-actions {
  position: absolute;
  left: 50%;
  bottom: calc(114px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 26;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  width: min(92vw, 620px);
  gap: 10px;
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.finale-actions.hidden {
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 16px);
}

.finale-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  border: 2px solid;
  backdrop-filter: blur(10px);
}

.finale-replay {
  background: rgba(12, 9, 20, 0.88);
  color: var(--gold);
  border-color: var(--gold);
}

.finale-fireworks {
  background: linear-gradient(90deg, rgba(255, 0, 127, 0.92), rgba(255, 90, 0, 0.92));
  color: #ffffff;
  border-color: var(--acid);
  box-shadow: 0 0 22px rgba(255, 0, 127, 0.5), 3px 3px 0 var(--acid);
}

/* 16 年代速览抽屉 */
.era-drawer {
  position: absolute;
  left: 50%;
  bottom: calc(102px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: min(900px, calc(100vw - 20px));
  max-height: 56dvh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  z-index: 28;
  padding: 12px 14px;
  background: rgba(10, 8, 18, 0.94);
  border: 1px solid rgba(232, 195, 107, 0.52);
  border-radius: 12px;
  backdrop-filter: blur(16px);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.82);
}

.era-drawer.hidden {
  display: none;
}

.era-drawer-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  font-size: 12px;
  font-weight: 700;
  color: var(--gold);
  position: sticky;
  top: 0;
  background: rgba(10, 8, 18, 0.96);
  padding-bottom: 6px;
}

.era-drawer-close {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.78);
  cursor: pointer;
  font-size: 12px;
  padding: 2px 6px;
}

.era-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 6px;
}

.era-btn {
  padding: 7px 8px;
  text-align: left;
  font-family: var(--font-sans);
  font-size: 11px;
  color: rgba(246, 241, 231, 0.88);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.14s ease;
}

.era-btn b {
  display: block;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--gold);
  margin-bottom: 2px;
}

.era-btn:hover {
  border-color: var(--cyan);
  background: rgba(0, 245, 255, 0.12);
}

.era-btn.active {
  background: rgba(232, 195, 107, 0.24);
  border-color: var(--gold);
  color: #ffffff;
}

/* 底部控制栏（固定在动态视口底部安全区，进度条醒目易拖动！） */
.hud {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: calc(10px + env(safe-area-inset-bottom));
  z-index: 25;
  padding: 8px 14px 10px;
  background: var(--hud-bg);
  border: 1px solid rgba(232, 195, 107, 0.38);
  border-radius: 12px;
  backdrop-filter: blur(12px);
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.65);
  transition: opacity 0.35s ease, transform 0.35s ease;
}

.hud.hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateY(16px);
}

.hud.idle {
  opacity: 0.24;
}

.hud:hover,
.hud:focus-within {
  opacity: 1 !important;
}

.timeline-row {
  position: relative;
  margin-bottom: 7px;
}

.timeline-wrap {
  position: relative;
  height: 24px;
  display: flex;
  align-items: center;
  cursor: pointer;
  touch-action: none;
}

.timeline-track {
  position: relative;
  width: 100%;
  height: 7px;
  background: rgba(255, 255, 255, 0.18);
  border-radius: 999px;
}

.timeline-progress {
  width: 0%;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--gold), var(--magenta), var(--cyan));
}

.timeline-thumb {
  position: absolute;
  top: 50%;
  left: 0%;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--gold);
  border: 2px solid #08060c;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 10px var(--gold);
}

.timeline-markers {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.timeline-marker {
  position: absolute;
  top: 7px;
  bottom: 7px;
  width: 1.5px;
  background: rgba(255, 255, 255, 0.44);
}

.timeline-tooltip {
  position: absolute;
  bottom: 28px;
  transform: translateX(-50%);
  padding: 3px 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  background: #0d0916;
  color: var(--gold);
  border: 1px solid var(--gold);
  border-radius: 4px;
  pointer-events: none;
}

.timeline-tooltip.hidden {
  display: none;
}

.controls-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.controls-left,
.controls-center,
.controls-right {
  display: flex;
  align-items: center;
  gap: 6px;
}

.hud-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 5px 10px;
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 700;
  color: var(--ivory);
  background: rgba(255, 255, 255, 0.09);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 6px;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.14s ease;
}

.hud-btn:hover {
  border-color: var(--gold);
  color: var(--gold);
}

.hud-btn.active {
  background: rgba(0, 245, 255, 0.18);
  border-color: var(--cyan);
  color: var(--cyan);
}

.hud-btn-primary {
  background: rgba(232, 195, 107, 0.22);
  border-color: var(--gold);
  color: var(--gold);
}

.hud-btn-icon {
  min-width: 30px;
  padding: 5px 7px;
}

.hud-btn-sfx.active {
  background: rgba(0, 245, 255, 0.16);
  border-color: var(--cyan);
  color: var(--cyan);
}

.hud-btn-fireworks {
  background: linear-gradient(90deg, rgba(255, 0, 127, 0.88), rgba(255, 90, 0, 0.88));
  border-color: var(--acid);
  color: #ffffff;
}

.hud-btn-fireworks:hover {
  color: #ffffff;
  box-shadow: 0 0 14px rgba(255, 0, 127, 0.55);
}

.time-display {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  color: var(--gold);
  min-width: 108px;
}

.volume-slider {
  width: 64px;
  accent-color: var(--gold);
  cursor: pointer;
}

/* ---------------- 深度手机竖屏与窄屏响应式适配 ---------------- */
@media (max-width: 820px) {
  /* 手机端永不自动淡隐进度条与控制栏！ */
  .hud.idle {
    opacity: 1 !important;
  }

  .top-bar {
    display: none;
  }

  .launch-overlay {
    padding: 10px;
    align-items: flex-start;
  }

  .launch-card {
    width: 100%;
    padding: 18px 14px 16px;
    box-shadow: 4px 4px 0 var(--magenta), -3px -3px 0 var(--cyan), 0 16px 40px rgba(0, 0, 0, 0.85);
  }

  .launch-meta {
    justify-content: center;
    margin-bottom: 6px;
  }

  .badge-mono,
  .launch-keys {
    display: none;
  }

  .title-main {
    font-size: 26px;
  }

  .launch-desc {
    font-size: 12.5px;
    line-height: 1.55;
    margin-bottom: 12px;
  }

  .feature-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    margin-bottom: 14px;
  }

  .feat-item {
    padding: 6px 4px;
    font-size: 11px;
  }

  .btn-launch {
    font-size: 13.5px;
    padding: 11px 12px;
  }

  .hud {
    left: 8px;
    right: 8px;
    bottom: calc(8px + env(safe-area-inset-bottom));
    padding: 6px 10px 8px;
    border-radius: 10px;
  }

  .timeline-row {
    margin-bottom: 6px;
  }

  .timeline-wrap {
    height: 30px; /* 加大手机手指触摸热区，一摸就拖！ */
  }

  .timeline-track {
    height: 8px;
  }

  .timeline-thumb {
    width: 16px;
    height: 16px;
  }

  .controls-row {
    gap: 5px;
    justify-content: space-between;
  }

  .controls-left,
  .controls-center,
  .controls-right {
    gap: 4px;
  }

  .hud-btn {
    padding: 5px 7px;
    font-size: 11px;
  }

  .hud-btn-icon {
    min-width: 28px;
    padding: 5px 6px;
  }

  .time-display {
    font-size: 10.5px;
    min-width: 82px;
  }

  .volume-slider,
  #btn-fullscreen,
  #btn-replay {
    display: none;
  }

  .era-drawer {
    bottom: calc(118px + env(safe-area-inset-bottom));
    max-height: 52dvh;
    padding: 10px;
  }

  .era-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 5px;
  }

  .finale-actions {
    bottom: calc(148px + env(safe-area-inset-bottom));
  }
}

@media (max-width: 520px) {
  html,
  body,
  #app {
    max-width: 100vw;
    overflow-x: hidden;
  }

  .hud {
    left: 6px;
    right: 6px;
    padding: 6px 8px 8px;
  }

  .controls-row {
    gap: 6px;
  }

  .controls-left {
    width: 100%;
    justify-content: space-between;
  }

  .controls-center {
    flex: 1;
    justify-content: flex-start;
  }

  .controls-right {
    justify-content: flex-end;
  }

  .time-display {
    margin-left: auto;
    text-align: right;
  }

  .era-drawer {
    bottom: calc(142px + env(safe-area-inset-bottom));
  }
}
