:root {
  color-scheme: light dark;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: #0f172a;
  color: #e2e8f0;
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px max(24px, env(safe-area-inset-right)) 24px max(24px, env(safe-area-inset-left));
}

.header h1 {
  margin: 0;
  font-size: 2rem;
}

.header p {
  margin-top: 8px;
  color: #93c5fd;
}

.status {
  margin: 20px 0;
  padding: 14px 16px;
  border-radius: 10px;
  background: #1e293b;
}

.grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
}

.card-link {
  text-decoration: none;
  color: inherit;
}

.card {
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 12px;
  padding: 14px;
  transition: transform 0.14s ease, border-color 0.14s ease;
}

.card-link:hover .card {
  transform: translateY(-2px);
  border-color: #60a5fa;
}

.card h3 {
  margin: 0;
  font-size: 1.05rem;
}

.card p {
  margin: 8px 0;
  color: #cbd5e1;
}

.badge {
  display: inline-block;
  margin-top: 10px;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
}

.badge.ready {
  background: #14532d;
  color: #dcfce7;
}

.badge.pending {
  background: #78350f;
  color: #fef3c7;
}

.top-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.back-link {
  color: #93c5fd;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 6px 4px;
  margin: -6px -4px;
  box-sizing: border-box;
  -webkit-tap-highlight-color: rgba(147, 197, 253, 0.25);
}

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

.metric-card {
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 12px;
  padding: 12px;
}

.metric-label {
  margin: 0;
  color: #93c5fd;
  font-size: 0.86rem;
}

.metric-value {
  margin: 6px 0 0;
  font-size: 1.4rem;
  font-weight: 700;
}

.aux-value {
  font-size: 1rem;
  font-weight: 600;
}

.sensor-panels-wrap {
  margin-bottom: 22px;
}

.sensor-panels-title {
  margin: 0 0 12px;
  font-size: 1.1rem;
  font-weight: 700;
}

.sensor-panel-card .sensor-panel-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: #e2e8f0;
  margin-bottom: 8px;
}

.metric-sensor-line {
  margin: 4px 0 0;
  font-size: 0.92rem;
  line-height: 1.35;
}

.metric-sensor-line .metric-label {
  display: inline-block;
  min-width: 5.5rem;
  color: #93c5fd;
  font-size: 0.82rem;
}

.metric-sensor-val {
  color: #f1f5f9;
  font-weight: 600;
}

.widget-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
  margin-bottom: 18px;
}

/* Compact top moon widget */
#moon-grid {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr));
  margin-bottom: 12px;
}

#moon-grid .widget-card.is-wide {
  grid-column: span 2;
}

@media (max-width: 520px) {
  #moon-grid .widget-card.is-wide {
    grid-column: auto;
  }
}

#moon-grid .widget-card {
  padding: 10px;
}

#moon-grid .moon-title {
  font-size: 0.95rem;
}

#moon-grid .moon-subtitle {
  font-size: 0.9rem;
}

#moon-grid .moon-phase-top {
  font-size: 1.2rem;
  font-weight: 800;
  margin-top: 6px;
}

#moon-grid .mini-widget {
  padding-top: 2px;
}

#moon-grid .mini-forecast-widget {
  text-align: left;
}

#moon-grid .mini-title {
  font-size: 0.95rem;
  font-weight: 800;
  color: #111827;
}

#moon-grid .mini-row {
  margin-top: 8px;
  display: inline-flex;
  gap: 10px;
  align-items: baseline;
  justify-content: center;
  font-weight: 800;
  color: #111827;
  font-size: 1rem;
  flex-wrap: wrap;
}

#moon-grid .mini-divider {
  color: #9ca3af;
  font-weight: 700;
}

#moon-grid .mini-forecast-widget .mini-forecast-row {
  margin-top: 8px;
  display: flex;
  gap: 10px;
  align-items: baseline;
  justify-content: flex-start;
  font-weight: 800;
  color: #111827;
  font-size: 1rem;
  flex-wrap: nowrap;
  white-space: nowrap;
  max-width: 100%;
  min-width: 0;
}

#moon-grid .mini-forecast-widget .mini-forecast-foot {
  margin-top: 10px;
  display: inline-flex;
  gap: 10px;
  align-items: center;
  justify-content: flex-start;
  color: #4b5563;
  font-weight: 700;
}

/* Keep the compact forecast row from wrapping (prevents taller tiles). */
#moon-grid .mini-forecast-widget .mini-forecast-row > * {
  white-space: nowrap;
  min-width: 0;
}

#moon-grid .mini-forecast-widget .mini-forecast-precip {
  flex: 0 0 auto;
}

body.station-page .widget-card {
  background: #ffffff;
  border: 1px solid #dbe2ea;
  border-radius: 12px;
  padding: 12px;
}

.widget-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: #111827;
}

.widget-kicker {
  font-size: 0.95rem;
  font-style: italic;
  color: #6b7280;
  font-weight: 600;
  margin-top: 2px;
}

.widget-main {
  display: grid;
  place-items: center;
  text-align: center;
  padding: 10px 0 4px;
}

.widget-big {
  font-size: 2rem;
  font-weight: 700;
  color: #374151;
  margin: 8px 0 4px;
}

.widget-sub {
  font-size: 1.05rem;
  font-weight: 700;
  color: #4b5563;
}

.widget-row {
  display: inline-flex;
  gap: 10px;
  align-items: baseline;
  justify-content: center;
  font-weight: 800;
  color: #111827;
  font-size: 1.15rem;
}

.widget-icon {
  width: 64px;
  height: 64px;
}

.moon-icon {
  width: 68px;
  height: 68px;
}

/* Forecast widget (WeatherLink-like) */
.forecast-widget {
  padding-top: 2px;
}

.forecast-top {
  margin-bottom: 10px;
}

.forecast-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: #111827;
}

.forecast-subtitle {
  margin-top: 2px;
  font-size: 1rem;
  font-style: italic;
  color: #4b5563;
  font-weight: 600;
}

.forecast-mid {
  display: grid;
  place-items: center;
  text-align: center;
  padding: 10px 0 8px;
}

/* Multi-day WeatherLink outlook: don’t center a wide grid in one column. */
.forecast-mid.forecast-mid--outlook {
  display: block;
  text-align: left;
  place-items: unset;
}

.forecast-period {
  font-size: 2rem;
  font-weight: 500;
  color: #374151;
  margin: 6px 0 4px;
}

.forecast-icon-wrap {
  width: 140px;
  height: 140px;
  display: grid;
  place-items: center;
  margin: 2px 0 10px;
}

.forecast-icon {
  width: 120px;
  height: 120px;
}

.forecast-stats {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 1.25rem;
  font-weight: 800;
  color: #111827;
}

.forecast-divider {
  color: #9ca3af;
  font-weight: 700;
}

.forecast-desc {
  margin-top: 6px;
  font-size: 1.05rem;
  font-weight: 700;
  color: #4b5563;
}

.forecast-foot {
  margin-top: 10px;
  font-size: 0.85rem;
  color: #9ca3af;
  font-weight: 600;
}

/* Local Forecast — “right now” card; main row sized near sun-widget graphic */
#widget-grid .widget-card:has(#widget-forecast) {
  display: flex;
  flex-direction: column;
}

body.station-page .widget-card:has(#widget-forecast-mini) {
  padding: 10px 11px;
}

.local-forecast-card {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.local-forecast-card .widget-title {
  font-size: 1.05rem;
  line-height: 1.25;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  font-weight: 800;
  color: #111827;
}

.local-forecast-kicker {
  font-size: 0.88rem;
  font-style: italic;
  color: #6b7280;
  font-weight: 600;
  margin-top: 2px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
}

.local-forecast-body {
  text-align: center;
  padding: 6px 0 4px;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.local-forecast-period {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  font-size: 1.65rem;
  font-weight: 600;
  color: #374151;
  margin: 2px 0 6px;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.local-forecast-icon-wrap {
  display: grid;
  place-items: center;
  margin: 2px 0 8px;
}

/* Icon sized between “hero” and body copy; stroke art is tuned for ~100px */
.local-forecast-icon-svg {
  width: 100px;
  height: 100px;
  display: block;
}

.local-forecast-stats {
  display: inline-flex;
  align-items: baseline;
  justify-content: center;
  gap: 8px;
  font-size: 1.12rem;
  font-weight: 800;
  color: #111827;
  flex-wrap: wrap;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
}

.local-forecast-divider {
  color: #9ca3af;
  font-weight: 600;
}

.local-forecast-condition {
  margin-top: 6px;
  font-size: 0.95rem;
  font-weight: 600;
  color: #9ca3af;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
}

/* Mini grid variant (beat #moon-grid .mini-forecast-widget rules) */
#moon-grid .mini-forecast-widget.local-forecast-mini .mini-title {
  font-size: 1rem;
  margin-bottom: 4px;
}

.local-forecast-period--mini {
  font-size: 1.1rem;
  margin: 0 0 8px;
}

#moon-grid .mini-forecast-widget.local-forecast-mini .mini-forecast-row {
  font-size: 1rem;
  margin-top: 4px;
  gap: 8px;
}

.local-forecast-mini .mini-divider {
  color: #9ca3af;
  font-weight: 600;
  margin: 0 2px;
}

.local-forecast-condition--mini {
  font-size: 0.8rem;
  margin-top: 3px;
}

/* Sunrise/Sunset widget */
.sun-widget {
  padding-top: 2px;
}

.sun-top {
  margin-bottom: 10px;
}

.sun-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: #111827;
}

.sun-subtitle {
  margin-top: 2px;
  font-size: 1rem;
  font-style: italic;
  color: #4b5563;
  font-weight: 600;
}

.sun-mid {
  display: grid;
  place-items: center;
  text-align: center;
  padding: 10px 0 8px;
}

.sun-time {
  font-size: 2.4rem;
  font-weight: 500;
  color: #374151;
  margin: 6px 0;
}

.sun-graphic {
  width: 100%;
  max-width: 420px;
  display: grid;
  place-items: center;
}

.sun-svg {
  width: 100%;
  height: 180px;
}

/* Moon Phase widget (WeatherLink-like) */
.moon-widget {
  padding-top: 2px;
}

.moon-top {
  margin-bottom: 10px;
}

.moon-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: #111827;
}

.moon-phase-top {
  font-size: 2rem;
  font-weight: 800;
  color: #374151;
  margin: 10px 0 2px;
}

.controls {
  margin-bottom: 14px;
}

.controls select {
  background: #0b1220;
  color: #e2e8f0;
  border: 1px solid #334155;
  border-radius: 8px;
  padding: 8px 10px;
}

.windrose-source-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 6px;
  border-radius: 12px;
  border: 1px solid #dbe2ea;
  background: #ffffff;
  margin: 0 0 8px;
  align-self: flex-start;
}

.windrose-source-controls[hidden] {
  display: none !important;
}

.windrose-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 6px;
  border-radius: 12px;
  border: 1px solid #dbe2ea;
  background: #ffffff;
  margin: 0 0 10px;
  align-self: flex-start;
  max-width: 100%;
}

.seg-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: #374151;
  font-weight: 800;
  font-size: 0.9rem;
  padding: 10px 14px;
  min-height: 44px;
  border-radius: 10px;
  cursor: pointer;
  -webkit-tap-highlight-color: rgba(17, 24, 39, 0.12);
}

.seg-btn:hover {
  background: #f3f4f6;
}

.seg-btn.is-active {
  background: #111827;
  color: #ffffff;
}

.chart-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
}

/* Slightly narrower tiles to avoid “too wide” charts */
@media (min-width: 900px) {
  body.station-page .chart-grid {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
  }
}

.chart-card {
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 12px;
  padding: 10px;
}

.chart-card h3 {
  margin: 4px 0 10px;
  font-size: 0.96rem;
}

.chart-subtext {
  margin: -6px 0 10px;
  color: #6b7280;
  font-size: 0.9rem;
  font-weight: 600;
}

.chart-card canvas {
  width: 100%;
  min-height: 220px;
  display: block;
  margin: 0 auto;
}

body.station-page {
  background: #eef0f3;
  color: #111827;
}

body.station-page .container {
  max-width: 1100px;
}

body.station-page .header p {
  color: #4b5563;
}

body.station-page .status {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  color: #374151;
}

body.station-page .metric-card,
body.station-page .chart-card {
  background: #ffffff;
  border: 1px solid #dbe2ea;
}

body.station-page .chart-card {
  display: flex;
  flex-direction: column;
}

body.station-page .chart-card canvas {
  /* Let Chart.js control aspect; we just provide height */
  flex: 0 0 auto;
  width: 100%;
  height: 240px;
  max-height: 240px;
  min-height: 0;
  margin: auto;
}

/* Give key charts more vertical room */
body.station-page #temp-chart {
  height: 280px;
  max-height: 280px;
}

body.station-page #pressure-chart {
  height: 280px;
  max-height: 280px;
}

@media (min-width: 900px) {
  body.station-page .chart-card-wide {
    grid-column: span 2;
  }
}

/* Station summary + companion transmitter wind roses (bottom of chart grid) */
.windrose-pair-wrap {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  align-items: stretch;
}

.windrose-pair-wrap.windrose-pair-single {
  grid-template-columns: 1fr;
}

.windrose-companion-stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

.windrose-pair-main {
  min-width: 0;
}

body.station-page .companion-windrose-wrap canvas {
  width: 100%;
  height: 240px;
  max-height: 240px;
  min-height: 240px;
  margin: 0 auto;
}

@media (max-width: 720px) {
  .windrose-pair-wrap:not(.windrose-pair-single) {
    grid-template-columns: 1fr;
  }
}

body.station-page .metric-label {
  color: #6b7280;
}

body.station-page .metric-value {
  color: #111827;
}

/* Sensor / transmitter cards: base rules assume dark cards; station page uses white cards. */
body.station-page .sensor-panels-title {
  color: #0f172a;
}

body.station-page .sensor-panel-card .sensor-panel-name {
  color: #0f172a;
}

body.station-page .sensor-panel-card .metric-sensor-line .metric-label {
  color: #475569;
}

body.station-page .sensor-panel-card .metric-sensor-val {
  color: #0f172a;
  font-weight: 700;
}

body.station-page .companion-windrose-card h3 {
  color: #0f172a;
}

body.station-page .back-link {
  color: #2563eb;
}

.windrose-legend {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 12px;
  padding: 8px 6px 2px;
}

.windrose-wrap {
  position: relative;
}

.windrose-wrap.windrose-loading {
  opacity: 0.55;
  transition: opacity 0.12s ease;
  pointer-events: none;
}

.windrose-tooltip {
  position: absolute;
  left: 0;
  top: 0;
  transform: translate(-9999px, -9999px);
  background: #374151;
  color: #ffffff;
  border-radius: 8px;
  padding: 12px 14px;
  min-width: 180px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  pointer-events: none;
  z-index: 5;
}

.windrose-tooltip-title {
  font-size: 1.05rem;
  font-weight: 800;
  margin-bottom: 8px;
}

.windrose-tooltip-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1rem;
  font-weight: 600;
}

.windrose-tooltip-swatch {
  width: 6px;
  height: 26px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.35);
}

.windrose-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  border-radius: 8px;
  padding: 10px 12px;
  font-weight: 700;
  color: #ffffff;
}

.windrose-swatch {
  width: 14px;
  height: 22px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.45);
}

/* ---------- Homepage (Dalton overview) ---------- */
body.home-page {
  background: linear-gradient(165deg, #0c1222 0%, #0f172a 40%, #111c33 100%);
}

.home-container {
  max-width: 1040px;
}

.home-header {
  margin-bottom: 8px;
}

.home-header h1 {
  margin: 0;
  font-size: 2rem;
  letter-spacing: -0.02em;
}

.home-tagline {
  margin: 10px 0 0;
  color: #93c5fd;
  font-size: 1rem;
}

.home-radar-widget {
  margin-top: 18px;
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 14px;
  padding: 18px 18px 16px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
}

.home-radar-widget-title {
  margin: 0 0 8px;
  font-size: 1.1rem;
  font-weight: 800;
  color: #e2e8f0;
}

.home-radar-widget-desc {
  margin: 0 0 14px;
  font-size: 0.9rem;
  color: #94a3b8;
  line-height: 1.45;
  max-width: 46rem;
}

.home-radar-preview {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid #334155;
  background: #0f172a;
}

.home-radar-preview-frame {
  display: block;
  width: 100%;
  height: clamp(200px, 42vw, 280px);
  border: 0;
}

.home-radar-preview-open {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding: 14px 16px;
  text-decoration: none;
  background: linear-gradient(to top, rgba(15, 23, 42, 0.78) 0%, rgba(15, 23, 42, 0.1) 52%, transparent 100%);
  color: #ffffff;
  transition: background 0.15s ease;
}

.home-radar-preview-open:hover {
  background: linear-gradient(to top, rgba(30, 58, 138, 0.85) 0%, rgba(15, 23, 42, 0.14) 52%, transparent 100%);
}

.home-radar-preview-open:focus-visible {
  outline: 2px solid #93c5fd;
  outline-offset: 2px;
}

.home-radar-preview-open-label {
  font-weight: 800;
  font-size: 0.95rem;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.55);
}

.home-radar-preview-open-hint {
  font-size: 0.78rem;
  font-weight: 600;
  color: #cbd5e1;
  margin-top: 4px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
}

.home-section {
  margin-top: 28px;
}

.home-section-title {
  margin: 0 0 6px;
  font-size: 1.15rem;
  color: #e2e8f0;
}

.home-section-lead {
  margin: 0 0 14px;
  color: #94a3b8;
  font-size: 0.92rem;
  max-width: 52rem;
}

.home-overview-card {
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 14px;
  padding: 20px 22px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
}

.home-overview-loading,
.home-forecast-loading {
  margin: 0;
  color: #94a3b8;
}

.home-forecast-paused {
  margin: 0;
  font-size: 0.92rem;
  color: #94a3b8;
  line-height: 1.5;
  max-width: 40rem;
}

.home-forecast-paused a {
  color: #93c5fd;
  font-weight: 600;
}

.home-overview-error {
  margin: 0;
  color: #fca5a5;
}

.home-overview-top {
  display: flex;
  flex-wrap: wrap;
  gap: 20px 28px;
  align-items: flex-start;
}

.home-overview-temp-block {
  display: flex;
  align-items: flex-start;
  gap: 4px;
  line-height: 1;
}

.home-overview-temp {
  font-size: 4rem;
  font-weight: 800;
  color: #f8fafc;
  letter-spacing: -0.04em;
}

.home-overview-temp-unit {
  font-size: 1.5rem;
  font-weight: 700;
  color: #94a3b8;
  margin-top: 0.35em;
}

.home-overview-place-title {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 700;
  color: #f1f5f9;
}

.home-overview-place-sub {
  margin: 6px 0 0;
  color: #cbd5e1;
  font-size: 0.98rem;
}

.home-meta {
  margin: 8px 0 0;
  font-size: 0.82rem;
  color: #64748b;
}

.home-overview-sub {
  margin: 14px 0 0;
  font-size: 0.88rem;
  color: #94a3b8;
  line-height: 1.45;
}

.home-overview-stats {
  margin-top: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 4px;
  align-items: baseline;
  font-size: 0.92rem;
  color: #e2e8f0;
  line-height: 1.5;
}

.home-overview-stats strong {
  color: #93c5fd;
  font-weight: 700;
}

.home-stat-sep {
  color: #475569;
  user-select: none;
}

.home-overview-actions {
  margin: 18px 0 0;
}

.home-btn {
  display: inline-block;
  padding: 10px 16px;
  border-radius: 10px;
  background: #2563eb;
  color: #ffffff;
  font-weight: 700;
  font-size: 0.9rem;
  text-decoration: none;
  border: 1px solid #3b82f6;
}

.home-btn:hover {
  background: #1d4ed8;
  border-color: #60a5fa;
}

.home-status {
  margin-top: 16px;
  margin-bottom: 0;
}

.home-status:empty {
  display: none;
}

.home-status.home-status-stale {
  background: #422006;
  border: 1px solid #b45309;
  color: #fde68a;
}

.home-station-grid {
  margin-top: 4px;
}

.home-week-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 118px), 1fr));
}

.home-day-card {
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 12px;
  padding: 12px 10px;
  text-align: center;
}

.home-day-name {
  margin: 0;
  font-weight: 800;
  color: #f1f5f9;
  font-size: 0.95rem;
}

.home-day-date {
  margin: 4px 0 0;
  font-size: 0.72rem;
  color: #64748b;
}

.home-day-temps {
  margin: 10px 0 4px;
  font-size: 1.05rem;
  font-weight: 800;
  color: #fde68a;
}

.home-day-desc {
  margin: 0;
  font-size: 0.78rem;
  color: #cbd5e1;
  line-height: 1.3;
}

.home-day-pop {
  margin: 6px 0 0;
  font-size: 0.72rem;
  color: #94a3b8;
}

.home-day-icon {
  display: block;
  margin: 8px auto 4px;
  max-width: 56px;
  height: auto;
}

.home-forecast-credit {
  margin: 14px 0 0;
  font-size: 0.78rem;
  color: #64748b;
}

.home-links-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
}

.home-link-card {
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 12px;
  padding: 16px;
}

.home-link-card h3 {
  margin: 0 0 8px;
  font-size: 1rem;
  color: #e2e8f0;
}

.home-link-card p {
  margin: 0;
  font-size: 0.88rem;
  color: #94a3b8;
  line-height: 1.45;
}

.home-link-card a {
  color: #93c5fd;
  font-weight: 600;
}

.home-footer {
  margin-top: 36px;
  padding-top: 20px;
  border-top: 1px solid #334155;
}

.home-footer p {
  margin: 0;
  font-size: 0.78rem;
  color: #64748b;
  line-height: 1.5;
  max-width: 48rem;
}

/* Radar map page */
body.radar-page {
  margin: 0;
  background: #eef0f3;
  color: #111827;
  min-height: 100vh;
}

.radar-container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 16px max(18px, env(safe-area-inset-right)) 32px max(18px, env(safe-area-inset-left));
}

.radar-top {
  margin-bottom: 14px;
}

.radar-back {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  margin-bottom: 10px;
  padding: 4px 2px;
  margin-left: -2px;
  color: #2563eb;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  -webkit-tap-highlight-color: rgba(37, 99, 235, 0.2);
}

.radar-back:hover {
  text-decoration: underline;
}

.radar-title {
  margin: 0 0 6px;
  font-size: 1.5rem;
  font-weight: 800;
  color: #0f172a;
}

.radar-lead {
  margin: 0;
  font-size: 0.92rem;
  color: #4b5563;
  line-height: 1.4;
}

.radar-intro {
  margin-bottom: 8px;
}

.radar-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px 24px;
  margin-bottom: 12px;
  padding: 12px 14px;
  background: #ffffff;
  border: 1px solid #dbe2ea;
  border-radius: 12px;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.06);
}

.radar-toolbar-check-solo {
  flex-shrink: 0;
  margin: 0;
}

.radar-toolbar-field {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
}

.radar-toolbar-label {
  font-size: 0.88rem;
  font-weight: 700;
  color: #374151;
}

.radar-toolbar-select {
  font: inherit;
  font-size: 0.9rem;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  color: #0f172a;
  min-width: 200px;
}

.radar-toolbar-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 0.9rem;
  color: #374151;
  cursor: pointer;
  user-select: none;
}

.radar-toolbar-check input {
  width: 1rem;
  height: 1rem;
  accent-color: #2563eb;
}

.radar-station-hint {
  margin: 0 0 10px;
  font-size: 0.86rem;
  color: #b45309;
  line-height: 1.45;
  max-width: 52rem;
}

.radar-popup-approx {
  margin: 0 0 12px !important;
  font-size: 0.8rem !important;
  line-height: 1.5 !important;
}

.radar-station-divicon {
  background: transparent !important;
  border: none !important;
}

.radar-station-pin {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid rgba(15, 23, 42, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 13px;
  color: #ffffff;
  background: #2563eb;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.18);
  line-height: 1;
}

.radar-station-pin--narrow {
  font-size: 11px;
  letter-spacing: -0.02em;
}

.leaflet-popup.radar-popup-wrap .leaflet-popup-content-wrapper {
  border-radius: 12px;
  padding: 0;
  box-shadow: 0 10px 36px rgba(0, 0, 0, 0.18);
}

.leaflet-popup.radar-popup-wrap .leaflet-popup-content {
  margin: 20px 22px;
  min-width: 248px;
}

.leaflet-popup.radar-popup-wrap .leaflet-popup-tip {
  box-shadow: 0 10px 36px rgba(0, 0, 0, 0.12);
}

.radar-popup-inner {
  color: #111827;
  padding: 2px 0 4px;
}

.radar-popup-title {
  font-weight: 800;
  font-size: 1.02rem;
  margin: 0 0 14px;
  line-height: 1.3;
}

.radar-popup-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  font-size: 0.88rem;
  margin: 9px 0;
  line-height: 1.45;
}

.radar-popup-row span:first-child {
  color: #6b7280;
  flex-shrink: 0;
}

.radar-popup-row span:last-child {
  font-weight: 600;
  text-align: right;
}

.radar-popup-muted {
  margin: 0 0 12px;
  font-size: 0.86rem;
  color: #6b7280;
  line-height: 1.5;
}

.radar-popup-actions {
  margin: 20px 0 0;
}

/* Leaflet / browser link styles can override anchor color — force readable CTA. */
.leaflet-popup.radar-popup-wrap a.radar-popup-btn,
.leaflet-popup.radar-popup-wrap a.radar-popup-btn:visited {
  display: inline-block;
  font-size: 0.9rem;
  font-weight: 800;
  color: #ffffff !important;
  background: #1e3a8a;
  text-decoration: none !important;
  padding: 11px 18px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
  letter-spacing: 0.01em;
}

.leaflet-popup.radar-popup-wrap a.radar-popup-btn:hover {
  color: #ffffff !important;
  background: #172554;
  border-color: rgba(255, 255, 255, 0.45);
}

.radar-popup-btn {
  display: inline-block;
  font-size: 0.9rem;
  font-weight: 800;
  color: #ffffff;
  background: #1e3a8a;
  text-decoration: none;
  padding: 11px 18px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.35);
}

.radar-map-wrap {
  background: #ffffff;
  border: 1px solid #dbe2ea;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 18px rgba(15, 23, 42, 0.08);
}

.radar-map {
  height: min(72vh, 640px);
  min-height: 360px;
  width: 100%;
}

.radar-map .leaflet-control-attribution {
  font-size: 10px;
  max-width: 100%;
}

/* Radar page — compact embed for home preview iframe */
html.radar-embed-html,
body.radar-embed.radar-page {
  height: 100%;
  margin: 0;
  overflow: hidden;
}

body.radar-embed.radar-page {
  min-height: 0;
}

body.radar-embed .radar-container {
  max-width: none;
  margin: 0;
  padding: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
}

body.radar-embed .radar-top,
body.radar-embed .radar-toolbar,
body.radar-embed .radar-station-hint {
  display: none !important;
}

body.radar-embed .radar-map-wrap {
  flex: 1;
  min-height: 0;
  border: none;
  border-radius: 0;
  box-shadow: none;
  display: flex;
  flex-direction: column;
}

body.radar-embed .radar-map {
  flex: 1;
  min-height: 160px;
  height: 100%;
  max-height: none;
}

/* ---------- Responsive: phones & narrow viewports ---------- */
.home-btn {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 18px;
  -webkit-tap-highlight-color: rgba(255, 255, 255, 0.15);
}

.home-radar-preview-open {
  -webkit-tap-highlight-color: rgba(255, 255, 255, 0.12);
}

@media (max-width: 720px) {
  .container {
    padding: 18px max(16px, env(safe-area-inset-right)) 20px max(16px, env(safe-area-inset-left));
  }

  body.station-page .top-row {
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
  }

  body.station-page .top-row .back-link {
    justify-content: flex-start;
  }

  .header h1 {
    font-size: clamp(1.35rem, 5.5vw, 2rem);
    line-height: 1.15;
  }

  .home-header h1 {
    font-size: clamp(1.5rem, 6.5vw, 2rem);
  }

  .home-tagline {
    font-size: 0.95rem;
  }

  .home-overview-temp {
    font-size: clamp(2.75rem, 14vw, 4rem);
  }

  .home-overview-temp-unit {
    font-size: 1.25rem;
  }

  .home-overview-place-title {
    font-size: 1.15rem;
  }

  .home-overview-stats {
    font-size: 0.85rem;
  }

  .home-radar-widget {
    padding: 14px max(12px, env(safe-area-inset-left)) 14px max(12px, env(safe-area-inset-right));
  }

  .home-radar-preview-frame {
    height: clamp(200px, 48vw, 260px);
  }

  .radar-title {
    font-size: 1.35rem;
  }

  .radar-map {
    min-height: 280px;
    height: min(62vh, 560px);
  }

  .radar-toolbar-check {
    min-height: 44px;
    padding: 4px 2px;
    align-items: center;
  }

  .radar-toolbar-check input {
    width: 1.15rem;
    height: 1.15rem;
  }

  .sun-time {
    font-size: clamp(1.65rem, 8vw, 2.4rem);
  }

  .sun-svg {
    height: min(180px, 42vw);
  }

  .local-forecast-period {
    font-size: clamp(1.2rem, 6vw, 1.65rem);
  }

  .local-forecast-icon-svg {
    width: min(100px, 26vw);
    height: min(100px, 26vw);
  }
}

@media (max-width: 400px) {
  .home-day-desc {
    font-size: 0.72rem;
  }

  .windrose-legend {
    grid-template-columns: 1fr;
  }
}
