:root {
	--bg: #f4ead8;
	--ink: #1d2327;
	--muted: #5d6266;
	--panel: rgba(250, 245, 236, 0.78);
	--panel-solid: #f8f2e7;
	--line: rgba(29, 35, 39, 0.12);
	--accent: #d9652a;
	--accent-ink: #fff8ef;
	--teal: #1f5f66;
	--gauge-track: rgba(29, 35, 39, 0.14);
	--shadow: 0 6px 24px rgba(30, 24, 16, 0.16);
	--blur: blur(14px) saturate(1.3);
	--display: "Fraunces", Georgia, serif;
	--ui: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
	--safe-t: env(safe-area-inset-top, 0px);
	--safe-b: env(safe-area-inset-bottom, 0px);
	--safe-l: env(safe-area-inset-left, 0px);
	--safe-r: env(safe-area-inset-right, 0px);
	color-scheme: light;
}
@media (prefers-color-scheme: dark) {
	:root:not([data-theme="light"]) {
		--bg: #12171b; --ink: #ece6dc; --muted: #a7a39b; --panel: rgba(20, 25, 30, 0.72); --panel-solid: #1a2026;
		--line: rgba(236, 230, 220, 0.14); --accent: #f08a4b; --accent-ink: #1a1410; --teal: #7cc4c0;
		--gauge-track: rgba(236, 230, 220, 0.16); --shadow: 0 6px 24px rgba(0, 0, 0, 0.4); color-scheme: dark;
	}
}
:root[data-theme="dark"] {
	--bg: #12171b; --ink: #ece6dc; --muted: #a7a39b; --panel: rgba(20, 25, 30, 0.72); --panel-solid: #1a2026;
	--line: rgba(236, 230, 220, 0.14); --accent: #f08a4b; --accent-ink: #1a1410; --teal: #7cc4c0;
	--gauge-track: rgba(236, 230, 220, 0.16); --shadow: 0 6px 24px rgba(0, 0, 0, 0.4); color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--ink); font-family: var(--ui); -webkit-tap-highlight-color: transparent; }
body { overscroll-behavior: none; touch-action: none; }
button { font: inherit; color: inherit; cursor: pointer; }
#scene { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
.panel { background: var(--panel); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); border: 1px solid var(--line); box-shadow: var(--shadow); }

/* ---------- HUD ---------- */
.hud { position: fixed; inset: 0; pointer-events: none; opacity: 0; transition: opacity 0.8s; }
body.started .hud { opacity: 1; }
body.hide-hud .hud { opacity: 0 !important; }
.hud button, .hud .map { pointer-events: auto; }
.top { position: absolute; left: calc(12px + var(--safe-l)); right: calc(12px + var(--safe-r)); top: calc(10px + var(--safe-t)); display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 6px 12px 6px 6px; border-radius: 999px; background: var(--panel); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); border: 1px solid var(--line); }
.logo { border-radius: 50%; flex: none; }
.brand-text { min-width: 0; }
.name { font-family: var(--display); font-weight: 600; font-size: 16px; letter-spacing: 0.01em; line-height: 1.1; }
.where { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 52vw; }
.icons { display: flex; gap: 6px; flex: none; }
.ic { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); background: var(--panel); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); display: grid; place-items: center; padding: 0; }
.ic svg, .chip svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.ic:hover { border-color: var(--accent); }
.ic.active { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
#btn-sound .on { display: none; }
#btn-sound.active .on { display: block; }
#btn-sound.active .off { display: none; }
#btn-theme .moon { display: none; }
:root[data-theme="dark"] #btn-theme .sun { display: none; }
:root[data-theme="dark"] #btn-theme .moon { display: block; }
@media (prefers-color-scheme: dark) {
	:root:not([data-theme="light"]) #btn-theme .sun { display: none; }
	:root:not([data-theme="light"]) #btn-theme .moon { display: block; }
}

.card { position: absolute; left: 50%; top: calc(17vh + var(--safe-t)); transform: translate(-50%, 8px); text-align: center; opacity: 0; transition: opacity 1.4s ease, transform 1.4s ease; color: #fffaf2; text-shadow: 0 2px 28px rgba(20, 12, 4, 0.55), 0 1px 3px rgba(20, 12, 4, 0.45); width: min(92vw, 720px); padding: 18px 10px 22px; border-radius: 40px; background: radial-gradient(closest-side, rgba(25, 18, 10, 0.22), rgba(25, 18, 10, 0)); }
.card.show { opacity: 1; transform: translate(-50%, 0); }
.card-kicker { font-size: 12px; letter-spacing: 0.22em; text-transform: uppercase; font-weight: 600; opacity: 0.92; }
.card-title { font-family: var(--display); font-weight: 500; font-size: clamp(42px, 9vw, 86px); line-height: 1.02; margin: 6px 0 8px; letter-spacing: -0.01em; }
.card-line { font-size: clamp(14px, 2.2vw, 18px); font-weight: 500; max-width: 560px; margin: 0 auto; }

.toast { position: absolute; left: 50%; bottom: calc(150px + var(--safe-b)); transform: translateX(-50%) translateY(6px); padding: 8px 14px; border-radius: 999px; background: var(--panel); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); border: 1px solid var(--line); font-size: 13px; opacity: 0; transition: opacity 0.6s, transform 0.6s; white-space: nowrap; max-width: calc(100vw - 24px); overflow: hidden; text-overflow: ellipsis; }
.toast.show { opacity: 1; transform: translateX(-50%); }
.toast b { font-weight: 600; }

.bottom { position: absolute; left: calc(12px + var(--safe-l)); right: calc(12px + var(--safe-r)); bottom: calc(12px + var(--safe-b)); display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; }
.map { width: 136px; height: 136px; border-radius: 18px; position: relative; overflow: hidden; flex: none; padding: 0; color: var(--ink); text-align: left; }
.map:hover, .map:focus-visible { border-color: var(--accent); }
.map canvas { width: 100%; height: 100%; display: block; }
.map-meta { position: absolute; left: 6px; bottom: 6px; font-size: 11px; color: var(--ink); font-variant-numeric: tabular-nums; background: var(--panel-solid); padding: 1px 6px; border-radius: 999px; opacity: 0.92; }
.map-open { position: absolute; right: 6px; top: 6px; display: inline-flex; align-items: center; gap: 3px; font-size: 10.5px; font-weight: 600; padding: 2px 7px 2px 5px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); letter-spacing: 0.02em; }
.map-open svg { width: 11px; height: 11px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.center { display: flex; flex-direction: column; align-items: center; gap: 8px; flex: 1; min-width: 0; }
.seg { display: inline-flex; padding: 3px; border-radius: 999px; background: var(--panel); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); border: 1px solid var(--line); }
.seg button { border: 0; background: transparent; padding: 8px 16px; border-radius: 999px; font-weight: 600; font-size: 14px; }
.seg button.active { background: var(--accent); color: var(--accent-ink); }
.seg.small button { padding: 6px 11px; font-size: 13px; font-weight: 500; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); font-size: 13px; }
.speedo { width: 136px; height: 136px; border-radius: 50%; position: relative; flex: none; }
.gauge { position: absolute; inset: 6px; width: calc(100% - 12px); height: calc(100% - 12px); }
.gauge .track, .gauge .fill { fill: none; stroke-width: 5; stroke-linecap: round; }
.gauge .track { stroke: var(--gauge-track); }
.gauge .fill { stroke: var(--accent); stroke-dasharray: 231 231; stroke-dashoffset: 231; transition: stroke-dashoffset 0.15s linear; }
.gauge #ticks line { stroke: var(--muted); stroke-width: 1.2; }
.gauge #ticks text { fill: var(--muted); font-size: 7px; font-family: var(--ui); text-anchor: middle; dominant-baseline: middle; }
.gauge #needle { stroke: var(--ink); stroke-width: 3; stroke-linecap: round; transform-origin: 60px 60px; transition: transform 0.12s linear; }
.gauge .hub { fill: var(--ink); }
.readout { position: absolute; left: 0; right: 0; top: 52%; transform: translateY(-50%); text-align: center; line-height: 1; }
.readout span { font-family: var(--display); font-size: 30px; font-weight: 600; font-variant-numeric: tabular-nums; }
.readout small { display: block; font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); margin-top: 2px; }
.gear { position: absolute; left: 50%; bottom: 10%; transform: translateX(-50%); display: flex; align-items: center; gap: 5px; font-size: 11px; color: var(--muted); font-weight: 600; }
.gear i { display: block; width: 26px; height: 3px; border-radius: 2px; background: var(--gauge-track); position: relative; overflow: hidden; }
.gear i::after { content: ""; position: absolute; inset: 0; width: var(--rpm, 20%); background: var(--teal); }

.touch { position: absolute; left: 0; right: 0; bottom: calc(160px + var(--safe-b)); display: none; justify-content: space-between; padding: 0 calc(12px + var(--safe-l)) 0 calc(12px + var(--safe-r)); }
body.ride.touchdev .touch { display: flex; }
.pad { display: flex; gap: 10px; pointer-events: auto; }
.pad button { width: 66px; height: 66px; border-radius: 50%; border: 1px solid var(--line); background: var(--panel); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); font-size: 20px; touch-action: none; user-select: none; -webkit-user-select: none; }
.pad.right button { font-size: 12px; font-weight: 600; letter-spacing: 0.04em; }
.pad button.on { background: var(--accent); color: var(--accent-ink); }
#t-gas { width: 78px; height: 78px; }
.hint { position: absolute; left: 50%; bottom: calc(112px + var(--safe-b)); transform: translateX(-50%); font-size: 12px; color: #fffaf2; text-shadow: 0 1px 6px rgba(0, 0, 0, 0.5); opacity: 0; transition: opacity 0.6s; white-space: nowrap; }
body.ride:not(.touchdev) .hint.show { opacity: 0.95; }

/* ---------- sheets ---------- */
.sheet { position: fixed; right: calc(12px + var(--safe-r)); top: calc(62px + var(--safe-t)); width: min(360px, calc(100vw - 24px)); max-height: calc(100vh - 80px - var(--safe-t) - var(--safe-b)); overflow: auto; background: var(--panel-solid); color: var(--ink); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); padding: 14px 16px 16px; z-index: 5; }
.sheet[hidden] { display: none; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.sheet h2 { font-family: var(--display); font-weight: 600; font-size: 20px; margin: 0; }
.x { border: 0; background: transparent; font-size: 26px; line-height: 1; width: 36px; height: 36px; border-radius: 50%; }
.x:hover { background: var(--line); }
#chapter-list { list-style: none; margin: 0; padding: 0; }
#chapter-list li button { width: 100%; text-align: left; border: 0; background: transparent; padding: 10px 8px; border-radius: 12px; display: grid; grid-template-columns: 28px 1fr auto; gap: 2px 10px; align-items: baseline; }
#chapter-list li button:hover, #chapter-list li button.current { background: var(--line); }
#chapter-list .n { font-family: var(--display); color: var(--accent); font-size: 18px; grid-row: span 2; }
#chapter-list .t { font-weight: 600; font-size: 15px; }
#chapter-list .d { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
#chapter-list .l { grid-column: 2 / 4; font-size: 12.5px; color: var(--muted); }
.row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.row label { font-size: 14px; font-weight: 500; }
.row input[type="range"] { flex: 1; accent-color: var(--accent); }
.val { font-variant-numeric: tabular-nums; font-size: 13px; color: var(--muted); min-width: 64px; text-align: right; }
.swatches { display: flex; gap: 8px; }
.swatches button { width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--panel-solid); box-shadow: 0 0 0 1px var(--line); padding: 0; }
.swatches button.active { box-shadow: 0 0 0 2px var(--accent); }
.note { font-size: 12px; color: var(--muted); margin: 4px 0 0; }
.credits { font-size: 12px; color: var(--muted); margin: 12px 0 0; line-height: 1.5; border-top: 1px solid var(--line); padding-top: 10px; }
.credits a { color: inherit; }

.keys { border-top: 1px solid var(--line); margin-top: 10px; padding-top: 8px; font-size: 13px; }
.keys summary { cursor: pointer; font-weight: 500; font-size: 14px; padding: 2px 0; }
.keys dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 8px 0 0; }
.keys dt { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.keys dd { margin: 0; color: var(--muted); }

/* ---------- explore map ---------- */
.explore { position: fixed; inset: 0; z-index: 8; background: var(--bg); }
.explore[hidden] { display: none; }
.ex-map, .explore .ex-map.maplibregl-map { position: absolute; inset: 0; background: #b9c4c9; }
:root[data-theme="dark"] .ex-map { background: #1b2126; }
@media (prefers-color-scheme: dark) {
	:root:not([data-theme="light"]) .ex-map { background: #1b2126; }
}
.ex-top { position: absolute; z-index: 1000; top: calc(10px + var(--safe-t)); right: calc(12px + var(--safe-r)); left: calc(384px + var(--safe-l)); display: flex; gap: 8px; align-items: center; justify-content: flex-end; pointer-events: none; }
.ex-top > * { pointer-events: auto; }
.ex-search { flex: 0 1 380px; min-width: 0; display: flex; align-items: center; gap: 8px; height: 42px; padding: 0 14px; border-radius: 999px; background: var(--panel-solid); border: 1px solid var(--line); box-shadow: var(--shadow); }
.ex-search:focus-within { border-color: var(--accent); }
.ex-search svg { width: 18px; height: 18px; flex: none; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; }
.ex-search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--ink); font: inherit; font-size: 15px; }
.ex-top .ic { width: 42px; height: 42px; background: var(--panel-solid); box-shadow: var(--shadow); flex: none; }
.ex-top .ic.active { background: var(--accent); }
.ex-side { position: absolute; z-index: 1000; left: calc(12px + var(--safe-l)); top: calc(10px + var(--safe-t)); bottom: calc(12px + var(--safe-b)); width: 360px; display: flex; flex-direction: column; background: var(--panel-solid); color: var(--ink); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); padding: 14px 14px 10px; overflow: hidden; }
.ex-side h2 { font-family: var(--display); font-weight: 600; font-size: 20px; margin: 0 0 10px; }
.ex-grip { display: none; }
.ex-cats { display: flex; flex-wrap: wrap; gap: 6px; flex: none; }
.cat { display: inline-flex; align-items: center; gap: 5px; border: 1px solid var(--line); background: transparent; border-radius: 999px; padding: 5px 9px 5px 7px; font-size: 12.5px; font-weight: 500; white-space: nowrap; }
.cat svg { fill: none; stroke: var(--c); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.cat small { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.cat.on { background: var(--c); border-color: transparent; color: #fff; }
.cat.on svg { stroke: #fff; }
.cat.on small { color: rgba(255, 255, 255, 0.85); }
.cat.all { color: var(--muted); padding: 5px 10px; }
.ex-tools { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 10px 0 4px; flex-wrap: wrap; }
.ex-check { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; }
.ex-check input { accent-color: var(--accent); width: 16px; height: 16px; margin: 0; }
.ex-live { border: 1px solid var(--line); background: transparent; border-radius: 999px; padding: 5px 11px; font-size: 12.5px; font-weight: 500; }
.ex-live:disabled { opacity: 0.45; cursor: default; }
.ex-count { font-size: 12px; color: var(--muted); padding: 6px 2px 6px; border-top: 1px solid var(--line); margin-top: 6px; }
.ex-list { list-style: none; margin: 0 -6px; padding: 0; overflow: auto; flex: 1; min-height: 0; overscroll-behavior: contain; touch-action: pan-y; }
.ex-list button { width: 100%; display: grid; grid-template-columns: 30px 1fr auto; gap: 10px; align-items: center; text-align: left; border: 0; background: transparent; padding: 7px 6px; border-radius: 10px; }
.ex-list button:hover, .ex-list button:focus-visible { background: var(--line); }
.li-ic { width: 28px; height: 28px; border-radius: 50%; background: var(--c); display: grid; place-items: center; }
.li-ic svg, .ex-pin svg, .pp-kind svg { fill: none; stroke: #fff; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.li-t { min-width: 0; display: flex; flex-direction: column; }
.li-t b { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.li-t small { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.li-d { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.ex-credit { font-size: 11px; color: var(--muted); margin: 8px 0 0; line-height: 1.45; }
.ex-credit a { color: inherit; }
.ex-status { position: absolute; z-index: 1001; left: 50%; bottom: calc(24px + var(--safe-b)); transform: translateX(-50%); background: var(--panel-solid); color: var(--ink); border: 1px solid var(--line); box-shadow: var(--shadow); padding: 8px 14px; border-radius: 999px; font-size: 13px; max-width: calc(100vw - 24px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ex-status:empty { display: none; }
/* map toolbar: style switcher, 3D, overview, fly along */
.ex-bar { position: absolute; z-index: 1000; top: calc(62px + var(--safe-t)); right: calc(12px + var(--safe-r)); display: flex; gap: 8px; align-items: center; max-width: calc(100vw - 396px - var(--safe-l) - var(--safe-r)); overflow-x: auto; scrollbar-width: none; padding: 2px; }
.ex-bar::-webkit-scrollbar { display: none; }
.ex-seg { display: inline-flex; flex: none; padding: 3px; border-radius: 999px; background: var(--panel-solid); border: 1px solid var(--line); box-shadow: var(--shadow); }
.ex-seg button { border: 0; background: transparent; border-radius: 999px; padding: 6px 12px; font-size: 13px; font-weight: 500; }
.ex-seg button.active { background: var(--ink); color: var(--bg); }
.ex-seg button:disabled { opacity: 0.4; cursor: default; }
.ex-btn { flex: none; height: 38px; padding: 0 14px; border-radius: 999px; background: var(--panel-solid); border: 1px solid var(--line); box-shadow: var(--shadow); font-size: 13px; font-weight: 600; white-space: nowrap; }
.ex-btn.active { background: var(--ink); color: var(--bg); border-color: transparent; }
#ex-3d { min-width: 46px; padding: 0 12px; }
.ex-fly.active { background: var(--accent); color: var(--accent-ink); }
.ex-chaps { display: flex; gap: 6px; flex: none; overflow-x: auto; margin: 0 -14px 10px; padding: 0 14px 2px; scrollbar-width: none; }
.ex-chaps::-webkit-scrollbar { display: none; }
.chap { flex: none; display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: transparent; border-radius: 999px; padding: 4px 10px 4px 4px; font-size: 12.5px; font-weight: 500; white-space: nowrap; }
.ex-bar .s { display: none; }
.chap span, .ex-chapter span { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: #1d2327; color: #fff8ef; font-family: var(--display); font-weight: 600; font-size: 12px; }
.chap span { background: var(--ink); color: var(--bg); }
.chap:hover, .chap:focus-visible { background: var(--line); }
/* maplibre skin */
.explore .maplibregl-map { font-family: var(--ui); }
.explore .maplibregl-ctrl-attrib { font-size: 11px; background: rgba(250, 245, 236, 0.85); color: #1d2327; }
.explore .maplibregl-ctrl-attrib a { color: inherit; }
.explore .maplibregl-ctrl-group { border-radius: 12px; overflow: hidden; box-shadow: var(--shadow); }
.explore .maplibregl-ctrl-group button { width: 38px; height: 38px; }
.explore .maplibregl-ctrl-scale { background: rgba(250, 245, 236, 0.8); border-color: #1d2327; color: #1d2327; }
.explore .maplibregl-ctrl-bottom-left { left: 384px; }
.explore .maplibregl-ctrl-bottom-right .maplibregl-ctrl-attrib { max-width: calc(100vw - 560px); }
.explore .maplibregl-ctrl-attrib.maplibregl-compact { max-width: calc(100vw - 80px); }
.ex-chaps { -webkit-mask-image: linear-gradient(90deg, #000 85%, transparent); mask-image: linear-gradient(90deg, #000 85%, transparent); }
.ex-chapter { display: inline-flex; align-items: center; gap: 0; padding: 0; border: 0; background: transparent; cursor: pointer; }
.ex-chapter span { width: 24px; height: 24px; font-size: 13px; border: 2px solid #fff8ef; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.45); flex: none; }
.ex-chapter em { font-style: normal; font-weight: 600; font-size: 12px; color: #fff; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.9), 0 0 6px rgba(0, 0, 0, 0.6); margin-left: 5px; white-space: nowrap; }
.ex-rider { width: 44px; height: 44px; position: relative; pointer-events: none; }
.ex-rider .dot { position: absolute; left: 11px; top: 11px; width: 22px; height: 22px; border-radius: 50%; background: #d9652a; border: 3px solid #fff; box-shadow: 0 0 0 6px rgba(217, 101, 42, 0.3), 0 1px 5px rgba(0, 0, 0, 0.4); }
.ex-rider .cone { position: absolute; left: 0; top: 0; width: 44px; height: 44px; }
.ex-rider .cone::before { content: ""; position: absolute; left: 15px; top: -4px; border-left: 7px solid transparent; border-right: 7px solid transparent; border-bottom: 14px solid #d9652a; filter: drop-shadow(0 0 1px #fff); }
.explore .maplibregl-popup-content { border-radius: 14px; background: var(--panel-solid); color: var(--ink); padding: 12px 14px; font-size: 13px; line-height: 1.4; box-shadow: var(--shadow); }
.explore .maplibregl-popup-anchor-bottom .maplibregl-popup-tip, .explore .maplibregl-popup-anchor-bottom-left .maplibregl-popup-tip, .explore .maplibregl-popup-anchor-bottom-right .maplibregl-popup-tip { border-top-color: var(--panel-solid); }
.explore .maplibregl-popup-anchor-top .maplibregl-popup-tip, .explore .maplibregl-popup-anchor-top-left .maplibregl-popup-tip, .explore .maplibregl-popup-anchor-top-right .maplibregl-popup-tip { border-bottom-color: var(--panel-solid); }
.explore .maplibregl-popup-anchor-left .maplibregl-popup-tip { border-right-color: var(--panel-solid); }
.explore .maplibregl-popup-anchor-right .maplibregl-popup-tip { border-left-color: var(--panel-solid); }
.explore .maplibregl-popup-close-button { width: 28px; height: 28px; font-size: 20px; color: var(--muted); right: 4px; top: 4px; border-radius: 8px; }
:root[data-theme="dark"] .explore .maplibregl-ctrl-group { background: #1a2026; }
:root[data-theme="dark"] .explore .maplibregl-ctrl-group button + button { border-top-color: rgba(236, 230, 220, 0.14); }
:root[data-theme="dark"] .explore .maplibregl-ctrl-group .maplibregl-ctrl-icon { filter: invert(1); }
:root[data-theme="dark"] .explore .maplibregl-ctrl-attrib, :root[data-theme="dark"] .explore .maplibregl-ctrl-scale { background: rgba(20, 25, 30, 0.8); color: #ece6dc; border-color: #ece6dc; }
@media (prefers-color-scheme: dark) {
	:root:not([data-theme="light"]) .explore .maplibregl-ctrl-group { background: #1a2026; }
	:root:not([data-theme="light"]) .explore .maplibregl-ctrl-group button + button { border-top-color: rgba(236, 230, 220, 0.14); }
	:root:not([data-theme="light"]) .explore .maplibregl-ctrl-group .maplibregl-ctrl-icon { filter: invert(1); }
	:root:not([data-theme="light"]) .explore .maplibregl-ctrl-attrib, :root:not([data-theme="light"]) .explore .maplibregl-ctrl-scale { background: rgba(20, 25, 30, 0.8); color: #ece6dc; border-color: #ece6dc; }
}
.pp-kind { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: #fff; background: var(--c); padding: 2px 8px 2px 6px; border-radius: 999px; }
.pp-name { font-family: var(--display); font-weight: 600; font-size: 18px; margin: 6px 24px 2px 0; line-height: 1.2; }
.pp-dist { color: var(--muted); font-size: 12px; margin-bottom: 6px; }
.pp-row { margin: 3px 0; }
.pp-row b { font-weight: 600; }
.pp-links { margin: 6px 0 8px; }
.pp a { color: var(--teal); }
.pp-go { font-size: 13px; padding: 7px 16px; box-shadow: none; }

/* ---------- loader / finale ---------- */
.loader { position: fixed; inset: 0; display: grid; place-items: center; background: radial-gradient(120% 90% at 50% 0%, #f8dcae 0%, #f4ead8 55%, #e9dcc4 100%); color: #1d2327; z-index: 10; transition: opacity 0.9s ease; padding: 24px; }
:root[data-theme="dark"] .loader { background: radial-gradient(120% 90% at 50% 0%, #3a2a22 0%, #161b20 60%, #101418 100%); color: #ece6dc; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .loader { background: radial-gradient(120% 90% at 50% 0%, #3a2a22 0%, #161b20 60%, #101418 100%); color: #ece6dc; } }
body.started .loader { opacity: 0; pointer-events: none; }
.loader-in { text-align: center; max-width: 440px; }
.loader h1 { font-family: var(--display); font-weight: 600; font-size: clamp(34px, 8vw, 52px); margin: 14px 0 6px; letter-spacing: -0.01em; }
.tag { font-size: 15px; line-height: 1.5; opacity: 0.8; margin: 0 auto 22px; }
.bar { width: min(260px, 70vw); height: 3px; background: rgba(127, 110, 90, 0.25); border-radius: 2px; margin: 0 auto; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--accent); transform-origin: left; transform: scaleX(0); transition: transform 0.3s; }
.load-msg { font-size: 12px; opacity: 0.7; margin: 10px 0 18px; min-height: 16px; }
.primary { border: 0; background: var(--accent); color: var(--accent-ink); font-weight: 600; font-size: 16px; padding: 12px 26px; border-radius: 999px; box-shadow: 0 6px 18px rgba(217, 101, 42, 0.32); }
.primary:disabled { opacity: 0.35; box-shadow: none; cursor: default; }
.credit-small { font-size: 11px; opacity: 0.55; margin-top: 22px; }
.finale { position: fixed; inset: 0; display: flex; align-items: flex-start; justify-content: center; z-index: 6; padding: calc(70px + var(--safe-t)) 16px 16px; pointer-events: none; }
.finale[hidden] { display: none; }
.finale-in { pointer-events: auto; border-radius: 22px; padding: 22px 24px; max-width: 420px; text-align: center; color: var(--ink); }
.finale h2 { font-family: var(--display); font-weight: 600; font-size: 26px; margin: 6px 0 8px; }
.finale p { color: var(--muted); font-size: 14px; line-height: 1.5; margin: 0 0 16px; }
.finale .card-kicker { color: var(--accent); }
.finale-btns { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.finale-btns button:not(.primary) { border: 1px solid var(--line); background: transparent; padding: 11px 20px; border-radius: 999px; font-weight: 600; }

/* ---------- small screens ---------- */
@media (max-width: 600px) {
	.ic { width: 36px; height: 36px; }
	.icons { gap: 4px; }
	.brand { padding-right: 10px; }
	.name { font-size: 14px; }
	.where { max-width: 34vw; font-size: 11px; }
	.map { width: 104px; height: 104px; border-radius: 14px; }
	.speedo { width: 112px; height: 112px; }
	.readout span { font-size: 25px; }
	.gauge #ticks text { display: none; }
	.seg button { padding: 7px 13px; font-size: 13px; }
	.toast { bottom: calc(128px + var(--safe-b)); font-size: 12px; }
	.touch { bottom: calc(132px + var(--safe-b)); }
	.pad button { width: 58px; height: 58px; }
	#t-gas { width: 68px; height: 68px; }
	.card { top: calc(14vh + var(--safe-t)); }
}
@media (max-height: 500px) {
	.map { width: 92px; height: 92px; }
	.speedo { width: 100px; height: 100px; }
	.readout span { font-size: 22px; }
	.card { top: calc(10vh + var(--safe-t)); }
	.card-title { font-size: clamp(34px, 7vw, 58px); }
	.touch { bottom: calc(18px + var(--safe-b)); padding: 0 calc(120px + var(--safe-l)) 0 calc(120px + var(--safe-r)); }
	body.ride.touchdev .center { visibility: hidden; }
	.toast { bottom: calc(110px + var(--safe-b)); }
	.sheet { top: calc(56px + var(--safe-t)); max-height: calc(100vh - 66px); }
}
@media (max-width: 600px) {
	#btn-map { display: none; }
	.ex-top { left: calc(12px + var(--safe-l)); }
	.ex-search { flex: 1; }
	.ex-side { left: 0; right: 0; bottom: 0; top: auto; width: auto; height: 196px; max-height: 196px; border-radius: 18px 18px 0 0; padding: 4px 12px calc(8px + var(--safe-b)); transition: max-height 0.3s ease, height 0.3s ease; border-bottom: 0; }
	.explore.sheet-open .ex-side { height: 66vh; max-height: 66vh; }
	.ex-grip { display: block; width: 100%; height: 22px; border: 0; background: transparent; padding: 0; flex: none; }
	.ex-grip i { display: block; width: 42px; height: 5px; border-radius: 3px; background: var(--line); margin: 6px auto; }
	.ex-side h2 { display: none; }
	.ex-cats { flex-wrap: nowrap; overflow-x: auto; margin: 0 -12px; padding: 0 12px 4px; scrollbar-width: none; touch-action: pan-x; }
	.ex-cats::-webkit-scrollbar { display: none; }
	.ex-bar { top: calc(60px + var(--safe-t)); left: calc(12px + var(--safe-l)); right: calc(12px + var(--safe-r)); max-width: none; gap: 6px; }
	.ex-seg button { padding: 6px 10px; }
	.ex-bar .s { display: inline; }
	.ex-bar .l { display: none; }
	.ex-btn { height: 36px; padding: 0 12px; }
	.ex-chaps { margin: 0 -12px 8px; padding: 0 12px 2px; }
	.explore .maplibregl-ctrl-bottom-right, .explore .maplibregl-ctrl-bottom-left { bottom: 196px; transition: bottom 0.3s ease; }
	.explore.sheet-open .maplibregl-ctrl-bottom-right, .explore.sheet-open .maplibregl-ctrl-bottom-left { bottom: 66vh; }
	.explore .maplibregl-ctrl-bottom-left { left: 0; }
	.explore .maplibregl-ctrl-group button { width: 36px; height: 36px; }
	.ex-status { bottom: calc(208px + var(--safe-b)); }
	.ex-tools { margin-top: 8px; flex: none; }
	.explore:not(.sheet-open) .ex-credit { display: none; }
}
@media (max-height: 500px) and (min-width: 601px) {
	.ex-side { width: 300px; }
	.ex-top { left: calc(324px + var(--safe-l)); }
	.ex-bar { top: calc(58px + var(--safe-t)); max-width: calc(100vw - 336px - var(--safe-l) - var(--safe-r)); }
	.explore .maplibregl-ctrl-bottom-left { left: 312px; }
	.ex-side h2 { display: none; }
}
@media (max-width: 380px) {
	#btn-music { display: none; }
	.where { max-width: 30vw; }
}
@media (prefers-reduced-motion: reduce) {
	.card, .toast, .hud, .loader { transition: none; }
}
