:root {
  --ink: #07131f;
  --night: #030712;
  --cream: #f3f1e8;
  --sun: #ffcc70;
  --coral: #ff6f61;
  --cyan: #61d8dc;
  --violet: #897cff;
  --glass: rgba(5, 13, 28, .68);
  --mono: ui-monospace, "Cascadia Mono", "SF Mono", Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }

html, body { width: 100%; height: 100%; }

body {
  margin: 0;
  overflow: hidden;
  background: var(--night);
  color: var(--cream);
  font-family: Inter, Avenir Next, Avenir, Helvetica Neue, Arial, sans-serif;
}

button, a { font: inherit; }
button { cursor: pointer; }
button:focus-visible, a:focus-visible { outline: 3px solid var(--sun); outline-offset: 4px; }

kbd {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border: 1px solid rgba(243, 241, 232, .34);
  border-bottom-width: 2px;
  border-radius: 6px;
  background: rgba(243, 241, 232, .06);
  color: var(--cream);
  font: 700 10px var(--mono);
  letter-spacing: .04em;
}

kbd.mouse-key { padding: 0 5px; }
.mouse-key svg { width: 12px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.6; }

#scene {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle at 70% 30%, #17334d, #02050c 68%);
}

.warp-flash {
  position: fixed;
  inset: 0;
  z-index: 90;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(circle at 50% 50%, rgba(255, 255, 255, .95), rgba(97, 216, 220, .55) 38%, rgba(3, 7, 18, 0) 72%);
}

/* The page opens straight into the flight, so a veil in the sky's own colours hides the HUD while it is still being built and
   lifts after the first frame is drawn. If the script never gets that far, the animation lifts it anyway instead of leaving a
   blank page. */
.veil {
  position: fixed;
  inset: 0;
  z-index: 95;
  pointer-events: none;
  background: radial-gradient(circle at 70% 30%, #17334d, #02050c 68%);
  animation: veil-lift .9s ease 10s forwards;
}
.veil.gone { opacity: 0; transition: opacity .9s ease; animation: none; }
@keyframes veil-lift { to { opacity: 0; } }

/* The opening (see arrival.js) shows nothing but the ship and the dark: every part of the interface is held back until the ship has
   arrived, then fades in a piece at a time. The fade names only where it starts, so it ends at whatever each part shows anyway. */
body.arriving :is(.topbar, .chapter-dock, .world-labels, .reticle, .bracket, .edge-pointer, .theme-chip, .hud-bl, .radar, .journey-controls, .hud-notice, .touch-controls) {
  opacity: 0 !important;
  pointer-events: none !important;
}
body.landed :is(.topbar, .chapter-dock, .world-labels, .reticle, .bracket, .edge-pointer, .theme-chip, .hud-bl, .radar, .journey-controls, .hud-notice, .touch-controls) {
  animation: hud-in 1.3s ease backwards;
}
body.landed .hud-bl { animation-delay: .2s; }
body.landed .chapter-dock { animation-delay: .35s; }
body.landed :is(.radar, .journey-controls, .touch-controls) { animation-delay: .5s; }
@keyframes hud-in { from { opacity: 0; } }

.topbar {
  position: fixed;
  z-index: 20;
  top: 0;
  left: 0;
  width: 100%;
  height: 82px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 18px 32px;
  background: linear-gradient(180deg, rgba(4, 12, 28, .72), transparent);
}

.view-controls {
  grid-column: 2;
  display: flex;
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 999px;
  background: rgba(4, 12, 28, .42);
  backdrop-filter: blur(12px);
  padding: 4px;
}
.nav-button {
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: rgba(245, 237, 218, .68);
  padding: 8px 14px;
}
.nav-button.active { background: var(--cream); color: var(--ink); }

.sound-button {
  grid-column: 3;
  justify-self: end;
  display: flex;
  gap: 8px;
  align-items: center;
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 999px;
  background: rgba(4, 12, 28, .42);
  color: var(--cream);
  padding: 9px 12px;
  backdrop-filter: blur(12px);
}
.sound-icon { color: var(--cyan); }
.sound-button[aria-pressed="false"] .sound-icon { color: rgba(243, 241, 232, .4); } /* on a phone the label is hidden, so the icon shows the state */

.space-view {
  position: fixed;
  inset: 0;
  z-index: 5;
  touch-action: none;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
}
.space-view.dragging { cursor: grabbing; }
.space-view.mouse-captured { cursor: none; }
.space-view.mouse-captured .reticle { color: #fff; filter: drop-shadow(0 0 8px rgba(255, 255, 255, .7)); }

.world-labels { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.world-label {
  position: absolute;
  left: 0;
  top: 0;
  display: grid;
  justify-items: center;
  gap: 3px;
  color: var(--c);
  font: 700 12px/1 var(--mono);
  letter-spacing: .16em;
  text-shadow: 0 0 10px var(--c);
  white-space: nowrap;
  will-change: transform, opacity;
}
.world-label small {
  font-size: 9px;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--cream);
  text-shadow: none;
  opacity: var(--t, 0);
}
.world-label.focus b { color: #fff; text-shadow: 0 0 14px var(--c), 0 0 4px var(--c); }
/* The planets, stars and constellations of the Milky Way: a touch smaller, so the nebula's own year labels stay the stars of the show. */
.world-label.cosmic { font-size: 11px; letter-spacing: .14em; }
.world-label.cosmic small { font-size: 8.5px; letter-spacing: .18em; color: color-mix(in srgb, var(--c) 45%, var(--cream)); }

.reticle {
  position: absolute;
  left: 0;
  top: 0;
  width: 48px;
  height: 48px;
  margin: -24px 0 0 -24px;
  pointer-events: none;
  color: rgba(255, 204, 112, .92);
  filter: drop-shadow(0 0 6px rgba(255, 204, 112, .6));
}
.reticle svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; }

.bracket {
  --c: var(--sun);
  --l: 14px;
  --t: 2px;
  position: absolute;
  left: 0;
  top: 0;
  pointer-events: none;
  will-change: transform, width, height;
  background:
    linear-gradient(var(--c), var(--c)) left top / var(--l) var(--t) no-repeat,
    linear-gradient(var(--c), var(--c)) left top / var(--t) var(--l) no-repeat,
    linear-gradient(var(--c), var(--c)) right top / var(--l) var(--t) no-repeat,
    linear-gradient(var(--c), var(--c)) right top / var(--t) var(--l) no-repeat,
    linear-gradient(var(--c), var(--c)) left bottom / var(--l) var(--t) no-repeat,
    linear-gradient(var(--c), var(--c)) left bottom / var(--t) var(--l) no-repeat,
    linear-gradient(var(--c), var(--c)) right bottom / var(--l) var(--t) no-repeat,
    linear-gradient(var(--c), var(--c)) right bottom / var(--t) var(--l) no-repeat;
}
/* The aim label is positioned by hud.js (placeLabel), relative to the bracket's top-left corner. */
.bracket span {
  position: absolute;
  left: 0;
  top: 0;
  color: var(--c);
  font: 700 10px var(--mono);
  letter-spacing: .14em;
  white-space: nowrap;
  text-shadow: 0 0 10px rgba(0, 0, 0, .9);
}
.waypoint-bracket { --c: var(--cyan); opacity: .85; }

.edge-pointer {
  position: absolute;
  left: 0;
  top: 0;
  width: 0;
  height: 0;
  margin: -9px 0 0 -9px;
  border-left: 9px solid transparent;
  border-right: 9px solid transparent;
  border-bottom: 18px solid var(--cyan);
  filter: drop-shadow(0 0 8px var(--cyan));
  pointer-events: none;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--sun);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .22em;
  text-transform: uppercase;
}

.tag-row { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 18px; }
.tag-chip {
  --c: var(--cyan);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid color-mix(in srgb, var(--c) 55%, transparent);
  border-radius: 999px;
  background: color-mix(in srgb, var(--c) 10%, transparent);
  color: var(--c);
  padding: 5px 10px;
  font: 700 10px var(--mono);
  letter-spacing: .14em;
  text-transform: uppercase;
}
.tag-chip:hover { background: color-mix(in srgb, var(--c) 30%, transparent); color: #fff; }
span.tag-chip { cursor: default; }

.primary-button {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border: 0;
  border-radius: 999px;
  background: var(--cream);
  color: var(--ink);
  font-weight: 800;
  padding: 13px 18px;
}
.primary-button span { display: inline-block; }
.text-button { border: 0; background: transparent; color: var(--cream); padding: 12px; }

.theme-chip {
  --c: var(--sun);
  position: absolute;
  z-index: 7;
  left: 50%;
  top: 92px;
  transform: translateX(-50%);
  display: inline-flex;
  gap: 10px;
  border: 1px solid var(--c);
  border-radius: 999px;
  background: var(--glass);
  backdrop-filter: blur(10px);
  color: var(--cream);
  padding: 8px 14px;
  font: 700 11px var(--mono);
  letter-spacing: .16em;
  text-transform: uppercase;
}

.hud-bl {
  position: absolute;
  z-index: 7;
  left: 22px;
  bottom: 22px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  width: min(480px, calc(50vw - 215px));
  pointer-events: none;
}
.telemetry {
  display: grid;
  grid-template-columns: auto auto;
  gap: 4px 22px;
  justify-content: start;
  font: 700 11px var(--mono);
  letter-spacing: .12em;
  text-shadow: 0 0 10px rgba(0, 0, 0, .8);
}
.telemetry div { display: flex; gap: 8px; }
.telemetry span { color: var(--cyan); }
.telemetry b { font-weight: 700; white-space: nowrap; }

.key-legend {
  display: grid;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 14px;
  background: rgba(4, 12, 28, .5);
  backdrop-filter: blur(10px);
  font: 600 11px var(--mono);
  letter-spacing: .05em;
  color: rgba(243, 241, 232, .8);
}
.legend-row, .legend-extra { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.legend-row > span, .legend-extra > span { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.legend-extra > .legend-wide { flex-basis: 100%; white-space: normal; color: rgba(243, 241, 232, .62); }
.legend-mouse { color: var(--sun); }
.legend-mouse .mouse-key { border-color: rgba(255, 204, 112, .6); color: var(--sun); }
.legend-extra { padding-top: 8px; border-top: 1px solid rgba(255, 255, 255, .1); }
.legend-toggle {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  border: 0;
  background: transparent;
  color: var(--sun);
  font: 700 10px var(--mono);
  letter-spacing: .1em;
  text-transform: uppercase;
}

.radar {
  position: absolute;
  z-index: 7;
  right: 24px;
  bottom: 22px;
  width: 168px;
  height: 168px;
  border-radius: 50%;
  pointer-events: none;
  filter: drop-shadow(0 0 12px rgba(97, 216, 220, .18));
}

.journey-controls {
  position: absolute;
  z-index: 12;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  display: flex;
  gap: 12px;
  align-items: center;
}
.journey-controls button {
  width: 44px;
  height: 44px;
  border: 1px solid rgba(255, 255, 255, .19);
  border-radius: 50%;
  background: var(--glass);
  color: var(--cream);
  backdrop-filter: blur(12px);
}
.time-gauge { width: 190px; display: grid; gap: 7px; }
.gauge-labels {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font: 700 10px var(--mono);
  letter-spacing: .14em;
  color: rgba(243, 241, 232, .5);
}
.gauge-labels b { color: var(--sun); font-size: 13px; }
.progress { height: 3px; background: rgba(255, 255, 255, .18); overflow: hidden; }
.progress span { display: block; height: 100%; width: 0; background: var(--sun); }

.hud-notice {
  position: absolute;
  z-index: 9;
  left: 50%;
  top: 92px;
  transform: translate(-50%, -6px);
  width: max-content;
  max-width: min(640px, calc(100vw - 520px));
  padding: 9px 16px;
  border: 1px solid rgba(97, 216, 220, .4);
  border-radius: 18px;
  background: var(--glass);
  backdrop-filter: blur(10px);
  color: var(--cream);
  font: 700 11px/1.5 var(--mono);
  letter-spacing: .16em;
  text-align: center;
  text-transform: uppercase;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease, transform .25s ease;
}
.hud-notice.show { opacity: 1; transform: translate(-50%, 0); }
.theme-chip:not([hidden]) ~ .hud-notice { top: 140px; }

.touch-controls {
  position: absolute;
  z-index: 13;
  left: 0;
  right: 0;
  bottom: 128px;
  display: none;
  justify-content: space-between;
  align-items: flex-end;
  padding: 0 18px;
  pointer-events: none;
}
.touch-controls button {
  pointer-events: auto;
  width: 84px;
  height: 84px;
  border: 1px solid rgba(255, 255, 255, .22);
  border-radius: 50%;
  background: var(--glass);
  color: var(--cream);
  font: 800 11px var(--mono);
  letter-spacing: .14em;
  text-transform: uppercase;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
.touch-controls button:first-child { width: 100px; height: 100px; }
.touch-controls button.pressed { background: rgba(255, 204, 112, .25); border-color: var(--sun); }

.chapter-dock {
  position: fixed;
  z-index: 18;
  right: 24px;
  top: 104px;
  width: 210px;
  max-height: calc(100vh - 310px);
  overflow-y: auto;
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 18px;
  background: rgba(4, 12, 28, .48);
  backdrop-filter: blur(14px);
  padding: 8px;
}
.chapter-dock > button {
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--cream);
  display: flex;
  justify-content: space-between;
  padding: 8px;
  font-weight: 800;
}
.dock-items { display: grid; gap: 2px; }
.dock-items button[data-index] {
  display: flex;
  align-items: center;
  width: 100%;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: rgba(245, 237, 218, .66);
  text-align: left;
  padding: 8px 10px;
  font-size: 12px;
}
.dock-items button[data-index]::before {
  content: "";
  flex: none;
  width: 7px;
  height: 7px;
  margin-right: 9px;
  border-radius: 50%;
  background: var(--c);
  box-shadow: 0 0 8px var(--c);
}
.dock-items button[data-index]:hover, .dock-items button[data-index].active { background: rgba(255, 255, 255, .1); color: white; }
.dock-items button:focus-visible { outline-offset: -3px; } /* inside the button, where the dock's scrolling edge cannot clip it */

/* A section of the dock: a heading that opens and closes the list of destinations under it, which starts closed. */
.dock-heading {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  margin: 4px 0 0;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: rgba(245, 237, 218, .62);
  padding: 9px 10px;
  text-align: left;
  font: 700 10px var(--mono);
  letter-spacing: .12em;
  text-transform: uppercase;
}
.dock-heading::before {
  content: "";
  flex: none;
  width: 5px;
  height: 5px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg);
  transition: transform .2s ease;
}
.dock-heading[aria-expanded="true"] { color: var(--cream); }
.dock-heading[aria-expanded="true"]::before { transform: rotate(45deg); }
.dock-heading:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.dock-heading small { margin-left: auto; color: rgba(245, 237, 218, .4); font: 600 10px var(--mono); letter-spacing: .06em; }
.dock-heading:first-child { margin-top: 2px; }
.dock-group { display: grid; gap: 2px; padding: 2px 0 6px; }
.dock-group:not([hidden]) { animation: dock-open .22s ease; }
@keyframes dock-open { from { opacity: 0; transform: translateY(-4px); } }
body:not([data-view="space"]) .chapter-dock { display: none; }

.themes-view, .timeline-view, .atlas-view {
  position: fixed;
  z-index: 10;
  inset: 82px 0 0;
  overflow-y: auto;
  background: rgba(4, 12, 28, .84);
  backdrop-filter: blur(18px);
  padding: 62px clamp(24px, 8vw, 116px);
}
.view-heading { margin-bottom: 36px; }
.view-heading h2 {
  margin: 0;
  font-family: Georgia, serif;
  font-size: clamp(44px, 6vw, 76px);
  letter-spacing: -.04em;
}
.themes-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  max-width: 1180px;
}
.theme-card {
  --accent: var(--sun);
  min-height: 190px;
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 24px;
  background: linear-gradient(135deg, rgba(255, 255, 255, .09), rgba(255, 255, 255, .025));
  color: var(--cream);
  text-align: left;
  padding: 24px;
  transition: transform .2s, border-color .2s;
}
.theme-card:hover { transform: translateY(-4px); border-color: var(--accent); }
.theme-card .star { display: block; color: var(--accent); font-size: 32px; margin-bottom: 30px; }
.theme-card h3 { margin: 0 0 8px; font-family: Georgia, serif; font-size: 28px; }
.theme-card p { margin: 0; color: rgba(245, 237, 218, .66); }
.theme-card small {
  display: block;
  margin-top: 16px;
  color: var(--accent);
  font: 700 10px var(--mono);
  letter-spacing: .16em;
  text-transform: uppercase;
}

.timeline-list { max-width: 900px; position: relative; margin-left: 10px; }
.timeline-list::before { content: ""; position: absolute; left: 75px; top: 10px; bottom: 10px; width: 1px; background: rgba(255, 255, 255, .18); }
.timeline-item { display: grid; grid-template-columns: 70px 1fr; gap: 30px; padding: 18px 0; }
.timeline-year { color: var(--sun); font-weight: 800; }
.timeline-story { position: relative; border: 0; width: 100%; border-bottom: 1px solid rgba(255, 255, 255, .1); background: transparent; color: var(--cream); text-align: left; padding: 0 0 24px; }
.timeline-story::before { content: ""; position: absolute; left: -39px; top: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--c, var(--cream)); box-shadow: 0 0 18px var(--c, var(--cyan)); }
.timeline-story h3 { margin: 0 0 8px; font-family: Georgia, serif; font-size: 24px; }
.timeline-story p { margin: 0; color: rgba(245, 237, 218, .66); }

.view-lede { max-width: 640px; margin: 18px 0 0; color: rgba(245, 237, 218, .7); font-size: 18px; line-height: 1.6; }
.atlas-filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 28px; }
.atlas-filter {
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 999px;
  background: transparent;
  color: rgba(245, 237, 218, .72);
  padding: 8px 16px;
  font: 700 11px var(--mono);
  letter-spacing: .12em;
  text-transform: uppercase;
}
.atlas-filter[aria-pressed="true"] { background: var(--cream); border-color: var(--cream); color: var(--ink); }
.atlas-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; max-width: 1280px; }
.atlas-card {
  --accent: var(--sun);
  display: grid;
  align-content: start;
  gap: 6px;
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 22px;
  background: linear-gradient(160deg, rgba(255, 255, 255, .08), rgba(255, 255, 255, .02));
  color: var(--cream);
  text-align: left;
  padding: 12px 12px 18px;
  overflow: hidden;
  transition: transform .2s, border-color .2s;
}
.atlas-card:hover { transform: translateY(-4px); border-color: var(--accent); }
.atlas-art { aspect-ratio: 16 / 10; margin-bottom: 8px; border-radius: 14px; overflow: hidden; background: #050a16; }
.atlas-art img, .atlas-art canvas { display: block; width: 100%; height: 100%; object-fit: cover; }
/* A mission's photo is often tall (a rocket, a person at a hatch) and the subject sits high in it, so the crop keeps the upper part. */
.atlas-card[data-group="missions"] .atlas-art img { object-position: 50% 30%; }
.atlas-card h3 { margin: 4px 6px 0; font-family: Georgia, serif; font-size: 24px; }
.atlas-card p { margin: 0 6px; color: rgba(245, 237, 218, .66); font-size: 14px; line-height: 1.45; }
.atlas-card small { margin: 8px 6px 0; color: var(--accent); font: 700 10px var(--mono); letter-spacing: .14em; text-transform: uppercase; }

.intro {
  position: fixed;
  z-index: 100;
  inset: 0;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 68% 30%, #183d55 0, #081425 30%, #030712 72%);
  transition: opacity .8s ease, visibility .8s;
}
.intro.hidden { opacity: 0; visibility: hidden; }
.intro-glow { position: absolute; width: 420px; height: 420px; border: 1px solid rgba(97, 216, 220, .22); transform: rotate(45deg); box-shadow: 0 0 100px rgba(137, 124, 255, .16), inset 0 0 100px rgba(97, 216, 220, .08); }
.intro-card { position: relative; width: min(560px, calc(100vw - 48px)); text-align: center; }
.intro-card h2 { margin: 0 0 18px; font-family: Georgia, serif; font-size: clamp(54px, 8vw, 92px); line-height: .86; letter-spacing: -.06em; }
.intro-card > p:not(.eyebrow) { margin: 0 auto 22px; max-width: 440px; color: rgba(245, 237, 218, .72); line-height: 1.55; }
.intro-keys { display: flex; justify-content: center; flex-wrap: wrap; gap: 10px 20px; margin: 0 0 26px; font: 600 11px var(--mono); letter-spacing: .08em; color: rgba(243, 241, 232, .8); }
.intro-keys span { display: inline-flex; align-items: center; gap: 5px; }
.intro-card > p.intro-note { margin: -8px auto 24px; max-width: 420px; color: rgba(243, 241, 232, .6); font: 500 12px/1.6 var(--mono); }
.intro-card > p.intro-note kbd { height: 18px; min-width: 18px; font-size: 9px; }
.intro-card > p.intro-touch { display: none; margin-bottom: 24px; }
.intro-actions { display: flex; justify-content: center; align-items: center; gap: 8px; }

/* The pre-flight screen (see preflight.js) stands in front of the opening, which waits on its first frame behind it: the dark is clear
   toward the edges so the ship and the stars show. The card is a roll call of the ship's systems that ends in the Engage button. */
.preflight {
  position: fixed;
  z-index: 100;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  overflow-y: auto;
  background: radial-gradient(ellipse at 50% 46%, rgba(3, 7, 18, .88) 0, rgba(3, 7, 18, .66) 40%, rgba(3, 7, 18, .1) 100%);
  transition: opacity .9s ease .05s, visibility .9s;
}
.preflight[data-state="launching"] { opacity: 0; visibility: hidden; pointer-events: none; }
.pf-card { width: min(420px, 100%); text-align: center; transition: transform .9s ease, filter .9s ease; }
.preflight[data-state="launching"] .pf-card { transform: scale(1.14); filter: blur(3px); }
.pf-card h2 { margin: 0 0 24px; font-family: Georgia, serif; font-size: clamp(46px, 11vw, 74px); line-height: .88; letter-spacing: -.055em; }

.pf-stations { list-style: none; margin: 0 auto 14px; padding: 0; max-width: 340px; font: 700 12px/1 var(--mono); letter-spacing: .16em; text-transform: uppercase; }
.pf-stations li { display: flex; align-items: baseline; gap: 10px; padding: 7px 0; color: rgba(243, 241, 232, .38); transition: color .3s ease; }
.pf-leader { flex: 1; min-width: 12px; border-bottom: 1px dotted rgba(243, 241, 232, .22); transform: translateY(-3px); }
.pf-state { min-width: 78px; text-align: right; }
.pf-stations li[data-state="checking"] .pf-state { animation: pf-wait 1s ease-in-out infinite; }
.pf-stations li[data-state="go"] { color: var(--cream); }
.pf-stations li[data-state="go"] .pf-state { color: var(--cyan); text-shadow: 0 0 10px rgba(97, 216, 220, .75); }
.pf-stations li[data-state="standby"] { color: rgba(243, 241, 232, .8); }
.pf-stations li[data-state="standby"] .pf-state { color: var(--sun); }
@keyframes pf-wait { 50% { opacity: .25; } }
/* Before the page's script has started, the first line already blinks, so the screen is never still. */
.preflight:not([data-state]) li:first-child .pf-state { animation: pf-wait 1s ease-in-out infinite; }

.pf-charge { max-width: 340px; height: 2px; margin: 4px auto 20px; border-radius: 2px; background: rgba(243, 241, 232, .14); overflow: hidden; }
.pf-charge i { display: block; height: 100%; background: linear-gradient(90deg, var(--cyan), var(--sun)); transform-origin: left; transform: scaleX(var(--charge, 0)); transition: transform .35s ease; }
.pf-status { min-height: 2.8em; margin: 0 auto 18px; max-width: 340px; color: var(--sun); font: 700 11px/1.6 var(--mono); letter-spacing: .2em; text-transform: uppercase; }

.pf-engage { font-size: 15px; padding: 15px 28px; transition: opacity .3s ease, transform .15s ease, box-shadow .3s ease; }
.pf-engage[aria-disabled="true"] { opacity: .42; cursor: progress; }
.pf-engage[data-armed][aria-disabled="true"] { opacity: .75; }
.preflight[data-state="ready"] .pf-engage { animation: pf-glow 2.2s ease-in-out infinite; }
.pf-engage:hover:not([aria-disabled="true"]) { transform: translateY(-1px); }
.pf-engage:active:not([aria-disabled="true"]) { transform: scale(.97); }
@keyframes pf-glow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 204, 112, 0), 0 0 22px rgba(97, 216, 220, .32); }
  50% { box-shadow: 0 0 0 7px rgba(255, 204, 112, .1), 0 0 42px rgba(97, 216, 220, .62); }
}

.pf-hint { margin: 16px auto 0; max-width: 320px; color: rgba(243, 241, 232, .52); font: 500 11px/1.6 var(--mono); letter-spacing: .05em; }
.pf-hint .touch { display: none; }
.pf-sound {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  margin-top: 18px;
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 999px;
  background: rgba(4, 12, 28, .5);
  color: var(--cream);
  padding: 8px 13px;
  font: 600 12px var(--mono);
  letter-spacing: .08em;
}
.pf-sound[aria-pressed="false"] .sound-icon { color: rgba(243, 241, 232, .4); }

@media (pointer: coarse) {
  .pf-hint .fine { display: none; }
  .pf-hint .touch { display: inline; }
}
@media (max-height: 640px) {
  .pf-card h2 { margin-bottom: 14px; font-size: clamp(36px, 9vw, 52px); }
  .pf-stations li { padding: 4px 0; }
  .pf-status { min-height: 2.4em; margin-bottom: 12px; }
  .pf-hint { margin-top: 10px; }
  .pf-sound { margin-top: 12px; }
}

/* The story dialog is a large two-pane sheet: a stage (photo and star chart, or the year for a moment) beside the text and facts. */
.story-modal {
  --accent: var(--sun);
  position: fixed;
  z-index: 60;
  left: 50%;
  top: 50%;
  width: min(1180px, calc(100vw - 56px));
  max-height: calc(100vh - 56px);
  max-height: calc(100dvh - 56px);
  overflow: auto;
  transform: translate(-50%, -50%);
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  gap: clamp(24px, 3.6vw, 56px);
  align-items: start;
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 32px;
  background: rgb(7, 27, 49);
  box-shadow: 0 40px 140px rgba(0, 0, 0, .55), 0 0 120px color-mix(in srgb, var(--accent) 14%, transparent);
  padding: clamp(24px, 3.6vw, 52px);
}
.story-modal:focus { outline: none; }
.story-stage, .story-body { min-width: 0; }
.story-body { padding-top: 6px; }
.story-modal .eyebrow { color: var(--accent); }
.story-modal h2 { margin: 0 0 10px; font-family: Georgia, serif; font-size: clamp(40px, 4.6vw, 68px); line-height: .98; letter-spacing: -.04em; }
.story-nick { margin: 0 0 20px; color: color-mix(in srgb, var(--accent) 70%, white); font: italic 400 clamp(18px, 1.7vw, 24px)/1.35 Georgia, serif; }
.story-modal #storyCopy { margin: 0 0 24px; color: rgba(245, 237, 218, .8); font-size: clamp(16px, 1.25vw, 18px); line-height: 1.75; white-space: pre-line; }
.story-modal .tag-row { margin-bottom: 22px; }
.close-button { position: absolute; z-index: 2; right: 18px; top: 16px; width: 40px; height: 40px; border: 1px solid rgba(255, 255, 255, .14); border-radius: 50%; background: rgba(7, 27, 49, .8); color: var(--cream); font-size: 24px; }

.story-media { display: grid; gap: 14px; }
.story-media figure { margin: 0; overflow: hidden; border: 1px solid rgba(255, 255, 255, .12); border-radius: 20px; background: #02060f; }
.story-media img, .story-media canvas { display: block; width: 100%; height: auto; }
.story-media img { max-height: min(62vh, 660px); object-fit: contain; background: #000; }
.story-media figcaption { padding: 10px 14px 12px; color: rgba(245, 237, 218, .58); font: 600 10px/1.5 var(--mono); letter-spacing: .08em; }
.story-media figcaption a { color: var(--accent); }

.story-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 0 0 26px; }
.story-facts div { border: 1px solid rgba(255, 255, 255, .1); border-radius: 14px; background: rgba(255, 255, 255, .04); padding: 12px 14px; }
.story-facts dt { margin: 0 0 4px; color: var(--accent); font: 700 10px var(--mono); letter-spacing: .14em; text-transform: uppercase; }
.story-facts dd { margin: 0; color: var(--cream); font-size: 14px; line-height: 1.4; }

/* A moment of the life model gets a stage of its own: the year, large, in its theme colour. */
.story-visual {
  position: relative;
  min-height: clamp(260px, 46vh, 520px);
  overflow: hidden;
  border-radius: 24px;
  background: radial-gradient(circle at 72% 28%, var(--accent), transparent 3%), linear-gradient(135deg, #17334d, #090d1b 55%, #241b46);
}
.story-visual::before { content: ""; position: absolute; width: min(78%, 420px); aspect-ratio: 3 / 2; left: 50%; top: 54%; border: 1px solid color-mix(in srgb, var(--accent) 60%, transparent); transform: translate(-50%, -50%) perspective(500px) rotateX(64deg) rotateZ(30deg); box-shadow: 0 0 60px color-mix(in srgb, var(--accent) 35%, transparent); }
.story-visual::after { content: ""; position: absolute; left: -10%; right: -10%; bottom: -46px; height: 110px; border-top: 1px solid rgba(255, 204, 112, .28); transform: perspective(280px) rotateX(52deg); background: linear-gradient(90deg, transparent, rgba(97, 216, 220, .18), transparent); }
.story-year {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: grid;
  place-items: center;
  color: color-mix(in srgb, var(--accent) 78%, white);
  font: 700 clamp(96px, 13vw, 200px)/1 Georgia, serif;
  letter-spacing: -.06em;
  text-shadow: 0 0 70px color-mix(in srgb, var(--accent) 60%, transparent);
}

.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; border: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

[hidden] { display: none !important; }

@media (max-width: 900px) {
  .topbar { height: 72px; grid-template-columns: 1fr auto; padding: 14px 16px; }
  .view-controls { position: fixed; left: 50%; bottom: 14px; transform: translateX(-50%); }
  .sound-button { grid-column: 2; }
  #soundLabel { display: none; }
  .chapter-dock { display: none; }
  .hud-bl { top: 78px; bottom: auto; left: 16px; width: auto; }
  .key-legend { display: none; }
  .telemetry div:nth-child(2), .telemetry div:nth-child(4) { display: none; }
  .radar { width: 112px; height: 112px; right: 12px; top: 76px; bottom: auto; }
  .journey-controls { bottom: 72px; }
  .time-gauge { width: min(190px, 38vw); }
  .hud-notice { top: auto; bottom: 246px; max-width: calc(100vw - 24px); }
  .themes-view, .timeline-view, .atlas-view { inset: 72px 0 0; padding: 40px 20px 120px; }
  .themes-grid { grid-template-columns: 1fr; }
  .theme-card { min-height: 150px; }
  .theme-card .star { margin-bottom: 20px; }
  .story-modal { grid-template-columns: 1fr; width: calc(100vw - 16px); max-height: calc(100vh - 16px); max-height: calc(100dvh - 16px); gap: 20px; padding: 20px 16px 28px; border-radius: 24px; }
  .story-modal h2 { font-size: clamp(36px, 10vw, 48px); }
  /* On a phone the words come before the pictures, and clear of the close button. */
  .story-modal.cosmic .story-body { order: -1; padding-top: 0; }
  .story-modal.cosmic .eyebrow { padding-right: 52px; }
  .story-facts { grid-template-columns: 1fr; }
  .story-visual { min-height: 220px; }
  .close-button { right: 12px; top: 12px; }
}

@media (max-width: 480px) {
  .nav-button { padding: 8px 11px; font-size: 14px; }
}

@media (pointer: coarse) {
  .key-legend { display: none; }
  .touch-controls { display: flex; }
  .intro-keys, .intro-card > p.intro-note { display: none; }
  .intro-card > p.intro-touch { display: block; }
}

@media (max-height: 720px) {
  .radar { width: 136px; height: 136px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
