/* ================================================================
   Wettermap – Modern Glassmorphism UI
   ================================================================ */

:root {
  /* Weatherhunters Brand Palette */
  --gold: #C9A84C;
  --gold-light: #E8C96B;
  --gold-dim: #8B6F2A;
  --gold-glow: rgba(201, 168, 76, 0.15);

  --bg: #1A1C1E;
  --bg-2: #222528;
  --bg-card: #2A2D31;
  --bg-border: #363A3F;
  --panel: rgba(26, 28, 30, 0.82);
  --panel-solid: #222528;
  --panel-border: rgba(201, 168, 76, 0.18);
  --text: #F0EDE6;
  --text-dim: #B8B4A8;
  --text-mute: #8A8880;
  --text-dark: #5A5855;

  --accent: var(--gold);
  --accent-2: var(--gold-light);
  --good: #6FBF6F;
  --warn: var(--gold-light);
  --bad: #D94B4B;
  --shadow-lg: 0 20px 48px rgba(0, 0, 0, 0.55);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.45);
  --shadow-gold: 0 8px 28px rgba(201, 168, 76, 0.25);
  --radius: 6px;
  --radius-sm: 4px;
  --topbar-h: 68px;
  --player-h: 82px;
  --panel-w: 360px;
  --transition: 200ms cubic-bezier(.2,.7,.3,1);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);

  --font-body: 'Outfit', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-head: 'Bebas Neue', 'Outfit', sans-serif;
}

body.light-theme {
  --bg: #F5F2EA;
  --bg-2: #FFFFFF;
  --bg-card: #FFFFFF;
  --bg-border: #E5DDC8;
  --panel: rgba(255, 252, 244, 0.92);
  --panel-solid: #FFFFFF;
  --panel-border: rgba(139, 111, 42, 0.22);
  --text: #2A2724;
  --text-dim: #6A6358;
  --text-mute: #8A8270;
  --shadow-lg: 0 20px 48px rgba(60, 50, 25, 0.18);
  --shadow-md: 0 8px 24px rgba(60, 50, 25, 0.12);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-weight: 300;
  font-size: 14px;
  line-height: 1.5;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overscroll-behavior: none;
}

::selection { background: var(--gold); color: var(--bg); }

a { color: var(--gold); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--gold-light); text-decoration: underline; }

button { font-family: inherit; cursor: pointer; }

.hidden { display: none !important; }

/* ================================================================
   BRAND BACKGROUND LAYERS
   ================================================================ */
.bg-grid {
  position: fixed; inset: 0;
  background-image:
    linear-gradient(rgba(201,168,76,.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(201,168,76,.05) 1px, transparent 1px);
  background-size: 60px 60px;
  z-index: 0; pointer-events: none;
}
body.light-theme .bg-grid {
  background-image:
    linear-gradient(rgba(139,111,42,.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(139,111,42,.08) 1px, transparent 1px);
}
.bg-r1 {
  position: fixed;
  top: -20%; left: 50%;
  transform: translateX(-50%);
  width: 900px; height: 600px;
  background: radial-gradient(ellipse at center,
              rgba(201,168,76,.10) 0%, transparent 65%);
  z-index: 0; pointer-events: none;
}
.bg-r2 {
  position: fixed;
  bottom: -15%; right: -10%;
  width: 600px; height: 500px;
  background: radial-gradient(ellipse at center,
              rgba(201,168,76,.06) 0%, transparent 65%);
  z-index: 0; pointer-events: none;
}

/* ================================================================
   TOP BAR
   ================================================================ */
.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: calc(var(--topbar-h) + var(--safe-top));
  padding-top: var(--safe-top);
  background: rgba(26, 28, 30, 0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(201, 168, 76, 0.18);
  display: flex;
  align-items: center;
  padding-left: 20px;
  padding-right: 20px;
  z-index: 1000;
  gap: 16px;
}
body.light-theme .topbar {
  background: rgba(255, 252, 244, 0.92);
  border-bottom-color: rgba(139, 111, 42, 0.20);
}

.brand {
  display: flex; align-items: center; gap: 14px;
  flex-shrink: 0;
  text-decoration: none;
  color: inherit;
  transition: opacity var(--transition);
}
.brand:hover { opacity: 0.85; text-decoration: none; }
.brand-logo {
  height: 38px; width: auto;
  filter: brightness(0) saturate(100%) invert(73%) sepia(50%) saturate(500%) hue-rotate(5deg) brightness(.95);
  flex-shrink: 0;
}
body.light-theme .brand-logo {
  filter: brightness(0) saturate(100%) invert(46%) sepia(40%) saturate(700%) hue-rotate(5deg) brightness(.85);
}
.brand-text h1 {
  margin: 0;
  font-family: var(--font-head);
  font-size: 22px;
  font-weight: 400;
  letter-spacing: 0.06em;
  line-height: 1;
  color: var(--text);
  text-transform: uppercase;
}
.brand-text .tagline {
  display: block;
  font-size: 10px;
  color: var(--gold);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  margin-top: 3px;
  font-weight: 500;
}

.status-pills {
  display: flex;
  gap: 8px;
  flex: 1;
  justify-content: center;
  flex-wrap: wrap;
}
.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(42, 45, 49, 0.6);
  border: 1px solid var(--bg-border);
  border-radius: 4px;
  padding: 6px 12px;
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-mute);
  transition: var(--transition);
}
body.light-theme .pill {
  background: rgba(245, 242, 234, 0.7);
}
.pill .dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--text-mute);
  transition: var(--transition);
}
.pill.is-on .dot {
  background: var(--gold);
  box-shadow: 0 0 8px var(--gold);
  animation: pulse 2s ease-in-out infinite;
}
.pill.is-err .dot { background: var(--bad); box-shadow: 0 0 8px var(--bad); }
.pill.is-on { color: var(--gold); border-color: rgba(201, 168, 76, 0.35); }
.pill-count {
  background: rgba(201, 168, 76, 0.12);
  color: var(--gold);
  padding: 1px 8px;
  border-radius: 3px;
  font-variant-numeric: tabular-nums;
  font-size: 11px;
  letter-spacing: 0;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.4; transform: scale(0.7); }
}

.topbar-actions { display: flex; gap: 6px; flex-shrink: 0; }
.icon-btn {
  background: transparent;
  border: 1px solid var(--bg-border);
  color: var(--text-dim);
  width: 38px; height: 38px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}
.icon-btn:hover {
  background: rgba(201, 168, 76, 0.08);
  border-color: var(--gold);
  color: var(--gold);
}
.icon-btn:active { transform: scale(0.96); }

/* ================================================================
   MAP
   ================================================================ */
#map {
  position: fixed;
  top: calc(var(--topbar-h) + var(--safe-top));
  left: 0;
  right: var(--panel-w);
  bottom: var(--player-h);
  background: var(--bg-2);
  z-index: 1;
}
body.light-theme .leaflet-container { background: #ebe6d4; }
.leaflet-container { background: #15171a; outline: none; font-family: var(--font-body) !important; }

.leaflet-control-zoom {
  border: 1px solid var(--bg-border) !important;
  box-shadow: var(--shadow-md) !important;
  border-radius: 4px !important;
  overflow: hidden;
}
.leaflet-control-zoom a {
  background: var(--bg-card) !important;
  color: var(--text-dim) !important;
  border-bottom: 1px solid var(--bg-border) !important;
  transition: all var(--transition) !important;
}
.leaflet-control-zoom a:hover {
  background: rgba(201, 168, 76, 0.12) !important;
  color: var(--gold) !important;
}
.leaflet-control-attribution {
  background: rgba(26, 28, 30, 0.7) !important;
  color: var(--text-mute) !important;
  font-size: 10px !important;
  padding: 2px 8px !important;
  border-radius: 4px 0 0 0;
  font-family: var(--font-body) !important;
}
.leaflet-control-attribution a { color: var(--gold) !important; }
body.light-theme .leaflet-control-attribution {
  background: rgba(255,252,244,.85) !important;
  color: var(--text-dim) !important;
}

/* ================================================================
   LAYER PANEL (Desktop right side)
   ================================================================ */
.layer-panel {
  position: fixed;
  top: calc(var(--topbar-h) + var(--safe-top));
  right: 0;
  bottom: var(--player-h);
  width: var(--panel-w);
  background: var(--panel);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-left: 1px solid var(--panel-border);
  z-index: 999;
  display: flex;
  flex-direction: column;
  transition: transform var(--transition);
  overflow: hidden;
}
.layer-panel.collapsed { transform: translateX(calc(100% - 36px)); }

.panel-toggle {
  position: absolute;
  top: 50%;
  left: -16px;
  transform: translateY(-50%);
  width: 32px; height: 56px;
  background: var(--panel-solid);
  border: 1px solid var(--panel-border);
  border-right: none;
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
  display: none;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  box-shadow: var(--shadow-md);
}
.panel-handle {
  width: 3px; height: 28px; background: currentColor; border-radius: 2px; opacity: .6;
}

.panel-content {
  flex: 1;
  overflow-y: auto;
  padding: 18px;
  -webkit-overflow-scrolling: touch;
}
.panel-content::-webkit-scrollbar { width: 6px; }
.panel-content::-webkit-scrollbar-track { background: transparent; }
.panel-content::-webkit-scrollbar-thumb {
  background: var(--bg-border); border-radius: 3px;
}
.panel-content::-webkit-scrollbar-thumb:hover { background: var(--gold-dim); }

.panel-section {
  padding-bottom: 18px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--panel-border);
}
.panel-section:last-child { border-bottom: none; }
.panel-section h3 {
  margin: 0 0 12px;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--gold-dim);
  font-weight: 500;
}

/* Segmented control */
.seg-control {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: var(--bg);
  border: 1px solid var(--bg-border);
  border-radius: 4px;
  padding: 3px;
  gap: 2px;
}
body.light-theme .seg-control { background: rgba(245,242,234,0.6); }
.seg-control button {
  background: transparent;
  border: none;
  color: var(--text-mute);
  padding: 8px 6px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-radius: 3px;
  transition: var(--transition);
}
.seg-control button.active {
  background: var(--gold);
  color: var(--bg);
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(201, 168, 76, 0.30);
}
.seg-control button:not(.active):hover { color: var(--gold); background: rgba(201, 168, 76, 0.06); }

/* Layer rows */
.layer-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  margin: 2px 0;
}
.layer-row:hover { background: rgba(255,255,255,0.04); }
body.light-theme .layer-row:hover { background: rgba(15,22,36,0.04); }
.layer-row input[type=checkbox] {
  appearance: none; -webkit-appearance: none;
  width: 36px; height: 20px;
  border-radius: 999px;
  background: var(--bg-border);
  position: relative;
  cursor: pointer;
  flex-shrink: 0;
  transition: var(--transition);
}
.layer-row input[type=checkbox]::after {
  content: '';
  position: absolute;
  top: 2px; left: 2px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--text);
  box-shadow: 0 1px 3px rgba(0,0,0,.5);
  transition: var(--transition);
}
.layer-row input[type=checkbox]:checked { background: var(--gold); box-shadow: 0 0 12px rgba(201,168,76,.3); }
.layer-row input[type=checkbox]:checked::after { transform: translateX(16px); background: var(--bg); }
.layer-name { flex: 1; font-size: 13px; }
.layer-info { font-size: 11px; color: var(--text-mute); }

/* Control rows */
.control-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
}
.control-row label {
  font-size: 13px;
  color: var(--text-dim);
  flex-shrink: 0;
}
.control-row.toggle-row label { cursor: pointer; }
.control-row select,
.control-row input[type=range] { flex: 1; max-width: 200px; }

select, input[type=text], input[type=password], input[type=email], input[type=url], input[type=number] {
  background: var(--bg-card);
  border: 1px solid var(--bg-border);
  color: var(--text);
  border-radius: 4px;
  padding: 10px 12px;
  font-size: 13px;
  font-family: var(--font-body);
  font-weight: 400;
  width: 100%;
  outline: none;
  transition: var(--transition);
}
select:focus, input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(201, 168, 76, 0.20);
}
select { cursor: pointer; }
::placeholder { color: var(--text-dark); }

input[type=range] {
  -webkit-appearance: none; appearance: none;
  background: transparent;
  height: 18px;
  width: 100%;
}
input[type=range]::-webkit-slider-runnable-track {
  height: 3px; border-radius: 2px;
  background: var(--bg-border);
}
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--gold);
  margin-top: -6.5px;
  box-shadow: 0 0 12px rgba(201,168,76,0.5);
  cursor: pointer;
  border: 2px solid var(--bg);
}
input[type=range]::-moz-range-track { height: 3px; border-radius: 2px; background: var(--bg-border); }
input[type=range]::-moz-range-thumb { width: 14px; height: 14px; border: 2px solid var(--bg); border-radius: 50%; background: var(--gold); cursor: pointer; }

/* Toggle checkbox in form/control-rows */
.toggle-row input[type=checkbox] {
  appearance: none; -webkit-appearance: none;
  width: 36px; height: 20px;
  border-radius: 999px;
  background: var(--bg-border);
  position: relative;
  cursor: pointer;
  transition: var(--transition);
}
.toggle-row input[type=checkbox]::after {
  content: '';
  position: absolute;
  top: 2px; left: 2px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--text);
  transition: var(--transition);
}
.toggle-row input[type=checkbox]:checked { background: var(--gold); }
.toggle-row input[type=checkbox]:checked::after { transform: translateX(16px); background: var(--bg); }

/* Device list */
.device-list { display: flex; flex-direction: column; gap: 6px; max-height: 320px; overflow-y: auto; }
.device-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  background: var(--bg-card);
  border: 1px solid var(--bg-border);
  border-radius: 4px;
  cursor: pointer;
  transition: var(--transition);
}
.device-item:hover {
  border-color: var(--gold);
  background: rgba(201, 168, 76, 0.06);
}
.device-status {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--text-mute);
  flex-shrink: 0;
}
.device-status.online { background: var(--good); box-shadow: 0 0 6px var(--good); }
.device-status.offline { background: var(--bad); }
.device-status.unknown { background: var(--warn); }
.device-info { flex: 1; min-width: 0; }
.device-name { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.device-meta { font-size: 11px; color: var(--text-mute); }
.device-locate {
  width: 30px; height: 30px;
  background: transparent;
  border: 1px solid var(--bg-border);
  color: var(--text-mute);
  border-radius: 4px;
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: var(--transition);
}
.device-locate:hover { color: var(--gold); border-color: var(--gold); }

/* Buttons */
.btn-primary, .btn-secondary, .btn-ghost {
  border: 1px solid transparent;
  border-radius: 4px;
  padding: 11px 18px;
  font-size: 12px;
  font-weight: 600;
  font-family: var(--font-body);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition: var(--transition);
}
.btn-block { width: 100%; }
.btn-primary {
  background: var(--gold);
  color: var(--bg);
}
.btn-primary:hover { background: var(--gold-light); }
.btn-secondary {
  background: var(--bg-card);
  color: var(--text);
  border-color: var(--bg-border);
}
.btn-secondary:hover { background: rgba(201,168,76,0.08); color: var(--gold); border-color: var(--gold); }
.btn-ghost {
  background: transparent;
  color: var(--text-mute);
  border-color: var(--bg-border);
}
.btn-ghost:hover { color: var(--gold); border-color: var(--gold); }

.hint { font-size: 12px; color: var(--text-mute); line-height: 1.65; margin: 0 0 12px; font-weight: 300; }
.hint code {
  background: var(--bg);
  color: var(--gold-light);
  padding: 2px 7px;
  border-radius: 3px;
  font-size: 11px;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  border: 1px solid var(--bg-border);
}

/* Legend */
.legend { display: flex; flex-direction: column; gap: 4px; }
.legend-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--text-dim);
}
.legend-item .sw {
  width: 16px; height: 16px;
  border-radius: 4px;
  flex-shrink: 0;
  border: 1px solid rgba(255,255,255,0.1);
}

/* ================================================================
   PLAYER / TIMELINE
   ================================================================ */
.player {
  position: fixed;
  bottom: 0; left: 0;
  right: var(--panel-w);
  height: calc(var(--player-h) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: var(--panel);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--panel-border);
  display: flex;
  align-items: center;
  gap: 16px;
  padding-left: 18px;
  padding-right: 18px;
  z-index: 998;
}

.play-btn {
  background: var(--gold);
  color: var(--bg);
  border: none;
  width: 48px; height: 48px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 22px rgba(201, 168, 76, 0.40);
  flex-shrink: 0;
  transition: var(--transition);
}
.play-btn:hover { background: var(--gold-light); transform: scale(1.05); }
.play-btn:active { transform: scale(0.96); }

.timeline-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}
.time-label {
  font-variant-numeric: tabular-nums;
  font-family: var(--font-head);
  letter-spacing: 0.08em;
  font-weight: 400;
  font-size: 17px;
  background: var(--bg-card);
  color: var(--text);
  padding: 6px 14px;
  border-radius: 4px;
  border: 1px solid var(--bg-border);
  white-space: nowrap;
  flex-shrink: 0;
}
.time-label.is-forecast {
  color: var(--gold);
  border-color: rgba(201, 168, 76, 0.40);
  background: rgba(201, 168, 76, 0.08);
}

#timeline {
  flex: 1;
  min-width: 0;
}

.timeline-ticks {
  position: absolute;
  pointer-events: none;
  display: none;
}

.speed-control { flex-shrink: 0; }
.chip {
  background: transparent;
  border: 1px solid var(--bg-border);
  color: var(--text-dim);
  border-radius: 4px;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
  min-width: 48px;
  transition: var(--transition);
}
.chip:hover { background: rgba(201, 168, 76, 0.08); color: var(--gold); border-color: var(--gold); }

/* ================================================================
   MODAL
   ================================================================ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(10, 11, 13, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: fadeIn 200ms ease;
}
body.light-theme .modal-backdrop { background: rgba(60, 50, 25, 0.4); }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--panel-solid);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: slideUp 240ms cubic-bezier(.2,.7,.3,1);
}
@keyframes slideUp {
  from { transform: translateY(20px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--panel-border);
}
.modal-header h2 {
  margin: 0;
  font-family: var(--font-head);
  font-size: 24px;
  font-weight: 400;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text);
}
.modal-header h2::before {
  content: '';
  display: inline-block;
  width: 4px; height: 22px;
  background: var(--gold);
  margin-right: 12px;
  vertical-align: -4px;
}
.modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

.form-section {
  margin-bottom: 24px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--panel-border);
}
.form-section:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.form-section h3 {
  margin: 0 0 14px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--gold-dim);
  font-weight: 500;
}
.form-group { margin-bottom: 12px; }
.form-group label {
  display: block;
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 6px;
}
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.form-row .form-group { margin-bottom: 0; }
.form-actions {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}

/* ================================================================
   TOAST
   ================================================================ */
.toast-host {
  position: fixed;
  top: calc(var(--topbar-h) + var(--safe-top) + 12px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 1500;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  background: var(--panel-solid);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-md);
  animation: toast-in 220ms ease-out;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 90vw;
}
.toast.success { border-left: 3px solid var(--good); }
.toast.error   { border-left: 3px solid var(--bad); }
.toast.warn    { border-left: 3px solid var(--warn); }
.toast.info    { border-left: 3px solid var(--gold); }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(-12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ================================================================
   MAP MARKERS
   ================================================================ */
.lightning-marker {
  position: relative;
  width: 14px; height: 14px;
  pointer-events: none;
}
.lightning-marker::before,
.lightning-marker::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
}
.lightning-marker::before {
  background: radial-gradient(circle,
              rgba(255,255,255,1) 0%,
              rgba(232,201,107,0.95) 30%,
              rgba(201,168,76,0.75) 60%,
              rgba(201,168,76,0) 100%);
  filter: blur(1px);
}
.lightning-marker::after {
  background: rgba(255, 248, 220, 0.95);
  transform: scale(0.35);
  box-shadow: 0 0 14px rgba(232, 201, 107, 0.95);
}
.lightning-marker.fade-1 { opacity: 0.85; }
.lightning-marker.fade-2 { opacity: 0.55; }
.lightning-marker.fade-3 { opacity: 0.3;  }
.lightning-marker.is-fresh {
  animation: flash 0.9s ease-out;
}
@keyframes flash {
  0%   { transform: scale(2.8); filter: brightness(2); }
  60%  { transform: scale(1.2); filter: brightness(1.2); }
  100% { transform: scale(1);   filter: brightness(1); }
}

/* ----------- Storm Cells ----------- */
.storm-cell {
  position: relative;
  width: 48px; height: 48px;
  pointer-events: auto;
  cursor: pointer;
}
.storm-cell .storm-pulse {
  position: absolute; inset: 0;
  border-radius: 50%;
  opacity: 0.35;
  animation: storm-pulse 2.4s ease-out infinite;
}
.storm-cell .storm-core {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 22px; height: 22px;
  border-radius: 50%;
  border: 2px solid #1A1C1E;
  box-shadow: 0 2px 8px rgba(0,0,0,0.5);
}
.storm-cell .storm-label {
  position: absolute;
  top: 100%; left: 50%;
  transform: translate(-50%, 4px);
  background: rgba(26, 28, 30, 0.92);
  padding: 2px 7px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  border-radius: 3px;
  white-space: nowrap;
  box-shadow: 0 2px 6px rgba(0,0,0,0.6);
  pointer-events: none;
  font-family: var(--font-body);
  font-variant-numeric: tabular-nums;
}

/* Intensity colors: 1 yellow → 2 orange → 3 red-magenta */
.storm-cell.intensity-1 .storm-pulse { background: #F5D030; }
.storm-cell.intensity-1 .storm-core  { background: #F5D030; box-shadow: 0 0 14px rgba(245,208,48,0.7); }
.storm-cell.intensity-1 .storm-label { color: #F5D030; border: 1px solid rgba(245,208,48,0.45); }

.storm-cell.intensity-2 .storm-pulse { background: #F57C1F; }
.storm-cell.intensity-2 .storm-core  { background: #F57C1F; box-shadow: 0 0 16px rgba(245,124,31,0.8); }
.storm-cell.intensity-2 .storm-label { color: #F5A55D; border: 1px solid rgba(245,124,31,0.5); }

.storm-cell.intensity-3 .storm-pulse { background: #D1232A; }
.storm-cell.intensity-3 .storm-core  { background: #D1232A; box-shadow: 0 0 20px rgba(209,35,42,0.9); }
.storm-cell.intensity-3 .storm-label { color: #FF6B72; border: 1px solid rgba(209,35,42,0.55); }

@keyframes storm-pulse {
  0%   { transform: scale(0.6); opacity: 0.5; }
  100% { transform: scale(2.4); opacity: 0; }
}

.storm-arrow {
  width: 22px; height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  transform-origin: 50% 50%;
  filter: drop-shadow(0 0 4px rgba(0,0,0,0.6));
  pointer-events: none;
}

.storm-dot-future {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: rgba(232, 201, 107, 0.9);
  border: 1.5px solid #1A1C1E;
  box-shadow: 0 0 6px rgba(232, 201, 107, 0.6);
  pointer-events: none;
}

.gps-marker {
  width: 32px; height: 32px;
  position: relative;
}
.gps-marker .gps-pulse {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: var(--gold);
  opacity: 0.35;
  animation: gps-pulse 2s ease-out infinite;
}
.gps-marker.is-offline .gps-pulse { animation: none; opacity: 0.15; background: var(--text-dark); }
.gps-marker .gps-dot {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--gold);
  border: 2.5px solid var(--bg);
  box-shadow: 0 2px 6px rgba(0,0,0,0.5), 0 0 12px rgba(201,168,76,0.6);
}
.gps-marker.is-offline .gps-dot { background: var(--text-mute); box-shadow: 0 2px 6px rgba(0,0,0,0.5); }
.gps-marker .gps-label {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translate(-50%, 6px);
  background: var(--bg);
  color: var(--gold);
  padding: 3px 9px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border: 1px solid rgba(201, 168, 76, 0.35);
  border-radius: 3px;
  white-space: nowrap;
  box-shadow: 0 2px 6px rgba(0,0,0,0.6);
  pointer-events: none;
  font-family: var(--font-body);
}
@keyframes gps-pulse {
  0%   { transform: scale(0.5); opacity: 0.5; }
  100% { transform: scale(2.0); opacity: 0; }
}

.self-marker {
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--gold);
  border: 3px solid var(--bg);
  box-shadow: 0 0 0 4px rgba(201, 168, 76, 0.3), 0 2px 6px rgba(0,0,0,0.5);
}

.leaflet-popup-content-wrapper {
  background: var(--bg-card);
  color: var(--text);
  border-radius: 4px;
  border: 1px solid var(--bg-border);
  box-shadow: var(--shadow-md);
}
.leaflet-popup-content {
  margin: 14px 16px;
  font-size: 12px;
  line-height: 1.6;
  font-family: var(--font-body);
  font-weight: 400;
}
.leaflet-popup-tip { background: var(--bg-card); }
.leaflet-popup-content strong { color: var(--gold); font-weight: 600; }
.leaflet-popup-close-button { color: var(--text-mute) !important; }

/* ================================================================
   MOBILE
   ================================================================ */
@media (max-width: 900px) {
  :root {
    --topbar-h: 60px;
    --player-h: 70px;
    --panel-w: 100vw;
  }
  .topbar { padding-left: 14px; padding-right: 14px; }
  .brand-text .tagline { display: none; }
  .brand-text h1 { font-size: 18px; }
  .brand-logo { height: 30px; }

  .status-pills { gap: 4px; }
  .pill-label { display: none; }
  .pill { padding: 5px 8px; }

  #map {
    right: 0;
    bottom: var(--player-h);
  }

  .layer-panel {
    top: auto;
    bottom: var(--player-h);
    left: 0; right: 0;
    width: 100vw;
    height: 78vh;
    max-height: 78vh;
    border-left: none;
    border-top: 1px solid var(--panel-border);
    border-radius: 18px 18px 0 0;
    transform: translateY(calc(100% - 44px));
    transition: transform 280ms cubic-bezier(.2,.7,.3,1);
  }
  .layer-panel.open { transform: translateY(0); }
  .panel-toggle {
    display: flex;
    position: absolute;
    top: -2px; left: 50%;
    transform: translateX(-50%);
    width: 64px; height: 32px;
    border-radius: 18px 18px 0 0;
    border-bottom: none;
    border-right: 1px solid var(--panel-border);
  }
  .panel-handle {
    width: 36px; height: 4px;
  }
  .panel-content {
    padding: 16px;
    padding-top: 32px;
  }

  .player {
    right: 0;
    padding-left: 12px;
    padding-right: 12px;
    gap: 10px;
  }
  .play-btn { width: 42px; height: 42px; }
  .time-label { font-size: 12px; padding: 5px 9px; }

  .modal { max-height: 95vh; }
  .form-row { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .topbar { padding-left: 10px; padding-right: 10px; gap: 8px; }
  .brand-text { display: none; }
  .brand-logo { height: 32px; }
  .topbar-actions .icon-btn { width: 34px; height: 34px; }
  .status-pills { flex: 1; justify-content: flex-end; }
  .pill { padding: 5px 8px; font-size: 10px; }
}
