/* Base: map and page fill – no page scroll; dvh for iOS keyboard */
html, body {
  height: 100%;
  height: 100dvh;
  width: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
  position: fixed;
  inset: 0;
}
#map {
  height: 100%;
  height: 100dvh;
  width: 100%;
  overflow: hidden;
  position: absolute;
  inset: 0;
}

/* Floating pill tag on polygon: tint + glow from --map-polygon-tag-accent (alert / surrounding stroke) */
.map-polygon-area-tag {
  position: absolute;
  left: 0;
  top: 0;
  /* GPU layer + stable compositing on iOS when AdvancedMarker moves frequently */
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  transform: translate3d(-50%, -50%, 0);
  max-width: min(38vw, 160px);
  padding: 3px 8px;
  border-radius: 999px;
  box-sizing: border-box;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  font-weight: 800;
  font-size: clamp(8px, 1.9vw, 10px);
  line-height: 1.12;
  letter-spacing: 0.02em;
  color: #f8fafc;
  --_tag-accent: var(--map-polygon-tag-accent, rgba(255, 255, 255, 0.55));
  background: rgba(8, 10, 14, 0.92);
  background: color-mix(in srgb, var(--_tag-accent) 28%, rgba(8, 10, 14, 0.92));
  border: 1.5px solid var(--_tag-accent);
  box-shadow:
    0 1px 3px rgba(0, 0, 0, 0.55),
    0 0 12px color-mix(in srgb, var(--_tag-accent) 45%, transparent),
    0 0 0 1px rgba(0, 0, 0, 0.35) inset;
  text-shadow:
    0 0 1px rgba(0, 0, 0, 1),
    0 1px 2px rgba(0, 0, 0, 0.9);
}

/* Status + wake lock: fixed stack bottom-left (see #status-dock in map.html) */
/* Status strip stays compact; alert summary uses a larger max-width above. */
/* Fixed width: expanded panel matches collapsed strip (no horizontal jump). */
#status-dock {
  --status-panel-w: min(260px, calc(100vw - 2 * var(--overlay-gap)));
  position: fixed;
  bottom: max(var(--overlay-gap), env(safe-area-inset-bottom, 0px));
  left: max(var(--overlay-gap), env(safe-area-inset-left, 0px));
  right: auto;
  z-index: var(--refalert-z-chrome);
  display: inline-flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  width: var(--status-panel-w);
  max-width: var(--status-panel-w);
  min-width: 0;
  box-sizing: border-box;
  pointer-events: none;
}

#status-dock > #wake-lock-indicator {
  position: relative;
  top: auto;
  left: auto;
  flex-shrink: 0;
  align-self: stretch;
}

#status-dock > #status-overlay {
  position: relative;
  bottom: auto;
  left: auto;
  flex: 0 1 auto;
  min-width: 0;
  min-height: 0;
  max-width: 100%;
  max-height: min(calc(100dvh - 2 * var(--overlay-gap) - 40px), 32vh, 220px);
  pointer-events: auto;
}

/* Hebrew UI: dock and status copy align to the physical right (RTL). */
#status-dock.refalert-status-dock--hebrew {
  left: auto;
  right: max(var(--overlay-gap), env(safe-area-inset-right, 0px));
}

#status-dock.refalert-status-dock--hebrew #status-overlay {
  text-align: right;
}

/* Screen Wake Lock status (see map.js) */
#wake-lock-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 9px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.72);
  color: #fff;
  font-family: sans-serif;
  font-size: clamp(10px, 2.6vw, 12px);
  line-height: 1.2;
  pointer-events: none;
  user-select: none;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
}

/* Wake label flush left, zoom flush right (physical LTR inside strip even when dock is RTL). */
#wake-lock-indicator .wake-lock-main {
  direction: ltr;
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  flex-wrap: nowrap;
  gap: 0.5em;
}

#wake-lock-indicator .wake-lock-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

#wake-lock-indicator .wake-lock-zoom {
  font-variant-numeric: tabular-nums;
  opacity: 0.9;
  font-size: 1em;
  line-height: inherit;
  white-space: nowrap;
  flex-shrink: 0;
}

#wake-lock-indicator .wake-lock-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  background: #78909c;
}

#wake-lock-indicator.wake-lock-on .wake-lock-dot {
  background: #69f0ae;
  box-shadow: 0 0 6px rgba(105, 240, 174, 0.55);
}

#wake-lock-indicator.wake-lock-off .wake-lock-dot {
  background: #78909c;
}

#wake-lock-indicator.wake-lock-unsupported .wake-lock-dot {
  background: #546e7a;
  opacity: 0.75;
}

#wake-lock-indicator.wake-lock-unsupported .wake-lock-label {
  opacity: 0.85;
}

#map-watermark {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(12px, 4vw, 24px);
  pointer-events: none;
  z-index: 1;
}
#map-watermark img {
  width: clamp(80px, 20vw, 140px);
  height: auto;
  opacity: 0.20;
  filter: drop-shadow(0 0 1px rgba(0, 0, 0, 0.3)) drop-shadow(0 1px 2px rgba(0, 0, 0, 0.2));
}
#map-watermark span {
  font-family: sans-serif;
  font-size: clamp(42px, 14vw, 100px);
  font-weight: 700;
  color: rgba(255, 255, 255, 0.12);
  text-shadow: 0 0 1px rgba(0, 0, 0, 0.3), 0 1px 2px rgba(0, 0, 0, 0.2);
  letter-spacing: 0.02em;
  white-space: nowrap;
  opacity: 0.5;
}

/* Initial/visibility reload indicator */
#loading-logo-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 50;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

#loading-logo-overlay.visible {
  opacity: 1;
  visibility: visible;
}

#loading-logo-overlay img#loading-logo {
  width: clamp(60px, 18vw, 120px);
  height: auto;
  animation: loadingLogoSpin 0.9s linear infinite;
  filter: drop-shadow(0 6px 18px rgba(0,0,0,0.4));
}

@keyframes loadingLogoSpin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Responsive spacing (safe area + scale) */
:root {
  --overlay-gap: clamp(6px, 2vw, 14px);
  --overlay-pad: clamp(6px, 2vw, 12px);
  --font-status: clamp(9px, 2.2vw, 12px);
  --font-legend: clamp(9px, 2.2vw, 12px);
  --font-alert: clamp(12px, 3.5vw, 17px);
  --touch-min: 44px;
  /* Legend (marker index) stays below primary chrome so it never covers toolbar / summary / status. */
  --refalert-z-legend: 90;
  --refalert-z-chrome: 110;
}

.temporarily-hidden {
  display: none !important;
}

#status-overlay {
  overflow-y: auto;
  overflow-x: hidden;
  min-width: 0;
  box-sizing: border-box;
  background: rgba(0, 0, 0, 0.75);
  color: #fff;
  padding: clamp(5px, 1.4vw, 10px) clamp(7px, 2vw, 12px);
  font-family: sans-serif;
  font-size: var(--font-status);
  line-height: 1.28;
  border-radius: clamp(4px, 1.5vw, 6px);
  display: flex;
  flex-direction: column;
  gap: 6px;
  /* Pull native range track in so it matches text comfortable margins (RTL/LTR). */
  --status-range-end-inset: clamp(6px, 1.5vw, 12px);
}

#status-overlay .status-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-weight: 600;
  padding-bottom: 2px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  margin-bottom: 2px;
  min-width: 0;
}

#status-overlay .status-header-left {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
}

#status-overlay .status-header-clients {
  font-weight: 500;
  opacity: 0.9;
  font-size: 0.92em;
  white-space: nowrap;
}

#status-overlay .status-autohide {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 500;
  opacity: 0.95;
  user-select: none;
}

#status-overlay.collapsed {
  cursor: pointer;
  overflow-y: hidden;
  max-height: none;
}

#status-overlay.collapsed .status-header {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

#status-overlay.collapsed > :not(.status-header) {
  display: none;
}

#status-overlay .status-row-auto {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

#status-overlay .notice-sources-block {
  margin-top: 6px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.15);
}
#status-overlay .notice-sources-heading {
  font-weight: 600;
  font-size: 0.92em;
  opacity: 0.95;
  margin-bottom: 6px;
}
#status-overlay .notice-sources-checkboxes {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
#status-overlay .notice-source-option {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-weight: 500;
  font-size: 0.88em;
  line-height: 1.35;
  cursor: pointer;
  user-select: none;
}
#status-overlay .notice-source-option input {
  margin-top: 2px;
  flex-shrink: 0;
}
#status-overlay .notice-source-option-text {
  flex: 1;
  text-align: right;
  direction: rtl;
}

#status-overlay .status-sse-wrap {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

#status-overlay label {
  display: inline;
}

/* Slider row: full width of status panel; min-width 0 so range can shrink below UA default (no overflow:hidden — clips the control). */
#status-overlay .recent-alerts-minutes-label {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  align-self: stretch;
  gap: 6px 10px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

#status-overlay .recent-alerts-minutes-value {
  min-width: 2.5em;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

#status-overlay #recent-alerts-minutes-slider {
  flex: 0 0 100%;
  /* UA range widgets often paint past 100% width; narrow + center so both ends clear the panel. */
  width: calc(100% - 2 * var(--status-range-end-inset));
  max-width: calc(100% - 2 * var(--status-range-end-inset));
  min-width: 0;
  margin-inline: auto;
  box-sizing: border-box;
  min-height: 32px;
  font-size: 16px; /* prevent iOS zoom on focus */
}

#status-overlay #status-refresh {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  padding: 0;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.15);
  border: none;
  border-radius: 6px;
  color: #fff;
  cursor: pointer;
  transition: background 0.15s ease;
}
#status-overlay #status-refresh:hover {
  background: rgba(255, 255, 255, 0.3);
}
#status-overlay #status-refresh svg,
#status-overlay #status-qr svg,
#status-overlay #status-install-app svg {
  width: 14px;
  height: 14px;
}

#status-overlay #status-qr {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  padding: 0;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.15);
  border: none;
  border-radius: 6px;
  color: #fff;
  cursor: pointer;
  transition: background 0.15s ease;
}
#status-overlay #status-qr:hover {
  background: rgba(255, 255, 255, 0.3);
}

#status-overlay #status-install-app {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  padding: 0;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.15);
  border: none;
  border-radius: 6px;
  color: #fff;
  cursor: pointer;
  transition: background 0.15s ease;
}
#status-overlay #status-install-app:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* QR modal */
#qr-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 400;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  box-sizing: border-box;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}
#qr-modal-overlay.visible {
  opacity: 1;
  visibility: visible;
}
#qr-modal-overlay .qr-modal-content {
  background: #fff;
  border-radius: 12px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  max-width: 100%;
  position: relative;
}
#qr-modal-overlay .qr-modal-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 32px;
  height: 32px;
  padding: 0;
  border: none;
  background: rgba(0,0,0,0.08);
  border-radius: 8px;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  color: #333;
}
#qr-modal-overlay .qr-modal-close:hover {
  background: rgba(0,0,0,0.15);
}
#qr-modal-overlay .qr-modal-logo {
  width: 64px;
  height: 64px;
  object-fit: contain;
}
#qr-modal-overlay .qr-modal-title {
  font-family: sans-serif;
  font-size: 1.1rem;
  font-weight: 600;
  color: #333;
  margin: 0;
}
#qr-modal-overlay .qr-modal-qr {
  width: 200px;
  height: 200px;
  display: block;
  border: 0;
}
#qr-modal-overlay .qr-modal-hint {
  font-family: sans-serif;
  font-size: 0.85rem;
  color: #666;
  margin: 0;
}

/* Install app instructions (device-specific) */
.install-app-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 400;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  box-sizing: border-box;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}
.install-app-modal-overlay.visible {
  opacity: 1;
  visibility: visible;
}
.install-app-modal-overlay .install-app-modal-content {
  background: #fff;
  border-radius: 12px;
  padding: 20px 18px 18px;
  max-width: min(440px, 100%);
  width: 100%;
  max-height: min(85vh, 640px);
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: relative;
  box-sizing: border-box;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
}
.install-app-modal-overlay .install-app-modal-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 32px;
  height: 32px;
  padding: 0;
  border: none;
  background: rgba(0, 0, 0, 0.08);
  border-radius: 8px;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  color: #333;
}
.install-app-modal-overlay .install-app-modal-close:hover {
  background: rgba(0, 0, 0, 0.15);
}
.install-app-modal-overlay .install-app-modal-title {
  font-family: sans-serif;
  font-size: 1.05rem;
  font-weight: 700;
  color: #1a1a1a;
  margin: 0 36px 0 0;
  line-height: 1.35;
  direction: rtl;
  text-align: right;
}
.install-app-modal-overlay .install-app-modal-subtitle {
  font-family: sans-serif;
  font-size: 0.88rem;
  font-weight: 600;
  color: #444;
  margin: -4px 0 0;
  line-height: 1.35;
  direction: ltr;
  text-align: left;
}
.install-app-modal-overlay .install-app-modal-body {
  font-family: sans-serif;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-right: 2px;
}
.install-app-modal-overlay .install-app-step {
  margin: 0 0 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}
.install-app-modal-overlay .install-app-step:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}
.install-app-modal-overlay .install-app-step-body {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.45;
  color: #333;
}
.install-app-modal-overlay .install-app-note {
  margin: 14px 0 0;
  padding: 10px 12px;
  background: rgba(25, 118, 210, 0.08);
  border-radius: 8px;
  font-size: 0.82rem;
  line-height: 1.4;
  color: #1565c0;
}
.install-app-modal-overlay .install-app-note--single[dir="rtl"] {
  direction: rtl;
  text-align: right;
}
.install-app-modal-overlay .install-app-note--single[dir="ltr"] {
  direction: ltr;
  text-align: left;
}
.install-app-modal-overlay .install-app-note-en {
  display: block;
  margin-top: 6px;
  direction: ltr;
  text-align: left;
  color: #0d47a1;
}

.install-app-modal-overlay .install-app-push-callout {
  margin: 0 0 18px;
  padding: 14px 14px 16px;
  border: 2px solid #1565c0;
  border-radius: 12px;
  background: linear-gradient(165deg, rgba(21, 101, 192, 0.12) 0%, rgba(255, 255, 255, 0.95) 55%);
  box-shadow: 0 4px 14px rgba(21, 101, 192, 0.18);
}
.install-app-modal-overlay .install-app-push-title {
  margin: 0 0 10px;
  font-size: 1rem;
  font-weight: 800;
  line-height: 1.35;
  color: #0d47a1;
}
.install-app-modal-overlay .install-app-push-title[dir="rtl"] {
  text-align: right;
}
.install-app-modal-overlay .install-app-push-title[dir="ltr"] {
  text-align: left;
}
.install-app-modal-overlay .install-app-push-hint {
  margin: 0 0 14px;
  font-size: 0.88rem;
  line-height: 1.45;
  color: #333;
}
.install-app-modal-overlay .install-app-push-hint[dir="rtl"] {
  text-align: right;
}
.install-app-modal-overlay .install-app-push-hint[dir="ltr"] {
  text-align: left;
}
.install-app-modal-overlay .install-app-push-btn {
  display: block;
  width: 100%;
  box-sizing: border-box;
  padding: 14px 16px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-radius: 10px;
  background: #1565c0;
  color: #fff;
  font-family: sans-serif;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.35;
  cursor: pointer;
  text-align: center;
  box-shadow: 0 2px 8px rgba(13, 71, 161, 0.35);
}
.install-app-modal-overlay .install-app-push-btn:hover {
  background: #1976d2;
}
.install-app-modal-overlay .install-app-push-btn:active {
  background: #0d47a1;
}
.install-app-modal-overlay .install-app-steps-heading {
  margin: 0 0 12px;
  padding-top: 14px;
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.4;
  color: #555;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
}
.install-app-modal-overlay .install-app-steps-heading[dir="rtl"] {
  direction: rtl;
  text-align: right;
}
.install-app-modal-overlay .install-app-steps-heading[dir="ltr"] {
  direction: ltr;
  text-align: left;
}

#status-overlay .status-copyright {
  font-size: 0.85em;
  opacity: 0.8;
}

.countdown-popup {
  direction: rtl;
  z-index: 150;
  text-align: right;
}

#legend-overlay {
  position: fixed;
  bottom: var(--overlay-gap);
  right: var(--overlay-gap);
  left: auto;
  top: auto;
  background: rgba(0, 0, 0, 0.75);
  color: #fff;
  padding: var(--overlay-pad);
  font-family: sans-serif;
  font-size: var(--font-legend);
  line-height: 1.4;
  z-index: var(--refalert-z-legend);
  border-radius: clamp(4px, 1.5vw, 6px);
  max-width: min(calc(100vw - 2 * var(--overlay-gap)), 180px);
  max-height: calc(100vh - 2 * var(--overlay-gap));
  overflow-y: auto;
}

#legend-overlay .legend-item {
  display: flex;
  align-items: center;
  gap: clamp(4px, 1.2vw, 8px);
  margin: 2px 0;
}

#legend-overlay .legend-dot {
  width: clamp(8px, 2.2vw, 11px);
  height: clamp(8px, 2.2vw, 11px);
  border-radius: 50%;
  border: 1px solid #333;
  flex-shrink: 0;
}

#alert-summary-overlay {
  position: fixed;
  top: calc(var(--overlay-gap) + env(safe-area-inset-top, 0px));
  left: 50%;
  transform: translateX(-50%);
  background: rgba(23, 22, 22, 0.8);
  color: #fff;
  padding: var(--overlay-pad) clamp(10px, 3vw, 18px);
  font-family: sans-serif;
  font-size: var(--font-alert);
  line-height: 1.4;
  z-index: var(--refalert-z-chrome);
  border-radius: clamp(4px, 1.5vw, 8px);
  text-align: center;
  width: min(calc(100vw - 2 * var(--overlay-gap)), min(98vw, 1100px));
  max-width: min(calc(100vw - 2 * var(--overlay-gap)), min(98vw, 1100px));
  max-height: calc(100vh - 2 * var(--overlay-gap));
  overflow-y: auto;
  display: none;
}

#alert-summary-overlay.visible { display: block; }
#alert-summary-overlay.clickable-alert-summary.visible { cursor: pointer; }
#alert-summary-overlay.clickable-alert-summary.visible:hover {
  background: rgba(23, 22, 22, 0.88);
}

/* Collapsed: single row — whatsapp | logo | time | caption */
#alert-summary-overlay.visible.summary-collapsed {
  overflow: hidden;
}
#alert-summary-overlay.visible.summary-collapsed .alert-summary-header {
  flex-wrap: nowrap;
  margin-bottom: 0;
}
#alert-summary-overlay.visible.summary-collapsed .alert-summary-header .alert-time {
  flex-basis: auto;
  white-space: nowrap;
}
#alert-summary-overlay.visible.summary-collapsed .alert-my-location,
#alert-summary-overlay.visible.summary-collapsed .alert-areas,
#alert-summary-overlay.visible.summary-collapsed .alert-summary-auto-collapse {
  display: none;
}

#alert-summary-overlay .alert-summary-header {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: clamp(4px, 1.5vw, 10px);
  font-size: clamp(11px, 2.8vw, 14px);
  font-weight: 600;
  margin-bottom: 4px;
}


#alert-summary-overlay .alert-summary-header img,
#alert-summary-overlay .alert-summary-header-icon {
  height: clamp(18px, 4.5vw, 24px);
  width: clamp(18px, 4.5vw, 24px);
  object-fit: contain;
  opacity: 0.75;
}

#alert-summary-overlay .alert-summary-header-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  text-decoration: none;
}

#alert-summary-overlay .alert-summary-header-icon:hover {
  opacity: 1;
}

#alert-summary-overlay .alert-summary-header-icon svg {
  width: 100%;
  height: 100%;
}

#alert-summary-overlay .alert-time {
  font-weight: 600;
}

#alert-summary-overlay .alert-my-location {
  font-size: clamp(11px, 2.8vw, 14px);
  margin-top: 2px;
}

#alert-summary-overlay .no-surrounding-polygons-warning {
  /* Bigger warning so it stands out when there are no polygons */
  font-size: clamp(12px, 3.3vw, 18px);
  font-weight: 800;
  color: #ffeb3b;
}

#alert-summary-overlay .alert-areas {
  font-size: clamp(12px, 3vw, 16px);
}

#alert-summary-overlay .alert-areas.alert-areas-multiline {
  font-size: clamp(10px, 2.5vw, 12px);
  line-height: 1.3;
}

#alert-summary-overlay .alert-summary-auto-collapse {
  display: block;
  width: fit-content;
  margin-top: 6px;
  margin-left: auto;
  font-size: 11px;
  color: rgba(255,255,255,0.45);
  cursor: pointer;
  user-select: none;
  text-align: right;
}
#alert-summary-overlay .alert-summary-auto-collapse:hover {
  color: rgba(255,255,255,0.75);
}
#alert-summary-overlay .alert-summary-auto-collapse input {
  margin-right: 4px;
  cursor: pointer;
}

#map-toolbar-overlay {
  position: fixed;
  top: 50%;
  right: var(--overlay-gap);
  left: auto;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: clamp(2px, 1vw, 6px);
  z-index: var(--refalert-z-chrome);
  border-radius: clamp(4px, 1.5vw, 8px);
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0,0,0,0.3);
  transition: transform 0.28s ease, box-shadow 0.28s ease;
}

/* Hebrew / RTL: toolbar on the start (left) edge. */
#map-toolbar-overlay.refalert-toolbar--hebrew {
  right: auto;
  left: max(var(--overlay-gap), env(safe-area-inset-left, 0px));
}

/* After idle: tuck to the right; hover expands (see JS: only on hover-capable devices) */
#map-toolbar-overlay.toolbar-collapsed {
  transform: translateY(-50%) translateX(calc(100% - 18px));
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.45);
  cursor: pointer;
}

/* Hebrew: tuck off the left edge. */
#map-toolbar-overlay.refalert-toolbar--hebrew.toolbar-collapsed {
  transform: translateY(-50%) translateX(calc(-100% + 18px));
}

#map-toolbar-overlay.toolbar-collapsed:hover {
  transform: translateY(-50%) translateX(0);
  cursor: default;
}

#map-toolbar-overlay button {
  width: max(var(--touch-min), clamp(36px, 9vw, 44px));
  height: max(var(--touch-min), clamp(36px, 9vw, 44px));
  min-width: var(--touch-min);
  min-height: var(--touch-min);
  border: none;
  background: rgba(0, 0, 0, 0.75);
  color: #fff;
  font-size: clamp(16px, 4vw, 22px);
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

#map-toolbar-overlay button:hover {
  background: rgba(0, 0, 0, 0.85);
}

#map-toolbar-overlay button:active {
  background: rgba(0, 0, 0, 0.95);
}

#map-toolbar-overlay #show-navigation-btn {
  font-size: clamp(15px, 3.8vw, 21px);
}

/* 🚘 + × stacked when navigation panel open or a route is on the map (tap again to clear). */
#map-toolbar-overlay #show-navigation-btn .map-toolbar-nav-inner {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

#map-toolbar-overlay #show-navigation-btn .map-toolbar-nav-stack {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 1.85em;
  height: 1.2em;
}

#map-toolbar-overlay #show-navigation-btn .map-toolbar-nav-modes {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 0.06em;
  line-height: 1;
}

#map-toolbar-overlay #show-navigation-btn .map-toolbar-nav-mode {
  line-height: 1;
  font-size: 0.76em;
  opacity: 0.78;
  /* Halo + rim so pale emoji (e.g. 🚶) stay readable on rgba(0,0,0,~0.75) buttons. */
  text-shadow:
    0 0 1px rgba(255, 255, 255, 0.95),
    0 0 3px rgba(255, 255, 255, 0.45),
    0 0 6px rgba(0, 0, 0, 0.85),
    0 1px 2px rgba(0, 0, 0, 0.95);
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.65));
  transition: opacity 0.15s ease, transform 0.15s ease, filter 0.15s ease;
}

#map-toolbar-overlay #show-navigation-btn .map-toolbar-nav-mode--selected {
  opacity: 1;
  transform: scale(1.08);
  text-shadow:
    0 0 1px rgba(255, 255, 255, 1),
    0 0 4px rgba(255, 255, 255, 0.55),
    0 0 8px rgba(0, 0, 0, 0.9),
    0 1px 3px rgba(0, 0, 0, 1);
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.75));
}

#map-toolbar-overlay #show-navigation-btn .map-toolbar-nav-x {
  display: none;
  position: absolute;
  right: -0.08em;
  left: auto;
  top: -0.16em;
  z-index: 1;
  font-size: 0.55em;
  font-weight: 900;
  line-height: 1;
  color: #ff8a80;
  text-shadow:
    0 0 3px rgba(0, 0, 0, 1),
    0 1px 2px rgba(0, 0, 0, 0.95),
    0 0 1px #000;
  pointer-events: none;
}

#map-toolbar-overlay #show-navigation-btn.navigation-toolbar-active .map-toolbar-nav-x {
  display: block;
}

#map-toolbar-overlay #safe-route-btn {
  font-size: 0;
  line-height: 0;
  overflow: hidden;
  padding: 0;
}

#map-toolbar-overlay #safe-route-btn .map-toolbar-safe-route-icon {
  width: 70%;
  height: 70%;
  object-fit: cover;
  object-position: center;
  display: block;
  pointer-events: none;
  user-select: none;
}

#map-toolbar-overlay #show-my-location-btn {
  font-size: clamp(18px, 4.5vw, 22px);
}

#map-toolbar-overlay #set-home-location-btn {
  font-size: clamp(16px, 4vw, 22px);
}

#map-toolbar-overlay #set-home-location-btn .map-toolbar-home-inner {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* 🏠 centered; × badge at stack top-left (same as navigation). */
#map-toolbar-overlay #set-home-location-btn .map-toolbar-home-stack {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.2em;
  height: 1.2em;
}

#map-toolbar-overlay #set-home-location-btn .map-toolbar-home-emoji {
  line-height: 1;
  font-size: 1em;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.35));
}

#map-toolbar-overlay #set-home-location-btn .map-toolbar-home-x {
  display: none;
  position: absolute;
  left: -0.12em;
  top: -0.18em;
  z-index: 1;
  font-size: 0.55em;
  font-weight: 900;
  line-height: 1;
  color: #ff8a80;
  text-shadow:
    0 0 3px rgba(0, 0, 0, 1),
    0 1px 2px rgba(0, 0, 0, 0.95),
    0 0 1px #000;
  pointer-events: none;
}

#map-toolbar-overlay #set-home-location-btn.home-location-set .map-toolbar-home-x {
  display: block;
}

#map-toolbar-overlay #set-home-location-btn.home-location-saved-flash {
  animation: refalert-home-saved 0.55s ease;
}

@keyframes refalert-home-saved {
  0% {
    box-shadow: inset 0 0 0 0 rgba(255, 193, 7, 0);
  }
  35% {
    box-shadow: inset 0 0 0 3px rgba(255, 193, 7, 0.75);
  }
  100% {
    box-shadow: inset 0 0 0 0 rgba(255, 193, 7, 0);
  }
}

#map-toolbar-overlay #show-notices-history-btn {
  font-size: clamp(16px, 4vw, 20px);
  position: relative;
}

/* Rolling server history has at least one notice */
#map-toolbar-overlay #show-notices-history-btn.notice-history-has-items::before {
  content: '';
  position: absolute;
  top: 5px;
  left: 5px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #ff5252;
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.82);
  pointer-events: none;
}

#map-toolbar-overlay.refalert-toolbar--hebrew #show-notices-history-btn.notice-history-has-items::before {
  left: auto;
  right: 5px;
}

/* Center-screen FAB + hint: full-screen stack so map stays tappable (pointer-events: none); button receives taps when visible */
.map-center-safe-route-stack {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(8px, 2vw, 14px);
  pointer-events: none;
  padding-top: max(12px, env(safe-area-inset-top, 0px));
  padding-bottom: max(12px, env(safe-area-inset-bottom, 0px));
  box-sizing: border-box;
}

.map-center-nearest-shelter-hint {
  margin: 0;
  order: 2;
  max-width: min(92vw, 320px);
  padding: 12px 16px;
  box-sizing: border-box;
  direction: rtl;
  text-align: center;
  font-size: clamp(14px, 3.8vw, 17px);
  font-weight: 600;
  line-height: 1.35;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.85);
  background: rgba(12, 35, 64, 0.92);
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
  opacity: 0;
  visibility: hidden;
  transform: translateY(6px);
  transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.2s ease;
  pointer-events: none;
  -webkit-font-smoothing: antialiased;
}

.map-center-nearest-shelter-hint.map-center-nearest-shelter-hint--visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) translateZ(0);
}

/* iPhone / touch: WebKit sometimes fails to complete opacity+visibility transitions; show hint immediately. */
@media (hover: none) {
  .map-center-nearest-shelter-hint {
    transition: none;
  }
  .map-center-nearest-shelter-hint.map-center-nearest-shelter-hint--visible {
    transform: translateZ(0);
  }
}

.map-center-safe-route-row {
  order: 1;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: clamp(8px, 2.2vw, 14px);
}

.map-center-safe-route-dismiss {
  flex-shrink: 0;
  width: min(46px, 12vw);
  height: min(46px, 12vw);
  min-width: 40px;
  min-height: 40px;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  font-size: clamp(22px, 6vw, 28px);
  line-height: 1;
  font-weight: 300;
  color: #fff;
  background: rgba(30, 30, 30, 0.88);
  box-shadow:
    0 4px 18px rgba(0, 0, 0, 0.45),
    0 0 0 2px rgba(255, 255, 255, 0.28);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  display: none;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.2s ease, background 0.15s ease;
}

.map-center-safe-route-dismiss.map-center-safe-route-dismiss--visible {
  display: flex;
  pointer-events: auto;
  opacity: 1;
}

.map-center-safe-route-dismiss.map-center-safe-route-dismiss--visible:active {
  transform: scale(0.92);
  background: rgba(55, 55, 55, 0.92);
}

/* Center-screen FAB: nearest protected place when user is inside started/expected alert polygon */
/* z-index above #big-alert-overlay (500), navigation/QR/TV modals (~400), toolbar, status — stays tappable during alerts */
.map-center-safe-route {
  position: relative;
  width: min(104px, 30vw);
  height: min(104px, 30vw);
  min-width: 76px;
  min-height: 76px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  font-size: clamp(34px, 9vw, 46px);
  line-height: 1;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 0;
  color: #fff;
  overflow: hidden;
  background: #1b1b1b;
  box-shadow:
    0 8px 34px rgba(0, 0, 0, 0.52),
    0 0 0 3px rgba(255, 255, 255, 0.35);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.map-center-safe-route.map-center-safe-route--visible {
  display: flex;
  pointer-events: auto;
  opacity: 1;
  animation: map-center-safe-route-pulse 2s ease-in-out infinite;
}

.map-center-safe-route.map-center-safe-route--visible:active {
  transform: scale(0.94);
}

.map-center-safe-route .map-center-safe-route-icon {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
  pointer-events: none;
  user-select: none;
}

.map-center-safe-route.temporarily-hidden {
  display: none !important;
  pointer-events: none !important;
  opacity: 0 !important;
  animation: none !important;
}

@keyframes map-center-safe-route-pulse {
  0%, 100% {
    box-shadow:
      0 8px 34px rgba(0, 0, 0, 0.52),
      0 0 0 3px rgba(255, 255, 255, 0.35),
      0 0 0 0 rgba(255, 255, 255, 0);
  }
  50% {
    box-shadow:
      0 10px 38px rgba(0, 0, 0, 0.58),
      0 0 0 4px rgba(255, 235, 59, 0.5),
      0 0 28px 6px rgba(255, 235, 59, 0.38);
  }
}

/* Turn-by-turn style: remaining distance + ETA while route is active */
.navigation-progress-hud {
  position: fixed;
  left: 50%;
  bottom: max(calc(var(--overlay-gap) + 120px), calc(var(--overlay-gap) + env(safe-area-inset-bottom, 0px) + 112px));
  transform: translateX(-50%);
  z-index: 105;
  max-width: min(calc(100vw - 2 * var(--overlay-gap)), 360px);
  padding: 8px 14px;
  border-radius: 10px;
  background: rgba(13, 71, 161, 0.92);
  color: #fff;
  font-family: sans-serif;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.35);
  pointer-events: none;
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  text-align: center;
}
.navigation-progress-hud.navigation-progress-hud--he {
  direction: rtl;
}
.navigation-progress-hud.navigation-progress-hud--locale {
  direction: ltr;
}
.navigation-progress-hud.navigation-progress-hud--ar {
  direction: rtl;
}
.navigation-progress-hud.visible {
  display: flex;
}
.navigation-progress-hud-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: center;
  gap: 4px 8px;
  font-size: clamp(13px, 3.4vw, 16px);
  font-weight: 700;
  line-height: 1.25;
}
.navigation-progress-hud .navigation-progress-sep {
  opacity: 0.75;
  font-weight: 500;
}
.navigation-progress-hud-en {
  font-size: clamp(10px, 2.6vw, 12px);
  font-weight: 500;
  opacity: 0.88;
  direction: ltr;
}
.navigation-progress-hud:not(.navigation-progress-hud--he) .navigation-progress-hud-en {
  display: none;
}

/* Navigation modal (Directions on map) */
.navigation-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  z-index: 410;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  box-sizing: border-box;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}
.navigation-modal.visible {
  opacity: 1;
  visibility: visible;
}
.navigation-modal-content {
  background: #1a1a1a;
  border-radius: 12px;
  padding: 16px 40px 16px 16px;
  max-width: min(420px, 100%);
  width: 100%;
  position: relative;
  box-shadow: 0 8px 32px rgba(0,0,0,0.45);
}
.navigation-modal-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 32px;
  height: 32px;
  padding: 0;
  border: none;
  background: rgba(255,255,255,0.12);
  border-radius: 8px;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  color: #fff;
}
.navigation-modal-close:hover {
  background: rgba(255,255,255,0.22);
}
.navigation-modal-title {
  font-family: sans-serif;
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
  margin: 0 0 8px 0;
  text-align: right;
  direction: rtl;
}
.navigation-modal-hint {
  font-family: sans-serif;
  font-size: 0.8rem;
  color: rgba(255,255,255,0.7);
  margin: 0 0 12px 0;
  line-height: 1.35;
  text-align: right;
  direction: rtl;
}
.navigation-travel-mode,
.navigation-routing-style {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  margin: 0 0 12px 0;
  justify-content: flex-end;
  direction: rtl;
}
.navigation-travel-mode-label,
.navigation-routing-style-label {
  margin-bottom: 0;
  width: 100%;
}
.navigation-travel-mode-option {
  font-family: sans-serif;
  font-size: 0.85rem;
  color: rgba(255,255,255,0.92);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  user-select: none;
}
.navigation-travel-mode-option input {
  width: 18px;
  height: 18px;
  accent-color: #4285f4;
}
.navigation-modal-label {
  display: block;
  font-family: sans-serif;
  font-size: 0.85rem;
  color: rgba(255,255,255,0.9);
  margin-bottom: 6px;
  text-align: right;
  direction: rtl;
}
.navigation-modal-input {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.2);
  background: rgba(255,255,255,0.08);
  color: #fff;
  font-size: 16px;
  direction: rtl;
}
.navigation-modal-input::placeholder {
  color: rgba(255,255,255,0.45);
}
.navigation-modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
  justify-content: flex-end;
}
.navigation-modal-primary,
.navigation-modal-secondary,
.navigation-modal-drive {
  font-family: sans-serif;
  font-size: 0.95rem;
  padding: 10px 16px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  min-height: var(--touch-min);
}
.navigation-modal-drive {
  background: linear-gradient(180deg, #43a047 0%, #2e7d32 100%);
  color: #fff;
  font-weight: 600;
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}
.navigation-modal-drive:hover {
  filter: brightness(1.08);
}
.navigation-modal-drive:active {
  filter: brightness(0.94);
}
.navigation-modal-primary {
  background: #4285f4;
  color: #fff;
  font-weight: 600;
}
.navigation-modal-primary:hover {
  background: #5a95f5;
}
.navigation-modal-secondary {
  background: rgba(255,255,255,0.12);
  color: #fff;
}
.navigation-modal-secondary:hover {
  background: rgba(255,255,255,0.2);
}
.navigation-modal-status {
  font-family: sans-serif;
  font-size: 0.8rem;
  color: #ffab91;
  margin: 12px 0 0 0;
  min-height: 1.2em;
  text-align: right;
  direction: rtl;
}

/* Live TV modal */
.live-tv-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  z-index: 400;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  box-sizing: border-box;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}
.live-tv-modal.visible {
  opacity: 1;
  visibility: visible;
}
.live-tv-modal-content {
  background: #1a1a1a;
  border-radius: 12px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  max-width: 100%;
  max-height: 95vh;
  width: min(560px, 100%);
  position: relative;
}
.live-tv-modal-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 32px;
  height: 32px;
  padding: 0;
  border: none;
  background: rgba(255,255,255,0.12);
  border-radius: 8px;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  color: #fff;
  z-index: 2;
}
.live-tv-modal-close:hover {
  background: rgba(255,255,255,0.25);
}
.live-tv-modal-title {
  font-family: sans-serif;
  font-size: 1rem;
  font-weight: 600;
  color: #fff;
  margin: 0;
  text-align: center;
}
.live-tv-channel-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
}
.live-tv-tab {
  padding: 8px 14px;
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 8px;
  background: rgba(255,255,255,0.08);
  color: #fff;
  font-size: 0.9rem;
  cursor: pointer;
}
.live-tv-tab:hover {
  background: rgba(255,255,255,0.15);
}
.live-tv-tab.active {
  background: rgba(255,255,255,0.25);
  border-color: rgba(255,255,255,0.5);
}
.live-tv-embed-wrap {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%;
  height: 0;
  overflow: hidden;
  border-radius: 8px;
  background: #000;
}
.live-tv-embed-wrap iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 0;
}
.live-tv-modal-hint {
  font-family: sans-serif;
  font-size: 0.75rem;
  color: rgba(255,255,255,0.6);
  margin: 0;
  text-align: center;
}

/* Big consolidated alert message (התראה / אזעקה / שחרור) */
#big-alert-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.6);
  z-index: 500;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}
#big-alert-overlay.visible {
  opacity: 1;
  visibility: visible;
}
#big-alert-overlay .big-alert-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(8px, 3vw, 20px);
  max-width: min(calc(100vw - 2 * var(--overlay-gap)), 90vw);
  text-align: center;
}

/* Full prominence when alerts touch your surrounding (blue) municipalities; GPS/名单 없으면 defaults to this in JS. */
#big-alert-overlay.big-alert--local .big-alert-content {
  --big-alert-title-font-size: clamp(1.05rem, 5.4vw, 1.72rem);
}

#big-alert-overlay.big-alert--local #big-alert-text {
  font-size: clamp(2.65rem, 15vw, 6.35rem);
  font-weight: 700;
  color: #fff;
  text-shadow: 0 0 20px rgba(0,0,0,0.8), 0 2px 4px rgba(0,0,0,0.9);
  direction: rtl;
  font-family: sans-serif;
}

/* Compact banner when alerts are only outside your surrounding polygon list */
#big-alert-overlay.big-alert--remote .big-alert-content {
  --big-alert-title-font-size: clamp(0.72rem, 3.1vw, 1.02rem);
}

#big-alert-overlay.big-alert--remote #big-alert-text {
  font-size: clamp(1.32rem, 7.5vw, 2.85rem);
  font-weight: 700;
  color: #fff;
  text-shadow: 0 0 14px rgba(0,0,0,0.75), 0 2px 3px rgba(0,0,0,0.85);
  direction: rtl;
  font-family: sans-serif;
}
#big-alert-overlay.type-started #big-alert-text { color: #ffcdd2; }
#big-alert-overlay.type-expected #big-alert-text { color: #fff9c4; }
#big-alert-overlay.type-ended #big-alert-text { color: #c8e6c9; }
#big-alert-overlay .big-alert-title {
  font-size: calc(1.2 * var(--big-alert-title-font-size));
  font-weight: 600;
  color: rgba(255,255,255,0.95);
  direction: rtl;
  font-family: sans-serif;
  margin-top: 4px;
}
#big-alert-overlay.type-started .big-alert-title { color: #ffcdd2; }
#big-alert-overlay.type-expected .big-alert-title { color: #fff9c4; }
#big-alert-overlay.type-ended .big-alert-title { color: #c8e6c9; }
#big-alert-overlay.big-alert--local .big-alert-areas {
  font-size: calc(1.48 * var(--big-alert-title-font-size));
  font-weight: 800;
  color: rgba(255,255,255,0.95);
  direction: rtl;
  font-family: sans-serif;
  line-height: 1.38;
  max-height: 34vh;
  overflow-y: auto;
  /* Stroke + halo so long Hebrew area lists stay readable on the dimmed map */
  -webkit-text-stroke: clamp(0.5px, 0.08em, 2px) rgba(0, 0, 0, 0.88);
  text-shadow:
    0 0 1px rgba(0, 0, 0, 1),
    0 1px 2px rgba(0, 0, 0, 0.95),
    0 2px 6px rgba(0, 0, 0, 0.65),
    0 0 14px rgba(0, 0, 0, 0.45);
}

#big-alert-overlay.big-alert--remote .big-alert-areas {
  font-size: calc(1.22 * var(--big-alert-title-font-size));
  font-weight: 600;
  color: rgba(255,255,255,0.95);
  direction: rtl;
  font-family: sans-serif;
  line-height: 1.32;
  max-height: 22vh;
  overflow-y: auto;
  -webkit-text-stroke: clamp(0.4px, 0.06em, 1.5px) rgba(0, 0, 0, 0.88);
  text-shadow:
    0 0 1px rgba(0, 0, 0, 1),
    0 1px 2px rgba(0, 0, 0, 0.92),
    0 2px 5px rgba(0, 0, 0, 0.55);
}

#big-alert-overlay.type-started .big-alert-areas { color: #ffcdd2; }
#big-alert-overlay.type-expected .big-alert-areas { color: #fff9c4; }
#big-alert-overlay.type-ended .big-alert-areas { color: #c8e6c9; }

/* Notice overlay (api/notice): info=green, warning=yellow, error=red */
.notice-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}
.notice-overlay.visible {
  pointer-events: auto;
  opacity: 1;
  visibility: visible;
}
.notice-content {
  position: relative;
  max-width: min(90vw, 480px);
  max-height: 60vh;
  max-height: 60dvh;
  padding: 24px 48px 24px 24px;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.3);
  background: rgba(255, 255, 255, 0.97);
  display: flex;
  flex-direction: column;
}
/* Stacked notices: ascending by time (oldest at top) */
.notice-stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  -webkit-overflow-scrolling: touch;
}
.notice-message {
  font-family: sans-serif;
  font-size: clamp(16px, 4vw, 20px);
  line-height: 1.4;
  color: #1a1a1a;
  direction: rtl;
}
/* Single notice card */
.notice-item {
  border-radius: 10px;
  padding: 12px 14px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12);
  flex-shrink: 0;
}
.notice-item.type-info {
  border-left: 5px solid #2e7d32;
  background: #e8f5e9;
}
.notice-item.type-warning {
  border-left: 5px solid #f9a825;
  background: #fff8e1;
}
.notice-item.type-error {
  border-left: 5px solid #c62828;
  background: #ffebee;
}
/* Header: logo | sender (single line) | date/time (wraps on narrow widths) */
.notice-item-head {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  width: 100%;
  margin: 0 0 10px 0;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.12);
  direction: ltr;
  gap: 8px 12px;
  row-gap: 6px;
}
.notice-item-logo {
  width: 40px;
  height: 40px;
  object-fit: contain;
  flex-shrink: 0;
  display: block;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.65);
}
.notice-item-from-group {
  display: inline-flex;
  align-items: baseline;
  flex-direction: row;
  flex-wrap: nowrap;
  flex: 0 1 auto;
  min-width: 0;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  gap: 0.25em;
}
.notice-item-time {
  flex: 1 1 9rem;
  min-width: min(100%, 5.5rem);
  font-size: 0.85rem;
  font-weight: 600;
  color: #333;
  font-variant-numeric: tabular-nums;
  white-space: normal;
  line-height: 1.3;
  letter-spacing: 0.02em;
  margin-left: auto;
  text-align: right;
  word-break: break-word;
}
/* Sender — full width above message text */
.notice-item-from {
  text-align: right;
  direction: rtl;
  margin: 0 0 10px 0;
  padding: 8px 0 10px 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  font-size: clamp(15px, 3.6vw, 18px);
  line-height: 1.35;
}
.notice-item-from-label {
  font-weight: 600;
  color: rgba(0, 0, 0, 0.55);
  font-size: 0.88em;
  flex-shrink: 0;
}
.notice-item-from-name {
  font-weight: 700;
  color: #1565c0;
  flex-shrink: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.notice-item-body {
  text-align: right;
  direction: rtl;
  font-size: clamp(16px, 4vw, 20px);
  line-height: 1.45;
}
.notice-item-media {
  margin-top: 12px;
  max-width: 100%;
  border-radius: 10px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.04);
}
.notice-item-media-el {
  display: block;
  width: 100%;
  max-height: min(40vh, 280px);
  object-fit: contain;
}
.notice-item-media-video .notice-item-media-el {
  max-height: min(45vh, 320px);
  background: #000;
}
.notice-item-media-audio .notice-item-media-el {
  width: 100%;
  max-height: none;
  padding: 8px 0;
}
.notice-item-media-sticker .notice-item-sticker {
  max-width: 200px;
  max-height: 200px;
  width: auto;
  height: auto;
  margin: 0 auto;
}
.notice-item-download {
  margin-top: 10px;
  font-size: 0.95rem;
}
.notice-item-download a {
  color: #1565c0;
  font-weight: 600;
}
.notice-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 36px;
  height: 36px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: rgba(0,0,0,0.08);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  color: #333;
}
.notice-close:hover { background: rgba(0,0,0,0.12); }

@media (max-width: 480px) {
  #status-dock {
    --status-panel-w: min(260px, calc(100vw - 2 * var(--overlay-gap)));
    width: var(--status-panel-w);
    max-width: var(--status-panel-w);
    bottom: env(safe-area-inset-bottom, 0px);
  }
  #alert-summary-overlay {
    width: calc(100vw - 2 * var(--overlay-gap));
    max-width: calc(100vw - 2 * var(--overlay-gap));
    padding-top: 5px;
    padding-bottom: 5px;
    line-height: 1.2;
  }
  #alert-summary-overlay .alert-summary-header { margin-bottom: 2px; }
  #alert-summary-overlay .alert-time { margin-bottom: 2px; }
  #alert-summary-overlay .alert-my-location { margin-top: 1px; }
  #legend-overlay { max-width: 92vw; }
}

/* SSE / connectivity: shown when EventSource fails (e.g. poor network in shelter). */
#map-low-network-indicator {
  position: fixed;
  top: max(calc(var(--overlay-gap) + 48px), calc(env(safe-area-inset-top, 0px) + 40px));
  right: max(var(--overlay-gap), env(safe-area-inset-right, 0px));
  z-index: 99;
  display: none;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 8px;
  background: rgba(80, 60, 20, 0.88);
  color: #fff;
  font-family: sans-serif;
  font-size: clamp(11px, 2.8vw, 13px);
  font-weight: 600;
  line-height: 1.25;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
  pointer-events: none;
  max-width: min(240px, calc(100vw - 2 * var(--overlay-gap)));
  text-align: center;
  direction: rtl;
}
#map-low-network-indicator.visible {
  display: inline-flex;
}
#map-low-network-indicator .low-network-icon {
  font-size: 1.15em;
  flex-shrink: 0;
}
.hagada-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  z-index: 400;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: env(safe-area-inset-top, 8px) 12px env(safe-area-inset-bottom, 8px);
  box-sizing: border-box;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}
.hagada-modal.visible {
  opacity: 1;
  visibility: visible;
}
.hagada-modal-content {
  display: flex;
  flex-direction: column;
  width: 90%;
  height: 90dvh;
  height: 90vh;
  background: #1a1a1a;
  border-radius: 12px;
  overflow: hidden;
}
@supports (height: 90dvh) {
  .hagada-modal-content { height: 90dvh; }
}
.hagada-modal-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  flex-shrink: 0;
  background: #111;
}
.hagada-modal-logo {
  width: 28px;
  height: 28px;
  object-fit: contain;
  opacity: 0.85;
  flex-shrink: 0;
}
.hagada-modal-title {
  flex: 1;
  color: #fff;
  font-family: sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  text-align: center;
}
.hagada-pages-wrap {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: #555;
}
.hagada-modal-close {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  padding: 0;
  border: none;
  background: rgba(255,255,255,0.12);
  border-radius: 8px;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  color: #fff;
}
.hagada-modal-close:hover {
  background: rgba(255,255,255,0.25);
}

/* Privacy notice (first-visit modal) */
.privacy-notice-overlay {
  position: fixed;
  inset: 0;
  z-index: 9000;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  box-sizing: border-box;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}
.privacy-notice-overlay.visible {
  opacity: 1;
  visibility: visible;
}
.privacy-notice-content {
  background: #fff;
  border-radius: 14px;
  max-width: min(92vw, 480px);
  max-height: 90dvh;
  max-height: 90vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 24px 20px 20px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.35);
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.privacy-notice-header {
  display: flex;
  align-items: center;
  gap: 10px;
}
.privacy-notice-logo {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
}
.privacy-notice-title {
  font-size: 1rem;
  font-weight: 700;
  color: #1a1a1a;
}
.privacy-notice-body {
  font-size: 0.92rem;
  line-height: 1.55;
  color: #222;
}
.privacy-notice-body p { margin: 0 0 8px; }
.privacy-notice-body ul {
  margin: 0 0 8px;
  padding-inline-start: 1.4em;
}
.privacy-notice-body li { margin-bottom: 4px; }
.privacy-notice-legal {
  font-size: 0.78rem;
  color: #888;
  margin-top: 6px !important;
}
.privacy-notice-accept {
  align-self: stretch;
  background: #1976d2;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 12px 20px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.privacy-notice-accept:hover {
  background: #1565c0;
}
