/* ============================================================
   NowCast · Warnservice Ansbach — Apple-Style, Dark Navy
   ============================================================ */

:root {
  /* Typography */
  --font-body: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Inter', 'Segoe UI', system-ui, sans-serif;
  --text-xs: clamp(0.75rem, 0.7rem + 0.25vw, 0.875rem);
  --text-sm: clamp(0.875rem, 0.8rem + 0.35vw, 1rem);
  --text-base: clamp(1rem, 0.95rem + 0.25vw, 1.0625rem);
  --text-lg: clamp(1.125rem, 1rem + 0.5vw, 1.375rem);
  --text-xl: clamp(1.5rem, 1.2rem + 1vw, 2rem);

  /* Spacing */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;

  /* Dark Navy Palette */
  --color-bg: #0a1322;
  --color-surface: #121d31;
  --color-surface-2: #18253d;
  --color-surface-3: #1f2f4c;
  --color-border: #27395a;
  --color-divider: #1d2c47;
  --color-text: #eef3fa;
  --color-text-muted: #9cadc8;
  --color-text-faint: #64769377;

  /* Apple System Accents (Dark Mode) */
  --color-primary: #0a84ff;
  --color-primary-hover: #339dff;
  --color-green: #30d158;
  --color-yellow: #ffd60a;
  --color-orange: #ff9f0a;
  --color-red: #ff453a;
  --color-violet: #bf5af2;
  --color-cyan: #64d2ff;

  /* Radius & Shadows */
  --radius-sm: 0.5rem;
  --radius-md: 0.75rem;
  --radius-lg: 1.125rem;
  --radius-full: 9999px;
  --shadow-md: 0 6px 20px rgba(2, 6, 14, 0.45);
  --shadow-lg: 0 16px 44px rgba(2, 6, 14, 0.55);
  --transition-interactive: 180ms cubic-bezier(0.16, 1, 0.3, 1);
}

body {
  background:
    radial-gradient(1100px 500px at 85% -10%, rgba(10, 132, 255, 0.13), transparent 60%),
    radial-gradient(900px 500px at -10% 25%, rgba(100, 210, 255, 0.06), transparent 55%),
    var(--color-bg);
  background-attachment: fixed;
}

/* ---------- Topbar ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 1100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-3) clamp(var(--space-4), 3vw, var(--space-8));
  background: rgba(10, 19, 34, 0.82);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--color-divider);
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.logo { width: 40px; height: 40px; flex: none; }

.brand-text h1 {
  font-size: var(--text-lg);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.brand-text p {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin-top: -2px;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.clock {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  line-height: 1.25;
}

#clock-time {
  font-size: var(--text-base);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

#clock-date {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-full);
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--color-text-muted);
  white-space: nowrap;
}

.status-pill-sm { padding: 2px var(--space-2); }

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-text-faint);
  flex: none;
  transition: background var(--transition-interactive);
}

.status-pill.is-live .status-dot { background: var(--color-green); box-shadow: 0 0 8px rgba(48, 209, 88, 0.7); }
.status-pill.is-live { color: var(--color-text); }
.status-pill.is-error .status-dot { background: var(--color-red); }

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: var(--radius-full);
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  color: var(--color-text-muted);
}

.btn-icon:hover { color: var(--color-text); background: var(--color-surface-3); }
.btn-icon.spinning svg { animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Layout ---------- */

main {
  max-width: 1320px;
  margin: 0 auto;
  padding: clamp(var(--space-4), 3vw, var(--space-8));
}

.grid {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  gap: var(--space-5);
}

.card-map { grid-column: 1; grid-row: 1 / 3; display: flex; flex-direction: column; }
.card-current { grid-column: 2; grid-row: 1; }
.card-lightning { grid-column: 2; grid-row: 2; }
.card-nowcast { grid-column: 1; grid-row: 3; }
.card-warnings { grid-column: 2; grid-row: 3; }
.card-forecast { grid-column: 1 / -1; }
.card-composer { grid-column: 1 / -1; }

@media (max-width: 980px) {
  .grid { grid-template-columns: minmax(0, 1fr); }
  .card-map, .card-current, .card-lightning, .card-nowcast, .card-warnings, .card-forecast, .card-composer {
    grid-column: 1;
    grid-row: auto;
  }
}

/* ---------- Cards ---------- */

.card {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0) 38%), var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  box-shadow: var(--shadow-md);
}

.card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
  flex-wrap: wrap;
}

.card-head h2 {
  font-size: var(--text-base);
  font-weight: 600;
  letter-spacing: -0.01em;
}

.muted { font-size: var(--text-xs); color: var(--color-text-muted); }
.muted-inline { font-size: var(--text-xs); color: var(--color-text-muted); font-weight: 400; text-transform: none; letter-spacing: 0; }

/* ---------- Lage Banner ---------- */

.lage-banner {
  display: flex;
  align-items: center;
  gap: var(--space-5);
  flex-wrap: wrap;
  padding: var(--space-4) var(--space-5);
  margin-bottom: var(--space-5);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0) 40%), var(--color-surface);
  box-shadow: var(--shadow-md);
  border-left: 4px solid var(--color-text-faint);
}

.lage-banner[data-level="0"] { border-left-color: var(--color-green); }
.lage-banner[data-level="1"] { border-left-color: var(--color-yellow); }
.lage-banner[data-level="2"] { border-left-color: var(--color-orange); }
.lage-banner[data-level="3"] { border-left-color: var(--color-red); }
.lage-banner[data-level="4"] { border-left-color: var(--color-violet); }

.lage-main {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  min-width: 260px;
}

.lage-icon { width: 56px; height: 56px; flex: none; }

.lage-label {
  font-size: var(--text-lg);
  font-weight: 700;
  letter-spacing: -0.015em;
}

.lage-sub {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.lage-reasons {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
  flex: 1;
}

.reason-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-full);
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--color-text-muted);
}

.reason-chip img { width: 20px; height: 20px; }

/* ---------- Map ---------- */

#map {
  flex: 1;
  min-height: 430px;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--color-border);
  background: #0d1729;
  z-index: 1;
}

.radar-controls {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex: 1;
  max-width: 360px;
}

#radar-slider {
  flex: 1;
  accent-color: var(--color-primary);
  min-width: 90px;
}

.radar-time {
  font-size: var(--text-xs);
  font-variant-numeric: tabular-nums;
  color: var(--color-text-muted);
  white-space: nowrap;
  min-width: 88px;
  text-align: right;
}

.map-legend {
  display: flex;
  gap: var(--space-4);
  flex-wrap: wrap;
  margin-top: var(--space-3);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.map-legend span { display: inline-flex; align-items: center; gap: var(--space-2); }

.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.dot-new { background: #ffd60a; box-shadow: 0 0 6px rgba(255, 214, 10, 0.8); }
.dot-mid { background: #ff9f0a; }
.dot-old { background: #8e6d1a; }

.motion-legend {
  display: inline-block;
  width: 16px;
  height: 0;
  border-top: 2px dashed #ffd60a;
}

.motion-arrow svg {
  display: block;
  filter: drop-shadow(0 0 4px rgba(255, 214, 10, 0.7));
}

.ring {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 1.5px dashed var(--color-cyan);
  display: inline-block;
}

.leaflet-container { font-family: var(--font-body); background: #0d1729; }
.leaflet-control-attribution {
  background: rgba(10, 19, 34, 0.75) !important;
  color: var(--color-text-faint) !important;
  font-size: 10px !important;
}
.leaflet-control-attribution a { color: var(--color-text-muted) !important; }
.leaflet-bar a {
  background: var(--color-surface-2) !important;
  color: var(--color-text) !important;
  border-color: var(--color-border) !important;
}

/* ---------- Aktuell ---------- */

.current-hero {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  margin-bottom: var(--space-4);
}

.current-temp {
  font-size: var(--text-xl);
  font-weight: 700;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.current-desc { color: var(--color-text-muted); font-size: var(--text-sm); }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-3);
}

.stat {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  background: var(--color-surface-2);
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-md);
  padding: var(--space-2) var(--space-3);
}

.stat img { flex: none; }

.stat-val {
  display: block;
  font-weight: 650;
  font-size: var(--text-sm);
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

.stat-lbl {
  display: block;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  line-height: 1.3;
}

/* ---------- Blitzaktivität ---------- */

.lightning-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.lightning-stat {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  background: var(--color-surface-2);
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-md);
  padding: var(--space-3);
}

.big-val {
  display: block;
  font-size: var(--text-xl);
  font-weight: 700;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}

.lightning-meta { display: flex; flex-direction: column; gap: var(--space-2); }

.meta-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--space-3);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  border-bottom: 1px solid var(--color-divider);
  padding-bottom: var(--space-2);
}

.meta-row:last-child { border-bottom: none; padding-bottom: 0; }
.meta-row strong { color: var(--color-text); font-weight: 600; font-variant-numeric: tabular-nums; }

/* ---------- Nowcast ---------- */

.chart-wrap { height: 240px; position: relative; }

.nowcast-summary {
  display: flex;
  gap: var(--space-4);
  flex-wrap: wrap;
  margin-top: var(--space-4);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.nowcast-summary strong { color: var(--color-text); font-variant-numeric: tabular-nums; }

/* ---------- 7-Tage-Vorschau ---------- */

.forecast-row {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: var(--space-3);
}

.forecast-row > .empty-state {
  grid-column: 1 / -1;
  width: 100%;
  flex: 1 1 100%;
}

.day-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-3) var(--space-2);
  background: var(--color-surface-2);
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-md);
  text-align: center;
  transition: border-color var(--transition-interactive), transform var(--transition-interactive);
}

.day-tile:hover { border-color: var(--color-border); transform: translateY(-2px); }

.day-name { font-weight: 600; font-size: var(--text-sm); }
.day-date { font-size: var(--text-xs); color: var(--color-text-muted); }
.day-tile > img { width: 44px; height: 44px; margin: 2px 0; }

.day-rain {
  font-size: var(--text-xs);
  color: var(--color-cyan);
  font-variant-numeric: tabular-nums;
  min-height: 1.2em;
  white-space: nowrap;
}

.day-temps {
  display: flex;
  gap: var(--space-2);
  align-items: baseline;
  font-variant-numeric: tabular-nums;
  margin-top: var(--space-1);
}

.t-max { font-weight: 650; font-size: var(--text-sm); }
.t-min { font-size: var(--text-xs); color: var(--color-text-muted); }

.temp-track {
  position: relative;
  width: 100%;
  height: 5px;
  border-radius: var(--radius-full);
  background: var(--color-surface-3);
  overflow: hidden;
  margin: 2px 0 var(--space-1);
}

.temp-fill {
  position: absolute;
  top: 0;
  bottom: 0;
  border-radius: var(--radius-full);
  background-image: linear-gradient(90deg, #64d2ff, #30d158 35%, #ffd60a 70%, #ff9f0a);
  background-repeat: no-repeat;
}

.day-stats {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 2px;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.day-stats strong { color: var(--color-text); font-weight: 600; }
.day-stats .is-warn-1 strong { color: var(--color-yellow); }
.day-stats .is-warn-2 strong { color: var(--color-orange); }
.day-stats .is-warn-3 strong { color: var(--color-red); }

.forecast-error .error-detail {
  font-size: var(--text-xs);
  color: var(--color-text-faint);
}

.btn-retry {
  margin-top: var(--space-2);
  background: var(--color-surface-3);
  color: var(--color-text);
  border: 1px solid var(--color-border);
  font-size: var(--text-xs);
  cursor: pointer;
}

.btn-retry:hover { background: var(--color-surface-2); border-color: var(--color-text-faint); }

.warn-dot {
  position: absolute;
  top: 9px;
  right: 9px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
}

.warn-dot.warn-1 { background: var(--color-yellow); box-shadow: 0 0 6px rgba(255, 214, 10, 0.55); }
.warn-dot.warn-2 { background: var(--color-orange); box-shadow: 0 0 6px rgba(255, 159, 10, 0.6); }
.warn-dot.warn-3 { background: var(--color-red); box-shadow: 0 0 6px rgba(255, 69, 58, 0.6); }
.warn-dot.warn-4 { background: var(--color-violet); box-shadow: 0 0 6px rgba(191, 90, 242, 0.6); }

.forecast-hint {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-3);
  font-size: var(--text-xs);
  color: var(--color-text-faint);
}

.warn-dot-inline {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--color-orange);
  flex: none;
  box-shadow: 0 0 6px rgba(255, 159, 10, 0.6);
}

@media (max-width: 860px) {
  .forecast-row {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    padding-bottom: var(--space-2);
    scrollbar-width: thin;
    scrollbar-color: var(--color-border) transparent;
  }
  .day-tile { flex: 0 0 132px; scroll-snap-align: start; }
}

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

.warnings-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  max-height: 330px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--color-border) transparent;
}

.warning-item {
  border: 1px solid var(--color-border);
  border-left-width: 4px;
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  background: var(--color-surface-2);
}

.warning-item[data-severity="minor"] { border-left-color: var(--color-yellow); }
.warning-item[data-severity="moderate"] { border-left-color: var(--color-orange); }
.warning-item[data-severity="severe"] { border-left-color: var(--color-red); }
.warning-item[data-severity="extreme"] { border-left-color: var(--color-violet); }

.warning-title {
  font-weight: 600;
  font-size: var(--text-sm);
  margin-bottom: 2px;
}

.warning-meta {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin-bottom: var(--space-1);
}

.warning-desc {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-8) var(--space-4);
  text-align: center;
  color: var(--color-text-muted);
  font-size: var(--text-sm);
}

/* ---------- Composer ---------- */

.composer-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: var(--space-6);
}

@media (max-width: 980px) {
  .composer-grid { grid-template-columns: minmax(0, 1fr); }
}

.composer-form { display: flex; flex-direction: column; gap: var(--space-4); }

.field { display: flex; flex-direction: column; gap: var(--space-2); border: none; }

.field-label, .field legend {
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-muted);
  margin-bottom: var(--space-1);
}

.field-row { display: grid; gap: var(--space-3); }
.field-row.two { grid-template-columns: 1fr 1fr; }
@media (max-width: 540px) { .field-row.two { grid-template-columns: 1fr; } }

input[type="text"],
input[type="datetime-local"],
select,
textarea {
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-sm);
  color: var(--color-text);
  width: 100%;
}

input::placeholder, textarea::placeholder { color: var(--color-text-faint); }

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(10, 132, 255, 0.25);
}

select {
  color-scheme: dark;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239cadc8' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 32px;
  cursor: pointer;
}

textarea { resize: vertical; line-height: 1.5; }

input[type="datetime-local"] { color-scheme: dark; }

/* Segmented control */

.seg-control {
  display: flex;
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 3px;
  gap: 3px;
  flex-wrap: wrap;
}

.seg {
  flex: 1;
  min-width: 72px;
  padding: var(--space-2) var(--space-2);
  border-radius: calc(var(--radius-md) - 3px);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-text-muted);
  text-align: center;
  white-space: nowrap;
}

.seg:hover { color: var(--color-text); }

.seg[aria-checked="true"] { color: #0a1322; }
.seg-hinweis[aria-checked="true"] { background: var(--color-cyan); }
.seg-1[aria-checked="true"] { background: var(--color-yellow); }
.seg-2[aria-checked="true"] { background: var(--color-orange); }
.seg-3[aria-checked="true"] { background: var(--color-red); color: #fff; }
.seg-4[aria-checked="true"] { background: var(--color-violet); color: #fff; }

.field-hint { font-size: var(--text-xs); color: var(--color-text-muted); }

/* Phenomena chips */

.chips { display: flex; gap: var(--space-2); flex-wrap: wrap; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-3) var(--space-1) var(--space-2);
  border-radius: var(--radius-full);
  border: 1px solid var(--color-border);
  background: var(--color-surface-2);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text-muted);
  transition: all var(--transition-interactive);
}

.chip img { width: 26px; height: 26px; }

.chip:hover { color: var(--color-text); border-color: var(--color-primary); }

.chip[aria-pressed="true"] {
  background: rgba(10, 132, 255, 0.18);
  border-color: var(--color-primary);
  color: var(--color-text);
}

/* Advice suggestions */

.advice-suggestions {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
}

.advice-suggestion {
  text-align: left;
  font-size: var(--text-xs);
  line-height: 1.45;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  border: 1px dashed var(--color-border);
  background: transparent;
  color: var(--color-text-muted);
  transition: all var(--transition-interactive);
}

.advice-suggestion:hover {
  border-color: var(--color-primary);
  color: var(--color-text);
  background: rgba(10, 132, 255, 0.08);
}

.advice-suggestion.added {
  opacity: 0.45;
  text-decoration: line-through;
  pointer-events: none;
}

/* Preview */

.composer-preview { display: flex; flex-direction: column; gap: var(--space-3); }

.preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}

.preview-box {
  flex: 1;
  background: #0c1626;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-y: auto;
  max-height: 560px;
  scrollbar-width: thin;
  scrollbar-color: var(--color-border) transparent;
}

/* Buttons */

.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  font-weight: 600;
  white-space: nowrap;
}

.btn-primary {
  background: var(--color-primary);
  color: #fff;
  box-shadow: 0 2px 10px rgba(10, 132, 255, 0.35);
}

.btn-primary:hover { background: var(--color-primary-hover); }

.btn-primary.copied { background: var(--color-green); box-shadow: 0 2px 10px rgba(48, 209, 88, 0.35); }

/* ---------- Footer & Toast ---------- */

.footer {
  max-width: 1320px;
  margin: 0 auto;
  padding: var(--space-6) clamp(var(--space-4), 3vw, var(--space-8)) var(--space-10);
  color: var(--color-text-faint);
  font-size: var(--text-xs);
  line-height: 1.7;
}

.toast {
  position: fixed;
  bottom: var(--space-6);
  left: 50%;
  transform: translate(-50%, 20px);
  background: var(--color-surface-3);
  border: 1px solid var(--color-border);
  color: var(--color-text);
  padding: var(--space-2) var(--space-5);
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transition: opacity 220ms ease, transform 220ms cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 2000;
}

.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* Lightning marker pulse */

.bolt-marker { pointer-events: none; }

/* Zelle mit Lightning Jump: dezent pulsierender Schein, damit der Vorbote auffällt */
.cell-jump {
  animation: cell-pulse 1.6s ease-in-out infinite;
}
@keyframes cell-pulse {
  0%, 100% { filter: drop-shadow(0 0 2px rgba(255, 255, 255, 0.15)); }
  50% { filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.95)); }
}

/* Beschriftung der relevantesten Zelle, wenn ein Lightning Jump aktiv ist */
.is-jump {
  color: #ff453a;
  font-weight: 600;
}

/* ---------- Ortssuche (Topbar) ---------- */

.brand-text p { max-width: 520px; }

.loc-search {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1 1 220px;
  max-width: 300px;
  min-width: 170px;
}

.loc-search-icon {
  position: absolute;
  left: 10px;
  color: var(--color-text-faint);
  pointer-events: none;
}

.loc-search input[type="search"] {
  width: 100%;
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  padding: var(--space-2) var(--space-3) var(--space-2) 32px;
  font-size: var(--text-sm);
  color: var(--color-text);
}

.loc-search input[type="search"]::placeholder { color: var(--color-text-faint); }

.loc-search input[type="search"]:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(10, 132, 255, 0.25);
}

.loc-search input[type="search"]::-webkit-search-cancel-button { -webkit-appearance: none; }

.loc-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 1200;
  list-style: none;
  margin: 0;
  padding: 4px;
  background: rgba(16, 27, 45, 0.97);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
  max-height: 280px;
  overflow-y: auto;
}

.loc-results li {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border-radius: calc(var(--radius-md) - 3px);
  font-size: var(--text-sm);
  cursor: pointer;
}

.loc-results li strong { font-weight: 600; color: var(--color-text); }

.loc-results li span {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.loc-results li:hover, .loc-results li.active { background: rgba(10, 132, 255, 0.18); }

.loc-results .loc-empty {
  cursor: default;
  color: var(--color-text-muted);
  justify-content: center;
}

@media (max-width: 900px) {
  .brand-text p { display: none; }
}

@media (max-width: 640px) {
  .topbar { flex-wrap: wrap; }
  .clock { display: none; }
  .loc-search { order: 3; flex-basis: 100%; max-width: none; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lightning-grid { grid-template-columns: 1fr; }
}
