:root {
  --bg: #120d09;
  --panel: rgba(36, 24, 18, 0.92);
  --panel-strong: rgba(20, 13, 9, 0.96);
  --panel-soft: rgba(60, 42, 29, 0.72);
  --text: #f1e7d2;
  --muted: #c7b99a;
  --accent: #b88945;
  --accent-soft: #8f6735;
  --line: rgba(215, 182, 131, 0.24);
  --error: #f0a2a2;
  --shadow: 0 18px 60px rgba(0, 0, 0, 0.35);
  --radius: 18px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at top left, rgba(184, 137, 69, 0.16), transparent 28%),
    radial-gradient(circle at bottom right, rgba(143, 103, 53, 0.2), transparent 22%),
    linear-gradient(180deg, #1b120d 0%, #0c0907 100%);
  color: var(--text);
  font-family: Georgia, "Times New Roman", serif;
}

body {
  min-height: 100vh;
}

a {
  color: var(--accent);
}

button {
  font: inherit;
}

.app-shell {
  width: min(1440px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 24px 0 32px;
}

.hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 26px 28px;
  margin-bottom: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(40, 27, 18, 0.96), rgba(21, 15, 11, 0.96));
  box-shadow: var(--shadow);
}

.eyebrow {
  margin: 0 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 0.72rem;
  color: var(--accent);
}

.hero h1 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 3.5rem);
  line-height: 0.96;
  letter-spacing: 0.02em;
}

.lede {
  max-width: 62ch;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 1.02rem;
  line-height: 1.6;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(300px, 0.85fr);
  gap: 20px;
  align-items: start;
}

.map-panel,
.sidebar-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
}

.map-panel {
  position: relative;
  overflow: hidden;
  min-height: 72vh;
}

.map-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px 0;
  position: relative;
  z-index: 400;
}

.status-pill,
.status-note {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel-soft);
  padding: 8px 12px;
  color: var(--text);
  font-size: 0.88rem;
}

.status-pill[data-state="error"] {
  color: var(--error);
  border-color: rgba(240, 162, 162, 0.35);
}

.status-pill[data-state="ready"] {
  color: #d1f0cb;
}

.map-canvas {
  width: 100%;
  min-height: 68vh;
  margin-top: 10px;
}

.leaflet-container {
  background: #0d0b09;
  font-family: Georgia, "Times New Roman", serif;
}

.leaflet-control-layers,
.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
  background: #1b120d;
  color: var(--text);
}

.leaflet-control-layers {
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.leaflet-control-layers label {
  color: var(--text);
}

.leaflet-bar a,
.leaflet-bar a:hover {
  background: #251912;
  color: var(--text);
  border-bottom-color: var(--line);
}

.leaflet-control-attribution {
  background: rgba(15, 11, 8, 0.84);
  color: var(--muted);
}

.leaflet-control-attribution a {
  color: var(--accent);
}

.legend {
  position: absolute;
  right: 18px;
  bottom: 18px;
  z-index: 450;
  width: min(280px, calc(100% - 36px));
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(17, 12, 9, 0.9);
}

.legend h2,
.sidebar-card h2 {
  margin: 0 0 10px;
  font-size: 1rem;
}

.legend ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.legend li {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 0.92rem;
}

.legend-swatch {
  width: 16px;
  height: 16px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.18);
}

.legend-swatch.villages {
  background: #d9c29f;
}

.legend-swatch.culture {
  background: #b88945;
}

.legend-swatch.ecology {
  background: #5b8f58;
}

.legend-swatch.routes {
  height: 5px;
  border-radius: 999px;
  background: #d7a35f;
}

.sidebar {
  display: grid;
  gap: 20px;
}

.sidebar-card {
  padding: 18px;
}

.muted {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.feature-details {
  display: grid;
  gap: 14px;
}

.feature-meta {
  display: grid;
  gap: 8px;
}

.feature-title {
  margin: 0;
  font-size: 1.5rem;
}

.feature-tag {
  display: inline-flex;
  width: fit-content;
  border: 1px solid rgba(184, 137, 69, 0.4);
  border-radius: 999px;
  padding: 6px 10px;
  color: var(--accent);
  background: rgba(184, 137, 69, 0.08);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.feature-copy {
  color: var(--text);
  line-height: 1.7;
}

.verified-note {
  color: var(--muted);
  font-size: 0.92rem;
}

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

.ghost-button,
.action-button {
  border: 1px solid rgba(184, 137, 69, 0.35);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(184, 137, 69, 0.14), rgba(184, 137, 69, 0.06));
  color: var(--text);
  padding: 12px 14px;
  cursor: pointer;
  transition: transform 120ms ease, border-color 120ms ease, background 120ms ease;
}

.ghost-button:hover,
.action-button:hover {
  transform: translateY(-1px);
  border-color: rgba(184, 137, 69, 0.6);
}

.action-button[disabled] {
  cursor: not-allowed;
  opacity: 0.45;
  transform: none;
}

.error-box {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(240, 162, 162, 0.35);
  background: rgba(103, 39, 39, 0.28);
  color: var(--error);
  white-space: pre-wrap;
}

.popup-card {
  display: grid;
  gap: 6px;
  min-width: 220px;
}

.popup-card strong {
  font-size: 1.02rem;
}

.popup-card span,
.popup-card p {
  margin: 0;
  color: var(--muted);
}

@media (max-width: 1100px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .map-panel {
    min-height: 62vh;
  }
}

@media (max-width: 760px) {
  .app-shell {
    width: min(100vw - 16px, 1440px);
    padding-top: 12px;
  }

  .hero {
    padding: 20px;
    flex-direction: column;
  }

  .map-toolbar {
    flex-direction: column;
    align-items: stretch;
    padding-inline: 12px;
  }

  .map-canvas {
    min-height: 58vh;
  }

  .legend {
    left: 12px;
    right: 12px;
    width: auto;
  }

  .action-grid {
    grid-template-columns: 1fr;
  }
}
