:root {
  --page-bg: #eef3ea;
  --panel-bg: #fbfcf8;
  --panel-border: #cfd8c6;
  --ink: #18231c;
  --muted: #5a685d;
  --accent: #1f5c47;
  --accent-soft: #dfeee5;
  --warning-bg: #f7e7ca;
  --warning-border: #d39f42;
  --warning-ink: #5c3d00;
  --danger-bg: #f8dcdc;
  --danger-border: #b94a48;
  --danger-ink: #5e1d1b;
  --shadow: 0 18px 40px rgba(38, 61, 42, 0.08);
  --radius: 18px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(208, 230, 213, 0.9), transparent 28%),
    linear-gradient(180deg, #f8fbf5 0%, var(--page-bg) 100%);
}

.page-shell {
  width: min(1480px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 28px 0 40px;
}

.hero,
.control-strip,
.main-grid,
.future-grid {
  margin-bottom: 20px;
}

.hero {
  display: flex;
  gap: 20px;
  justify-content: space-between;
  align-items: end;
}

.eyebrow {
  margin: 0 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.72rem;
  color: var(--accent);
}

.hero h1 {
  margin: 0;
  font-size: clamp(2.2rem, 4vw, 4rem);
  line-height: 0.95;
}

.hero-copy {
  max-width: 760px;
  color: var(--muted);
  margin: 12px 0 0;
  font-size: 1.05rem;
}

.hero-note {
  background: var(--accent-soft);
  border: 1px solid var(--panel-border);
  border-radius: 999px;
  padding: 14px 18px;
  color: var(--accent);
  box-shadow: var(--shadow);
}

.control-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.control-strip label,
.slider-wrap label,
.stacked-control {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 0.95rem;
}

.control-strip span,
.meta-label {
  color: var(--muted);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

select,
input[type="search"],
input[type="range"] {
  width: 100%;
}

select,
input[type="search"] {
  appearance: none;
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  background: var(--panel-bg);
  padding: 12px 14px;
  color: var(--ink);
  box-shadow: var(--shadow);
}

input[type="search"]::placeholder {
  color: #7b877d;
}

.banner {
  padding: 14px 16px;
  border-radius: 14px;
  margin-bottom: 18px;
}

.banner.warning {
  background: var(--warning-bg);
  border: 1px solid var(--warning-border);
  color: var(--warning-ink);
}

.banner.error {
  background: var(--danger-bg);
  border: 1px solid var(--danger-border);
  color: var(--danger-ink);
}

.hidden {
  display: none;
}

.timing-panel {
  position: fixed;
  right: 12px;
  bottom: 12px;
  z-index: 1200;
  width: min(520px, calc(100vw - 24px));
  max-height: 42vh;
  overflow: auto;
  padding: 10px;
  border: 1px solid #77847a;
  border-radius: 10px;
  background: rgba(250, 252, 248, 0.96);
  box-shadow: var(--shadow);
  font: 12px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace;
}

.timing-panel summary { cursor: pointer; font-weight: 700; }
.timing-panel button { float: right; margin: 4px 0; }
.timing-log { clear: both; white-space: pre-wrap; }
.metadata-refreshing { cursor: progress; opacity: 0.72; }

.main-grid {
  display: grid;
  grid-template-columns: minmax(0, 2.2fr) minmax(300px, 0.9fr);
  gap: 20px;
  align-items: start;
}

.side-panel,
.future-grid {
  display: grid;
  gap: 20px;
}

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

.card {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}

.plot-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
  margin-bottom: 10px;
}

.plot-header h2,
.card h2 {
  margin: 0 0 6px;
  font-size: 1.25rem;
}

.plot-header p,
.small-copy,
.surface-list,
#metadata-panel,
.future-grid p {
  color: var(--muted);
}

.meta-block {
  display: flex;
  gap: 18px;
  text-align: right;
}

.utility-link {
  color: var(--accent);
  font-weight: 700;
  text-decoration: none;
}

.utility-link:hover {
  text-decoration: underline;
}

.calculations-link {
  display: inline-block;
  margin-top: 10px;
}

.calculations-page {
  max-width: 1480px;
}

.calculations-hero {
  align-items: center;
}

.calculation-intro {
  margin-bottom: 20px;
}

.calculation-intro label {
  display: block;
  margin: 18px 0 7px;
  font-weight: 700;
}

.calculation-table-wrap {
  overflow-x: auto;
}

.calculation-table {
  width: 100%;
  border-collapse: collapse;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.92rem;
  line-height: 1.45;
}

.calculation-table th,
.calculation-table td {
  min-width: 150px;
  padding: 12px;
  border-bottom: 1px solid var(--panel-border);
  text-align: left;
  vertical-align: top;
}

.calculation-table th {
  color: var(--accent);
  background: var(--accent-soft);
  position: sticky;
  top: 0;
}

.calculation-table th:nth-child(2) {
  min-width: 320px;
}

.plot-surface {
  min-height: 700px;
}

.meteogram-surface {
  min-height: 320px;
  margin-top: 12px;
}

.slider-wrap {
  margin-top: 14px;
}

.slider-scale {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 0.82rem;
  gap: 8px;
  flex-wrap: wrap;
}

.stat-groups {
  display: grid;
  gap: 12px;
}

.station-results {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0 14px;
}

.station-chip {
  border: 1px solid var(--panel-border);
  background: #f3f7f0;
  color: var(--ink);
  border-radius: 999px;
  padding: 8px 12px;
  cursor: pointer;
  font: inherit;
}

.station-chip.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.station-map-shell {
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(190, 220, 206, 0.55), rgba(236, 243, 234, 0.9)),
    radial-gradient(circle at 20% 25%, rgba(255, 255, 255, 0.55), transparent 35%);
}

.station-map {
  display: block;
  width: 100%;
  height: 190px;
}

.station-map-label {
  fill: var(--ink);
  font-size: 11px;
}

.station-map-dot {
  fill: rgba(31, 92, 71, 0.85);
  stroke: #fff;
  stroke-width: 2;
  cursor: pointer;
}

.station-map-dot.active {
  fill: #c2362b;
}

.station-map-frame {
  fill: none;
  stroke: rgba(31, 92, 71, 0.25);
  stroke-width: 1.25;
  stroke-dasharray: 6 4;
}

.station-map-grid {
  stroke: rgba(31, 92, 71, 0.14);
  stroke-width: 1;
}

.stat-group {
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  padding: 12px;
  background: linear-gradient(180deg, rgba(240, 247, 242, 0.9), rgba(251, 252, 248, 1));
}

.stat-group h3 {
  margin: 0 0 10px;
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
}

.metric-row,
.surface-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 0;
  border-bottom: 1px dashed rgba(95, 113, 99, 0.2);
}

.metric-row:last-child,
.surface-row:last-child {
  border-bottom: 0;
}

.metric-name,
.surface-name {
  color: var(--muted);
}

.metric-value,
.surface-value {
  font-weight: 700;
}

details summary {
  cursor: pointer;
  font-weight: 700;
}

@media (max-width: 1120px) {
  .main-grid,
  .future-grid,
  .control-strip,
  .hero {
    grid-template-columns: 1fr;
    display: grid;
  }

  .hero-note,
  .meta-block {
    text-align: left;
  }

  .plot-surface {
    min-height: 560px;
  }
}
