/* Star map and system view. */

/* Space scene: turnable view of points in space with grid and axes (common/view/space-scene) */
.space-scene { position: absolute; inset: 0; overflow: hidden; touch-action: none; cursor: grab; user-select: none; }
.space-scene.dragging { cursor: grabbing; }
.scene-graphics { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.scene-grid { stroke: var(--grid); stroke-width: 1; }
.scene-axis { stroke: var(--grid-axis); stroke-width: 1.2; }
.scene-arrow { fill: var(--grid-axis); }
/* Axes in the usual colours: x red, y green, z blue (arrow tips and names). */
.scene-arrow.x, .diagram-arrow.x { fill: var(--axis-x); }
.scene-arrow.y, .diagram-arrow.y { fill: var(--axis-y); }
.scene-arrow.z, .diagram-arrow.z { fill: var(--axis-z); }
.scene-axis-name.x, .diagram-axis-name.x { fill: var(--axis-x); }
.scene-axis-name.y, .diagram-axis-name.y { fill: var(--axis-y); }
.scene-axis-name.z, .diagram-axis-name.z { fill: var(--axis-z); }
.scene-axis-name { font: 700 var(--text-sm) var(--font-mono); fill: var(--grid-axis); text-anchor: middle; dominant-baseline: middle; }
.scene-axis-value { font: 500 var(--text-xs) var(--font-mono); fill: var(--grid-label); dominant-baseline: middle; }
.scene-path { fill: none; stroke: var(--orbit); stroke-width: 1.5; }
.scene-points { position: absolute; inset: 0; z-index: 1; pointer-events: none; }
.scene-points > * { pointer-events: auto; }
.scene-view-actions { position: absolute; z-index: 2; left: 20px; bottom: 20px; display: flex; align-items: center; gap: 12px; }
.scene-controls-anchor { position: relative; display: flex; }
/* Buttons and zoom factor below the scene share one shape and height */
.scene-view-actions > .button, .scene-controls-anchor > .button { height: 38px; }
.scene-controls-anchor > .button.icon { width: 38px; padding: 8px; }
.button.scene-zoom { min-width: 72px; justify-content: flex-end; font: 600 var(--text-sm) var(--font-mono); cursor: default; }
@media (hover: hover) { .button.scene-zoom:hover { background: var(--button); border: var(--button-border); } }
.scene-controls { position: absolute; left: 0; bottom: calc(100% + 12px); display: grid; gap: 4px; padding: 6px; grid-template-areas: ". up . in" "left . right ." ". down . out"; }
.scene-navigation { position: absolute; z-index: 3; transform: translateY(calc(-100% - 12px)); }

/* Inspector: panels at the right of a space scene (star map, system view) */
.scene-panels {
  position: absolute; z-index: 2; right: 20px; top: 20px; width: 320px; max-height: calc(100% - 40px);
  display: flex; flex-direction: column; gap: 12px;
}
.inspector { min-height: 0; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.inspector-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.inspector-actions { display: flex; gap: 4px; }
.inspector h2 { font-size: 1.21rem; font-weight: 300; letter-spacing: var(--title-spacing); text-transform: var(--title-case); }
.inspector p { font-size: var(--text-sm); color: var(--surface-soft); }
.inspector .inspector-note { font-size: var(--text-sm); }
.inspector .body-list { border-top: 1px solid var(--divider-soft); padding-top: 8px; }
.inspector .body-list-entry > span { font-size: var(--text-sm); color: var(--surface-soft); }
.inspector > .colony-tag { align-self: flex-start; margin: 0; }
.inspector-commands { flex: none; padding: 6px; display: flex; flex-direction: column; gap: 6px; }
.inspector-command-row { display: flex; gap: 6px; }
.inspector-commands .button { padding: 6px 10px; }

/* Star map */
.map-point { position: absolute; }
.map-star {
  position: absolute; left: 0; top: 0; display: flex; flex-direction: column; align-items: center; transform: translate(-50%, calc(var(--disc) / -2));
  opacity: calc(0.55 + 0.45 * var(--nearness));
  padding: 0; border: 0; border-radius: var(--radius-button); background: none; line-height: 1.5;
}
.map-star-disc { display: flex; align-items: center; justify-content: center; width: var(--disc); height: var(--disc); border-radius: 50%; }
.map-star[aria-expanded="true"], .map-star[aria-pressed="true"] { opacity: 1; }
.map-star[aria-expanded="true"] .map-star-disc, .map-star[aria-pressed="true"] .map-star-disc { background: var(--button-hover); outline: 1px solid var(--accent); }
@media (hover: hover) {
  .map-star:hover { opacity: 1; }
  .map-star:hover .map-star-disc { background: var(--button-hover); outline: 1px solid var(--accent); }
}
.map-star.colony .map-star-disc { outline: 2px dashed var(--colony); outline-offset: -3px; }
.map-star:focus-visible { outline: none; }
.map-star:focus-visible .map-star-disc { outline: 2px solid var(--accent); outline-offset: 4px; }
.map-star-name { font: 600 var(--text-sm) var(--font-mono); padding: 0 8px 4px; white-space: nowrap; }
.button.icon.map-measure {
  position: absolute; left: 0; top: calc(var(--disc) / -2); transform: translate(-50%, -100%);
  width: 26px; height: 26px; padding: 4px; color: var(--accent); border-color: var(--accent); box-shadow: var(--glow);
}
.map-measure .symbol { width: 16px; height: 16px; }
.map-distance {
  display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 6px 8px; text-align: left;
  background: var(--surface-deep); border: 0; border-radius: calc(var(--radius) / 2); color: var(--surface-text);
}
@media (hover: hover) { .map-distance:hover { outline: 1px solid var(--accent); box-shadow: var(--glow); } }
.map-distance > span { font: 500 var(--text-sm) var(--font-mono); color: var(--surface-soft); }
.map-distance strong { font: 600 1.07rem var(--font-mono); }
.name-arrow { font-size: 1.5em; line-height: 0; vertical-align: -0.08em; color: var(--direction-arrow); }
.star-map.measuring .map-star { cursor: crosshair; }
.map-status {
  position: absolute; z-index: 2; right: 20px; bottom: 20px; padding: 8px 14px; font-size: var(--text-sm); font-weight: 600;
  color: var(--accent); border: 1px solid var(--accent); box-shadow: var(--glow);
}
/* Development aid: frame rate at the top left of the star map */
.fps-meter { position: absolute; z-index: 2; left: 20px; top: 16px; padding: 4px 10px; font: 600 var(--text-sm) var(--font-mono); color: var(--surface-soft); pointer-events: none; }
.scene-path.distance { stroke: var(--accent); stroke-width: 2; stroke-dasharray: 2 7; stroke-linecap: round; }
.distance-dialog { width: min(480px, calc(100% - 32px)); padding: 18px; color: var(--surface-text); background: var(--surface-solid); }
.distance-dialog[open] { display: flex; flex-direction: column; gap: 14px; }
.distance-dialog::backdrop { background: var(--dialog-backdrop); backdrop-filter: var(--blur); }
.distance-dialog h2 { font-size: 1.14rem; }
.distance-diagram { display: block; width: 100%; height: auto; overflow: visible; }
.diagram-axis { stroke: var(--diagram-axis); stroke-width: 1.2; }
.diagram-axis-name { font: 700 var(--text-sm) var(--font-mono); fill: var(--diagram-axis); text-anchor: middle; dominant-baseline: middle; }
.diagram-tick-label { font: 500 var(--text-xs) var(--font-mono); fill: var(--diagram-axis); dominant-baseline: middle; }
.diagram-guide { stroke: var(--vector-light); stroke-width: 1.2; stroke-dasharray: 3 3; }
.diagram-projection { stroke: var(--vector-light); stroke-width: 4; stroke-linecap: round; }
.diagram-vector { stroke: var(--vector); stroke-width: 2.5; }
.diagram-arrow.vector { fill: var(--vector); }
.diagram-label {
  font: 700 var(--text-sm) var(--font-mono); fill: var(--vector); dominant-baseline: middle;
  paint-order: stroke; stroke: var(--surface-solid); stroke-width: 4px; stroke-linejoin: round;
}

@media (max-width: 759px) {
  .scene-panels { top: auto; bottom: 16px; right: 16px; width: min(320px, calc(100% - 32px)); max-height: calc(48% - 24px); }
  .map-status { bottom: auto; top: 16px; right: 16px; }
}

/* System view (space scene with compressed distances) */
.scene-path.habitable-zone { fill: var(--habitable-zone); stroke: none; }
.scene-path.orbit.active { stroke: var(--orbit-active); stroke-width: 2; }
.system-star, .system-body { position: absolute; transform: translate(-50%, -50%); }
.system-star { display: flex; pointer-events: none; }
.system-body {
  display: flex; flex-direction: column; align-items: center; transform: translate(-50%, calc(var(--disc) / -2));
  opacity: calc(0.6 + 0.4 * var(--nearness));
  padding: 0; border: 0; background: none; color: inherit; font: inherit; line-height: 1.5;
}
.system-body-disc { display: flex; align-items: center; justify-content: center; width: var(--disc); height: var(--disc); border-radius: 50%; }
.system-body.colony .system-body-disc { outline: 2.5px dashed var(--colony); outline-offset: -3px; }
.system-body.active { opacity: 1; }
.system-body.active .system-body-disc { outline: 2px solid var(--marker); outline-offset: -1px; }
.system-body[aria-pressed="true"] { opacity: 1; }
.system-body[aria-pressed="true"] .system-body-disc { background: var(--button-hover); outline: 2px solid var(--accent); outline-offset: -1px; }
.system-body:focus-visible { outline: none; }
.system-body:focus-visible .system-body-disc { outline: 2px solid var(--accent); outline-offset: 2px; }
.system-body-name { font: 700 var(--text-xs) var(--font); color: var(--text-soft); padding: 0 6px 2px; white-space: nowrap; }
.system-body.active .system-body-name { color: var(--text); }
.system-aside { min-height: 0; overflow: auto; padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.system-aside h1 { font-size: 1.43rem; font-weight: 300; letter-spacing: var(--title-spacing); text-transform: var(--title-case); }
.system-description { font-size: var(--text-sm); color: var(--surface-soft); }
.system-aside .body-list { border-top: 1px solid var(--divider-soft); padding-top: 8px; }
