:root {
  --ink: #edf3f5;
  --muted: #96a5ae;
  --paper: #0a1117;
  --panel: #121c24;
  --line: #2b3b46;
  --lime: #8fd3c7;
  --coral: #ef8c76;
  --blue: #77a9d4;
  --gold: #e4bd6a;
}

* { box-sizing: border-box; }
html { background: var(--paper); color: var(--ink); font-family: "Manrope", sans-serif; }
body { margin: 0; min-width: 320px; background: radial-gradient(circle at 78% 0%, rgba(42,91,105,.24) 0, transparent 32rem), linear-gradient(180deg, #0a1117 0, #0c141a 52%, #091016 100%); }
.shell { width: min(1500px, 100%); margin: auto; padding: 0 clamp(1rem, 3vw, 3.5rem); }
.hero { min-height: 390px; padding: clamp(4rem, 7vw, 7rem) 0 3rem; display: grid; grid-template-columns: minmax(0, 1fr) 240px; gap: 3rem; align-items: end; border-bottom: 1px solid var(--line); }
.eyebrow, .section-kicker { color: var(--lime); font: 600 .68rem/1.4 "IBM Plex Mono", monospace; letter-spacing: .14em; margin: 0 0 1.2rem; }
h1, h2 { font-family: "Manrope", sans-serif; }
h1 { margin: 0; max-width: 1050px; font-size: clamp(3.5rem, 7.5vw, 7.2rem); line-height: .9; letter-spacing: -.06em; font-weight: 600; }
h1 em { display: block; color: var(--lime); font-style: normal; font-weight: 500; }
.lede { max-width: 760px; color: #c2cdd2; font-size: clamp(1rem, 1.45vw, 1.22rem); line-height: 1.7; margin: 2rem 0 0; }
.hero-mark { display: flex; flex-direction: column; align-items: center; gap: 1rem; color: var(--muted); font-size: .72rem; letter-spacing: .13em; }
.orbit { width: 160px; height: 160px; border: 1px solid #536052; border-radius: 50%; position: relative; animation: spin 16s linear infinite; }
.orbit::before, .orbit::after { content: ""; position: absolute; inset: 50% -15px auto; height: 1px; background: #536052; }
.orbit::after { transform: rotate(90deg); }
.orbit i { position: absolute; width: 14px; height: 14px; background: var(--lime); border-radius: 50%; top: 12px; left: 29px; box-shadow: 0 0 22px var(--lime); }
@keyframes spin { to { transform: rotate(360deg); } }

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-bottom: 1px solid var(--line); }
.stats article { min-width: 0; overflow: hidden; padding: 2.2rem clamp(1rem, 2.5vw, 2.5rem); border-right: 1px solid var(--line); }
.stats article:first-child { padding-left: 0; }
.stats article:last-child { border: 0; }
.stats strong { display: block; font: 600 clamp(2rem, 4vw, 4.5rem)/1 "Manrope", sans-serif; letter-spacing: -.055em; white-space: nowrap; }
.stats span { color: var(--muted); text-transform: uppercase; letter-spacing: .1em; font: 500 .66rem/1.4 "IBM Plex Mono", monospace; }

.map-panel { padding: 5rem 0; }
.map-toolbar { display: flex; justify-content: space-between; gap: 2rem; align-items: end; margin-bottom: 1.4rem; }
.map-toolbar h2, .story-grid h2 { margin: 0; font-size: clamp(1.6rem, 3vw, 2.8rem); letter-spacing: -.04em; }
.filters { display: flex; gap: .75rem; align-items: end; flex-wrap: wrap; justify-content: flex-end; }
.map-toolbar > *, .filters { min-width: 0; }
.filters label { color: var(--muted); font: 500 .66rem/1.4 "IBM Plex Mono", monospace; text-transform: uppercase; letter-spacing: .08em; }
.timeline-control > span, .routes-control > span, .region-view-control > span, .region-summary-control > span, .international-control > span { display: block; color: var(--muted); font: 500 .66rem/1.4 "IBM Plex Mono", monospace; text-transform: uppercase; letter-spacing: .08em; }
.timeline-actions { display: flex; align-items: center; gap: .6rem; }
.timeline-actions output { min-width: 92px; color: var(--ink); font-size: .76rem; white-space: nowrap; }
.timeline-actions button[aria-pressed="true"] { color: var(--paper); background: var(--lime); border-color: var(--lime); }
.routes-actions { display: flex; align-items: center; gap: .6rem; }
.routes-actions button { min-width: 88px; }
.routes-actions input[type="range"] { width: 112px; height: 42px; margin-top: .4rem; padding: 0; border: 0; background: transparent; accent-color: var(--blue); cursor: ew-resize; }
.routes-actions output { min-width: 34px; margin-top: .4rem; color: var(--ink); font: 600 .7rem/1 "IBM Plex Mono", monospace; text-align: right; }
.region-actions { display: flex; }
.region-actions button { min-width: 78px; margin-right: -1px; border-radius: 0; }
.region-actions button:first-child { border-radius: 3px 0 0 3px; }
.region-actions button:last-child { margin-right: 0; border-radius: 0 3px 3px 0; }
.region-actions button[aria-pressed="true"] { color: var(--paper); background: var(--lime); border-color: var(--lime); position: relative; z-index: 1; }
.region-actions button:disabled { cursor: default; opacity: .45; }
.region-summary-control output { display: flex; align-items: center; min-width: 190px; height: 42px; margin-top: .4rem; padding: 0 .8rem; border: 1px solid #3a4a55; border-radius: 2px; background: #101921; color: var(--ink); font-size: .76rem; white-space: nowrap; }
select, input, button { display: block; margin-top: .4rem; height: 42px; border: 1px solid #3a4a55; border-radius: 2px; background: #14202a; color: var(--ink); font: inherit; padding: 0 .8rem; }
input { width: 190px; }
button { color: var(--lime); cursor: pointer; }
button:hover { border-color: var(--lime); }
.map-wrap { position: relative; overflow: hidden; border: 1px solid #354752; background: #0d151c; box-shadow: 0 24px 70px rgba(0,0,0,.24); }
#map { height: min(68vh, 760px); min-height: 490px; }
.globe-badge { position: absolute; z-index: 3; top: 18px; left: 18px; padding: .7rem .85rem; border: 1px solid #3a4b55; background: rgba(10,17,23,.9); color: var(--lime); font: 600 .64rem/1 "IBM Plex Mono", monospace; letter-spacing: .12em; backdrop-filter: blur(8px); pointer-events: none; }
.map-reset { position: absolute; z-index: 3; top: 58px; left: 18px; margin: 0; background: rgba(17,19,21,.9); backdrop-filter: blur(8px); }
.international-status { min-width: 174px; margin-top: .4rem; border-color: #5e573b; color: var(--gold); font: 700 .68rem/1.2 "Space Grotesk", sans-serif; letter-spacing: .05em; }
.international-status:hover { border-color: var(--gold); background: rgba(38,34,22,.94); }
.international-status:disabled { cursor: default; opacity: .8; }
.map-key { position: absolute; z-index: 500; left: 18px; bottom: 18px; background: rgba(17,19,21,.9); border: 1px solid #41464a; padding: .8rem 1rem; display: flex; gap: 1.1rem; flex-wrap: wrap; font-size: .7rem; color: #c5c3bd; backdrop-filter: blur(8px); }
.map-key i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: .35rem; }
.key-origin { background: var(--lime); box-shadow: 0 0 8px var(--lime); }
.key-destination { background: var(--coral); }
.key-hub { background: var(--gold); }
.map-key .key-route { width: 15px; height: 2px; border-radius: 0; background: var(--blue); vertical-align: middle; }
.map-key .key-selected { width: 15px; height: 3px; border-radius: 0; background: var(--lime); box-shadow: 0 0 6px rgba(214,255,84,.6); vertical-align: middle; }
.map-key .key-onward { width: 16px; height: 2px; border-radius: 0; background: repeating-linear-gradient(90deg, var(--gold) 0 5px, transparent 5px 8px); vertical-align: middle; }
#empty-state { position: absolute; z-index: 550; inset: 50% auto auto 50%; transform: translate(-50%, -50%); padding: 1rem 1.5rem; background: #111315e8; border: 1px solid var(--line); }
.maplibregl-map { background: radial-gradient(circle, #172735 0, #05090d 72%); font-family: "Manrope", sans-serif; }
.maplibregl-ctrl-group, .maplibregl-ctrl-attrib { background: rgba(17,19,21,.88) !important; color: #aaa; }
.maplibregl-ctrl-group button { margin: 0; background-color: transparent; }
.maplibregl-ctrl-group button + button { border-top-color: #41464a; }
.maplibregl-ctrl-icon { filter: invert(1); }
.maplibregl-ctrl-attrib a { color: var(--lime); }
.maplibregl-popup-content { min-width: 220px; padding: 1rem; border: 1px solid #41464a; border-radius: 3px; background: #191c1f; color: var(--ink); box-shadow: 0 12px 40px #0008; }
.maplibregl-popup-tip { border-top-color: #191c1f !important; border-bottom-color: #191c1f !important; }
.maplibregl-popup-close-button { width: 28px; height: 28px; margin: 0; padding: 0; border: 0; color: var(--ink); }
.popup-place { color: var(--lime); font-weight: 700; font-size: 1rem; }
.popup-place.hub-place { color: var(--gold); font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; }
.popup-title { margin: .55rem 0; }
.popup-meta { color: #aaa; font-size: .78rem; }
.popup-via { margin-top: .35rem; color: var(--gold); }

.records { padding: 0 0 5rem; }
.records-heading { display: flex; justify-content: space-between; align-items: end; gap: 2rem; margin-bottom: 1.5rem; }
.records-heading h2 { margin: 0; font-size: clamp(1.6rem, 3vw, 2.8rem); letter-spacing: -.04em; }
.records-heading > p { max-width: 320px; margin: 0; color: var(--muted); line-height: 1.5; text-align: right; }
.records-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; padding: 1px; background: var(--line); }
.records-grid article { min-width: 0; min-height: 210px; padding: clamp(1.4rem, 2.5vw, 2.4rem); border: 0; background: linear-gradient(145deg, #14202a, #101920); display: flex; flex-direction: column; }
.records-grid article:nth-last-child(-n+2) { grid-column: span 2; background: linear-gradient(135deg, #182833, #111b23 72%); }
.records-grid span { color: var(--lime); text-transform: uppercase; letter-spacing: .1em; font: 600 .66rem/1.4 "IBM Plex Mono", monospace; }
.records-grid strong { margin: auto 0 1rem; font: 600 clamp(1.8rem, 3vw, 3.4rem)/.98 "Manrope", sans-serif; letter-spacing: -.05em; overflow-wrap: anywhere; }
.records-grid p { margin: 0; color: var(--muted); }

.story-grid { display: grid; grid-template-columns: 1fr 1.4fr; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.story-grid article { padding: clamp(2rem, 5vw, 5rem); }
.story-grid article:first-child { padding-left: 0; border-right: 1px solid var(--line); }
.farthest-card .distance { font: 600 clamp(4rem, 8vw, 8rem)/.9 "Manrope", sans-serif; color: var(--coral); letter-spacing: -.07em; margin: 2rem 0; }
.farthest-card > p:last-child, .method-card > p { color: var(--muted); line-height: 1.7; max-width: 680px; }
.method-card strong { color: var(--ink); }
.store-link { display: inline-flex; align-items: center; min-height: 42px; margin-top: 1.3rem; padding: 0 .95rem; border: 1px solid #41535e; border-radius: 2px; color: var(--lime); font-weight: 700; text-decoration: none; }
.store-link:hover { border-color: var(--lime); background: rgba(214,255,84,.08); }
.method-tags { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: 2rem; }
.method-tags span { border: 1px solid #4a5054; padding: .55rem .75rem; color: #cac8c1; font-size: .75rem; }
footer { display: flex; justify-content: space-between; gap: 1rem 2rem; flex-wrap: wrap; padding: 2rem 0 4rem; color: var(--muted); font: 400 .68rem/1.5 "IBM Plex Mono", monospace; }
footer span { color: var(--lime); font-weight: 600; }

@media (max-width: 1300px) {
  .stats { grid-template-columns: 1fr 1fr; }
  .stats article { border-bottom: 1px solid var(--line); }
  .stats article:nth-child(2) { border-right: 0; }
  .map-toolbar { align-items: start; flex-direction: column; }
  .filters { justify-content: start; }
  .records-grid { grid-template-columns: 1fr 1fr; }
  .records-grid article:nth-last-child(-n+2) { grid-column: span 1; }
}
@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; }
  .hero-mark { display: none; }
  .story-grid { grid-template-columns: 1fr; }
  .story-grid article:first-child { border-right: 0; border-bottom: 1px solid var(--line); }
  .records-heading { align-items: start; flex-direction: column; gap: .75rem; }
  .records-heading > p { text-align: left; }
  footer { flex-direction: column; gap: .4rem; }
}
@media (max-width: 560px) {
  .shell { padding: 0 1rem; }
  .hero { min-height: 340px; padding-top: 4rem; }
  h1 { font-size: 3.5rem; }
  .stats strong { font-size: 2.4rem; }
  .stats article { padding: 1.5rem .8rem; }
  .map-key { right: 10px; left: 10px; bottom: 10px; }
  .globe-badge { top: 10px; left: 10px; }
  .map-reset { top: 50px; left: 10px; }
  .search-label, .search-label input { width: 100%; }
  .timeline-control, .timeline-actions, .routes-control, .routes-actions, .region-view-control, .region-summary-control, .international-control { width: 100%; }
  .routes-actions input[type="range"] { flex: 1; width: auto; }
  .region-actions button { flex: 1; }
  .region-summary-control output, .international-status { width: 100%; }
  .records-grid { grid-template-columns: 1fr; }
  .records-grid article { min-height: 180px; }
}
@media (prefers-reduced-motion: reduce) { .orbit { animation: none; } }

.preview-mode body { background: #07090c; }
.preview-mode .shell { width: 100%; padding: 0; }
.preview-mode .hero, .preview-mode .stats, .preview-mode .map-toolbar, .preview-mode .records, .preview-mode .story-grid, .preview-mode footer { display: none; }
.preview-mode .map-panel { padding: 0; }
.preview-mode .map-wrap { height: 100vh; border: 0; }
.preview-mode #map { height: 100vh; min-height: 0; }
