:root {
  color-scheme: dark;
  --bg: #07080d;
  --panel: rgba(15, 18, 32, 0.78);
  --panel-strong: rgba(22, 27, 46, 0.96);
  --line: rgba(255, 255, 255, 0.12);
  --text: #f7f7fb;
  --muted: #a6acc4;
  --muted-2: #717894;
  --pink: #ff4fa3;
  --orange: #ff9f43;
  --blue: #64d2ff;
  --green: #59f0a7;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.45);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 12% 10%, rgba(255, 79, 163, 0.22), transparent 36rem),
    radial-gradient(circle at 84% 8%, rgba(100, 210, 255, 0.2), transparent 34rem),
    linear-gradient(180deg, #07080d 0%, #0c1020 54%, #06070b 100%);
  color: var(--text);
  min-height: 100vh;
}

a { color: inherit; }
.orb { position: fixed; border-radius: 999px; filter: blur(20px); pointer-events: none; opacity: 0.35; }
.orb-a { width: 18rem; height: 18rem; background: var(--pink); right: -5rem; top: 12rem; }
.orb-b { width: 14rem; height: 14rem; background: var(--blue); left: -5rem; bottom: 6rem; }

.hero, .app-shell { width: min(1180px, calc(100% - 32px)); margin: 0 auto; }
.hero { padding: 28px 0 18px; }
.topnav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 54px; }
.brand { font-weight: 800; letter-spacing: -0.03em; text-decoration: none; font-size: 1.1rem; }
.home-link { color: var(--muted); text-decoration: none; border: 1px solid var(--line); padding: 0.55rem 0.85rem; border-radius: 999px; background: rgba(255,255,255,0.04); }
.home-link:hover { color: var(--text); border-color: rgba(255,255,255,0.28); }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1fr) 230px; gap: 28px; align-items: end; }
.eyebrow { margin: 0 0 10px; color: var(--blue); text-transform: uppercase; letter-spacing: 0.16em; font-size: 0.78rem; font-weight: 800; }
h1 { margin: 0; font-size: clamp(2.4rem, 8vw, 6rem); line-height: 0.9; letter-spacing: -0.08em; max-width: 850px; }
.lede { color: var(--muted); max-width: 760px; font-size: clamp(1rem, 2.2vw, 1.25rem); line-height: 1.7; margin: 24px 0 0; }
.stats-card { padding: 22px; border-radius: 28px; border: 1px solid var(--line); background: linear-gradient(135deg, rgba(255,255,255,0.1), rgba(255,255,255,0.035)); box-shadow: var(--shadow); backdrop-filter: blur(18px); }
.stat-number { display: block; font-size: 3.6rem; line-height: 0.9; font-weight: 800; letter-spacing: -0.08em; }
.stat-number.small { font-size: 2rem; margin-top: 18px; }
.stat-label { display: block; color: var(--muted); font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.12em; margin-top: 8px; }

.app-shell { padding-bottom: 56px; position: relative; }
.controls { position: sticky; top: 12px; z-index: 20; display: grid; grid-template-columns: 1fr auto; gap: 12px; padding: 14px; border: 1px solid var(--line); border-radius: 26px; background: rgba(7, 8, 13, 0.76); box-shadow: 0 18px 50px rgba(0,0,0,0.28); backdrop-filter: blur(22px); margin: 28px 0; }
.search-wrap { display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 0 16px; border-radius: 999px; background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.08); }
.search-wrap span { color: var(--muted-2); font-size: 1.2rem; }
input, select, button { font: inherit; }
#search { width: 100%; background: transparent; border: 0; outline: 0; color: var(--text); font-size: 1rem; }
#search::placeholder { color: var(--muted-2); }
.view-toggle { display: flex; gap: 6px; padding: 5px; border-radius: 999px; background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.08); }
.toggle { border: 0; border-radius: 999px; padding: 0 18px; color: var(--muted); background: transparent; cursor: pointer; font-weight: 700; }
.toggle.active { color: #11131b; background: linear-gradient(135deg, var(--blue), var(--green)); }
.filter-row { grid-column: 1 / -1; display: flex; gap: 10px; flex-wrap: wrap; }
select { color: var(--text); background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.1); border-radius: 999px; padding: 0.65rem 0.9rem; min-width: 150px; }
select option { background: #111522; color: var(--text); }
.result-meta { grid-column: 1 / -1; margin: 0; color: var(--muted-2); font-size: 0.9rem; }

.timeline { position: relative; display: grid; gap: 18px; padding-left: 28px; }
.timeline::before { content: ''; position: absolute; left: 8px; top: 8px; bottom: 8px; width: 2px; background: linear-gradient(var(--pink), var(--orange), var(--blue)); opacity: 0.75; }
.place-card { position: relative; border: 1px solid var(--line); border-radius: 28px; padding: 22px; background: var(--panel); box-shadow: 0 20px 55px rgba(0,0,0,0.28); backdrop-filter: blur(16px); overflow: hidden; }
.place-card::before { content: ''; position: absolute; left: -27px; top: 30px; width: 14px; height: 14px; border-radius: 50%; background: var(--orange); border: 3px solid #07080d; box-shadow: 0 0 0 6px rgba(255,159,67,0.18); }
.place-card::after { content: ''; position: absolute; inset: 0 0 auto 0; height: 3px; background: linear-gradient(90deg, var(--pink), var(--orange), var(--blue)); opacity: 0.85; }
.card-topline { display: flex; justify-content: space-between; gap: 10px; align-items: center; margin-bottom: 10px; }
.date-pill, .confidence { color: var(--muted); font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; }
.confidence { color: var(--green); }
.place-card h2 { margin: 0; font-size: clamp(1.45rem, 3vw, 2.4rem); letter-spacing: -0.05em; }
.place-meta { margin: 8px 0 12px; color: var(--muted); }
.evidence { margin: 0; color: #d9dced; line-height: 1.65; }
.details { margin-top: 14px; color: var(--muted); }
.details summary { cursor: pointer; color: var(--blue); font-weight: 700; }
.caption, .notes { margin: 10px 0 0; font-size: 0.93rem; }
.links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.links a { text-decoration: none; border-radius: 999px; padding: 0.55rem 0.8rem; border: 1px solid rgba(255,255,255,0.12); background: rgba(255,255,255,0.07); color: var(--text); font-weight: 700; font-size: 0.86rem; }
.links a:hover { border-color: rgba(255,255,255,0.32); transform: translateY(-1px); }

.hidden { display: none !important; }
.map-panel { display: grid; grid-template-columns: 390px minmax(0, 1fr); gap: 16px; min-height: 72vh; }
.map-list { display: grid; gap: 10px; align-content: start; max-height: 72vh; overflow: auto; padding-right: 6px; }
.map-row { width: 100%; text-align: left; border: 1px solid var(--line); border-radius: 18px; background: rgba(255,255,255,0.06); color: var(--text); padding: 14px; cursor: pointer; }
.map-row:hover, .map-row.active { border-color: rgba(100,210,255,0.55); background: rgba(100,210,255,0.1); }
.map-row strong { display: block; font-size: 1rem; margin-bottom: 5px; }
.map-row span, .map-row em { display: block; color: var(--muted); font-size: 0.86rem; font-style: normal; }
.map-row em { color: var(--green); font-size: 0.72rem; margin-top: 6px; text-transform: uppercase; letter-spacing: 0.12em; font-weight: 800; }
.map-frame-wrap { position: sticky; top: 135px; height: calc(100vh - 165px); min-height: 520px; border-radius: 28px; overflow: hidden; border: 1px solid var(--line); background: var(--panel-strong); box-shadow: var(--shadow); }
#map { position: absolute; inset: 0; background: #111522; }
.maplibregl-ctrl-attrib, .maplibregl-ctrl button { color: #111827; }
.marker { width: 34px; height: 44px; border: 0; background: transparent; cursor: pointer; transform-origin: bottom center; filter: drop-shadow(0 8px 14px rgba(0,0,0,0.38)); }
.marker span { position: absolute; left: 50%; top: 3px; width: 28px; height: 28px; transform: translateX(-50%) rotate(45deg); border-radius: 50% 50% 50% 4px; background: linear-gradient(135deg, var(--pink), var(--orange)); border: 3px solid #fff; }
.marker span::after { content: ''; position: absolute; inset: 7px; border-radius: 50%; background: #fff; opacity: 0.95; }
.marker:hover, .marker.active { transform: scale(1.14); z-index: 5; }
.marker.active span { background: linear-gradient(135deg, var(--blue), var(--green)); box-shadow: 0 0 0 8px rgba(100,210,255,0.2); }
.map-card { position: absolute; left: 18px; right: 18px; bottom: 18px; z-index: 4; padding: 16px; border-radius: 20px; background: rgba(7, 8, 13, 0.86); border: 1px solid rgba(255,255,255,0.16); box-shadow: 0 18px 44px rgba(0,0,0,0.36); backdrop-filter: blur(18px); }
.map-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.map-card strong { font-size: 1.15rem; letter-spacing: -0.03em; }
.map-card button { width: 30px; height: 30px; border: 1px solid rgba(255,255,255,0.18); border-radius: 999px; background: rgba(255,255,255,0.08); color: var(--text); cursor: pointer; }
.map-card p { margin: 8px 0 12px; color: var(--muted); font-size: 0.92rem; }
.map-card-links { display: flex; flex-wrap: wrap; gap: 8px; }
.map-card-links a { text-decoration: none; border-radius: 999px; padding: 0.45rem 0.7rem; background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.12); font-size: 0.82rem; font-weight: 800; }
.map-empty { position: absolute; left: 18px; right: 18px; top: 18px; z-index: 3; padding: 14px; border-radius: 18px; color: var(--muted); text-align: center; background: rgba(7,8,13,0.72); border: 1px solid rgba(255,255,255,0.12); backdrop-filter: blur(14px); }

.empty { border: 1px dashed var(--line); border-radius: 24px; padding: 32px; color: var(--muted); text-align: center; }

@media (max-width: 820px) {
  .hero-grid, .controls, .map-panel { grid-template-columns: 1fr; }
  .topnav { margin-bottom: 34px; }
  .stats-card { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; align-items: baseline; }
  .stat-number.small { margin-top: 0; }
  .controls { position: relative; top: 0; }
  .toggle { min-height: 40px; flex: 1; }
  .map-frame-wrap { position: relative; top: 0; height: 420px; min-height: 420px; }
  .map-list { max-height: none; }
}
