:root {
  color-scheme: dark;
  --bg: #11120f;
  --panel: #1b1b18;
  --panel-2: #222119;
  --line: #393528;
  --text: #f2ecd9;
  --muted: #b9b09d;
  --gold: #e0b84f;
  --teal: #64b6ac;
  --red: #d66a4d;
  --green: #8fbf75;
  --ink: #0b0c0a;
  --shadow: rgba(0, 0, 0, 0.34);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100%;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 20% 0%, rgba(224, 184, 79, 0.08), transparent 32rem),
    linear-gradient(180deg, #151611 0%, #10110f 42%, #151410 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    radial-gradient(circle, rgba(255, 255, 255, 0.22) 0 1px, transparent 1px),
    radial-gradient(circle, rgba(224, 184, 79, 0.18) 0 1px, transparent 1px);
  background-position:
    0 0,
    19px 31px;
  background-size:
    92px 92px,
    137px 137px;
  opacity: 0.22;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  padding: 1rem clamp(1rem, 3vw, 2rem);
  border-bottom: 1px solid var(--line);
  background: rgba(17, 18, 15, 0.88);
  backdrop-filter: blur(14px);
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: clamp(1.8rem, 3vw, 3.2rem);
  line-height: 1;
  letter-spacing: 0;
}

h2 {
  font-size: 1.1rem;
  line-height: 1.2;
}

h3 {
  font-size: 1rem;
  line-height: 1.25;
}

main {
  position: relative;
  z-index: 1;
  width: min(1560px, 100%);
  margin: 0 auto;
  padding: 1rem clamp(1rem, 3vw, 2rem) 3rem;
}

.eyebrow {
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 0;
  font-size: 0.74rem;
  font-weight: 800;
}

.muted {
  color: var(--muted);
  line-height: 1.5;
}

.toolbar {
  display: flex;
  gap: 0.6rem;
  align-items: center;
}

.toolbar input,
.toolbar button,
.segmented button,
.tab {
  min-height: 2.35rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #1c1b16;
  color: var(--text);
  padding: 0.45rem 0.72rem;
}

.toolbar button,
.segmented button.active,
.tab.active {
  border-color: rgba(224, 184, 79, 0.72);
  background: #2a2518;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.8rem;
  margin: 1rem 0;
}

.tile,
.chart-panel,
.sky-panel,
.timeline-band,
.content-band {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(27, 27, 24, 0.92);
  box-shadow: 0 18px 60px var(--shadow);
}

.tile {
  min-height: 12rem;
  padding: 1rem;
  overflow: hidden;
}

.moon-tile {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 8rem;
  gap: 0.8rem;
  align-items: center;
}

.tile-label {
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0;
  margin-bottom: 0.45rem;
}

.hero-value {
  font-size: clamp(1.25rem, 2vw, 2rem);
  line-height: 1.05;
  font-weight: 850;
  margin-bottom: 0.45rem;
}

.fact-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.8rem;
}

.pill,
.status {
  display: inline-flex;
  align-items: center;
  min-height: 1.65rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.2rem 0.55rem;
  color: var(--text);
  background: #191914;
  font-size: 0.82rem;
  white-space: nowrap;
}

.status.good {
  border-color: rgba(143, 191, 117, 0.55);
  color: #dcefd0;
}

.status.warn {
  border-color: rgba(224, 184, 79, 0.55);
  color: #f5dda0;
}

.status.bad {
  border-color: rgba(214, 106, 77, 0.65);
  color: #ffd3c7;
}

.mini-list {
  display: grid;
  gap: 0.35rem;
  margin-top: 0.6rem;
}

.mini-row,
.data-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  border-top: 1px solid rgba(57, 53, 40, 0.7);
  padding-top: 0.5rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.visual-band {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(20rem, 0.8fr);
  gap: 0.8rem;
  margin-bottom: 1rem;
}

.chart-panel,
.sky-panel,
.timeline-band {
  padding: 1rem;
  min-width: 0;
}

.panel-heading {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: start;
  margin-bottom: 0.8rem;
}

.panel-heading.compact {
  margin-bottom: 0.3rem;
}

.segmented,
.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.segmented button {
  font-size: 0.85rem;
}

canvas {
  display: block;
  width: 100%;
  max-width: 100%;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-top: 0.6rem;
  color: var(--muted);
  font-size: 0.86rem;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.legend-swatch {
  width: 1.2rem;
  height: 0.18rem;
  border-radius: 999px;
  background: var(--gold);
}

.timeline-band {
  margin-bottom: 1rem;
}

.timeline {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.65rem;
}

.timeline-item {
  display: grid;
  gap: 0.35rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #191915;
  padding: 0.75rem;
  min-height: 8.5rem;
}

.timeline-time {
  color: var(--gold);
  font-weight: 850;
  font-size: 1.25rem;
}

.timeline-kind {
  color: var(--muted);
  text-transform: uppercase;
  font-size: 0.72rem;
  letter-spacing: 0;
}

.timeline-item.high {
  border-color: rgba(224, 184, 79, 0.55);
}

.timeline-item.alert {
  border-color: rgba(214, 106, 77, 0.95);
  box-shadow:
    inset 0 0 0 1px rgba(214, 106, 77, 0.45),
    0 16px 42px rgba(214, 106, 77, 0.14);
}

.timeline-item.alert .timeline-time,
.timeline-item.alert .timeline-kind {
  color: #ff9a82;
}

#moonCanvas {
  aspect-ratio: 1;
}

#skyMap {
  margin-inline: auto;
  aspect-ratio: 1;
}

.tabs {
  margin: 1rem 0;
}

.tab {
  min-width: 6rem;
}

.content-band {
  padding: 1rem;
  min-height: 24rem;
}

.grid {
  display: grid;
  gap: 0.75rem;
}

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

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

.card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #191915;
  padding: 0.85rem;
  min-width: 0;
}

.card h3 {
  margin-bottom: 0.35rem;
}

.card .muted {
  font-size: 0.92rem;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.metric {
  border-top: 1px solid var(--line);
  padding-top: 0.45rem;
}

.metric strong {
  display: block;
  font-size: 1.05rem;
}

.metric span {
  color: var(--muted);
  font-size: 0.78rem;
}

.event-list,
.target-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.wide-card {
  grid-column: 1 / -1;
}

.target-title {
  display: flex;
  justify-content: space-between;
  gap: 0.7rem;
  align-items: start;
}

.toast {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 50;
  max-width: min(28rem, calc(100vw - 2rem));
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.75rem 0.9rem;
  color: var(--text);
  background: #1e1c16;
  box-shadow: 0 18px 60px var(--shadow);
  transform: translateY(150%);
  transition: transform 180ms ease;
}

.toast.show {
  transform: translateY(0);
}

.empty {
  color: var(--muted);
  padding: 2rem 0;
  text-align: center;
}

@media (max-width: 1120px) {
  .summary-grid,
  .visual-band,
  .timeline,
  .grid.three {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .sky-panel {
    grid-column: 1 / -1;
  }
}

@media (max-width: 760px) {
  .topbar,
  .toolbar,
  .panel-heading,
  .target-title {
    align-items: stretch;
    flex-direction: column;
  }

  .summary-grid,
  .visual-band,
  .timeline,
  .grid.two,
  .grid.three,
  .event-list,
  .target-list,
  .metric-grid {
    grid-template-columns: 1fr;
  }

  .moon-tile {
    grid-template-columns: 1fr;
  }

  #moonCanvas {
    width: 10rem;
  }

  .tab {
    flex: 1 1 8rem;
  }
}
