* {
  box-sizing: border-box;
}
:root {
  color-scheme: dark;
  --background: #090f1d;
  --panel: #111d31;
  --ink: #e8f2ff;
  --muted: #a7bdd7;
  --rule: #273c56;
  --control: #3a526f;
  --hover: #1d334e;
  --accent: #8cdaff;
  --accent-ink: #091c30;
  --amber: #ffba89;
}
body {
  margin: 0;
  min-height: 100dvh;
  background: radial-gradient(ellipse at 16% 0, #142945 0, transparent 56%), var(--background);
  color: var(--ink);
  font:
    15px/1.45 "DM Sans",
    -apple-system,
    sans-serif;
}
header,
main {
  max-width: 1530px;
  margin: auto;
  padding-inline: clamp(16px, 4vw, 64px);
}
header {
  display: flex;
  align-items: center;
  gap: 24px;
  padding-block: 14px;
  border-bottom: 1px solid var(--rule);
}
header > button {
  margin-left: auto;
}
.brand {
  font-weight: 700;
  font-size: 19px;
  letter-spacing: -0.7px;
  color: var(--accent);
}
nav,
.inline,
.timeline,
.between,
.scene-head,
.scene-foot,
.scene-tools,
#thrusters {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
button,
select,
input,
.file {
  font: inherit;
  color: inherit;
}
button,
select,
input:not([type="range"]),
.file {
  border: 1px solid var(--control);
  border-radius: 7px;
  padding: 6px 10px;
  background: var(--panel);
}
button,
select,
summary,
.file {
  cursor: pointer;
}
button:disabled {
  opacity: 0.42;
  cursor: default;
}
button:hover:enabled {
  border-color: var(--accent);
  background: var(--hover);
}
button[aria-pressed="true"],
button.accent,
button.dark {
  border-color: transparent;
  background: var(--accent);
  color: var(--accent-ink);
}
button[aria-pressed="true"]:hover:enabled,
button.accent:hover:enabled,
button.dark:hover:enabled {
  background: #b7eaff;
}
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
#scenarioList {
  padding-top: 20px;
}
#scenarioList::before {
  content: "Experiment";
  color: var(--muted);
  margin-right: 4px;
}
#scenarioList button {
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
}
#scenarioList button[aria-pressed="true"],
#scenarioList button:hover:enabled {
  color: var(--accent);
  background: transparent;
  border-color: var(--accent);
}
#scenarioList button[aria-pressed="true"] {
  font-weight: 650;
}
.intro {
  margin: 22px 0 18px;
}
.intro h1 {
  font:
    normal clamp(34px, 4vw, 57px) / 1.08 Georgia,
    serif;
  letter-spacing: -0.045em;
  margin: 0;
}
.intro p {
  margin: 9px 0;
  color: var(--muted);
  max-width: 76ch;
}
.layout {
  display: grid;
  grid-template-columns: minmax(0, 2.4fr) minmax(270px, 1fr);
  gap: clamp(16px, 2.5vw, 36px);
}
.world,
aside {
  min-width: 0;
}
.scene {
  border: 1px solid var(--rule);
  border-radius: 12px;
  overflow: hidden;
  background: #101f35;
  box-shadow: 0 16px 38px #05091545;
}
.scene-head,
.scene-foot {
  justify-content: space-between;
  padding: 12px 16px;
}
.scene-head {
  border-bottom: 1px solid var(--rule);
  background: var(--panel);
}
#paused {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  border: 1px solid #80634d;
  border-radius: 6px;
  background: #2f251f;
  color: #ffd2ad;
  font-size: 13px;
  font-weight: 700;
}
#paused::before {
  content: "";
  width: 7px;
  height: 9px;
  border-inline: 2px solid currentColor;
}
#paused.playing {
  visibility: hidden;
}
.scene-foot {
  border-top: 1px solid var(--rule);
  background: var(--panel);
  color: var(--muted);
  font-size: 13px;
}
#sceneStatus:empty {
  display: none;
}
#sceneStatus {
  color: var(--amber);
}
canvas {
  display: block;
  width: 100%;
}
#space {
  height: clamp(250px, 42vh, 490px);
  touch-action: none;
  background: radial-gradient(ellipse at 50% 52%, #182f4b, transparent 80%);
}
#diagram {
  height: 230px;
  background: #101c30;
  border: 1px solid var(--rule);
  border-radius: 8px;
  cursor: grab;
  touch-action: none;
}
#diagram.dragging {
  cursor: grabbing;
}
.between {
  justify-content: space-between;
}
.transport {
  padding-bottom: 8px;
}
.timeline {
  gap: 4px;
}
button#play {
  padding-inline: 19px;
}
input[type="range"] {
  width: 100%;
  margin: 16px 0;
  accent-color: var(--accent);
}
.timeline select {
  margin-left: auto;
}
.turn {
  margin: 10px 0;
}
details {
  padding: 12px 0;
  border-top: 1px solid var(--rule);
}
summary {
  font-weight: 620;
}
details p,
small,
#elapsed,
#inspection,
.scene-foot,
#groups {
  color: var(--muted);
}
details p {
  margin: 8px 0;
}
a {
  color: var(--accent);
  text-underline-offset: 3px;
}
details[open] summary {
  margin-bottom: 8px;
}
.plot-controls {
  margin-top: 8px;
  font-size: 13px;
}
.plot-controls button {
  min-width: 29px;
  padding: 3px 6px;
}
#diagramPanHelp {
  display: block;
}
.scene-note:first-of-type {
  margin-top: 12px;
}
#ownSpeed,
#diagramScale {
  font-variant-numeric: tabular-nums;
}
#ownSpeed {
  color: var(--accent);
  font-size: 13px;
}
#eventDrawer {
  margin-top: 16px;
}
.below {
  margin: 6px 0 25px;
}
.world .below button {
  font-size: 13px;
}
.clock,
.event {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  padding: 7px 0;
  border: 0;
  border-bottom: 1px solid var(--rule);
  border-radius: 0;
}
.clock[aria-pressed="true"] {
  background: transparent;
  color: inherit;
}
.clock:hover:enabled {
  background: transparent;
  border-color: var(--accent);
}
.clock[aria-pressed="true"] span {
  text-decoration: underline;
}
#events,
#savedList {
  display: grid;
  gap: 5px;
  margin: 12px 0;
  max-height: 270px;
  overflow: auto;
}
.piloting {
  padding: 12px;
  background: #142238;
  border-top: 1px solid var(--rule);
  border-radius: 0;
}
.piloting span {
  margin-left: 8px;
  font-size: 13px;
}
.photon-controls {
  margin-top: 12px;
}
#lightReadings {
  padding: 10px 16px 14px;
  background: var(--panel);
  border-top: 1px solid var(--rule);
  font-size: 13px;
}
#lightValues {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  margin-top: 7px;
  font-variant-numeric: tabular-nums;
}
#lightValues b,
#lightValues span {
  display: block;
}
#lightValues span {
  color: var(--muted);
}
#lightValues b {
  color: #ffe38a;
}
#thrusters {
  margin-top: 8px;
}
#thrusters button {
  font-size: 13px;
}
.stack {
  display: grid;
  gap: 8px;
}
.vectors {
  display: flex;
  gap: 6px;
}
.vectors label {
  min-width: 0;
  flex: 1;
}
.vectors input {
  width: 100%;
}
#newName {
  width: 100px;
}
body:not(.free) .flight-only,
body.free #scenarioList,
[hidden] {
  display: none !important;
}
body.free .scene {
  background: #080f20;
}
body.free #space {
  background: radial-gradient(ellipse at 52% 75%, #13294a, transparent 78%);
}
.file input {
  display: none;
}
dialog {
  border: 1px solid var(--rule);
  border-radius: 10px;
  width: min(510px, 96vw);
  background: var(--panel);
  color: inherit;
}
dialog::backdrop {
  background: #030916b8;
}
h2 {
  font:
    normal 24px Georgia,
    serif;
  margin: 0;
}
#status:not(:empty) {
  position: fixed;
  bottom: 15px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--accent);
  color: var(--accent-ink);
  padding: 10px 16px;
  border-radius: 6px;
  z-index: 5;
}
@media (max-width: 760px) {
  header {
    gap: 8px;
    flex-wrap: wrap;
  }
  .brand {
    width: 100%;
  }
  .layout {
    display: flex;
    flex-direction: column;
    gap: 14px;
  }
  .world {
    display: contents;
  }
  .scene {
    order: 0;
  }
  aside {
    order: 2;
  }
  #eventDrawer {
    order: 3;
  }
  .below {
    order: 4;
  }
  #space {
    height: 250px;
  }
  #scenarioList {
    gap: 3px;
  }
  #scenarioList button {
    font-size: 13px;
    padding: 5px;
  }
  .intro {
    margin: 14px 0;
  }
  .scene-head,
  .scene-foot {
    padding: 8px 10px;
  }
}
.immersive-controls {
  display: none;
}
.scene.expanded {
  position: fixed;
  inset: 0;
  z-index: 10;
  width: 100vw;
  height: 100dvh;
  border: 0;
  border-radius: 0;
  display: flex;
  flex-direction: column;
}
.scene.expanded #space {
  flex: 1;
  min-height: 0;
  height: 0;
}
.scene.expanded .immersive-controls {
  display: flex;
  justify-content: center;
  gap: 8px;
  padding: 8px;
}
.immersive {
  overflow: hidden;
}
.scene-head select {
  max-width: 170px;
}
#resetFlight {
  border-color: #785845;
  color: var(--amber);
}
#resetFlight:hover:enabled {
  border-color: var(--amber);
}
