.screen.active {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 20px;
  height: 100vh;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: radial-gradient(circle at top, #ffffff, #dfe6ee);
  color: #1c1c1e;
  font-family: -apple-system, BlinkMacSystemFont, sans-serif;
}

body::before {
  content: "";
  position: fixed;
  top: -100px;
  left: -100px;
  width: 300px;
  height: 300px;
  background: rgba(255,255,255,0.6);
  filter: blur(80px);
  z-index: 0;
}

#app {
  height: 100%;
}

/* --- ЭКРАНЫ --- */
.screen {
  display: none;
  height: 100%;
  box-sizing: border-box;
  padding: 20px;
}

/* --- SOS --- */
#status {
  margin-top: 10px;
  font-size: 16px;
  color: #444;
  text-align: center;
}

#cancel-btn {
  margin-top: 10px;
  display: none;
}

/* --- ТЕКСТ --- */
.screen h2 {
  margin-bottom: 10px;
}

.screen p,
.screen li {
  text-align: center;
  opacity: 0.9;
}

/* --- НИЖНЯЯ НАВИГАЦИЯ --- */
#bottom-nav{
  position:fixed;
  bottom:0;
  left:0;
  right:0;
  height:70px;
  padding-bottom:env(safe-area-inset-bottom);
  background:#eef2f7;
  box-shadow: 0 -5px 20px rgba(0,0,0,0.1);
  display:flex;
  justify-content:space-around;
  align-items:center;
  z-index:1000;
}
#bottom-nav button {
  background: none;
  border: none;
  color: #1c1c1e;
  font-size: 14px;
  opacity: 0.8;
}

#bottom-nav button:hover {
  opacity: 1;
}

#end-btn {
  height: 60px;
  font-size: 18px;
  border-radius: 20px;
  border: none;
  margin-top: 20px;
  width: 200px;
  background: linear-gradient(145deg, #ff5a5a, #d94444);
  color: white;

  box-shadow:
  5px 5px 15px rgba(0,0,0,0.2),
  -5px -5px 15px rgba(255,255,255,0.6);
}

#incident-panel {
  transition: transform 0.3s ease, opacity 0.3s ease;
}

#incident-panel{
  position: fixed;
  left: 10px;
  right: 10px;
  bottom: 90px;
  background: white;
  padding: 15px;
  border-radius: 14px;
  box-shadow: 0 6px 25px rgba(0,0,0,0.3);
  z-index: 9999;
  transform: translateY(100%);
  transition: transform 0.35s ease;
  pointer-events: auto;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.modal-box {
  position: relative;
  background: white;
  padding: 30px 25px;
  border-radius: 20px;
  width: 85%;
  max-width: 380px;
  text-align: center;
  box-shadow:
  10px 10px 30px rgba(0,0,0,0.2),
  -10px -10px 30px rgba(255,255,255,0.6);
}

.modal-close {
  position: absolute;
  top: 10px;
  right: 14px;
  font-size: 20px;
  cursor: pointer;
}

.modal-text {
  font-size: 16px;
  color: #222;
}

#incident-top-bar{
  position: fixed;
  bottom: 190px;
  left: 20px;
  right: 20px;
  display: flex;
  justify-content: space-between;
  z-index: 10000;
  pointer-events: auto;
}

#incident-top-bar.hidden {
  display: none;
}

#incident-timer,
#incident-distance {
  position: relative;
  padding: 8px 18px;
  border-radius: 30px;
  font-weight: bold;
  font-size: 14px;
  background: white;
  color: black;
  z-index: 1;
  overflow: visible;
}

#incident-timer::before,
#incident-distance::before {
  content: "";
  position: absolute;
  inset: -3px;
  border-radius: 32px;
  background: linear-gradient(
    90deg,
    yellow,
    orange,
    red
  );
  z-index: -1;
  animation: pulseBorder 2s ease-in-out infinite;
}

@keyframes pulseBorder {
  0% { opacity: 0.5; }
  50% { opacity: 1; }
  100% { opacity: 0.5; }
}

@keyframes moveBorder {
  from { background-position: 0% 0%; }
  to   { background-position: 200% 0%; }
}

.panel-close {
  position: absolute;
  top: -18px;
  right: 15px;
  width: 36px;
  height: 36px;
  background: white;
  border-radius: 50%;
  box-shadow: 0 4px 15px rgba(0,0,0,0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  cursor: pointer;
  z-index: 2000;
}
.panel-close,
.modal-close {
  font-weight: bold;
  user-select: none;
}
.panel-close {
  color: black;
}
.custom-modal {
  position: relative;
  padding-top: 40px;
}
/* ===== MAP LAYOUT FIX ===== */

#screen-map{
  position:relative;
  height:100vh;
  padding:0;
  overflow:hidden;
}

#map{
  position:absolute;
  top:0;
  left:0;
  right:0;
  bottom:0;
  z-index:1;
}

#incident-panel:not(.hidden) {
  transform: translateY(0);
}
#incident-panel{
  pointer-events:auto;
}

#map{
  touch-action: pan-x pan-y;
}

body{
padding-bottom:80px;
}
.hidden{
display:none;
}

.incident-marker{
  display:flex;
  align-items:center;
  justify-content:center;
}

.incident-dot{
  width:16px;
  height:16px;
  background:red;
  border-radius:50%;
  box-shadow:0 0 0 4px rgba(255,0,0,0.3);
}

/* ===== FIX MAP LAYERS ===== */

#map{
  z-index:1;
}

.leaflet-container{
  z-index:1;
}

#incident-panel{
  z-index:2000;
}

#incident-top-bar{
  z-index:2100;
}

#bottom-nav{
  z-index:2200;
}

.card {
  background: #eef2f7;
  border-radius: 20px;
  padding: 15px;
  margin: 10px 0;

  box-shadow:
    6px 6px 15px rgba(0,0,0,0.1),
    -6px -6px 15px rgba(255,255,255,0.7);
}

#sos-hint {
  margin-top: 20px;
  font-size: 14px;
  color: #555;
  text-align: center;
  line-height: 1.4;
  max-width: 260px;
}

#help-stats {
  margin-top: 25px;
  width: 100%;
  max-width: 280px;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  padding: 12px 16px;
  margin-bottom: 10px;

  border-radius: 14px;

  background: #eef2f7;

  box-shadow:
    inset 3px 3px 6px rgba(0,0,0,0.1),
    inset -3px -3px 6px rgba(255,255,255,0.7);

  font-size: 14px;
}

#help-status {
  margin-top: 10px;
  font-size: 15px;
  color: #444;
  text-align: center;
  line-height: 1.4;
}

/* === SOS SCREEN === */

.sos-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding-top: 40px;
  width: 100%;
  gap: 14px;
}

/* логотип */
.logo img {
  width: 140px;
  height: auto;
}
/* кнопка */
#sos-btn {
  width: 220px;
  height: 140px;
  border-radius: 70px;

  background: linear-gradient(180deg, #ff7a7a, #e54848);

  display: flex;
  align-items: center;
  justify-content: center;

  font-size: 42px;
  color: white;
  font-weight: bold;

  position: relative;
  overflow: hidden;
  animation: pulse 2.5s infinite;
  box-shadow:
    0 25px 40px rgba(0,0,0,0.15),
    inset 0 6px 10px rgba(255,255,255,0.6),
    inset 0 -10px 20px rgba(0,0,0,0.2);
}

#sos-btn::before {
  content: "";
  position: absolute;
  top: 8%;
  left: 15%;
  width: 70%;
  height: 35%;
  border-radius: 50%;
  background: rgba(255,255,255,0.5);
  filter: blur(18px);
}

#sos-btn::after {
  content: "";
  position: absolute;
  bottom: -18px;
  width: 80%;
  height: 30px;
  background: rgba(255,255,255,0.9);
  border-radius: 50%;

  filter: blur(6px);

  z-index: -1;
}
/* текст */
#sos-hint {
  text-align: center;
  font-size: 15px;
  color: #444;
  line-height: 1.4;
  margin-bottom: 25px;
  max-width: 260px;
}

/* карточки */
.fake-card {
  width: 90%;
  max-width: 300px;

  display: flex;
  align-items: center;
  justify-content: space-between;

  padding: 14px 16px;

  border-radius: 22px;

  background: rgba(255,255,255,0.6);
  backdrop-filter: blur(12px);

  box-shadow:
    0 10px 25px rgba(0,0,0,0.1);

  font-size: 15px;
}
.fake-card span:last-child {
  background: rgba(255,255,255,0.8);
  padding: 6px 12px;
  border-radius: 20px;
}
.fake-card:hover {
  transform: translateY(-2px);
}

#sos-btn:active {
  transform: scale(0.96);

  box-shadow:
    inset 6px 6px 12px rgba(0,0,0,0.2),
    inset -6px -6px 12px rgba(255,255,255,0.7);
}
@keyframes pulse {
  0% {
    box-shadow:
      12px 12px 30px rgba(0,0,0,0.2),
      -12px -12px 30px rgba(255,255,255,0.8);
  }

  50% {
    box-shadow:
      12px 12px 35px rgba(255,0,0,0.25),
      -12px -12px 35px rgba(255,255,255,0.9);
  }

  100% {
    box-shadow:
      12px 12px 30px rgba(0,0,0,0.2),
      -12px -12px 30px rgba(255,255,255,0.8);
  }
}

#cancel-btn {
  margin-top: 8px;
  padding: 8px 16px;
  border-radius: 20px;
  border: none;

  background: #ddd;
  color: #333;

  font-size: 14px;
}
/* === MENU === */

.menu-list {
  width: 100%;
  max-width: 320px;
  margin-top: 20px;
}

.menu-item {
  padding: 16px;
  margin-bottom: 12px;

  border-radius: 16px;

  background: #eef2f7;

  box-shadow:
    6px 6px 15px rgba(0,0,0,0.1),
    -6px -6px 15px rgba(255,255,255,0.8);

  text-align: center;
  font-size: 16px;
}
#sos-extra-text {
  margin-top: 10px;
  font-size: 13px;
  color: #666;
  text-align: center;
  max-width: 260px;
}
#center-map-btn {
  position: absolute;
  bottom: 100px;
  right: 15px;
  z-index: 3000;

  padding: 10px 14px;
  border-radius: 20px;
  border: none;

  background: white;
  color: black;

  box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

.leaflet-control-attribution img {
  display: none !important;
}

.leaflet-control-attribution a img {
  display: none !important;
}
.leaflet-control-zoom a {
  width: 34px;
  height: 34px;
  display: flex !important;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}
.leaflet-top.leaflet-right {
  top: 32px;     /* примерно 2 см вниз */
  right: 8px;    /* ~2 мм от края */
}
.modal-overlay{
  pointer-events: auto;
}

#incident-panel{
  pointer-events: auto;
  z-index: 10001;
}
