/* 拆开的火箭 · SpaceX × 特斯拉合并备考 — 样式 */
:root {
  --ink: #0b1b33;
  --ink-2: #44546a;
  --muted: #7a8699;
  --line: rgba(11, 27, 51, 0.10);
  --glass: rgba(255, 255, 255, 0.84);
  --glass-strong: rgba(255, 255, 255, 0.93);
  --navy: #1f3864;
  --accent: #2a78d6;
  --shadow: 0 18px 50px rgba(18, 38, 74, 0.18), 0 2px 8px rgba(18, 38, 74, 0.08);
  --radius: 18px;
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", "Segoe UI", system-ui, sans-serif;
  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100; --s5: #e87ba4;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { scroll-behavior: auto; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: #bcd9f2;               /* bright sky fallback while WebGL loads */
  background: linear-gradient(180deg, #7fb6e8 0%, #bcd9f2 55%, #eef4f8 100%);
  overflow-x: hidden;
  line-height: 1.5;
}
#scene {
  position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; z-index: 0;
}
.vignette {
  position: fixed; inset: 0; z-index: 1; pointer-events: none;
  background: linear-gradient(180deg, rgba(8, 26, 58, 0.30) 0%, rgba(8, 26, 58, 0) 14%), radial-gradient(120% 90% at 50% 45%, rgba(0,0,0,0) 60%, rgba(10, 30, 60, 0.16) 100%);
}
.scrim { position: fixed; inset: 0; z-index: 4; pointer-events: none; opacity: 0; transition: opacity .6s ease;
  background: linear-gradient(90deg, rgba(8, 34, 82, 0.34) 0%, rgba(8, 34, 82, 0.14) 36%, rgba(8, 34, 82, 0) 58%); }
body.hero-on .scrim { opacity: 1; }
.letterbox { position: fixed; left: 0; right: 0; height: 0; z-index: 2; pointer-events: none; background: #050b16; transition: height .6s ease; }
.letterbox.top { top: 0; } .letterbox.bottom { bottom: 0; }
body.cine .letterbox { height: 3.2vh; }

/* ---------- top bar ---------- */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px 28px; pointer-events: none;
  color: #fff; text-shadow: 0 1px 8px rgba(5, 20, 45, 0.35);
  font-size: 13px; letter-spacing: .02em;
}
.topbar .brand { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.topbar .brand i { width: 22px; height: 22px; border-radius: 50%; display: inline-block;
  background: conic-gradient(var(--s1) 0 68%, var(--s2) 0 76%, var(--s3) 0 88%, var(--s4) 0 97%, var(--s5) 0 100%); box-shadow: 0 0 0 2px rgba(255,255,255,.8); }
.topbar .meta { opacity: .92; font-weight: 500; }

/* ---------- chapter rail ---------- */
.rail {
  position: fixed; right: 22px; top: 50%; transform: translateY(-50%); z-index: 20;
  display: flex; flex-direction: column; gap: 6px;
}
.rail button {
  all: unset; cursor: pointer; display: flex; align-items: center; justify-content: flex-end; gap: 10px;
  font-size: 12px; color: rgba(255,255,255,.85); text-shadow: 0 1px 6px rgba(5,20,45,.45); padding: 3px 0;
}
.rail button span.lab { opacity: 0; transform: translateX(6px); transition: all .25s ease; white-space: nowrap; }
.rail:hover button span.lab, .rail button:focus-visible span.lab { opacity: 1; transform: none; }
.rail button span.dot { width: 9px; height: 9px; border-radius: 50%; background: rgba(255,255,255,.55); box-shadow: 0 0 0 2px rgba(255,255,255,.25); transition: all .25s ease; }
.rail button.on span.dot { width: 11px; height: 11px; background: #fff; box-shadow: 0 0 0 3px rgba(255,255,255,.35), 0 0 14px rgba(255,255,255,.8); }
.rail button:focus-visible { outline: 2px solid #fff; outline-offset: 4px; border-radius: 6px; }

/* ---------- scroll spacers ---------- */
#story { position: relative; z-index: 3; }
.chapter { position: relative; height: 150vh; }
.chapter[data-ch="0"] { height: 120vh; }
.chapter[data-ch="1"] { height: 140vh; }
.chapter[data-ch="7"] { height: 200vh; }
.chapter .sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- overlay panels ---------- */
.overlay { position: fixed; z-index: 10; pointer-events: none; opacity: 0; transition: opacity .55s ease, transform .7s cubic-bezier(.2,.8,.2,1); }
.overlay.on { opacity: 1; pointer-events: auto; }

/* hero */
.hero { left: 5.5vw; top: 17vh; width: min(880px, 52vw); transform: translateY(16px); color: #fff; }
.hero.on { transform: none; }
.hero .kicker { font-size: 14px; letter-spacing: .28em; font-weight: 600; opacity: .95; text-shadow: 0 1px 10px rgba(5,20,45,.45); }
.hero h1 { font-size: clamp(30px, 3.05vw, 58px); line-height: 1.12; margin: 14px 0 16px; font-weight: 750; letter-spacing: .01em;
  text-shadow: 0 2px 22px rgba(5, 20, 45, 0.42); }
.hero p.lead { font-size: clamp(15px, 1.1vw, 19px); margin: 0 0 22px; max-width: 640px; text-shadow: 0 1px 12px rgba(5,20,45,.5); }
.hero .tiles { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 10px; max-width: 700px; }
.tile { background: var(--glass); color: var(--ink); border-radius: 14px; padding: 12px 14px; box-shadow: var(--shadow);
  backdrop-filter: blur(14px) saturate(1.25); -webkit-backdrop-filter: blur(14px) saturate(1.25); }
.tile .l { font-size: 12px; color: var(--ink-2); }
.tile .v { font-size: 22px; font-weight: 700; margin-top: 2px; white-space: nowrap; }
.tile .v small { font-size: 12px; font-weight: 600; color: var(--ink-2); margin-left: 2px; }
.tile .s { font-size: 11px; color: var(--muted); margin-top: 2px; }
.hero .hint { margin-top: 22px; font-size: 13px; display: flex; align-items: center; gap: 10px; text-shadow: 0 1px 8px rgba(5,20,45,.5); }
.hero .hint .mouse { width: 18px; height: 28px; border: 2px solid #fff; border-radius: 10px; position: relative; }
.hero .hint .mouse::after { content: ""; position: absolute; left: 50%; top: 5px; width: 3px; height: 6px; margin-left: -1.5px; border-radius: 2px; background: #fff; animation: wheel 1.6s infinite; }
@keyframes wheel { 0% { transform: translateY(0); opacity: 1 } 70% { transform: translateY(8px); opacity: 0 } 100% { opacity: 0 } }

/* caption card (liftoff) */
.caption { left: 6vw; bottom: 9vh; width: min(560px, 44vw); transform: translateY(18px); }
.caption.on { transform: none; }
.card { background: var(--glass); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px 22px;
  backdrop-filter: blur(16px) saturate(1.25); -webkit-backdrop-filter: blur(16px) saturate(1.25); border: 1px solid rgba(255,255,255,.6); }
.card h2 { margin: 0 0 6px; font-size: 22px; line-height: 1.25; }
.card p { margin: 0; color: var(--ink-2); font-size: 14px; }
.legend { display: grid; grid-template-columns: 1fr; gap: 6px; margin-top: 12px; }
.legend .row { display: grid; grid-template-columns: 12px 1fr auto auto; gap: 10px; align-items: center; font-size: 13px; }
.legend .sw { width: 12px; height: 12px; border-radius: 3px; }
.legend .bar { height: 6px; border-radius: 3px; background: rgba(11,27,51,.08); width: 120px; overflow: hidden; }
.legend .bar b { display: block; height: 100%; border-radius: 3px; }
.legend .num { font-variant-numeric: tabular-nums; color: var(--ink); font-weight: 600; min-width: 74px; text-align: right; }

/* stage panel */
.stage-panel { top: 14vh; width: min(430px, 31vw); transform: translateX(26px); }
.stage-panel.right { right: 6.2vw; } .stage-panel.left { left: 5vw; transform: translateX(-26px); }
.stage-panel.on { transform: none; }
.stage-panel .card { padding: 0; overflow: hidden; }
.stage-panel .strip { height: 5px; }
.stage-panel .inner { padding: 18px 22px 18px; }
.stage-panel .k { display: flex; align-items: center; justify-content: space-between; font-size: 12px; color: var(--ink-2); letter-spacing: .04em; }
.stage-panel .tag { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 999px; background: rgba(11,27,51,.06); font-weight: 600; color: var(--ink); }
.stage-panel .tag i { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.stage-panel h2 { font-size: 26px; margin: 10px 0 2px; }
.stage-panel .big { display: flex; align-items: baseline; gap: 8px; margin: 6px 0 4px; }
.stage-panel .big .n { font-size: 46px; font-weight: 760; letter-spacing: -.01em; line-height: 1.05; }
.stage-panel .big .u { font-size: 14px; color: var(--ink-2); font-weight: 600; }
.stage-panel .sharebar { position: relative; height: 10px; border-radius: 5px; background: rgba(11,27,51,.07); margin: 10px 0 4px; overflow: hidden; }
.stage-panel .sharebar b { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 5px; }
.stage-panel .sharecap { font-size: 12px; color: var(--ink-2); display: flex; justify-content: space-between; }
.stage-panel dl { display: grid; grid-template-columns: 1fr auto; gap: 7px 12px; margin: 14px 0 0; font-size: 14px; }
.stage-panel dt { color: var(--ink-2); }
.stage-panel dd { margin: 0; font-weight: 650; text-align: right; font-variant-numeric: tabular-nums; }
.stage-panel .note { margin-top: 12px; font-size: 12px; color: var(--muted); border-top: 1px solid var(--line); padding-top: 10px; }

/* final dashboard */
.final { right: 3.4vw; top: 7.5vh; bottom: 5.5vh; width: min(760px, 47vw); transform: translateX(30px); display: flex; }
.final.on { transform: none; }
.final .card { width: 100%; overflow: auto; padding: 18px 22px 16px; background: var(--glass-strong); }
.final h2 { font-size: 22px; margin: 0; }
.final .sub { color: var(--ink-2); font-size: 12.5px; margin: 2px 0 10px; }
.final .grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.final .grid .tile { box-shadow: none; background: rgba(11,27,51,.045); padding: 8px 10px; backdrop-filter: none; -webkit-backdrop-filter: none; }
.final .grid .tile .l { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.final .grid .tile .s { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.final .grid .tile .v { font-size: 18px; }
.final h3 { font-size: 14.5px; margin: 13px 0 6px; display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.final h3 small { font-weight: 500; color: var(--muted); font-size: 12px; }
.seg-ctl { display: inline-flex; background: rgba(11,27,51,.06); border-radius: 999px; padding: 3px; gap: 2px; }
.seg-ctl button { all: unset; cursor: pointer; font-size: 12px; padding: 4px 10px; border-radius: 999px; color: var(--ink-2); font-weight: 600; }
.seg-ctl button.on { background: #fff; color: var(--ink); box-shadow: 0 1px 4px rgba(11,27,51,.15); }
.seg-ctl button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.chart { position: relative; }
.chart .rowc { display: grid; grid-template-columns: 150px 1fr 64px; align-items: center; gap: 10px; height: 27px; }
.chart .mlab { font-size: 13px; color: var(--ink); white-space: nowrap; }
.chart .track { position: relative; height: 100%; }
.chart .track .gl { position: absolute; top: 0; bottom: 0; width: 1px; background: rgba(11,27,51,.08); }
.chart .track .b { position: absolute; left: 0; top: 50%; height: 14px; margin-top: -7px; border-radius: 0 4px 4px 0; background: var(--accent); transition: width .45s cubic-bezier(.2,.8,.2,1); outline: none; }
.chart .track .b:hover, .chart .track .b:focus-visible { filter: brightness(1.08); box-shadow: 0 0 0 2px #fff, 0 0 0 4px rgba(42,120,214,.35); }
.chart .val { font-size: 13px; font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }
.chart .axis { display: grid; grid-template-columns: 150px 1fr 64px; gap: 10px; font-size: 11px; color: var(--muted); }
.chart .axis .ticks { position: relative; height: 16px; }
.chart .axis .ticks span { position: absolute; transform: translateX(-50%); }
.tip { position: fixed; z-index: 40; pointer-events: none; background: #0b1b33; color: #fff; font-size: 12px; line-height: 1.5;
  padding: 9px 11px; border-radius: 9px; box-shadow: 0 10px 30px rgba(0,0,0,.25); opacity: 0; transform: translateY(4px); transition: opacity .12s ease, transform .12s ease; max-width: 280px; }
.tip.on { opacity: 1; transform: none; }
.tip b { font-weight: 700; }
table.mt { width: 100%; border-collapse: collapse; font-size: 12px; margin-top: 4px; }
table.mt th, table.mt td { padding: 4px 5px; border-bottom: 1px solid var(--line); text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.mt th:first-child, table.mt td:first-child { text-align: left; }
table.mt th { color: var(--ink-2); font-weight: 600; font-size: 11.5px; }
table.mt tr.hl td { background: rgba(42,120,214,.06); font-weight: 650; }
.musk { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 8px; margin-top: 6px; }
.musk .tile { box-shadow: none; background: rgba(11,27,51,.045); backdrop-filter: none; -webkit-backdrop-filter: none; padding: 8px 10px; }
.fine { font-size: 11px; color: var(--muted); margin-top: 9px; line-height: 1.5; }

/* leader line & labels */
#leader { position: fixed; inset: 0; z-index: 9; pointer-events: none; width: 100vw; height: 100vh; }
#leader line { stroke: rgba(255,255,255,.95); stroke-width: 1.5; }
#leader circle { fill: #fff; stroke: rgba(11,27,51,.35); stroke-width: 1; }
#labels { position: fixed; inset: 0; z-index: 9; pointer-events: none; }
.slabel { position: absolute; transform: translate(-100%, -50%); display: flex; align-items: center; gap: 8px; opacity: 0; transition: opacity .5s ease; white-space: nowrap; }
.slabel.on { opacity: 1; }
.slabel .t { background: var(--glass-strong); border-radius: 10px; padding: 5px 10px; box-shadow: 0 6px 20px rgba(18,38,74,.16); font-size: 12.5px; color: var(--ink); }
.slabel .t b { font-weight: 700; }
.slabel .t i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 6px; vertical-align: 0; }
.slabel .ln { width: 46px; height: 1.5px; background: rgba(255,255,255,.95); box-shadow: 0 0 4px rgba(0,0,0,.2); }

/* footer sources */
.sources { position: fixed; left: 0; right: 0; bottom: 0; z-index: 15; padding: 8px 28px; font-size: 11px; color: rgba(255,255,255,.92);
  text-shadow: 0 1px 6px rgba(5,20,45,.55); pointer-events: none; display: flex; justify-content: space-between; gap: 16px; }
.sources .r { white-space: nowrap; }

/* loader & fallback */
.loader { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; background: linear-gradient(180deg, #7fb6e8, #dcebf7); transition: opacity .6s ease, visibility .6s; }
.loader.done { opacity: 0; visibility: hidden; }
.loader .c { text-align: center; color: #0b1b33; }
.loader .ring { width: 46px; height: 46px; border-radius: 50%; border: 3px solid rgba(255,255,255,.7); border-top-color: var(--navy); margin: 0 auto 14px; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg) } }
.fallback-note { display: none; }
body.no-webgl #scene, body.no-webgl .vignette, body.no-webgl #leader, body.no-webgl #labels, body.no-webgl .rail { display: none; }
body.no-webgl .fallback-note { display: block; position: relative; z-index: 12; margin: 80px auto 0; max-width: 760px; padding: 0 20px; color: var(--ink); }
body.no-webgl #story .chapter { height: auto; }
body.no-webgl .overlay { position: relative; opacity: 1; transform: none; left: auto; right: auto; top: auto; bottom: auto; width: auto; max-width: 760px; margin: 24px auto; padding: 0 20px; pointer-events: auto; display: block; color: var(--ink); }
body.no-webgl .hero h1, body.no-webgl .hero .kicker, body.no-webgl .hero p.lead, body.no-webgl .hero .hint { color: var(--ink); text-shadow: none; }
body.no-webgl .final .card { overflow: visible; }
body.no-webgl .sources { position: relative; color: var(--ink-2); text-shadow: none; }
body.no-webgl .topbar { position: relative; color: var(--ink); text-shadow: none; }

/* ---------- responsive ---------- */
@media (max-width: 1280px) {
  .final .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 820px) {
  .topbar { padding: 10px 14px; font-size: 11.5px; }
  .topbar .meta { display: none; }
  .rail { right: 8px; gap: 2px; }
  .rail button span.lab { display: none; }
  .hero { left: 16px; right: 16px; width: auto; top: 11vh; }
  .hero h1 { font-size: 27px; text-wrap: balance; }
  .hero h1 br.d { display: none; }
  .hero p.lead { font-size: 14px; }
  .hero .tiles { display: none; }
  .scrim { background: linear-gradient(180deg, rgba(8, 34, 82, 0.42) 0%, rgba(8, 34, 82, 0.16) 42%, rgba(8, 34, 82, 0) 60%); }
  .hero .tiles { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .tile .v { font-size: 18px; }
  .caption { left: 12px; right: 12px; width: auto; bottom: 42px; }
  .caption .card { padding: 14px 16px; }
  .caption h2 { font-size: 18px; }
  .legend .bar { display: none; }
  .legend .row { grid-template-columns: 12px 1fr auto; }
  .stage-panel, .stage-panel.left, .stage-panel.right { left: 10px; right: 10px; width: auto; top: auto; bottom: 34px; transform: translateY(24px); }
  .stage-panel.on { transform: none; }
  .stage-panel .inner { padding: 14px 16px; }
  .stage-panel h2 { font-size: 20px; margin-top: 6px; }
  .stage-panel .big .n { font-size: 34px; }
  .stage-panel dl { font-size: 13px; gap: 4px 10px; margin-top: 8px; }
  .stage-panel .note { display: none; }
  .final { left: 8px; right: 8px; width: auto; top: auto; bottom: 30px; height: 64vh; transform: translateY(30px); }
  .final.on { transform: none; }
  .final .card { padding: 16px; }
  .final .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .chart .rowc, .chart .axis { grid-template-columns: 104px 1fr 52px; }
  .chart .mlab { font-size: 11.5px; }
  .sources { font-size: 9.5px; padding: 6px 12px; }
  .sources .l { display: none; }
  #labels { display: none; }
  body.cine .letterbox { height: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .overlay { transition: opacity .2s linear; transform: none !important; }
}
