:root {
  --bg: #050816;
  --panel: rgba(7, 12, 28, 0.64);
  --panel-border: rgba(160, 196, 255, 0.16);
  --text: #eef4ff;
  --muted: #a6b7d9;
  --accent: #7fc4ff;
  --alert: #ff8c6b;
  --hypo: #b88cff;
  --good: #8df5c1;
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
  --radius: 18px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; width: 100%; height: 100%; overflow: hidden; }
body {
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: radial-gradient(circle at top, #162445, #040711 52%);
  color: var(--text);
}

#appShell, #cesiumContainer {
  position: absolute;
  inset: 0;
}

.glass {
  background: var(--panel);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--panel-border);
  box-shadow: var(--shadow);
}

.topbar {
  position: absolute;
  top: 18px;
  left: 18px;
  right: 18px;
  height: 78px;
  border-radius: 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  z-index: 20;
}

.brandBlock h1 {
  margin: 2px 0 0;
  font-size: 1.3rem;
  font-weight: 700;
}

.eyebrow, .panelLabel, .small {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.68rem;
}

.eyebrow, .panelLabel, .muted, .small { color: var(--muted); }

.leftPanel, .rightPanel {
  position: absolute;
  top: 112px;
  bottom: 205px;
  width: 320px;
  border-radius: var(--radius);
  padding: 18px;
  z-index: 15;
  overflow: auto;
}
.leftPanel { left: 18px; }
.rightPanel { right: 18px; }

.leftPanel section + section,
.rightPanel section + section { margin-top: 18px; }

.bottomDock {
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 18px;
  min-height: 168px;
  border-radius: 24px;
  z-index: 20;
  padding: 18px;
}

.dockHeader {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: center;
  margin-bottom: 14px;
}

.topbarActions, .transportControls, .modePills, .chipWrap {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

button, select {
  border: 1px solid rgba(166, 183, 217, 0.18);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  border-radius: 999px;
  padding: 10px 14px;
  font: inherit;
}

button:hover, select:hover { border-color: rgba(127, 196, 255, 0.45); cursor: pointer; }
button.active, .chip.active, .pill.active, .primaryBtn {
  background: linear-gradient(135deg, rgba(127, 196, 255, 0.22), rgba(184, 140, 255, 0.18));
  border-color: rgba(127, 196, 255, 0.42);
}
button.disabled { opacity: 0.45; cursor: default; }
.primaryBtn { font-weight: 600; }
.ghostBtn { background: rgba(255, 255, 255, 0.03); }

h2 {
  margin: 6px 0 10px;
  font-size: 1.2rem;
}

.facts {
  display: grid;
  gap: 10px;
  margin: 14px 0 0;
}
.facts div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
}
.facts dt, .facts dd { margin: 0; }
.facts dt { color: var(--muted); }
.facts dd { text-align: right; }

.metricGrid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.metricCard {
  background: rgba(255, 255, 255, 0.03);
  border-radius: 16px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.06);
}
.metricCard span {
  display: block;
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 8px;
}
.metricCard strong {
  font-size: 1.15rem;
}

.notesBlock {
  display: grid;
  gap: 10px;
}
.notesBlock .note {
  border-left: 3px solid rgba(127, 196, 255, 0.55);
  padding-left: 12px;
  color: #d8e4ff;
}

.legendList {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  display: grid;
  gap: 10px;
}
.legendList li {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #dce7ff;
}
.swatch {
  width: 13px;
  height: 13px;
  border-radius: 999px;
  display: inline-block;
  box-shadow: 0 0 16px currentColor;
}
.swatch.pale { color: #d2ebff; background: #d2ebff; }
.swatch.alert { color: #ff8c6b; background: #ff8c6b; }
.swatch.link { color: #8df5c1; background: #8df5c1; }
.swatch.hypo { color: #b88cff; background: #b88cff; }

.scenarioButtons {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}
.scenarioBtn {
  padding: 14px;
  border-radius: 18px;
  text-align: left;
  min-height: 86px;
}
.scenarioBtn strong {
  display: block;
  margin-bottom: 6px;
}
.scenarioBtn span {
  display: block;
  font-size: 0.82rem;
  color: var(--muted);
}
.scenarioBtn.active { outline: 1px solid rgba(127, 196, 255, 0.6); }

.timelineWrap {
  display: grid;
  gap: 8px;
}
#timelineSlider { width: 100%; }
.timelineLabels {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 0.78rem;
}

.speedWrap {
  display: flex;
  gap: 8px;
  align-items: center;
  color: var(--muted);
}

.cesium-viewer-toolbar,
.cesium-viewer-animationContainer,
.cesium-viewer-timelineContainer,
.cesium-viewer-bottom,
.cesium-viewer-fullscreenContainer,
.cesium-viewer-infoBoxContainer,
.cesium-viewer-selectionIndicatorContainer {
  display: none !important;
}

@media (max-width: 1400px) {
  .leftPanel, .rightPanel { width: 280px; }
  .scenarioButtons { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 980px) {
  .leftPanel, .rightPanel {
    width: calc(50% - 24px);
    top: 102px;
    bottom: 240px;
  }
  .scenarioButtons { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
