* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg: #0e1116;
  --surface: #161b22;
  --surface2: #1c222b;
  --border: #262d36;
  --text: #e6edf3;
  --muted: #8b949e;
  --accent: #e5484d;
  --danger: #e5484d;
  --chip-bg: rgba(255, 255, 255, 0.05);
  --chip-border: rgba(255, 255, 255, 0.10);
  --input-bg: #0e1116;
  --area-bg: #1c222b;
  --hover-bg: rgba(255, 255, 255, 0.06);
  --tile-filter: none;
  --map-bg: #161b22;
  --dropdown-bg: #1c222b;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  --on: #2da44e;
  --on-track: #1e3a2a;
  --checked-row: rgba(229, 72, 77, 0.10);
}

[data-theme="light"] {
  --bg: #f6f8fa;
  --surface: #ffffff;
  --surface2: #f6f8fa;
  --border: #d0d7de;
  --text: #1f2328;
  --muted: #57606a;
  --accent: #cf222e;
  --danger: #cf222e;
  --chip-bg: rgba(0, 0, 0, 0.04);
  --chip-border: rgba(0, 0, 0, 0.10);
  --input-bg: #ffffff;
  --area-bg: #f6f8fa;
  --hover-bg: rgba(0, 0, 0, 0.04);
  --tile-filter: none;
  --map-bg: #e5e5e5;
  --dropdown-bg: #ffffff;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  --on: #1a7f37;
  --on-track: #dafbe1;
  --checked-row: rgba(207, 34, 46, 0.07);
}

html:not([data-theme="light"]) {
  --tile-filter: invert(100%) hue-rotate(180deg) brightness(95%) contrast(90%);
}

html, body {
  font-family: 'Heebo', sans-serif;
  background: var(--bg);
  color: var(--text);
}

html, body {
  overflow-x: clip;
}

button, input, select {
  font-family: 'Heebo', sans-serif;
}

button:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

#site-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

#site-logo-link {
  flex-shrink: 0;
  line-height: 0;
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}

#site-logo {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--border);
  object-fit: cover;
}

#site-title {
  flex: 1;
  min-width: 0;
  font-size: 17px;
  font-weight: 600;
  line-height: 1.3;
  overflow-wrap: break-word;
}

#header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

#lang-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

#lang-btn, #theme-btn, #contact-btn, #shelters-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 19px;
  cursor: pointer;
  width: 44px;
  height: 44px;
  min-width: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}

#lang-btn:hover, #theme-btn:hover, #contact-btn:hover, #shelters-btn:hover {
  background: var(--hover-bg);
}

#lang-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  inset-inline-end: 0;
  background: var(--dropdown-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  min-width: 150px;
  max-width: min(220px, 90vw);
  z-index: 99999;
  box-shadow: var(--shadow);
}

.lang-option {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 16px;
  font-size: 14px;
  color: var(--text);
  text-decoration: none;
  border-bottom: 1px solid var(--border);
  text-align: center;
}

.lang-option:last-child {
  border-bottom: none;
}

.lang-option:hover {
  background: var(--hover-bg);
}

#home-view {
  display: none;
  min-width: 0;
}

#home-view.active {
  display: block;
}

#home-main {
  display: block;
  min-width: 0;
}

#map-wrap {
  position: relative;
  min-height: 48vh;
}

#map-home {
  width: 100%;
  height: 48vh;
  min-height: 280px;
  z-index: 1;
}

#sidebar {
  display: block;
  min-width: 0;
  background: var(--bg);
}

#clock-bar {
  display: flex;
  flex-direction: row;
  align-items: baseline;
  gap: 8px;
  white-space: nowrap;
  flex-shrink: 0;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--chip-bg);
  border: 1px solid var(--border);
}

#clock-date {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 1px;
  color: var(--muted);
  margin-bottom: 0;
  overflow-wrap: break-word;
}

#clock-time {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  letter-spacing: 1px;
  line-height: 1.2;
}

@media (max-width: 700px) {
  #site-header {
    flex-wrap: wrap;
  }
  #clock-bar {
    order: 99;
    flex-basis: 100%;
    justify-content: center;
  }
}

#sidebar-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.tab-btn {
  flex: 1;
  min-height: 44px;
  padding: 10px 8px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.tab-btn.active {
  color: var(--text);
  border-bottom: 2px solid var(--accent);
}

.tab-btn:hover:not(.active) {
  color: var(--text);
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

#alerts-container {
  padding: 0;
}

#no-alerts {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  color: var(--muted);
  font-size: 14px;
  gap: 8px;
  padding: 32px 20px;
  text-align: center;
}

#no-alerts .icon {
  font-size: 28px;
  opacity: 0.45;
}

.alert-block {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.alert-block-content {
  flex: 1;
  min-width: 0;
}

.alert-cat-tab {
  width: 24px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  border-radius: 4px 0 0 4px;
  margin: 5px 5px 5px 0;
}

html[dir="ltr"] .alert-cat-tab {
  border-radius: 0 4px 4px 0;
  margin: 5px 0 5px 5px;
}

.alert-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px 7px;
}

.alert-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}

.alert-title-row {
  flex: 1;
  min-width: 0;
}

.alert-type {
  font-size: 13px;
  font-weight: 700;
  overflow-wrap: break-word;
}

.alert-count {
  font-size: 12px;
  color: var(--muted);
  margin-top: 1px;
}

.alert-body {
  padding: 0 12px 10px;
}

.alert-area-group {
  margin-bottom: 6px;
}

.alert-area-name {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 3px;
  overflow-wrap: break-word;
}

.alert-cities {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.city-chip {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  font-size: 12px;
  padding: 5px 10px;
  border-radius: 7px;
  background: var(--chip-bg);
  border: 1px solid var(--chip-border);
  cursor: pointer;
  color: var(--text);
  overflow-wrap: break-word;
}

.city-chip:hover {
  background: var(--hover-bg);
}

.city-chip.active {
  color: #fff;
  font-weight: 600;
  border-color: transparent;
}

.alert-timestamps {
  margin-top: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ts-row {
  font-size: 12px;
  color: var(--muted);
  direction: ltr;
  text-align: right;
}

.ts-range {
  margin-bottom: 4px;
}

.alert-instruction {
  margin-top: 10px;
  font-size: 13px;
  color: var(--muted);
  font-style: italic;
  border-top: 1px solid var(--border);
  padding-top: 8px;
  overflow-wrap: break-word;
}

.leaflet-tile-pane {
  filter: var(--tile-filter);
}

.leaflet-container {
  background: var(--map-bg);
}

#settings-content {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  min-width: 0;
}

.settings-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  min-width: 0;
}

.settings-subgroup {
  margin-top: 14px;
}

.settings-subgroup + .settings-subgroup {
  border-top: 1px solid var(--border);
  padding-top: 14px;
}

.settings-label {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
  overflow-wrap: break-word;
}

.settings-label.settings-subhead {
  font-size: 13px;
}

.settings-sublabel {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 10px;
  line-height: 1.6;
  overflow-wrap: break-word;
}

#area-search, #city-search {
  width: 100%;
  min-height: 44px;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 14px;
  padding: 10px 12px;
  outline: none;
  margin-bottom: 8px;
}

#area-search:focus, #city-search:focus {
  border-color: var(--accent);
}

#area-search::placeholder, #city-search::placeholder {
  color: var(--muted);
}

#area-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 280px;
  overflow-y: auto;
  margin-bottom: 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 4px;
}

.area-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 8px 10px;
  cursor: pointer;
  border-radius: 6px;
  font-size: 14px;
  overflow-wrap: break-word;
}

.area-row:hover {
  background: var(--hover-bg);
}

.area-row:has(input:checked) {
  background: var(--checked-row);
}

.area-row input[type="checkbox"] {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  accent-color: var(--accent);
  cursor: pointer;
}

.area-empty {
  padding: 12px;
  font-size: 13px;
  color: var(--muted);
  text-align: center;
}

#clear-areas-btn, #clear-cities-btn {
  background: none;
  border: 1px dashed var(--border);
  border-radius: 8px;
  color: var(--muted);
  font-size: 13px;
  min-height: 44px;
  padding: 10px 12px;
  cursor: pointer;
  width: 100%;
  text-align: center;
}

#clear-areas-btn:hover, #clear-cities-btn:hover {
  color: var(--text);
  border-color: var(--muted);
}

#city-search-wrap {
  position: relative;
}

#city-autocomplete {
  background: var(--dropdown-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 8px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.autocomplete-item {
  padding: 10px 12px;
  min-height: 44px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  cursor: pointer;
  font-size: 14px;
  border-bottom: 1px solid var(--border);
}

.autocomplete-item:last-child {
  border-bottom: none;
}

.autocomplete-item:hover {
  background: var(--hover-bg);
}

.autocomplete-item .ac-name {
  color: var(--text);
}

.autocomplete-item .ac-area {
  color: var(--muted);
  font-size: 11px;
  margin-top: 1px;
}

#selected-cities {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 8px;
}

.city-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  background: var(--chip-bg);
  border: 1px solid var(--chip-border);
  border-radius: 8px;
  padding: 8px 10px;
}

.city-row-name {
  flex: 1;
  min-width: 0;
  font-size: 14px;
  overflow-wrap: break-word;
}

.city-row-area {
  font-size: 12px;
  color: var(--muted);
  flex-shrink: 0;
}

.city-remove-btn {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.city-remove-btn:hover {
  color: var(--accent);
}

.sound-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 4px;
  min-height: 44px;
}

.toggle-switch {
  position: relative;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--border);
  border-radius: 24px;
  cursor: pointer;
}

.toggle-slider:before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  right: 3px;
  top: 3px;
  background: var(--muted);
  border-radius: 50%;
}

.toggle-switch input:checked + .toggle-slider {
  background: var(--on-track);
}

.toggle-switch input:checked + .toggle-slider:before {
  transform: translateX(-20px);
  background: var(--on);
}

.sound-select-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  margin-bottom: 10px;
}

.sound-select {
  flex: 1;
  min-width: 0;
  min-height: 44px;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 14px;
  padding: 10px 8px;
  outline: none;
}

.sound-preview-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  cursor: pointer;
  font-size: 14px;
  min-width: 44px;
  min-height: 44px;
  padding: 10px 12px;
  flex-shrink: 0;
}

.sound-preview-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.settings-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 4px 0;
}

.social-links {
  display: flex;
  flex-direction: row;
  gap: 12px;
  align-items: center;
  justify-content: center;
  margin-top: 8px;
  flex-wrap: wrap;
}

.social-link {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  opacity: 0.8;
}

.social-link:hover {
  opacity: 1;
}

.pwa-download-line {
  text-align: center;
  font-size: 14px;
  color: var(--muted);
  line-height: 1.6;
  margin-top: 10px;
}

.pwa-download-line a {
  color: var(--accent);
  text-decoration: underline;
  cursor: pointer;
}

#settings-credits {
  text-align: center;
}

.credits-line {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.7;
  overflow-wrap: break-word;
}

.credits-line a {
  color: var(--muted);
  text-decoration: underline;
}

.credits-disclaimer {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.6;
  margin-top: 8px;
  overflow-wrap: break-word;
}

#legal-content {
  margin-top: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 14px;
}

.legal-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}
html[lang="ru"] .legal-tabs {
  overflow-x: auto;
}
html[lang="ru"] .legal-tab-btn {
  white-space: nowrap;
  flex-shrink: 0;
}

.legal-tab-btn {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
}

.legal-tab-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.legal-pane {
  display: none;
  max-height: 260px;
  overflow-y: auto;
  padding-inline-end: 4px;
}

.legal-pane.active {
  display: block;
}

.legal-list {
  margin: 0;
  padding-inline-start: 28px;
  font-size: 13px;
  color: var(--text);
  line-height: 1.7;
}

.legal-list li {
  margin-bottom: 6px;
}

#contact-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
}

#contact-modal-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 24px;
  max-width: 320px;
  width: 90%;
  text-align: center;
  position: relative;
}

#contact-modal-close {
  position: absolute;
  top: 8px;
  inset-inline-end: 8px;
  background: transparent;
  border: none;
  font-size: 18px;
  cursor: pointer;
  color: var(--muted);
}

#contact-modal-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--text);
}

#contact-modal-text {
  font-size: 14px;
  color: var(--text);
  margin-bottom: 8px;
  line-height: 1.6;
}

#contact-modal-link {
  display: inline-block;
  margin-top: 8px;
  padding: 10px 20px;
  background: var(--accent);
  color: #fff;
  border-radius: 8px;
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
}

#alert-view {
  display: none;
  padding: 16px;
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
}

#alert-view.active {
  display: block;
}

#alert-title {
  text-align: center;
  font-size: clamp(20px, 5vw, 28px);
  font-weight: 700;
  color: var(--danger);
  line-height: 1.3;
  margin: 8px 0 10px;
  overflow-wrap: break-word;
}

#alert-view h2 {
  text-align: center;
  color: var(--muted);
  font-weight: normal;
  font-style: italic;
  font-size: clamp(14px, 3.5vw, 18px);
  margin-bottom: 16px;
  overflow-wrap: break-word;
}

#alert-view h3 {
  color: var(--accent);
  margin-top: 20px;
  margin-bottom: 6px;
  font-size: 16px;
  border-bottom: 1px solid var(--accent);
  padding-bottom: 4px;
  overflow-wrap: break-word;
}

#alert-view .area {
  margin-top: 20px;
}

#alert-view ul {
  display: grid;
  grid-template-columns: 1fr;
  list-style: none;
  padding: 0;
  gap: 6px;
}

#alert-view li {
  background: var(--area-bg);
  padding: 10px 8px;
  min-height: 44px;
  display: flex;
  align-items: center;
  border-inline-end: 3px solid var(--accent);
  font-size: 14px;
  color: var(--text);
  overflow-wrap: break-word;
}

#alert-view li.clickable {
  cursor: pointer;
}

#alert-view li.clickable:hover {
  background: var(--hover-bg);
}

#alert-view li.active-city {
  background: var(--accent);
  color: #fff;
}

.detail-instruction {
  text-align: center;
  font-style: italic;
  color: var(--muted);
  margin-bottom: 16px;
  font-size: 15px;
  line-height: 1.5;
}

#alert-map {
  display: none;
  width: 100%;
  height: 280px;
  border-radius: 12px;
  margin: 20px 0;
  border: 1px solid var(--border);
}

#alert-search {
  display: none;
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  margin-bottom: 16px;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 16px;
}

#alert-search::placeholder {
  color: var(--muted);
}

#sidebar-search {
  display: none;
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  margin-bottom: 16px;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 16px;
}

#sidebar-search::placeholder {
  color: var(--muted);
}

.error-title {
  color: var(--danger);
  text-align: center;
  margin-top: 40px;
  font-size: clamp(18px, 4vw, 24px);
  padding: 0 16px;
  overflow-wrap: break-word;
}

#history-link {
  font-size: 13px;
  color: var(--accent);
  cursor: pointer;
  margin-top: 6px;
  min-height: 44px;
  display: flex;
  align-items: center;
}

#history-view {
  display: none;
}

#history-view.active {
  display: block;
}

#history-back {
  padding: 10px 16px;
  min-height: 44px;
  display: flex;
  align-items: center;
  font-size: 13px;
  color: var(--accent);
  cursor: pointer;
  border-bottom: 1px solid var(--border);
}

#history-back:hover {
  background: var(--hover-bg);
}

#history-container {
  padding: 0;
}

#history-loading {
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  padding: 30px 20px;
}

#history-title {
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
}

.history-block {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  background: var(--surface);
}

.history-block:hover {
  background: var(--hover-bg);
}

.history-block:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.history-cat-tab {
  width: 28px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  border-radius: 0 4px 4px 0;
  margin: 6px 0 6px 6px;
}

html[dir="ltr"] .history-cat-tab {
  border-radius: 4px 0 0 4px;
  margin: 6px 6px 6px 0;
}

.history-block-content {
  flex: 1;
  min-width: 0;
  padding: 14px 16px;
}

.history-block-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.history-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.history-type {
  font-size: 14px;
  font-weight: 700;
  overflow-wrap: break-word;
}

.history-time {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 8px;
  direction: ltr;
  text-align: right;
}

.history-cities {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.7;
  overflow-wrap: break-word;
}

.popup-close-btn {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 16px;
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.popup-close-btn:hover {
  color: var(--accent);
}

@media (max-width: 700px) {
  .desktop-only {
    display: none !important;
  }

  #map-home .leaflet-container, #alert-map .leaflet-container {
    touch-action: pan-x pan-y pinch-zoom;
  }
}

@media (min-width: 481px) and (max-width: 700px) {
  #alert-view ul {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 701px) {
  html, body {
    height: 100%;
    overflow: hidden;
  }

  body {
    display: flex;
    flex-direction: column;
  }

  #site-header {
    flex-shrink: 0;
  }

  #home-view.active {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    height: 100vh;
  }

  #home-main {
    display: flex;
    flex-direction: row;
    flex: 1;
    min-height: 0;
  }

  html[dir="ltr"] #home-main {
    flex-direction: row-reverse;
  }

  #map-wrap {
    flex: 1;
    min-height: 0;
    min-width: 0;
    position: relative;
  }

  #map-home {
    height: 100%;
    min-height: 0;
  }

  #sidebar {
    width: 380px;
    flex: none;
    height: 100%;
    min-height: 0;
    display: flex;
    flex-direction: column;
    border-inline-end: 1px solid var(--border);
  }

  #sidebar-tabs {
    flex-shrink: 0;
  }

  #tab-alerts.active {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
  }

  #tab-settings.active {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
  }


  #alerts-container {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
  }

  #history-view.active {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
  }

  #history-back {
    flex-shrink: 0;
  }

  #history-title {
    flex-shrink: 0;
  }

  #history-container {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
  }

  #alert-view.active {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
  }

  #alert-view ul {
    grid-template-columns: repeat(3, 1fr);
  }

  #alert-map {
    height: 400px;
  }

  #alerts-container::-webkit-scrollbar, #tab-settings::-webkit-scrollbar, #history-container::-webkit-scrollbar, #area-list::-webkit-scrollbar {
    width: 4px;
  }

  #alerts-container::-webkit-scrollbar-thumb, #tab-settings::-webkit-scrollbar-thumb, #history-container::-webkit-scrollbar-thumb, #area-list::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 2px;
  }
}

.loc-btn {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
}

.loc-btn:disabled {
  opacity: 0.6;
  cursor: default;
}

.loc-status {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.6;
  margin-top: 8px;
  overflow-wrap: break-word;
}

.loc-choices {
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.loc-choice-btn {
  flex: 1;
  min-width: 100px;
  min-height: 44px;
  padding: 10px 8px;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
}

.loc-choice-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.settings-subhead-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  cursor: pointer;
  min-height: 44px;
}

.settings-areas-summary {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
  overflow-wrap: break-word;
}

.settings-chevron {
  font-size: 16px;
  color: var(--muted);
  flex-shrink: 0;
}

.city-chip.no-click {
  cursor: default;
}

.city-chip.no-click:hover {
  background: var(--chip-bg);
}

.leaflet-popup-content-wrapper {
  background: rgba(13, 17, 23, 0.92);
  color: #fff;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
}

.leaflet-popup-content {
  margin: 14px 18px;
  line-height: 1.45;
  font-size: 15px;
}

.leaflet-popup-tip {
  background: rgba(13, 17, 23, 0.92);
  box-shadow: none;
}

.share-btn {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  padding: 4px 8px;
  opacity: 0.7;
  flex-shrink: 0;
}
.share-btn:hover {
  opacity: 1;
}
.share-menu {
  background: var(--surface, #fff);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow, 0 4px 16px rgba(0,0,0,0.15));
  padding: 6px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 140px;
}
.share-menu button {
  background: none;
  border: none;
  padding: 10px 14px;
  font-size: 15px;
  cursor: pointer;
  text-align: start;
  border-radius: 8px;
  color: inherit;
}
.share-menu button:hover {
  background: rgba(0,0,0,0.06);
}
.share-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: #333;
  color: #fff;
  padding: 10px 20px;
  border-radius: 20px;
  font-size: 14px;
  z-index: 1001;
}

.legal-version {
  font-size: 11px;
  opacity: 0.5;
  text-align: center;
  margin-top: 8px;
}



#shelters-back-btn {
  padding: 8px 12px;
  border: 1px solid #ccc;
  border-radius: 4px;
  background: #fff;
  cursor: pointer;
  font-size: 18px;
}
#shelters-search {
  display: flex;
  gap: 8px;
  flex: 1;
}
#shelters-search-input {
  flex: 1;
  padding: 8px;
  border: 1px solid #ccc;
  border-radius: 4px;
}
#shelters-locate-btn {
  padding: 8px 12px;
  border: 1px solid #ccc;
  border-radius: 4px;
  background: #fff;
  cursor: pointer;
}


#shelters-autocomplete {
  position: absolute;
  top: 100%;
  right: 0;
  left: 0;
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 0 0 4px 4px;
  max-height: 200px;
  overflow-y: auto;
  z-index: 1000;
}
.shelters-ac-item {
  padding: 8px 12px;
  cursor: pointer;
  text-align: right;
}
.shelters-ac-item:hover {
  background: #f0f0f0;
}
#shelters-search {
  position: relative;
}
#map-wrap {
  position: relative;
}

#shelters-floating-panel {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 8px 12px;
  box-shadow: var(--shadow);
  max-width: 90%;
}

#shelters-floating-panel #shelters-search {
  display: flex;
  gap: 8px;
  align-items: center;
  position: relative;
}

#shelters-floating-panel #shelters-search-input {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 10px;
  background: var(--input-bg);
  color: var(--text);
  min-width: 200px;
}

#shelters-floating-panel #shelters-autocomplete {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--dropdown-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-top: 4px;
  max-height: 200px;
  overflow-y: auto;
  z-index: 1001;
}

.deeplink-highlight {
  animation: deeplink-pulse 1s ease-in-out 3;
  border-radius: 8px;
}
@keyframes deeplink-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 193, 7, 0); }
  50% { box-shadow: 0 0 0 4px rgba(255, 193, 7, 0.55); }
}

#pwa-app-settings {
  background: var(--surface);
  border: 2px solid #D32F2F;
  border-radius: 12px;
  padding: 16px;
  margin: 12px 0;
}
.pwa-header { text-align: center; margin-bottom: 8px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.pwa-header h3 { margin: 8px 0 4px 0; color: #D32F2F; }
.pwa-subtitle { font-size: 13px; color: var(--muted); margin: 0; }
.pwa-badge { font-size: 32px; }
.pwa-row { display: flex; align-items: center; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid var(--border); gap: 12px; }
.pwa-row:last-child { border-bottom: none; }
.pwa-info { flex: 1; }
.pwa-title { font-weight: 600; font-size: 15px; }
.pwa-desc { font-size: 13px; color: var(--muted); margin-top: 2px; }
.pwa-switch { position: relative; display: inline-block; width: 50px; height: 28px; flex-shrink: 0; }
.pwa-switch input { opacity: 0; width: 0; height: 0; }
.pwa-slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #ccc; border-radius: 28px; transition: .3s; }
.pwa-slider:before { position: absolute; content: ""; height: 20px; width: 20px; right: 4px; bottom: 4px; background-color: white; border-radius: 50%; transition: .3s; }
.pwa-switch input:checked + .pwa-slider { background-color: #D32F2F; }
.pwa-switch input:checked + .pwa-slider:before { transform: translateX(-22px); }
[dir="ltr"] .pwa-slider:before { right: auto; left: 4px; }
[dir="ltr"] .pwa-switch input:checked + .pwa-slider:before { transform: translateX(22px); }
.pwa-btn { background: #D32F2F; color: white; border: none; border-radius: 8px; padding: 8px 16px; font-size: 14px; cursor: pointer; flex-shrink: 0; }
.pwa-select { padding: 8px 12px; border-radius: 8px; border: 1px solid var(--border); font-size: 14px; background: var(--input-bg); color: var(--text); }
.pwa-areas-list { max-height: 200px; overflow-y: auto; border: 1px solid var(--border); border-radius: 8px; padding: 8px; margin: 8px 0; }
.pwa-check { display: flex; align-items: center; gap: 8px; padding: 6px 4px; cursor: pointer; font-size: 14px; }
.pwa-city-wrap { position: relative; margin: 8px 0; }
.pwa-city-input { width: 100%; padding: 8px 12px; border-radius: 8px; border: 1px solid var(--border); font-size: 14px; background: var(--input-bg); color: var(--text); box-sizing: border-box; }
.pwa-city-drop { position: absolute; top: 100%; left: 0; right: 0; background: var(--dropdown-bg, #fff); border: 1px solid var(--border); border-radius: 8px; margin-top: 4px; max-height: 180px; overflow-y: auto; z-index: 100; }
.pwa-city-item { padding: 8px 12px; cursor: pointer; font-size: 14px; }
.pwa-city-item:hover { background: var(--hover-bg, #f5f5f5); }
.pwa-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.pwa-chip { display: inline-flex; align-items: center; gap: 6px; background: var(--chip-bg); border: 1px solid var(--chip-border); border-radius: 16px; padding: 4px 8px 4px 12px; font-size: 13px; }
.pwa-chip-x { background: none; border: none; cursor: pointer; font-size: 12px; color: var(--muted); padding: 0 2px; }

.pwa-section { padding: 12px 0; border-bottom: 1px solid var(--border); }
.pwa-section:last-child { border-bottom: none; }
#pwa-area-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 280px;
  overflow-y: auto;
  margin-bottom: 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 4px;
}
#pwa-area-search, #pwa-city-search {
  width: 100%;
  min-height: 44px;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 16px;
  padding: 10px 12px;
  outline: none;
  margin-bottom: 8px;
  box-sizing: border-box;
}
#pwa-area-search:focus, #pwa-city-search:focus { border-color: var(--accent); }
#pwa-area-search::placeholder, #pwa-city-search::placeholder { color: var(--muted); }
#pwa-city-search-wrap { position: relative; }
#pwa-city-autocomplete {
  background: var(--dropdown-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 8px;
  overflow: hidden;
  box-shadow: var(--shadow);
}
#pwa-selected-cities {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 8px;
}

.pwa-sound-wrap { display: flex; align-items: center; gap: 8px; }
.pwa-test-btn {
  background: var(--chip-bg);
  border: 1px solid var(--chip-border);
  border-radius: 8px;
  min-width: 44px;
  min-height: 44px;
  font-size: 18px;
  cursor: pointer;
  flex-shrink: 0;
}
.pwa-test-btn:hover { background: var(--hover-bg); }

.pwa-mode #settings-content > .settings-section:not(#legal-section):not(#platforms-section) { display: none !important; }
.pwa-mode .pwa-download-line { display: none !important; }

#pwa-clear-areas-btn, #pwa-clear-cities-btn {
  background: none;
  border: 1px dashed var(--border);
  border-radius: 8px;
  color: var(--muted);
  font-size: 13px;
  min-height: 44px;
  padding: 10px 12px;
  cursor: pointer;
  width: 100%;
  text-align: center;
  margin-top: 4px;
}
#pwa-clear-areas-btn:hover, #pwa-clear-cities-btn:hover {
  color: var(--text);
  border-color: var(--muted);
}
#pwa-areas-summary {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
  margin-bottom: 6px;
  overflow-wrap: break-word;
}
