@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);
  /* A phone on its side has its camera notch at one end and a rounded corner at the other: side padding is never less than these. */
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  color-scheme: dark;
}

* { box-sizing: border-box; }
/* Text size: every size is counted in --px, a sixteenth of the browser's own text size (so a phone set to larger text
   is larger here too), times the size chosen in Bridge settings (js/prefs.js). The root keeps the browser's size, so
   rem is always the browser's. */
:root { --ts: 1; --px: calc(var(--ts) * 0.0625rem); }
:root[data-text="large"] { --ts: 1.15; }
:root[data-text="largest"] { --ts: 1.3; }
/* High contrast (Bridge settings): solid panels, brighter secondary text and lines, and every outline twice as thick
   (each is drawn --bw wide), in the same amber and cyan. Boxes are measured with their borders inside, so nothing
   moves. */
:root { --bw: 1px; }
:root[data-contrast="high"] {
  --bw: 2px;
  --panel: var(--panel-solid);
  --line: rgba(170, 200, 255, 0.5);
  --line-strong: rgba(195, 218, 255, 0.85);
  --muted: #c9d2e3;
  --dim: #aeb9cd;
}
html { font-size: 100%; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); overflow: hidden; -webkit-tap-highlight-color: transparent; }
body { font: calc(15 * var(--px))/1.5 var(--body); }
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; }
/* Focus handed on by a tap or a click, not by the keyboard: the place is kept, the ring isn't drawn (see quiet() in js/app.js). */
.quiet:focus-visible { outline: none; }

#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; }
/* Earth's sky, held to compare: the old view fades out over the new, and a quiet line under the header says what is
   on the viewscreen while the button is held. */
#fade { position: absolute; inset: 0; width: 100%; height: 100%; display: block; pointer-events: none; opacity: 0; }
/* The Sun's hello, once, from far out: a line under the header that fades in and out over seven seconds. */
.sun-note { position: absolute; left: 50%; top: calc(132px + var(--safe-t)); transform: translateX(-50%); margin: 0; width: max-content; max-width: calc(100vw - 32px);
  padding: 8px 16px; border-radius: 999px; background: rgba(5, 7, 13, 0.7); border: var(--bw) solid rgba(255, 210, 122, 0.4); color: var(--sun);
  font: 500 calc(15 * var(--px))/1.35 var(--body); text-align: center; pointer-events: none; animation: sun-note 7s both; }
@keyframes sun-note { 0% { opacity: 0; } 12%, 80% { opacity: 1; } 100% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .sun-note { animation: none; } }
.earth-note { position: absolute; left: 50%; top: calc(132px + var(--safe-t)); transform: translateX(-50%); margin: 0; padding: 6px 12px; border-radius: 999px;
  background: rgba(5, 7, 13, 0.7); border: var(--bw) solid rgba(255, 210, 122, 0.4); color: var(--sun); font: 600 calc(11 * var(--px))/1.2 var(--display); letter-spacing: 0.12em;
  text-transform: uppercase; white-space: nowrap; pointer-events: none; }
/* Autopilot: the round buttons and the helm are away, and each star held at gets two lines near the foot. */
body.auto .hud-buttons { visibility: hidden; }
body.auto #labels { cursor: none; }
.caption { position: absolute; left: max(16px, var(--safe-l)); right: max(16px, var(--safe-r)); bottom: calc(40px + var(--safe-b)); margin: 0 auto; width: fit-content; max-width: 560px; text-align: center;
  padding: 10px 18px 12px; border-radius: 16px; background: rgba(5, 7, 13, 0.62);
  pointer-events: none; text-shadow: 0 1px 10px rgba(0, 0, 0, 0.95); animation: caption-in 1.2s both; }
@keyframes caption-in { from { opacity: 0; } }
.caption p { margin: 0; }
.cap-title { font: 600 calc(26 * var(--px))/1.2 var(--display); letter-spacing: 0.02em; }
.cap-sub { margin-top: 6px !important; color: var(--muted); font-size: calc(14 * var(--px)); }
.auto-hint { position: absolute; left: 50%; bottom: calc(12px + var(--safe-b)); transform: translateX(-50%); margin: 0; white-space: nowrap; color: var(--dim);
  font: 500 calc(11 * var(--px))/1.2 var(--display); letter-spacing: 0.1em; text-transform: uppercase; pointer-events: none; transition: opacity 1.5s; }
.auto-hint.gone { opacity: 0; }
.autopilot-row { display: flex; align-items: center; gap: 14px; padding: 14px 2px; border-bottom: var(--bw) solid var(--line); }
.autopilot-row .secondary { flex: none; height: 44px; font-size: calc(13 * var(--px)); }
.autopilot-row p { margin: 0; font-size: calc(13 * var(--px)); color: var(--muted); }
.auto-hint .on-touch { display: none; }
@media (pointer: coarse) { .autopilot-row .keys, .auto-hint .on-keys { display: none; } .auto-hint .on-touch { display: inline; } }
#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 calc(11 * var(--px))/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)) max(16px, var(--safe-r)) 28px max(16px, var(--safe-l)); 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 calc(22 * var(--px))/1.15 var(--display); letter-spacing: 0.02em; text-shadow: 0 1px 8px rgba(0, 0, 0, 0.8); }
/* Headings that take the keyboard's place only so a screen reader reads on from them: no ring. */
[tabindex="-1"]:focus { outline: none; }
/* The stardate, a dot, and how far from home. The dot belongs to the second and hangs in the gap before it; when the
   second wraps to a line of its own, the dot is left of the edge, and clipped away rather than left dangling. (Only
   the left edge clips: on the narrowest phones these lines run on past the name's column, under the buttons.) */
.where .sub { display: flex; flex-wrap: wrap; column-gap: 1.1em; clip-path: inset(-12px -100vw -12px 0); }
.where .sub span { position: relative; white-space: nowrap; }
.where .sub span + span::before { content: '·'; position: absolute; left: -0.7em; }
.where .sub { margin: 3px 0 0; color: var(--muted); font-size: calc(13 * var(--px)); font-variant-numeric: tabular-nums; text-shadow: 0 1px 6px rgba(0, 0, 0, 0.9); }
.where .behaves { color: var(--sun); }
/* A room added since the last visit: one line, with a link to it and a button to close it. */
.whats-new { pointer-events: auto; display: flex; align-items: center; gap: 2px; width: max-content; max-width: calc(100vw - 2 * max(16px, var(--safe-l), var(--safe-r))); margin: 8px 0 0; padding: 4px 0 4px 12px; border-radius: 12px; border: var(--bw) solid rgba(255, 181, 74, 0.45); background: rgba(5, 7, 13, 0.72); color: var(--text); font-size: calc(13 * var(--px)); line-height: 1.35; }
.whats-new[hidden] { display: none; }
.whats-new a { color: var(--amber); }
.whats-new-close { flex: none; width: 44px; height: 44px; margin: -10px -2px -10px 0; padding: 0; display: grid; place-items: center; border: 0; background: transparent; color: var(--muted); }
.whats-new-close svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.hud-buttons { display: flex; gap: 8px; pointer-events: auto; flex: none; }
.round { position: relative; width: 42px; height: 42px; border-radius: 50%; border: var(--bw) 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; }
/* Each button can be tapped anywhere in a 44 px square round its middle, though it is drawn smaller. The squares meet
   in the middle of the gap between buttons, so a tap never lands on the neighbour. */
.round::after { content: ''; position: absolute; inset: -2px; }
.round:hover { border-color: var(--cyan); }
.round svg { width: 20px; height: 20px; }
a.round { color: var(--text); text-decoration: none; }
/* The speaker in every room's header: Engage's sound, on or off everywhere at once (js/room.js). In the rooms with a
   header bar it stands at the end of the first row, level with Bridge; tonight's sky has it among its round buttons. */
.top > .speaker { grid-row: 1; grid-column: -2 / -1; justify-self: end; position: relative; width: 40px; height: 40px; border-radius: 50%; border: var(--bw) solid var(--line-strong);
  background: var(--panel); color: var(--text); display: grid; place-items: center; padding: 0; }
/* At the larger text sizes a room's name can be wider than the room between Bridge and the speaker: it breaks there
   rather than pushing the speaker off the screen. */
.top > .title { min-width: 0; }
.top > .title h1 { overflow-wrap: break-word; hyphens: auto; }
.top > .speaker::after { content: ''; position: absolute; inset: -2px; }
.top > .speaker:hover { border-color: var(--cyan); }
.speaker svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.speaker[aria-pressed="true"] .mute, .speaker[aria-pressed="false"] .waves { display: none; }
.speaker[aria-pressed="false"] { color: var(--muted); }
/* The Keys card, in every room: press ? (js/room.js). Only a key opens it, so only a keyboard sees it. */
.keys-card { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; padding: 16px; background: rgba(2, 4, 8, 0.6); }
.keys-box { width: min(440px, 100%); max-height: calc(100vh - 32px); overflow: auto; padding: 10px 18px 18px; border-radius: 20px; border: var(--bw) solid var(--line-strong); background: var(--panel-solid); box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6); }
.keys-head { display: flex; align-items: center; justify-content: space-between; }
.keys-head h2 { margin: 0; font: 600 calc(18 * var(--px))/1.2 var(--display); letter-spacing: 0.06em; text-transform: uppercase; color: var(--amber); }
.keys-box dl { display: grid; grid-template-columns: auto 1fr; gap: 9px 16px; margin: 8px 0 0; align-items: baseline; }
.keys-box dt { white-space: nowrap; color: var(--dim); font-size: calc(12 * var(--px)); }
.keys-box dd { margin: 0; font-size: calc(14 * var(--px)); line-height: 1.35; color: var(--text); }
.keys-box kbd { display: inline-block; min-width: 1.7em; margin: 0 2px; padding: 2px 6px; border-radius: 6px; border: var(--bw) solid var(--line-strong); border-bottom-width: 2px;
  background: rgba(255, 255, 255, 0.04); font: 600 calc(12 * var(--px))/1.3 var(--display); text-align: center; color: var(--text); }
#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: 0 14px; flex-wrap: wrap; justify-content: center;
  padding: 8px 16px; border: var(--bw) solid var(--line-strong); border-radius: 20px; background: var(--panel); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  font: 500 calc(13 * var(--px))/1.3 var(--display); letter-spacing: 0.06em; font-variant-numeric: tabular-nums; white-space: nowrap; max-width: calc(100vw - 2 * max(16px, var(--safe-l), var(--safe-r))); }
#readout-warp { color: var(--amber); }
#readout-time { color: var(--cyan); }

/* Helm console */
.console { position: absolute; left: max(12px, var(--safe-l)); right: max(12px, var(--safe-r)); bottom: calc(12px + var(--safe-b)); padding: 12px; border-radius: 22px;
  background: var(--panel); border: var(--bw) 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: var(--bw) solid var(--line); border-radius: 14px; background: rgba(255, 255, 255, 0.03); }
.target:hover { border-color: var(--line-strong); }
.target-name { font: 600 calc(19 * var(--px))/1.2 var(--display); letter-spacing: 0.02em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.target-sub { color: var(--muted); font-size: calc(13 * var(--px)); 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: calc(13 * var(--px)); 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 calc(14 * var(--px))/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: calc(12 * var(--px)); color: var(--dim); font-variant-numeric: tabular-nums; }
/* 44 px tall under a thumb. The room is added below the words and to their left, never above: that is the slider's. */
#open-scale { color: #c9a2ff; text-decoration: none; white-space: nowrap; padding: 4px 0 22px 14px; margin: -4px 0 -22px -14px; }
#open-scale:hover { text-decoration: underline; text-underline-offset: 3px; }
/* Computer, report: a switch on the helm, and the line it says over the viewscreen, just above the helm (or above the
   readout in flight). */
.report { margin: -4px -6px -22px auto; padding: 4px 6px 22px 14px; border: 0; background: none; color: var(--cyan); font: inherit; white-space: nowrap; }
.report[aria-pressed="true"] { color: var(--amber); }
.report[aria-pressed="true"]::before { content: '● '; font-size: 0.8em; }
.report:hover { text-decoration: underline; text-underline-offset: 3px; }
.report-line { position: absolute; left: max(16px, var(--safe-l)); right: max(16px, var(--safe-r)); bottom: calc(24px + var(--safe-b) + var(--console-h, 210px)); margin: 0 auto; width: fit-content; max-width: 560px;
  padding: 8px 14px; border-radius: 14px; border: var(--bw) solid var(--line); background: rgba(5, 7, 13, 0.72); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  font-size: calc(13 * var(--px)); line-height: 1.45; color: var(--text); pointer-events: none; text-wrap: pretty; }
.report-line.flying { bottom: calc(80px + var(--safe-b)); }
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 calc(17 * var(--px))/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: var(--bw) solid var(--line); border-bottom: 0; border-radius: 22px 22px 0 0; padding: 6px max(16px, var(--safe-r)) calc(12px + var(--safe-b)) max(16px, var(--safe-l));
  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; } }
/* Set course keeps one height whatever the list holds, so the search field stays near the top of the screen and the
   hits fill downward from it. --kb is how much of the bottom of the screen a phone's keyboard covers (app.js keeps it
   up to date): the sheet stands on top of the keyboard, not behind it. */
#picker { bottom: var(--kb, 0px); height: calc(88vh - var(--kb, 0px)); height: calc(88dvh - var(--kb, 0px)); }
.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 calc(21 * var(--px))/1.2 var(--display); letter-spacing: 0.03em; }
.close { width: 40px; height: 40px; border-radius: 50%; border: var(--bw) 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: var(--bw) solid var(--line-strong); background: rgba(255, 255, 255, 0.04); outline: none; font-size: calc(16 * var(--px)); }
.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 calc(11 * var(--px))/1.2 var(--display); letter-spacing: 0.16em; text-transform: uppercase; color: var(--dim); }
/* The way to subspace radio, at the foot of Set course. */
.list .to-room { display: flex; align-items: center; min-height: 48px; margin: 14px 0 4px; padding: 0 12px; border-radius: 14px; border: var(--bw) dashed var(--line-strong); color: var(--cyan); text-decoration: none; font-size: calc(14 * var(--px)); }
.list .to-room:hover { border-color: var(--cyan); }
.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: var(--bw) solid var(--line); }
.row:hover { background: rgba(255, 255, 255, 0.03); }
/* Inside the row, or the list's scrolling edge cuts the top of the first row's ring off. */
.row:focus-visible { outline-offset: -2px; }
.row .name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .name .badge { font-weight: 400; color: var(--muted); font-size: calc(12 * var(--px)); margin-left: 6px; }
.row .name .chart { font: 600 calc(10 * var(--px))/1 var(--display); letter-spacing: 0.12em; text-transform: uppercase; color: var(--amber); margin-left: 8px; }
.row .dist { font: 500 calc(14 * var(--px))/1 var(--display); color: var(--cyan); font-variant-numeric: tabular-nums; white-space: nowrap; }
.row .meta { grid-column: 1 / -1; font-size: calc(13 * var(--px)); color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row.here .dist { color: var(--amber); }
.row .dist.unmeasured { font: 400 calc(12 * var(--px))/1 var(--body); color: var(--muted); }
/* A voyage in Set course: its stops in full, wrapped, and the one under way marked. */
.row.voyage .stops { white-space: normal; line-height: 1.4; }
.row.voyage .stops span { white-space: nowrap; }
.row.voyage .stops .flown { color: var(--dim); text-decoration: line-through; text-decoration-color: rgba(147, 160, 184, 0.5); }
.row.voyage.on .name { color: var(--amber); }
.leave-voyage { font-size: calc(13 * var(--px)); min-height: 44px; }
.empty { color: var(--muted); padding: 16px 4px; }
.computer { margin: 12px 4px 8px; color: var(--text); line-height: 1.45; }
.computer::before { content: 'Computer'; display: block; margin-bottom: 4px; font: 600 calc(11 * var(--px))/1.2 var(--display); letter-spacing: 0.16em; text-transform: uppercase; color: var(--dim); }

.stats { margin: 0 0 4px; color: var(--muted); font-size: calc(14 * var(--px)); flex: none; }
.records { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 14px; margin: 6px 0 10px; padding: 10px 12px; border: var(--bw) solid var(--line); border-radius: 14px; background: rgba(255, 255, 255, 0.02); }
.records dt { font: 600 calc(10 * var(--px))/1.2 var(--display); letter-spacing: 0.14em; text-transform: uppercase; color: var(--dim); }
.records dd { margin: 2px 0 0; font-size: calc(14 * var(--px)); color: var(--text); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
/* Kinds of star, across the foot of the records: the seven classes, each lit once a star of it has been visited. */
.records .kinds { grid-column: 1 / -1; }
.records .letters { margin-left: 8px; font: 500 calc(14 * var(--px))/1 var(--display); letter-spacing: 0.3em; }
.records .letters b { font-weight: 500; color: var(--dim); }
.records .letters b.on { font-weight: 600; color: var(--amber); }
.records .rare { display: block; margin-top: 2px; font-size: calc(13 * var(--px)); color: var(--muted); }
/* Words for a screen reader only: there to be read, not seen. */
.sr { position: absolute; width: 1px; height: 1px; margin: 0; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.unsaved { flex: none; margin: 6px 0 0; padding-left: 10px; border-left: 2px solid var(--amber); color: var(--amber); font-size: calc(13 * var(--px)); }
.entry h3 { margin: 0 0 4px; font: 600 calc(24 * var(--px))/1.15 var(--display); letter-spacing: 0.02em; }
/* What this arrival did to the records, in one quiet line under the star's name. Each part stays whole, with a dot
   in the gap before it that is clipped away when the part starts a new line (as in the header: see .where .sub). */
.entry .firsts { margin: 0 0 8px; display: flex; flex-wrap: wrap; column-gap: 1.2em; clip-path: inset(-4px -100vw -4px 0); font: 500 calc(12 * var(--px))/1.5 var(--display); letter-spacing: 0.06em; color: var(--muted); }
.entry .firsts span { position: relative; white-space: nowrap; }
.entry .firsts span + span::before { content: '·'; position: absolute; left: -0.8em; }
.entry .intro-line { margin: 0 0 12px; color: var(--text); }
.entry dl { margin: 0; }
.entry dt { margin: 12px 0 2px; font: 600 calc(11 * var(--px))/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: var(--bw) solid rgba(134, 216, 255, 0.35); color: var(--cyan); text-decoration: none; font-size: calc(13 * var(--px)); }
.entry .files a:hover { border-color: var(--cyan); }
/* The link to the xenobiology lab, in the green of its flask. */
.entry .files a.to-lab { border-color: rgba(111, 227, 164, 0.4); color: #6fe3a4; }
.entry .files a.to-lab:hover { border-color: #6fe3a4; }
.entry-actions { margin: 12px 0 2px; display: flex; flex-wrap: wrap; gap: 8px; }
.entry-actions a, .entry-actions button { min-height: 40px; padding: 0 12px; display: inline-flex; align-items: center; border-radius: 999px; border: var(--bw) solid var(--line-strong); background: rgba(255, 255, 255, 0.03); color: var(--text); text-decoration: none; font: 600 calc(12 * var(--px))/1 var(--display); letter-spacing: 0.05em; text-transform: uppercase; }
.entry-actions a:hover, .entry-actions button:hover { border-color: var(--cyan); }
.entry-actions [data-again], .entry-actions [data-course] { border-color: rgba(255, 181, 74, 0.55); color: var(--amber); }
.share-link { flex: 1 1 100%; min-width: 0; height: 40px; padding: 0 12px; border-radius: 12px; border: var(--bw) solid var(--line-strong); background: rgba(255, 255, 255, 0.04); font-size: calc(14 * var(--px)); }
/* A room's share link: a text link under its buttons, the way the lab's Send this creature is. */
.share-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0 12px; margin: 0; }
.share-row .text-button { color: #6fe3a4; font-size: calc(13 * var(--px)); min-height: 44px; padding: 12px 0; }
.share-row .share-link { color: var(--text); margin-bottom: 8px; }
.past { border: var(--bw) 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 calc(17 * var(--px))/1.2 var(--display); }
.past summary span { color: var(--muted); font-size: calc(13 * var(--px)); }
.past summary .sd { font: 500 calc(12 * var(--px))/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; }
/* A long log: a heading over each day's arrivals, the time of each beside its stardate, and Show earlier at the foot. */
.entries .day { margin: 18px 0 4px; font: 600 calc(11 * var(--px))/1.3 var(--display); letter-spacing: 0.14em; text-transform: uppercase; color: var(--dim); }
.entries .day:first-of-type { margin-top: 8px; }
.past summary .sd small { display: block; font-size: calc(11 * var(--px)); margin-top: 2px; }
.entries .more { display: block; min-height: 44px; margin: 4px auto 8px; }
/* Past 30 entries the log can be searched, and shown by star: one row for each, with its visits. */
.log-tools { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0 2px; flex: none; }
.log-tools .search { flex: 1 1 180px; width: auto; }
.log-view { display: flex; flex: none; border: var(--bw) solid var(--line-strong); border-radius: 12px; overflow: hidden; }
.log-view button { min-height: 44px; padding: 0 14px; border: 0; background: transparent; color: var(--muted); font: 600 calc(12 * var(--px))/1 var(--display); letter-spacing: 0.1em; text-transform: uppercase; }
.log-view button + button { border-left: var(--bw) solid var(--line-strong); }
.log-view button[aria-pressed="true"] { background: rgba(134, 216, 255, 0.12); color: var(--text); }
/* Stellar cartography: the log as a chart, square, as wide as the sheet allows. */
.chart .chart-box { display: flex; justify-content: center; margin: 4px 0 6px; }
.chart canvas { display: block; border-radius: 14px; background: radial-gradient(circle at 50% 50%, rgba(255, 210, 122, 0.05), rgba(255, 255, 255, 0.015) 70%); border: var(--bw) solid var(--line); touch-action: manipulation; cursor: pointer; }
.chart .chart-line { margin: 4px 0; color: var(--text); font-size: calc(14 * var(--px)); }
.chart .chart-pick { margin: 4px 0; min-height: 44px; padding: 10px 0; color: var(--muted); font-size: calc(14 * var(--px)); font-variant-numeric: tabular-nums; }
.chart .chart-pick b { color: var(--text); font: 600 calc(14 * var(--px))/1.3 var(--display); letter-spacing: 0.02em; }
.chart .chart-pick .text-button { margin-left: 6px; min-height: 44px; padding: 0 4px; color: var(--amber); line-height: 1.3; }
.chart .chart-key { margin: 4px 0; color: var(--dim); font-size: calc(13 * var(--px)); }
.past.star[open] summary span:last-child { display: block; }
/* The voyage in one sentence, at the head of the log. */
.entries .story { margin: 8px 0 4px; font: 500 calc(16 * var(--px))/1.4 var(--display); letter-spacing: 0.02em; color: var(--sun); }
/* The service record: a row for each room's record, each leading to it. */
.service { margin: 8px 0 10px; padding: 10px 12px 4px; border: var(--bw) solid var(--line); border-radius: 14px; background: rgba(255, 255, 255, 0.02); }
.service h3 { margin: 0 0 2px; font: 600 calc(10 * var(--px))/1.2 var(--display); letter-spacing: 0.14em; text-transform: uppercase; color: var(--dim); }
.service ul { list-style: none; margin: 0; padding: 0; }
.service li + li { border-top: var(--bw) solid var(--line); }
.service a { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 0 10px; min-height: 44px; padding: 6px 0; color: var(--text); text-decoration: none; }
.service a b { font: 600 calc(14 * var(--px))/1.25 var(--display); letter-spacing: 0.02em; }
.service a span { grid-column: 1; font-size: calc(13 * var(--px)); color: var(--muted); font-variant-numeric: tabular-nums; }
.service a span.none { color: var(--dim); }
.service .chev { grid-column: 2; grid-row: 1 / span 2; width: 16px; height: 16px; fill: none; stroke: var(--dim); stroke-width: 2; }
.service a:hover b, .service a:focus-visible b { text-decoration: underline; text-underline-offset: 3px; }
.service .clock { margin: 2px 0 4px; font: 600 calc(15 * var(--px))/1.3 var(--display); letter-spacing: 0.03em; color: var(--sun); }
/* With the mission clock on: a summary over the arrival that closed each five-year mission. */
.mission-end { margin: 10px 0; border: var(--bw) solid rgba(255, 210, 122, 0.45); border-radius: 14px; background: rgba(255, 210, 122, 0.05); }
.mission-end summary { list-style: none; cursor: pointer; padding: 12px 14px; display: grid; gap: 2px; }
.mission-end summary::-webkit-details-marker { display: none; }
.mission-end summary b { font: 600 calc(17 * var(--px))/1.2 var(--display); color: var(--sun); }
.mission-end summary span { color: var(--muted); font-size: calc(13 * var(--px)); }
.mission-end dl { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 14px; margin: 0; padding: 0 14px 12px; }
.mission-end dt { font: 600 calc(10 * var(--px))/1.2 var(--display); letter-spacing: 0.14em; text-transform: uppercase; color: var(--dim); }
.mission-end dd { margin: 2px 0 0; font-size: calc(14 * var(--px)); overflow-wrap: anywhere; }
/* A line another room adds to the log when something there finishes, between the arrivals. */
.entries .supp { margin: 8px 0; padding: 4px 0 4px 14px; border-left: 2px solid var(--line-strong); font-size: calc(13 * var(--px)); }
.entries .supp a { display: block; color: var(--muted); text-decoration: none; padding: 6px 0; }
.entries .supp a:hover, .entries .supp a:focus-visible { color: var(--text); text-decoration: underline; text-underline-offset: 3px; }
.log-tools #log-print { margin-left: auto; min-height: 44px; padding: 0 2px; font-size: calc(13 * var(--px)); }

/* Print the log: the whole log, oldest first, as a booklet in black on white, one entry to a block. Nothing else on the
   bridge is printed: the viewscreen would come out as a black page. */
#print-log { display: none; }
@media print {
  @page { margin: 16mm 14mm; }
  html, body { height: auto; overflow: visible; background: #fff; color: #000; }
  body > :not(#print-log), body.red::after { display: none !important; }
  #print-log { display: block; color: #000; font: 10.5pt/1.45 var(--body); }
  #print-log h1 { margin: 0; font: 600 22pt/1.2 var(--display); letter-spacing: 0.02em; }
  #print-log .print-sub { margin: 2pt 0 10pt; color: #333; }
  #print-log h2 { margin: 16pt 0 2pt; font: 600 9pt/1.3 var(--display); letter-spacing: 0.14em; text-transform: uppercase; color: #333; break-after: avoid; }
  #print-log article { break-inside: avoid; border-top: 0.5pt solid #888; padding: 6pt 0 4pt; }
  #print-log h3 { display: inline; margin: 0; font: 600 13pt/1.3 var(--display); }
  #print-log .when { float: right; margin: 2pt 0 0 8pt; font: 500 8.5pt/1.3 var(--display); color: #333; }
  #print-log p, #print-log dl { margin: 3pt 0; }
  #print-log dt { margin-top: 4pt; font: 600 8pt/1.3 var(--display); letter-spacing: 0.12em; text-transform: uppercase; color: #333; }
  #print-log dd { margin: 0; }
  #print-log .mission { border-top: 1.5pt solid #000; }
  #print-log .supp { margin: 4pt 0; padding-left: 8pt; border-left: 1pt solid #888; font-style: italic; break-inside: avoid; }
}

.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; }
/* The small press-and-hold button beside the arrival's date. */
.arrival .sheet-head .eyebrow { flex: 1 1 auto; min-width: 0; }
.earth-sky { flex: none; position: relative; min-height: 32px; padding: 6px 12px; border-radius: 999px; border: var(--bw) solid rgba(255, 210, 122, 0.45); background: transparent;
  color: var(--sun); font: 600 calc(11 * var(--px))/1.2 var(--display); letter-spacing: 0.1em; text-transform: uppercase; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.earth-sky::after { content: ''; position: absolute; inset: -6px -2px; } /* a 44-pixel tall place to press */
.earth-sky[aria-pressed="true"] { background: rgba(255, 210, 122, 0.18); }
.arrival-actions { display: flex; gap: 10px; padding-top: 12px; flex: none; }
.arrival-actions button { flex: 1; }
/* On a voyage the main button names the next leg, on two lines: how far, then the star. */
.arrival-actions .leg { height: auto; min-height: 48px; padding: 6px 10px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-width: 0; }
.arrival-actions .leg .leg-of { font-size: calc(10 * var(--px)); letter-spacing: 0.14em; opacity: 0.78; }
.arrival-actions .leg .leg-to { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.primary, .secondary { height: 48px; border-radius: 14px; font: 600 calc(15 * var(--px))/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: var(--bw) 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: var(--bw) solid var(--line); cursor: pointer; flex: none; }
.toggle input { width: 20px; height: 20px; accent-color: var(--amber); margin: 0; }
.toggle small { display: block; font-size: calc(12 * var(--px)); color: var(--muted); }
/* Text size, in Bridge settings: three sizes for every room. */
.text-size { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; padding: 10px 2px 12px; border-bottom: var(--bw) solid var(--line); }
.text-size p { margin: 0; flex: 1 1 160px; }
.text-size small { display: block; font-size: calc(12 * var(--px)); color: var(--muted); }
.text-size .log-view button { padding: 0 12px; }
/* Your ship's name and registry. */
.ship-fields { display: flex; gap: 10px; }
.field { display: grid; gap: 4px; flex: 1 1 0; min-width: 0; }
.field.registry { flex: 0 1 9.5em; }
.field span { font: 600 calc(10 * var(--px))/1.2 var(--display); letter-spacing: 0.14em; text-transform: uppercase; color: var(--dim); }
.field input { width: 100%; min-width: 0; height: 44px; padding: 0 12px; border-radius: 12px; border: var(--bw) solid var(--line-strong); background: rgba(255, 255, 255, 0.04); color: var(--text); font: calc(16 * var(--px)) var(--body); outline: none; }
.field input:focus { border-color: var(--cyan); }
.field.registry input { font-family: var(--display); letter-spacing: 0.06em; }
.ship-said { margin: 6px 0 0; font-size: calc(13 * var(--px)); }
/* Everything under the settings' heading scrolls as one, so on a short screen "What you're seeing" isn't squeezed
   into a sliver, and the heading and its close button stay where they are. (It is the part under the heading that
   scrolls and not the sheet itself: with the whole sheet scrolling, Chromium drew a lit band above it under night
   vision's red light.) */
#settings .sheet-body { overflow-y: auto; overscroll-behavior: contain; margin: 0 -16px; padding: 0 16px; flex: 1 1 auto; min-height: 0; }
.about { flex: none; color: var(--muted); font-size: calc(14 * var(--px)); }
.about h3 { margin: 18px 0 6px; font: 600 calc(13 * var(--px))/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 max(16px, var(--safe-r)) 16px max(16px, var(--safe-l)); 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: var(--bw) solid var(--line-strong); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.intro-card h2 { margin: 4px 0 10px; font: 600 calc(40 * var(--px))/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; }
/* A link that brought a course with it says so, first thing. */
.intro-card .course-line { margin: 0 0 8px; padding: 6px 12px; border-left: 3px solid var(--amber); border-radius: 0 12px 12px 0; background: rgba(255, 181, 74, 0.08); color: var(--text); }
/* The rooms off the bridge, on the welcome card and in Bridge settings: each a link with its button's picture. */
.rooms { list-style: none; margin: 0 0 12px; padding: 0; }
.rooms li + li { border-top: var(--bw) solid var(--line); }
.rooms a { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 4px 2px; color: var(--text); text-decoration: none; }
.rooms a:hover b { color: var(--cyan); }
.room-icon { flex: none; width: 34px; height: 34px; border-radius: 50%; border: var(--bw) solid var(--line-strong); display: grid; place-items: center; }
.room-icon svg { width: 18px; height: 18px; }
.room-text { display: grid; gap: 1px; min-width: 0; }
.room-text b { font: 600 calc(14 * var(--px))/1.25 var(--display); letter-spacing: 0.04em; }
.room-text span { color: var(--muted); font-size: calc(13 * var(--px)); line-height: 1.35; }
.intro-card .rooms { margin-top: -2px; }
/* Each room's picture in the colour of its button on the bridge. */
.rooms [data-room=maru] svg { stroke: #ff8f84; }
.rooms [data-room=missions] svg { stroke: var(--cyan); }
.rooms [data-room=tonight] svg { stroke: var(--sun); }
.rooms [data-room=xeno] svg { stroke: #6fe3a4; }
.rooms [data-room=contact] svg, .rooms [data-room=warp] svg { stroke: #c9a2ff; }
#show-intro { margin: 0 0 4px; }
/* Ship's records: save everything to a file, and restore it. */
.records-buttons { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 10px; }
.records-buttons .secondary { flex: 1 1 140px; min-height: 44px; height: auto; padding: 10px 14px; font-size: calc(13 * var(--px)); line-height: 1.2; }
#records-what { color: var(--text); }
#records-said:empty { display: none; }
#install { min-height: 44px; padding: 0 18px; border-radius: 999px; font: 600 calc(13 * var(--px))/1 var(--display); letter-spacing: 0.08em; text-transform: uppercase; margin: 0 0 10px; }

.loading { position: fixed; left: 0; right: 0; top: 45%; text-align: center; margin: 0; font: 500 calc(14 * var(--px))/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: var(--bw) 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: calc(12 * var(--px)); 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); }

/* Night vision: everything in red, so eyes that are used to the dark stay that way. It is switched on in tonight's
   sky or in Bridge settings, kept by tonight's sky, and worn by both (the other rooms don't have it).
   The red light keeps only the red in each colour. Starfleet's cyan has little, so what was meant to stand out came
   out the dimmest thing on the page. Under the light it is white, which keeps all its red. Pure red on black can't
   do better than 5.25:1, and needs red 236 or more of 255 to reach 4.5:1. */
body.red::after { content: ''; position: fixed; inset: 0; z-index: 100; background: #ff2a14; mix-blend-mode: multiply; pointer-events: none; }
body.red { --cyan: #fff; --text: #fff0ec; --muted: #ecd0c8; --dim: #d8b8b0; }
/* The log's words and the links that were green or violet have too little red of their own. */
body.red .entry dd:not(.home), body.red .intro-card p, body.red .lost p { color: var(--text); }
body.red .entry .files a.to-lab, body.red #open-scale { color: var(--text); border-color: rgba(255, 255, 255, 0.4); }
body.red #open-xeno svg, body.red #open-contact svg, body.red .rooms [data-room=xeno] svg, body.red .rooms [data-room=contact] svg, body.red .rooms [data-room=warp] svg { stroke: currentColor; }
/* Nothing large and bright is left: the big buttons are drawn as outlines. (The flash of going to warp is dimmed
   too: see flash() in js/app.js.) */
body.red .primary, body.red .engage:not(:disabled) { background: none; box-shadow: none; border: 1.5px solid currentColor; color: var(--text); }

@media (max-width: 480px) {
  /* Look for the Sun and Next destination each fit on one line of a phone. */
  .arrival-actions { gap: 8px; }
  .arrival-actions button { font-size: calc(13 * var(--px)); letter-spacing: 0.04em; padding: 0 6px; }
  .hud-buttons { gap: 6px; flex-wrap: wrap; justify-content: flex-end; max-width: calc(5 * 38px + 4 * 6px); }
  .round { width: 38px; height: 38px; }
  .round::after { inset: -4px; }
  .round svg { width: 18px; height: 18px; }
}

/* Narrower than 375 px, the buttons leave the star's name less room than its longest word, and the name ran on under
   them ("Teegarden's" and "Betelgeuse" at 360 px, seventeen of the destinations at 320). From 360 px the name is a
   size smaller, which fits the longest word among the destinations, and a longer word still breaks before it would
   run under a button. Narrower than that, the name has the row under the buttons to itself. */
@media (max-width: 374px) {
  .where h1 { font-size: calc(17 * var(--px)); overflow-wrap: break-word; }
}
@media (max-width: 359px) {
  .hud { flex-wrap: wrap; row-gap: 8px; }
  .hud-buttons { order: -1; margin-left: auto; }
  .where { flex: 1 1 100%; }
  .where h1 { font-size: calc(22 * var(--px)); }
}

/* 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; }
}

/* On a phone the sheets stand on the bottom edge, and a finger dragging a sheet's head down takes the sheet with it
   (see swipeDown in js/sheets.js): the browser doesn't scroll the page for it. */
@media (max-width: 759px) {
  .sheet-head { touch-action: none; }
}

@media (min-width: 760px) {
  .console { left: max(20px, var(--safe-l)); right: auto; bottom: calc(20px + var(--safe-b)); width: 430px; }
  .report-line:not(.flying) { left: max(20px, var(--safe-l)); right: auto; margin: 0; max-width: 430px; bottom: calc(32px + var(--safe-b) + var(--console-h, 210px)); }
  .hud { padding: calc(20px + var(--safe-t)) max(24px, var(--safe-r)) 30px max(24px, var(--safe-l)); }
  .where h1 { font-size: calc(26 * var(--px)); }
  .sheet { left: auto; right: max(20px, var(--safe-r)); top: calc(84px + var(--safe-t)); bottom: 20px; width: 440px; max-height: none; border-radius: 22px; border-bottom: var(--bw) solid var(--line); padding: 6px 16px 14px; animation-name: slide; }
  .sheet.arrival { top: auto; max-height: calc(100vh - 104px); }
  #picker { bottom: calc(20px + var(--kb, 0px)); height: auto; }
  .intro-card { max-width: 470px; } /* wider, so the card with its list of rooms fits in a screen 800 px tall */
  @keyframes slide { from { transform: translateX(30px); opacity: 0; } }
}

/* A phone on its side with its keyboard up has about 180 px of screen left. The Set course sheet, with its heading
   above the search field, left the field half under the keyboard and no room for a single hit: you typed without
   seeing what you typed or what it found. There the sheet takes all the room above the keyboard (the "kb" class is
   there while one is up: see watchKeyboard in js/app.js), and the heading gives way, with the close button beside
   the search field. */
@media (max-height: 500px) {
  .kb #picker { top: calc(6px + var(--safe-t)); bottom: var(--kb, 0px); height: auto; max-height: none; padding-top: 8px; padding-bottom: 4px;
    display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: auto minmax(0, 1fr); column-gap: 10px; }
  .kb #picker .sheet-head { display: contents; }
  .kb #picker h2 { display: none; }
  .kb #picker .close { grid-column: 2; grid-row: 1; align-self: center; }
  .kb #picker .search { grid-column: 1; grid-row: 1; }
  .kb #picker .list { grid-column: 1 / -1; grid-row: 2; }
}
@media (max-height: 500px) and (min-width: 760px) {
  .kb #picker { bottom: calc(6px + var(--kb, 0px)); }
}

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

/* A wide but short screen (a phone on its side, even a small one at 667 by 375, or a laptop) has the welcome card's
   eleven rooms in two columns, so the card stays about one screen tall and Take the helm is a swipe away. */
@media (min-width: 640px) and (max-height: 860px) {
  .intro-card { max-width: 780px; }
  .intro-card .rooms { display: grid; grid-template-columns: 1fr 1fr; column-gap: 22px; }
  .intro-card .rooms li + li { border-top: 0; }
  .intro-card .rooms li { border-bottom: var(--bw) solid var(--line); }
}
