:root {
  --bg: #eef4f7;
  --panel: rgba(255, 255, 255, 0.92);
  --panel-soft: rgba(255, 255, 255, 0.76);
  --ink: #122026;
  --muted: #4b6370;
  --accent: #0a6d77;
  --accent-dark: #084f57;
  --border: rgba(18, 32, 38, 0.12);
  --shadow: 0 18px 50px rgba(18, 32, 38, 0.12);
  --radius: 20px;
  --font-sans: "Avenir Next", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  font-family: var(--font-sans);
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(10, 109, 119, 0.14), transparent 30%),
    linear-gradient(160deg, #f6fbfd 0%, #e5eef2 100%);
}

body {
  min-height: 100vh;
}

.layout {
  display: grid;
  grid-template-columns: 380px 1fr;
  min-height: 100vh;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 24px;
  background: var(--panel);
  border-right: 1px solid var(--border);
  backdrop-filter: blur(16px);
}

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

h1 {
  margin: 0;
  font-size: 2rem;
  line-height: 1;
}

h2 {
  margin: 0;
  font-size: 1rem;
}

.lede,
footer p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.controls,
.legend-card {
  display: grid;
  gap: 14px;
  padding: 16px;
  background: var(--panel-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.date-toolbar {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  align-items: end;
}

.date-label {
  min-width: 0;
}

.date-nav {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.view-summary {
  position: relative;
  display: grid;
  gap: 6px;
}

.view-summary-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: fit-content;
  margin: 0;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(10, 109, 119, 0.1);
  color: var(--accent-dark);
  font-size: 0.85rem;
  font-weight: 600;
}

.control-note,
.section-meta,
.legend-kicker,
.time-value {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.legend-kicker {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.75rem;
}

[hidden] {
  display: none !important;
}

label {
  display: grid;
  gap: 6px;
  font-size: 0.92rem;
  color: var(--muted);
}

input,
select,
button {
  width: 100%;
  border-radius: 14px;
  border: 1px solid var(--border);
  padding: 10px 12px;
  font: inherit;
}

input[type="range"] {
  padding: 0;
}

button {
  background: linear-gradient(135deg, #0a6d77, #138a92);
  color: white;
  border: 0;
  cursor: pointer;
  font-weight: 600;
}

.secondary-button {
  background: white;
  color: var(--ink);
  border: 1px solid var(--border);
  box-shadow: none;
}

.date-toolbar .secondary-button,
.map-actions .secondary-button {
  width: auto;
}

.secondary-button.compact {
  width: auto;
  padding-inline: 12px;
}

.info-button {
  width: 30px;
  height: 30px;
  padding: 0;
  border-radius: 999px;
  background: #1b6fd8;
  color: white;
  font-weight: 700;
  line-height: 1;
  box-shadow: none;
}

.info-popover {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 30;
  display: grid;
  gap: 8px;
  width: min(320px, calc(100vw - 96px));
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid rgba(27, 111, 216, 0.18);
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 16px 40px rgba(18, 32, 38, 0.16);
}

.section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 10px;
}

.favorites-list {
  list-style: none;
  display: grid;
  gap: 10px;
  padding: 0;
  margin: 0;
  overflow: auto;
}

.favorite-card {
  padding: 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--border);
  cursor: pointer;
}

.favorite-card h3,
.favorite-card p {
  margin: 0;
}

.favorite-card h3 {
  margin-bottom: 6px;
  font-size: 1rem;
}

.favorite-card p {
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
}

.favorite-meta {
  margin-top: 8px;
}

.map-wrap {
  position: relative;
  padding: 18px;
}

#map {
  width: 100%;
  height: calc(100vh - 36px);
  border-radius: 28px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.map-overlay {
  position: absolute;
  top: 34px;
  left: 34px;
  right: 34px;
  z-index: 600;
  pointer-events: none;
}

.floating {
  width: min(560px, 100%);
  pointer-events: auto;
}

.legend-card.legend-actions-only {
  padding: 12px 14px;
}

.legend-card.legend-actions-only .legend-header {
  justify-content: flex-end;
}

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

.map-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.legend-scale {
  display: grid;
  gap: 4px;
}

.legend-step {
  height: 14px;
  border-radius: 999px;
}

.legend-labels {
  display: grid;
  gap: 6px;
  margin-top: 6px;
}

.legend-label {
  text-align: center;
  font-size: 0.78rem;
  color: var(--muted);
}

.legend-unit {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.weather-symbol {
  background: transparent;
  border: 0;
}

.metric-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
  text-shadow:
    0 0 3px rgba(255, 255, 255, 0.96),
    0 0 8px rgba(255, 255, 255, 0.92);
}

.metric-marker {
  background: transparent;
  border: 0;
}

.metric-stack {
  display: grid;
  justify-items: center;
  gap: 3px;
}

.metric-arrow {
  display: inline-block;
  transform: rotate(var(--rotation, 0deg));
  transform-origin: center center;
}

.symbol-marker {
  display: grid;
  justify-items: center;
  gap: 4px;
}

.symbol-meta {
  display: grid;
  justify-items: center;
  gap: 3px;
}

.symbol-core {
  display: grid;
  place-items: center;
  min-width: 34px;
  min-height: 34px;
  padding: 5px 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid rgba(18, 32, 38, 0.12);
  box-shadow: 0 8px 24px rgba(18, 32, 38, 0.18);
  font-size: 1.35rem;
}

.symbol-glyph {
  display: inline-grid;
  place-items: center;
}

.symbol-fog {
  display: grid;
  justify-items: center;
  line-height: 0.9;
}

.symbol-fog-cloud {
  font-size: 1.35rem;
}

.symbol-fog-lines {
  margin-top: -4px;
  font-size: 0.85rem;
  letter-spacing: -0.08em;
  color: #6a7b86;
}

.wind-marker {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0;
  white-space: nowrap;
  background: transparent;
  border: 0;
  box-shadow: none;
  filter: drop-shadow(0 1px 1px rgba(255, 255, 255, 0.95));
}

.wind-arrow {
  display: inline-block;
  font-size: 1.1rem;
  transform: rotate(var(--rotation, 0deg));
  transform-origin: center center;
}

.wind-speed {
  font-size: 0.82rem;
  color: var(--ink);
  font-weight: 600;
  text-shadow:
    0 0 3px rgba(255, 255, 255, 0.96),
    0 0 8px rgba(255, 255, 255, 0.92);
}

.leaflet-popup-content {
  line-height: 1.45;
}

@media (max-width: 1180px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .map-overlay {
    position: static;
    margin-bottom: 14px;
    pointer-events: auto;
  }

  .floating {
    width: 100%;
  }

  .map-wrap {
    display: grid;
    gap: 14px;
  }

  #map {
    height: 65vh;
  }
}

@media (max-width: 720px) {
  .view-summary-header {
    align-items: flex-start;
  }

  .info-popover {
    left: 0;
    right: auto;
    width: 100%;
  }

  .legend-header {
    flex-direction: column;
  }

  .map-actions {
    justify-content: flex-start;
  }

  .date-nav {
    grid-template-columns: 1fr;
  }
}
