:root {
  color-scheme: light;
  --bg: #f4f7f8;
  --surface: #ffffff;
  --surface-soft: #eef4f5;
  --ink: #172129;
  --muted: #60717c;
  --line: #d7e2e5;
  --brand: #d91f2f;
  --brand-dark: #a71320;
  --blue: #177a9c;
  --green: #2a8f6b;
  --yellow: #f2c84b;
  --orange: #f07b35;
  --red: #d93932;
  --violet: #7b4bb4;
  --shadow: 0 18px 50px rgba(23, 33, 41, .12);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
}

body.dark {
  color-scheme: dark;
  --bg: #11181d;
  --surface: #182228;
  --surface-soft: #202d34;
  --ink: #edf4f6;
  --muted: #a6b7c0;
  --line: #2c3c44;
  --shadow: 0 18px 50px rgba(0, 0, 0, .32);
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input {
  font: inherit;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 20px;
  min-height: 72px;
  padding: 12px clamp(16px, 4vw, 48px);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 210px;
}

.brand-mark {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 8px;
  background: var(--brand);
  color: white;
  font-weight: 900;
}

.brand strong,
.brand small {
  display: block;
}

.brand small {
  color: var(--muted);
  margin-top: 2px;
}

.nav {
  display: flex;
  flex: 1;
  justify-content: center;
  gap: 6px;
}

.nav a {
  min-height: 40px;
  padding: 11px 14px;
  color: var(--muted);
  border-radius: 8px;
}

.nav a:hover {
  background: var(--surface-soft);
  color: var(--ink);
}

.top-actions {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.admin-entry {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  font-weight: 900;
}

.admin-entry:hover {
  color: var(--ink);
  border-color: color-mix(in srgb, var(--brand) 40%, var(--line));
}

.admin-entry span {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 6px;
  background: var(--brand);
  color: #fff;
  font-size: .78rem;
}

.icon-btn {
  display: inline-grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
}

.icon-btn.filled {
  border-color: var(--brand);
  background: var(--brand);
  color: white;
}

.hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(290px, .55fr);
  gap: clamp(18px, 3vw, 34px);
  min-height: calc(100vh - 72px);
  padding: clamp(34px, 6vw, 76px) clamp(16px, 4vw, 48px) 38px;
  overflow: hidden;
  background:
    linear-gradient(112deg, rgba(23, 122, 156, .15), transparent 46%),
    linear-gradient(158deg, rgba(217, 31, 47, .12), transparent 42%),
    var(--bg);
}

.hero-content {
  position: relative;
  z-index: 2;
  align-self: center;
  max-width: 860px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--brand);
  font-size: .78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 780px;
  margin-bottom: 18px;
  font-size: clamp(3rem, 8vw, 6.8rem);
  line-height: .95;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

h2 {
  margin-bottom: 0;
  font-size: clamp(1.7rem, 3vw, 2.7rem);
  letter-spacing: 0;
}

h3 {
  font-size: 1.15rem;
}

.lead {
  max-width: 680px;
  color: var(--muted);
  font-size: clamp(1.05rem, 2vw, 1.3rem);
  line-height: 1.55;
}

.hero-actions,
.controls,
.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.primary-action,
.secondary-action,
.filter-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border-radius: 8px;
  padding: 0 18px;
  border: 1px solid var(--line);
  cursor: pointer;
}

.primary-action {
  background: var(--brand);
  border-color: var(--brand);
  color: white;
  font-weight: 800;
}

.primary-action:hover,
.icon-btn.filled:hover {
  background: var(--brand-dark);
  border-color: var(--brand-dark);
}

.primary-action:disabled {
  cursor: default;
  opacity: .68;
}

.secondary-action,
.filter-btn {
  background: var(--surface);
  color: var(--ink);
}

.filter-btn.is-active {
  background: var(--ink);
  color: var(--surface);
}

.storm-visual {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.storm-visual::before {
  content: "";
  position: absolute;
  right: -8vw;
  top: 9vh;
  width: 58vw;
  height: 58vw;
  max-width: 760px;
  max-height: 760px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 50%, rgba(217, 31, 47, .20), transparent 28%),
    repeating-conic-gradient(from 18deg, rgba(23, 122, 156, .22) 0 12deg, rgba(255, 255, 255, .18) 12deg 22deg);
  animation: spin 24s linear infinite;
}

.rain {
  position: absolute;
  inset: -40px;
  opacity: .26;
  background-image: repeating-linear-gradient(110deg, transparent 0 18px, rgba(23, 122, 156, .45) 18px 20px, transparent 20px 38px);
}

.rain-a {
  animation: rain 12s linear infinite;
}

.rain-b {
  opacity: .14;
  animation: rain 18s linear infinite reverse;
}

.bolt {
  position: absolute;
  left: 52%;
  top: 22%;
  width: 90px;
  height: 150px;
  clip-path: polygon(44% 0, 82% 0, 59% 38%, 88% 38%, 28% 100%, 43% 53%, 18% 53%);
  background: #f9d85b;
  filter: drop-shadow(0 0 20px rgba(249, 216, 91, .6));
  opacity: .8;
}

.radar-ring {
  position: absolute;
  right: 12vw;
  top: 32vh;
  width: 180px;
  height: 180px;
  border: 2px solid rgba(23, 122, 156, .22);
  border-radius: 50%;
  animation: pulseRing 4s ease-out infinite;
}

.ring-b {
  animation-delay: 1.2s;
}

.ring-c {
  animation-delay: 2.4s;
}

.status-panel,
.detail-panel,
.module,
.search-card {
  position: relative;
  min-width: 0;
  z-index: 2;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  box-shadow: var(--shadow);
}

.status-panel {
  align-self: end;
  padding: 18px;
}

.status-head,
.module-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}

.pulse {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--red);
  box-shadow: 0 0 0 8px rgba(217, 57, 50, .16);
}

.stats-grid,
.mini-data {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
}

.stats-grid div,
.mini-data div {
  padding: 14px;
  border-radius: 8px;
  background: var(--surface-soft);
}

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

dd {
  margin: 6px 0 0;
  font-weight: 900;
  font-size: 1.5rem;
}

.source-note {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: .9rem;
}

.source-note[data-mode="dwd"] {
  color: var(--green);
  font-weight: 800;
}

.source-note[data-mode="unavailable"] {
  color: var(--orange);
  font-weight: 800;
}

.source-note[data-mode="loading"] {
  color: var(--blue);
  font-weight: 800;
}

.dashboard-band,
.workbench,
.data-grid,
.ticker-band,
.feature-preview {
  padding: clamp(34px, 5vw, 64px) clamp(16px, 4vw, 48px);
}

.dashboard-band {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  background: var(--surface);
  border-block: 1px solid var(--line);
}

.alert-strip {
  display: flex;
  gap: 14px;
  min-height: 118px;
  padding: 18px;
  border-left: 6px solid var(--yellow);
  border-radius: 8px;
  background: var(--surface-soft);
}

.alert-strip p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.45;
}

.alert-icon {
  flex: 0 0 auto;
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 8px;
  background: var(--ink);
  color: var(--surface);
  font-weight: 900;
}

.level-1 {
  --level: var(--yellow);
}

.level-0 {
  --level: var(--green);
}

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

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

.level-4 {
  --level: var(--violet);
}

.alert-strip.level-0,
.alert-strip.level-1,
.alert-strip.level-2,
.alert-strip.level-3,
.alert-strip.level-4 {
  border-left-color: var(--level);
}

.alert-strip:only-child {
  grid-column: 1 / -1;
}

.section-title {
  margin-bottom: 22px;
}

.workbench {
  background: var(--bg);
}

.controls {
  margin-bottom: 18px;
}

.map-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 380px);
  gap: 18px;
}

.map-shell {
  min-height: 620px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.germany-map {
  display: block;
  width: 100%;
  height: min(72vh, 600px);
  min-height: 480px;
}

.country {
  fill: #e9f0ed;
  stroke: #ffffff;
  stroke-width: 4;
}

.state {
  cursor: pointer;
  stroke: #ffffff;
  stroke-width: 3;
  transition: transform .2s ease, opacity .2s ease, filter .2s ease;
  transform-box: fill-box;
  transform-origin: center;
}

.state:hover,
.state.is-selected {
  transform: scale(1.025);
  filter: drop-shadow(0 10px 12px rgba(23, 33, 41, .22));
}

.state.is-muted {
  opacity: .24;
}

.state.level-0,
.swatch.level-0 {
  fill: #cfe4de;
  background: #cfe4de;
}

.state.level-1,
.swatch.level-1 {
  fill: var(--yellow);
  background: var(--yellow);
}

.state.level-2,
.swatch.level-2 {
  fill: var(--orange);
  background: var(--orange);
}

.state.level-3,
.swatch.level-3 {
  fill: var(--red);
  background: var(--red);
}

.state.level-4,
.swatch.level-4 {
  fill: var(--violet);
  background: var(--violet);
}

.radar-sweep {
  stroke: rgba(23, 122, 156, .5);
  stroke-width: 42;
  stroke-linecap: round;
  stroke-dasharray: 55 22;
  animation: dash 7s linear infinite;
}

.city {
  fill: #11181d;
  stroke: white;
  stroke-width: 3;
}

.city-label {
  fill: #11181d;
  font-size: 15px;
  font-weight: 800;
}

.legend {
  align-items: center;
  margin-top: 12px;
  color: var(--muted);
  font-size: .9rem;
}

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

.swatch {
  width: 14px;
  height: 14px;
  border-radius: 4px;
}

.detail-panel {
  padding: 20px;
  align-self: start;
  position: sticky;
  top: 92px;
}

.severity {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  margin-bottom: 14px;
  padding: 0 10px;
  border-radius: 8px;
  background: var(--level);
  color: white;
  font-weight: 900;
}

.check-list {
  padding-left: 20px;
  color: var(--muted);
  line-height: 1.7;
}

.full {
  width: 100%;
}

.data-grid {
  display: grid;
  grid-template-columns: 1.15fr .9fr .95fr;
  gap: 18px;
  background: var(--surface);
}

.data-grid > *,
.map-layout > *,
.ticker-layout > *,
.feature-grid > * {
  min-width: 0;
}

.module {
  padding: 20px;
}

.module h2 {
  font-size: 1.25rem;
}

.module-head span {
  color: var(--muted);
  font-weight: 800;
}

.radar-box {
  position: relative;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 7px;
  width: 100%;
  min-width: 0;
  height: 230px;
  padding: 12px;
  overflow: hidden;
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, .09) 1px, transparent 1px),
    linear-gradient(rgba(255, 255, 255, .09) 1px, transparent 1px),
    #16242c;
  background-size: 28px 28px;
}

.cell {
  border-radius: 999px;
  align-self: center;
  justify-self: center;
  background: rgba(47, 166, 118, .8);
  filter: blur(5px);
}

.c1 { width: 70px; height: 52px; grid-column: 2; grid-row: 3; }
.c2 { width: 96px; height: 70px; grid-column: 3; grid-row: 4; background: rgba(242, 200, 75, .86); }
.c3 { width: 84px; height: 84px; grid-column: 4; grid-row: 4; background: rgba(217, 57, 50, .9); }
.c4 { width: 92px; height: 56px; grid-column: 5; grid-row: 3; background: rgba(23, 122, 156, .85); }
.c5 { width: 72px; height: 64px; grid-column: 6; grid-row: 2; background: rgba(123, 75, 180, .75); }

.scan {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .22), transparent);
  transform: translateX(-100%);
  animation: scan 4s linear infinite;
}

.meter {
  height: 24px;
  overflow: hidden;
  border-radius: 8px;
  background: var(--surface-soft);
}

.meter span {
  display: block;
  width: var(--value);
  height: 100%;
  background: linear-gradient(90deg, var(--green), var(--yellow), var(--orange));
}

.mini-data {
  margin-top: 18px;
}

.mini-data dd {
  font-size: 1.15rem;
}

.bars {
  display: grid;
  gap: 14px;
}

.bars label {
  display: grid;
  gap: 7px;
  color: var(--muted);
}

.bars span {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-soft);
}

.bars i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--blue);
}

.ticker-band {
  background: var(--bg);
}

.ticker-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 18px;
}

.timeline {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.timeline li {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  gap: 8px 18px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.timeline time {
  grid-row: span 2;
  color: var(--brand);
  font-weight: 900;
}

.timeline p {
  margin-bottom: 0;
  color: var(--muted);
}

.search-card {
  padding: 20px;
  align-self: start;
}

.search-card label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
}

.input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 42px;
  gap: 8px;
}

input {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: var(--surface-soft);
  color: var(--ink);
}

#searchResult {
  margin: 14px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.feature-preview {
  display: grid;
  grid-template-columns: 310px minmax(0, 1fr);
  gap: 24px;
  border-top: 1px solid var(--line);
  background: var(--surface);
}

.preview-copy {
  margin-top: 14px;
  color: var(--muted);
  line-height: 1.5;
}

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

.feature-card {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.feature-card.priority {
  border-color: color-mix(in srgb, var(--brand) 45%, var(--line));
  background: color-mix(in srgb, var(--surface-soft) 72%, rgba(217, 31, 47, .12));
}

.feature-icon {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  margin-bottom: 14px;
  border-radius: 8px;
  background: var(--ink);
  color: var(--surface);
  font-weight: 900;
}

.feature-card p {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.45;
}

.feature-card strong {
  display: inline-block;
  margin-top: 14px;
  color: var(--brand);
  font-size: .9rem;
}

.footer {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 22px clamp(16px, 4vw, 48px);
  color: var(--muted);
  border-top: 1px solid var(--line);
}

@keyframes spin {
  to { transform: rotate(1turn); }
}

@keyframes rain {
  to { transform: translate3d(-90px, 90px, 0); }
}

@keyframes pulseRing {
  from { transform: scale(.35); opacity: .8; }
  to { transform: scale(2.2); opacity: 0; }
}

@keyframes dash {
  to { stroke-dashoffset: -154; }
}

@keyframes scan {
  to { transform: translateX(100%); }
}

@media (max-width: 1020px) {
  .hero,
  .map-layout,
  .data-grid,
  .ticker-layout,
  .feature-preview {
    grid-template-columns: 1fr;
  }

  .dashboard-band,
  .feature-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .detail-panel {
    position: relative;
    top: auto;
  }
}

@media (max-width: 760px) {
  .topbar {
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 10px;
  }

  .brand {
    flex: 1;
    min-width: 0;
  }

  .top-actions {
    margin-left: 0;
  }

  .nav {
    order: 3;
    flex: 0 0 100%;
    justify-content: flex-start;
    overflow-x: auto;
    width: 100%;
    max-width: 100%;
    padding-bottom: 4px;
  }

  .nav a {
    white-space: nowrap;
  }

  .hero {
    min-height: auto;
    padding-top: 34px;
  }

  h1 {
    font-size: clamp(2.45rem, 12vw, 3.45rem);
    line-height: 1;
  }

  .dashboard-band,
  .feature-grid,
  .stats-grid,
  .mini-data {
    grid-template-columns: 1fr;
  }

  .module {
    overflow: hidden;
  }

  .map-shell {
    min-height: auto;
    padding: 10px;
  }

  .germany-map {
    min-height: 420px;
  }

  .timeline li {
    grid-template-columns: 1fr;
  }

  .timeline time {
    grid-row: auto;
  }

  .footer {
    flex-direction: column;
  }
}
