@font-face {
  font-family: "Figtree";
  src: url("../fonts/figtree-latin-wght-normal.woff2") format("woff2");
  font-weight: 300 900;
  font-display: swap;
}

:root {
  --paper: #f1f5f7;
  --panel: #ffffff;
  --ink: #1b2a4a;
  --ink2: #56637f;
  --ink3: #9aa6ba;
  --line: #dbe2e9;
  --burn: #f4a520;
  --burn-ink: #8f5600;
  --target: #13a88a;
  --target-ink: #0a7560;
  --alert: #d94a68;
  --earth: #3b7fc4;
  --earth-lit: #4b93da;
  --land: #72c6a4;
  --halo: #ffffff;
  --on-burn: #1b2a4a;
  --font: "Figtree", ui-rounded, "Segoe UI", system-ui, sans-serif;
  --dock: 140px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; overflow: hidden; }
body {
  background: var(--paper);
  color: var(--ink);
  font: 500 14px/1.4 var(--font);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  user-select: none;
}
button, input, output, select { font: inherit; color: inherit; }
p, h1, ol { margin: 0; padding: 0; }

#sky { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }

/* Mission brief, top left */
.brief { position: fixed; top: 20px; left: 28px; width: min(400px, 36vw); pointer-events: none; text-shadow: 0 0 5px var(--paper), 0 0 5px var(--paper), 0 0 9px var(--paper); }
.brief > * { pointer-events: auto; }
/* A soft wash of paper behind the text, fading out at its right and bottom edges. */
.brief::before {
  content: ""; position: absolute; inset: -20px -70px -40px -28px; z-index: -1; pointer-events: none;
  background: color-mix(in srgb, var(--paper) 90%, transparent);
  -webkit-mask-image: linear-gradient(to right, #000 78%, transparent), linear-gradient(to bottom, #000 80%, transparent);
  mask-image: linear-gradient(to right, #000 78%, transparent), linear-gradient(to bottom, #000 80%, transparent);
  -webkit-mask-composite: source-in; mask-composite: intersect;
}
.brief button { text-shadow: none; }
.brief-nav { display: flex; align-items: center; gap: 4px; margin-left: -8px; color: var(--ink2); font-size: 13px; }
.brief h1 { font-size: 30px; line-height: 1.1; font-weight: 700; letter-spacing: -0.02em; margin: 4px 0 8px; }
.goal { font-size: 16px; line-height: 1.4; }
.note { margin-top: 8px; color: var(--ink2); line-height: 1.45; min-height: 2.9em; }
.note.good { color: var(--target-ink); }
.note.bad { color: var(--alert); }
.note strong { font-weight: 700; }
.note span { display: block; color: var(--ink2); margin-top: 4px; }
.flights { display: flex; align-items: center; gap: 8px; margin-top: 12px; font-size: 13px; font-weight: 600; color: var(--ink2); }
.flights select { flex: 1; min-width: 0; text-shadow: none; }

/* Buttons */
button {
  border: 1.5px solid var(--line); background: var(--panel); border-radius: 999px;
  padding: 6px 14px; cursor: pointer; font-weight: 600; font-size: 13px;
}
button:hover { border-color: var(--ink3); }
button:active { transform: translateY(1px); }
button:disabled { opacity: 0.4; cursor: default; }
button:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible { outline: 2.5px solid var(--earth); outline-offset: 2px; }
button.icon { border: 0; background: none; padding: 6px; display: grid; place-items: center; color: var(--ink2); }
button.icon:hover { color: var(--ink); background: var(--line); }
button.primary { background: var(--target); border-color: var(--target); color: #fff; margin-top: 12px; padding: 8px 18px; font-size: 14px; }
button.primary:hover { background: var(--target-ink); border-color: var(--target-ink); }
button.quiet { border-color: transparent; background: none; color: var(--ink2); padding: 6px 10px; }
button.quiet:hover { color: var(--ink); border-color: var(--line); }
button.link { border: 0; background: none; padding: 0; color: var(--earth); font-size: 12px; font-weight: 600; text-decoration: underline; border-radius: 3px; }
select { border: 1.5px solid var(--line); background: var(--panel); border-radius: 9px; height: 30px; padding: 0 8px; font-weight: 600; font-size: 13px; }

.tools { position: fixed; top: 20px; right: 24px; display: flex; gap: 8px; align-items: flex-start; }
.seg { display: inline-flex; border: 1.5px solid var(--line); border-radius: 999px; background: var(--panel); padding: 2px; }
.seg button { border: 0; padding: 4px 12px; background: none; color: var(--ink2); }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--panel); }
.seg.mini { padding: 1px; }
.seg.mini button { padding: 2px 8px; font-size: 12px; }

/* Settings: things you set once and forget */
.menu { position: relative; }
.menu summary { list-style: none; border: 1.5px solid var(--line); background: var(--panel); border-radius: 999px; padding: 6px 14px; cursor: pointer; font-weight: 600; font-size: 13px; }
.menu summary::-webkit-details-marker { display: none; }
.menu[open] summary { border-color: var(--ink); }
.menu-body { position: absolute; right: 0; top: calc(100% + 8px); width: 230px; background: var(--panel); border: 1.5px solid var(--line); border-radius: 14px; padding: 14px 16px; display: flex; flex-direction: column; gap: 12px; }
.menu-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; font-size: 13px; font-weight: 600; }
.menu-row input { width: 120px; }

/* Zoom and tilt: small and out of the way, just above the dock */
.zoom { position: fixed; right: 24px; bottom: calc(var(--dock) + 16px); display: flex; flex-direction: column; gap: 6px; align-items: center; }
.zoom button { width: 34px; height: 34px; padding: 0; display: grid; place-items: center; font-size: 17px; font-weight: 500; line-height: 1; }
.zoom #zoom-fit, .zoom #tilt { font-size: 12px; font-weight: 650; }
.zoom #tilt { margin-bottom: 6px; }
.zoom #tilt[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--panel); }

/* The dock. Top row: the journey as a chain of steps. Below it: the selected step,
   with a pointer tying the two together. Extra controls stay folded away until
   the player or the mission calls for them. */
.dock {
  position: fixed; left: 0; right: 0; bottom: 0;
  background: var(--panel); border-top: 1.5px solid var(--line);
  display: grid; grid-template-columns: minmax(0, 1fr) 262px;
}
.plan { padding: 12px 20px 12px 28px; min-width: 0; display: flex; flex-direction: column; gap: 11px; }
.budget { border-left: 1.5px solid var(--line); padding: 13px 22px; display: flex; flex-direction: column; gap: 7px; }

.strip { list-style: none; display: flex; align-items: center; overflow-x: auto; scrollbar-width: none; flex: none; padding: 2px; margin: -2px; }
.strip::-webkit-scrollbar { display: none; }
.strip li { display: flex; align-items: center; flex: none; }
.coast { color: var(--ink2); font-size: 12px; position: relative; min-width: 34px; text-align: center; white-space: nowrap; }
.coast.short { min-width: 18px; }
.coast::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; border-top: 1.5px dashed var(--line); }
.coast span { position: relative; background: var(--panel); padding: 0 8px; margin: 0 10px; }
.step {
  display: flex; align-items: center; gap: 9px; text-align: left;
  border-radius: 14px; padding: 6px 14px 6px 8px; min-height: 44px;
}
.step[aria-pressed="true"] { border-color: var(--ink); box-shadow: 0 0 0 1.5px var(--ink); }
.step .dot { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; background: var(--burn); color: var(--on-burn); flex: none; }
.step .dot.start { background: var(--ink); }
.step .dot.start::after { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--panel); }
.step b { display: block; font-weight: 650; font-size: 13.5px; line-height: 1.2; }
.step small { display: block; color: var(--ink2); font-size: 12px; font-weight: 500; line-height: 1.25; }
.step.lost { opacity: 0.45; }
.step.short small { color: var(--alert); }
.step.drop { padding: 6px 14px; border-radius: 8px; }
.step.add { border-style: dashed; color: var(--ink2); padding: 6px 14px 6px 10px; gap: 6px; min-height: 36px; }
.step.add:hover { color: var(--ink); }
.step.add .plus { font-size: 17px; line-height: 1; font-weight: 500; }
.step.result { padding: 0 4px 0 10px; border-left: 3px solid var(--ink); border-radius: 0; min-height: 34px; }
.step.result.bad { border-left-color: var(--alert); }
.step.result.bad small { color: var(--alert); }

.detail { position: relative; background: var(--paper); border-radius: 14px; padding: 9px 12px 9px 16px; display: flex; flex-direction: column; gap: 9px; }
.detail::before {
  content: ""; position: absolute; top: -6px; left: var(--caret, 60px); width: 14px; height: 14px;
  background: var(--paper); border-radius: 3px; transform: translateX(-50%) rotate(45deg); transition: left 0.18s ease;
}
.rowA { display: flex; align-items: center; gap: 16px; min-height: 36px; }
.rowB { display: flex; align-items: flex-start; gap: 30px; border-top: 1.5px solid var(--line); padding-top: 9px; flex-wrap: wrap; row-gap: 10px; }
.spacer { flex: 1; }
.lead-box { display: flex; flex-direction: column; }
.lead { font-weight: 650; font-size: 14px; }
.lead-text { font-size: 13.5px; }
.group { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.group-name { font-size: 12px; font-weight: 600; color: var(--ink2); height: 16px; }
.group-foot { font-size: 12px; color: var(--ink2); line-height: 1.3; }
.group-foot.bad { color: var(--alert); }
.thrust { flex: 0 1 340px; min-width: 190px; display: grid; grid-template-columns: 26px minmax(70px, 1fr) 26px; align-items: center; gap: 0 8px; }
.thrust .ends { grid-column: 2; display: flex; justify-content: space-between; color: var(--ink2); font-size: 11.5px; margin-top: -5px; line-height: 1.1; }
button.nudge { width: 26px; height: 26px; padding: 0; display: grid; place-items: center; font-size: 16px; line-height: 1; font-weight: 500; }
button.nudge.sm { width: 22px; height: 22px; font-size: 14px; }
.stats { display: flex; gap: 20px; align-items: center; }
.stats div { display: flex; flex-direction: column; white-space: nowrap; }
.stats span { font-size: 11.5px; color: var(--ink2); line-height: 1.2; }
.stats b { font-weight: 650; font-size: 13.5px; line-height: 1.3; }
.detail .seg button { padding: 4px 10px; font-size: 12.5px; }
.detail .seg button:disabled { opacity: 0.35; }
.laps { display: flex; align-items: center; gap: 5px; font-size: 12px; color: var(--ink2); white-space: nowrap; }
.laps .seg { margin-left: 3px; }
#remove:hover { color: var(--alert); }

/* Numbers you can type into */
.num {
  width: 100%; height: 30px; padding: 0 9px; text-align: right; font-weight: 650; font-size: 13px;
  border: 1.5px solid var(--line); border-radius: 9px; background: var(--panel); color: var(--ink);
  user-select: text; cursor: text; min-width: 0;
}
.num:hover { border-color: var(--ink3); }
.num:focus { outline: none; border-color: var(--earth); box-shadow: 0 0 0 3px color-mix(in srgb, var(--earth) 25%, transparent); }
.num:disabled { opacity: 0.45; }
.num.tiny { width: 60px; height: 24px; padding: 0; text-align: center; border-radius: 7px; }
.num.main { width: 108px; flex: none; font-weight: 700; font-size: 14px; }
.budget .num { width: 108px; margin-left: auto; }

/* Linked numbers: three sizes with one held, or three direction parts */
.holds { display: flex; gap: 8px; }
.hold { display: flex; flex-direction: column; gap: 6px; width: 92px; }
.hold > span, .hold button { height: 16px; font-size: 12px; font-weight: 600; color: var(--ink2); white-space: nowrap; }
.hold button { border: 0; background: none; padding: 0; border-radius: 4px; text-align: left; display: flex; align-items: center; gap: 5px; }
.hold button::before { content: ""; width: 9px; height: 9px; border-radius: 50%; border: 1.5px solid var(--ink3); flex: none; }
.hold[data-on] button { color: var(--ink); }
.hold[data-on] button::before { background: var(--ink); border-color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--panel); }
.hold[data-on] .num { border-color: var(--ink); font-weight: 700; }

/* Fuel and delta-v */
.field { display: flex; align-items: center; gap: 8px; min-height: 30px; }
.field-name { font-weight: 650; font-size: 13px; white-space: nowrap; }
.field output { font-weight: 650; margin-left: auto; white-space: nowrap; }
.small { color: var(--ink2); font-size: 12.5px; }
.small.bad { color: var(--alert); }
.meter { height: 10px; border-radius: 5px; background: var(--line); display: flex; overflow: hidden; gap: 2px; }
.meter i { display: block; height: 100%; background: var(--burn); min-width: 0; }
.meter i.over { background: var(--alert); }

input[type="range"] { -webkit-appearance: none; appearance: none; width: 100%; height: 22px; background: none; margin: 0; cursor: pointer; }
input[type="range"]::-webkit-slider-runnable-track { height: 6px; border-radius: 3px; background: var(--line); }
input[type="range"]::-moz-range-track { height: 6px; border-radius: 3px; background: var(--line); }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 20px; height: 20px; margin-top: -7px; border-radius: 50%; background: var(--ink); border: 3px solid var(--panel); box-shadow: 0 0 0 1.5px var(--ink); }
input[type="range"]::-moz-range-thumb { width: 15px; height: 15px; border-radius: 50%; background: var(--ink); border: 3px solid var(--panel); box-shadow: 0 0 0 1.5px var(--ink); }
input[type="range"].warm::-webkit-slider-thumb { background: var(--burn); box-shadow: 0 0 0 1.5px var(--burn-ink); }
input[type="range"].warm::-moz-range-thumb { background: var(--burn); box-shadow: 0 0 0 1.5px var(--burn-ink); }
input[type="range"]:disabled { opacity: 0.4; }

@media (max-width: 1100px) {
  .dock { grid-template-columns: minmax(0, 1fr) 236px; }
  .brief h1 { font-size: 26px; }
}

/* Choosing a real spacecraft, in Free flight */
.craft { display: flex; flex-direction: column; gap: 6px; padding-bottom: 8px; margin-bottom: 2px; border-bottom: 1.5px solid var(--line); }
.craft select { width: 100%; }
.craft .small { font-size: 12px; line-height: 1.35; }

/* Switch between the Earth game and the Moon game */
.seg.world a { padding: 4px 12px; border-radius: 999px; font-weight: 600; font-size: 13px; color: var(--ink2); text-decoration: none; }
.seg.world a[aria-current="page"] { background: var(--ink); color: var(--panel); }
.seg.world a:focus-visible { outline: 2.5px solid var(--earth); outline-offset: 2px; }
