:root {
  color-scheme: dark;

  --bg: #0a1323;
  --surface: #111e32;
  --surface-raised: #172841;
  --line: rgb(255 255 255 / 0.12);
  --line-strong: #4b6581;
  --text: #f4f7fc;
  --muted: #a3b6d0;
  --accent: #6ccaff;

  /* Warnstufen des IPMA. Dieselben Werte stehen in app.js für die Kartenpunkte. */
  --calm: #60c6f9;
  --yellow: #f2d04b;
  --orange: #f28b3c;
  --red: #f25c68;

  --header: 72px;

  /* Bewusst die Systemschrift: Es wird keine Schrift nachgeladen, und die App
     sieht auf jedem Gerät so aus wie dessen eigene Oberfläche. */
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

a {
  color: #8ed7ff;
}

h2 {
  margin: 28px 0 0;
  font-size: 18px;
  letter-spacing: -0.3px;
}

button {
  font: inherit;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.muted {
  color: var(--muted);
}

.small {
  font-size: 12px;
  color: #b4c4d9;
}

/* --- Kopfzeile ----------------------------------------------------------- */

.top {
  height: var(--header);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 28px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.brand {
  font-weight: 800;
  font-size: 21px;
  letter-spacing: -0.6px;
}

.brand span {
  color: #63c9fb;
}

.sub {
  font-size: 12px;
  color: #9aaec9;
}

#status {
  text-align: right;
}

/* --- Aufteilung ---------------------------------------------------------- */

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(340px, 1fr);
  height: calc(100vh - var(--header));
  height: calc(100dvh - var(--header));
}

.mapcol {
  position: relative;
  min-height: 0;
}

#map {
  height: 100%;
  background: #14243a;
}

.panel {
  padding: 30px;
  overflow: auto;
  background: linear-gradient(150deg, #152840, #0b1729);
}

/* --- Karte: Suche, Regionen, Legende ------------------------------------- */

.overlay {
  position: absolute;
  top: 22px;
  left: 22px;
  right: 22px;
  z-index: 500;
  max-width: 380px;
}

.search {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--line-strong);
  border-radius: 13px;
  background: var(--surface-raised);
  color: #fff;
  font: inherit;
  font-size: 15px;
  box-shadow: 0 6px 18px rgb(0 0 0 / 0.25);
}

.search:focus {
  border-color: var(--accent);
  outline: none;
}

.results {
  max-height: 260px;
  margin-top: 5px;
  overflow: auto;
  border-radius: 12px;
  background: var(--surface-raised);
  box-shadow: 0 6px 18px rgb(0 0 0 / 0.25);
}

.results:empty {
  display: none;
}

.result {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 11px 15px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: none;
  color: #fff;
  text-align: left;
  cursor: pointer;
}

.result:last-child {
  border-bottom: 0;
}

.result:hover,
.result:focus-visible {
  background: rgb(255 255 255 / 0.08);
}

.result .small {
  flex: none;
}

.no-result {
  padding: 11px 15px;
  color: var(--muted);
  font-size: 14px;
}

.regions {
  display: inline-flex;
  margin-top: 8px;
  padding: 3px;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  background: var(--surface-raised);
  box-shadow: 0 6px 18px rgb(0 0 0 / 0.25);
}

.region {
  padding: 7px 12px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
}

.region:hover {
  color: #fff;
}

.region[aria-pressed="true"] {
  background: rgb(108 202 255 / 0.18);
  color: #fff;
}

.legend {
  position: absolute;
  right: 12px;
  bottom: 28px;
  z-index: 500;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  max-width: calc(100% - 70px);
  padding: 8px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  background: rgb(23 40 65 / 0.94);
  font-size: 12px;
}

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.dot {
  width: 10px;
  height: 10px;
  border: 1.5px solid #fff;
  border-radius: 50%;
}

.dot.calm {
  background: var(--calm);
}

.dot.yellow {
  background: var(--yellow);
}

.dot.orange {
  background: var(--orange);
}

.dot.red {
  background: var(--red);
}

/* --- Seitenleiste -------------------------------------------------------- */

.eyebrow {
  color: #70cdf5;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 2px;
  text-transform: uppercase;
}

.city {
  margin: 12px 0;
  font-size: 42px;
  font-weight: 800;
  letter-spacing: -1.8px;
  line-height: 1.05;
}

.summary {
  margin-top: 22px;
  padding: 22px;
  border: 1px solid rgb(255 255 255 / 0.13);
  border-radius: 20px;
  background: rgb(255 255 255 / 0.04);
}

.temp {
  font-size: 57px;
  font-weight: 800;
  letter-spacing: -2px;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
}

.condition {
  margin-top: 2px;
  font-size: 18px;
  font-weight: 600;
}

.condition:empty {
  display: none;
}

.summary .muted {
  margin-top: 6px;
}

.days {
  display: grid;
  gap: 9px;
  margin-top: 14px;
}

.day {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) auto 62px;
  align-items: center;
  gap: 4px 14px;
  padding: 13px 14px;
  border: 1px solid rgb(255 255 255 / 0.07);
  border-radius: 13px;
  background: rgb(255 255 255 / 0.04);
  font-size: 14px;
}

.day-name {
  font-weight: 700;
}

.day-weather {
  grid-column: 1;
  color: var(--muted);
  font-size: 13px;
}

.day-temps {
  grid-row: 1 / span 2;
  grid-column: 2;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.day-temps .min {
  color: var(--muted);
}

.day-rain {
  grid-row: 1 / span 2;
  grid-column: 3;
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
  color: #9fd8ff;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.day-rain svg {
  flex: none;
  width: 11px;
  height: 14px;
  fill: currentColor;
}

/* --- Warnungen ----------------------------------------------------------- */

#warnings {
  margin-top: 14px;
}

/* Die Stufe färbt Rand und Fläche der ganzen Karte leicht ein. */
.warn {
  --level: var(--yellow);
  margin-top: 9px;
  padding: 13px 16px;
  border: 1px solid color-mix(in srgb, var(--level) 45%, transparent);
  border-radius: 12px;
  background: color-mix(in srgb, var(--level) 8%, transparent);
}

.warn.orange {
  --level: var(--orange);
}

.warn.red {
  --level: var(--red);
}

.warn-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  font-weight: 700;
}

/* Die Stufe steht immer auch als Wort da, nicht nur als Farbe. */
.badge {
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--level);
  color: #1a1a1a;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.4px;
  text-transform: uppercase;
}

.warn-text {
  margin-top: 6px;
  font-size: 14px;
  line-height: 1.45;
}

.warn-time {
  margin-top: 6px;
}

.notice {
  margin-top: 9px;
  padding: 11px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.retry {
  margin-top: 10px;
  padding: 8px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--surface-raised);
  color: #fff;
  cursor: pointer;
}

.retry:hover {
  border-color: var(--accent);
}

.foot {
  margin-top: 28px;
  color: #94a9c3;
  font-size: 12px;
  line-height: 1.6;
}

.version {
  display: block;
  margin-top: 8px;
  color: #7f93ad;
}

/* --- Schmale Bildschirme ------------------------------------------------- */

@media (max-width: 850px) {
  :root {
    --header: 60px;
  }

  .top {
    padding: 0 16px;
  }

  .brand {
    font-size: 18px;
  }

  .layout {
    display: block;
    height: auto;
  }

  .mapcol {
    height: 56vh;
    min-height: 380px;
  }

  .overlay {
    top: 12px;
    left: 12px;
    right: 12px;
  }

  .search {
    padding: 12px 14px;
    /* Unter 16px zoomt iOS beim Antippen in das Feld hinein. */
    font-size: 16px;
  }

  .legend {
    right: 8px;
    bottom: 24px;
    gap: 3px 10px;
    padding: 6px 9px;
    font-size: 11px;
  }

  .panel {
    padding: 24px 16px 32px;
    overflow: visible;
  }

  .city {
    font-size: 34px;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    animation: none !important;
  }
}
