/*
 * Lightning Front Observatory
 * De kaart is het product; alle bediening zweeft er als een warme, rustige
 * instrumentenlaag boven. Oranje betekent live of actief.
 */

:root {
  --obs-accent: #ff6b1a;
  --obs-accent-bright: #ff9a52;
  --obs-accent-soft: rgba(255, 107, 26, .12);
  --obs-surface: rgba(31, 23, 18, .91);
  --obs-surface-solid: #211813;
  --obs-card: rgba(255, 249, 243, .055);
  --obs-control: rgba(255, 249, 243, .075);
  --obs-border: rgba(255, 187, 140, .19);
  --obs-border-strong: rgba(255, 142, 76, .38);
  --obs-ink: #fff8f1;
  --obs-muted: #c5b2a6;
  --obs-shadow: 0 24px 72px rgba(22, 11, 5, .34);
  --obs-shadow-soft: 0 12px 34px rgba(22, 11, 5, .18);
  --obs-radius: 22px;

  --night: #17100c;
  --panel: var(--obs-surface);
  --line: var(--obs-border);
  --text: var(--obs-ink);
  --muted: var(--obs-muted);
  --lime: var(--obs-accent);
  --orange: var(--obs-accent);

  --ui-surface: var(--obs-surface);
  --ui-surface-solid: var(--obs-surface-solid);
  --ui-card: var(--obs-card);
  --ui-field: var(--obs-control);
  --ui-accent-soft: var(--obs-accent-soft);
  --ui-control: var(--obs-control);
  --ui-border: var(--obs-border);
  --ui-ink: var(--obs-ink);
  --ui-muted: var(--obs-muted);
  --ui-accent: var(--obs-accent);
  --ui-meter: rgba(255, 249, 243, .1);
  --ui-chart: #201712;
  --ui-shadow: var(--obs-shadow);
}

body[data-map-style="light"] {
  --obs-accent: #e85b13;
  --obs-accent-bright: #f47c39;
  --obs-accent-soft: rgba(232, 91, 19, .1);
  --obs-surface: rgba(255, 252, 247, .93);
  --obs-surface-solid: #fffaf4;
  --obs-card: rgba(246, 229, 213, .72);
  --obs-control: rgba(255, 255, 255, .72);
  --obs-border: rgba(119, 78, 48, .18);
  --obs-border-strong: rgba(232, 91, 19, .34);
  --obs-ink: #2d211a;
  --obs-muted: #77675d;
  --obs-shadow: 0 24px 64px rgba(87, 51, 26, .16);
  --obs-shadow-soft: 0 10px 28px rgba(87, 51, 26, .12);

  --panel: var(--obs-surface);
  --line: var(--obs-border);
  --text: var(--obs-ink);
  --muted: var(--obs-muted);
  --lime: var(--obs-accent);
  --orange: var(--obs-accent);

  --ui-surface: var(--obs-surface);
  --ui-surface-solid: var(--obs-surface-solid);
  --ui-card: var(--obs-card);
  --ui-field: var(--obs-control);
  --ui-accent-soft: var(--obs-accent-soft);
  --ui-control: var(--obs-control);
  --ui-border: var(--obs-border);
  --ui-ink: var(--obs-ink);
  --ui-muted: var(--obs-muted);
  --ui-accent: var(--obs-accent);
  --ui-meter: #ead8c9;
  --ui-chart: #fffaf4;
  --ui-shadow: var(--obs-shadow);
}

body {
  background: #17100c;
}

#map {
  background: #1d1511;
}

body[data-map-style="dark"] #map .leaflet-tile-pane {
  filter: grayscale(.18) sepia(.22) brightness(48%) contrast(124%) saturate(72%);
}

#map::after,
body[data-map-style="light"] #map::after {
  background:
    linear-gradient(90deg, rgba(34, 17, 8, .13), transparent 27%, transparent 73%, rgba(34, 17, 8, .08)),
    radial-gradient(circle at 50% 44%, transparent 48%, rgba(42, 20, 9, .16) 100%);
}

.ambient-frame {
  position: absolute;
  z-index: 430;
  inset: 9px;
  pointer-events: none;
  border: 1px solid rgba(255, 119, 43, .2);
  border-radius: 28px;
  opacity: .72;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .04);
}

.ambient-frame::before,
.ambient-frame::after {
  content: "";
  position: absolute;
  width: 88px;
  height: 3px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--obs-accent), transparent);
  box-shadow: 0 0 18px rgba(255, 107, 26, .34);
}

.ambient-frame::before {
  top: -1px;
  left: 34px;
}

.ambient-frame::after {
  right: 34px;
  bottom: -1px;
  transform: rotate(180deg);
}

.glass,
.station-panel,
.settings-dialog,
.location-search-dialog {
  border-color: var(--obs-border);
  background: var(--obs-surface);
  color: var(--obs-ink);
  box-shadow: var(--obs-shadow);
  backdrop-filter: blur(22px) saturate(1.12);
  -webkit-backdrop-filter: blur(22px) saturate(1.12);
}

/* Command capsules */
.topbar {
  position: absolute;
  z-index: 660;
  top: 20px;
  right: 20px;
  left: 20px;
  height: 58px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  pointer-events: none;
}

body[data-map-style="light"] .topbar {
  border: 0;
  background: transparent;
  box-shadow: none;
}

.brand,
.command-bar {
  pointer-events: auto;
  border: 1px solid var(--obs-border);
  background: var(--obs-surface);
  box-shadow: var(--obs-shadow-soft);
  backdrop-filter: blur(22px) saturate(1.12);
  -webkit-backdrop-filter: blur(22px) saturate(1.12);
}

.brand {
  min-height: 58px;
  padding: 7px 17px 7px 8px;
  gap: 12px;
  border-radius: 19px;
  color: var(--obs-ink);
  transition: transform .2s ease, border-color .2s ease;
}

.brand:hover {
  border-color: var(--obs-border-strong);
  transform: translateY(-1px);
}

.brand-bolt {
  width: 43px;
  height: 43px;
  flex: 0 0 43px;
  border-radius: 14px;
  background: linear-gradient(145deg, var(--obs-accent-bright), var(--obs-accent));
  color: #fff;
  font-size: 28px;
  box-shadow:
    0 8px 20px rgba(232, 91, 19, .25),
    inset 0 1px 0 rgba(255, 255, 255, .32);
}

.brand-bolt img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.brand strong {
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -.045em;
}

.brand-domain-suffix {
  color: var(--obs-accent);
}

.brand small {
  margin-top: 2px;
  color: var(--obs-muted);
  font: 500 9px "DM Mono", monospace;
  letter-spacing: .13em;
}

.command-bar {
  min-height: 58px;
  padding: 7px;
  display: flex;
  align-items: center;
  gap: 5px;
  border-radius: 19px;
}

.connection {
  min-width: 114px;
  padding: 0 10px 0 7px;
  gap: 9px;
  color: var(--obs-muted);
  font-size: 9px;
  letter-spacing: .1em;
}

.command-divider {
  width: 1px;
  height: 25px;
  margin: 0 3px;
  background: var(--obs-border);
}

.pulse {
  width: 8px;
  height: 8px;
  background: #b25a4d;
}

.pulse.online,
.station-led,
body[data-map-style="light"] .pulse.online,
body[data-map-style="light"] .station-led {
  background: var(--obs-accent);
  box-shadow:
    0 0 0 5px rgba(255, 107, 26, .1),
    0 0 15px rgba(255, 107, 26, .65);
}

.header-button,
.station-button {
  min-height: 42px;
  border-color: transparent;
  background: transparent;
  color: var(--obs-ink);
  transition:
    transform .18s ease,
    border-color .18s ease,
    background .18s ease,
    color .18s ease;
}

body[data-map-style="light"] .header-button,
body[data-map-style="light"] .station-button {
  border-color: transparent;
  background: transparent;
  color: var(--obs-ink);
}

.header-button {
  width: 42px;
  height: 42px;
  margin: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border-radius: 13px;
}

.info-button {
  text-decoration: none;
}

.language-button {
  color: var(--obs-accent);
  font: 800 10px/1 "DM Mono", monospace;
  letter-spacing: .06em;
  text-decoration: none;
}

.language-menu {
  position: relative;
}

.language-menu summary {
  list-style: none;
  cursor: pointer;
}

.language-menu summary::-webkit-details-marker {
  display: none;
}

.language-options {
  position: absolute;
  z-index: 1200;
  top: calc(100% + 10px);
  right: 0;
  width: 190px;
  padding: 8px;
  display: grid;
  gap: 3px;
  border: 1px solid var(--obs-border);
  border-radius: 16px;
  background: var(--obs-surface-solid);
  box-shadow: var(--obs-shadow);
}

.language-options a {
  min-height: 42px;
  padding: 0 11px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-radius: 10px;
  color: var(--obs-ink);
  font-size: 12px;
  font-weight: 750;
  text-decoration: none;
}

.language-options a:hover,
.language-options a[aria-current="true"] {
  background: var(--obs-accent-soft);
  color: var(--obs-accent);
}

.language-options small {
  color: var(--obs-muted);
  font: 800 9px/1 "DM Mono", monospace;
}

.command-button {
  width: auto;
  padding: 0 12px;
}

.header-icon {
  font-size: 18px;
}

.header-label {
  font-size: 10px;
  font-weight: 800;
}

.station-button {
  margin: 0;
  padding: 0 12px;
  border-radius: 13px;
  font-size: 10px;
}

.language-setting-row .secondary-button {
  min-width: 92px;
  text-align: center;
  text-decoration: none;
}

.settings-language-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(48px, 1fr));
  gap: 6px;
}

.settings-language-grid .secondary-button {
  min-width: 0;
}

.settings-language-grid .secondary-button.active {
  border-color: var(--obs-accent);
  background: var(--obs-accent-soft);
  color: var(--obs-accent);
}

.header-button:hover,
.station-button:hover,
body[data-map-style="light"] .header-button:hover,
body[data-map-style="light"] .station-button:hover {
  border-color: var(--obs-border-strong);
  background: var(--obs-accent-soft);
  color: var(--obs-accent);
  transform: translateY(-1px);
}

/* Live pulse card */
.stats {
  top: 96px;
  left: 20px;
  width: 318px;
  padding: 22px;
  overflow: hidden;
  border-radius: var(--obs-radius);
}

.stats::before {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--obs-accent), var(--obs-accent-bright) 42%, transparent 88%);
}

.stats::after {
  content: "";
  position: absolute;
  z-index: -1;
  top: -82px;
  left: -55px;
  width: 190px;
  height: 190px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 107, 26, .13), transparent 68%);
  pointer-events: none;
}

.panel-titlebar {
  position: relative;
  z-index: 1;
}

.kicker {
  color: var(--obs-accent);
  font-size: 9px;
  font-weight: 500;
  letter-spacing: .18em;
}

.live-chip {
  display: inline-flex;
  min-height: 20px;
  margin-left: 6px;
  padding: 0 7px;
  align-items: center;
  border: 1px solid var(--obs-border-strong);
  border-radius: 999px;
  background: var(--obs-accent-soft);
  color: var(--obs-accent);
  font: 700 8px "DM Mono", monospace;
  letter-spacing: .08em;
}

.collapse-button,
.round-button {
  border-color: var(--obs-border);
  background: var(--obs-control);
  color: var(--obs-ink);
}

.collapse-button:hover,
.round-button:hover {
  border-color: var(--obs-border-strong);
  color: var(--obs-accent);
}

.stat-main {
  min-height: 106px;
  padding: 20px 0 19px;
  display: flex;
  align-items: center;
  gap: 18px;
  border-bottom-color: var(--obs-border);
}

.live-signal-mark {
  position: relative;
  width: 60px;
  height: 60px;
  flex: 0 0 60px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 142, 76, .46);
  border-radius: 18px;
  background: linear-gradient(145deg, var(--obs-accent-bright), var(--obs-accent));
  color: #fff;
  font: 800 35px/1 "Manrope", sans-serif;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .3),
    0 10px 24px rgba(232, 91, 19, .22);
}

.live-signal-mark::before {
  content: "";
  position: absolute;
  inset: 6px;
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 13px;
}

.stat-main strong {
  font-size: clamp(43px, 4vw, 59px);
  line-height: .86;
  color: var(--obs-ink);
  letter-spacing: -.09em;
}

.stat-main > div > span {
  max-width: 150px;
  margin-top: 10px;
  color: var(--obs-muted);
  font-size: 11px;
  line-height: 1.35;
}

.stat-grid {
  gap: 10px;
  padding: 15px 0;
  border-bottom-color: var(--obs-border);
}

.stat-grid > div {
  padding: 11px 12px;
  border: 1px solid var(--obs-border);
  border-radius: 13px;
  background: var(--obs-card);
}

.stat-grid span,
.source-row span {
  color: var(--obs-muted);
  font-size: 8px;
  text-transform: uppercase;
  letter-spacing: .05em;
}

.stat-grid strong,
.source-row strong {
  margin-top: 6px;
  color: var(--obs-ink);
  font-size: 10px;
}

.source-row {
  padding-top: 14px;
}

.source-row strong,
body[data-map-style="light"] .source-row strong {
  color: var(--obs-accent);
}

.live-note {
  margin: 13px 0 0;
  padding-left: 12px;
  border-left: 2px solid var(--obs-accent);
  color: var(--obs-muted);
  font-size: 8px;
  line-height: 1.55;
}

.stats.collapsed {
  width: 244px;
  min-height: 61px;
  padding: 15px 16px;
}

.stats.collapsed .panel-titlebar {
  align-items: center;
}

.stats.collapsed .kicker {
  margin: 0 0 3px;
}

/* Floating map tools */
.map-tools {
  position: absolute;
  z-index: 620;
  top: 96px;
  right: 20px;
  display: grid;
  gap: 8px;
}

.map-tools .glass {
  position: relative;
}

.refresh-button,
.layers-button {
  top: auto;
  right: auto;
  min-width: 112px;
  min-height: 46px;
  padding: 0 15px;
  justify-content: flex-start;
  border-radius: 15px;
  color: var(--obs-ink);
  box-shadow: var(--obs-shadow-soft);
  transition: transform .18s ease, border-color .18s ease, background .18s ease;
}

.refresh-button:hover,
.layers-button:hover {
  border-color: var(--obs-border-strong);
  background: color-mix(in srgb, var(--obs-surface) 88%, var(--obs-accent));
  transform: translateX(-2px);
}

.refresh-button > span:first-child,
.layers-button > span:first-child {
  width: 22px;
  color: var(--obs-accent);
  font-size: 18px;
  text-align: center;
}

.layers-panel {
  top: 202px;
  right: 20px;
  width: 292px;
  max-height: calc(100vh - 226px);
  padding: 20px;
  border-radius: var(--obs-radius);
}

.surface-titlebar {
  position: sticky;
  top: -2px;
  z-index: 3;
  margin: -2px -2px 4px;
  padding: 2px 2px 12px;
  background: color-mix(in srgb, var(--obs-surface) 94%, transparent);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.surface-titlebar > div > strong {
  color: var(--obs-ink);
}

.surface-close {
  position: static;
  border-color: var(--obs-border);
  background: var(--obs-field);
  color: var(--obs-ink);
}

.surface-close:hover {
  border-color: var(--obs-accent);
  color: var(--obs-accent);
}

.layers-panel label {
  min-height: 57px;
  padding: 11px 2px;
  border-top-color: var(--obs-border);
}

.layers-panel label span strong {
  font-size: 12px;
}

.layers-panel label span small {
  margin-top: 4px;
  color: var(--obs-muted);
  font-size: 9px;
  line-height: 1.35;
}

.layers-panel input {
  accent-color: var(--obs-accent);
}

/* Timeline becomes a deliberate observation dock */
.timeline,
.timeline.collapsed {
  right: auto;
  bottom: 20px;
  left: 50%;
  width: clamp(470px, 48vw, 720px);
  padding: 18px 21px 16px;
  border-radius: var(--obs-radius);
  transform: translateX(-50%);
}

.timeline::before {
  content: "";
  position: absolute;
  top: 8px;
  left: 50%;
  width: 38px;
  height: 3px;
  border-radius: 999px;
  background: var(--obs-border-strong);
  transform: translateX(-50%);
}

.timeline-heading {
  min-height: 41px;
}

.timeline-heading strong {
  font-size: 14px;
  letter-spacing: -.02em;
}

.timeline-mode {
  margin-top: 12px;
  padding: 4px;
  border: 1px solid var(--obs-border);
  background: var(--obs-control);
}

.timeline-mode button {
  min-height: 34px;
  font-size: 10px;
}

.timeline-mode button.active,
body[data-map-style="light"] .timeline-mode button.active {
  background: linear-gradient(135deg, var(--obs-accent-bright), var(--obs-accent));
  color: #fff;
  box-shadow: 0 7px 18px rgba(232, 91, 19, .18);
}

input[type="range"] {
  accent-color: var(--obs-accent);
}

.range-labels,
.legend {
  color: var(--obs-muted);
}

.timeline.collapsed {
  width: 390px;
  min-height: 65px;
  padding: 14px 17px;
}

/* Detail surfaces */
.detail-panel,
.detector-panel {
  top: 96px;
  left: 356px;
  width: 326px;
  padding: 23px;
  border-radius: var(--obs-radius);
}

.storm-legend {
  top: 96px;
  right: 151px;
  width: 340px;
  max-height: calc(100vh - 120px);
  padding: 22px;
  border-radius: var(--obs-radius);
}

.storm-actions {
  grid-template-columns: 1fr;
}

.storm-actions button {
  min-height: 42px;
  border-color: var(--obs-border-strong);
  background: var(--obs-accent-soft);
  color: var(--obs-accent);
}

.weather-context {
  right: 20px;
  bottom: 20px;
  width: 344px;
  padding: 22px;
  border-radius: var(--obs-radius);
}

.detail-close {
  top: 9px;
  right: 10px;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 12px;
}

.detail-close:hover {
  background: var(--obs-accent-soft);
  color: var(--obs-accent);
}

.active-region-button,
.activity-totals span,
.weather-grid article,
.detector-grid div,
.local-health-grid article,
.station-summary-grid article,
.history-chart-wrap,
.legacy-periods article,
.legacy-event,
.detail-station-list {
  border-color: var(--obs-border);
  background: var(--obs-card);
}

/* Station observatory */
.station-panel {
  top: 20px;
  right: 20px;
  bottom: 20px;
  width: min(520px, calc(100% - 40px));
  padding: 28px;
  border-color: var(--obs-border);
  border-radius: 28px;
  background:
    radial-gradient(circle at 100% 0, rgba(255, 107, 26, .13), transparent 28%),
    var(--obs-surface-solid);
  box-shadow: 0 34px 100px rgba(30, 14, 5, .42);
}

.station-panel::before {
  content: "";
  position: absolute;
  top: 0;
  right: 70px;
  left: 28px;
  height: 3px;
  border-radius: 0 0 999px 999px;
  background: linear-gradient(90deg, var(--obs-accent), var(--obs-accent-bright), transparent);
}

.station-full-link {
  min-height: 76px;
  margin-top: 18px;
  padding: 17px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border: 1px solid var(--obs-border-strong);
  border-radius: 17px;
  background:
    linear-gradient(135deg, var(--obs-accent-soft), transparent 68%),
    var(--obs-card);
  color: var(--obs-ink);
  text-decoration: none;
  transition: transform .18s ease, border-color .18s ease, background .18s ease;
}

.station-full-link:hover {
  border-color: var(--obs-accent);
  background: var(--obs-accent-soft);
  transform: translateY(-1px);
}

.station-full-link span,
.station-full-link small,
.station-full-link strong {
  display: block;
}

.station-full-link small {
  margin-bottom: 5px;
  color: var(--obs-accent);
  font: 500 9px "DM Mono", monospace;
  letter-spacing: .14em;
}

.station-full-link strong {
  font-size: 14px;
}

.station-full-link i {
  color: var(--obs-accent);
  font: normal 24px/1 "Manrope", sans-serif;
}

.station-panel-head h2 {
  font-size: 30px;
  font-weight: 800;
}

.station-hero {
  min-height: 106px;
  margin-top: 24px;
  padding: 20px;
  border-color: var(--obs-border-strong);
  border-radius: 19px;
  background:
    linear-gradient(135deg, var(--obs-accent-soft), transparent 68%),
    var(--obs-card);
}

.station-status-dot.online {
  background: var(--obs-accent);
  box-shadow: 0 0 0 7px rgba(255, 107, 26, .1), 0 0 18px rgba(255, 107, 26, .52);
}

.signal-count strong,
body[data-map-style="light"] .signal-count strong {
  color: var(--obs-accent);
  font-size: 30px;
}

.station-meta {
  gap: 9px;
  margin: 11px 0 27px;
}

.station-meta div {
  min-height: 64px;
  padding: 13px;
  border: 1px solid var(--obs-border);
  background: var(--obs-card);
}

.local-health {
  padding: 20px;
  border-color: var(--obs-border);
  border-radius: 19px;
  background: var(--obs-accent-soft);
}

.local-health-grid {
  gap: 9px;
}

.local-health-grid article {
  min-height: 82px;
  padding: 13px;
  border-radius: 13px;
}

.station-history-section {
  border-top-color: var(--obs-border);
}

.station-summary-grid {
  gap: 9px;
  margin-bottom: 10px;
}

.station-summary-grid article {
  min-height: 78px;
  padding: 13px;
  border-radius: 13px;
}

.history-chart-wrap {
  padding: 12px;
  border-radius: 16px;
}

.legacy-archive {
  border-color: var(--obs-border);
  border-radius: 16px;
  background: var(--obs-accent-soft);
}

.privacy-note {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--obs-border);
  color: var(--obs-muted);
}

.settings-dialog,
.location-search-dialog {
  border-color: var(--obs-border);
  border-radius: 26px;
  background:
    radial-gradient(circle at 100% 0, rgba(255, 107, 26, .11), transparent 26%),
    var(--obs-surface-solid);
}

.settings-dialog::backdrop,
.location-search-dialog::backdrop {
  background: rgba(34, 20, 12, .48);
}

.choice-card,
.setting-row select,
.location-search-field input,
.location-search-results button,
.secondary-button {
  border-color: var(--obs-border);
  background: var(--obs-control);
  color: var(--obs-ink);
}

.save-button {
  background: linear-gradient(135deg, var(--obs-accent-bright), var(--obs-accent));
  color: #fff;
  box-shadow: 0 8px 20px rgba(232, 91, 19, .2);
}

.toast {
  border: 1px solid var(--obs-border);
  border-radius: 14px;
  background: var(--obs-surface-solid);
  color: var(--obs-ink);
}

.leaflet-control-zoom {
  overflow: hidden;
  border: 1px solid var(--obs-border) !important;
  border-radius: 15px !important;
  box-shadow: var(--obs-shadow-soft) !important;
}

.leaflet-control-zoom a,
body[data-map-style="light"] .leaflet-control-zoom a {
  background: var(--obs-surface-solid) !important;
  color: var(--obs-ink) !important;
  border-color: var(--obs-border) !important;
}

.leaflet-control-zoom a:hover {
  color: var(--obs-accent) !important;
}

.leaflet-control-attribution,
body[data-map-style="light"] .leaflet-control-attribution {
  border-radius: 8px 0 0 0;
  background: color-mix(in srgb, var(--obs-surface-solid) 82%, transparent) !important;
  color: var(--obs-muted) !important;
}

.lightningfront-attribution {
  cursor: pointer;
}

.leaflet-control-attribution a,
body[data-map-style="light"] .leaflet-control-attribution a {
  color: var(--obs-accent) !important;
}

@media (max-width: 1180px) {
  .command-button {
    width: 42px;
    padding: 0;
  }

  .command-button .header-label {
    display: none;
  }

  .timeline,
  .timeline.collapsed {
    width: clamp(430px, 46vw, 560px);
  }

  .detail-panel,
  .detector-panel {
    left: 20px;
    top: 430px;
  }
}

@media (max-width: 900px) {
  .station-button {
    width: 42px;
    padding: 0;
    font-size: 0;
  }

  .station-button .station-led {
    margin: auto;
  }

  .connection {
    min-width: auto;
  }

  .connection > span:not(.pulse) {
    display: none;
  }

  .command-divider {
    display: none;
  }

  .timeline,
  .timeline.collapsed {
    width: min(520px, calc(100vw - 40px));
  }
}

@media (max-width: 768px) {
  :root {
    --mobile-gutter: 10px;
    --mobile-top: max(10px, env(safe-area-inset-top));
    --mobile-bottom: max(10px, env(safe-area-inset-bottom));
    --mobile-header-height: 62px;
    --mobile-timeline-height: 66px;
  }

  .ambient-frame {
    inset: 5px;
    border-radius: 21px;
  }

  .ambient-frame::before,
  .ambient-frame::after {
    width: 52px;
  }

  .topbar {
    top: var(--mobile-top);
    right: var(--mobile-gutter);
    left: var(--mobile-gutter);
    height: var(--mobile-header-height);
    padding: 5px;
    gap: 2px;
    border: 1px solid var(--obs-border);
    border-radius: 19px;
    background: var(--obs-surface);
    box-shadow: var(--obs-shadow-soft);
    backdrop-filter: blur(22px) saturate(1.12);
    -webkit-backdrop-filter: blur(22px) saturate(1.12);
    pointer-events: auto;
  }

  .brand,
  .command-bar {
    min-height: 50px;
    border: 0;
    background: transparent;
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }

  .brand {
    min-width: 0;
    padding: 4px;
    gap: 9px;
  }

  .brand-bolt {
    width: 40px;
    height: 40px;
    flex-basis: 40px;
    border-radius: 12px;
    font-size: 26px;
  }

  .brand strong {
    font-size: 16px;
  }

  .brand small {
    display: none;
  }

  .command-bar {
    padding: 0;
    gap: 1px;
  }

  .connection {
    width: 18px;
    min-width: 18px;
    padding: 0 4px 0 0;
  }

  .header-button,
  .station-button {
    width: 42px;
    height: 42px;
    min-height: 42px;
    margin: 0;
    padding: 0;
    border-radius: 12px;
  }

  .header-button {
    font-size: 18px;
  }

  .header-label {
    display: none;
  }

  #station-button,
  #share-button {
    display: none;
  }

  .stats,
  .stats.collapsed {
    top: calc(var(--mobile-top) + var(--mobile-header-height) + 10px);
    left: var(--mobile-gutter);
    width: min(256px, calc(100% - 76px));
    border-radius: 18px;
  }

  .stats {
    padding: 19px;
  }

  .stats.collapsed {
    min-height: 58px;
    padding: 12px 14px;
  }

  .kicker {
    font-size: 12px;
  }

  .live-chip {
    min-height: 21px;
    font-size: 9px;
  }

  .panel-summary {
    font-size: 14px;
  }

  .panel-summary strong {
    font-size: 17px;
  }

  .stat-main {
    min-height: 94px;
    gap: 13px;
  }

  .live-signal-mark {
    width: 52px;
    height: 52px;
    flex-basis: 52px;
    border-radius: 15px;
    font-size: 31px;
  }

  .stat-main strong {
    font-size: 43px;
  }

  .stat-main > div > span,
  .stat-grid span,
  .source-row span,
  .live-note {
    font-size: 13px;
  }

  .stat-grid strong,
  .source-row strong {
    font-size: 14px;
  }

  .map-tools {
    top: calc(var(--mobile-top) + var(--mobile-header-height) + 10px);
    right: var(--mobile-gutter);
  }

  .refresh-button,
  .layers-button {
    width: 48px;
    min-width: 48px;
    height: 48px;
    min-height: 48px;
    padding: 0;
    justify-content: center;
    border-radius: 15px;
  }

  .refresh-button > span:first-child,
  .layers-button > span:first-child {
    width: auto;
  }

  .refresh-button span:last-child,
  .layers-button span:last-child {
    display: none;
  }

  .layers-panel {
    top: calc(var(--mobile-top) + var(--mobile-header-height) + 116px);
    right: var(--mobile-gutter);
    bottom: calc(var(--mobile-bottom) + var(--mobile-timeline-height) + 10px);
    left: var(--mobile-gutter);
    width: auto;
    max-height: none;
    padding: 20px;
    border-radius: 22px;
  }

  .layers-panel label span strong {
    font-size: 16px;
  }

  .layers-panel label span small {
    font-size: 13px;
  }

  .timeline,
  .timeline.collapsed {
    right: var(--mobile-gutter);
    bottom: var(--mobile-bottom);
    left: var(--mobile-gutter);
    width: auto;
    padding: 15px 16px;
    border-radius: 19px;
    transform: none;
  }

  .timeline:not(.collapsed) {
    max-height: min(45dvh, 360px);
  }

  .timeline-heading strong {
    font-size: 17px;
  }

  .timeline-mode button {
    min-height: 42px;
    font-size: 14px;
  }

  .detail-panel,
  .detector-panel,
  .weather-context,
  .storm-legend {
    top: auto;
    right: var(--mobile-gutter);
    bottom: calc(var(--mobile-bottom) + var(--mobile-timeline-height) + 10px);
    left: var(--mobile-gutter);
    width: auto;
    max-height: min(64dvh, 620px);
    padding: 22px;
    overflow: auto;
    border-radius: 23px;
  }

  .station-panel {
    top: var(--mobile-top);
    right: var(--mobile-gutter);
    bottom: var(--mobile-bottom);
    width: calc(100% - 2 * var(--mobile-gutter));
    padding: 23px;
    border-radius: 24px;
  }

  .station-panel-head h2 {
    font-size: 28px;
  }

  .station-hero {
    grid-template-columns: auto 1fr;
    gap: 13px;
  }

  .station-hero .signal-count {
    grid-column: 1 / -1;
    padding-top: 14px;
    border-top: 1px solid var(--obs-border);
    text-align: left;
  }

  .station-meta,
  .station-summary-grid {
    grid-template-columns: 1fr 1fr;
  }

  .station-meta div:last-child,
  .station-summary-grid article:last-child {
    grid-column: 1 / -1;
  }

  .local-health-grid {
    grid-template-columns: 1fr 1fr;
  }

  .local-health-grid span,
  .local-health-grid small,
  .station-meta span,
  .station-summary-grid span,
  .station-summary-grid small,
  .privacy-note,
  .gateway-privacy {
    font-size: 13px;
    line-height: 1.45;
  }

  .local-health-grid strong,
  .station-meta strong,
  .station-summary-grid strong {
    font-size: 16px;
  }
}

@media (max-width: 390px) {
  .brand-wordmark {
    max-width: 112px;
  }

  .brand strong {
    font-size: 15px;
  }

  .header-button {
    width: 40px;
  }

  #world-view-button {
    display: none;
  }

  .station-meta,
  .station-summary-grid,
  .local-health-grid {
    grid-template-columns: 1fr;
  }

  .station-meta div:last-child,
  .station-summary-grid article:last-child {
    grid-column: auto;
  }
}
