:root {
  --bg: #f5f0e8;
  --sheet: #fbf8f3;
  --card: #ffffff;
  --ink: #13202e;
  --muted: #6a6f76;
  --line: #e7e0d5;
  --chip: #efe9df;
  --navy: #0f1f33;
  --navy-ink: #ffffff;
  --accent: #c4461c;
  --accent-soft: #f7e3d8;
  --route: #c4461c;
  --hop: #5b21a0;
  --open: #2f9e44;
  --soon: #b7791f;
  --closed: #b42318;
  --warn: #8a4d00;
  --warn-bg: #fbeed6;
  --bad: #b42318;
  --bad-bg: #fbe6e3;
  --glass: rgba(255, 255, 255, .88);
  --shadow: 0 8px 30px rgba(20, 24, 30, .14), 0 1px 3px rgba(20, 24, 30, .08);
  --display: "DM Serif Display", Georgia, "Times New Roman", serif;
  --serif: "Source Serif 4", Georgia, serif;
  --body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --tiles: sepia(.18) saturate(.75) brightness(1.02) contrast(.95);
  --panel-w: 440px;
  --tab-h: 64px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #12161b; --sheet: #171c22; --card: #1f252c; --ink: #eef0f2; --muted: #9aa3ad; --line: #2b333c;
    --chip: #262d35; --navy: #eef0f2; --navy-ink: #12161b; --accent: #ff7a45; --accent-soft: #3a2218; --route: #ff7a45; --hop: #cfa8ff;
    --open: #4cc26a; --soon: #e0a23c; --closed: #ff8a80; --warn: #f0b35a; --warn-bg: #3a2a10; --bad: #ff8a80; --bad-bg: #3d1714;
    --glass: rgba(31, 37, 44, .9); --shadow: 0 8px 30px rgba(0, 0, 0, .45);
    --tiles: invert(1) hue-rotate(180deg) brightness(.85) contrast(.9) saturate(.5);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #12161b; --sheet: #171c22; --card: #1f252c; --ink: #eef0f2; --muted: #9aa3ad; --line: #2b333c;
  --chip: #262d35; --navy: #eef0f2; --navy-ink: #12161b; --accent: #ff7a45; --accent-soft: #3a2218; --route: #ff7a45; --hop: #cfa8ff;
  --open: #4cc26a; --soon: #e0a23c; --closed: #ff8a80; --warn: #f0b35a; --warn-bg: #3a2a10; --bad: #ff8a80; --bad-bg: #3d1714;
  --glass: rgba(31, 37, 44, .9); --shadow: 0 8px 30px rgba(0, 0, 0, .45);
    --tiles: invert(1) hue-rotate(180deg) brightness(.85) contrast(.9) saturate(.5);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; overflow: hidden; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.45 var(--body); -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }
a { color: var(--accent); }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
h1, h2, h3 { font-weight: 400; margin: 0; }
p { margin: 0; }
.ic { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.ic.sm { width: 17px; height: 17px; }
.ic.xs { width: 14px; height: 14px; }

.app { position: fixed; inset: 0; }
#map { position: absolute; inset: 0; background: var(--bg); z-index: 0; }

/* ---------- map chrome ---------- */
.brand {
  position: absolute; z-index: 400; left: 0; right: 0; top: 0;
  padding: calc(env(safe-area-inset-top, 0px) + 18px) 20px 60px;
  background: linear-gradient(to bottom, var(--bg) 0%, color-mix(in srgb, var(--bg) 80%, transparent) 50%, transparent 100%);
  pointer-events: none;
  display: grid; grid-template-columns: 1fr auto; column-gap: 12px; align-items: start;
}
.brand h1 { font: 38px/.95 var(--display); white-space: nowrap; letter-spacing: -.01em; color: var(--ink); }
.brand h1 span { font-size: 58px; }
.tagline { grid-column: 1; margin-top: 10px; font-size: 11px; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }
.daychip {
  grid-column: 2; grid-row: 1; pointer-events: auto; position: relative;
  display: inline-flex; align-items: center; gap: 6px; padding: 0 12px; height: 40px; border-radius: 999px;
  background: var(--glass); box-shadow: var(--shadow); font-weight: 600; font-size: 14px;
}
.daychip select { appearance: none; -webkit-appearance: none; border: 0; background: transparent; font-weight: 600; padding: 0 18px 0 0; margin-right: -18px; cursor: pointer; height: 100%; position: relative; z-index: 1; }
.daychip select:focus-visible { outline: none; }
.daychip:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }

.mapbtns { position: absolute; z-index: 400; right: 16px; top: calc(env(safe-area-inset-top, 0px) + 150px); display: grid; gap: 12px; }
.round { width: 48px; height: 48px; border-radius: 50%; border: 0; display: grid; place-items: center; background: var(--glass); color: var(--ink); box-shadow: var(--shadow); padding: 0; }
.round[aria-pressed="true"] { color: var(--accent); }
#locate[aria-pressed="true"] { color: #2f7ff5; }
.round.busy .ic { animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .3; } }

.leaflet-control-zoom { display: none; }
.leaflet-control-attribution { background: color-mix(in srgb, var(--sheet) 80%, transparent) !important; color: var(--muted); font-size: 10px; }
.leaflet-control-attribution a { color: var(--muted); }
.leaflet-container { font: 13px/1.4 var(--body); background: var(--bg); }
.leaflet-tile-pane { filter: var(--tiles); }

/* photo pins */
.pin { position: relative; width: 100%; height: 100%; transition: transform .15s; transform-origin: 50% 100%; }
.pin .pimg { position: absolute; left: 0; top: 0; width: 50px; height: 50px; border-radius: 50%; overflow: hidden; background: var(--chip); border: 3px solid #fff; box-shadow: 0 3px 10px rgba(0,0,0,.35); }
.pin .pimg img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pin::after { content: ""; position: absolute; left: 50%; bottom: 0; width: 12px; height: 12px; background: #fff; transform: translate(-50%, -2px) rotate(45deg); border-radius: 2px; box-shadow: 2px 2px 3px rgba(0,0,0,.2); z-index: -1; }
.pin .pn { position: absolute; right: -6px; top: -5px; min-width: 22px; height: 22px; padding: 0 5px; border-radius: 11px; background: var(--navy); color: var(--navy-ink); font: 700 12px/22px var(--body); text-align: center; border: 2px solid #fff; }
.pin.sel { transform: scale(1.18); }
.pin.sel .pimg { border-color: var(--accent); }
.pin.sel .pn { background: var(--accent); color: #fff; }
.pin.done .pn { background: var(--open); }
.pin.done .pimg img { filter: saturate(.5); opacity: .85; }
.pin.off .pimg { width: 36px; height: 36px; filter: grayscale(1); opacity: .75; border-width: 2px; }
.dotpin { width: 18px; height: 18px; border-radius: 50%; background: #7b4a1e; border: 3px solid #fff; box-shadow: 0 1px 5px rgba(0,0,0,.35); }
.dotpin.sel { background: var(--accent); transform: scale(1.35); }
.me { width: 22px; height: 22px; border-radius: 50%; background: #2f7ff5; border: 4px solid #fff; box-shadow: 0 0 0 6px rgba(47,127,245,.25), 0 2px 6px rgba(0,0,0,.3); }

/* peek card */
.peek {
  position: absolute; z-index: 450; left: 12px; right: 12px; bottom: calc(var(--tab-h) + env(safe-area-inset-bottom, 0px) + 12px);
  background: var(--sheet); border-radius: 24px; box-shadow: var(--shadow); padding: 6px 12px 12px;
}
.peek:empty { display: none; }
.grab { width: 40px; height: 5px; border-radius: 3px; background: var(--line); margin: 4px auto 8px; }
.grabbtn { position: sticky; top: -6px; z-index: 2; display: block; width: 100%; height: 30px; margin: -6px 0 -12px; padding: 12px 0 0; border: 0; background: linear-gradient(var(--sheet) 70%, transparent); cursor: grab; touch-action: none; }
.grabbtn .grab { display: block; width: 44px; height: 5px; margin: 0 auto; background: color-mix(in srgb, var(--muted) 45%, transparent); }
.sheethead { touch-action: pan-x; }
.peek { padding: 0; background: none; box-shadow: none; border-radius: 0; left: 0; right: 0; }
.ptrack { display: flex; gap: 10px; overflow-x: auto; scroll-snap-type: x mandatory; padding: 4px 22px 12px; scrollbar-width: none; overscroll-behavior-x: contain; }
.ptrack::-webkit-scrollbar { display: none; }
.pslide { flex: 0 0 calc(100% - 44px); scroll-snap-align: center; scroll-snap-stop: always; display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; min-width: 0; padding: 12px; border-radius: 22px; background: var(--sheet); box-shadow: var(--shadow); }
.peek .card { display: grid; grid-template-columns: 92px 1fr; gap: 12px; align-items: center; width: 100%; border: 0; background: none; padding: 0; text-align: left; min-width: 0; color: inherit; }
.peek .pth { width: 92px; height: 88px; border-radius: 14px; }
.kick { display: block; font-size: 11px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.peek .nm { display: block; font: 20px/1.15 var(--display); margin: 3px 0 4px; }
.psub { font-weight: 600; color: var(--ink); }
.pdots { display: flex; justify-content: center; gap: 6px; width: max-content; margin: -2px auto 0; padding: 5px 8px; border-radius: 999px; background: var(--glass); box-shadow: var(--shadow); }
.pdots i { width: 6px; height: 6px; border-radius: 3px; background: var(--line); transition: width .2s, background .2s; }
.pdots i.on { width: 16px; background: var(--ink); }
.chev.check { color: var(--muted); }
.chev.check[aria-pressed="true"] { background: var(--open); border-color: var(--open); color: #fff; }
.chev { padding: 0; color: var(--ink); width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); display: grid; place-items: center; background: var(--card); }

/* images */
.ph { display: block; position: relative; overflow: hidden; background: linear-gradient(135deg, var(--chip), var(--line)); flex: none; }
.ph img { width: 100%; height: 100%; object-fit: cover; display: block; }
img.broken { visibility: hidden; }

/* status */
.status { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 500; }
.status .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--open); flex: none; }
.status.open { color: var(--open); }
.status.soon { color: var(--soon); } .status.soon .dot { background: var(--soon); }
.status.closed { color: var(--closed); } .status.closed .dot { background: var(--closed); }
.arr { margin-left: 4px; font-size: 13px; font-weight: 600; color: var(--ink); white-space: nowrap; font-variant-numeric: tabular-nums; }

/* ---------- tab bar ---------- */
.tabbar {
  position: absolute; z-index: 600; left: 0; right: 0; bottom: 0;
  height: calc(var(--tab-h) + env(safe-area-inset-bottom, 0px)); padding-bottom: env(safe-area-inset-bottom, 0px);
  display: flex; background: var(--sheet); border-top: 1px solid var(--line);
}
.tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 12px; font-weight: 500; color: var(--muted); text-decoration: none; }
.tabbar a[aria-current="page"] { color: var(--ink); font-weight: 700; }
.tabbar a[aria-current="page"] .ic { stroke-width: 2.4; }

/* ---------- sheets ---------- */
.sheet {
  position: absolute; z-index: 500; left: 0; right: 0; top: calc(env(safe-area-inset-top, 0px) + 28px); bottom: calc(var(--tab-h) + env(safe-area-inset-bottom, 0px));
  background: var(--sheet); border-radius: 24px 24px 0 0; box-shadow: 0 -10px 40px rgba(0,0,0,.18);
  overflow-y: auto; overscroll-behavior: contain; padding: 6px 0 24px;
  visibility: hidden; transform: translateY(24px); opacity: 0; transition: transform .22s ease, opacity .22s ease, visibility 0s .22s;
}
[data-view="plan"] #plan-view, [data-view="list"] #list-view, [data-view="history"] #history-view { visibility: visible; transform: none; opacity: 1; transition: transform .22s ease, opacity .22s ease; }
.sheethead { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 12px 20px 4px; }
.sheethead h2 { font: 38px/1.05 var(--display); letter-spacing: -.01em; }
.sub { margin-top: 4px; color: var(--muted); font-size: 15px; font-variant-numeric: tabular-nums; }
.pillbtn { white-space: nowrap; border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 9px 18px; font-weight: 600; font-size: 15px; }
.pillbtn[aria-pressed="true"] { background: var(--navy); color: var(--navy-ink); border-color: var(--navy); }

.settings { margin: 14px 16px 0; padding: 12px; border-radius: 18px; background: var(--card); border: 1px solid var(--line); display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.seg { grid-column: 1 / -1; display: flex; background: var(--chip); border-radius: 12px; padding: 3px; }
.seg button { flex: 1; border: 0; background: transparent; padding: 8px; border-radius: 10px; font-weight: 600; font-size: 14px; color: var(--muted); }
.seg button[aria-checked="true"] { background: var(--card); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.field { display: grid; gap: 4px; font-size: 12px; font-weight: 600; color: var(--muted); }
.field input { width: 100%; min-height: 42px; border: 1px solid var(--line); border-radius: 10px; background: var(--sheet); padding: 6px 10px; font-size: 16px; color: var(--ink); font-variant-numeric: tabular-nums; }
.ghostbtn { grid-column: 1 / -1; display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; border-radius: 12px; border: 1px solid var(--accent); background: transparent; color: var(--accent); font-weight: 600; }
.plan-line { margin: 10px 20px 0; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.plan-line b { color: var(--ink); font-weight: 600; }

.progress { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 6px 12px; margin: 12px 20px 0; font-size: 13px; color: var(--muted); }
.progress[hidden] { display: none; }
.progress b { color: var(--ink); }
.progress .bar { grid-column: 1 / -1; height: 6px; border-radius: 3px; background: var(--chip); overflow: hidden; }
.progress .bar i { display: block; height: 100%; background: var(--open); border-radius: 3px; transition: width .3s; }
.progress button { border: 0; background: none; color: var(--accent); font-weight: 600; font-size: 13px; padding: 4px 0; }
/* timeline */
.timeline { list-style: none; margin: 14px 16px 0; padding: 0; background: var(--card); border: 1px solid var(--line); border-radius: 20px; overflow: hidden; }
.stop { position: relative; display: grid; grid-template-columns: 42px 1fr 42px 24px; align-items: center; padding: 10px 8px 10px 12px; border-top: 1px solid var(--line); }
.stop:first-child { border-top: 0; }
.stop::before { content: ""; position: absolute; left: 33px; top: 0; bottom: 0; width: 2px; background: var(--line); }
.stop:first-child::before { top: 50%; }
.stop:not(.off):has(+ .off)::before, .stop:not(.off):last-child::before { bottom: 50%; }
.stop.off::before { display: none; }
.stop:first-child:last-child::before { display: none; }
.stop.sel { background: var(--accent-soft); }
.num { position: relative; z-index: 1; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--navy); color: var(--navy-ink); font: 600 15px/1 var(--body); font-variant-numeric: tabular-nums; }
.stop.sel .num { background: var(--accent); color: #fff; }
.checkbox { width: 36px; height: 36px; border-radius: 50%; border: 2px solid color-mix(in srgb, var(--muted) 55%, transparent); background: var(--card); color: color-mix(in srgb, var(--muted) 45%, transparent); display: grid; place-items: center; padding: 0; justify-self: center; }
.checkbox:hover { color: var(--muted); border-color: var(--muted); }
.checkbox[aria-pressed="true"] { background: var(--open); border-color: var(--open); color: #fff; }
.stop.done .num { background: var(--open); color: #fff; }
.stop.done .th img { opacity: .75; }
.stop.done .nm { color: var(--muted); }
.stop.off .num { background: transparent; color: var(--muted); border: 2px dashed var(--line); }
.stop .card { display: grid; grid-template-columns: 64px 1fr; gap: 12px; align-items: center; border: 0; background: none; padding: 0; text-align: left; min-width: 0; }
.th { width: 64px; height: 64px; border-radius: 12px; }
.th.sm { width: 60px; height: 60px; }
.stop.off .th img { filter: grayscale(1); opacity: .7; }
.txt { display: grid; gap: 3px; min-width: 0; }
.nm { font: 19px/1.2 var(--display); }
.stop.off .nm { color: var(--muted); }
.ln .arr { margin-left: 0; }
.ln .ic { margin-right: -1px; }
.ln { display: flex; align-items: center; flex-wrap: wrap; gap: 5px; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.flag { font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--chip); color: var(--muted); justify-self: start; }
.flag.ok { display: inline-flex; align-items: center; gap: 4px; background: color-mix(in srgb, var(--open) 16%, transparent); color: var(--open); }
.flag.warn { background: var(--warn-bg); color: var(--warn); }
.flag.bad { background: var(--bad-bg); color: var(--bad); }
.grip { display: grid; place-items: center; height: 44px; width: 24px; color: var(--muted); cursor: grab; touch-action: none; opacity: .7; }
.grip:active { cursor: grabbing; }
.stop.off .grip { visibility: hidden; }
.editrow { display: none; grid-column: 2 / -1; gap: 8px; margin-top: 8px; }
.editing .editrow { display: flex; }
.editrow button { min-height: 36px; min-width: 44px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--sheet); font-weight: 600; font-size: 13px; display: grid; place-items: center; }
.editrow button:disabled { opacity: .35; cursor: default; }
.stop.sortable-ghost { opacity: .35; }
.stop.sortable-chosen { background: var(--card); box-shadow: var(--shadow); }

.routecta { margin: 16px 16px 0; }
.cta { display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 56px; border-radius: 999px; background: var(--navy); color: var(--navy-ink); text-decoration: none; font: 20px/1 var(--display); }
.alt { display: flex; justify-content: center; gap: 18px; margin-top: 10px; font-size: 14px; font-weight: 600; }
.alt a { text-decoration: none; padding: 4px 0; }

.explore { margin-top: 28px; }
.explore h3 { font: 26px/1.1 var(--display); padding: 0 20px; }
.hint { margin: 6px 20px 0; font-size: 13px; color: var(--muted); }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 12px 20px 4px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 8px 16px; font-size: 14px; font-weight: 500; white-space: nowrap; }
.chip[aria-pressed="true"] { background: var(--navy); color: var(--navy-ink); border-color: var(--navy); }
.cards { display: flex; gap: 12px; overflow-x: auto; padding: 10px 20px 6px; scroll-snap-type: x mandatory; scrollbar-width: thin; }
.xcard { flex: none; width: 200px; scroll-snap-align: start; background: var(--card); border: 1px solid var(--line); border-radius: 18px; overflow: hidden; display: grid; grid-template-rows: 1fr auto; }
.xopen { display: grid; gap: 4px; align-content: start; border: 0; background: none; padding: 0 0 8px; text-align: left; }
.xth { width: 100%; height: 124px; margin-bottom: 6px; }
.xname { font: 17px/1.2 var(--display); padding: 0 12px; }
.xmeta { display: flex; gap: 5px; align-items: flex-start; font-size: 12px; color: var(--muted); padding: 0 12px; line-height: 1.35; }
.xmeta .status { font-size: 12px; }
.addbtn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; margin: 0 12px 12px; min-height: 38px; border-radius: 999px; border: 1px solid var(--accent); background: transparent; color: var(--accent); font-weight: 600; font-size: 14px; }
.empty { padding: 8px 20px; color: var(--muted); font-size: 14px; list-style: none; }
.foot { margin: 24px 20px 0; font-size: 12px; color: var(--muted); }

/* list view */
.search { display: flex; align-items: center; gap: 8px; margin: 12px 16px 0; padding: 0 14px; border-radius: 14px; background: var(--card); border: 1px solid var(--line); color: var(--muted); }
.search input { flex: 1; min-width: 0; border: 0; background: none; min-height: 46px; font-size: 16px; color: var(--ink); outline: none; }
.search:focus-within { outline: 2px solid var(--accent); outline-offset: 1px; }
.sitelist { list-style: none; margin: 8px 16px 0; padding: 0; background: var(--card); border: 1px solid var(--line); border-radius: 20px; overflow: hidden; }
.site { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--line); }
.site:first-child { border-top: 0; }
.site .card { display: grid; grid-template-columns: 60px 1fr; gap: 12px; align-items: center; border: 0; background: none; padding: 0; text-align: left; min-width: 0; }
.site .nm { font-size: 17px; }
.round-add { margin: 0; width: 40px; height: 40px; min-height: 0; padding: 0; }
.stopno { width: 32px; height: 32px; margin-right: 4px; border-radius: 50%; display: grid; place-items: center; background: var(--navy); color: var(--navy-ink); font-weight: 600; font-size: 14px; }
.stopno.ok { background: var(--open); color: #fff; }
.stopno.off { background: var(--chip); color: var(--muted); }

/* ---------- detail ---------- */
.detail {
  --d-bg: #171513; --d-ink: #f4efe8; --d-muted: #b9b0a5; --d-line: #3a3530;
  position: absolute; z-index: 700; inset: 0; background: var(--d-bg); color: var(--d-ink);
  overflow-y: auto; overscroll-behavior: contain; visibility: hidden; opacity: 0; transform: translateX(24px);
  transition: transform .22s ease, opacity .22s ease, visibility 0s .22s; color-scheme: dark;
}
[data-view="stop"] .detail { visibility: visible; opacity: 1; transform: none; transition: transform .22s ease, opacity .22s ease; }
.detail a { color: #ffb08a; }
.hero { position: relative; min-height: 58vh; display: flex; flex-direction: column; justify-content: flex-end; }
.hero > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.shade { position: absolute; inset: 0; background: linear-gradient(to bottom, rgba(0,0,0,.35) 0%, rgba(0,0,0,0) 22%, rgba(0,0,0,0) 38%, rgba(23,21,19,.75) 68%, var(--d-bg) 100%); }
.topbtns { position: absolute; z-index: 2; left: 16px; right: 16px; top: calc(env(safe-area-inset-top, 0px) + 14px); display: grid; grid-template-columns: auto 1fr auto auto; gap: 12px; }
.round.glass { background: rgba(30, 28, 26, .55); color: #fff; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); box-shadow: none; }
#d-book[aria-pressed="true"] .ic { fill: #fff; }
#d-book:disabled { opacity: .4; cursor: default; }
.menu { position: absolute; right: 0; top: 56px; min-width: 230px; background: #26221f; border: 1px solid var(--d-line); border-radius: 14px; padding: 6px; display: grid; box-shadow: 0 12px 30px rgba(0,0,0,.5); }
.menu[hidden] { display: none; }
.menu a, .menu button { text-align: left; padding: 11px 12px; border-radius: 10px; color: var(--d-ink); text-decoration: none; background: none; border: 0; font-size: 15px; }
.menu a:hover, .menu button:hover { background: rgba(255,255,255,.07); }
.herotext { position: relative; z-index: 1; padding: 0 20px 8px; }
.eyebrow { font-size: 12px; font-weight: 600; letter-spacing: .2em; text-transform: uppercase; color: var(--d-muted); }
.visitbtn { display: inline-flex; align-items: center; gap: 8px; margin-top: 14px; min-height: 42px; padding: 0 18px; border-radius: 999px; border: 1px solid rgba(255,255,255,.35); background: rgba(255,255,255,.08); color: #fff; font-weight: 600; font-size: 15px; }
.visitbtn[aria-pressed="true"] { background: #2f9e44; border-color: #2f9e44; }
.herotext h2 { font: 36px/1.08 var(--display); margin: 8px 0 10px; text-wrap: balance; }
.hl { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; font-size: 16px; margin-top: 4px; }
.hl .status { font-size: 16px; }
.detail .status.open { color: #5fd47c; } .detail .status.open .dot { background: #5fd47c; }
.detail .status.closed { color: #ff8a80; } .detail .status.closed .dot { background: #ff8a80; }
.detail .status.soon { color: #f0b35a; } .detail .status.soon .dot { background: #f0b35a; }
.detail .arr { color: var(--d-ink); }
.tabs { display: flex; gap: 28px; margin: 18px 20px 0; border-bottom: 1px solid var(--d-line); }
.tabs button { border: 0; background: none; padding: 10px 0; font-size: 16px; color: var(--d-muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button[aria-selected="true"] { color: var(--d-ink); font-weight: 600; border-color: var(--d-ink); }
.dbody { padding: 18px 20px 110px; max-width: 680px; }
.dbody p { font: 18px/1.6 var(--serif); color: #e9e3db; margin-bottom: 14px; }
.dbody h3 { font: 22px/1.2 var(--display); margin: 22px 0 10px; }
.dbody .muted, .muted { color: var(--d-muted); }
.strip { display: flex; gap: 10px; overflow-x: auto; margin: 8px -20px 0; padding: 0 20px 4px; scrollbar-width: none; }
.strip .ph { width: 150px; height: 120px; border-radius: 12px; border: 0; padding: 0; background: #2a2622; }
.pgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.pgrid .ph { aspect-ratio: 1; border-radius: 12px; border: 0; padding: 0; background: #2a2622; }
.credit { font: 13px/1.4 var(--body) !important; color: var(--d-muted) !important; margin-top: 14px; }
.facts { margin: 0; display: grid; }
.facts div { display: grid; grid-template-columns: 120px 1fr; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--d-line); font-size: 15px; }
.facts dt { color: var(--d-muted); font-weight: 500; }
.facts dd { margin: 0; }
.dlinks { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.dlinks a, .dlinks button { padding: 10px 14px; border-radius: 999px; border: 1px solid var(--d-line); background: none; color: var(--d-ink); text-decoration: none; font-size: 14px; font-weight: 500; }
.dirbar { position: sticky; bottom: 0; padding: 12px 16px calc(env(safe-area-inset-bottom, 0px) + 14px); background: linear-gradient(to top, var(--d-bg) 60%, transparent); margin-top: -96px; }
.dir { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 60px; padding: 0 22px; border-radius: 999px; border: 0; background: #fbf8f3; color: #13202e !important; text-decoration: none; box-shadow: 0 6px 24px rgba(0,0,0,.4); }
.dir b { font: 20px/1 var(--display); font-weight: 400; }
.dir span { margin-left: auto; font-size: 15px; color: #5a5f66; font-variant-numeric: tabular-nums; }

/* lightbox */
.lightbox { position: fixed; inset: 0; z-index: 2000; background: rgba(8,8,8,.94); display: grid; place-items: center; padding: 60px 12px; }
.lightbox[hidden] { display: none; }
.lightbox img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 6px; }
.lightbox .round { position: absolute; background: rgba(255,255,255,.12); color: #fff; box-shadow: none; }
.lb-close { top: calc(env(safe-area-inset-top, 0px) + 12px); right: 12px; }
.lb-prev { left: 12px; top: 50%; transform: translateY(-50%); }
.lb-next { right: 12px; top: 50%; transform: translateY(-50%); }
.lb-cap { position: absolute; bottom: calc(env(safe-area-inset-bottom, 0px) + 18px); left: 0; right: 0; text-align: center; color: #ccc; font-size: 13px; }

/* ---------- desktop: panel on the left, map on the right ---------- */
@media (min-width: 900px) {
  .mobile-only { display: none !important; }
  #map { left: var(--panel-w); }
  .brand { left: var(--panel-w); right: auto; width: min(560px, calc(100% - var(--panel-w))); padding: 24px 28px 70px; background: linear-gradient(to bottom, color-mix(in srgb, var(--bg) 92%, transparent), transparent); }
  .brand h1 { font-size: 46px; } .brand h1 span { font-size: 64px; }
  .mapbtns { right: 20px; top: 24px; }
  .peek { left: calc(var(--panel-w) + 8px); right: auto; width: 420px; bottom: 24px; }
  [data-view="stop"] .peek { display: none; }
  .sheet, .detail { left: 0; right: auto; width: var(--panel-w); top: 0; border-radius: 0; box-shadow: 1px 0 0 var(--line); }
  .sheet { bottom: var(--tab-h); transform: none; }
  .detail { bottom: var(--tab-h); transform: none; }
  .tabbar { right: auto; width: var(--panel-w); border-right: 1px solid var(--line); }
  .hero { min-height: 380px; }
  .leaflet-control-zoom { display: block; }
  .leaflet-bar a { background: var(--glass); color: var(--ink); border-color: var(--line); }
}
@media (max-width: 380px) {
  .brand h1 { font-size: 34px; } .brand h1 span { font-size: 50px; }
  .peek .card { grid-template-columns: 76px 1fr; gap: 10px; }
  .peek .pth { width: 76px; height: 76px; }
  .th { width: 56px; height: 56px; }
  .stop .card { grid-template-columns: 56px 1fr; gap: 10px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---------- history ---------- */
.trackcard { margin: 14px 16px 0; padding: 4px 14px; border-radius: 18px; background: var(--card); border: 1px solid var(--line); }
.trow { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.trow b { display: block; font-size: 16px; }
.tstat { display: block; font-size: 13px; color: var(--muted); margin-top: 2px; }
.tnote { font-size: 12px; color: var(--muted); padding: 10px 0 12px; }
.switch { width: 52px; height: 32px; border-radius: 16px; border: 0; padding: 3px; background: var(--line); position: relative; flex: none; transition: background .2s; }
.switch i { display: block; width: 26px; height: 26px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: transform .2s; }
.switch[aria-checked="true"] { background: var(--open); }
.switch[aria-checked="true"] i { transform: translateX(20px); }
.hlist { margin: 6px 16px 0; }
.hday { font: 22px/1.2 var(--display); margin: 18px 4px 8px; }
.hgap { display: flex; align-items: center; gap: 6px; margin: 0 0 0 30px; padding: 6px 0 6px 14px; border-left: 2px dashed var(--line); font-size: 13px; color: var(--muted); }
.hitem { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; align-items: center; padding: 12px; border-radius: 18px; background: var(--card); border: 1px solid var(--line); }
.hitem.open { border-color: var(--open); }
.hitem .card { display: grid; grid-template-columns: 60px 1fr; gap: 12px; align-items: center; border: 0; background: none; padding: 0; text-align: left; min-width: 0; color: inherit; }
.hitem .nm { font-size: 18px; }
.htimes { color: var(--ink); font-weight: 600; font-size: 15px; }
.here { color: var(--open); font-weight: 700; margin-right: 6px; }
.hdur { font: 20px/1 var(--display); white-space: nowrap; }
.hacts { grid-column: 1 / -1; display: flex; gap: 8px; justify-content: flex-end; }
.hacts button, .hedit .del { min-height: 34px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--sheet); font-size: 13px; font-weight: 600; }
.hacts button[data-leave] { border-color: var(--accent); color: var(--accent); }
.hedit { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 6px; }
.hedit label { display: grid; gap: 4px; font-size: 12px; font-weight: 600; color: var(--muted); }
.hedit input { min-height: 42px; border: 1px solid var(--line); border-radius: 10px; background: var(--sheet); padding: 6px 10px; font-size: 16px; color: var(--ink); }
.hedit .del { grid-column: 1 / -1; color: var(--bad); border-color: var(--bad-bg); }
.toast { position: absolute; z-index: 1500; left: 50%; top: calc(env(safe-area-inset-top, 0px) + 12px); transform: translate(-50%, -140%); max-width: calc(100% - 32px); padding: 12px 18px; border-radius: 999px; background: var(--navy); color: var(--navy-ink); font-weight: 600; font-size: 14px; box-shadow: var(--shadow); transition: transform .25s ease; pointer-events: none; }
.toast.show { transform: translate(-50%, 0); }
.toast.long { border-radius: 18px; width: max-content; max-width: min(460px, calc(100% - 32px)); line-height: 1.4; }
@media (min-width: 900px) { .toast { left: calc(var(--panel-w) + (100% - var(--panel-w)) / 2); } }
.tabbar a { font-size: 11px; }

/* entrances */
.ln.door { color: var(--ink); font-weight: 500; flex-wrap: nowrap; align-items: flex-start; line-height: 1.35; }
.ln.door .ic { flex: none; margin-top: 2px; }
.ln.door .ic, .hl.door .ic { color: var(--accent); }
.peek .ln.door { font-weight: 500; font-size: 12px; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.peek .ln.door .ic { vertical-align: -2px; margin-right: 4px; }

/* the Hop */
.hopbtn { position: relative; }
.hopbtn.live::after { content: ""; position: absolute; right: 9px; top: 9px; width: 9px; height: 9px; border-radius: 50%; background: var(--open); border: 2px solid var(--card); }
.hopbtn[aria-pressed="false"]::after { display: none; }
.car { position: relative; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--c, #6d27b8); color: #fff; border: 2px solid #fff; box-shadow: 0 2px 6px rgba(0,0,0,.35); }
.car .ic { width: 14px; height: 14px; }
.car i { position: absolute; inset: -9px; pointer-events: none; }
.car i::before { content: ""; position: absolute; left: 50%; top: 0; transform: translateX(-50%); border: 5px solid transparent; border-bottom: 7px solid var(--c, #6d27b8); border-top: 0; }
.hopchip { display: inline-flex; align-items: center; gap: 4px; margin-left: 2px; padding: 1px 8px; border-radius: 999px; background: color-mix(in srgb, var(--hop) 14%, transparent); color: var(--hop); font-weight: 600; font-size: 12px; cursor: pointer; }
.peek .hopln { display: block; font-size: 12px; font-weight: 500; line-height: 1.3; margin-top: 3px; }
.peek .hopln .ic { vertical-align: -2px; margin-right: 4px; }
.peek .hopln.good { color: var(--hop); font-weight: 600; }
.leaflet-popup-content { font: 13px/1.4 var(--body); }

/* breaks */
.ph.brk { display: grid; place-items: center; color: var(--accent); background: var(--accent-soft); }
.ph.brk .ic { width: 45%; height: 45%; }
.pin.brk .pimg { display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.pin.brk .pimg .ic { width: 24px; height: 24px; }
.app.picking #map { cursor: crosshair; }
dialog.brk { width: min(440px, calc(100% - 24px)); max-height: calc(100% - 24px); padding: 0; border: 0; border-radius: 22px; background: var(--sheet); color: var(--ink); box-shadow: var(--shadow); }
dialog.brk::backdrop { background: rgba(10, 14, 20, .45); }
.brkin { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; padding: 18px 16px 16px; }
.brkin > *, .brkrow > *, .brksearch > * { min-width: 0; }
.brkin h3 { margin: 0; font: 26px/1.1 var(--display); }
.brkin .hint { margin: 0; }
.brkin .chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 0; margin: 0; overflow: visible; }
.brkin .chip { display: inline-flex; align-items: center; gap: 6px; }
.brksearch { display: flex; gap: 8px; align-items: center; }
.brksearch .search { flex: 1; margin: 0; }
.brkres { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; max-height: 190px; overflow-y: auto; }
.brkres:empty { display: none; }
.brkres li { display: grid; padding: 8px 12px; border-radius: 12px; background: var(--card); border: 1px solid var(--line); cursor: pointer; font-size: 14px; }
.brkres li span { font-size: 12px; color: var(--muted); }
.brkres li.muted { cursor: default; color: var(--muted); }
.brkwhere { margin: 0; font-size: 14px; color: var(--muted); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.brkwhere b { color: var(--ink); }
.brkrow { display: grid; grid-template-columns: 1fr 110px; gap: 10px; }
.brkin select { width: 100%; min-width: 0; max-width: 100%; min-height: 42px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); padding: 6px 10px; font-size: 16px; color: var(--ink); }
.brkacts { display: grid; grid-template-columns: 1fr 1.4fr; gap: 10px; }
.brkacts .cta { min-height: 48px; font-size: 18px; border: 0; }
.brkacts .cta:disabled { opacity: .4; }
.brkacts .ghostbtn { grid-column: auto; }
