/* Layout: cockpit glass. Instruments sit on the canopy edges so the view stays clear;
   amber is reserved for things you can act on, ice blue for live readouts. */
:root {
  --void: #03050a;
  --glass: rgba(9, 14, 23, 0.66);
  --glass-strong: rgba(10, 16, 27, 0.9);
  --line: rgba(156, 184, 222, 0.16);
  --line-strong: rgba(156, 184, 222, 0.3);
  --ink: #e2e9f3;
  --ink-dim: #8e9cb2;
  --ink-faint: #5d6a80;
  --amber: #ffb547;
  --amber-ink: #1d1203;
  --amber-soft: rgba(255, 181, 71, 0.16);
  --ice: #93d6ff;
  --violet: #c7b4ff;
  --danger: #ff7a66;
  --font-display: "Chakra Petch", "Rajdhani", "Segoe UI", system-ui, sans-serif;
  --font-body: "Barlow", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-data: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --radius: 10px;
  --gutter: 16px;
  /* how far down the app's own controls start: the notch, plus the site header floating across the top (css/sitehead.css) */
  --safe-top: var(--site-head-total, env(safe-area-inset-top, 0px));
  color-scheme: dark;
}
/* no header in a lesson's figure, or when the controls are hidden: the controls go back to the top edge */
html.embed, body.ui-hidden { --safe-top: env(safe-area-inset-top, 0px); }

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; overflow: hidden; }
body {
  background: var(--void);
  color: var(--ink);
  font: 400 14px/1.45 var(--font-body);
  -webkit-font-smoothing: antialiased;
  touch-action: none;
}
button, select { font: inherit; color: inherit; }

/* Touch devices and the iOS app: behave like an app, not a web page. */
html { -webkit-tap-highlight-color: transparent; -webkit-text-size-adjust: 100%; }
body { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; overscroll-behavior: none; }
input, textarea, select, .blurb, .help-note, .gr-note { -webkit-user-select: text; user-select: text; }
.touch-row { display: none !important; }
@media (hover: none) and (pointer: coarse) {
  /* iOS zooms into any form field smaller than 16px when it gets focus */
  input, select, textarea, .ps-field input { font-size: 16px; }
  .kbd-row, .kbd-only, .tog kbd, .menu-action kbd { display: none !important; }
  .touch-row { display: grid !important; }
  button { touch-action: manipulation; }
}
/* Full screen is a desktop-browser feature; iPhones and the app are full screen already. */
.no-fullscreen [data-action="fullscreen"] { display: none !important; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
kbd {
  font: 500 11px var(--font-data);
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  padding: 1px 5px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.04);
}

#view { position: fixed; inset: 0; width: 100%; height: 100%; display: block; cursor: grab; }
#view:active { cursor: grabbing; }

/* ---------------------------------------------------------------- labels */
#labels, #sky-labels { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }
.lbl {
  position: absolute; left: 0; top: 0;
  display: flex; align-items: center; gap: 6px;
  white-space: nowrap;
  font: 500 12px/1 var(--font-body);
  letter-spacing: 0.02em;
  color: var(--ink);
  text-shadow: 0 0 4px #000, 0 0 10px rgba(0, 0, 0, 0.8);
  pointer-events: auto;
  cursor: pointer;
  will-change: transform;
  padding: 3px 4px;
}
.lbl::before {
  content: ""; width: 10px; height: 1px; background: currentColor; opacity: 0.55;
}
.lbl.planet { font: 600 12px/1 var(--font-display); text-transform: uppercase; letter-spacing: 0.12em; }
.lbl.star { color: #ffd9a0; font: 600 12px/1 var(--font-display); text-transform: uppercase; letter-spacing: 0.12em; }
.lbl.moon { color: #c2ccd9; font-size: 11px; }
.lbl.asteroid, .lbl.comet { color: #cdbfa8; font-size: 11px; }
.lbl.comet { color: #b9dcff; }
.lbl.visitor { color: #9ff0c4; font-weight: 600; }
.lbl.craft { color: #e6ecf5; font-size: 11px; font-weight: 600; letter-spacing: 0.02em; }
.lbl.craft::before { content: "◆ "; font-size: 8px; color: var(--amber); vertical-align: 1px; }
.lbl.dest { color: var(--amber); }
.lbl.dest::after { content: "◂ destination"; font: 500 10px var(--font-data); letter-spacing: 0; text-transform: none; opacity: 0.85; }
.lbl:hover { color: var(--amber); }
.lbl.feature {
  color: var(--ice); font: 500 11px/1 var(--font-data); letter-spacing: 0; cursor: default; pointer-events: none;
}
.lbl.feature::before { width: 6px; height: 6px; border-radius: 50%; border: 1px solid currentColor; background: transparent; opacity: 1; }
.lbl.const { color: rgba(147, 190, 255, 0.62); font: 600 10px/1 var(--font-display); text-transform: uppercase; letter-spacing: 0.24em; pointer-events: none; }
.lbl.const::before, .lbl.sname::before { display: none; }
.lbl.sname { color: rgba(220, 228, 240, 0.7); font: 400 10px/1 var(--font-body); pointer-events: none; transform-origin: left center; }
/* galaxies, nebulae and clusters: a small ring in the object's colour, then its name */
.lbl.dso { color: #d8cdf2; font: 500 11px/1 var(--font-body); letter-spacing: 0.04em; }
.lbl.dso::before {
  width: 7px; height: 7px; border-radius: 50%; background: transparent; opacity: 0.9;
  border: 1px solid var(--c, currentColor); box-shadow: 0 0 6px var(--c, transparent);
}
.lbl.dso.galaxy { color: #e9dcc0; }
.lbl.dso.nebula { color: #f2c9d6; }
.lbl.dso.cluster { color: #c9d8f5; }
.lbl.dso.dest { color: var(--amber); }
.lbl.dso:hover { color: var(--amber); }

/* ---------------------------------------------------------------- cockpit */
#cockpit { position: fixed; inset: 0; pointer-events: none; transition: opacity 0.4s; }
#cockpit.off { opacity: 0; }
#cockpit .canopy { position: absolute; inset: 0; width: 100%; height: 100%; }
#cockpit .edge { fill: none; stroke: rgba(255, 181, 71, 0.22); stroke-width: 1; }
#cockpit .vignette {
  position: absolute; inset: 0;
  background: radial-gradient(130% 100% at 50% 45%, transparent 58%, rgba(1, 2, 5, 0.6) 100%);
  box-shadow: inset 0 0 0 1px rgba(255, 181, 71, 0.06);
}
#cockpit .reticle { position: absolute; left: calc(50% + var(--view-shift-x, 0px)); top: calc(50% - var(--view-shift, 0px)); width: 120px; height: 120px; transform: translate(-50%, -50%); opacity: 0.55; }
.ret-ring { fill: none; stroke: rgba(147, 214, 255, 0.45); stroke-width: 1; }
.ret-tick { stroke: rgba(147, 214, 255, 0.5); stroke-width: 1; }
.ret-corner { fill: none; stroke: rgba(255, 181, 71, 0.45); stroke-width: 1.2; }

/* ---------------------------------------------------------------- panels */
.panel {
  position: fixed;
  background: var(--glass);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  backdrop-filter: blur(14px) saturate(1.2);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.35);
}
.eyebrow {
  font: 500 10px/1.2 var(--font-data);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
select {
  appearance: none;
  -webkit-appearance: none;
  background: rgba(255, 255, 255, 0.045) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5l3 3 3-3' fill='none' stroke='%238e9cb2' stroke-width='1.4'/%3E%3C/svg%3E") no-repeat right 8px center / 12px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  padding: 7px 28px 7px 10px;
  font: 500 13px/1.2 var(--font-body);
  color: var(--ink);
  min-width: 0;
  width: 100%;
}
select:hover { border-color: rgba(255, 181, 71, 0.5); }
select option, select optgroup { background: #0d1420; color: var(--ink); }
.btn-ghost {
  background: transparent;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  padding: 6px 10px;
  font: 500 12px/1 var(--font-body);
  color: var(--ink);
}
.btn-ghost:hover { border-color: var(--amber); color: var(--amber); }
.btn-ghost.wide { width: 100%; padding: 9px; }
.icon-btn {
  width: 32px; height: 32px;
  display: grid; place-items: center;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--glass);
  backdrop-filter: blur(10px);
  color: var(--ink-dim);
  font: 600 14px var(--font-display);
}
.icon-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.6; }
.icon-btn:hover { color: var(--amber); border-color: rgba(255, 181, 71, 0.5); }
.icon-btn.small { width: 26px; height: 26px; background: transparent; backdrop-filter: none; }

/* ---------------------------------------------------------------- zoom control */
.zoom {
  position: fixed; left: var(--gutter); top: 50%;
  transform: translateY(-50%);
  width: 60px;
  padding: 8px 0 9px;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  background: var(--glass);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  touch-action: none;
}
.zoom-btn {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border-radius: 8px;
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.04);
  color: var(--ink);
  -webkit-user-select: none; user-select: none;
}
.zoom-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.zoom-btn:hover { color: var(--amber); border-color: rgba(255, 181, 71, 0.5); }
.zoom-btn:active, .zoom-btn.holding { background: var(--amber-soft); color: var(--amber); border-color: var(--amber); }
.zoom-btn:disabled, .zoom input:disabled { opacity: 0.35; cursor: not-allowed; }
.zoom-track { position: relative; width: 38px; height: 170px; }
.zoom-track::before, .zoom-track::after {
  content: ""; position: absolute; left: 50%; width: 9px; height: 1px; background: var(--line-strong); transform: translateX(-50%);
}
.zoom-track::before { top: 9px; }
.zoom-track::after { bottom: 9px; }
.zoom-track input {
  position: absolute; left: 50%; top: 50%;
  width: 170px; height: 26px; margin: 0;
  transform: translate(-50%, -50%) rotate(-90deg);
  -webkit-appearance: none; appearance: none;
  background: transparent;
  cursor: pointer;
}
.zoom-track input::-webkit-slider-runnable-track {
  height: 3px; border-radius: 2px;
  background: linear-gradient(to right, rgba(156, 184, 222, 0.25), var(--ice));
}
.zoom-track input::-moz-range-track {
  height: 3px; border-radius: 2px;
  background: linear-gradient(to right, rgba(156, 184, 222, 0.25), var(--ice));
}
.zoom-track input::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 16px; height: 16px; margin-top: -6.5px;
  border-radius: 50%;
  background: var(--amber);
  border: 3px solid var(--amber-ink);
  box-shadow: 0 0 0 1px var(--amber), 0 0 10px rgba(255, 181, 71, 0.7);
}
.zoom-track input::-moz-range-thumb {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--amber);
  border: 3px solid var(--amber-ink);
  box-shadow: 0 0 0 1px var(--amber), 0 0 10px rgba(255, 181, 71, 0.7);
}
.zoom-track input:focus-visible { outline: none; }
.zoom-track input:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 2px var(--ink), 0 0 12px var(--amber); }
.zoom-readout { display: flex; flex-direction: column; align-items: center; gap: 2px; padding-top: 2px; }
.zoom-readout span { font: 500 9px/1 var(--font-data); letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-faint); }
.zoom-readout b { font: 500 10.5px/1.2 var(--font-data); color: var(--ice); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---------------------------------------------------------------- top bar */
.topbar {
  position: fixed; top: 0; left: 0;
  padding: calc(var(--safe-top) + 14px) var(--gutter) 0;
  display: flex; flex-direction: column; gap: 10px;
  pointer-events: none;
}
.topbar > * { pointer-events: auto; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark { width: 30px; height: 30px; fill: none; stroke: var(--amber); stroke-width: 1.6; }
.brand-mark circle { fill: rgba(255, 181, 71, 0.15); }
.brand-name { font: 700 17px/1 var(--font-display); letter-spacing: 0.2em; text-transform: uppercase; }
.brand-sub { font: 400 11px/1.4 var(--font-data); color: var(--ink-dim); letter-spacing: 0.04em; margin-top: 3px; }
.clock {
  display: flex; flex-direction: column; gap: 8px;
  padding: 10px 12px;
  background: var(--glass);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  backdrop-filter: blur(12px);
  width: max-content;
  max-width: calc(100vw - 2 * var(--gutter));
}
.clock-readout { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; font: 500 13px/1 var(--font-data); font-variant-numeric: tabular-nums; color: var(--ice); }
.clock-readout #clock-date { color: var(--ink); }
.clock-readout #clock-zone { margin-left: -4px; font-size: 11px; color: var(--ink-dim); }
.clock-controls { display: flex; gap: 6px; }
.clock-controls select { width: 132px; padding-block: 5px; font-size: 12px; }
/* Date: a button with the native date and time picker laid invisibly over it */
.clock-set { position: relative; display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.clock-set svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; }
.clock-set input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; padding: 0; border: 0; opacity: 0; font-size: 16px; cursor: pointer; color-scheme: dark; }
.clock-set:focus-within { border-color: var(--amber); color: var(--amber); }

.toggles {
  position: fixed; top: calc(var(--safe-top) + 14px); right: var(--gutter); z-index: 7;
  display: flex; gap: 6px; align-items: center;
}
.icon-btn svg { stroke-linecap: round; stroke-linejoin: round; }

/* share: a menu under the share button (to the left of the button stack on phones) */
.share-btn svg { width: 17px; height: 17px; }
.share-btn[aria-expanded="true"] { color: var(--amber); border-color: rgba(255, 181, 71, 0.5); }
.share-menu {
  position: absolute; top: calc(100% + 8px); right: 0; z-index: 8;
  width: 264px; padding: 6px; display: flex; flex-direction: column; gap: 2px;
  background: rgba(9, 14, 24, 0.96); border: 1px solid var(--line-strong); border-radius: 12px;
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.55);
  animation: menu-in 0.16s ease-out;
}
.share-menu button { display: flex; align-items: center; gap: 12px; padding: 10px; border: 0; border-radius: 8px; background: none; color: var(--ink); text-align: left; }
.share-menu button:hover { background: rgba(255, 255, 255, 0.05); }
.share-menu svg { width: 18px; height: 18px; flex: none; fill: none; stroke: var(--amber); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.share-menu span { display: flex; flex-direction: column; gap: 2px; }
.share-menu b { font: 500 14px/1.2 var(--font-body); }
.share-menu small { font-size: 11.5px; color: var(--ink-faint); }

/* sound: a speaker that shows waves when on and a cross when muted */
.sound-btn svg { width: 17px; height: 17px; }
.sound-btn .x { display: none; }
.sound-btn[aria-pressed="false"] { color: var(--ink-faint); }
.sound-btn[aria-pressed="false"] .w1, .sound-btn[aria-pressed="false"] .w2 { display: none; }
.sound-btn[aria-pressed="false"] .x { display: inline; }

/* View: one button that opens every display option, grouped */
.view-btn {
  height: 32px;
  display: inline-flex; align-items: center; gap: 8px;
  padding: 0 9px 0 11px;
  border-radius: 8px;
  border: 1px solid var(--line-strong);
  background: var(--glass);
  backdrop-filter: blur(10px);
  color: var(--ink);
  font: 600 12px/1 var(--font-body);
  letter-spacing: 0.03em;
}
.view-btn svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.view-btn .view-icon { color: var(--amber); }
.view-btn .view-chev { width: 13px; height: 13px; color: var(--ink-dim); transition: transform 0.2s; }
.view-count {
  min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9px;
  background: var(--amber-soft); color: var(--amber);
  font: 600 10.5px/18px var(--font-data); text-align: center; font-variant-numeric: tabular-nums;
}
.view-btn:hover, .toggles.open .view-btn { border-color: rgba(255, 181, 71, 0.55); }
.toggles.open .view-btn { background: var(--glass-strong); }
.toggles.open .view-chev { transform: rotate(180deg); }
.pill-btn {
  height: 32px;
  display: inline-flex; align-items: center; gap: 7px;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--glass);
  backdrop-filter: blur(10px);
  color: var(--ink);
  font: 500 12px/1 var(--font-body);
}
.pill-btn svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; }
.pill-btn:hover { color: var(--amber); border-color: rgba(255, 181, 71, 0.5); }
a.pill-btn, a.menu-action, a.sheet-poster { text-decoration: none; }
.events-btn svg { stroke: currentColor; }
.menu-action.events-btn svg, .sheet-poster svg { color: var(--amber); }
.sheet-poster + .sheet-poster, a.sheet-poster + .sheet-poster { margin-top: -12px; }

.tog-group {
  display: none;
  position: absolute; top: calc(100% + 8px); right: 0;
  width: 300px;
  max-height: calc(100vh - 90px - var(--safe-top));
  overflow-y: auto; overscroll-behavior: contain;
  flex-direction: column; gap: 8px;
  padding: 8px;
  background: rgba(9, 14, 24, 0.95);
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.55);
  animation: menu-in 0.16s ease-out;
}
.toggles.open .tog-group { display: flex; }
@keyframes menu-in { from { opacity: 0; transform: translateY(-4px); } }
.tog-section { display: flex; flex-direction: column; gap: 1px; }
.tog-section + .tog-section { padding-top: 6px; border-top: 1px solid var(--line); }
.tog-section .eyebrow { padding: 4px 8px 5px; }
.tog {
  display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 10px;
  width: 100%;
  padding: 7px 8px;
  border: 0; border-radius: 8px;
  background: transparent;
  text-align: left;
}
.tog:hover { background: rgba(255, 255, 255, 0.05); }
.tog-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.tog-text b { font: 500 13.5px/1.2 var(--font-body); color: var(--ink); }
.tog-text small { font-size: 11.5px; line-height: 1.3; color: var(--ink-faint); }
.tog kbd, .menu-action kbd { font-size: 10px; color: var(--ink-faint); }
.tog kbd { grid-column: 2; }
.tog .switch { grid-column: 3; }
@media (hover: none) { .tog kbd, .menu-action kbd { display: none; } }
.switch {
  position: relative; width: 30px; height: 18px; flex: none;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.1);
  box-shadow: inset 0 0 0 1px var(--line-strong);
  transition: background 0.2s;
}
.switch::after {
  content: ""; position: absolute; top: 3px; left: 3px;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--ink-dim);
  transition: transform 0.2s, background 0.2s;
}
.tog[aria-pressed="true"] .switch { background: var(--amber); box-shadow: 0 0 10px -2px var(--amber); }
.tog[aria-pressed="true"] .switch::after { transform: translateX(12px); background: var(--amber-ink); }
.tog.resting { opacity: 0.45; }
/* poster, help and full screen live in the top row here; on phones they move into the menu */
.tog-actions { display: none; flex-direction: column; gap: 1px; padding-top: 6px; border-top: 1px solid var(--line); }
.menu-action {
  display: flex; align-items: center; gap: 11px;
  width: 100%; padding: 10px 8px;
  border: 0; border-radius: 8px; background: transparent;
  color: var(--ink); font: 500 13.5px/1.2 var(--font-body); text-align: left;
}
.menu-action:hover { background: rgba(255, 255, 255, 0.05); }
.menu-action svg { width: 16px; height: 16px; fill: none; stroke: var(--amber); stroke-width: 1.5; stroke-linecap: round; flex: none; }
.menu-action .q { width: 16px; text-align: center; font: 600 14px/1 var(--font-display); color: var(--amber); }
.menu-action kbd { margin-left: auto; }

/* ---------------------------------------------------------------- hide every control */
.topbar, .toggles, #info, #console, .zoom, .hud { transition: opacity 0.25s ease, visibility 0.25s; }
body.ui-hidden :is(.topbar, .toggles, #info, #console, .zoom, .hud, #toast) { opacity: 0; visibility: hidden; pointer-events: none; }
.show-ui {
  position: fixed; top: calc(var(--safe-top) + 14px); right: var(--gutter); z-index: 6;
  opacity: 0.5; transition: opacity 0.2s;
  animation: show-ui-in 1.6s ease-out;
}
.show-ui:hover, .show-ui:focus-visible { opacity: 1; }
@keyframes show-ui-in {
  0%, 40% { opacity: 1; color: var(--amber); border-color: var(--amber); box-shadow: 0 0 14px -2px var(--amber); }
}

/* Dock: the only control left in clear view. Details and flight controls open above it on demand. */
.dock {
  position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom, 0px) + 14px); z-index: 6;
  transform: translateX(-50%);
  display: flex; align-items: center; gap: 2px;
  max-width: calc(100% - 2 * var(--gutter));
  padding: 5px 5px 5px 14px;
  background: var(--glass-strong);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 10px 34px rgba(0, 0, 0, 0.45);
  animation: dock-in 0.3s ease-out;
}
@keyframes dock-in { from { opacity: 0; transform: translate(-50%, 8px); } }
.dock-dest { position: relative; display: flex; align-items: center; gap: 9px; min-width: 0; padding: 4px 10px 4px 0; }
.dock-dot { flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--c, #888); box-shadow: 0 0 8px -1px var(--c, #888); }
.dock-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.dock-text b { font: 600 12.5px/1.1 var(--font-display); letter-spacing: 0.1em; text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dock-text span { font: 500 10.5px/1.1 var(--font-data); color: var(--ink-dim); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dock-progress { position: absolute; left: 19px; right: 10px; bottom: -2px; height: 2px; border-radius: 1px; background: rgba(255, 255, 255, 0.1); overflow: hidden; }
.dock-progress i { display: block; height: 100%; width: 0; background: var(--amber); box-shadow: 0 0 8px var(--amber); }
.dock-btn {
  flex: none; width: 40px; height: 40px;
  display: grid; place-items: center;
  border-radius: 50%; border: 1px solid transparent;
  background: transparent; color: var(--ink-dim);
}
.dock-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.dock-btn:hover { color: var(--ink); background: rgba(255, 255, 255, 0.05); }
.dock-btn[aria-pressed="true"] { color: var(--ice); background: rgba(147, 214, 255, 0.1); border-color: rgba(147, 214, 255, 0.28); }
.dock-go { margin-left: 4px; background: var(--amber); color: var(--amber-ink); box-shadow: 0 0 0 1px rgba(255, 181, 71, 0.4), 0 4px 16px -4px rgba(255, 181, 71, 0.7); }
.dock-go:hover { background: var(--amber); color: var(--amber-ink); filter: brightness(1.08); }
.dock-go svg { stroke-width: 2.1; }
.dock-abort { margin-left: 4px; color: var(--danger); border-color: rgba(255, 122, 102, 0.35); }
.dock-abort:hover { color: var(--danger); background: rgba(255, 122, 102, 0.1); }

/* Panels closed with × (or switched off under View); the dock stands in for the console. */
body.no-console #console, body.no-info #info { opacity: 0; visibility: hidden; pointer-events: none; }
body.no-console { --console-h: 52px; }
body.no-clock .clock, body.no-zoom .zoom { opacity: 0; visibility: hidden; pointer-events: none; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: -4px -6px -3px 0; }
.panel-close {
  width: 24px; height: 24px; display: grid; place-items: center; flex: none;
  border: 0; border-radius: 6px; background: transparent; color: var(--ink-faint);
}
.panel-close svg, .panel-close-inline svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.panel-close:hover { color: var(--ink); background: rgba(255, 255, 255, 0.06); }
.info-head .panel-close-inline { margin-left: -6px; }

/* Panels opened from the dock sit above it instead of in their usual places. */
body.ui-hidden { --dock-space: calc(env(safe-area-inset-bottom, 0px) + 14px + 52px + 10px); }
body.ui-hidden.peek-info #info, body.ui-hidden.peek-console #console, body.ui-hidden.peek-console #flight {
  opacity: 1; visibility: visible; pointer-events: auto;
}
/* mid-flight, the flight icon shows the flight readout only; the console is locked anyway */
body.ui-hidden.flying.peek-console #console { opacity: 0; visibility: hidden; pointer-events: none; }
body.ui-hidden #console { bottom: var(--dock-space); }
body.ui-hidden #flight { top: calc(var(--safe-top) + 62px); }
body.ui-hidden #info { max-height: calc(100% - 58px - var(--dock-space) - 12px - var(--safe-top)); }
body.ui-hidden.peek-console:not(.flying) #info { max-height: calc(100% - 58px - var(--dock-space) - var(--console-h, 170px) - 22px - var(--safe-top)); }

/* ---------------------------------------------------------------- info panel */
#info {
  top: calc(var(--safe-top) + 58px);
  right: var(--gutter);
  width: 320px;
  max-height: calc(100% - 58px - var(--console-h, 170px) - 36px - var(--safe-top) - env(safe-area-inset-bottom, 0px));
  display: flex; flex-direction: column;
  overflow: hidden;
}
.info-head { display: flex; align-items: flex-start; gap: 12px; padding: 14px 14px 12px; border-bottom: 1px solid var(--line); }
.swatch {
  flex: none; width: 34px; height: 34px; border-radius: 50%; margin-top: 2px;
  background: radial-gradient(circle at 35% 35%, rgba(255, 255, 255, 0.55), transparent 45%), var(--sw, #888);
  box-shadow: inset -6px -6px 12px rgba(0, 0, 0, 0.55), 0 0 18px -4px var(--sw, #888);
}
.info-title { flex: 1; min-width: 0; }
#info-name { margin: 3px 0 2px; font: 600 24px/1.05 var(--font-display); letter-spacing: 0.04em; text-wrap: balance; }
.info-sub { font-size: 12.5px; color: var(--ink-dim); }
#info.collapsed .info-body { display: none; }
#info.collapsed #info-collapse svg { transform: rotate(180deg); }
.info-body { overflow-y: auto; padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 14px; overscroll-behavior: contain; }
.info-body::-webkit-scrollbar { width: 6px; }
.info-body::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 3px; }
dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 5px 12px; }
dt { color: var(--ink-dim); font-size: 12.5px; }
dd { margin: 0; text-align: right; font: 500 12.5px/1.4 var(--font-data); font-variant-numeric: tabular-nums; min-width: 0; overflow-wrap: anywhere; }
.live { padding: 10px 11px; border-radius: 8px; background: rgba(147, 214, 255, 0.06); border: 1px solid rgba(147, 214, 255, 0.14); }
.live dd { color: var(--ice); }
/* Spacetime readout: violet, the same hue the curvature grid takes at the bottom of a well. */
.gr { display: flex; flex-direction: column; gap: 8px; padding: 10px 11px; border-radius: 8px; background: rgba(199, 180, 255, 0.06); border: 1px solid rgba(199, 180, 255, 0.16); }
.gr dd { color: var(--violet); }
.gr-note { margin: 0; font-size: 11.5px; line-height: 1.45; color: var(--ink-dim); }
.mag { background: rgba(110, 220, 255, 0.05); border-color: rgba(110, 220, 255, 0.16); }
.mag dd { color: var(--ice); }
.blurb { margin: 0; font-size: 13.5px; line-height: 1.55; color: #c9d3e1; max-width: 62ch; }
.chip-group { display: flex; flex-direction: column; gap: 7px; }
.chips { display: flex; flex-wrap: wrap; gap: 5px; }
.chip {
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.03);
  border-radius: 999px;
  padding: 4px 9px;
  font: 500 11.5px/1.2 var(--font-body);
  color: var(--ink);
}
.chip:hover { border-color: var(--amber); color: var(--amber); }
.chip.feature { border-color: rgba(147, 214, 255, 0.3); color: var(--ice); }
.chip.feature:hover { border-color: var(--ice); background: rgba(147, 214, 255, 0.08); color: var(--ice); }
.chip .dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 5px; vertical-align: 0; background: var(--c, #999); }

/* ---------------------------------------------------------------- flight console */
#console {
  left: 50%; bottom: calc(env(safe-area-inset-bottom, 0px) + 16px);
  transform: translateX(-50%);
  width: min(880px, calc(100% - 2 * var(--gutter)));
  padding: 12px 14px 10px;
  display: flex; flex-direction: column; gap: 9px;
}
.console-row { display: grid; grid-template-columns: 1.15fr 1.2fr 1fr auto; gap: 10px; align-items: end; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field label { font: 500 10px/1 var(--font-data); letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-faint); }
.btn-engage {
  height: 36px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 0 18px;
  border: 0; border-radius: 8px;
  background: var(--amber);
  color: var(--amber-ink);
  font: 700 13px/1 var(--font-display);
  letter-spacing: 0.16em; text-transform: uppercase;
  box-shadow: 0 0 0 1px rgba(255, 181, 71, 0.4), 0 6px 24px -6px rgba(255, 181, 71, 0.6);
}
.btn-engage svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; }
.btn-engage:hover { filter: brightness(1.08); }
.btn-engage:disabled { opacity: 0.4; cursor: not-allowed; box-shadow: none; }
.trip { font-size: 13px; color: var(--ink-dim); line-height: 1.5; min-height: 1.5em; }
.trip b { color: var(--ink); font-weight: 600; }
.trip .num { font: 500 12.5px var(--font-data); color: var(--ice); font-variant-numeric: tabular-nums; }
#compare summary { cursor: pointer; font: 500 11px var(--font-data); letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-faint); list-style: none; }
#compare summary::-webkit-details-marker { display: none; }
#compare summary::before { content: "+ "; color: var(--amber); }
#compare[open] summary::before { content: "− "; }
#compare summary:hover { color: var(--ink); }
.compare-scroll { overflow-x: auto; margin-top: 8px; max-height: 210px; overflow-y: auto; }
#compare-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
#compare-table td { padding: 4px 6px; border-top: 1px solid var(--line); white-space: nowrap; }
#compare-table td:last-child { text-align: right; font: 500 12px var(--font-data); color: var(--ice); font-variant-numeric: tabular-nums; }
#compare-table tr.sel td { color: var(--amber); }
#compare-table tr.sel td:last-child { color: var(--amber); }
#compare-table tr { cursor: pointer; }
#compare-table tr:hover td { background: rgba(255, 255, 255, 0.03); }

/* ---------------------------------------------------------------- flight HUD */
.hud {
  position: fixed; left: 50%; top: calc(var(--safe-top) + 16px);
  transform: translateX(-50%);
  z-index: 5;
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; column-gap: 6px;
  width: max-content; min-width: 260px; max-width: calc(100% - 2 * var(--gutter));
  padding: 6px 6px 9px 14px;
  background: var(--glass);
  border: 1px solid var(--line);
  border-radius: 12px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.hud-main {
  display: flex; align-items: baseline; gap: 10px; min-width: 0;
  padding: 2px 0; border: 0; background: none; text-align: left;
}
.hud-dot { flex: none; align-self: center; width: 6px; height: 6px; border-radius: 50%; background: var(--amber); box-shadow: 0 0 8px var(--amber); animation: hud-pulse 1.6s ease-in-out infinite; }
@keyframes hud-pulse { 50% { opacity: 0.35; } }
.hud-main b { font: 700 13px/1.2 var(--font-display); letter-spacing: 0.14em; text-transform: uppercase; color: var(--amber); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hud-left { font: 500 13px/1.2 var(--font-data); color: var(--ink); font-variant-numeric: tabular-nums; white-space: nowrap; }
.hud-abort {
  width: 28px; height: 28px; display: grid; place-items: center;
  border: 0; border-radius: 50%; background: transparent; color: var(--ink-faint);
}
.hud-abort svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.hud-abort:hover { color: var(--danger); background: rgba(255, 122, 102, 0.1); }
.hud-sub {
  grid-column: 1 / -1;
  display: flex; flex-wrap: wrap; gap: 0 12px;
  padding-left: 16px;
  font: 400 11px/1.4 var(--font-data); color: var(--ink-faint); font-variant-numeric: tabular-nums;
}
.hud-details {
  grid-column: 1 / -1;
  margin: 8px 8px 2px 16px; padding-top: 8px;
  border-top: 1px solid var(--line);
  grid-template-columns: auto 1fr; gap: 3px 14px;
}
.hud-details:not([hidden]) { display: grid; }
.hud-details dt { font-size: 11.5px; }
.hud-details dd { font-size: 12px; text-align: left; }
.flight-progress { position: absolute; left: 12px; right: 12px; bottom: 0; height: 2px; border-radius: 1px; background: rgba(255, 255, 255, 0.07); overflow: hidden; }
#flight-bar { height: 100%; width: 0; background: var(--amber); box-shadow: 0 0 8px var(--amber); }

#toast {
  position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom, 0px) + var(--console-h, 170px) + 30px);
  transform: translate(-50%, 10px);
  background: var(--glass-strong);
  border: 1px solid rgba(255, 181, 71, 0.4);
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 13px;
  opacity: 0; pointer-events: none;
  transition: opacity 0.3s, transform 0.3s;
  max-width: calc(100% - 2 * var(--gutter));
  text-align: center;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast b { color: var(--amber); font-weight: 600; }
/* the toast as a button: "About Saturn", after picking a world */
#toast.has-btn { padding: 0; }
#toast.show.has-btn { pointer-events: auto; }
.toast-btn {
  display: inline-flex; align-items: center; gap: 9px; min-height: 40px; padding: 0 12px 0 14px;
  border: 0; background: none; color: var(--ink); font: 500 13.5px/1.2 var(--font-body); white-space: nowrap;
}
.toast-btn .dot { flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--c); box-shadow: 0 0 8px -1px var(--c); }
.toast-btn svg { width: 14px; height: 14px; fill: none; stroke: var(--amber); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.toast-btn:active { opacity: 0.7; }

/* ---------------------------------------------------------------- phone bottom sheet (js/sheet.js) */
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 6;
  height: calc(100dvh - var(--safe-top) - 58px);
  display: flex; flex-direction: column;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: rgba(11, 16, 27, 0.9);
  backdrop-filter: blur(22px) saturate(1.3); -webkit-backdrop-filter: blur(22px) saturate(1.3);
  border: 1px solid var(--line-strong); border-bottom: 0;
  border-radius: 22px 22px 0 0;
  box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.45);
  will-change: transform;
}
.sheet.animating { transition: transform 0.46s cubic-bezier(0.22, 1, 0.36, 1); }
.sheet.animating .sheet-body { transition: opacity 0.3s ease; }
.sheet-handle { flex: none; width: 100%; height: 22px; display: grid; place-items: center; border: 0; background: none; touch-action: none; cursor: grab; }
.sheet-handle span { width: 38px; height: 5px; border-radius: 3px; background: rgba(226, 233, 243, 0.3); }
.sheet-head { flex: none; display: flex; align-items: center; gap: 12px; padding: 0 16px 14px; touch-action: none; }
.sheet-swatch {
  flex: none; width: 44px; height: 44px; border-radius: 50%;
  background: radial-gradient(circle at 34% 30%, rgba(255, 255, 255, 0.6), transparent 44%), var(--c, #888);
  box-shadow: inset -9px -9px 16px rgba(0, 0, 0, 0.55), 0 0 20px -6px var(--c, #888);
}
.sheet-title { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.sheet-title .eyebrow { color: var(--ink-dim); }
.sheet-title b { font: 600 20px/1.1 var(--font-display); letter-spacing: 0.03em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sheet-title b .lead { font-weight: 500; color: var(--ink-dim); margin-right: 0.3em; }
.sheet-title .eyebrow { text-transform: none; letter-spacing: 0.04em; font-size: 11.5px; }
/* pictures of worlds: a real render, or painted art for galaxies, nebulae and clusters */
.sheet-swatch.img, .world-chip .sw.img, .sheet-results .sw.img { background: var(--img) center / cover no-repeat; box-shadow: 0 0 22px -8px var(--c, #567); }
.world-chip .sw.img, .sheet-results .sw.img { box-shadow: none; }
:is(.sw, .sheet-swatch).dso.dso { background-color: #04070d; overflow: hidden; position: relative; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1); }
:is(.sw, .sheet-swatch).dso::before, :is(.sw, .sheet-swatch).dso::after { content: ""; position: absolute; inset: 0; border-radius: 50%; }
:is(.sw, .sheet-swatch).dso.dso-galaxy { background-image: radial-gradient(circle at 50% 50%, #fff 0 4%, var(--c) 10%, transparent 24%); }
:is(.sw, .sheet-swatch).dso.dso-galaxy::before { background: radial-gradient(ellipse 46% 15% at 50% 50%, color-mix(in srgb, var(--c) 90%, white) 0, transparent 100%), radial-gradient(ellipse 15% 46% at 50% 50%, color-mix(in srgb, var(--c) 40%, transparent) 0, transparent 100%); transform: rotate(-28deg); filter: blur(1.2px); }
:is(.sw, .sheet-swatch).dso.dso-galaxy::after { background: conic-gradient(from 20deg, transparent 0 10%, color-mix(in srgb, var(--c) 45%, transparent) 16%, transparent 28% 60%, color-mix(in srgb, var(--c) 45%, transparent) 66%, transparent 78%); -webkit-mask: radial-gradient(circle, transparent 12%, #000 30%, transparent 62%); mask: radial-gradient(circle, transparent 12%, #000 30%, transparent 62%); transform: rotate(-28deg) scaleY(0.4); }
:is(.sw, .sheet-swatch).dso.dso-nebula { background-image: radial-gradient(circle at 34% 40%, color-mix(in srgb, var(--c) 95%, white) 0, transparent 38%), radial-gradient(circle at 66% 62%, color-mix(in srgb, var(--c) 70%, #20003a) 0, transparent 42%), radial-gradient(circle at 56% 26%, color-mix(in srgb, var(--c) 55%, transparent) 0, transparent 34%); filter: saturate(1.2); }
:is(.sw, .sheet-swatch).dso.dso-nebula::before { background: radial-gradient(circle at 40% 54%, rgba(0, 0, 0, 0.55) 0, transparent 22%), radial-gradient(circle at 62% 38%, rgba(255, 255, 255, 0.85) 0 2.5%, transparent 4%), radial-gradient(circle at 28% 66%, rgba(255, 255, 255, 0.6) 0 2%, transparent 3.5%); }
:is(.sw, .sheet-swatch).dso.dso-cluster { background-image: radial-gradient(circle at 50% 50%, color-mix(in srgb, var(--c) 55%, transparent) 0, transparent 62%); }
:is(.sw, .sheet-swatch).dso.dso-cluster::before { background: radial-gradient(circle at 30% 34%, #fff 0 3%, transparent 5%), radial-gradient(circle at 62% 24%, #cfe0ff 0 3.5%, transparent 5.5%), radial-gradient(circle at 74% 56%, #fff 0 3%, transparent 5%), radial-gradient(circle at 44% 66%, #dbe7ff 0 4%, transparent 6%), radial-gradient(circle at 24% 62%, #fff 0 2.5%, transparent 4.5%), radial-gradient(circle at 54% 44%, #fff 0 4.5%, transparent 7%), radial-gradient(circle at 80% 30%, #bcd1ff 0 2.5%, transparent 4.5%), radial-gradient(circle at 36% 84%, #fff 0 2.5%, transparent 4.5%); }
:is(.sw, .sheet-swatch).dso.dso-cluster::after { background: radial-gradient(circle at 50% 50%, transparent 40%, rgba(2, 4, 9, 0.7) 78%); }
.sheet-title span:last-child { font: 400 12.5px/1.3 var(--font-data); color: var(--ink-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.sheet-fly {
  flex: none; height: 48px; padding: 0 20px 0 22px; border: 0; border-radius: 24px;
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--amber); color: var(--amber-ink);
  font: 700 15px/1 var(--font-display); letter-spacing: 0.1em; text-transform: uppercase;
  box-shadow: 0 0 0 1px rgba(255, 181, 71, 0.4), 0 8px 24px -8px rgba(255, 181, 71, 0.8);
}
.sheet-fly svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.sheet-fly:active { transform: scale(0.96); }
.sheet-abort { flex: none; width: 46px; height: 46px; display: grid; place-items: center; border-radius: 50%; border: 1px solid rgba(255, 122, 102, 0.45); background: rgba(255, 122, 102, 0.08); color: var(--danger); }
.sheet-abort svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.sheet-where { flex: none; height: 42px; padding: 0 16px; border-radius: 21px; border: 1px solid var(--line-strong); background: rgba(255, 255, 255, 0.05); font: 600 14px var(--font-body); color: var(--ink); }
.sheet-progress { flex: none; height: 3px; margin: -6px 16px 10px; border-radius: 2px; background: rgba(255, 255, 255, 0.08); overflow: hidden; }
.sheet-progress i { display: block; height: 100%; width: 0; background: var(--amber); box-shadow: 0 0 8px var(--amber); }
.sheet-body {
  flex: 1; min-height: 0; overflow: hidden;
  display: flex; flex-direction: column; gap: 22px;
  padding: 2px 16px 28px;
  touch-action: pan-x; overscroll-behavior: contain;
}
.sheet.full .sheet-body { overflow-y: auto; touch-action: auto; -webkit-overflow-scrolling: touch; }
.sheet-search { flex: none; display: flex; align-items: center; gap: 8px; height: 44px; padding: 0 8px 0 12px; border-radius: 12px; background: rgba(255, 255, 255, 0.07); }
.sheet-search svg { width: 18px; height: 18px; flex: none; fill: none; stroke: var(--ink-dim); stroke-width: 1.8; stroke-linecap: round; }
.sheet-search input { flex: 1; min-width: 0; height: 100%; border: 0; background: none; color: var(--ink); font: 400 16px var(--font-body); outline: none; -webkit-appearance: none; appearance: none; }
.sheet-search input::placeholder { color: var(--ink-faint); }
.sheet-search input::-webkit-search-cancel-button { display: none; }
.sheet-search button { width: 30px; height: 30px; display: grid; place-items: center; border: 0; border-radius: 50%; background: rgba(255, 255, 255, 0.12); color: var(--ink); }
.sheet-search button svg { width: 12px; height: 12px; stroke: currentColor; stroke-width: 2.4; }
.sheet-worlds { display: flex; flex-direction: column; gap: 14px; }
.world-group { display: flex; flex-direction: column; gap: 4px; }
.world-row { display: flex; gap: 6px; overflow-x: auto; margin: 0 -16px; padding: 6px 16px 2px; scrollbar-width: none; scroll-snap-type: x proximity; scroll-padding: 16px; }
.world-row::-webkit-scrollbar { display: none; }
.world-chip {
  flex: none; width: 68px; display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 0; border: 0; background: none; color: var(--ink); scroll-snap-align: start;
  font: 500 11.5px/1.15 var(--font-body);
}
.world-chip .sw {
  width: 50px; height: 50px; border-radius: 50%;
  background: radial-gradient(circle at 34% 30%, rgba(255, 255, 255, 0.55), transparent 44%), var(--c);
  box-shadow: inset -9px -9px 16px rgba(0, 0, 0, 0.55);
  transition: transform 0.15s;
}
.world-chip:active .sw { transform: scale(0.92); }
.world-chip.sel .sw { box-shadow: inset -9px -9px 16px rgba(0, 0, 0, 0.55), 0 0 0 2px #0b101b, 0 0 0 4px var(--amber), 0 0 18px -2px var(--amber); }
.world-chip .nm { max-width: 68px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.world-chip.sel .nm { color: var(--amber); }
.world-chip em { margin-top: -4px; font: 600 9.5px/1 var(--font-data); font-style: normal; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ice); }
.sheet-results { display: flex; flex-direction: column; }
.sheet-results .result { display: flex; align-items: center; gap: 12px; padding: 10px 2px; border: 0; border-bottom: 1px solid var(--line); background: none; color: var(--ink); text-align: left; }
.sheet-results .sw { flex: none; width: 34px; height: 34px; border-radius: 50%; background: radial-gradient(circle at 34% 30%, rgba(255, 255, 255, 0.5), transparent 44%), var(--c); box-shadow: inset -6px -6px 10px rgba(0, 0, 0, 0.5); }
.sheet-results .tx { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.sheet-results b { font: 500 15.5px var(--font-body); }
.sheet-results small { font-size: 12.5px; color: var(--ink-dim); }
.sheet-results .none { margin: 8px 0; color: var(--ink-dim); font-size: 14px; }
.sheet-group { display: flex; flex-direction: column; gap: 8px; }
.sheet-list { border-radius: 14px; background: rgba(255, 255, 255, 0.05); overflow: hidden; }
.sheet-row { position: relative; display: flex; align-items: center; gap: 8px; min-height: 50px; padding: 0 14px; font: 400 15.5px var(--font-body); color: var(--ink); }
.sheet-row + .sheet-row { border-top: 1px solid var(--line); }
.sheet-value { margin-left: auto; max-width: 58%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-dim); }
.sheet-row .chev, .sheet-poster .chev { color: var(--ink-faint); font-size: 22px; line-height: 1; }
/* the real select sits invisibly over the row, so tapping the row opens iOS's own picker */
.sheet-select select { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; font-size: 16px; }
.sheet-trip .trip { font-size: 13px; line-height: 1.5; }
.sheet-trip .trip .extra { display: inline; }
.sheet-about .info-body { padding: 0; overflow: visible; gap: 14px; }
.sheet-time .clock { width: auto; max-width: none; padding: 12px 14px; background: rgba(255, 255, 255, 0.05); border: 0; border-radius: 14px; backdrop-filter: none; }
.sheet-time .clock-controls select { width: auto; flex: 1; font-size: 16px; padding-block: 8px; }
.sheet-time .clock-controls .btn-ghost { padding: 9px 14px; font-size: 14px; }
.sheet-poster {
  display: flex; align-items: center; gap: 14px; padding: 14px;
  border-radius: 14px; border: 1px solid rgba(255, 181, 71, 0.28); background: rgba(255, 181, 71, 0.07);
  color: var(--ink); text-align: left;
}
.sheet-poster svg { width: 28px; height: 28px; flex: none; fill: none; stroke: var(--amber); stroke-width: 1.4; stroke-linecap: round; }
.sheet-poster span:not(.chev) { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.sheet-poster b { font: 600 15px var(--font-body); }
.sheet-poster small { font-size: 12.5px; color: var(--ink-dim); }
body.has-sheet #info, body.has-sheet #console, body.has-sheet #flight, body.has-sheet .dock { display: none !important; }
/* the clock lives in the sheet on phones, whatever the desktop Clock switch says */
body.has-sheet .sheet .clock { opacity: 1; visibility: visible; pointer-events: auto; }
body.has-sheet #toast { bottom: calc(var(--sheet-h, 110px) + 12px); }
body.ui-hidden .sheet { transform: translate3d(0, calc(100% + 20px), 0) !important; transition: transform 0.35s ease; }
.tog-sheet-head { display: none; }

/* ---------------------------------------------------------------- event viewpoint bar */
.event-bar {
  position: fixed; left: 50%; top: calc(var(--safe-top) + 14px); transform: translateX(-50%); z-index: 6;
  width: min(560px, calc(100% - 2 * var(--gutter) - 560px)); min-width: 380px;
  display: flex; flex-direction: column; gap: 8px; padding: 10px 10px 10px;
  background: rgba(9, 14, 24, 0.9); border: 1px solid var(--line-strong); border-top: 2px solid var(--c, var(--amber));
  border-radius: 14px; backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.45);
  animation: menu-in 0.2s ease-out;
}
body.flying .event-bar, body.ui-hidden .event-bar { opacity: 0; visibility: hidden; pointer-events: none; }
.evb-head { display: flex; align-items: center; gap: 8px; }
.evb-back, .evb-close { flex: none; width: 30px; height: 30px; display: grid; place-items: center; border: 0; border-radius: 8px; background: none; color: var(--ink-dim); }
.evb-back:hover, .evb-close:hover { color: var(--ink); background: rgba(255, 255, 255, 0.06); }
.evb-back svg, .evb-close svg, .evb-arrow svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.evb-titles { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.evb-meta { font: 500 10.5px var(--font-data); letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.evb-meta b { color: var(--c, var(--amber)); font-weight: 500; }
#evb-title { font: 600 15px/1.2 var(--font-display); letter-spacing: 0.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.evb-nav { display: flex; align-items: center; gap: 6px; }
.evb-arrow { flex: none; width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; border: 1px solid var(--line-strong); background: rgba(255, 255, 255, 0.04); color: var(--ink); }
.evb-arrow:disabled { opacity: 0.3; }
.evb-povs { flex: 1; min-width: 0; display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; scroll-snap-type: x proximity; }
.evb-povs::-webkit-scrollbar { display: none; }
.evb-povs button {
  flex: none; height: 34px; padding: 0 14px; border-radius: 17px; scroll-snap-align: center;
  border: 1px solid var(--line-strong); background: transparent; color: var(--ink-dim); font: 500 13px var(--font-body); white-space: nowrap;
}
.evb-povs button[aria-selected="true"] { background: var(--amber); border-color: var(--amber); color: var(--amber-ink); font-weight: 600; }
.evb-note { margin: 0 4px; font-size: 12px; color: var(--ink-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 1720px) { .event-bar { top: calc(var(--safe-top) + 62px); width: min(560px, calc(100% - 2 * var(--gutter))); } }

/* ---------------------------------------------------------------- guided tour */
.guide { position: fixed; inset: 0; z-index: 9; pointer-events: none; }
.guide-spot {
  position: fixed; border-radius: 14px;
  box-shadow: 0 0 0 9999px rgba(2, 4, 9, 0.5), 0 0 0 2px var(--amber), 0 0 24px 2px rgba(255, 181, 71, 0.45);
  transition: left 0.25s, top 0.25s, width 0.25s, height 0.25s;
  animation: spot-pulse 1.8s ease-in-out infinite;
}
@keyframes spot-pulse { 50% { box-shadow: 0 0 0 9999px rgba(2, 4, 9, 0.5), 0 0 0 3px var(--amber), 0 0 34px 6px rgba(255, 181, 71, 0.35); } }
/* a fingertip: where the demo is touching, like the touch dots in a screen recording */
.guide-touch {
  position: fixed; left: -22px; top: -22px; width: 44px; height: 44px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0.18) 62%, transparent 70%);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.85), 0 4px 18px rgba(0, 0, 0, 0.4);
  will-change: transform, opacity;
}
.guide-touch.pointer { border-radius: 50%; width: 28px; height: 28px; left: -14px; top: -14px; }
.guide-touch::after {
  content: ""; position: absolute; inset: -2px; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.9); opacity: 0;
}
.guide-touch.tapping::after { animation: tap-ring 0.7s ease-out; }
@keyframes tap-ring { 0% { opacity: 1; transform: scale(1); } 100% { opacity: 0; transform: scale(2.4); } }
.guide-wheel {
  position: fixed; left: 50%; top: 52%; transform: translate(-50%, -50%);
  width: 64px; display: flex; flex-direction: column; align-items: center; gap: 6px;
  color: rgba(255, 255, 255, 0.9);
}
.guide-wheel svg { width: 44px; height: 66px; fill: rgba(255, 255, 255, 0.12); stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }
.guide-wheel .a { position: absolute; left: 50%; transform: translateX(-50%); font-size: 13px; opacity: 0; }
.guide-wheel .a.up { top: -22px; } .guide-wheel .a.down { bottom: -22px; }
.guide-wheel.up .w { animation: wheel-up 0.6s linear infinite; } .guide-wheel.up .a.up { opacity: 1; }
.guide-wheel.down .w { animation: wheel-down 0.6s linear infinite; } .guide-wheel.down .a.down { opacity: 1; }
.guide-wheel.faint { opacity: 0.5; }
@keyframes wheel-up { from { transform: translateY(6px); opacity: 0.2; } to { transform: translateY(-3px); opacity: 1; } }
@keyframes wheel-down { from { transform: translateY(-3px); opacity: 0.2; } to { transform: translateY(6px); opacity: 1; } }
.guide-card {
  position: fixed; left: 50%; transform: translateX(-50%);
  top: calc(var(--safe-top) + 72px);
  width: min(420px, calc(100% - 2 * var(--gutter)));
  display: flex; flex-direction: column; gap: 8px;
  padding: 14px 16px 14px;
  background: rgba(9, 14, 24, 0.94);
  border: 1px solid rgba(255, 181, 71, 0.45);
  border-radius: 14px;
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.55);
  pointer-events: auto;
  animation: menu-in 0.2s ease-out;
}
.guide-card.low { top: auto; bottom: calc(env(safe-area-inset-bottom, 0px) + 96px); }
.guide-top { display: flex; align-items: center; justify-content: space-between; margin: -4px -6px -2px 0; }
.guide-top .eyebrow { color: var(--amber); }
.guide-card h3 { margin: 0; font: 700 19px/1.15 var(--font-display); letter-spacing: 0.04em; text-wrap: balance; }
.guide-card p { margin: 0; font-size: 14px; line-height: 1.5; color: #c9d3e1; }
.guide-card .guide-try:empty { display: none; }
.guide-card .guide-try { font-weight: 600; color: var(--ice); }
.guide-card .guide-try.waiting::before { content: ""; display: inline-block; width: 7px; height: 7px; margin-right: 8px; border-radius: 50%; background: var(--ice); vertical-align: 1px; animation: hud-pulse 1.2s ease-in-out infinite; }
.guide-card .guide-try.ok { color: #9be7a8; }
.guide-card .guide-try.ok::before { content: "✓ "; }
.guide-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; margin-top: 4px; }
.guide-actions .btn-engage { height: 36px; padding: 0 16px; letter-spacing: 0.1em; }
.guide-actions #guide-back { margin-right: auto; }
.help-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
body.touring #toast { opacity: 0; }

/* ---------------------------------------------------------------- help + loader */
.modal {
  position: fixed; inset: 0; display: grid; place-items: center; background: rgba(2, 4, 8, 0.6); z-index: 10;
  padding: max(var(--gutter), env(safe-area-inset-top, 0px)) var(--gutter) max(var(--gutter), env(safe-area-inset-bottom, 0px));
}
.modal-card {
  width: min(560px, 100%);
  max-height: 100%;
  overflow-y: auto;
  background: var(--glass-strong);
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  padding: 22px 22px 18px;
  display: flex; flex-direction: column; gap: 14px;
}
.modal-card h2 { margin: 0; font: 700 20px var(--font-display); letter-spacing: 0.14em; text-transform: uppercase; }
.help-grid { display: grid; gap: 8px; }
.help-grid > div { display: grid; grid-template-columns: 200px 1fr; gap: 10px; align-items: baseline; font-size: 13.5px; }
.help-grid .keys { color: var(--ink-dim); font-size: 12px; }
.help-grid .what { color: #c9d3e1; }
.help-note { margin: 0; font-size: 13.5px; line-height: 1.55; color: #c9d3e1; }
.help-credit { margin: 0; font-size: 11.5px; color: var(--ink-faint); line-height: 1.5; }
.modal-card .btn-engage { align-self: flex-end; }
.modal-card > * { flex-shrink: 0; } /* scroll the card rather than squash its contents on short screens */

/* ---------------------------------------------------------------- poster studio */
.poster-modal { padding: 20px; }
.poster-card {
  width: min(1180px, 100%); height: min(860px, 100%);
  display: grid; grid-template-columns: minmax(0, 1fr) 360px;
  background: #0a0f1a;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
}
.ps-preview {
  min-width: 0; min-height: 0;
  display: grid; place-items: center;
  padding: 24px;
  background: radial-gradient(ellipse at center, rgba(147, 214, 255, 0.05), transparent 70%), #04060c;
}
#ps-canvas { display: block; border-radius: 3px; box-shadow: 0 18px 50px rgba(0, 0, 0, 0.65), 0 0 0 1px rgba(255, 255, 255, 0.06); }
.ps-form {
  display: flex; flex-direction: column; gap: 13px;
  padding: 20px 20px 18px;
  overflow-y: auto; overscroll-behavior: contain;
  border-left: 1px solid var(--line);
}
.ps-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.ps-head h2 { margin: 4px 0 0; font: 700 21px/1.1 var(--font-display); letter-spacing: 0.06em; }
.ps-lede { margin: 0; font-size: 13px; line-height: 1.5; color: var(--ink-dim); }
.ps-field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.ps-field > span { font: 500 10px/1 var(--font-data); letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-faint); }
.ps-field em { font-style: normal; letter-spacing: 0.04em; text-transform: none; color: var(--ink-faint); opacity: 0.8; }
.ps-field input {
  width: 100%; min-width: 0;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  padding: 8px 10px;
  font: 500 13.5px/1.2 var(--font-body);
  color: var(--ink);
  color-scheme: dark;
}
.ps-field input:focus { border-color: rgba(255, 181, 71, 0.6); outline: none; }
.ps-field input::placeholder { color: var(--ink-faint); opacity: 1; }
/* iOS date and time fields have a built-in minimum width and centred text; make them behave like the rest */
.ps-form, .ps-row > * { min-width: 0; }
.ps-field input[type="date"], .ps-field input[type="time"] { -webkit-appearance: none; appearance: none; display: block; min-height: 38px; }
.ps-field input::-webkit-date-and-time-value { text-align: left; }
.ps-row { display: grid; grid-template-columns: 1.3fr 1fr; gap: 10px; }
.ps-note { margin: -4px 0 0; font-size: 12px; color: var(--danger); }
.ps-themes { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ps-theme {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 10px;
  border: 1px solid var(--line-strong); border-radius: 8px;
  background: transparent; font: 500 13px var(--font-body); color: var(--ink-dim);
}
.ps-theme[aria-checked="true"] { color: var(--ink); border-color: var(--amber); background: var(--amber-soft); }
.ps-theme .sw { width: 18px; height: 18px; border-radius: 4px; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2); }
.ps-theme .sw.midnight { background: radial-gradient(circle at 50% 45%, #ffcf6e 0 2px, transparent 3px), radial-gradient(circle, #0d1730, #03050b); }
.ps-theme .sw.ivory { background: radial-gradient(circle at 50% 45%, #c8902c 0 2px, transparent 3px), #f3ebdb; }
.ps-check { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-dim); }
.ps-check input { accent-color: var(--amber); width: 15px; height: 15px; }
.ps-check-hint { align-items: flex-start; }
.ps-check-hint input { margin-top: 2px; flex: none; }
.ps-check-hint span { display: flex; flex-direction: column; gap: 2px; }
.ps-check-hint small { font-size: 11.5px; line-height: 1.4; color: var(--ink-faint); }
.ps-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.ps-actions .btn-engage { width: 100%; height: 42px; }
.ps-actions .btn-ghost { width: 100%; padding: 10px; }
.ps-status { margin: 0; min-height: 1.4em; font-size: 12px; color: var(--ice); overflow-wrap: anywhere; }
body.poster-open #dock, body.poster-open .show-ui { visibility: hidden; }

#loader {
  position: fixed; inset: 0; z-index: 20;
  display: grid; place-items: center;
  background: radial-gradient(ellipse at center, #0a1220 0%, var(--void) 70%);
  transition: opacity 0.8s;
}
#loader.done { opacity: 0; pointer-events: none; }
.loader-inner { display: flex; flex-direction: column; align-items: center; gap: 14px; width: min(320px, 80vw); }
.brand-mark.big { width: 64px; height: 64px; animation: spin 14s linear infinite; }
.loader-title { font: 700 22px/1 var(--font-display); letter-spacing: 0.06em; }
.loader-tag { margin-top: -6px; font: 500 11px/1 var(--font-display); letter-spacing: 0.24em; text-transform: uppercase; color: var(--ink-dim); }
.loader-bar { width: 100%; height: 2px; background: rgba(255, 255, 255, 0.1); border-radius: 1px; overflow: hidden; }
#loader-fill { height: 100%; width: 0; background: var(--amber); transition: width 0.2s; }
.loader-text { font: 400 12px var(--font-data); color: var(--ink-dim); text-align: center; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------------------------------------------------------- small screens */
@media (max-width: 1100px) {
  .hud { top: calc(var(--safe-top) + 60px); }
  /* the top row would run into the brand: Poster, Learn and Events keep their icons and lose their words */
  .pill-btn.row-only { width: 32px; padding: 0; justify-content: center; }
  .pill-btn.row-only span { display: none; }
  .brand-sub { display: none; }
}
/* Tablets: the desktop layout, with controls sized for a finger rather than a mouse pointer */
@media (pointer: coarse) and (min-width: 720px) and (min-height: 500px) {
  .icon-btn, .view-btn, .pill-btn { height: 40px; }
  .icon-btn, .pill-btn.row-only { width: 40px; }
  .icon-btn svg, .pill-btn svg { width: 18px; height: 18px; }
  .icon-btn.small, .panel-close { width: 36px; height: 36px; }
  .panel-head { margin-block: -8px -6px; }
  .info-head .icon-btn.small { margin: -4px -4px 0 0; }
  select { padding-block: 10px; font-size: 15px; }
  .clock-controls select { width: 150px; padding-block: 9px; font-size: 15px; }
  .clock-controls .btn-ghost { padding: 0 14px; font-size: 14px; }
  .btn-engage { height: 44px; }
  .btn-ghost.wide { padding: 12px; }
  .chip { padding: 8px 12px; font-size: 13px; }
  .tog { padding-block: 10px; }
  .menu-action { padding-block: 12px; }
  .hud-abort { width: 40px; height: 40px; }
  .dock-btn { width: 46px; height: 46px; }
  .evb-arrow, .evb-povs button { height: 40px; }
  .evb-arrow { width: 40px; }
  .evb-back, .evb-close { width: 38px; height: 38px; }
  .zoom-btn { width: 44px; height: 44px; }
  .zoom { width: 64px; }
  .toggles { gap: 8px; }
  #info { top: calc(var(--safe-top) + 66px); }
}
@media (max-width: 900px) {
  .console-row { grid-template-columns: 1fr 1fr; }
  .console-row .field:nth-child(3) { grid-column: 1; }
  .btn-engage { grid-column: 2; }
  #info { width: 290px; }
}
@media (max-width: 720px), (max-height: 500px) and (pointer: coarse) {
  :root { --gutter: 12px; }
  .brand-sub { display: none; }
  .brand-name { font-size: 15px; }
  .clock { padding: 8px 10px; }
  /* Phones: a small stack of map-style buttons at the top right (Layers, clear view)... */
  /* (no blur on the stack itself: it would trap the fixed-position Layers sheet inside it) */
  .toggles { top: calc(var(--safe-top) + 10px); flex-direction: column; gap: 0; transition: opacity 0.25s, visibility 0.25s; }
  .toggles > .view-btn, .toggles > #btn-hide-ui, .toggles > #btn-sound, .toggles > #btn-share {
    width: 48px; height: 46px; padding: 0; justify-content: center;
    background: rgba(11, 16, 27, 0.84); border: 1px solid var(--line-strong);
    backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
  }
  .toggles > .view-btn { border-radius: 14px 14px 0 0; border-bottom-color: var(--line); }
  .toggles > #btn-sound { border-radius: 0; border-top: 0; border-bottom-color: var(--line); }
  .toggles > #btn-share { border-radius: 0; border-top: 0; border-bottom-color: var(--line); }
  .share-menu { top: 0; right: calc(100% + 8px); width: min(264px, calc(100vw - 90px)); }
  .toggles > #btn-hide-ui { border-radius: 0 0 14px 14px; border-top: 0; }
  /* the full-height sheet covers the top of the screen, so the buttons step aside */
  body.sheet-full .toggles:not(.open) { opacity: 0; visibility: hidden; }
  .toggles > .view-btn svg.view-icon { width: 19px; height: 19px; }
  .view-btn .view-count { position: absolute; top: 4px; right: 3px; min-width: 15px; height: 15px; padding: 0 3px; font-size: 9px; line-height: 15px; }
  .view-btn { position: relative; }
  .view-label, .view-chev, .row-only, .wide-only { display: none !important; }
  .show-ui { top: calc(var(--safe-top) + 10px); width: 44px; height: 44px; }
  /* ...and Layers opens as a bottom sheet over a dimmed view */
  /* (the dimmer and the sheet sit above the button stack, so the stack can't cover Done or catch taps meant for it) */
  .toggles.open::before { content: ""; position: fixed; inset: 0; z-index: 1; background: rgba(2, 4, 9, 0.45); animation: fade-in 0.2s ease-out; }
  .toggles.open .tog-group { z-index: 2; }
  @keyframes fade-in { from { opacity: 0; } }
  .tog-group {
    position: fixed; top: auto; left: 0; right: 0; bottom: 0; width: auto;
    max-height: min(82dvh, calc(100dvh - env(safe-area-inset-top, 0px) - 40px));
    padding: 0 12px calc(env(safe-area-inset-bottom, 0px) + 12px);
    border-radius: 22px 22px 0 0; border-bottom: 0;
    background: rgba(11, 16, 27, 0.96);
    animation: sheet-up 0.38s cubic-bezier(0.22, 1, 0.36, 1);
  }
  @keyframes sheet-up { from { transform: translateY(100%); } }
  .tog-sheet-head {
    position: sticky; top: 0; z-index: 1; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
    margin: 0 -12px; padding: 14px 16px 10px; background: rgba(11, 16, 27, 0.96);
  }
  .tog-sheet-head .grab { position: absolute; top: 6px; left: 50%; width: 38px; height: 5px; margin-left: -19px; border-radius: 3px; background: rgba(226, 233, 243, 0.3); }
  .tog-sheet-head b { grid-column: 2; font: 600 17px var(--font-display); letter-spacing: 0.06em; }
  .tog-done { grid-column: 3; justify-self: end; border: 0; background: none; color: var(--amber); font: 600 16px var(--font-body); padding: 6px 2px; }
  .tog { padding-block: 10px; }
  .tog-actions { display: flex; }
  .sheet-head .eyebrow { font-size: 10px; }
  .guide-card { top: calc(var(--safe-top) + 116px); }
  .event-bar { left: var(--gutter); transform: none; top: calc(var(--safe-top) + 58px); width: calc(100% - 2 * var(--gutter) - 60px); min-width: 0; }
  .evb-note { display: none; }
  #info { top: auto; bottom: calc(env(safe-area-inset-bottom, 0px) + var(--console-h, 170px) + 20px); left: var(--gutter); right: var(--gutter); width: auto; max-height: calc(100% - var(--console-h, 170px) - 20px - 150px - var(--safe-top)); }
  #info.collapsed { max-height: none; }
  body.ui-hidden #info { bottom: var(--dock-space); max-height: min(60%, calc(100% - 52px - 100px - var(--safe-top) - env(safe-area-inset-bottom, 0px))); }
  .dock { padding-left: 12px; }
  .info-head { padding: 10px 12px; }
  #info-name { font-size: 20px; }
  .swatch { width: 26px; height: 26px; }
  #console { padding: 10px; gap: 7px; bottom: calc(env(safe-area-inset-bottom, 0px) + 10px); }
  .console-row { gap: 8px; }
  #compare { display: none; }
  .trip { font-size: 12px; }
  .trip .extra { display: none; }
  #toast { bottom: calc(env(safe-area-inset-bottom, 0px) + var(--console-h, 170px) + 112px); border-radius: 12px; width: max-content; font-size: 12.5px; }
  /* above the sheet, centred in the space left of the zoom buttons rather than over them */
  body.has-sheet #toast { left: calc(50% - 31px); max-width: calc(100% - 2 * var(--gutter) - 62px); }
  body.has-sheet.sheet-full #toast, body.has-sheet.no-zoom #toast { left: 50%; max-width: calc(100% - 2 * var(--gutter)); }
  .hud { top: calc(var(--safe-top) + 124px); min-width: 0; }
  .help-grid > div { grid-template-columns: 1fr; gap: 2px; }
  #cockpit .reticle { width: 90px; height: 90px; }
  .poster-modal { padding: 0; }
  .poster-card { height: 100%; border-radius: 0; border: 0; grid-template-columns: 1fr; grid-template-rows: minmax(0, 46%) minmax(0, 1fr); }
  .ps-preview { padding: calc(env(safe-area-inset-top, 0px) + 12px) 14px 14px; }
  .ps-form { border-left: 0; border-top: 1px solid var(--line); padding: 14px 16px calc(env(safe-area-inset-bottom, 0px) + 16px); }
  .ps-lede { display: none; }
  .zoom {
    left: auto; right: var(--gutter); top: auto; transform: none; width: 52px; padding: 6px 0 7px;
    bottom: calc(var(--sheet-h, 110px) + 14px);
  }
  body.has-sheet.sheet-full .zoom, body.has-sheet.ui-hidden .zoom { opacity: 0; visibility: hidden; pointer-events: none; }
  body.has-sheet .zoom-readout span { display: none; }
  body:not(.has-sheet) .zoom { top: 40%; bottom: auto; transform: translateY(-50%); }
  .zoom-track { display: none; }
  .zoom-btn { width: 40px; height: 40px; }
}
/* small phones (iPhone SE, mini): a slimmer Fly button and swatch, so the destination's name fits */
@media (max-width: 380px) {
  .sheet-head { gap: 10px; padding-inline: 14px; }
  .sheet-swatch { width: 38px; height: 38px; }
  .sheet-title b { font-size: 18px; }
  .sheet-fly { height: 44px; padding: 0 14px 0 16px; font-size: 14px; }
}
@media (max-height: 500px) and (pointer: coarse) and (orientation: landscape) {
  .sheet { left: calc(env(safe-area-inset-left, 0px) + 10px); right: auto; width: min(400px, 54vw); height: calc(100dvh - var(--safe-top) - 16px); }
  .tog-group { left: auto; right: calc(env(safe-area-inset-right, 0px) + 10px); width: min(380px, 60vw); }
  /* the sheet runs down the left: the toast goes in the open space between it and the zoom buttons */
  body.has-sheet #toast, body.has-sheet.sheet-full #toast {
    --l: calc(env(safe-area-inset-left, 0px) + 20px + min(400px, 54vw)); --r: calc(var(--gutter) + 62px);
    bottom: calc(env(safe-area-inset-bottom, 0px) + 14px);
    left: calc((var(--l) + 100% - var(--r)) / 2); max-width: calc(100% - var(--l) - var(--r));
  }
}
@media (prefers-reduced-motion: reduce) {
  .brand-mark.big { animation: none; }
  .sheet.animating, .tog-group { transition: none; animation: none; }
  #toast, #cockpit, #loader, .show-ui, .dock, .tog-group, .switch, .switch::after, .hud-dot, .guide-spot, .guide-card { transition: none; animation: none; }
}

.learn-btn svg { fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }

/* ---------------------------------------------------------------- embedded in a lesson (js/embed.js) */
/* Only the controls the page asked for (ui=...), with no branding, sharing or sound. */
html.embed :is(.brand, .clock-set, .row-only, #btn-share, .share-menu, #btn-sound, #btn-hide-ui, #btn-show-ui, #sheet, #guide, .tog-actions, .tog-sheet-head .grab) { display: none !important; }
html.embed:not(.ui-clock) .clock,
html.embed:not(.ui-zoom) .zoom,
html.embed:not(.ui-view) .toggles,
html.embed:not(.ui-info) #info,
html.embed:not(.ui-flight) :is(#console, #dock, #flight) { display: none !important; }
html.embed { --gutter: 12px; }
/* inside a lesson, a wheel the view doesn't use must chain on to the lesson page (the app itself keeps it) */
html.embed body { overscroll-behavior: auto; }
html.embed .topbar { padding-top: 12px; }
html.embed .toggles { top: 12px; }
html.embed .clock { padding: 8px 10px; gap: 6px; }
html.embed .clock-readout { font-size: 12px; }
html.embed .clock-controls select { width: 118px; }
html.embed .zoom { top: auto; bottom: 12px; transform: none; width: 52px; padding: 6px 0 7px; }
html.embed .zoom-track { height: 120px; }
html.embed .zoom-track input { width: 120px; }
html.embed .zoom-btn { width: 36px; height: 36px; }
@media (max-height: 460px) { html.embed .zoom-track { display: none; } }
@media (max-width: 720px), (max-height: 500px) and (pointer: coarse) {
  html.embed .zoom { left: auto; right: var(--gutter); top: auto; bottom: 12px; transform: none; }
  html.embed .toggles > .view-btn { border-radius: 14px; }
}

/* Marks: labels, arrows, axes and rings a lesson pins to points in space */
#marks { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }
#marks svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
#marks .mk { opacity: 0; transition: opacity 0.5s ease; }
#marks .mk.in { opacity: 1; }
.mk-line { stroke: var(--mk); stroke-width: 2; stroke-linecap: round; fill: none; filter: drop-shadow(0 0 3px rgba(0, 0, 0, 0.9)); }
.mk-axis { stroke-width: 1.6; stroke-dasharray: 7 5; }
.mk-leader { stroke: var(--mk); stroke-width: 1.3; opacity: 0.85; }
.mk-dot { fill: var(--mk); stroke: rgba(3, 5, 10, 0.85); stroke-width: 1.5; }
.mk-curve { stroke-width: 1.7; opacity: 0.9; }
.mk-ring { fill: none; stroke: var(--mk); stroke-width: 1.8; stroke-dasharray: 4 4; filter: drop-shadow(0 0 4px rgba(0, 0, 0, 0.9)); animation: mk-spin 14s linear infinite; transform-box: fill-box; transform-origin: center; }
@keyframes mk-spin { to { transform: rotate(360deg); } }
.mk-label {
  position: absolute; left: 0; top: 0; max-width: min(260px, 60vw);
  padding: 6px 10px; border-radius: 9px;
  background: rgba(6, 10, 18, 0.82); border: 1px solid color-mix(in srgb, var(--mk) 55%, transparent);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.45);
  color: var(--ink); font: 600 13px/1.3 var(--font-body); white-space: normal; width: max-content;
  opacity: 0; transition: opacity 0.5s ease;
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.mk-label.in { opacity: 1; }
.mk-label b { color: var(--mk); font-weight: 700; }
.mk-label small { display: block; font: 500 11px/1.3 var(--font-body); color: var(--ink-dim); }
.mk-label.mk-small { padding: 2px 7px; font: 700 11px/1.2 var(--font-display); letter-spacing: 0.1em; color: var(--mk); }
@media (max-width: 520px) { .mk-label { font-size: 12px; padding: 5px 8px; } }
@media (prefers-reduced-motion: reduce) { .mk-ring { animation: none; } }
