:root {
  --void: #05060c;
  --panel: #0c1020;
  --panel-raised: #121830;
  --line: #232c4a;
  --line-soft: #171e38;
  --text: #e9ecf6;
  --text-dim: #7b84a3;
  --text-faint: #4a5273;
  --sun: #f5b942;
  --sun-glow: #ffcf6e;

  --c-mercury: #9c9c9c;
  --c-venus: #e8d2a0;
  --c-earth: #4a90d9;
  --c-mars: #c1440e;
  --c-jupiter: #d9a066;
  --c-saturn: #e8d19b;
  --c-uranus: #7fdbda;
  --c-neptune: #4166b0;

  --font-display: 'Manrope', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--void);
  color: var(--text);
  font-family: var(--font-display);
  overflow: hidden;
}

.starfield {
  position: fixed;
  inset: 0;
  z-index: 0;
  background-image:
    radial-gradient(1px 1px at 10% 20%, #ffffff55 0%, transparent 60%),
    radial-gradient(1px 1px at 80% 10%, #ffffff40 0%, transparent 60%),
    radial-gradient(1.5px 1.5px at 30% 65%, #ffffff50 0%, transparent 60%),
    radial-gradient(1px 1px at 60% 80%, #ffffff35 0%, transparent 60%),
    radial-gradient(1px 1px at 90% 55%, #ffffff45 0%, transparent 60%),
    radial-gradient(1.5px 1.5px at 45% 30%, #ffffff40 0%, transparent 60%),
    radial-gradient(1px 1px at 20% 90%, #ffffff35 0%, transparent 60%),
    radial-gradient(1px 1px at 70% 40%, #ffffff30 0%, transparent 60%);
  background-repeat: repeat;
  background-size: 600px 600px;
  opacity: 0.8;
}

.topbar {
  position: relative;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  padding: 18px 28px;
  border-bottom: 1px solid var(--line-soft);
  background: linear-gradient(180deg, #08091350, transparent);
}

.brand { display: flex; align-items: center; gap: 12px; }

.brand-mark {
  font-size: 30px;
  color: var(--sun);
  text-shadow: 0 0 18px var(--sun-glow), 0 0 34px #f5b94255;
}

.brand-text h1 {
  margin: 0;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0.01em;
}

.brand-sub {
  margin: 2px 0 0;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 0.02em;
}

.controls { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }

.control-group { display: flex; align-items: center; gap: 8px; position: relative; }

/* These controls only make sense inside a fullscreen view (Timelapse, Compare Distance,
   Transits) - hidden on the main page, and shown automatically once the existing
   fullscreen relocation logic physically moves them into #fullscreen-controls. */
.fullscreen-only { display: none; }
#fullscreen-controls .fullscreen-only { display: flex; }

.control-label {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-faint);
  margin-right: 2px;
}

.toggle-btn {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text-dim);
  background: var(--panel);
  border: 1px solid var(--line);
  padding: 7px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.toggle-btn:hover { color: var(--text); border-color: var(--text-faint); }

.toggle-btn.active {
  color: var(--void);
  background: var(--sun);
  border-color: var(--sun);
  font-weight: 700;
}

.transit-row {
  text-align: left;
  width: 100%;
  font-size: 11.5px;
  padding: 6px 10px;
}

#dwarf-control-group { position: relative; }

.dwarf-popover {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 10;
  background: var(--panel-raised);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 14px;
  min-width: 210px;
  box-shadow: 0 8px 24px #00000066;
}

.dwarf-popover-heading {
  margin: 10px 0 4px;
  font-family: var(--font-mono);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-faint);
}

.dwarf-popover-heading:first-child { margin-top: 0; }

.dwarf-popover-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 0;
  font-size: 12.5px;
  color: var(--text);
  cursor: pointer;
}

.dwarf-popover-item input { accent-color: var(--sun); }

.dwarf-popover-note {
  font-family: var(--font-mono);
  font-size: 9.5px;
  color: var(--text-faint);
  margin-left: auto;
}

#size-boost {
  accent-color: var(--sun);
  width: 120px;
}

.control-value {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text);
  min-width: 28px;
}

.speed-select {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px 8px;
  cursor: pointer;
}

.speed-select:hover { border-color: var(--text-faint); }

.custom-date-group {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.custom-date-field {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px 6px;
  cursor: pointer;
}

.custom-date-field:hover { border-color: var(--text-faint); }

.custom-date-year { width: 62px; cursor: text; }
.custom-date-day { width: 46px; cursor: text; }
.custom-date-month { width: 62px; }
.custom-date-era { width: 78px; }

#time-controls.disabled,
#sizeboost-control.disabled {
  opacity: 0.4;
  pointer-events: none;
}

/* Moons catalog tab */
.moons-wrap {
  flex-direction: column;
  align-items: stretch;
  padding: 18px 24px;
  gap: 12px;
  overflow: hidden;
}

.moons-filterbar {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line-soft);
  flex-shrink: 0;
}

.eclipse-picker-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line-soft);
  width: 100%;
  position: relative;
  z-index: 2;
}

.eclipse-transport {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 220px;
}

.eclipse-transport input[type="range"] {
  flex: 1;
  accent-color: var(--sun);
}

.eclipse-time-readout {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-faint);
  white-space: nowrap;
}

.eclipse-map-wrap {
  width: 100%;
  min-height: 0;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 0;
  position: relative;
  z-index: 1;
  overflow: hidden;
}

#eclipse-globe-canvas {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  cursor: grab;
  touch-action: none;
}

#eclipse-globe-canvas:active {
  cursor: grabbing;
}

.eclipse-follow-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  font-size: 11px;
  padding: 5px 10px;
}

.eclipse-legend {
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  padding: 6px 0;
  font-size: 10.5px;
  color: var(--text-faint);
}

.eclipse-legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.eclipse-legend-swatch {
  display: inline-block;
  width: 10px;
  height: 10px;
  border: 1px solid rgba(255,255,255,0.15);
  flex-shrink: 0;
}

.eclipse-info-bar {
  width: 100%;
  padding-top: 10px;
  border-top: 1px solid var(--line-soft);
  min-height: 138px;
}

.eclipse-catalog-wrap {
  width: 100%;
  margin-top: 10px;
  border-top: 1px solid var(--line-soft);
  padding-top: 8px;
}

.eclipse-catalog-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 11px;
  color: var(--text-faint);
  margin-bottom: 6px;
}

.eclipse-catalog-hint {
  font-style: italic;
}

.eclipse-catalog-list {
  max-height: 130px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1px;
  border: 1px solid var(--line-soft);
  border-radius: 4px;
}

.eclipse-catalog-col-labels {
  display: grid;
  grid-template-columns: 90px 60px 55px 60px 1fr;
  gap: 8px;
  padding: 3px 8px;
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  border-bottom: 1px solid var(--line-soft);
}

.eclipse-catalog-row {
  display: grid;
  grid-template-columns: 90px 60px 55px 60px 1fr;
  gap: 8px;
  padding: 4px 8px;
  font-size: 11px;
  font-family: var(--font-mono);
  cursor: pointer;
  color: var(--text-dim);
}

.eclipse-catalog-row:hover {
  background: rgba(245,185,66,0.1);
  color: var(--text);
}

.eclipse-catalog-row.selected {
  background: rgba(245,185,66,0.22);
  color: var(--text);
}

.eclipse-catalog-row.selected:hover {
  background: rgba(245,185,66,0.28);
}

.eclipse-catalog-row.featured {
  color: var(--sun);
}

.eclipse-catalog-row.featured::after {
  content: "\u25b6 animated";
  grid-column: 5;
  justify-self: end;
  font-size: 10px;
  opacity: 0.8;
}

.eclipse-info-row {
  font-size: 12.5px;
  line-height: 1.6;
}

.eclipse-info-dim { color: var(--text-dim); }
.eclipse-info-faint { color: var(--text-faint); font-size: 11px; margin-top: 4px; }

.filter-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.moon-count-readout {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-faint);
  margin-left: auto;
}

.moons-list {
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.moon-row {
  display: grid;
  grid-template-columns: 14px 1.6fr 1fr 1.3fr 70px 90px;
  align-items: center;
  gap: 14px;
  padding: 10px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.12s ease;
}

.moon-row:hover { background: var(--panel-raised); }
.moon-row.selected { background: #f5b94222; }

.moon-row .planet-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}

.moon-row .m-name {
  font-weight: 700;
  font-size: 13px;
}

.moon-row .m-planet {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
  text-transform: capitalize;
}

.moon-row .m-group {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-faint);
}

.moon-row .m-year {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
  text-align: right;
}

.moon-row .m-diameter {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
  text-align: right;
}

.moons-list-header {
  display: grid;
  grid-template-columns: 14px 1.6fr 1fr 1.3fr 70px 90px;
  gap: 14px;
  padding: 0 12px 8px;
  font-family: var(--font-mono);
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-faint);
  flex-shrink: 0;
}

.group-summary-note {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-faint);
  font-style: italic;
  padding: 8px 12px;
  border-top: 1px dashed var(--line-soft);
  margin-top: 6px;
}

@media (max-width: 860px) {
  .moon-row, .moons-list-header { grid-template-columns: 10px 1.4fr 1fr; }
  .m-group, .m-year, .m-diameter { display: none; }
}

.stage {
  position: relative;
  z-index: 1;
  display: flex;
  height: calc(100vh - 128px);
}

.map-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow-y: auto;
  overflow-x: hidden;
}

#orbital-wrap {
  min-height: 420px;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 20px 0;
  flex-shrink: 0;
}

.section-label {
  margin: 0;
  padding: 0;
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-faint);
  flex-shrink: 0;
}

.fullscreen-btn {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-faint);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 4px 9px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.fullscreen-btn:hover {
  color: var(--text);
  border-color: var(--text-faint);
}

.canvas-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4px 12px 12px;
  position: relative;
  overflow: hidden;
  min-height: 0;
}

.canvas-wrap svg { width: 100%; height: 100%; }

.eclipses-wrap {
  display: grid;
  grid-template-rows: auto 1fr auto auto auto;
  height: 100%;
  min-height: 0;
  align-items: stretch;
  justify-items: stretch;
  padding: 4px 12px 12px;
}

.lunar-wrap {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  padding: 4px 12px 12px;
}

.lunar-panels {
  flex: 1;
  display: flex;
  gap: 14px;
  min-height: 0;
}

.lunar-orbit-wrap { flex: 1.5; min-width: 300px; min-height: 0; }
.lunar-phase-wrap { flex: 1; min-width: 220px; min-height: 0; }
#lunar-orbit-svg { display: block; }

.lunar-phase-stage {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  background: radial-gradient(circle at 50% 45%, var(--panel-raised) 0%, var(--void) 70%);
  border: 1px solid var(--line-soft);
  border-radius: 6px;
}
#lunar-phase-canvas { max-width: 100%; max-height: 100%; display: block; }

.lunar-phase-readout {
  padding: 10px 4px 2px;
  font-size: 12.5px;
  color: var(--text-dim);
  text-align: center;
}
.lunar-phase-readout .lunar-phase-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 16px;
  color: var(--text);
  display: block;
  margin-bottom: 3px;
}
.lunar-phase-readout .lunar-phase-illum {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--c-uranus);
}

.lunar-controls {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  padding-top: 10px;
}

.lunar-orbit-path { fill: none; stroke: var(--line); stroke-width: 1.2; opacity: 0.85; }
.lunar-sun-ray { stroke: var(--sun); stroke-width: 1; stroke-dasharray: 1 4; opacity: 0.55; }
.lunar-label { font-family: var(--font-mono); font-size: 11px; fill: var(--text-dim); text-anchor: middle; }

.distance-wrap {
  flex: 0 0 auto;
  align-items: stretch;
  justify-content: center;
  gap: 6px;
  border-top: 1px solid var(--line-soft);
}

.distance-scroll {
  overflow-x: auto;
  overflow-y: hidden;
  height: 230px;
  scrollbar-color: var(--line) var(--void);
}

.distance-scroll svg { height: 230px; width: 3000px; }

.distance-hint {
  text-align: center;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-faint);
  margin: 0;
  padding: 0 20px;
}

.sizecompare-wrap {
  flex: 0 0 auto;
  align-items: stretch;
  justify-content: center;
  gap: 10px;
  border-top: 1px solid var(--line-soft);
}

.sizecompare-scroll {
  overflow-x: auto;
  overflow-y: hidden;
  height: 300px;
  scrollbar-color: var(--line) var(--void);
}

.sizecompare-scroll svg { height: 300px; width: 2600px; }

.sizecompare-sun-label {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 13px;
  fill: var(--sun);
  text-anchor: middle;
  pointer-events: none;
}

.sizecompare-sun-sublabel {
  font-family: var(--font-mono);
  font-size: 10px;
  fill: var(--text-dim);
  text-anchor: middle;
  pointer-events: none;
}

.sizecompare-ratio {
  font-family: var(--font-mono);
  font-size: 9.5px;
  fill: var(--text-faint);
  text-anchor: middle;
  pointer-events: none;
}

.orbit-ring { fill: none; stroke: var(--line); stroke-width: 1; }
.orbit-ring-dwarf { stroke-dasharray: 3 4; opacity: 0.7; }

.compare-distance-label {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 11px;
  fill: var(--sun);
  text-anchor: middle;
  pointer-events: none;
}

.belt-label {
  font-family: var(--font-mono);
  font-size: 10px;
  fill: var(--text-faint);
  text-anchor: middle;
  letter-spacing: 0.06em;
  pointer-events: auto;
  cursor: default;
  transition: font-size 0.12s ease;
}

.belt-label:hover { font-size: 14px; }

.belt-label-lg {
  font-size: 13px;
}

.belt-label-lg:hover { font-size: 16px; }

.body-dot { cursor: pointer; transition: filter 0.15s ease, r 0.15s ease; }
.body-dot:hover { filter: brightness(1.35); }
.body-dot.selected { filter: brightness(1.5); }
.body-dot-dwarf { stroke: var(--void); stroke-width: 1.5; }

.body-label {
  font-family: var(--font-mono);
  font-size: 12.5px;
  fill: var(--text-dim);
  pointer-events: auto;
  cursor: default;
  user-select: none;
  transition: font-size 0.12s ease;
}

.body-label:hover { font-size: 17px; }

.body-label.selected { fill: var(--text); font-weight: 700; }
.body-label-dwarf { font-style: italic; font-size: 11.5px; }
.body-label-dwarf:hover { font-size: 16px; }

.sun-core {
  filter: drop-shadow(0 0 10px var(--sun-glow)) drop-shadow(0 0 28px #f5b94288);
}

@keyframes sun-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.85; }
}

.sun-halo { animation: sun-pulse 5s ease-in-out infinite; }

@media (prefers-reduced-motion: reduce) {
  .sun-halo { animation: none; }
}

/* Info panel */
.info-panel {
  width: 400px;
  flex-shrink: 0;
  border-left: 1px solid var(--line-soft);
  background: #080a15c0;
  backdrop-filter: blur(6px);
  overflow-y: auto;
  padding: 22px 20px 40px;
  position: relative;
}

.info-close-btn {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 5;
  width: 26px;
  height: 26px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text-dim);
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  transition: all 0.15s ease;
}

.info-close-btn:hover {
  color: var(--text);
  border-color: var(--text-faint);
  background: var(--panel-raised);
}

.info-close-btn[hidden] { display: none; }

.info-empty {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-size: 12px;
  text-align: center;
}

.info-empty[hidden] { display: none; }

/* Every element below is toggled via el.hidden in JS, but also has a class that sets
   display unconditionally (e.g. .canvas-wrap { display: flex }). Author CSS always wins
   over the browser's built-in [hidden] rule regardless of selector specificity, so without
   these overrides the element stays visible even while "hidden" - the exact bug that broke
   .info-empty earlier, reoccurring for every other hidden-toggled element in the app.
   These make [hidden] actually work no matter what other display rule targets the element. */
.map-wrap[hidden],
.canvas-wrap[hidden],
.fullscreen-overlay[hidden] { display: none; }

.info-name {
  font-size: 22px;
  font-weight: 800;
  margin: 0 0 2px;
}

.info-type {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
  margin: 0 0 18px;
}

.info-section { margin-bottom: 20px; }

.info-section h3 {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--text-faint);
  margin: 0 0 10px;
  border-bottom: 1px solid var(--line-soft);
  padding-bottom: 6px;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 12.5px;
  padding: 4px 0;
  border-bottom: 1px dashed var(--line-soft);
}

.stat-row .k { color: var(--text-dim); white-space: nowrap; }
.stat-row .v { font-family: var(--font-mono); color: var(--text); text-align: right; }

.fact-list { margin: 0; padding-left: 16px; font-size: 12.5px; line-height: 1.6; color: var(--text); }
.fact-list li { margin-bottom: 6px; }

.moon-list { list-style: none; margin: 0; padding: 0; }

.moon-item {
  padding: 9px 0;
  border-bottom: 1px solid var(--line-soft);
}

.moon-item .moon-name { font-weight: 700; font-size: 13px; }

.moon-item .moon-meta {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-dim);
  margin: 2px 0 4px;
}

.moon-item .moon-notes {
  font-size: 11.5px;
  color: var(--text-dim);
  line-height: 1.5;
}

.moon-remainder {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-faint);
  padding-top: 8px;
  font-style: italic;
}

.ring-badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--sun);
  border: 1px solid #f5b94255;
  border-radius: 4px;
  padding: 2px 6px;
  margin-bottom: 8px;
}

.footbar {
  position: relative;
  z-index: 2;
  padding: 10px 28px;
  border-top: 1px solid var(--line-soft);
  text-align: center;
}

#scale-caption {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-faint);
}

/* Fullscreen overlay - a section (orbital view or distance walk) is moved in here
   and expanded to fill the window, along with whichever controls are relevant to it. */
.fullscreen-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: var(--void);
  display: flex;
  flex-direction: column;
}

.fullscreen-header {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 14px 22px;
  border-bottom: 1px solid var(--line-soft);
  flex-shrink: 0;
  flex-wrap: wrap;
}

.fullscreen-title {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

.fullscreen-controls {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
  flex: 1;
}

#btn-exit-fullscreen {
  margin-left: auto;
  flex-shrink: 0;
}

.fullscreen-content {
  flex: 1;
  display: flex;
  min-height: 0;
  overflow: auto;
}

/* When a canvas-wrap has been relocated into the overlay, let it fill the available space. */
.fullscreen-content .canvas-wrap {
  flex: 1;
  min-height: 0;
}

.fullscreen-content #orbital-svg {
  width: 100%;
  height: 100%;
}

/* Interactive 3D orbital view - only ever shown inside the fullscreen orbital overlay */
.orbit3d-wrap {
  position: relative;
  width: 100%;
  height: 100%;
  flex: 1;
}

#orbit3d-canvas {
  width: 100%;
  height: 100%;
  display: block;
  cursor: grab;
  touch-action: none;
}

#orbit3d-canvas:active {
  cursor: grabbing;
}

#orbital-svg {
  cursor: grab;
  touch-action: none;
}

#orbital-svg:active {
  cursor: grabbing;
}

.orbit3d-hint {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  margin: 0;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-faint);
  background: #08091380;
  padding: 6px 14px;
  border-radius: 6px;
  pointer-events: none;
  white-space: nowrap;
}

.orbit3d-topright-controls {
  position: absolute;
  top: 14px;
  right: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.orbit3d-flyto-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-dim);
  background: #08091380;
  padding: 6px 10px;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
}

.orbit3d-flyto-toggle input { accent-color: var(--sun); }

/* In fullscreen, let the distance-walk container grow to fill the available height instead
   of staying at the small fixed panel size. JS measures this and re-renders to match -
   width and height stay on the exact same px-per-AU scale, so nothing gets distorted. */
.fullscreen-content .distance-scroll {
  flex: 1;
  height: auto;
}

/* The per-section Fullscreen button is redundant once you're already in fullscreen -
   only the header's Exit button is needed there. */
.fullscreen-content .fullscreen-btn {
  display: none;
}

@media (max-width: 860px) {
  .stage { flex-direction: column; height: auto; overflow-y: auto; }
  .map-wrap { flex: none; }
  #orbital-wrap { height: 60vh; flex: none; }
  .moons-wrap { height: 70vh; }
  .info-panel { width: 100%; border-left: none; border-top: 1px solid var(--line-soft); }
}
