:root {
  --space: #061426;
  --space-soft: #0b2846;
  --sky: #3ba7e8;
  --sun: #ffc857;
  --moon: #d8dee8;
  --violet: #7457d9;
}

.astronomy-shell {
  width: min(1280px, 100%);
}

.astronomy-grid {
  grid-template-columns: minmax(0, 1.65fr) minmax(330px, 0.85fr);
}

.mode-tabs {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 7px;
  margin: 0 0 14px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 8px 28px rgba(23, 59, 103, 0.08);
}

.mode-tab {
  min-height: 46px;
  padding: 8px 9px;
  border: 1px solid transparent;
  border-radius: 9px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 750;
  transition: color 150ms ease, background 150ms ease, border-color 150ms ease;
}

.mode-tab:hover {
  color: var(--navy);
  background: #f0f6fc;
}

.mode-tab[aria-pressed="true"] {
  border-color: #aac9e7;
  color: #0c4f89;
  background: #e7f3ff;
}

.astronomy-scene {
  height: 610px;
  background:
    radial-gradient(circle at 38% 38%, rgba(28, 79, 125, 0.23), transparent 32rem),
    linear-gradient(rgba(255, 255, 255, 0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.018) 1px, transparent 1px),
    var(--space);
  background-size: auto, 42px 42px, 42px 42px, auto;
}

.astronomy-scene::after {
  content: "DRAG · PINCH · EXPLORE";
}

.phase-panel {
  position: absolute;
  z-index: 2;
  top: 16px;
  right: 16px;
  display: grid;
  width: 158px;
  justify-items: center;
  padding: 11px 10px 10px;
  border: 1px solid rgba(180, 211, 240, 0.28);
  border-radius: 14px;
  color: #edf7ff;
  background: rgba(4, 17, 34, 0.82);
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.24);
  pointer-events: none;
  backdrop-filter: blur(8px);
}

.phase-panel[hidden] {
  display: none;
}

.phase-panel span {
  color: #9cb8d2;
  font-size: 0.64rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.phase-panel canvas {
  width: 112px;
  height: 112px;
  margin: 2px 0;
}

.phase-panel strong {
  font-size: 0.68rem;
  text-align: center;
}

.astronomy-legend {
  min-height: 48px;
}

.sun-dot {
  background: var(--sun);
  box-shadow: 0 0 7px rgba(255, 200, 87, 0.75);
}

.earth-dot {
  background: var(--blue);
}

.moon-dot {
  background: var(--moon);
}

.axis-line {
  background: #8bd6ff;
}

.dynamic-controls {
  display: grid;
  gap: 13px;
  margin-top: 17px;
}

.range-control {
  display: grid;
  gap: 9px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f8fbfe;
}

.range-control > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.range-control label {
  color: var(--ink);
  font-size: 0.76rem;
  font-weight: 800;
}

.range-control output {
  color: var(--blue);
  font-size: 0.88rem;
  font-weight: 850;
  font-variant-numeric: tabular-nums;
}

.range-control input[type="range"] {
  width: 100%;
  min-height: 30px;
  margin: 0;
  accent-color: var(--blue);
  cursor: pointer;
}

.view-toggle,
.quick-actions {
  display: grid;
  gap: 7px;
}

.view-toggle {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.quick-actions {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.action-button {
  min-height: 42px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--navy);
  background: white;
  cursor: pointer;
  font-size: 0.72rem;
  font-weight: 750;
  transition: border-color 150ms ease, background 150ms ease, transform 150ms ease;
}

.action-button:hover {
  border-color: #91b7d9;
  background: #f2f8fe;
  transform: translateY(-1px);
}

.action-button[aria-pressed="true"] {
  border-color: var(--blue);
  color: #0c4f89;
  background: var(--blue-pale);
}

.action-button.primary {
  border-color: var(--navy);
  color: white;
  background: var(--navy);
}

.mission-section {
  background: #f7faff;
}

.mini-label {
  margin: 0 0 4px;
  color: var(--blue);
  font-size: 0.64rem;
  font-weight: 850;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.mission-section > p:last-child {
  margin: 0;
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 750;
  line-height: 1.55;
}

.observation {
  padding: 16px;
  border: 1px solid #afc9df;
  border-radius: 13px;
  background: #eef6fd;
}

.observation > span,
.observation > strong {
  display: block;
}

.observation > span {
  margin-bottom: 5px;
  color: var(--blue);
  font-size: 0.62rem;
  font-weight: 900;
  letter-spacing: 0.09em;
}

.observation > strong {
  margin-bottom: 7px;
  color: var(--navy-deep);
  font-size: 1.06rem;
}

.observation p {
  margin: 0;
  color: var(--muted);
  font-size: 0.74rem;
  line-height: 1.65;
}

.observation.complete {
  border-color: #7fcbb5;
  background: var(--green-pale);
}

.observation.complete > span {
  color: var(--green);
}

.why-section details {
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.65;
}

.why-section summary {
  color: var(--navy);
  cursor: pointer;
  font-weight: 800;
}

.why-section p {
  margin: 9px 0 0;
}

@media (max-width: 900px) {
  .astronomy-grid {
    grid-template-columns: 1fr;
  }

  .mode-tabs {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .astronomy-scene {
    height: min(62vh, 560px);
    min-height: 430px;
  }
}

@media (max-width: 560px) {
  .astronomy-shell {
    padding: 14px;
  }

  .lab-header {
    gap: 10px;
  }

  .astronomy-shell h1 {
    font-size: 1.28rem;
    letter-spacing: -0.045em;
  }

  .mode-tabs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 5px;
    padding: 5px;
  }

  .mode-tab {
    min-height: 44px;
    font-size: 0.7rem;
  }

  .astronomy-scene {
    height: 420px;
    min-height: 420px;
  }

  .phase-panel {
    top: 10px;
    right: 10px;
    width: 126px;
    padding: 8px 6px;
  }

  .phase-panel canvas {
    width: 86px;
    height: 86px;
  }

  .phase-panel strong {
    font-size: 0.6rem;
  }

  .quick-actions {
    grid-template-columns: 1fr 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  .mode-tab,
  .action-button {
    transition: none;
  }
}
