@font-face { font-family: 'Chakra Petch'; font-weight: 500; font-display: swap; src: url(../fonts/chakra-petch-500.woff2) format('woff2'); }
@font-face { font-family: 'Chakra Petch'; font-weight: 600; font-display: swap; src: url(../fonts/chakra-petch-600.woff2) format('woff2'); }
@font-face { font-family: 'IBM Plex Sans'; font-weight: 100 700; font-display: swap; src: url(../fonts/ibm-plex-sans.woff2) format('woff2'); }

:root {
  --bg: #05070d;
  --panel: rgba(9, 14, 27, 0.8);
  --panel-solid: #0b1222;
  --line: rgba(140, 180, 255, 0.16);
  --line-strong: rgba(140, 180, 255, 0.32);
  --text: #e8edf6;
  --muted: #93a0b8;
  --dim: #727f97; /* 4.6:1 on the panels, 5:1 on the page */
  --amber: #ffb54a;
  --amber-deep: #f08a24;
  --cyan: #86d8ff;
  --sun: #ffd27a;
  --display: 'Chakra Petch', 'Avenir Next Condensed', 'Arial Narrow', sans-serif;
  --body: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 15px/1.5 var(--body); overflow: hidden; -webkit-tap-highlight-color: transparent; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }

#bridge { position: fixed; inset: 0; }
#sky, #labels { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#labels { touch-action: none; cursor: grab; }
#labels.dragging { cursor: grabbing; }
#flash { position: absolute; inset: 0; background: radial-gradient(circle at 50% 50%, #fff 0%, #cfe6ff 30%, rgba(160, 200, 255, 0) 75%); opacity: 0; pointer-events: none; }

.eyebrow { margin: 0; font: 600 11px/1.2 var(--display); letter-spacing: 0.16em; text-transform: uppercase; color: var(--amber); }

/* Top HUD */
.hud { position: absolute; top: 0; left: 0; right: 0; display: flex; justify-content: space-between; align-items: flex-start; gap: 12px;
  padding: calc(14px + var(--safe-t)) 16px 28px; pointer-events: none;
  background: linear-gradient(to bottom, rgba(5, 7, 13, 0.75), rgba(5, 7, 13, 0)); }
.where { min-width: 0; }
.where h1 { margin: 2px 0 0; font: 600 22px/1.15 var(--display); letter-spacing: 0.02em; text-shadow: 0 1px 8px rgba(0, 0, 0, 0.8); }
.where .sub span { white-space: nowrap; }
.where .sub { margin: 3px 0 0; color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; text-shadow: 0 1px 6px rgba(0, 0, 0, 0.9); }
.hud-buttons { display: flex; gap: 8px; pointer-events: auto; flex: none; }
.round { width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--line-strong); background: var(--panel); display: grid; place-items: center; padding: 0;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); transition: border-color .15s, background .15s; }
.round:hover { border-color: var(--cyan); }
.round svg { width: 20px; height: 20px; }
a.round { color: var(--text); text-decoration: none; }
#look-home svg circle:first-child { fill: var(--sun); stroke: none; }
#open-maru svg { stroke: #ff8f84; }
#open-missions svg { stroke: var(--cyan); }
#open-sky svg { stroke: var(--sun); }
#open-xeno svg { stroke: #6fe3a4; }
#open-contact svg { stroke: #c9a2ff; }
#look-home svg .ring { stroke: var(--sun); stroke-width: 1.2; stroke-dasharray: 2 3; }

/* Warp readout */
.readout { position: absolute; left: 50%; bottom: calc(28px + var(--safe-b)); transform: translateX(-50%); display: flex; gap: 14px; flex-wrap: wrap; justify-content: center;
  padding: 8px 16px; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--panel); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  font: 500 13px/1.3 var(--display); letter-spacing: 0.06em; font-variant-numeric: tabular-nums; white-space: nowrap; max-width: calc(100vw - 32px); }
#readout-warp { color: var(--amber); }
#readout-time { color: var(--cyan); }

/* Helm console */
.console { position: absolute; left: 12px; right: 12px; bottom: calc(12px + var(--safe-b)); padding: 12px; border-radius: 22px;
  background: var(--panel); border: 1px solid var(--line); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5); transition: transform .5s cubic-bezier(.2, .8, .2, 1), opacity .4s; }
.console.away { transform: translateY(calc(100% + 30px)); opacity: 0; pointer-events: none; }
.target { position: relative; display: grid; width: 100%; text-align: left; gap: 1px; padding: 10px 40px 10px 12px; border: 1px solid var(--line); border-radius: 14px; background: rgba(255, 255, 255, 0.03); }
.target:hover { border-color: var(--line-strong); }
.target-name { font: 600 19px/1.2 var(--display); letter-spacing: 0.02em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.target-sub { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.target .chev { position: absolute; right: 12px; top: 50%; width: 20px; height: 20px; transform: translateY(-50%); color: var(--muted); }
.trip { margin: 8px 4px 2px; font-size: 13px; color: var(--muted); min-height: 1.5em; }
.trip:empty { display: none; }
.trip b { color: var(--text); font-weight: 600; }
.helm { display: flex; align-items: center; gap: 12px; margin-top: 6px; }
.warp { flex: 1; display: grid; grid-template-columns: auto 1fr; align-items: center; column-gap: 10px; min-width: 0; }
.warp-label { font: 600 14px/1 var(--display); letter-spacing: 0.08em; text-transform: uppercase; color: var(--amber); white-space: nowrap; }
.warp-label output { display: inline-block; min-width: 2.2em; font-variant-numeric: tabular-nums; }
.warp-speed { grid-column: 1 / -1; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0 8px; margin: 2px 0 0; font-size: 12px; color: var(--dim); font-variant-numeric: tabular-nums; }
#open-scale { color: #c9a2ff; text-decoration: none; white-space: nowrap; padding: 4px 0; margin: -4px 0; }
#open-scale:hover { text-decoration: underline; text-underline-offset: 3px; }
input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 32px; background: transparent; margin: 0; }
input[type=range]::-webkit-slider-runnable-track { height: 6px; border-radius: 3px; background: linear-gradient(90deg, var(--amber-deep), var(--amber) var(--fill, 85%), rgba(255, 255, 255, 0.12) var(--fill, 85%)); }
input[type=range]::-moz-range-track { height: 6px; border-radius: 3px; background: rgba(255, 255, 255, 0.12); }
input[type=range]::-moz-range-progress { height: 6px; border-radius: 3px; background: var(--amber); }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 24px; height: 24px; margin-top: -9px; border-radius: 50%; background: #fff7e8; border: 3px solid var(--amber); box-shadow: 0 0 12px rgba(255, 181, 74, 0.6); }
input[type=range]::-moz-range-thumb { width: 18px; height: 18px; border-radius: 50%; background: #fff7e8; border: 3px solid var(--amber); }
.engage { flex: none; height: 56px; padding: 0 22px; border: 0; border-radius: 16px; font: 600 17px/1 var(--display); letter-spacing: 0.18em; text-transform: uppercase; color: #1d1204;
  background: linear-gradient(180deg, #ffd08a, var(--amber) 45%, var(--amber-deep)); box-shadow: 0 0 0 1px rgba(255, 200, 120, 0.5) inset, 0 6px 24px rgba(255, 150, 40, 0.35); transition: transform .1s, filter .15s, opacity .2s; }
.engage:hover:not(:disabled) { filter: brightness(1.08); }
.engage:active:not(:disabled) { transform: scale(0.97); }
.engage:disabled { cursor: default; box-shadow: none; background: rgba(255, 181, 74, 0.12); color: rgba(255, 181, 74, 0.45); }

/* Sheets */
.scrim { position: fixed; inset: 0; background: rgba(2, 4, 10, 0.5); z-index: 10; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 11; max-height: 88vh; max-height: 88dvh; display: flex; flex-direction: column;
  background: var(--panel-solid); border: 1px solid var(--line); border-bottom: 0; border-radius: 22px 22px 0 0; padding: 6px 16px calc(12px + var(--safe-b));
  box-shadow: 0 -10px 50px rgba(0, 0, 0, 0.6); animation: rise .32s cubic-bezier(.2, .8, .2, 1); }
@keyframes rise { from { transform: translateY(40px); opacity: 0; } }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0 8px; flex: none; }
.sheet h2 { margin: 0; font: 600 21px/1.2 var(--display); letter-spacing: 0.03em; }
.close { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); background: transparent; display: grid; place-items: center; padding: 0; flex: none; }
.close svg { width: 18px; height: 18px; }
.search { flex: none; width: 100%; height: 44px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--line-strong); background: rgba(255, 255, 255, 0.04); outline: none; font-size: 16px; }
.search:focus { border-color: var(--cyan); }
.list, .entries { overflow-y: auto; overscroll-behavior: contain; margin: 8px -16px 0; padding: 0 16px 8px; flex: 1 1 auto; min-height: 0; }
.group { margin: 16px 0 4px; font: 600 11px/1.2 var(--display); letter-spacing: 0.16em; text-transform: uppercase; color: var(--dim); }
.row { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 2px 12px; width: 100%; padding: 10px 4px; text-align: left; background: none; border: 0; border-bottom: 1px solid var(--line); }
.row:hover { background: rgba(255, 255, 255, 0.03); }
.row .name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .name .badge { font-weight: 400; color: var(--muted); font-size: 12px; margin-left: 6px; }
.row .dist { font: 500 14px/1 var(--display); color: var(--cyan); font-variant-numeric: tabular-nums; white-space: nowrap; }
.row .meta { grid-column: 1 / -1; font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row.here .dist { color: var(--amber); }
.empty { color: var(--muted); padding: 16px 4px; }

.stats { margin: 0 0 4px; color: var(--muted); font-size: 14px; flex: none; }
.entry h3 { margin: 0 0 4px; font: 600 24px/1.15 var(--display); letter-spacing: 0.02em; }
.entry .intro-line { margin: 0 0 12px; color: var(--text); }
.entry dl { margin: 0; }
.entry dt { margin: 12px 0 2px; font: 600 11px/1.2 var(--display); letter-spacing: 0.16em; text-transform: uppercase; color: var(--amber); }
.entry dd { margin: 0 0 6px; color: #cdd5e3; }
.entry dd.note { padding-left: 14px; position: relative; }
.entry dd.note::before { content: ''; position: absolute; left: 2px; top: .65em; width: 5px; height: 5px; border-radius: 50%; background: var(--cyan); }
.entry dd.home { color: var(--sun); }
.entry .files { margin: 8px 0 6px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.entry .files a { padding: 6px 10px; border-radius: 999px; border: 1px solid rgba(134, 216, 255, 0.35); color: var(--cyan); text-decoration: none; font-size: 13px; }
.entry .files a:hover { border-color: var(--cyan); }
.past { border: 1px solid var(--line); border-radius: 14px; margin: 10px 0; background: rgba(255, 255, 255, 0.02); }
.past summary { list-style: none; cursor: pointer; padding: 12px 14px; display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; }
.past summary::-webkit-details-marker { display: none; }
.past summary b { font: 600 17px/1.2 var(--display); }
.past summary span { color: var(--muted); font-size: 13px; }
.past summary .sd { font: 500 12px/1.2 var(--display); color: var(--dim); letter-spacing: 0.06em; text-align: right; }
.past[open] summary span:last-child { display: none; } /* the entry opens with the same line */
.past .entry { padding: 0 14px 12px; }

.arrival { max-height: 62vh; max-height: 62dvh; }
.arrival .entry { overflow-y: auto; overscroll-behavior: contain; margin: 0 -16px; padding: 0 16px 8px; flex: 1 1 auto; min-height: 0; }
.arrival .entry .typed { white-space: pre-wrap; }
.arrival-actions { display: flex; gap: 10px; padding-top: 12px; flex: none; }
.arrival-actions button { flex: 1; }
.primary, .secondary { height: 48px; border-radius: 14px; font: 600 15px/1 var(--display); letter-spacing: 0.08em; text-transform: uppercase; padding: 0 16px; }
.primary { border: 0; color: #1d1204; background: linear-gradient(180deg, #ffd08a, var(--amber) 45%, var(--amber-deep)); }
.secondary { border: 1px solid rgba(255, 210, 122, 0.45); color: var(--sun); background: transparent; }

.toggle { display: flex; align-items: center; gap: 12px; padding: 12px 2px; border-bottom: 1px solid var(--line); cursor: pointer; flex: none; }
.toggle input { width: 20px; height: 20px; accent-color: var(--amber); margin: 0; }
/* The settings scroll as a whole, so on a short screen "What you're seeing" isn't squeezed into a sliver. */
#settings { overflow-y: auto; overscroll-behavior: contain; }
.about { flex: none; color: var(--muted); font-size: 14px; }
.about h3 { margin: 18px 0 6px; font: 600 13px/1.2 var(--display); letter-spacing: 0.14em; text-transform: uppercase; color: var(--text); }
.about p { margin: 0 0 10px; }
.text-button { background: none; border: 0; padding: 8px 0; color: var(--amber); text-decoration: underline; text-underline-offset: 3px; }

.intro { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: 16px; overflow-y: auto; overscroll-behavior: contain; background: radial-gradient(ellipse at 50% 60%, rgba(5, 7, 13, 0.35), rgba(5, 7, 13, 0.85)); }
.intro-card { max-width: 400px; padding: 24px 22px 14px; border-radius: 22px; background: var(--panel); border: 1px solid var(--line-strong); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.intro-card h2 { margin: 4px 0 10px; font: 600 40px/1 var(--display); letter-spacing: 0.12em; text-transform: uppercase; }
.intro-card p { color: #cdd5e3; margin: 0 0 12px; }
.intro-card .primary { width: 100%; margin-top: 6px; }

.loading { position: fixed; left: 0; right: 0; top: 45%; text-align: center; margin: 0; font: 500 14px/1 var(--display); letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
.noscript { position: fixed; inset: 0; z-index: 30; margin: 0; padding: 24px; background: var(--bg); }
.lost { position: fixed; left: 50%; top: 42%; transform: translate(-50%, -50%); z-index: 15; width: min(340px, calc(100% - 32px)); padding: 20px; border-radius: 18px; text-align: center; background: var(--panel); border: 1px solid var(--line-strong); }
.lost p { margin: 0 0 14px; color: #cdd5e3; }
.lost .primary { width: 100%; }

.jd-foot { flex: none; display: flex; justify-content: center; gap: 8px; padding: 14px 0 2px; font-size: 12px; color: var(--dim); }
.jd-foot a { color: var(--dim); text-decoration: none; }
.jd-foot a:hover, .jd-foot a:focus-visible { text-decoration: underline; color: var(--muted); }

@media (max-width: 480px) {
  .hud-buttons { gap: 6px; flex-wrap: wrap; justify-content: flex-end; max-width: calc(5 * 38px + 4 * 6px); }
  .round { width: 38px; height: 38px; }
  .round svg { width: 18px; height: 18px; }
}

/* On the narrowest phones the warp slider gets a row of its own, with Engage under it. */
@media (max-width: 360px) {
  .helm { flex-wrap: wrap; }
  .warp { flex-basis: 100%; }
  .engage { flex: 1 1 100%; height: 50px; }
}

@media (min-width: 760px) {
  .console { left: 20px; right: auto; bottom: calc(20px + var(--safe-b)); width: 430px; }
  .hud { padding: calc(20px + var(--safe-t)) 24px 30px; }
  .where h1 { font-size: 26px; }
  .sheet { left: auto; right: 20px; top: calc(84px + var(--safe-t)); bottom: 20px; width: 440px; max-height: none; border-radius: 22px; border-bottom: 1px solid var(--line); padding-bottom: 14px; animation-name: slide; }
  .sheet.arrival { top: auto; max-height: calc(100vh - 104px); }
  @keyframes slide { from { transform: translateX(30px); opacity: 0; } }
}

@media (prefers-reduced-motion: reduce) {
  .sheet, .console { animation: none; transition: none; }
}
