:root {
  --bg: #0e1418;
  --panel: #161f25;
  --panel-2: #1c272e;
  --line: #2a3841;
  --ink: #e7eef2;
  --ink-dim: #9db0bc;
  --ink-faint: #6b7f8c;
  --accent: #4fb0c6;
  --warn: #e0a458;
  --up: #d4603f;
  --down: #3d7ab8;
  --south: #e2b13c;
  --east: #6fc27b;
  --west: #c77dd6;
  --north: #58b6d8;
  --radius: 10px;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }

/* ---------- masthead ---------- */

.masthead {
  display: flex; flex-wrap: wrap; gap: 12px 24px; align-items: baseline;
  justify-content: space-between;
  padding: 18px 24px 14px;
  border-bottom: 1px solid var(--line);
}
.masthead h1 { font-size: 21px; }
.tagline { margin: 2px 0 0; color: var(--ink-dim); font-size: 13.5px; }
.badge {
  margin: 0; padding: 5px 11px; border-radius: 999px;
  background: rgba(224, 164, 88, 0.13);
  border: 1px solid rgba(224, 164, 88, 0.4);
  color: var(--warn); font-size: 12px; font-weight: 600; letter-spacing: 0.01em;
  cursor: help;
}

/* ---------- storm selector ---------- */

.storm-bar {
  display: flex; gap: 8px; padding: 12px 24px;
  overflow-x: auto; border-bottom: 1px solid var(--line);
  scrollbar-width: thin;
}
.storm-chip {
  flex: 0 0 auto; min-width: 132px; text-align: left;
  padding: 8px 12px; border-radius: var(--radius);
  background: var(--panel); border: 1px solid var(--line); color: var(--ink);
  cursor: pointer; font: inherit; transition: border-color .12s, background .12s;
}
.storm-chip:hover { border-color: var(--ink-faint); }
.storm-chip[aria-pressed="true"] { border-color: var(--accent); background: var(--panel-2); }
.storm-chip .chip-name { display: block; font-weight: 600; font-size: 14px; }
.storm-chip .chip-meta { display: block; color: var(--ink-dim); font-size: 11.5px; margin-top: 2px; }
.storm-chip .chip-dir { color: var(--accent); font-variant-numeric: tabular-nums; }

/* ---------- stage ---------- */

.stage {
  display: grid; grid-template-columns: minmax(340px, 1fr) minmax(340px, 460px);
  gap: 18px; padding: 18px 24px 28px; align-items: start;
}
/* Grid items default to min-width:auto, which lets a fixed-width child widen
   the column. The map holder is sized in pixels, so pin these to zero. */
.stage > * { min-width: 0; }

.map-panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
/* Width is set by sizeCanvases() so the map never outgrows the viewport; the
   holder tracks the canvas so the legend and wind inset stay aligned to it. */
.map-holder { position: relative; margin: 0 auto; }
#map { display: block; border-radius: 6px; background: #0a1013; }

.wind-inset {
  position: absolute; top: 10px; left: 10px;
  display: flex; align-items: center; gap: 13px;
  background: rgba(14, 20, 24, 0.82); border: 1px solid var(--line);
  border-radius: 10px; padding: 10px 16px 10px 10px; backdrop-filter: blur(3px);
}
#wind-dial { width: 78px; height: 78px; }
.wind-readout { display: flex; flex-direction: column; line-height: 1.35; }
.wind-readout span:first-child { font-size: 25px; font-weight: 600; font-variant-numeric: tabular-nums; }
.wind-readout .unit { font-size: 15px; color: var(--ink-dim); }
.wind-readout .stress { font-size: 14px; color: var(--ink-faint); font-family: var(--mono); margin-top: 3px; }

.map-legend { display: flex; align-items: center; gap: 16px; margin-top: 12px; flex-wrap: wrap; }
.colorbar { height: 10px; flex: 1 1 180px; border-radius: 3px; border: 1px solid var(--line); }
.colorbar-labels {
  display: flex; justify-content: space-between; gap: 12px; width: 100%;
  font-size: 11.5px; color: var(--ink-dim); font-variant-numeric: tabular-nums;
}
.colorbar-labels span:nth-child(2) { color: var(--ink-faint); }
.scalebar { display: flex; align-items: center; gap: 7px; font-size: 11.5px; color: var(--ink-dim); }
.scalebar-line { display: block; width: 56px; height: 3px; background: var(--ink-dim); border-radius: 2px; }
.vector-key { display: flex; align-items: center; gap: 7px; font-size: 11.5px; color: var(--ink-dim); }
#vector-key { width: 66px; height: 13px; }

.map-footnotes {
  display: flex; flex-direction: column; gap: 3px;
  margin-top: 10px; font-size: 11.5px; color: var(--ink-faint);
}

/* ---------- side column ---------- */

.side { display: flex; flex-direction: column; gap: 14px; }
.side > section {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px;
}
.side h2 { font-size: 12px; text-transform: uppercase; letter-spacing: 0.07em; color: var(--ink-dim); margin-bottom: 9px; }

.transport { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
button {
  font: inherit; font-size: 13.5px; padding: 7px 14px; border-radius: 7px;
  background: var(--panel-2); border: 1px solid var(--line); color: var(--ink); cursor: pointer;
}
button:hover { border-color: var(--ink-faint); }
button.primary { background: var(--accent); border-color: var(--accent); color: #06171c; font-weight: 600; min-width: 92px; }
button.primary:hover { filter: brightness(1.08); }

/* Marks the play button as the thing to press on arrival. Removed for good on
   first interaction, and skipped entirely for reduced-motion users. */
button.primary.attention { animation: call-to-action 2.6s ease-in-out infinite; }
@keyframes call-to-action {
  0%, 100% { box-shadow: 0 0 0 0 rgba(226, 177, 60, 0); }
  50% { box-shadow: 0 0 0 6px rgba(226, 177, 60, 0.28), 0 0 16px 2px rgba(226, 177, 60, 0.5); }
}
@media (prefers-reduced-motion: reduce) {
  button.primary.attention { animation: none; box-shadow: 0 0 0 3px rgba(226, 177, 60, 0.35); }
}
button:disabled { opacity: .45; cursor: default; }

.speed, .scale-label { margin-left: auto; font-size: 12px; color: var(--ink-dim); display: flex; align-items: center; gap: 6px; }
.toggles .current-mode { margin-left: 0; }
select {
  font: inherit; font-size: 12.5px; padding: 5px 7px; border-radius: 6px;
  background: var(--panel-2); border: 1px solid var(--line); color: var(--ink);
}

#scrub { width: 100%; margin: 13px 0 4px; accent-color: var(--accent); }
.time-row { display: flex; justify-content: space-between; font-size: 12.5px; }
.model-time { font-family: var(--mono); font-size: 13px; }
.frame-count { color: var(--ink-faint); font-family: var(--mono); font-size: 11.5px; }

.toggles { display: flex; flex-wrap: wrap; gap: 10px 16px; margin-top: 12px; font-size: 12.5px; color: var(--ink-dim); }
.toggles label { display: flex; align-items: center; gap: 6px; cursor: pointer; }
.toggles input { accent-color: var(--accent); }

.buffer-note { margin: 10px 0 0; font-size: 11px; color: var(--ink-faint); font-family: var(--mono); }

#series { width: 100%; height: auto; display: block; }
.chart-legend { margin: 8px 0 0; font-size: 11.5px; color: var(--ink-faint); }
.chart-legend b { font-weight: 600; }

dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; font-size: 12.5px; }
dt { color: var(--ink-dim); }
dd { margin: 0; text-align: right; font-family: var(--mono); font-size: 12px; }
dd.wrap { text-align: left; font-family: inherit; font-size: 12px; color: var(--ink-dim); }

.downloads { margin: 11px 0 0; font-size: 12px; display: flex; gap: 14px; flex-wrap: wrap; }
.downloads a { color: var(--accent); text-decoration: none; border-bottom: 1px solid rgba(79,176,198,.35); }
.downloads a:hover { border-bottom-color: var(--accent); }

/* ---------- limitations ---------- */

.limitations { padding: 6px 24px 40px; }
.limitations h2 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.07em; color: var(--ink-dim); margin-bottom: 12px; }
.limitation-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; }
.limitation-grid article {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 13px 15px;
}
.limitation-grid h3 { font-size: 13.5px; margin-bottom: 5px; color: var(--ink); }
.limitation-grid p { margin: 0; font-size: 12.5px; color: var(--ink-dim); line-height: 1.5; }
.attribution { margin: 16px 0 0; font-size: 11.5px; color: var(--ink-faint); }
.attribution a { color: var(--ink-dim); }

/* ---------- responsive ---------- */

@media (max-width: 900px) {
  .stage { grid-template-columns: 1fr; padding: 14px; }
  .masthead { padding: 14px; }
  .storm-bar { padding: 10px 14px; }
  .limitations { padding: 6px 14px 32px; }
  .wind-inset { padding: 7px 11px 7px 7px; gap: 9px; }
  #wind-dial { width: 58px; height: 58px; }
  .wind-readout span:first-child { font-size: 20px; }
  .wind-readout .unit { font-size: 12.5px; }
  .wind-readout .stress { font-size: 11.5px; }
}
