*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI',
    sans-serif;
  color: #f9fafb;
  background: #020617;
}

body {
  -webkit-font-smoothing: antialiased;
}

.page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  background: rgba(2, 6, 23, 0.9);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(148, 163, 184, 0.2);
  z-index: 1200; /* всегда выше слоёв карты */
}

.logo {
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 18px;
}

.nav a {
  color: #e5e7eb;
  text-decoration: none;
  margin-left: 20px;
  font-size: 14px;
  position: relative;
}

.nav a::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: -4px;
  width: 0;
  height: 2px;
  background: linear-gradient(90deg, #38bdf8, #a855f7);
  transition: width 0.2s ease-out;
}

.nav a:hover::after {
  width: 100%;
}

main {
  margin-top: 64px;
}

.hero {
  position: relative;
  min-height: calc(100vh - 64px);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.hero-bg {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 0% 0%, #22d3ee22, transparent 55%),
    radial-gradient(circle at 100% 100%, #a855f722, transparent 55%),
    radial-gradient(circle at 0% 100%, #22c55e1a, transparent 55%),
    radial-gradient(circle at 100% 0%, #f973161a, transparent 55%);
  animation: floatBackground 22s ease-in-out infinite alternate;
  /* убрали blur для снижения нагрузки при прокрутке */
}

@keyframes floatBackground {
  0% {
    transform: translate3d(0, 0, 0) scale(1);
  }
  50% {
    transform: translate3d(-10px, 10px, 0) scale(1.05);
  }
  100% {
    transform: translate3d(10px, -10px, 0) scale(1.02);
  }
}

.hero-content {
  position: relative;
  z-index: 1;
  text-align: center;
  max-width: 720px;
  padding: 40px 24px 64px;
}

.hero-tagline {
  font-size: 14px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: #9ca3af;
  margin-bottom: 16px;
}

.hero-word {
  font-size: clamp(48px, 8vw, 80px);
  margin: 0 0 16px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: linear-gradient(120deg, #22d3ee, #a855f7, #f97316);
  background-size: 200% 200%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: gradientText 8s ease-in-out infinite;
}

@keyframes gradientText {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

.hero-description {
  margin: 0 0 32px;
  font-size: 18px;
  color: #e5e7eb;
}

.primary-button {
  border: none;
  border-radius: 999px;
  padding: 12px 28px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  background: linear-gradient(120deg, #22d3ee, #6366f1, #a855f7);
  color: #0b1120;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.7);
  transition: transform 0.12s ease-out, box-shadow 0.12s ease-out,
    filter 0.12s ease-out;
}

.primary-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 24px 45px rgba(15, 23, 42, 0.9);
  filter: brightness(1.05);
}

.primary-button:active {
  transform: translateY(1px) scale(0.98);
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.7);
}

.map-section {
  padding: 40px 24px 56px;
}

.map-layout {
  max-width: 1120px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 2.2fr) minmax(260px, 1fr);
  gap: 24px;
  align-items: stretch;
}

.map-panel {
  background: radial-gradient(circle at top, #0f172a, #020617);
  border-radius: 20px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  overflow: hidden;
  box-shadow: 0 14px 32px rgba(15, 23, 42, 0.7); /* чуть легче тени */
}

.map-toolbar {
  padding: 12px 12px 4px;
  border-bottom: 1px solid rgba(15, 23, 42, 0.9);
  background: radial-gradient(circle at top, #020617, #020617);
}

.map-search {
  display: flex;
  gap: 8px;
  align-items: center;
}

.map-search input {
  flex: 1;
}

.primary-button.small {
  padding: 8px 16px;
  font-size: 13px;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.7);
}

#map {
  width: 100%;
  height: 382px;
  position: relative;
}

/* Overlay для изображения на UI карты */
.map-ui-overlay {
  position: absolute;
  z-index: 1000; /* Выше карты, но ниже маркеров (они обычно 1000+) */
  pointer-events: none; /* Чтобы не мешало взаимодействию с картой */
}

/* Стили для изображения на карте */
.map-overlay-image {
  max-width: 15px; /* Максимальная ширина */
  max-height: 15px; /* Максимальная высота */
  opacity: 1; /* Полупрозрачность */
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.3));
}

.map-overlay-image:hover {
  opacity: 1;
}

.map-ui-overlay {
  bottom: -5px;
  right: 185px;
}

.info-panel {
  background: radial-gradient(circle at top left, #020617, #020617);
  border-radius: 20px;
  padding: 20px 18px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.7);
}

.info-panel h2 {
  margin: 0 0 10px;
  font-size: 20px;
}

.term-details.empty {
  color: #9ca3af;
  font-size: 14px;
}

.term-word {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 6px;
}

.term-description {
  font-size: 15px;
  margin-bottom: 6px;
}

.term-example {
  font-size: 14px;
  color: #9ca3af;
}

.term-meta {
  margin-top: 10px;
  font-size: 12px;
  color: #6b7280;
}

.form-section {
  padding: 0 24px 56px;
}

.form-card {
  max-width: 1120px;
  margin: 0 auto;
  background: radial-gradient(circle at top right, #020617, #020617);
  border-radius: 24px;
  padding: 24px 24px 20px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.9);
}

.form-card h2 {
  margin-top: 0;
  margin-bottom: 6px;
  font-size: 22px;
}

.form-hint {
  margin: 0 0 18px;
  font-size: 14px;
  color: #9ca3af;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px 24px;
}

.form-field {
  display: flex;
  flex-direction: column;
}

.form-field label {
  font-size: 14px;
  color: #e5e7eb;
  margin-bottom: 4px;
}

.field-hint {
  margin-top: 4px;
  font-size: 12px;
  color: #6b7280;
}

input[type='text'],
textarea {
  background: rgba(15, 23, 42, 0.9);
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.45);
  color: #f9fafb;
  padding: 9px 11px;
  font-size: 14px;
  resize: vertical;
}

input[type='text']:focus,
textarea:focus {
  outline: none;
  border-color: #38bdf8;
  box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.4);
}

input[readonly] {
  opacity: 0.85;
}

.coords-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.form-footer {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}

.form-message {
  min-height: 18px;
  font-size: 13px;
}

.form-message.error {
  color: #f97373;
}

.form-message.success {
  color: #4ade80;
}

.footer {
  margin-top: auto;
  padding: 14px 24px 18px;
  border-top: 1px solid rgba(148, 163, 184, 0.35);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  color: #9ca3af;
}

.footer-note {
  opacity: 0.9;
}

/* Leaflet overrides (тёмная тема) */
.leaflet-container {
  background: #020617;
  font-family: inherit;
}

/* чтобы карта не перекрывала фиксированную шапку */
.leaflet-top,
.leaflet-bottom {
  z-index: 400;
}

.leaflet-control-attribution {
  font-size: 10px;
}

.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
  background: #020617;
  color: #f9fafb;
  border: 1px solid rgba(148, 163, 184, 0.6);
}

.leaflet-popup-content {
  margin: 10px 12px;
}

.leaflet-popup-content b {
  display: block;
  margin-bottom: 4px;
  font-size: 13px;
}

.leaflet-popup-content small {
  font-size: 11px;
  color: #9ca3af;
}

@media (max-width: 960px) {
  .map-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .info-panel {
    order: -1;
  }

  .form-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .header {
    padding: 0 16px;
  }

  .nav a {
    margin-left: 14px;
    font-size: 13px;
  }
}

@media (max-width: 640px) {
  .header {
    height: auto;
    padding: 10px 14px;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }

  main {
    margin-top: 88px;
  }

  .nav {
    display: flex;
    width: 100%;
    justify-content: space-between;
  }

  .map-section,
  .form-section {
    padding-inline: 14px;
  }

  .form-card {
    padding-inline: 16px;
  }

  .footer {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }
}


