/* 编辑式纪录片 HUD —— 严禁毛玻璃、卡片框、阴影与高饱和霓虹 */

:root {
  --bg: #040507;
  --ink: #f2f4f7;
  --ink-body: rgba(242, 244, 247, 0.80);
  --ink-dim: rgba(242, 244, 247, 0.52);
  --ink-faint: rgba(242, 244, 247, 0.30);
  --line: rgba(220, 228, 240, 0.16);
  --ice: #6fb2e6;
  --sans: "Helvetica Neue", "Noto Sans SC", "PingFang SC", -apple-system, sans-serif;
  --serif: "Cormorant Garamond", "Songti SC", "Times New Roman", Georgia, serif;
}

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

html, body {
  margin: 0; height: 100%; background: var(--bg); color: var(--ink);
  font-family: var(--sans); font-weight: 300;
  overflow: hidden; user-select: none;
  -webkit-font-smoothing: antialiased;
}

canvas#c {
  position: fixed; inset: 0; width: 100%; height: 100%; display: block;
  touch-action: none; cursor: grab;
}
canvas#c:active { cursor: grabbing; }
canvas#c.hover-part { cursor: pointer; }

.hud { position: fixed; inset: 0; pointer-events: none; z-index: 4; }
.hud button, .hud input, .hud a, .controls, #nav, .quickbar { pointer-events: auto; }

/* 径向渐变衬底：保证亮金属前文字依然清晰可读，无任何矩形卡片痕迹 */
.scrim { position: fixed; pointer-events: none; z-index: 2; }
.scrim-bl {
  left: 0; bottom: 0; width: 58vw; height: 48vh;
  background: radial-gradient(ellipse at 12% 90%, rgba(4,5,7,0.88) 0%, rgba(4,5,7,0.48) 46%, rgba(4,5,7,0) 76%);
}
.scrim-tr {
  right: 0; bottom: 0; width: 38vw; height: 58vh;
  background: radial-gradient(ellipse at 90% 82%, rgba(4,5,7,0.84) 0%, rgba(4,5,7,0.36) 50%, rgba(4,5,7,0) 78%);
}

/* 顶部栏：品牌标识 + 快捷工具文字链 */
.topbar {
  position: fixed; top: 24px; left: 36px; right: 200px; z-index: 6;
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
}
.brand {
  display: flex; align-items: center; gap: 14px;
  font-size: 11px; letter-spacing: 0.28em; color: var(--ink-dim);
  text-transform: uppercase; white-space: nowrap;
}
.brand .rule { width: 22px; height: 1px; background: var(--ice); opacity: 0.85; }
.brand em {
  font-family: var(--serif); font-style: italic; letter-spacing: 0.06em;
  font-size: 14px; color: var(--ink-body); text-transform: none;
}

.quickbar {
  display: flex; align-items: center; gap: 18px;
}
.quickbar button {
  all: unset; cursor: pointer;
  font-size: 11px; letter-spacing: 0.14em; color: var(--ink-dim);
  padding: 5px 0; border-bottom: 1px solid transparent;
  transition: color 0.22s ease, border-color 0.22s ease;
}
.quickbar button:hover { color: var(--ink); border-bottom-color: var(--line); }
.quickbar button.on { color: var(--ice); border-bottom-color: var(--ice); }
.fps-tag {
  font-size: 10px; letter-spacing: 0.12em; color: var(--ink-faint);
  font-variant-numeric: tabular-nums; min-width: 44px; text-align: right;
}

/* 右侧竖排章节目录 */
#nav {
  position: fixed; top: 22px; right: 34px; z-index: 6;
  display: flex; flex-direction: column; align-items: flex-end; gap: 3px;
}
#nav button {
  all: unset; cursor: pointer;
  display: flex; align-items: baseline; gap: 10px;
  padding: 4px 0;
  color: var(--ink-faint); font-size: 12px; letter-spacing: 0.08em;
  transition: color 0.22s ease, transform 0.22s ease;
}
#nav button .ix { font-variant-numeric: tabular-nums; font-size: 10px; letter-spacing: 0.18em; }
#nav button:hover { color: var(--ink-body); transform: translateX(-2px); }
#nav button.on { color: var(--ink); }
#nav button.on .ix { color: var(--ice); }
#nav button.on .nm { border-bottom: 1px solid var(--ice); padding-bottom: 2px; }

/* 左下主标题区 */
.headline {
  position: fixed; left: 36px; bottom: 104px; z-index: 5;
  max-width: min(440px, 44vw); pointer-events: none;
}
.kicker {
  font-size: 10.5px; letter-spacing: 0.30em; text-transform: uppercase;
  color: var(--ice); margin-bottom: 10px;
  opacity: 0; transform: translateY(5px);
  transition: opacity 0.45s ease, transform 0.45s ease;
}
.headline h1 {
  margin: 0; font-weight: 200; font-size: clamp(26px, 3.1vw, 42px);
  line-height: 1.12; letter-spacing: -0.01em; color: var(--ink);
  opacity: 0; transform: translateY(7px);
  transition: opacity 0.5s ease 0.04s, transform 0.5s ease 0.04s;
}
.quote {
  margin-top: 10px;
  font-family: var(--serif); font-style: italic; font-weight: 400;
  font-size: 15px; line-height: 1.45; color: var(--ink-dim);
  opacity: 0; transform: translateY(5px);
  transition: opacity 0.55s ease 0.1s, transform 0.55s ease 0.1s;
}
.kicker.in, .headline h1.in, .quote.in { opacity: 1; transform: none; }

/* 右下数字遥测栈 + 同步波形图 */
.telemetry {
  position: fixed; right: 34px; bottom: 34px; z-index: 5;
  width: 264px; text-align: right;
  display: flex; flex-direction: column; align-items: flex-end; gap: 16px;
}
.readout { width: 100%; border-top: 1px solid var(--line); }
.readout .m {
  display: grid; grid-template-columns: 1fr auto 42px; align-items: baseline; gap: 8px;
  padding: 7px 0; border-bottom: 1px solid var(--line);
}
.readout .k {
  text-align: left; font-size: 11px; letter-spacing: 0.14em; color: var(--ink-dim);
}
.readout .v {
  font-variant-numeric: tabular-nums; font-weight: 200; font-size: 21px;
  letter-spacing: -0.01em; color: var(--ink);
}
.readout .u {
  text-align: left; font-size: 10px; color: var(--ink-faint); letter-spacing: 0.04em;
}

/* SVG 细线波形（无边框背景） */
.wave-wrap { width: 100%; }
.wave-caption {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 10px; letter-spacing: 0.18em; color: var(--ink-faint);
  text-transform: uppercase; margin-bottom: 5px;
}
svg.wave { width: 100%; height: 92px; overflow: visible; display: block; }
svg.wave .axis { stroke: var(--line); stroke-width: 1; }
svg.wave .guide { stroke: rgba(220,228,240,0.20); stroke-width: 1; stroke-dasharray: 2 4; }
svg.wave .line { stroke: var(--ink); stroke-width: 1.35; opacity: 0.9; }
svg.wave .line.alt { stroke: var(--ice); opacity: 0.92; }
svg.wave .line.third { stroke: rgba(242,214,150,0.78); stroke-width: 1.15; }
svg.wave .cursor { stroke: var(--ice); stroke-width: 1; }

/* 左下控件条：1px 轨道滑杆 + 分段点选 + 文字开关 */
.controls {
  position: fixed; left: 36px; bottom: 28px; z-index: 6;
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: 18px 24px;
  max-width: calc(100vw - 360px);
}
.ctl { display: flex; flex-direction: column; gap: 5px; min-width: 132px; }
.ctl-head {
  display: flex; justify-content: space-between; gap: 12px;
  font-size: 11px; letter-spacing: 0.10em; color: var(--ink-dim);
}
.ctl-head b { font-weight: 300; color: var(--ink); font-variant-numeric: tabular-nums; }
.ctl input[type="range"] {
  -webkit-appearance: none; appearance: none;
  width: 138px; height: 22px; background: transparent; margin: 0; cursor: pointer;
}
.ctl input[type="range"]::-webkit-slider-runnable-track {
  height: 1px;
  background: linear-gradient(to right, var(--ice) 0%, var(--ice) var(--p,50%), rgba(220,228,240,0.24) var(--p,50%), rgba(220,228,240,0.24) 100%);
}
.ctl input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 9px; height: 9px; border-radius: 50%;
  background: var(--ink); margin-top: -4px; border: 1px solid var(--bg);
  transition: transform 0.15s ease, background 0.15s ease;
}
.ctl input[type="range"]:hover::-webkit-slider-thumb { transform: scale(1.3); background: var(--ice); }
.ctl input[type="range"]::-moz-range-track { height: 1px; background: rgba(220,228,240,0.24); }
.ctl input[type="range"]::-moz-range-progress { height: 1px; background: var(--ice); }
.ctl input[type="range"]::-moz-range-thumb {
  width: 9px; height: 9px; border-radius: 50%; border: 0; background: var(--ink);
}

.ctl-choices { display: flex; align-items: baseline; gap: 10px; height: 22px; }
.ctl-choices button {
  all: unset; cursor: pointer;
  font-size: 12px; color: var(--ink-faint); letter-spacing: 0.06em;
  padding: 2px 1px; border-bottom: 1px solid transparent;
  font-variant-numeric: tabular-nums;
  transition: color 0.18s ease, border-color 0.18s ease;
}
.ctl-choices button:hover { color: var(--ink-body); }
.ctl-choices button.on { color: var(--ice); border-bottom-color: var(--ice); }

.ctl-toggle {
  all: unset; cursor: pointer;
  font-size: 12px; letter-spacing: 0.12em; color: var(--ink-dim);
  padding: 5px 0; border-bottom: 1px solid var(--line);
  transition: color 0.2s ease, border-color 0.2s ease;
}
.ctl-toggle:hover { color: var(--ink); border-color: rgba(220,228,240,0.42); }
.ctl-toggle.on { color: var(--ice); border-color: var(--ice); }
.ctl-toggle.wrong { color: #d87a70; border-color: #d87a70; }

/* 底部电影字幕与悬停提示 */
.subtitle {
  position: fixed; left: 50%; bottom: 82px; transform: translateX(-50%);
  max-width: min(50ch, 62vw); text-align: center; z-index: 5;
  font-size: 13.5px; line-height: 1.65; letter-spacing: 0.04em;
  color: var(--ink-body);
  opacity: 0; transition: opacity 0.4s ease;
  pointer-events: none;
  text-shadow: 0 1px 14px rgba(0, 0, 0, 0.95);
}
.subtitle.in { opacity: 1; }
body.quiz .subtitle { bottom: 96px; max-width: min(52ch, 78vw); color: var(--ink); }

.part-hint {
  position: fixed; left: 50%; top: 26px; transform: translateX(-50%);
  font-size: 11px; letter-spacing: 0.14em; color: var(--ink-dim);
  opacity: 0; transition: opacity 0.2s ease; pointer-events: none; z-index: 6;
}
.part-hint.in { opacity: 1; }
.part-hint b { font-weight: 400; color: var(--ice); margin-right: 8px; }

/* 零件引线标注（GPU 合成层加速） */
#labels { position: fixed; inset: 0; pointer-events: none; z-index: 3; }
.pin {
  position: absolute; left: 0; top: 0; will-change: transform, opacity;
  display: flex; align-items: center; gap: 7px;
  opacity: 0; transition: opacity 0.3s ease;
  white-space: nowrap;
}
.pin.in { opacity: 1; }
.pin .dot { width: 3px; height: 3px; border-radius: 50%; background: var(--ice); }
.pin .leader { width: 22px; height: 1px; background: rgba(220,228,240,0.30); }
.pin .txt { font-size: 11px; letter-spacing: 0.08em; color: var(--ink-body); }
.pin .txt small { display: block; font-size: 9.5px; color: var(--ink-faint); letter-spacing: 0.05em; }
.pin.flip { flex-direction: row-reverse; text-align: right; }

.prog { position: fixed; left: 0; right: 0; bottom: 0; height: 1px; background: rgba(220,228,240,0.07); z-index: 6; }
.prog i { display: block; height: 100%; width: 0%; background: var(--ice); transition: width 0.35s ease; }

body.no-anim *, body.no-anim *::before, body.no-anim *::after {
  transition: none !important; animation: none !important;
}

/* 响应式与手机竖屏（保证 3D 画面占屏 ≥ 62%） */
@media (max-width: 920px) {
  .topbar { left: 20px; right: 20px; top: 14px; }
  .brand em, .fps-tag { display: none; }
  .quickbar { gap: 12px; }
  #nav {
    top: auto; bottom: 8px; right: 16px; left: 16px;
    flex-direction: row; justify-content: space-between;
    border-top: 1px solid var(--line); padding-top: 6px;
  }
  #nav button { font-size: 11px; gap: 3px; }
  #nav button .nm { display: none; }
  #nav button.on .nm { display: inline; }
  .headline { left: 20px; bottom: 132px; max-width: 62vw; }
  .quote { display: none; }
  .telemetry { right: 20px; bottom: 48px; width: 158px; gap: 8px; }
  .readout .v { font-size: 16px; }
  .readout .m { padding: 4px 0; }
  svg.wave { height: 58px; }
  .controls { left: 20px; bottom: 48px; max-width: 56vw; gap: 10px 14px; }
  .ctl { min-width: 112px; }
  .ctl input[type="range"] { width: 116px; }
  .subtitle { bottom: 185px; max-width: 86vw; font-size: 12.5px; }
}

@media (max-width: 600px) {
  .topbar { flex-wrap: wrap; gap: 6px; }
  .telemetry { top: 50px; bottom: auto; right: 16px; width: 136px; }
  .wave-wrap { display: none; }
  .headline { bottom: 124px; max-width: 88vw; }
  .headline h1 { font-size: 22px; }
  .controls { bottom: 42px; max-width: 90vw; }
  body.quiz .subtitle { bottom: 120px; }
}
