.page-map {
  --map-header-h: 4.25rem;
}

.page-map.page-map--embed {
  overflow: hidden;
  height: 100dvh;
}

.page-map.page-map--embed #stars {
  display: none;
}

.page-map .header {
  background: rgba(10, 12, 20, 0.96);
}

/* ——— Заглушки: вход / скоро ——— */
.map-main:not(.map-main--embed) {
  position: relative;
  z-index: 1;
  min-height: 100dvh;
  box-sizing: border-box;
  padding-top: var(--map-header-h);
}

.map-gate {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: calc(100dvh - var(--map-header-h));
  padding: 2rem 1.25rem max(2.5rem, env(safe-area-inset-bottom, 0px));
  box-sizing: border-box;
  position: relative;
  overflow: hidden;
}

.map-gate[hidden],
.map-panel[hidden],
.map-frame-wrap[hidden] {
  display: none !important;
}

.map-gate-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.map-gate-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(72px);
  opacity: 0.45;
}

.map-gate-orb--1 {
  width: min(420px, 70vw);
  height: min(420px, 70vw);
  top: 10%;
  left: 50%;
  transform: translateX(-60%);
  background: rgba(107, 92, 231, 0.55);
}

.map-gate-orb--2 {
  width: min(360px, 60vw);
  height: min(360px, 60vw);
  bottom: 5%;
  right: 50%;
  transform: translateX(55%);
  background: rgba(201, 162, 39, 0.35);
}

.map-gate-grid {
  position: absolute;
  inset: -20% -10%;
  background-image:
    linear-gradient(rgba(120, 140, 220, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(120, 140, 220, 0.06) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse 70% 60% at 50% 45%, #000 20%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 50% 45%, #000 20%, transparent 75%);
}

.map-panel {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 26rem;
  margin: 0 auto;
  padding: 2.25rem 2rem 2rem;
  text-align: center;
  border-radius: 20px;
  border: 1px solid rgba(140, 160, 220, 0.22);
  background: rgba(14, 18, 32, 0.88);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow:
    0 24px 64px rgba(0, 0, 0, 0.45),
    0 0 0 1px rgba(107, 92, 231, 0.08) inset,
    0 0 48px rgba(107, 92, 231, 0.12);
}

.map-panel-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 4.5rem;
  height: 4.5rem;
  margin: 0 auto 1.25rem;
  border-radius: 50%;
  color: var(--accent);
  background: linear-gradient(
    145deg,
    rgba(107, 92, 231, 0.35) 0%,
    rgba(201, 162, 39, 0.2) 100%
  );
  border: 1px solid rgba(201, 162, 39, 0.25);
  box-shadow: 0 8px 28px rgba(107, 92, 231, 0.25);
}

.map-panel-icon--lock {
  color: #c4b5fd;
}

.map-panel-icon--map {
  color: var(--accent);
}

.map-panel-badge {
  display: inline-block;
  margin: 0 0 0.65rem;
  padding: 0.28rem 0.7rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  background: rgba(201, 162, 39, 0.14);
  border: 1px solid rgba(201, 162, 39, 0.3);
}

.map-panel-title {
  margin: 0 0 0.65rem;
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text);
}

.map-panel-title--hero {
  font-size: clamp(1.65rem, 4.5vw, 2.1rem);
  background: linear-gradient(135deg, #fff 0%, var(--accent) 45%, #a5b4fc 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.map-panel-lead {
  margin: 0 0 1.5rem;
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.6;
  max-width: 22rem;
  margin-left: auto;
  margin-right: auto;
}

.map-panel-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
}

.map-panel-actions .btn {
  min-width: 10rem;
}

/* ——— Встроенная карта ——— */
.map-main.map-main--embed {
  position: fixed;
  top: var(--map-header-h);
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1;
  min-height: 0;
  padding: 0;
  margin: 0;
}

.map-frame-wrap {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  background: #0a0e14;
  border-top: 1px solid rgba(120, 140, 220, 0.12);
}

.map-frame {
  flex: 1;
  width: 100%;
  min-height: 0;
  border: 0;
  display: block;
  background: #0a0e14;
}

.map-loading {
  position: fixed;
  top: var(--map-header-h);
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.95rem;
  pointer-events: none;
  background: rgba(10, 14, 26, 0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.map-loading[hidden] {
  display: none !important;
}

.map-loading-spinner {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  border: 3px solid rgba(107, 92, 231, 0.25);
  border-top-color: var(--accent);
  animation: map-spin 0.85s linear infinite;
}

@keyframes map-spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 640px) {
  .page-map {
    --map-header-h: 3.85rem;
  }

  .map-panel {
    padding: 1.75rem 1.25rem 1.5rem;
    border-radius: 16px;
  }

  .map-gate {
    padding-left: 1rem;
    padding-right: 1rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .map-loading-spinner {
    animation: none;
    border-top-color: rgba(107, 92, 231, 0.5);
  }
}
