/* Flat board: filter panel on top, a pannable schematic of cards joined by roads, route bar below.
 * Styling follows anikoyoga.ru: Manrope, white/#f7f8f8 ground, #161616 ink, #8f8e91 grey text,
 * peach #ffd8af accent, tan script sub-headings, black uppercase pill buttons, soft white cards. */
:root {
  --bg: #f7f8f8;
  --white: #ffffff;
  --ink: #161616;
  --grey: #8f8e91;
  --line: #c6c6c6;
  --line-2: #e6e6e6;
  --peach: #ffd8af;
  --tan: #c49a6c;
  --sans: 'Manrope', Arial, sans-serif;
  --script: 'Marck Script', 'Segoe Script', cursive;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
  --shadow: 0 10px 30px rgba(22, 22, 22, .07), 0 2px 6px rgba(22, 22, 22, .05);
  color-scheme: light;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; margin: 0; overflow: hidden; overscroll-behavior: none; }
body { background: var(--bg); color: var(--ink); font: 500 14px/1.45 var(--sans); }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--tan); outline-offset: 2px; }

/* ---------- Top ---------- */
.top { position: fixed; z-index: 20; top: 0; left: 0; right: 0; background: rgba(255, 255, 255, .96); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); padding: calc(env(safe-area-inset-top, 0px) + 10px) max(16px, env(safe-area-inset-right, 0px)) 10px max(16px, env(safe-area-inset-left, 0px)); box-shadow: 0 1px 0 var(--line-2); }
.row1 { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { font: 400 22px/1 var(--sans); letter-spacing: -.02em; }
.brand b { font-weight: 800; }
.brand .bul { display: inline-block; width: 7px; height: 7px; margin: 0 6px 3px; border-radius: 50%; background: #a8cf9b; box-shadow: 0 0 0 3px rgba(168,207,155,.25); vertical-align: middle; }
.fold { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 14px; border-radius: 12px; background: var(--ink); color: #fff; font: 700 11px/1 var(--sans); letter-spacing: .06em; text-transform: uppercase; }
.fold svg { width: 14px; height: 14px; stroke-width: 2; transition: transform .25s; }
.top.folded .fold svg { transform: rotate(180deg); }
.top.folded .filters { display: none; }
.filters { display: flex; flex-direction: column; gap: 10px; padding-top: 12px; }

.radius { display: flex; align-items: center; gap: 12px; }
.radius .lbl, .prices .lbl { font: 700 11px/1 var(--sans); letter-spacing: .08em; text-transform: uppercase; }
.radius output { min-width: 56px; text-align: right; font: 800 15px/1 var(--sans); font-variant-numeric: tabular-nums; }
.slider { flex: 1; min-width: 0; position: relative; display: flex; padding-bottom: 12px; }
input[type=range] { flex: 1; min-width: 0; appearance: none; height: 22px; background: transparent; }
input[type=range]::-webkit-slider-runnable-track { height: 2px; background: var(--line-2); border-radius: 1px; }
input[type=range]::-moz-range-track { height: 2px; background: var(--line-2); }
input[type=range]::-webkit-slider-thumb { appearance: none; width: 20px; height: 20px; margin-top: -9px; border-radius: 50%; background: var(--ink); border: 4px solid var(--peach); }
input[type=range]::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: var(--ink); border: 4px solid var(--peach); }
.ticks { position: absolute; left: 10px; right: 10px; bottom: 0; height: 10px; font: 500 9px/1 var(--mono); color: var(--grey); pointer-events: none; }
.ticks span { position: absolute; transform: translateX(-50%); white-space: nowrap; }

.types { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 0 12px; }
.types::-webkit-scrollbar { display: none; }
.type { flex: none; width: 60px; display: flex; flex-direction: column; align-items: center; gap: 5px; color: var(--grey); }
.type .ic { width: 42px; height: 42px; border-radius: 50%; background: var(--bg); display: grid; place-items: center; color: var(--ink); transition: background .2s, color .2s; }
.type .ic svg { width: 21px; height: 21px; }
.type span { font: 600 10px/1.1 var(--sans); white-space: nowrap; }
.type.on .ic { background: var(--ink); color: #fff; box-shadow: 0 0 0 3px var(--peach); }
.type.on span { color: var(--ink); }
.prices { display: flex; align-items: center; gap: 6px; }
.prices .lbl { margin-right: 4px; }
.price-btn { height: 30px; padding: 0 12px; border-radius: 15px; background: var(--white); border: 1px solid var(--line-2); font: 700 12px/1 var(--sans); letter-spacing: .04em; }
.price-btn.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.price-btn.clear { border-color: transparent; background: none; color: var(--grey); margin-left: auto; font-weight: 600; }

/* ---------- Board ---------- */
.board { position: fixed; inset: 0; overflow: hidden; touch-action: none; cursor: grab; background:
  radial-gradient(circle at 50% 55%, rgba(255, 216, 175, .28), transparent 55%), var(--bg); }
.board.dragging { cursor: grabbing; }
.world { position: absolute; inset: 0; }
.roads { position: absolute; left: 0; top: 0; width: 100%; height: 100%; overflow: visible; }
.road-edge { stroke: var(--line); stroke-width: 7; fill: none; stroke-linecap: round; }
.road-fill { stroke: var(--white); stroke-width: 4; fill: none; stroke-linecap: round; }
.trail { stroke: var(--grey); stroke-width: 1.4; stroke-dasharray: 4 5; fill: none; stroke-linecap: round; opacity: .7; }
.route-glow { stroke: var(--peach); stroke-width: 14; fill: none; stroke-linecap: round; opacity: .9; }
.route-line { stroke: var(--ink); stroke-width: 2.5; fill: none; stroke-linecap: round; stroke-dasharray: 8 7; animation: flow 1.2s linear infinite; }
@keyframes flow { to { stroke-dashoffset: -15; } }
.km-label { font: 500 9px/1 var(--mono); fill: var(--grey); paint-order: stroke; stroke: var(--bg); stroke-width: 3px; }
.ring { fill: none; stroke: var(--line-2); stroke-width: 1; stroke-dasharray: 2 4; }
.ring-label { font: 500 9px var(--mono); fill: #b9b6b0; stroke: none; }

.card { position: absolute; left: 0; top: 0; width: 116px; margin-left: -58px; margin-top: -62px; background: var(--white); border-radius: 18px; box-shadow: var(--shadow); text-align: left; overflow: hidden; transition: box-shadow .2s, opacity .3s; }
.card.sel, .card.onroute { box-shadow: 0 0 0 2px var(--ink), var(--shadow); }
.card.onroute.sel { box-shadow: 0 0 0 2px var(--ink), 0 0 0 7px var(--peach), var(--shadow); }
.card .media { height: 62px; position: relative; overflow: hidden; background: var(--bg); }
.card .media i { position: absolute; inset: -8%; background: center/cover; animation: drift 16s ease-in-out infinite alternate; }
.card .media video { width: 100%; height: 100%; object-fit: cover; display: block; }
@keyframes drift { 0% { transform: scale(1) translate(0, 0); } 100% { transform: scale(1.14) translate(-4%, 3%); } }
@keyframes blink { 50% { opacity: .25; } }
.card .body { padding: 7px 9px 9px; display: flex; flex-direction: column; gap: 4px; }
.card h3 { margin: 0; font: 800 11px/1.15 var(--sans); text-transform: uppercase; letter-spacing: .01em; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 25px; }
.card .row { display: flex; justify-content: space-between; align-items: center; gap: 4px; }
.card .icons { display: flex; gap: 2px; }
.card .icons svg { width: 14px; height: 14px; stroke-width: 1.6; }
.card .meta { font: 500 9px/1 var(--mono); color: var(--grey); white-space: nowrap; font-variant-numeric: tabular-nums; }
.dollars b { color: var(--ink); font-weight: 700; }
.dollars .off { opacity: .3; }
.me { position: absolute; left: 0; top: 0; width: 0; height: 0; z-index: 5; }
.me i { position: absolute; left: -9px; top: -9px; width: 18px; height: 18px; border-radius: 50%; background: var(--ink); border: 4px solid var(--peach); animation: ping 2.2s infinite; }
.me span { position: absolute; left: 50%; top: 14px; transform: translateX(-50%); font: 500 9px/1 var(--mono); text-transform: uppercase; color: var(--ink); white-space: nowrap; background: var(--white); padding: 3px 6px; border-radius: 6px; }
@keyframes ping { 0% { box-shadow: 0 0 0 0 rgba(255,216,175,.9); } 70% { box-shadow: 0 0 0 16px rgba(255,216,175,0); } 100% { box-shadow: 0 0 0 0 rgba(255,216,175,0); } }
.script { font: 400 26px/1 var(--script); color: var(--tan); }
.empty { position: fixed; left: 50%; top: 55%; transform: translate(-50%, -50%); text-align: center; color: var(--grey); width: min(300px, 80vw); }
.empty .script { display: block; margin-bottom: 6px; }

/* ---------- Zoom ---------- */
.zoom { position: fixed; z-index: 15; right: max(12px, env(safe-area-inset-right, 0px)); bottom: calc(env(safe-area-inset-bottom, 0px) + 84px); display: flex; flex-direction: column; gap: 6px; }
.ctrl { width: 40px; height: 40px; border-radius: 12px; background: var(--white); box-shadow: var(--shadow); display: grid; place-items: center; font: 500 20px/1 var(--sans); }

/* ---------- Bottom bar ---------- */
.bar { position: fixed; z-index: 20; left: max(10px, env(safe-area-inset-left, 0px)); right: max(10px, env(safe-area-inset-right, 0px)); bottom: calc(env(safe-area-inset-bottom, 0px) + 10px); min-height: 60px; display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 16px; background: var(--white); border-radius: 20px; box-shadow: var(--shadow); }
.bar-info { flex: 1; min-width: 0; font-size: 12px; color: var(--grey); }
.bar-info b { font-weight: 800; color: var(--ink); }
.bar-info .stops { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; margin-top: 4px; }
.bar-info .stops button { flex: none; font: 600 10px/1 var(--sans); padding: 5px 8px; background: var(--bg); border-radius: 8px; color: var(--ink); }
.route-btn { flex: none; height: 44px; padding: 0 18px; border-radius: 12px; background: var(--ink); color: #fff; font: 700 12px/1 var(--sans); letter-spacing: .06em; text-transform: uppercase; }
.route-btn.on { background: var(--peach); color: var(--ink); }

/* ---------- Detail ---------- */
.detail { position: fixed; inset: 0; z-index: 50; background: var(--bg); overflow-y: auto; overscroll-behavior: contain; animation: rise .3s cubic-bezier(.2,.8,.2,1); }
@keyframes rise { from { transform: translateY(40px); opacity: 0; } }
.d-hero { position: relative; aspect-ratio: 4 / 3.6; max-height: 58vh; width: 100%; overflow: hidden; background: var(--ink); }
.d-hero i { position: absolute; inset: -6%; background: center/cover; animation: drift 18s ease-in-out infinite alternate; }
.d-hero::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(22,22,22,.25), transparent 30%, transparent 55%, rgba(22,22,22,.75)); }
.d-hero video { width: 100%; height: 100%; object-fit: cover; }
.d-hero .ph { position: absolute; z-index: 1; left: 16px; top: calc(env(safe-area-inset-top, 0px) + 20px); font: 500 9px/1 var(--mono); text-transform: uppercase; letter-spacing: .04em; color: #fff; background: rgba(22,22,22,.55); padding: 5px 8px; border-radius: 6px; }
.d-close { position: absolute; z-index: 2; top: calc(env(safe-area-inset-top, 0px) + 12px); right: max(12px, env(safe-area-inset-right, 0px)); width: 40px; height: 40px; border-radius: 12px; background: var(--white); display: grid; place-items: center; }
.d-hero h1 { position: absolute; z-index: 1; left: 18px; right: 18px; bottom: 18px; margin: 0; color: #fff; font: 800 30px/1.02 var(--sans); text-transform: uppercase; letter-spacing: -.005em; text-wrap: balance; }
.d-body { padding: 18px max(18px, env(safe-area-inset-right, 0px)) calc(40px + env(safe-area-inset-bottom, 0px)) max(18px, env(safe-area-inset-left, 0px)); max-width: 640px; margin: 0 auto; }
.d-body .script { margin: 4px 0 2px; }
.d-sub { color: var(--grey); font-size: 15px; margin: 0; }
.d-facts { display: flex; gap: 8px; margin: 14px 0 0; flex-wrap: wrap; }
.d-facts span { font: 700 11px/1 var(--sans); text-transform: uppercase; letter-spacing: .04em; background: var(--white); padding: 9px 12px; border-radius: 12px; }
.d-facts .ex { background: var(--peach); }
.d-types { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.d-types span { display: inline-flex; align-items: center; gap: 6px; font: 600 12px/1 var(--sans); padding: 8px 12px 8px 9px; border-radius: 20px; background: var(--white); border: 1px solid var(--line-2); }
.d-types svg { width: 16px; height: 16px; }
.d-cta { display: flex; flex-direction: column; gap: 8px; margin: 18px 0 6px; }
.btn { display: flex; align-items: center; justify-content: center; gap: 8px; height: 50px; border-radius: 12px; font: 700 13px/1 var(--sans); letter-spacing: .06em; text-transform: uppercase; text-decoration: none; }
.btn.dark { background: var(--ink); color: #fff; }
.btn.light { background: var(--white); color: var(--ink); box-shadow: var(--shadow); }
.btn.soon { background: transparent; color: var(--grey); border: 1px dashed var(--line); }
.btn svg { width: 18px; height: 18px; }
.btn-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.btn-row .btn { height: 46px; font-size: 11px; letter-spacing: .04em; }
.d-sec { margin-top: 28px; }
.d-sec h2 { font: 800 18px/1.1 var(--sans); text-transform: uppercase; margin: 2px 0 10px; }
.d-sec p { margin: 0; max-width: 62ch; color: var(--grey); font-size: 15px; }
.d-sec p b { color: var(--ink); font-weight: 500; }
.d-dark { margin-top: 28px; border-radius: 24px; padding: 22px; color: #fff; background: linear-gradient(120deg, #161616 45%, #b8916b); }
.d-dark h2 { color: #fff; font: 800 18px/1.1 var(--sans); text-transform: uppercase; margin: 0 0 10px; }
.d-dark p { margin: 0; color: rgba(255,255,255,.82); font-size: 15px; }
.d-dark small { display: block; margin-top: 12px; font: 500 10px/1 var(--mono); text-transform: uppercase; color: var(--peach); }
.d-gallery { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.d-gallery button { aspect-ratio: 1.25; border-radius: 18px; background: center/cover var(--white); position: relative; overflow: hidden; box-shadow: var(--shadow); }
.d-gallery .play { position: absolute; left: 8px; bottom: 8px; width: 26px; height: 26px; border-radius: 50%; background: var(--white); display: grid; place-items: center; }
.d-gallery .play svg { width: 10px; height: 10px; fill: var(--ink); stroke: none; }

/* ---------- Viewer ---------- */
.viewer { position: fixed; inset: 0; z-index: 70; background: var(--ink); display: flex; flex-direction: column; justify-content: center; }
.v-track { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
.v-track::-webkit-scrollbar { display: none; }
.v-slide { flex: none; width: 100%; aspect-ratio: 400/250; scroll-snap-align: center; background: center/cover; }
.v-slide video, .v-slide img { width: 100%; height: 100%; object-fit: cover; }
.v-cap { color: #fff; text-align: center; font: 500 11px/1.4 var(--mono); padding: 14px; min-height: 48px; margin: 0; }
.v-close { position: absolute; top: calc(env(safe-area-inset-top, 0px) + 12px); right: 12px; color: #fff; width: 44px; height: 44px; display: grid; place-items: center; }

@media (min-width: 760px) {
  .top { left: 50%; right: auto; width: 560px; transform: translateX(-50%); top: 12px; border-radius: 20px; box-shadow: var(--shadow); padding-top: 12px; }
  .bar { left: 50%; right: auto; width: 560px; transform: translateX(-50%); }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* folded card: a dot with the main icon */
.card .dot, .card .dot-lbl { display: none; }
.card.mini { width: 0; height: 0; margin: 0; overflow: visible; background: none; box-shadow: none; border-radius: 0; }
.card.mini .media, .card.mini .body { display: none; }
.card.mini .dot { display: grid; position: absolute; left: -16px; top: -16px; width: 32px; height: 32px; border-radius: 50%; background: var(--white); box-shadow: var(--shadow); place-items: center; color: var(--ink); }
.card.mini .dot svg { width: 16px; height: 16px; }
.card.mini.onroute .dot { background: var(--ink); color: #fff; box-shadow: 0 0 0 3px var(--peach); }
.card.mini .dot-lbl { display: block; position: absolute; left: 0; top: 19px; transform: translateX(-50%); max-width: 90px; font: 700 8px/1.1 var(--sans); text-transform: uppercase; text-align: center; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; opacity: .7; }
.card.mini.nolbl .dot-lbl { display: none; }
.filters { gap: 8px; padding-top: 10px; }

/* real McLeod streets under the schematic */
.st { fill: none; stroke: #cfcac1; stroke-linecap: round; stroke-linejoin: round; }
.st.st1 { stroke-width: 9; } .st.st2 { stroke-width: 6.5; } .st.st3 { stroke-width: 2.4; stroke: #d9d5ce; }
.st-in { fill: none; stroke: var(--white); stroke-linecap: round; stroke-linejoin: round; }
.st-in.st1 { stroke-width: 6; } .st-in.st2 { stroke-width: 4; }
.st-lbl { font: 700 8px/1 var(--sans); letter-spacing: .08em; text-transform: uppercase; fill: #a9a6a0; stroke: var(--bg); stroke-width: 3px; paint-order: stroke; }

/* place dots + leaders (true positions) */
.leader { stroke: var(--ink); stroke-width: 1; opacity: .35; fill: none; }
.pdot { fill: var(--ink); stroke: var(--white); stroke-width: 2; }
.pdot.on { fill: var(--ink); stroke: var(--peach); stroke-width: 3; }
