:root {
  --bg: #07111d;
  --bg-elevated: rgba(8, 16, 31, 0.82);
  --panel: rgba(10, 19, 36, 0.78);
  --panel-border: rgba(255, 255, 255, 0.08);
  --text: #edf3ff;
  --muted: #9fb0cc;
  --accent: #8bd3ff;
  --accent-2: #f5b347;
  --glow: 0 0 0 1px rgba(139, 211, 255, 0.2), 0 0 24px rgba(245, 179, 71, 0.2);
  --radius-xl: 24px;
  --radius-lg: 18px;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at top left, rgba(245, 179, 71, 0.16), transparent 26%),
    radial-gradient(circle at top right, rgba(49, 181, 255, 0.14), transparent 20%),
    linear-gradient(180deg, #060c17 0%, #091223 100%);
  color: var(--text);
  font-family: "DM Sans", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body {
  padding: 18px;
}

body.is-embedded .close-map-button {
  display: none !important;
}

body.is-embedded {
  padding: 0;
  background: #07111d;
}

body.is-embedded .app-shell {
  min-height: 100vh;
  gap: 0;
}

body.is-embedded .topbar,
body.is-embedded .detail-panel {
  display: none;
}

body.is-embedded .layout {
  grid-template-columns: 1fr;
  gap: 0;
  min-height: 100vh;
}

body.is-embedded .map-overlay {
  display: none;
}

body.is-embedded .map-panel {
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: #07111d;
}

body.is-embedded #map {
  min-height: 100vh;
  height: 100vh;
}

.app-shell {
  min-height: calc(100vh - 36px);
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 16px;
}

.topbar,
.detail-panel__inner,
.stat-card {
  backdrop-filter: blur(18px);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px 22px;
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-xl);
  background: var(--bg-elevated);
  box-shadow: var(--shadow);
}

.topbar h1 {
  margin: 4px 0 0;
  font-family: "Playfair Display", Georgia, serif;
  font-size: clamp(1.5rem, 3vw, 2.6rem);
  line-height: 0.98;
  max-width: 12ch;
}

.eyebrow {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.72rem;
  color: var(--muted);
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.ghost-button,
.ghost-link,
.primary-link {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  font: inherit;
  text-decoration: none;
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease, color 160ms ease;
}

.ghost-button,
.ghost-link {
  padding: 12px 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
}

.close-map-button {
  border-color: rgba(245, 179, 71, 0.22);
  background: rgba(245, 179, 71, 0.08);
}

.primary-link {
  padding: 12px 16px;
  border: 1px solid rgba(245, 179, 71, 0.3);
  background: linear-gradient(135deg, #f5b347 0%, #ea6a2e 100%);
  color: #07111d;
  font-weight: 700;
}

.ghost-button:hover,
.ghost-button:focus-visible,
.ghost-link:hover,
.ghost-link:focus-visible,
.primary-link:hover,
.primary-link:focus-visible {
  outline: none;
  transform: translateY(-1px);
}

.ghost-button:hover,
.ghost-button:focus-visible,
.ghost-link:hover,
.ghost-link:focus-visible {
  border-color: rgba(139, 211, 255, 0.5);
  background: rgba(139, 211, 255, 0.09);
}

.primary-link:hover,
.primary-link:focus-visible {
  border-color: rgba(255, 255, 255, 0.3);
  background: linear-gradient(135deg, #ffd98f 0%, #f18b4d 100%);
}

.layout {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(320px, 420px);
  gap: 16px;
}

.map-panel,
.detail-panel__inner {
  border: 1px solid var(--panel-border);
  box-shadow: var(--shadow);
}

.map-panel {
  position: relative;
  overflow: hidden;
  border-radius: 32px;
  background: linear-gradient(180deg, rgba(8, 18, 35, 0.8), rgba(7, 15, 31, 0.92));
}

#map {
  width: 100%;
  height: 100%;
  min-height: 68vh;
}

.map-overlay {
  position: absolute;
  inset: 18px 18px auto 18px;
  z-index: 600;
  display: flex;
  justify-content: flex-start;
  pointer-events: none;
}

.stat-card {
  pointer-events: auto;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(10, 18, 35, 0.74);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.stat-label {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  margin-bottom: 4px;
}

.detail-panel {
  min-height: 0;
}

.detail-panel__inner {
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 24px;
  border-radius: 32px;
  background: var(--panel);
}

.detail-panel h2 {
  margin: 0;
  font-family: "Playfair Display", Georgia, serif;
  font-size: clamp(1.6rem, 2.2vw, 2.25rem);
  line-height: 0.98;
}

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

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag {
  padding: 8px 10px;
  border-radius: 999px;
  font-size: 0.82rem;
  background: rgba(139, 211, 255, 0.08);
  border: 1px solid rgba(139, 211, 255, 0.18);
  color: #d9f4ff;
}

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

.meta-grid div {
  padding: 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.meta-grid dt {
  font-size: 0.78rem;
  color: var(--muted);
  margin-bottom: 6px;
}

.meta-grid dd {
  margin: 0;
  font-size: 1rem;
}

.detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: auto;
}

audio {
  width: 100%;
  min-height: 54px;
  filter: saturate(1.05);
}

.sound-marker {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: radial-gradient(circle at 35% 35%, #fff8d7 0%, #ffd166 26%, #ff7a3d 68%, #d94a2b 100%);
  box-shadow:
    0 0 0 1px rgba(8, 21, 45, 0.26),
    0 0 0 5px rgba(255, 255, 255, 0.34),
    0 0 14px rgba(8, 21, 45, 0.16),
    0 12px 22px rgba(8, 21, 45, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.82);
}

.leaflet-container {
  position: relative;
  background: linear-gradient(180deg, #bfe5f5 0%, #d8eff8 100%);
}

.leaflet-container::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.02));
}

.leaflet-tile-pane {
  filter: saturate(1.06) contrast(1.03) brightness(1.08);
}

.leaflet-control-attribution {
  max-width: min(280px, calc(100vw - 48px));
  white-space: normal;
  font-size: 0.62rem;
  line-height: 1.25;
  background: rgba(255, 255, 255, 0.76) !important;
}

.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
  background: rgba(8, 16, 31, 0.95);
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.popup-title {
  font-weight: 700;
  margin-bottom: 4px;
}

.popup-meta {
  color: var(--muted);
  font-size: 0.88rem;
}

.popup-link {
  display: inline-flex;
  margin-top: 8px;
  color: #d8f2ff;
  font-size: 0.88rem;
  font-weight: 700;
  text-decoration: none;
}

.popup-link:hover,
.popup-link:focus-visible {
  text-decoration: underline;
}

@media (max-width: 980px) {
  body {
    padding: 12px;
  }

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

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .toolbar {
    width: 100%;
  }

  .toolbar > * {
    flex: 1 1 auto;
  }

  #map {
    min-height: 52vh;
  }
}
