:root {
  --bg: #f5f7fa;
  --surface: #ffffff;
  --surface-subtle: #f1f4f8;
  --text: #0f172a;
  --text-muted: #5b6577;
  --border: rgba(15, 23, 42, 0.08);
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 14px 36px rgba(15, 23, 42, 0.05);

  --aqi-good: #10b981;
  --aqi-mod: #f59e0b;
  --aqi-usg: #ea580c;
  --aqi-unhealthy: #e11d48;
  --aqi-very: #7c3aed;
  --aqi-haz: #881337;
  --live-green: #059669;
  --live-green-soft: rgba(16, 185, 129, 0.14);
  --logo-bg: #0f172a;

  --accent: var(--aqi-good);
  --accent-soft: rgba(22, 163, 74, 0.12);

  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-pill: 999px;
}

[data-theme="dark"] {
  --bg: #0a0d14;
  --surface: #121722;
  --surface-subtle: #1a2130;
  --text: #f3f6fb;
  --text-muted: #94a3b8;
  --border: rgba(255, 255, 255, 0.08);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 18px 44px rgba(0, 0, 0, 0.4);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Inter", "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}

.container {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 20px;
}

/* TOPBAR & ANIMATED RADAR LOGO */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  background: color-mix(in srgb, var(--bg) 84%, transparent);
  border-bottom: 1px solid var(--border);
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 70px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
  font-size: 1.08rem;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.aqi24-logo {
  width: 36px;
  height: 36px;
  display: inline-flex;
  color: var(--accent);
}
.aqi24-logo svg { width: 100%; height: 100%; }

.brand-name {
  font-size: 1.24rem;
  letter-spacing: -0.04em;
}
.brand-24 {
  color: var(--live-green);
  font-weight: 800;
}

.logo-live-blink {
  animation: liveBlink 1.6s ease-in-out infinite;
}

@keyframes liveBlink {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.25; }
}

.search-wrap {
  position: relative;
  flex: 1;
  max-width: 440px;
}

.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--text-muted);
  pointer-events: none;
}

.search-input {
  width: 100%;
  height: 44px;
  padding: 0 42px 0 42px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 0.94rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.search-kbd {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  padding: 2px 7px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface-subtle);
  color: var(--text-muted);
  font-size: 0.74rem;
  font-weight: 700;
  pointer-events: none;
}

.search-clear {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 0;
  background: var(--surface-subtle);
  color: var(--text-muted);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.search-clear:hover { color: var(--text); }

.search-results {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 18px 48px rgba(15, 23, 42, 0.14);
  overflow: hidden;
  z-index: 60;
  max-height: 420px;
  overflow-y: auto;
}

.search-group-label {
  padding: 10px 16px 6px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.search-item {
  display: grid;
  grid-template-columns: 26px 1fr auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 11px 16px;
  border: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  font-size: 0.94rem;
}

.search-item:hover,
.search-item.is-active {
  background: var(--surface-subtle);
}

.search-item-main strong { display: block; font-weight: 700; line-height: 1.25; }
.search-item-main span { color: var(--text-muted); font-size: 0.8rem; }
.search-item-meta { color: var(--text-muted); font-size: 0.76rem; font-variant-numeric: tabular-nums; }
.search-geo-icon {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--live-green-soft);
  color: var(--live-green);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.search-geo-icon svg { width: 14px; height: 14px; }
.search-empty { padding: 16px; text-align: center; font-size: 0.86rem; color: var(--text-muted); }

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.scale-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.info-btn {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  font-weight: 700;
  font-size: 0.8rem;
  cursor: pointer;
}
.info-btn:hover { color: var(--text); border-color: var(--text-muted); }

.scale-popover {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 300px;
  padding: 16px;
  border-radius: var(--radius-md);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  font-size: 0.84rem;
  line-height: 1.45;
  color: var(--text-muted);
  z-index: 60;
}
.scale-popover strong { color: var(--text); }

.segmented {
  display: inline-flex;
  padding: 3px;
  border-radius: var(--radius-pill);
  background: var(--surface-subtle);
  border: 1px solid var(--border);
}

.seg-btn {
  border: 0;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 600;
  padding: 7px 12px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
  white-space: nowrap;
}

.seg-btn.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.icon-btn svg { width: 18px; height: 18px; }
[data-theme="light"] .icon-sun { display: none; }
[data-theme="dark"] .icon-moon { display: none; }

/* MAIN */
.main {
  padding-top: 22px;
  padding-bottom: 64px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.quick-cities {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
}
.quick-cities::-webkit-scrollbar { display: none; }

.city-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  padding: 7px 14px;
  border-radius: var(--radius-pill);
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
}

.pill-flag {
  width: 18px;
  height: 13px;
  border-radius: 2px;
  overflow: hidden;
  display: inline-flex;
  flex-shrink: 0;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.08);
}
.city-pill:hover { color: var(--text); }
.city-pill.active {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
}

/* STARTSEITEN-HERO (WasserLive-inspiriert) */
.home-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 28px 20px 12px;
  gap: 14px;
}

.home-hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  background: var(--live-green-soft);
  color: var(--live-green);
  font-size: 0.82rem;
  font-weight: 700;
}

.home-hero-title {
  margin: 0;
  font-size: clamp(2rem, 4.5vw, 3.1rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.08;
}

.home-hero-sub {
  margin: 0;
  color: var(--text-muted);
  font-size: 1.02rem;
  max-width: 54ch;
}

.hero-search-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  max-width: 660px;
  margin-top: 6px;
}

.hero-search-box {
  position: relative;
  flex: 1;
}

.hero-search-input {
  width: 100%;
  height: 54px;
  padding: 0 20px 0 46px;
  border-radius: var(--radius-pill);
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 1rem;
  box-shadow: var(--shadow);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.hero-search-input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }

.hero-geo-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 54px;
  padding: 0 22px;
  border-radius: var(--radius-pill);
  border: 0;
  background: var(--live-green);
  color: #ffffff;
  font-size: 0.94rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 6px 18px rgba(16, 185, 129, 0.28);
  transition: transform 0.15s, opacity 0.2s;
}
.hero-geo-btn:hover { transform: translateY(-1px); opacity: 0.94; }
.hero-geo-btn svg { width: 18px; height: 18px; }

.region-cards-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

.region-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding: 20px 22px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform 0.15s, border-color 0.2s;
}
.region-card:hover { transform: translateY(-2px); border-color: var(--accent); }
.region-card-eyebrow { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--live-green); }
.region-card-title { font-size: 1.2rem; font-weight: 800; letter-spacing: -0.02em; }
.region-card-meta { font-size: 0.8rem; color: var(--text-muted); }

@media (max-width: 900px) {
  .region-cards-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
  .hero-search-row { flex-direction: column; }
  .hero-geo-btn { width: 100%; justify-content: center; }
}

/* HERO CARD WITH RADIAL GAUGE */
.hero-card {
  position: relative;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 36px;
  box-shadow: var(--shadow);
  background-image: radial-gradient(circle at 22% 18%, var(--accent-soft), transparent 48%);
}

.hero-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 24px;
}

.hero-location {
  display: flex;
  align-items: center;
  gap: 14px;
}

.hero-flag {
  display: inline-flex;
  width: 48px;
  height: 34px;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.14);
  flex-shrink: 0;
}

.eyebrow {
  margin: 0 0 3px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.city-title {
  margin: 0;
  font-size: clamp(2.4rem, 5vw, 3.5rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.04;
}

.live-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 5px;
}

.live-pill-green {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  border-radius: var(--radius-pill);
  background: var(--live-green-soft);
  color: var(--live-green);
  border: 1px solid rgba(16, 185, 129, 0.28);
  font-size: 0.88rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
}

[data-theme="dark"] .live-pill-green { color: #34d399; }

.live-dot-green {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #10b981;
  animation: livePulse 1.8s infinite;
}

@keyframes livePulse {
  0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.55); }
  70% { box-shadow: 0 0 0 9px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}

.clock-colon {
  animation: blinkColon 1s steps(2, start) infinite;
}

@keyframes blinkColon {
  to { opacity: 0.2; }
}

.updated-at { font-size: 0.8rem; color: var(--live-green); font-weight: 600; opacity: 0.85; }
[data-theme="dark"] .updated-at { color: #34d399; }

.hero-grid {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 36px;
  align-items: center;
}

.hero-score-col {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.score-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.score-main {
  display: flex;
  align-items: center;
  gap: 24px;
}

.aqi-scale-pill {
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 5px 11px;
  border-radius: var(--radius-pill);
  background: var(--surface-subtle);
}

.aqi-number {
  font-size: clamp(5.2rem, 10vw, 7.2rem);
  font-weight: 800;
  letter-spacing: -0.055em;
  line-height: 0.9;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.score-status-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.aqi-status {
  font-size: clamp(1.5rem, 2.5vw, 2rem);
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: 1.1;
}

.secondary-aqi-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 13px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--surface-subtle);
  color: var(--text);
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: border-color 0.2s, transform 0.15s;
}
.secondary-aqi-pill:hover { border-color: var(--accent); transform: translateY(-1px); }
.switch-hint { color: var(--text-muted); font-weight: 500; font-size: 0.74rem; }

.map-controls { display: flex; flex-wrap: wrap; gap: 8px; }

.aqi-summary {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.96rem;
  max-width: 38ch;
}

/* CLEAN HORIZONTAL SCALE BAR */
.scale-bar-wrap {
  position: relative;
  width: 100%;
  padding-top: 10px;
}

.scale-track {
  height: 12px;
  border-radius: 99px;
  width: 100%;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.08);
}

.hero-scale-seg {
  display: inline-flex;
  padding: 4px;
  border-radius: var(--radius-pill);
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  align-self: flex-start;
  gap: 2px;
}

.hero-seg-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 0;
  background: transparent;
  color: var(--text-muted);
  padding: 7px 16px;
  border-radius: var(--radius-pill);
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.hero-seg-btn strong {
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  padding: 1px 7px;
  border-radius: var(--radius-pill);
  background: color-mix(in srgb, var(--text) 7%, transparent);
  color: var(--text);
}

.hero-seg-btn.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
}

.hero-seg-btn.active strong {
  background: var(--accent-soft);
  color: var(--accent);
}

.scale-explain {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.scale-marker {
  position: absolute;
  top: 33px;
  transform: translateX(-50%);
  transition: left 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

.scale-marker-pin {
  display: block;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--surface);
  border: 5px solid var(--accent);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.22);
}

.scale-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 10px;
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

/* HERO METRIC CARDS */
.hero-metrics-col {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.metric-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.metric-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  border-radius: var(--radius-lg);
  background: var(--surface-subtle);
  border: 1px solid var(--border);
}

.metric-icon-wrap {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: var(--accent-soft);
  color: var(--accent);
}

.metric-icon-wrap svg { width: 22px; height: 22px; }
.icon-green { background: rgba(22, 163, 74, 0.12); color: #16a34a; }
.icon-blue { background: rgba(59, 130, 246, 0.12); color: #3b82f6; }
.icon-cyan { background: rgba(6, 182, 212, 0.12); color: #0891b2; }

.metric-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.metric-label {
  font-size: 0.76rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.metric-value {
  font-size: 1.12rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}

.metric-sub { font-size: 0.82rem; color: var(--text-muted); }

.metric-badge {
  display: inline-flex;
  align-self: flex-start;
  margin-top: 2px;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  font-size: 0.78rem;
  font-weight: 700;
  background: var(--accent-soft);
  color: var(--accent);
}

.badge-good {
  background: rgba(22, 163, 74, 0.12);
  color: #15803d;
}
[data-theme="dark"] .badge-good { color: #4ade80; }

/* CARDS */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 32px;
  box-shadow: var(--shadow);
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}

.section-title {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.025em;
}

.section-sub {
  margin: 4px 0 0;
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* RADAR MAP */
.radar-canvas-wrap {
  position: relative;
  width: 100%;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: radial-gradient(circle at 50% 45%, #111c2d 0%, #090e18 100%);
  border: 1px solid var(--border);
}

.radar-canvas {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1020 / 440;
  cursor: pointer;
}

.map-tooltip {
  position: absolute;
  pointer-events: none;
  background: rgba(15, 23, 42, 0.94);
  color: #f8fafc;
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 0.82rem;
  font-weight: 600;
  border: 1px solid rgba(255, 255, 255, 0.14);
  backdrop-filter: blur(8px);
  transform: translate(-50%, -125%);
  white-space: nowrap;
  z-index: 10;
}

/* TIMELINE */
.scrubber-readout {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  padding: 14px 18px;
  border-radius: var(--radius-md);
  background: var(--surface-subtle);
  margin-bottom: 18px;
}

.readout-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.readout-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--accent);
}

.readout-time {
  font-weight: 800;
  font-size: 1rem;
  font-variant-numeric: tabular-nums;
}

.readout-status {
  font-size: 0.84rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  background: var(--accent-soft);
  color: var(--accent);
}

.readout-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.readout-pill {
  font-size: 0.86rem;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  font-variant-numeric: tabular-nums;
}
.readout-pill strong { color: var(--text); }

.timeline-chart-wrap {
  position: relative;
  width: 100%;
  user-select: none;
  touch-action: pan-y;
  cursor: crosshair;
}

.timeline-svg {
  width: 100%;
  height: 310px;
  display: block;
  overflow: visible;
}

.timeline-axis {
  display: flex;
  justify-content: space-between;
  margin-top: 10px;
  font-size: 0.8rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.aqi-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  font-size: 0.82rem;
  color: var(--text-muted);
}

.legend-item { display: inline-flex; align-items: center; gap: 7px; }
.legend-item i { width: 10px; height: 10px; border-radius: 50%; background: var(--c); display: inline-block; }

/* GUIDANCE GRID */
.guidance-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

.guidance-item {
  padding: 20px;
  border-radius: var(--radius-lg);
  background: var(--surface-subtle);
  border-left: 4px solid var(--g-color, var(--accent));
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.guidance-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, var(--g-color, var(--accent)) 14%, transparent);
  color: var(--g-color, var(--accent));
}
.guidance-icon svg { width: 20px; height: 20px; }
.guidance-title { font-weight: 700; font-size: 0.96rem; }
.guidance-text { font-size: 0.85rem; color: var(--text-muted); margin: 0; }

/* SOURCES LAYOUT + FILLED PIE CHART */
.sources-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 28px;
  align-items: center;
}

.sources-pie-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.sources-pie {
  width: 224px;
  height: 224px;
  filter: drop-shadow(0 8px 20px rgba(15, 23, 42, 0.10));
}

.pie-legend {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
}

.pie-leg-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.82rem;
}

.pie-leg-left {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-weight: 600;
}

.pie-leg-dot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  flex-shrink: 0;
}

.pie-leg-pct {
  font-weight: 800;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.sources-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

.source-card {
  padding: 18px;
  border-radius: var(--radius-lg);
  background: var(--surface-subtle);
  border-top: 3px solid var(--s-color, var(--accent));
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.source-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.source-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, var(--s-color) 14%, transparent);
  color: var(--s-color);
}
.source-icon svg { width: 20px; height: 20px; }

.source-pct {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--s-color);
  font-variant-numeric: tabular-nums;
}

.source-title { font-weight: 700; font-size: 0.95rem; }
.source-desc { font-size: 0.82rem; color: var(--text-muted); margin: 0; }

/* POLLUTANT DETAILS TOGGLE */
.pollutant-details {
  margin-top: 4px;
  border-top: 1px solid var(--border);
  padding-top: 8px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.pollutant-details summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--text);
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.pollutant-details summary::after {
  content: "+";
  font-weight: 700;
  color: var(--text-muted);
}

.pollutant-details[open] summary::after { content: "−"; }
.pollutant-details p { margin: 8px 0 0; line-height: 1.45; }

/* POLLUTANTS WITH SHARE BAR */
.pollutant-share-bar {
  display: flex;
  height: 12px;
  border-radius: 99px;
  overflow: hidden;
  gap: 3px;
  margin-bottom: 20px;
  background: var(--surface-subtle);
}

.share-seg { height: 100%; transition: width 0.5s ease; }

.pollutants-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.pollutant-card {
  padding: 20px;
  border-radius: var(--radius-lg);
  background: var(--surface-subtle);
  border-top: 3px solid var(--p-color, var(--accent));
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pollutant-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.pollutant-name { font-weight: 800; font-size: 1rem; display: flex; align-items: center; gap: 7px; }
.pollutant-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--p-color); display: inline-block; }
.pollutant-desc { font-size: 0.78rem; color: var(--text-muted); display: block; margin-top: 2px; }
.pollutant-val { font-size: 1.25rem; font-weight: 800; font-variant-numeric: tabular-nums; text-align: right; }
.pollutant-unit { font-size: 0.76rem; color: var(--text-muted); font-weight: 500; }

.bar-track {
  position: relative;
  height: 8px;
  border-radius: 99px;
  background: color-mix(in srgb, var(--text) 10%, transparent);
}

.bar-fill {
  height: 100%;
  border-radius: 99px;
  transition: width 0.5s ease;
}

.who-tick {
  position: absolute;
  top: -3px;
  bottom: -3px;
  width: 2px;
  background: var(--text);
  opacity: 0.45;
}

.pollutant-foot {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* FORECAST — MINIMALIST HORIZONTAL BARS */
.forecast-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.forecast-row {
  display: grid;
  grid-template-columns: 120px 44px 1fr 44px 110px;
  align-items: center;
  gap: 14px;
  padding: 13px 18px;
  border-radius: var(--radius-md);
  background: var(--surface-subtle);
}

.forecast-date { font-weight: 700; font-size: 0.94rem; }
.forecast-min { font-size: 0.86rem; font-weight: 600; color: var(--text-muted); text-align: right; font-variant-numeric: tabular-nums; }
.forecast-max { font-size: 0.94rem; font-weight: 800; text-align: left; font-variant-numeric: tabular-nums; }

.forecast-bar-track {
  position: relative;
  height: 9px;
  border-radius: 99px;
  background: color-mix(in srgb, var(--text) 10%, transparent);
  overflow: hidden;
}

.forecast-bar-fill {
  position: absolute;
  top: 0;
  bottom: 0;
  border-radius: 99px;
}

.forecast-status {
  font-size: 0.8rem;
  font-weight: 700;
  text-align: right;
  white-space: nowrap;
}

/* RANKING WITH FLAT SVG FLAGS & COLORED ROWS */
.ranking-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.country-select {
  height: 36px;
  padding: 0 12px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
}

.ranking-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ranking-loading { padding: 24px; text-align: center; color: var(--text-muted); }

.rank-row {
  display: grid;
  grid-template-columns: 36px 32px 1.2fr 120px auto auto;
  align-items: center;
  gap: 14px;
  padding: 13px 18px;
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--row-color) 7%, var(--surface-subtle));
  border: 1px solid color-mix(in srgb, var(--row-color) 18%, transparent);
  border-left: 4px solid var(--row-color);
  cursor: pointer;
  text-align: left;
  color: var(--text);
  width: 100%;
  transition: transform 0.15s, box-shadow 0.15s;
}

.rank-row:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.06);
}

.rank-pos { font-weight: 800; font-size: 0.92rem; color: var(--text-muted); font-variant-numeric: tabular-nums; }

.flag-flat {
  width: 28px;
  height: 20px;
  border-radius: 4px;
  overflow: hidden;
  display: inline-flex;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
  flex-shrink: 0;
}

.rank-city { font-weight: 700; font-size: 0.98rem; }
.rank-region { display: block; font-size: 0.8rem; color: var(--text-muted); font-weight: 400; }

.rank-bar-wrap {
  height: 7px;
  border-radius: 99px;
  background: color-mix(in srgb, var(--text) 10%, transparent);
  overflow: hidden;
}
.rank-bar-fill { height: 100%; border-radius: 99px; background: var(--row-color); }

.rank-pm { font-size: 0.82rem; color: var(--text-muted); font-variant-numeric: tabular-nums; white-space: nowrap; }

.rank-badge {
  min-width: 66px;
  text-align: center;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  font-weight: 800;
  font-size: 0.92rem;
  color: #fff;
  background: var(--row-color);
  font-variant-numeric: tabular-nums;
}

/* FOOTER */
/* CROSS-LINKING & FOOTER */
.crosslink-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding-bottom: 18px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--border);
}
.crosslink-label { font-size: 0.8rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.crosslink-pill {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 16px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.88rem;
}
.crosslink-pill:hover { border-color: var(--accent); }

.footer-left { display: flex; align-items: center; flex-wrap: wrap; gap: 16px; }
.footer-link { color: var(--text-muted); text-decoration: none; font-size: 0.86rem; }
.footer-link:hover { color: var(--text); text-decoration: underline; }
.footer-btn { border: 0; background: transparent; padding: 0; cursor: pointer; font-family: inherit; }

/* COOKIE BANNER (Standard: full-width bottom bar, equal primary buttons >= 48px) */
.cookie-banner {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 100;
  background: var(--surface);
  border-top: 1px solid var(--border);
  box-shadow: 0 -8px 30px rgba(15, 23, 42, 0.12);
}
.cookie-inner { max-width: 80rem; margin: 0 auto; padding: 20px 24px 12px; }
.cookie-top { display: flex; justify-content: space-between; align-items: center; gap: 24px; flex-wrap: wrap; }
.cookie-copy { flex: 1; min-width: 260px; }
.cookie-title { font-weight: 800; font-size: 1rem; margin-bottom: 4px; color: var(--text); }
.cookie-text { margin: 0; font-size: 0.86rem; color: var(--text-muted); line-height: 1.45; }
.cookie-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.cookie-btn {
  min-height: 48px;
  padding: 0 18px;
  border-radius: 10px;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  border: 1.5px solid var(--text);
  background: var(--surface);
  color: var(--text);
}
.cookie-btn-accept { background: var(--text); color: var(--bg); }
.cookie-btn-sec { border-color: var(--border); background: var(--surface-subtle); color: var(--text-muted); }
.cookie-foot {
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 20px;
}
.cookie-foot a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-size: 0.82rem;
  color: var(--text-muted);
  text-decoration: none;
}
.cookie-foot a:hover { text-decoration: underline; color: var(--text); }

.ref-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.ref-chip {
  display: inline-flex;
  align-items: center;
  padding: 8px 14px;
  border-radius: var(--radius-pill);
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  color: var(--text);
  text-decoration: none;
  font-size: 0.84rem;
  font-weight: 600;
}
.ref-chip:hover { border-color: var(--accent); }

.cookie-prefs {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 0.86rem;
}
.pref-row { display: flex; align-items: center; gap: 10px; color: var(--text); cursor: pointer; }

.footer {
  border-top: 1px solid var(--border);
  padding: 28px 0 40px;
  color: var(--text-muted);
  font-size: 0.86rem;
}

.footer-inner { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.footer-brand { font-weight: 700; color: var(--text); margin-right: 12px; }
.lang-select { height: 38px; padding: 0 14px; border-radius: var(--radius-pill); border: 1px solid var(--border); background: var(--surface); color: var(--text); font-size: 0.86rem; cursor: pointer; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); border: 0; }

@media (max-width: 900px) {
  .hero-grid, .sources-layout { grid-template-columns: 1fr; }
  .guidance-grid, .sources-grid { grid-template-columns: repeat(2, 1fr); }
  .pollutants-grid { grid-template-columns: repeat(2, 1fr); }
  .forecast-list { grid-template-columns: repeat(2, 1fr); }
  .rank-bar-wrap { display: none; }
  .rank-row { grid-template-columns: 32px 28px 1fr auto auto; }
}

@media (max-width: 620px) {
  .topbar-inner { flex-wrap: wrap; padding: 12px 0; }
  .search-wrap { order: 3; max-width: 100%; flex-basis: 100%; }
  .hero-card, .card { padding: 22px; border-radius: 22px; }
  .metric-row-2, .guidance-grid, .pollutants-grid { grid-template-columns: 1fr; }
  .rank-pm { display: none; }
  .rank-row { grid-template-columns: 28px 28px 1fr auto; }
}
