/* Общая визуальная система miniapp */
:root {
  color-scheme: dark;
  --bg: #07090e;
  --bg-elev: #10151d;
  --text: #f3f6fb;
  --hint: #8b96a8;
  --muted: #6f7b8e;
  --accent: #2dd4bf;
  --accent-2: #7aa2ff;
  --accent-soft: rgba(45, 212, 191, 0.16);
  --accent-2-soft: rgba(122, 162, 255, 0.18);
  --danger: #fb7185;
  --ok: #34d399;
  --warn: #f5c14a;
  --surface: rgba(12, 16, 24, 0.72);
  --surface-strong: rgba(10, 14, 22, 0.92);
  --border: rgba(255, 255, 255, 0.1);
  --border-strong: rgba(255, 255, 255, 0.16);
  --shadow: 0 16px 48px rgba(0, 0, 0, 0.48);
  --radius: 16px;
  --radius-sm: 12px;
  --blur: 20px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
}

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

html, body {
  height: 100%;
  width: 100%;
  overflow: hidden;
  position: fixed;
  inset: 0;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

#gate {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: grid;
  place-items: center;
  padding: 2rem;
  text-align: center;
  background:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(45, 212, 191, 0.18), transparent 55%),
    radial-gradient(ellipse 70% 45% at 110% 90%, rgba(122, 162, 255, 0.16), transparent 50%),
    radial-gradient(ellipse 50% 40% at -10% 80%, rgba(45, 212, 191, 0.08), transparent 50%),
    var(--bg);
}

#gate.hidden { display: none !important; }

.gate-card {
  position: relative;
  width: min(360px, 100%);
  padding: 2.1rem 1.5rem 1.7rem;
  border-radius: 24px;
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(var(--blur));
  -webkit-backdrop-filter: blur(var(--blur));
}

.gate-radar {
  position: relative;
  width: 72px;
  height: 72px;
  margin: 0 auto 1.15rem;
}

.gate-radar::before {
  content: "";
  position: absolute;
  inset: 10px;
  border-radius: 50%;
  border: 1.5px solid rgba(45, 212, 191, 0.28);
}

.gate-radar span {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1.5px solid rgba(45, 212, 191, 0.35);
  animation: gate-pulse 2.4s ease-out infinite;
}

.gate-radar span:nth-child(2) { animation-delay: 0.8s; }
.gate-radar span:nth-child(3) { animation-delay: 1.6s; }

.gate-radar::after {
  content: "";
  position: absolute;
  inset: 26px;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #7ff5e4, var(--accent) 55%, #0f766e);
  box-shadow: 0 0 0 4px rgba(45, 212, 191, 0.18), 0 8px 24px rgba(45, 212, 191, 0.35);
}

@keyframes gate-pulse {
  0% { transform: scale(0.55); opacity: 0.7; }
  100% { transform: scale(1.15); opacity: 0; }
}

#gate h1 {
  font-size: clamp(1.35rem, 5vw, 1.85rem);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1.15;
}

#gate p {
  margin-top: 0.7rem;
  color: var(--hint);
  font-size: 0.94rem;
  line-height: 1.45;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 1.2rem;
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  background: rgba(139, 150, 168, 0.14);
  color: var(--hint);
  border: 1px solid var(--border);
}

.status::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 22%, transparent);
}

.status.ok {
  background: rgba(52, 211, 153, 0.12);
  color: var(--ok);
  border-color: rgba(52, 211, 153, 0.28);
}

.status.err {
  background: rgba(251, 113, 133, 0.12);
  color: var(--danger);
  border-color: rgba(251, 113, 133, 0.28);
}

.status.warn {
  background: rgba(245, 193, 74, 0.12);
  color: var(--warn);
  border-color: rgba(245, 193, 74, 0.28);
}

#app {
  display: none;
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  height: 100dvh;
  z-index: 1;
}
#app.visible { display: block; }

#map {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  background: #0b1016;
}

.leaflet-container { width: 100%; height: 100%; background: #0b1016; }
.uav-marker { background: transparent !important; border: none !important; }

.uav-marker__label {
  background: rgba(8, 12, 18, 0.88);
  border: 1px solid var(--marker-color, var(--accent));
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: #f8fafc;
  white-space: nowrap;
  line-height: 1.2;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.uav-marker__mute,
.uav-marker__comment {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 999px;
  background: rgba(10, 14, 22, 0.92);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
  line-height: 0;
}

.uav-marker__mute {
  border: 1px solid rgba(251, 113, 133, 0.7);
  color: #fda4af;
}

.uav-marker__comment {
  border: 1px solid rgba(45, 212, 191, 0.7);
  color: #5eead4;
}

.leaflet-popup-close-button {
  width: 28px !important;
  height: 28px !important;
  top: 8px !important;
  right: 8px !important;
  padding: 0 !important;
  border-radius: 8px;
  color: var(--hint) !important;
  font-size: 20px !important;
  font-weight: 400 !important;
  line-height: 28px !important;
}

.leaflet-popup-close-button:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text) !important;
}
