:root {
  color-scheme: light;
  --ink: #12121a;
  --muted: #56566d;
  --accent: #ff7b2f;
  --accent-2: #0f8ea1;
  --surface: #f6f0e8;
  --surface-alt: #fff7ef;
  --panel: #ffffff;
  --panel-soft: #fff7ef;
  --card: #f6f0e8;
  --canvas: #ffffff;
  --tooltip-bg: #12121a;
  --tooltip-ink: #ffffff;
  --chart-grid: rgba(18, 18, 26, 0.1);
  --chart-axis: rgba(18, 18, 26, 0.35);
  --chart-axis-strong: rgba(18, 18, 26, 0.6);
  --chart-midnight: rgba(18, 18, 26, 0.18);
  --chart-watermark: rgba(18, 18, 26, 0.16);
  --stroke: rgba(18, 18, 26, 0.12);
  --shadow: 0 18px 40px rgba(14, 16, 26, 0.16);
  --radius: 24px;
  --bg-start: #f7e7d4;
  --bg-mid: #f2f1ff;
  --bg-end: #e9f3f4;
  --orbit-a: rgba(255, 123, 47, 0.28);
  --orbit-b: rgba(15, 142, 161, 0.22);
}

[data-theme="dark"] {
  color-scheme: dark;
  --ink: #f4f4f8;
  --muted: #b4b6c6;
  --accent: #ff9a50;
  --accent-2: #4bc3d4;
  --surface: #1c1f2b;
  --surface-alt: #151823;
  --panel: #1b1f2c;
  --panel-soft: #151923;
  --card: #22283a;
  --canvas: #141824;
  --tooltip-bg: #0d0f16;
  --tooltip-ink: #f4f4f8;
  --chart-grid: rgba(248, 248, 255, 0.14);
  --chart-axis: rgba(248, 248, 255, 0.28);
  --chart-axis-strong: rgba(248, 248, 255, 0.5);
  --chart-midnight: rgba(248, 248, 255, 0.18);
  --chart-watermark: rgba(248, 248, 255, 0.18);
  --stroke: rgba(248, 248, 255, 0.12);
  --shadow: 0 22px 50px rgba(0, 0, 0, 0.35);
  --bg-start: #0d111a;
  --bg-mid: #121626;
  --bg-end: #0b1318;
  --orbit-a: rgba(255, 154, 80, 0.2);
  --orbit-b: rgba(75, 195, 212, 0.18);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Space Grotesk", "Spline Sans", sans-serif;
  color: var(--ink);
  background: linear-gradient(140deg, var(--bg-start) 0%, var(--bg-mid) 45%, var(--bg-end) 100%);
}

.site-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  padding: 48px clamp(24px, 6vw, 72px) 24px;
  gap: 24px;
}

.site-header > div:first-child {
  min-width: 280px;
  flex: 1 1 320px;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent-2);
  margin: 0 0 12px;
}

h1 {
  font-size: clamp(32px, 4vw, 52px);
  margin: 0;
}

h2,
h3 {
  margin: 8px 0;
}

.subhead {
  max-width: 520px;
  margin: 0;
  color: var(--muted);
}

.status {
  background: var(--surface);
  padding: 16px 20px;
  border-radius: 999px;
  box-shadow: var(--shadow);
  font-weight: 600;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
}

.grid {
  display: grid;
  grid-template-columns: minmax(240px, 290px) minmax(0, 1fr);
  gap: 24px;
  padding: 0 clamp(24px, 6vw, 72px) 20px;
}

.panel {
  background: var(--panel-soft);
  border: 1px solid var(--stroke);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 0;
}

.locations {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.location-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-bottom: 12px;
}

@media (min-width: 961px) {
  #locationsToggle {
    display: none;
  }
}


.location-card {
  background: var(--panel);
  border-radius: 16px;
  padding: 16px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.2s ease, border 0.2s ease;
}

.location-card.active {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.location-card h3 {
  margin: 0 0 4px;
  font-size: 18px;
}

.location-card p {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}

.hint {
  font-size: 12px;
  color: var(--muted);
}

.viz {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

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

.chart-mode {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
}

.chart-mode .ghost {
  padding: 8px 12px;
}

.chart-mode .ghost.active {
  border-color: var(--accent-2);
  color: var(--accent-2);
}

.control {
  display: grid;
  gap: 6px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
}

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

.control-value {
  font-weight: 600;
}

.control input[type="range"] {
  width: 100%;
}

.primary,
.ghost {
  border-radius: 999px;
  border: none;
  padding: 10px 18px;
  font-weight: 600;
  cursor: pointer;
}

.primary {
  background: var(--accent);
  color: #fff;
}

.ghost {
  background: transparent;
  border: 1px solid var(--stroke);
  color: var(--ink);
}

.refresh-btn {
  position: relative;
  overflow: hidden;
}

.refresh-btn.is-loading {
  color: var(--muted);
  border-color: transparent;
  background: rgba(18, 18, 26, 0.05);
}

[data-theme="dark"] .refresh-btn.is-loading {
  background: rgba(248, 248, 255, 0.08);
}

.refresh-btn.is-loading::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, transparent 0%, rgba(255, 255, 255, 0.5) 50%, transparent 100%);
  transform: translateX(-100%);
  animation: shimmer 1.2s infinite;
}

@keyframes shimmer {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(100%);
  }
}

.meta {
  margin: 0 0 8px;
  color: var(--muted);
  text-align: left;
}

.meta-line {
  display: block;
}

.timeline {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 16px;
  background: var(--panel);
  border-radius: 18px;
  border: 1px solid var(--stroke);
}

.timeline-track {
  position: relative;
  display: block;
  height: 54px;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--stroke);
  background: var(--surface-alt);
  touch-action: none;
}

.timeline-days {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
}

.timeline-day {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  border-right: 1px solid var(--stroke);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.35), rgba(255, 255, 255, 0.1));
  text-transform: uppercase;
  letter-spacing: 0.06em;
  flex: 0 0 auto;
}

.timeline-day-label {
  transition: opacity 0.2s ease;
}

[data-theme="dark"] .timeline-day {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02));
}

.timeline-day:last-child {
  border-right: none;
}

.timeline-selection {
  position: absolute;
  top: 6px;
  bottom: 6px;
  border-radius: 10px;
  background: rgba(15, 142, 161, 0.18);
  border: 1px solid rgba(15, 142, 161, 0.35);
  cursor: grab;
  touch-action: none;
}

.timeline-selection:active {
  cursor: grabbing;
}

.timeline-marker {
  position: absolute;
  top: 4px;
  bottom: 4px;
  width: 10px;
  border-radius: 8px;
  border: 2px solid var(--accent);
  background: var(--panel);
  cursor: ew-resize;
  padding: 0;
  box-shadow: 0 6px 14px rgba(18, 18, 26, 0.2);
  touch-action: none;
}

.timeline-marker.end {
  border-color: var(--accent-2);
}

.timeline-marker:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

@media (max-width: 960px) {
  .locations.is-collapsed .location-list {
    display: none;
  }
}

.time-range {
  font-weight: 600;
  text-align: center;
  font-size: 17px;
}

.charts {
  display: grid;
  gap: 14px;
}

canvas {
  width: 100%;
  height: clamp(190px, 22vw, 250px);
  max-height: 250px;
  background: var(--canvas);
  border-radius: 18px;
  border: 1px solid var(--stroke);
}

.overlay-note {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--muted);
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  font-size: 12px;
  color: var(--muted);
  margin-top: 6px;
}

.chart-group {
  display: grid;
  gap: 10px;
}

.chart-group-head {
  font-weight: 600;
  color: var(--ink);
  margin-top: 8px;
}

.chart-group-legend {
  margin-bottom: 4px;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid transparent;
  background: transparent;
  padding: 4px 6px;
  border-radius: 999px;
  cursor: pointer;
  color: inherit;
  font: inherit;
}

.legend-toggle.is-off {
  opacity: 0.45;
  border-color: var(--stroke);
}

.legend-swatch {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
}

.tooltip {
  position: fixed;
  pointer-events: none;
  background: var(--tooltip-bg);
  color: var(--tooltip-ink);
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 12px;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.12s ease, transform 0.12s ease;
  z-index: 20;
  max-width: 260px;
  line-height: 1.4;
}

.tooltip.visible {
  opacity: 1;
  transform: translateY(0);
}

.tooltip-time {
  font-weight: 600;
  margin-bottom: 6px;
}

.tooltip-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.tooltip-swatch {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--tooltip-ink);
  flex: 0 0 auto;
}

.forecast {
  background: var(--panel);
  border-radius: 18px;
  padding: 16px;
  border: 1px solid var(--stroke);
}

.forecast-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}


.forecast-toggle {
  padding: 6px 12px;
  font-size: 12px;
}

.forecast.is-collapsed .forecast-cards {
  display: none;
}

.forecast-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.forecast-card {
  border-radius: 14px;
  padding: 12px;
  background: var(--card);
}

.forecast-card h4 {
  margin: 0 0 6px;
  font-size: 14px;
}

.forecast-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.site-footer {
  padding: 12px 24px 32px;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
}

@media (max-width: 960px) {
  .grid {
    grid-template-columns: 1fr;
    padding-left: 12px;
    padding-right: 12px;
  }

  .panel {
    padding: 12px;
  }

  .location-list {
    padding-bottom: 0;
  }

  h2,
  h3 {
    margin: 8px 4px;
  }

  .meta {
    margin: 0 4px 8px;
  }

  .controls {
    flex-wrap: wrap;
  }

  .control input[type="range"] {
    width: 100%;
  }
}
