:root {
  --background: #eef2f5;
  --surface: #ffffff;
  --navy: #10263d;
  --text: #172330;
  --muted: #687786;
  --border: #d9e0e6;
  --green: #15805d;
  --green-light: #e1f5ed;
  --blue: #1976a3;
  --shadow: 0 10px 30px rgba(16, 38, 61, 0.08);
  --shadow-hover: 0 16px 38px rgba(16, 38, 61, 0.13);
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background: var(--background);
  font-family:
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    Arial,
    sans-serif;
}

button {
  font: inherit;
}

.page {
  width: min(100% - 28px, 1100px);
  margin: 0 auto;
  padding: 22px 0 40px;
}

/* Kopfbereich */

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 19px 22px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
}

.airport-heading {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.airport-icon {
  display: grid;
  flex: 0 0 auto;
  width: 46px;
  height: 46px;
  place-items: center;
  color: white;
  background: var(--navy);
  border-radius: 12px;
  font-family: Arial, sans-serif;
  font-size: 23px;
  line-height: 1;
  box-shadow: 0 6px 14px rgba(16, 38, 61, 0.18);
}

.airport-label {
  margin: 0 0 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.airport-name {
  margin: 0;
  color: var(--navy);
  font-size: clamp(20px, 4vw, 28px);
  line-height: 1.15;
}

.header-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 12px;
}

/* Sprachauswahl */

.language-switch {
  display: flex;
  align-items: center;
  padding: 3px;
  background: #edf1f4;
  border: 1px solid var(--border);
  border-radius: 999px;
}

.language-button {
  display: grid;
  min-width: 37px;
  height: 30px;
  padding: 0 9px;
  place-items: center;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0.05em;
  transition:
    color 160ms ease,
    background 160ms ease,
    box-shadow 160ms ease;
}

.language-button.is-active {
  color: white;
  background: var(--navy);
  box-shadow: 0 3px 8px rgba(16, 38, 61, 0.2);
}

.language-button:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 2px;
}

@media (hover: hover) {
  .language-button:not(.is-active):hover {
    color: var(--navy);
    background: #dfe6eb;
  }
}

/* Status */

.status {
  --status-color: #687786;
  --status-background: #edf1f4;
  --status-ring: rgba(104, 119, 134, 0.13);

  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 9px;
  padding: 9px 13px;
  color: var(--status-color);
  background: var(--status-background);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.status[data-state="current"] {
  --status-color: var(--green);
  --status-background: var(--green-light);
  --status-ring: rgba(21, 128, 93, 0.13);
}

.status[data-state="stale"] {
  --status-color: #9b4d00;
  --status-background: #fff0d8;
  --status-ring: rgba(217, 119, 6, 0.13);
}

.status[data-state="error"] {
  --status-color: #9b1c1c;
  --status-background: #fde8e8;
  --status-ring: rgba(197, 48, 48, 0.13);
}

.status-dot {
  width: 9px;
  height: 9px;
  background: var(--status-color);
  border-radius: 50%;
  box-shadow: 0 0 0 4px var(--status-ring);
  animation: status-pulse 1.8s ease-in-out infinite;
}

@keyframes status-pulse {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
    box-shadow: 0 0 0 4px var(--status-ring);
  }

  50% {
    opacity: 0.75;
    transform: scale(0.9);
    box-shadow: 0 0 0 8px var(--status-ring);
  }
}

/* Messzeit */

.update-row {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  margin: 16px 0;
  padding: 0 4px;
  color: var(--muted);
  font-size: 14px;
  text-align: left;
}

.update-row time {
  color: var(--text);
  font-weight: 750;
}

/* Warnhinweis */

.data-warning {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 0 0 16px;
  padding: 13px 15px;
  color: #7a3e00;
  background: #fff4df;
  border: 1px solid #efc77f;
  border-radius: 13px;
  font-size: 13px;
  line-height: 1.45;
}

.data-warning[hidden] {
  display: none;
}

.data-warning[data-state="error"] {
  color: #8f1d1d;
  background: #fff0f0;
  border-color: #efb2b2;
}

.data-warning strong {
  flex: 0 0 auto;
}

/* Wetterkarten */

.weather-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.weather-card {
  display: flex;
  min-width: 0;
  min-height: 145px;
  flex-direction: column;
  justify-content: space-between;
  padding: 20px 22px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
  transition:
    transform 180ms ease,
    box-shadow 180ms ease,
    border-color 180ms ease;
}

.weather-grid[data-state="stale"] .weather-card {
  border-color: #dfb364;
}

.weather-grid[data-state="error"] .weather-card {
  border-color: #dda0a0;
}

.card-label {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.main-value {
  margin: 28px 0 0;
  color: var(--navy);
  font-size: clamp(44px, 5vw, 64px);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 0.95;
  letter-spacing: -0.055em;
  white-space: nowrap;
}

.unit {
  margin-left: 5px;
  color: var(--muted);
  font-size: 17px;
  font-weight: 650;
  letter-spacing: 0;
}

/* Wind */

.wind-values {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-top: auto;
}

.wind-value {
  margin: 0;
  color: var(--navy);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.wind-value strong {
  color: var(--navy);
  font-size: 40px;
  font-weight: 800;
  line-height: 1;
}

.wind-divider {
  flex: 0 0 auto;
  width: 1px;
  height: 40px;
  margin: 0 10px;
  background: var(--border);
}

.wind-degrees {
  text-align: right;
}

.wind-calm {
  display: none;
  width: 100%;
  margin: 0;
  color: var(--navy);
  font-size: 40px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0.04em;
}

.wind-values.is-calm .wind-value,
.wind-values.is-calm .wind-divider {
  display: none;
}

.wind-values.is-calm .wind-calm {
  display: block;
}

/* Luftdruck */

.qnh-card {
  color: white;
  background: var(--blue);
  border-color: var(--blue);
}

.qnh-card .card-label {
  color: rgba(255, 255, 255, 0.73);
}

.qnh-card .main-value,
.qnh-card .unit {
  color: white;
}

/* Wetteransage */

.audio-card {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-top: 16px;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.audio-card[data-state="error"] {
  border-color: #dda0a0;
}

.audio-card[data-state="error"] .play-symbol {
  color: #9b1c1c;
}

.audio-button {
  display: flex;
  flex: 1;
  align-items: center;
  gap: 16px;
  min-height: 67px;
  padding: 13px 20px;
  color: white;
  background: var(--navy);
  border: 0;
  border-radius: 13px;
  cursor: pointer;
  text-align: left;
  transition:
    background 160ms ease,
    transform 160ms ease;
}

.audio-button:hover {
  background: #193853;
  transform: translateY(-1px);
}

@media (hover: none) {
  .audio-button:active {
    background: #193853;
    transform: scale(0.985);
  }
}

.audio-button:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 3px;
}

.play-symbol {
  display: grid;
  flex: 0 0 auto;
  width: 39px;
  height: 39px;
  place-items: center;
  color: var(--navy);
  background: white;
  border-radius: 50%;
  font-size: 15px;
}

.audio-text {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 4px;
}

.audio-text strong {
  font-size: 16px;
}

.audio-text small {
  color: rgba(255, 255, 255, 0.68);
  font-size: 13px;
}

.audio-time {
  min-width: 90px;
  padding-right: 7px;
  color: var(--muted);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

/* Hinweis */

.footer {
  padding: 23px 6px 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
  text-align: center;
}

/* Maus und Bewegung */

@media (hover: hover) {
  .weather-card:hover {
    transform: translateY(-3px);
    border-color: #b7c4ce;
    box-shadow: var(--shadow-hover);
  }

  .qnh-card:hover {
    border-color: var(--blue);
  }
}

/* Reduzierte Bewegung */

@media (prefers-reduced-motion: reduce) {
  .weather-card,
  .audio-button,
  .language-button {
    transition: none;
  }

  .status-dot {
    animation: none;
  }

  .weather-card:hover,
  .audio-button:hover {
    transform: none;
  }
}

/* Tablet */

@media (max-width: 900px) {
  .weather-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Smartphone */

@media (max-width: 560px) {
  body {
    padding-right: env(safe-area-inset-right);
    padding-left: env(safe-area-inset-left);
  }

  .page {
    width: calc(100% - 20px);
    padding-top: calc(10px + env(safe-area-inset-top));
    padding-bottom: calc(28px + env(safe-area-inset-bottom));
  }

  .header {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 15px;
    border-radius: 13px;
  }

  .airport-heading {
    gap: 10px;
  }

  .airport-heading > div {
    min-width: 0;
  }

  .airport-icon {
    width: 39px;
    height: 39px;
    border-radius: 10px;
    font-size: 20px;
  }

  .airport-label {
    margin-bottom: 4px;
    font-size: 10px;
  }

  .airport-name {
    font-size: clamp(18px, 5vw, 20px);
    line-height: 1.2;
    overflow-wrap: anywhere;
  }

  .header-actions {
    width: 100%;
    align-items: stretch;
    gap: 8px;
  }

  .language-switch {
    flex: 0 0 auto;
    border-radius: 10px;
  }

  .language-button {
    min-width: 35px;
    height: 28px;
    padding: 0 7px;
    border-radius: 8px;
    font-size: 10px;
  }

  .status {
    flex: 1;
    justify-content: center;
    min-height: 36px;
    padding: 7px 10px;
    border-radius: 10px;
    font-size: 10px;
  }

  .update-row {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: start;
    gap: 5px 8px;
    margin: 13px 3px;
    font-size: 12px;
  }

  .update-row time {
    line-height: 1.4;
  }

  .data-warning {
    flex-direction: column;
    gap: 3px;
    margin-bottom: 13px;
    padding: 11px 12px;
    border-radius: 11px;
    font-size: 12px;
  }

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

  .weather-card {
    min-width: 0;
    min-height: 125px;
    padding: 13px 14px;
    border-radius: 14px;
  }

  .card-label {
    font-size: 10px;
    letter-spacing: 0.06em;
  }

  .main-value {
    margin-top: 22px;
    font-size: clamp(34px, 10vw, 42px);
    letter-spacing: -0.045em;
  }

  .unit {
    margin-left: 3px;
    font-size: 13px;
  }

  .wind-value strong,
  .wind-calm {
    font-size: clamp(28px, 8vw, 34px);
  }

  .wind-divider {
    height: 34px;
    margin: 0 4px;
  }

  .audio-card {
    position: sticky;
    z-index: 20;
    bottom: calc(8px + env(safe-area-inset-bottom));
    gap: 8px;
    padding: 10px;
    border-radius: 15px;
    box-shadow: 0 14px 35px rgba(16, 38, 61, 0.2);
  }

  .audio-button {
    width: 100%;
    min-height: 70px;
    padding: 11px 14px;
  }

  .audio-text strong {
    font-size: 15px;
  }

  .audio-text small {
    font-size: 12px;
    line-height: 1.35;
  }

  .audio-time {
    display: none;
  }

  .footer {
    padding-top: 19px;
    font-size: 11px;
  }
}

/* Besonders schmale Smartphones */

@media (max-width: 360px) {
  .wind-values:not(.is-calm) {
    flex-direction: column;
    align-items: stretch;
    gap: 7px;
  }

  .wind-values:not(.is-calm) .wind-divider {
    width: 100%;
    height: 1px;
    margin: 0;
  }

  .wind-degrees {
    text-align: left;
  }
}