:root {
  color-scheme: dark;
  --font: 'DIN Alternate', 'Bahnschrift', 'Roboto Condensed', 'Arial Narrow', sans-serif;
  --bg: #23292e;
  --panel: rgba(36, 42, 47, 0.93);
  --glass: rgba(30, 36, 41, 0.86);
  --glass-line: rgba(143, 203, 187, 0.14);
  --panel-2: #2c3338;
  --line: #3d464d;
  --text: #d8dfe3;
  --dim: #87939b;
  --mint: #8fcbbb;
  --mint-fill: #75b3a2;
  --mint-ink: #17302b;
  --red: #d0503f;
  --orange: #d9773a;
  --amber: #e2b871;
  --lilac: #b8a6e4;
  --sky: #b9d3e8;
  --probe: #9ad8e6;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  font-variant-numeric: tabular-nums;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg);
}
main {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: crosshair;
}
canvas.grabbing {
  cursor: grabbing;
}
canvas.pointing {
  cursor: pointer;
}
button {
  font: inherit;
  letter-spacing: 0.08em;
  color: var(--text);
  background: var(--panel-2);
  border: 1px solid #4a545b;
  border-radius: 0;
  padding: 6px 10px;
  cursor: pointer;
  transition:
    background 0.15s,
    border-color 0.15s,
    color 0.15s;
}
button:hover {
  background: #39424a;
  border-color: #6c7880;
}
button.active {
  background: var(--mint-fill);
  border-color: var(--mint);
  color: var(--mint-ink);
}
button.preview-active {
  border-color: var(--amber);
  color: var(--amber);
}
button:focus-visible,
input:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 2px;
}
button:disabled {
  opacity: 0.32;
  cursor: default;
}

/* --- Time block (top left) -------------------------------------------------------- */
.clock-block {
  position: absolute;
  top: 14px;
  left: 18px;
  pointer-events: none;
}
.clock-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 10px;
  background: rgba(36, 42, 47, 0.7);
}
.clock-time {
  font-size: 12px;
  color: var(--dim);
  min-width: 52px;
}
.clock-date {
  font-size: 10px;
  line-height: 1.25;
  letter-spacing: 0.08em;
  color: #b4bec4;
}
.clock-year {
  font-size: 26px;
  letter-spacing: 0.06em;
  color: #c9d1d6;
}
.speed {
  display: grid;
  gap: 3px;
  pointer-events: auto;
}
.speed small {
  font-size: 8px;
  letter-spacing: 0.18em;
  color: var(--dim);
}
.time-controls {
  display: flex;
  gap: 3px;
}
.time-controls button {
  padding: 2px 6px;
  font-size: 10px;
  letter-spacing: -0.05em;
  min-width: 28px;
}
.app-title {
  margin-top: 14px;
  font-size: 11px;
  letter-spacing: 0.22em;
  color: #aab4ba;
}
#clock {
  margin-left: 10px;
  font-size: 10px;
  letter-spacing: 0.1em;
  color: var(--dim);
}

/* --- System bar and command hint (top centre) ------------------------------------- */
.system-bar {
  position: absolute;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 6px 16px 9px;
  border-bottom: 1px dashed #59646c;
  pointer-events: none;
  white-space: nowrap;
}
.system-bar b {
  font-size: 13px;
  letter-spacing: 0.16em;
  color: #e3e8eb;
}
.system-bar small {
  display: block;
  margin-top: 3px;
  font-size: 9px;
  letter-spacing: 0.14em;
  color: var(--dim);
}
.run-indicator {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--mint);
  box-shadow: 0 0 14px rgba(143, 203, 187, 0.35);
  transition:
    background 0.2s,
    box-shadow 0.2s;
}
.run-indicator.paused {
  background: transparent;
  border: 2px solid var(--amber);
  box-shadow: none;
}
#hint {
  position: absolute;
  top: 82px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 26px;
  align-items: flex-end;
  max-width: calc(100% - 32px);
  font-size: 12px;
  letter-spacing: 0.16em;
  color: #e6ebee;
  pointer-events: none;
  white-space: nowrap;
  transition: opacity 0.2s;
}
#hint:empty {
  opacity: 0;
}
#hint .act {
  display: flex;
  align-items: center;
  gap: 7px;
  padding-bottom: 7px;
  border-bottom: 5px solid #e6ebee;
}
#hint .act.cancel {
  border-bottom: 5px solid transparent;
  border-image: repeating-linear-gradient(-45deg, #8d989f 0 3px, transparent 3px 6px) 5;
  color: #c3cbd0;
}
#hint kbd {
  font: inherit;
  font-size: 9px;
  letter-spacing: 0.12em;
  padding: 1px 5px;
  border: 1px solid currentColor;
}
#hint.warning {
  display: block;
  padding: 7px 14px;
  border: 1px solid var(--red);
  background: rgba(60, 26, 22, 0.88);
  color: #ffb4a6;
  white-space: normal;
  text-align: center;
  letter-spacing: 0.06em;
}
#hint.info {
  display: block;
  padding: 7px 14px;
  border: 1px solid #9a8455;
  background: rgba(52, 46, 32, 0.85);
  color: var(--amber);
  white-space: normal;
  text-align: center;
  letter-spacing: 0.06em;
}
#hint b {
  font-weight: 700;
  color: #fff;
}

/* --- Fleet list (left) ------------------------------------------------------------- */
.fleet {
  position: absolute;
  top: 112px;
  left: 16px;
  width: 250px;
}
.panel-header {
  padding: 6px 10px;
  font-size: 11px;
  letter-spacing: 0.16em;
  color: #e9f3f0;
  background: #5f9686;
}
#fleet-list {
  display: grid;
  gap: 6px;
  margin-top: 6px;
}
.fleet-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 3px 8px;
  width: 100%;
  padding: 7px 10px 8px 12px;
  text-align: left;
  background: rgba(36, 42, 47, 0.82);
  border: 0;
  border-left: 3px solid #6c777f;
}
.fleet-item.own {
  border-left-color: var(--mint);
}
.fleet-item.selected {
  background: rgba(58, 68, 75, 0.92);
  outline: 1px solid #5c676e;
}
.fleet-item b {
  font-size: 13px;
  letter-spacing: 0.1em;
  font-weight: 700;
}
.fleet-item em {
  font-style: normal;
  font-size: 9px;
  letter-spacing: 0.14em;
  color: var(--mint);
  align-self: center;
}
.fleet-item.other em {
  color: #b7c0c6;
}
.fleet-item small {
  grid-column: 1 / -1;
  font-size: 9px;
  letter-spacing: 0.1em;
  color: var(--dim);
}
.fleet-item i {
  grid-column: 1 / -1;
  height: 3px;
  background: #3b444b;
}
.fleet-item i b {
  display: block;
  height: 100%;
  background: #c9d2d7;
  transition: width 0.25s;
}
.fleet-item.own i b {
  background: var(--mint);
}
.fleet-item.probe {
  padding: 5px 10px 6px 24px;
  border-left-color: var(--probe);
}
.fleet-item.probe b {
  font-size: 11px;
}
.fleet-item.probe em {
  color: var(--probe);
}
.fleet-item.probe i b {
  background: var(--probe);
}
.fleet-item.contact em {
  color: var(--sky);
}
.fleet-item.contact i b {
  background: #8d989f;
}
.fleet-item.lost {
  opacity: 0.62;
  border-left-style: dashed;
}
.fleet-item.lost em {
  color: #b7c0c6;
}
.fleet-section {
  margin-top: 4px;
  padding: 0 2px;
  font-size: 9px;
  letter-spacing: 0.18em;
  color: var(--dim);
}
.fleet-empty {
  padding: 6px 10px;
  font-size: 9px;
  letter-spacing: 0.1em;
  color: #6f7a82;
  border-left: 3px dashed #4a545b;
}

/* --- Ship card (right) ------------------------------------------------------------- */
#ship-panel {
  position: absolute;
  top: 112px;
  right: 16px;
  width: 316px;
}
.ship-tag {
  display: inline-block;
  padding: 4px 9px;
  font-size: 10px;
  letter-spacing: 0.14em;
  color: #eaf5f1;
  background: #5f9686;
}
#ship-panel.observed .ship-tag {
  background: #6f7a82;
}
.ship-header {
  position: relative;
  height: 52px;
  background: var(--mint);
  overflow: visible;
}
#ship-panel.observed .ship-header {
  background: #a9b4bb;
}
.ship-header h1 {
  position: absolute;
  left: 12px;
  bottom: 9px;
  margin: 0;
  font-size: 20px;
  letter-spacing: 0.06em;
  color: var(--mint-ink);
  z-index: 1;
}
#ship-panel.observed .ship-header h1 {
  color: #22292e;
}
#ship-panel.lost .ship-header {
  background: repeating-linear-gradient(-45deg, #8a949b 0 6px, #7f898f 6px 12px);
}
#ship-panel.probe .ship-tag {
  background: #4f8794;
}
#ship-panel.probe .ship-header {
  background: var(--probe);
}
#ship-panel.probe .ship-header h1 {
  color: #173238;
}
#ship-portrait {
  position: absolute;
  right: -12px;
  bottom: 6px;
  width: 156px;
  height: 84px;
  pointer-events: none;
}
.ship-body {
  max-height: calc(100dvh - 250px);
  overflow-y: auto;
  scrollbar-width: thin;
  padding: 10px 12px 12px;
  background: var(--panel);
  border: 1px solid #353e44;
  border-top: 0;
}
.ownership-row {
  font-size: 11px;
  letter-spacing: 0.14em;
  color: #c7d0d5;
}
.gauges {
  display: grid;
  gap: 6px;
  margin: 10px 0;
}
.gauge {
  display: grid;
  grid-template-columns: 78px 1fr 70px;
  align-items: center;
  gap: 8px;
  font-size: 9px;
  letter-spacing: 0.12em;
  color: var(--dim);
}
.gauge i {
  height: 4px;
  background: #3b444b;
}
.gauge i b {
  display: block;
  height: 100%;
  width: 0;
  background: #e3e8eb;
  transition: width 0.2s;
}
.gauge.thrust i b {
  background: var(--mint);
}
.gauge.gravity i b {
  background: var(--lilac);
}
.gauge output {
  text-align: right;
  font-size: 10px;
  color: #c7d0d5;
}
#order-status {
  margin: 0 0 4px;
  min-height: 30px;
  font-size: 12px;
  line-height: 1.3;
  letter-spacing: 0.04em;
  color: #e3e8eb;
}
#ship-data {
  display: block;
  min-height: 12px;
  margin-bottom: 10px;
  font-size: 9px;
  letter-spacing: 0.1em;
  color: var(--dim);
}
.orders {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}
.orders button {
  display: grid;
  justify-items: center;
  gap: 5px;
  padding: 8px 2px 6px;
  font-size: 8px;
  letter-spacing: 0.1em;
  color: #cfd7dc;
  background: #2e363c;
  border: 1px solid #56616a;
}
.orders svg {
  width: 26px;
  height: 26px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.orders button:not(:disabled):hover {
  border-color: var(--mint);
  color: #fff;
}
.orders button.active {
  background: var(--mint-fill);
  color: var(--mint-ink);
}
#orbit-setup {
  display: grid;
  gap: 8px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed #6d644e;
  font-size: 10px;
}
#orbit-setup[hidden] {
  display: none;
}
.setup-title {
  font-size: 10px;
  letter-spacing: 0.16em;
  color: var(--amber);
}
#orbit-params {
  display: grid;
  gap: 8px;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}
#orbit-params:disabled {
  opacity: 0.45;
}
#orbit-setup label {
  display: flex;
  justify-content: space-between;
  letter-spacing: 0.1em;
  color: #aab4ba;
}
#orbit-setup output {
  color: var(--amber);
}
#orbit-altitude {
  width: 100%;
  accent-color: var(--amber);
}
.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.segmented button {
  font-size: 10px;
  padding: 6px 4px;
}
#orbit-info {
  font-size: 9px;
  letter-spacing: 0.08em;
  color: var(--dim);
}
.setup-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.setup-actions button {
  font-size: 10px;
}
#orbit-confirm:not(:disabled) {
  border-color: var(--amber);
  color: #1f1a10;
  background: var(--amber);
}

/* --- Sensors and probes (ship card) ------------------------------------------------ */
.sensor-block {
  display: grid;
  gap: 8px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed #4a545b;
}
.sensor-block[hidden] {
  display: none;
}
.sensor-status {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #c7d0d5;
}
.signature::before {
  content: '';
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 6px;
  border-radius: 50%;
  background: var(--mint);
  vertical-align: 1px;
  transition:
    background 0.3s,
    box-shadow 0.3s;
}
.signature.elevated {
  color: var(--amber);
}
.signature.elevated::before {
  background: var(--amber);
}
.signature.high {
  color: #f0a070;
}
.signature.high::before {
  background: var(--orange);
  box-shadow: 0 0 7px var(--orange);
}
.probe-stock {
  color: var(--probe);
}
.probe-stock.empty {
  color: var(--dim);
}
.sensor-orders {
  grid-template-columns: repeat(3, 1fr);
}
.sensor-orders span {
  text-align: center;
  line-height: 1.35;
}
#sensor-mode {
  font-size: 9px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--dim);
}
/* Surroundings of the ship: cover, blindness, a dense field's speed limit. */
.ship-env {
  display: block;
  margin-top: 4px;
  font-size: 9px;
  letter-spacing: 0.08em;
  line-height: 1.4;
  text-transform: uppercase;
  color: #d6bf8e;
}
.ship-env[hidden] {
  display: none;
}

/* --- Systems section (ship card, below the sensors) -------------------------------- */
.systems-block {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed #4a545b;
}
.systems-block[hidden] {
  display: none;
}
.systems-title {
  font-size: 10px;
  letter-spacing: 0.16em;
  color: #c7d0d5;
}
/* Hull schematic: nose up, small module icons, sidewall bars along the flanks. */
.hull {
  position: relative;
  height: 250px;
  margin: 4px -4px 0;
}
.hull[hidden] {
  display: none;
}
#hull-plan {
  display: block;
  width: 100%;
  height: 100%;
}
.hull-modules {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.module {
  position: absolute;
  width: 20px;
  height: 20px;
  padding: 0;
  display: grid;
  place-items: center;
  transform: translate(-50%, -50%);
  pointer-events: auto;
  color: var(--mint);
  background: rgba(28, 34, 39, 0.92);
  border: 1px solid currentColor;
  border-radius: 50%;
}
.module.reactor {
  width: 15px;
  height: 15px;
}
.module.reactor svg {
  width: 10px;
  height: 10px;
}
.module svg {
  width: 12px;
  height: 12px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.module svg .fill {
  fill: currentColor;
  stroke: none;
}
.module.starboard svg {
  transform: scaleX(-1);
}
.module:hover {
  background: rgba(48, 58, 64, 0.95);
  border-color: #fff;
}
.module.damaged {
  color: var(--amber);
}
.module.heavy {
  color: var(--orange);
}
.module.failed {
  color: var(--red);
  border-style: dashed;
}
.module.open {
  color: var(--mint-ink);
  background: var(--mint);
  border-color: var(--mint);
}
.module.open.damaged {
  background: var(--amber);
  border-color: var(--amber);
  color: #2a2110;
}
.module.open.heavy,
.module.open.failed {
  background: var(--orange);
  border-color: var(--orange);
  color: #2a160c;
}
/* Reserved weapon mounts: small empty dashed markers, a name on hover. */
.slot {
  position: absolute;
  transform: translate(-50%, -50%);
  pointer-events: auto;
  border: 1px dashed rgba(178, 188, 196, 0.65);
  background: rgba(28, 34, 39, 0.6);
}
.slot.tube {
  width: 11px;
  height: 5px;
}
.slot.pdTurret {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.slot.pdLaser {
  width: 7px;
  height: 7px;
  transform: translate(-50%, -50%) rotate(45deg);
}
.slot:hover {
  border-style: solid;
  border-color: #e6ebee;
}
.module-tip {
  position: absolute;
  z-index: 2;
  padding: 3px 7px;
  transform: translate(-50%, -100%);
  font-size: 9px;
  letter-spacing: 0.1em;
  white-space: nowrap;
  color: #eef2f3;
  background: rgba(22, 27, 31, 0.95);
  border: 1px solid #56616a;
  pointer-events: none;
}
.module-tip[hidden] {
  display: none;
}
.module-detail {
  display: grid;
  gap: 5px;
  margin: 2px 0 8px;
  padding: 8px 10px;
  background: rgba(24, 29, 33, 0.7);
  border-left: 2px solid var(--mint);
  font-size: 10px;
}
.module-detail[hidden] {
  display: none;
}
.module-detail.damaged {
  border-left-color: var(--amber);
}
.module-detail.heavy,
.module-detail.failed {
  border-left-color: var(--orange);
}
.detail-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  letter-spacing: 0.12em;
  color: #eef2f3;
}
.detail-head button {
  padding: 0 6px;
  font-size: 13px;
  line-height: 18px;
  background: none;
  border: 0;
  color: var(--dim);
}
.meter {
  display: grid;
  grid-template-columns: 96px 1fr 38px;
  align-items: center;
  gap: 8px;
  font-size: 9px;
  letter-spacing: 0.1em;
  color: var(--dim);
}
.meter i {
  height: 4px;
  background: #3b444b;
}
.meter i b {
  display: block;
  height: 100%;
  background: var(--mint);
}
.meter output {
  text-align: right;
  color: #d7dee2;
}
.detail-state {
  margin: 2px 0 0;
  color: #e3e8eb;
}
.detail-effect {
  margin: 0;
  line-height: 1.4;
  color: #b9c3c9;
}

/* Rows: protection, signature, probes, power (or observations for a contact). */
.ship-rows {
  display: grid;
  gap: 5px;
  margin: 2px 0 8px;
}
.row {
  display: grid;
  grid-template-columns: 82px 1fr;
  align-items: center;
  gap: 8px;
  font-size: 10px;
  letter-spacing: 0.06em;
}
.row > span {
  font-size: 9px;
  letter-spacing: 0.12em;
  color: var(--dim);
}
.row > div {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  color: #dde4e7;
}
.row .bar {
  flex: 1;
  min-width: 30px;
  height: 4px;
  background: #3b444b;
}
.row .bar b {
  display: block;
  height: 100%;
  background: var(--mint);
}
.row .warn {
  color: var(--amber);
}
.row .bad {
  color: #f0a070;
}
.row.deficit > div {
  color: #ffb4a6;
}
.row.deficit .bar b {
  background: var(--red);
}
.row .note {
  color: var(--dim);
  font-size: 9px;
}
.dot::before {
  content: '';
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 6px;
  border-radius: 50%;
  background: var(--mint);
  vertical-align: 0;
}
.dot.elevated {
  color: var(--amber);
}
.dot.elevated::before {
  background: var(--amber);
}
.dot.high {
  color: #f0a070;
}
.dot.high::before {
  background: var(--orange);
  box-shadow: 0 0 7px var(--orange);
}
.pips {
  letter-spacing: 0.2em;
  color: var(--probe);
}
/* --- Sensor notices (top centre, under the hint) ----------------------------------- */
#notices {
  position: absolute;
  top: 122px;
  left: 50%;
  transform: translateX(-50%);
  display: grid;
  justify-items: center;
  gap: 4px;
  pointer-events: none;
}
.notice {
  padding: 4px 10px;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  white-space: nowrap;
  color: #dfe7eb;
  background: rgba(30, 35, 40, 0.84);
  border-left: 2px solid var(--sky);
  animation: notice 4.5s ease forwards;
}
.notice.lost {
  color: #b9c2c8;
  border-left: 2px dashed #8d989f;
}
.notice.probe {
  border-left-color: var(--probe);
}
@keyframes notice {
  0% {
    opacity: 0;
    transform: translateY(-4px);
  }
  6%,
  80% {
    opacity: 1;
    transform: none;
  }
  100% {
    opacity: 0;
  }
}

/* --- Journal (bottom left) --------------------------------------------------------- */
.journal {
  position: absolute;
  left: 16px;
  bottom: 14px;
  width: 360px;
  padding: 10px 12px;
  background: linear-gradient(90deg, rgba(30, 35, 40, 0.88), rgba(30, 35, 40, 0));
  pointer-events: none;
}
.journal-title {
  font-size: 10px;
  letter-spacing: 0.18em;
  color: var(--mint);
  margin-bottom: 6px;
}
#journal-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 3px;
  font-size: 10px;
  letter-spacing: 0.04em;
}
#journal-list li {
  display: flex;
  gap: 10px;
  color: #d7dee2;
}
#journal-list time {
  color: var(--dim);
  min-width: 50px;
}
#journal-list .order {
  color: var(--mint);
}
#journal-list .warn {
  color: #ef8b74;
}
#journal-list .contact {
  color: var(--sky);
}
#journal-list .lost {
  color: #a9b3ba;
}

/* --- Toolbar, legend and scale (bottom) -------------------------------------------- */
.toolbar {
  position: absolute;
  left: 50%;
  bottom: 12px;
  transform: translateX(-50%);
  display: grid;
  justify-items: center;
  gap: 6px;
}
.map-controls {
  display: flex;
  gap: 4px;
}
.map-controls button {
  min-width: 34px;
  padding: 6px 9px;
  font-size: 11px;
  background: rgba(44, 51, 56, 0.92);
}
.keys {
  font-size: 9px;
  letter-spacing: 0.08em;
  color: #78848c;
  white-space: nowrap;
}
.keys b {
  font-weight: 700;
  color: #aeb8be;
}
.legend {
  position: absolute;
  left: 392px;
  bottom: 50px;
  font-size: 9px;
  letter-spacing: 0.12em;
}
/* Collapsed to a small tab by default so it does not cover the map; the list opens above. */
.legend summary {
  cursor: pointer;
  list-style: none;
  padding: 4px 8px;
  color: #aeb8be;
  letter-spacing: 0.16em;
  user-select: none;
}
.legend summary::-webkit-details-marker {
  display: none;
}
.legend summary::before {
  content: '▸ ';
  color: var(--mint);
}
.legend[open] summary::before {
  content: '▾ ';
}
.legend summary:hover {
  color: var(--text);
}
.legend-items {
  position: absolute;
  left: 0;
  bottom: calc(100% + 4px);
  display: grid;
  justify-items: start;
  gap: 3px;
  padding: 8px 10px;
  white-space: nowrap;
  pointer-events: none;
}
.trajectory,
.ship-orbit {
  color: var(--mint);
}
.preview {
  color: var(--amber);
}
.velocity {
  color: var(--sky);
}
.gravity {
  color: var(--lilac);
}
.body-orbit {
  color: #9aa5ad;
}
.coverage {
  color: var(--mint);
  opacity: 0.75;
}
.estimate,
.lost-contact {
  color: #a9b3ba;
}
.hazard {
  color: #e2b06a;
}
.cover {
  color: #b9c7a0;
}
.glare {
  color: #e2c48c;
}
#scale {
  position: absolute;
  right: 16px;
  bottom: 16px;
  padding-top: 5px;
  border-top: 2px solid #9aa5ad;
  border-left: 1px solid #9aa5ad;
  border-right: 1px solid #9aa5ad;
  text-align: center;
  font-size: 10px;
  letter-spacing: 0.1em;
  color: #b3bdc3;
  pointer-events: none;
}

/* --- Glass panels ---------------------------------------------------------------- */
/* One look for everything floating over the map: dense translucent graphite, a hairline mint
   frame and a faint highlight on the top edge. No backdrop-filter: the map canvas is redrawn
   every frame, so blurring it under each panel made the compositor drop frames. */
.clock-row,
.fleet-item,
.ship-body,
.notice,
.map-controls button,
.legend summary,
.legend-items {
  background-color: var(--glass);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    0 6px 18px rgba(0, 0, 0, 0.22);
}
.clock-row,
.ship-body,
.legend summary,
.legend-items {
  border: 1px solid var(--glass-line);
}
.ship-body {
  border-top: 0;
}
.journal {
  -webkit-mask-image: linear-gradient(90deg, #000 60%, transparent);
  mask-image: linear-gradient(90deg, #000 60%, transparent);
}

@media (max-width: 1280px) {
  .legend {
    left: auto;
    right: 16px;
    bottom: 44px;
  }
  .legend-items {
    left: auto;
    right: 0;
    justify-items: end;
  }
  .journal {
    width: 300px;
  }
  .keys {
    display: none;
  }
}
@media (max-width: 1100px) {
  .fleet {
    width: 210px;
  }
  #ship-panel {
    width: 286px;
  }
  .system-bar small {
    display: none;
  }
  .journal {
    display: none;
  }
}
@media (max-width: 850px) {
  .clock-block {
    top: 8px;
    left: 8px;
  }
  .clock-row {
    gap: 8px;
    padding: 4px 6px;
  }
  .clock-year {
    font-size: 18px;
  }
  .clock-time,
  .app-title {
    display: none;
  }
  .system-bar,
  .fleet {
    display: none;
  }
  #hint {
    top: 60px;
    gap: 14px;
    font-size: 10px;
  }
  #notices {
    top: 92px;
  }
  #ship-panel {
    top: auto;
    left: 8px;
    right: 8px;
    bottom: 8px;
    width: auto;
  }
  .ship-body {
    max-height: calc(58dvh - 70px);
  }
  #ship-portrait {
    width: 140px;
    height: 56px;
  }
  .ship-header {
    height: 42px;
  }
  .ship-header h1 {
    font-size: 17px;
    bottom: 7px;
  }
  #ship-portrait {
    bottom: 10px;
  }
  .gauges {
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
  }
  .gauge {
    grid-template-columns: 1fr;
    gap: 3px;
  }
  .gauge output {
    text-align: left;
  }
  #order-status {
    min-height: 0;
  }
  .toolbar {
    left: auto;
    right: 8px;
    bottom: auto;
    top: 8px;
    transform: none;
  }
  .map-controls button {
    min-width: 30px;
    padding: 5px 7px;
  }
  #scale {
    bottom: auto;
    top: 48px;
    right: 8px;
  }
}
@media (max-width: 850px) {
  .hull {
    height: 180px;
  }
  .module {
    width: 15px;
    height: 15px;
  }
  .module svg {
    width: 10px;
    height: 10px;
  }
  .module.reactor {
    width: 12px;
    height: 12px;
  }
  .module.reactor svg {
    width: 8px;
    height: 8px;
  }
}
@media (max-width: 850px) and (max-height: 640px) {
  .gauges,
  #ship-data {
    display: none;
  }
  .ship-body {
    max-height: calc(52dvh - 60px);
    padding: 8px 10px;
  }
}
@media (max-width: 520px) {
  #system,
  #overview {
    display: none;
  }
  .clock-date {
    display: none;
  }
  .orders span {
    font-size: 7px;
  }
}
.wing-orders {
  grid-template-columns: repeat(4, 1fr);
}
.wing-orders button {
  display: grid;
  gap: 4px;
  justify-items: center;
  padding: 6px 4px 7px;
  border-top: 2px solid #56616a;
}
.wing-orders span {
  display: grid;
  gap: 2px;
  text-align: center;
  line-height: 1.25;
}
.wing-orders span small {
  font-size: 8px;
  letter-spacing: 0.08em;
}
.wing-orders button.ready {
  border-top-color: var(--mint);
}
.wing-orders button.away {
  border-top-color: var(--probe);
}
.wing-orders button.away small {
  color: var(--probe);
}
.wing-orders button.warn {
  border-top-color: var(--amber);
}
.wing-orders button.warn small,
.wing-orders button.blocked small {
  color: var(--amber);
}
.wing-orders em {
  display: flex;
  gap: 3px;
}
.wing-orders em i {
  width: 6px;
  height: 6px;
  background: var(--mint);
}
.wing-orders em i.away {
  background: var(--probe);
}
.wing-orders em i.lost {
  background: var(--red);
}
.wing-orders u {
  display: block;
  width: 80%;
  height: 3px;
  background: #3b444b;
}
.wing-orders u s {
  display: block;
  height: 100%;
  background: var(--probe);
}
.wing-orders button.warn u s {
  background: var(--amber);
}
.wing-block #wing-status {
  color: var(--probe);
}

/* Triad card: resource and pilots on their own lines. */
#ship-data .flight-line,
#ship-data .flight-pilot {
  display: block;
}
#ship-data .flight-line {
  margin-bottom: 2px;
}
#ship-data .flight-pilot {
  color: #c7d0d5;
  text-transform: none;
  letter-spacing: 0.04em;
}
#ship-data .flight-pilot:first-of-type {
  margin-top: 6px;
}
