:root {
  --bg: #0f1419;
  --surface: #1a2332;
  --border: #2d3a4d;
  --text: #e8eef4;
  --muted: #8b9cb3;
  --accent: #3d9cf0;
  --accent-dim: #2563a8;
  --rain: #4ade80;
  --storm: #f87171;
  --wind: #a78bfa;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.45;
}

.header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.header h1 {
  margin: 0 0 0.35rem;
  font-size: 1.35rem;
  font-weight: 600;
}

.subtitle {
  margin: 0;
  font-size: 0.88rem;
  color: var(--muted);
  max-width: 900px;
}

.layout {
  display: grid;
  grid-template-columns: minmax(280px, 340px) 1fr;
  min-height: 62vh;
}

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

.panel {
  padding: 1rem;
  border-right: 1px solid var(--border);
  overflow-y: auto;
  max-height: 62vh;
}

@media (max-width: 900px) {
  .panel {
    border-right: none;
    border-bottom: 1px solid var(--border);
    max-height: none;
  }
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem;
  margin-bottom: 0.75rem;
}

.card h2 {
  margin: 0 0 0.65rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--accent);
}

.card label {
  display: block;
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 0.5rem;
  margin-bottom: 0.25rem;
}

.card input[type="number"],
.card input[type="datetime-local"],
.card input[type="password"],
.card input[type="url"] {
  width: 100%;
  padding: 0.45rem 0.5rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 0.9rem;
}

.file-label {
  display: block;
  cursor: pointer;
}

.file-label input {
  position: absolute;
  width: 0;
  height: 0;
  opacity: 0;
}

.file-label span {
  display: inline-block;
  padding: 0.5rem 0.75rem;
  background: var(--border);
  border-radius: 6px;
  font-size: 0.88rem;
}

.file-label:hover span {
  background: var(--accent-dim);
}

button.primary {
  width: 100%;
  margin-top: 0.75rem;
  padding: 0.6rem 1rem;
  border: none;
  border-radius: 8px;
  background: linear-gradient(180deg, var(--accent), var(--accent-dim));
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  font-size: 0.9rem;
}

button.primary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

button.secondary {
  flex-shrink: 0;
  padding: 0.45rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  font-size: 0.82rem;
  cursor: pointer;
}

button.secondary:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
}

button.secondary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.route-or {
  text-align: center;
  margin: 0.5rem 0 0.15rem !important;
  font-size: 0.72rem !important;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.url-row {
  display: flex;
  align-items: stretch;
  gap: 0.4rem;
}

.url-row input[type="url"] {
  flex: 1;
  min-width: 0;
  margin: 0;
}

.muted {
  color: var(--muted);
  font-size: 0.85rem;
}

.muted.small {
  font-size: 0.78rem;
  margin-bottom: 0.5rem;
}

.check-row {
  display: flex;
  gap: 0.5rem;
  align-items: flex-start;
  margin-top: 0.65rem;
  font-size: 0.82rem;
  color: var(--muted);
  cursor: pointer;
}

.check-row input {
  margin-top: 0.2rem;
  flex-shrink: 0;
}

.check-row span {
  line-height: 1.35;
}

.header a,
.timeline-wrap a {
  color: var(--accent);
}

/* Met-style wind scale (0–60 km/h); colour stops align with tick positions */
.wind-scale-pill {
  display: flex;
  align-items: stretch;
  margin-top: 0.65rem;
  min-height: 26px;
  border-radius: 999px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.wind-scale-unit-tab {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  padding: 0 0.55rem 0 0.65rem;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: #e8ecff;
  background: #3d4a86;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
}

.wind-scale-gradient-wrap {
  position: relative;
  flex: 1;
  min-width: 0;
  min-height: 26px;
}

.wind-scale-gradient {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    #4a5da1 0%,
    #3eaad4 8.333%,
    #4eb052 16.667%,
    #a7bb43 33.333%,
    #b58d4a 50%,
    #a2467d 66.667%,
    #4d7a9b 100%
  );
}

.wind-scale-ticks {
  position: absolute;
  inset: 0;
  pointer-events: none;
  font-size: 0.62rem;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.55);
}

.wind-scale-tick {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
}

.wind-scale-tick-edge-start {
  left: 5px;
  transform: translateY(-50%);
}

.wind-scale-tick-edge-end {
  left: auto;
  right: 5px;
  transform: translateY(-50%);
}

/* Temperature comfort scale 0–36 °C (matches tempComfortToRgb stops in app.js) */
.temp-scale-pill {
  display: flex;
  align-items: stretch;
  margin-top: 0.5rem;
  min-height: 22px;
  border-radius: 999px;
  overflow: hidden;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.temp-scale-pill .temp-scale-unit-tab {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  padding: 0 0.45rem 0 0.55rem;
  font-size: 0.58rem;
  font-weight: 700;
  color: #e0f2fe;
  background: #172554;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.temp-scale-gradient-wrap {
  position: relative;
  flex: 1;
  min-width: 0;
  min-height: 22px;
}

.temp-scale-gradient {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    #1e3a8a 0%,
    #7dd3fc 16.667%,
    #facc15 33.333%,
    #22c55e 50%,
    #f97316 66.667%,
    #dc2626 100%
  );
}

.temp-scale-ticks {
  position: absolute;
  inset: 0;
  pointer-events: none;
  font-size: 0.58rem;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
}

.temp-scale-tick {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
}

.temp-scale-tick-edge-start {
  left: 4px;
  transform: translateY(-50%);
}

.temp-scale-tick-edge-end {
  left: auto;
  right: 4px;
  transform: translateY(-50%);
}

/* Grade |%| 0–25 → blue … black (matches gradePercentToRgb in app.js) */
.grade-scale-pill {
  display: flex;
  align-items: stretch;
  margin-top: 0.5rem;
  min-height: 22px;
  border-radius: 999px;
  overflow: hidden;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.grade-scale-pill .grade-scale-unit-tab {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  padding: 0 0.45rem 0 0.55rem;
  font-size: 0.58rem;
  font-weight: 700;
  color: #e0e7ff;
  background: #1e1b4b;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.grade-scale-gradient-wrap {
  position: relative;
  flex: 1;
  min-width: 0;
  min-height: 22px;
}

.grade-scale-gradient {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    #2563eb 0%,
    #4f46e5 34%,
    #7c3aed 67%,
    #0a0a0a 100%
  );
}

.grade-scale-ticks {
  position: absolute;
  inset: 0;
  pointer-events: none;
  font-size: 0.58rem;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
}

.grade-scale-tick {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
}

.grade-scale-tick-edge-start {
  left: 4px;
  transform: translateY(-50%);
}

.grade-scale-tick-edge-end {
  left: auto;
  right: 4px;
  transform: translateY(-50%);
}

.leaflet-div-icon.route-endpoint-divicon {
  background: transparent !important;
  border: none !important;
}

.route-endpoint-start svg,
.route-endpoint-finish svg {
  display: block;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.45));
}

.legend {
  margin: 0;
  padding-left: 1.1rem;
  font-size: 0.82rem;
  color: var(--muted);
}

.legend li {
  margin-bottom: 0.35rem;
}

.swatch {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 3px;
  vertical-align: middle;
  margin-right: 6px;
}

.swatch.wind {
  background: var(--wind);
}

.swatch.route-temp {
  background: linear-gradient(
    90deg,
    #1e3a8a 0%,
    #7dd3fc 20%,
    #facc15 40%,
    #22c55e 55%,
    #f97316 75%,
    #dc2626 100%
  );
}

.swatch.rain {
  background: var(--rain);
}

.swatch.storm {
  background: var(--storm);
}

.swatch.swatch-start {
  width: 20px;
  border-radius: 2px;
  background: linear-gradient(
    90deg,
    #16a34a 0%,
    #16a34a 45%,
    #f9fafb 45%,
    #f9fafb 55%,
    #111827 55%,
    #111827 100%
  );
}

.map-wrap {
  position: relative;
  min-height: 400px;
}

#map {
  position: absolute;
  inset: 0;
  background: #1e293b;
}

.timeline-wrap {
  padding: 1rem 1.25rem 2rem;
  border-top: 1px solid var(--border);
}

.timeline-wrap h2 {
  margin: 0 0 0.35rem;
  font-size: 1rem;
}

.charts-intro {
  margin: 0 0 1rem;
  max-width: 720px;
}

.charts-empty {
  margin: 0;
  padding: 1.25rem;
  border: 1px dashed var(--border);
  border-radius: 8px;
  text-align: center;
}

.charts-empty.hidden {
  display: none;
}

.charts-content.hidden {
  display: none;
}

.chart-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem 1rem 0.75rem;
  margin-bottom: 1rem;
}

.chart-card--sunshine {
  margin-bottom: 0;
  border-color: rgba(251, 191, 36, 0.22);
  box-shadow: 0 0 0 1px rgba(234, 88, 12, 0.08);
}

.chart-headline {
  font-size: 1.65rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 0.15rem;
}

.chart-headline .wind-head-main {
  display: block;
}

.chart-headline .sub {
  display: block;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--muted);
  margin-top: 0.2rem;
}

.chart-subtitle {
  margin: 0 0 0.5rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--accent);
}

.wind-arrow-strip {
  position: relative;
  height: 45px;
  margin: 0.35rem 0 0.25rem;
  border-bottom: 1px solid var(--border);
}

.wind-arrow-slot {
  position: absolute;
  bottom: 4px;
  width: 28px;
  height: 28px;
  margin-left: -14px;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  color: rgba(232, 238, 244, 0.92);
}

.wind-arrow-slot svg {
  width: 22.5px;
  height: 22.5px;
  filter: drop-shadow(0 0 2px rgba(0, 0, 0, 0.9));
}

.chart-canvas-wrap {
  position: relative;
  height: 200px;
  margin-top: 0.5rem;
}

.chart-canvas-wrap--tall {
  height: 260px;
}

.chart-legend-inline {
  margin: 0.5rem 0 0;
  padding-bottom: 0.25rem;
}

.progress-wrap {
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  margin-top: 0.5rem;
  overflow: hidden;
}

.progress-wrap.hidden {
  display: none;
}

.progress-bar {
  height: 100%;
  width: 0%;
  background: var(--accent);
  transition: width 0.2s ease;
}

/* Leaflet wind marker */
.wind-marker-inner {
  width: 35px;
  height: 35px;
  display: flex;
  align-items: center;
  justify-content: center;
  transform-origin: center center;
}

.wind-marker-inner svg {
  width: 30px;
  height: 30px;
  filter: drop-shadow(0 0 2px rgba(0, 0, 0, 0.8));
}

.event-marker {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 0 4px rgba(0, 0, 0, 0.6);
}

.event-marker.rain {
  background: var(--rain);
}

.event-marker.storm {
  background: var(--storm);
}

.leaflet-div-icon.wind-leaflet-icon,
.leaflet-div-icon.event-leaflet-icon {
  background: transparent;
  border: none;
}
