/* Braess's Paradox simulator: laid out the way the big web map apps are (a floating search box, a side panel
   with place cards and tabs, round action buttons, map controls in the corners), in our own colours and art. */
:root {
  --primary: #0b57d0; --blue: #1a73e8; --text: #1f1f1f; --text-2: #444746; --text-3: #70757a; --line: #dadce0; --line-2: #e8eaed;
  --hover: #f1f3f4; --green: #188038; --red: #d93025; --purple: #8430ce; --purple-soft: #f3e8fd;
  --t-fast: #4cb860; --t-med: #ffa040; --t-slow: #ec3a2c; --t-jam: #8a1d18;
  --shadow: 0 1px 2px rgba(60, 64, 67, .3), 0 2px 6px 2px rgba(60, 64, 67, .15);
  --shadow-sm: 0 1px 4px -1px rgba(0, 0, 0, .3);
  --font: Roboto, 'Segoe UI', Arial, sans-serif; --head: 'Google Sans', Roboto, 'Segoe UI', Arial, sans-serif;
  --panel: 408px;
  --map-bg: #e5e3df; --surface: #fff; --float: #fff; --surface-2: #f8f9fa; --ib-hover: rgba(68, 71, 70, .08);
  --on-primary: #fff; --primary-hover: #0a4fbd; --sel-bg: #e8f0fe; --sel-line: #d2e3fc; --sel-text: #0842a0; --act-hover: #eef3fc; --purple-ink: #5b2192; --pin: #8430ce;
  --icon: #5f6368; --icon-2: #80868b; --placeholder: #5e5e5e; --chip-text: #3c4043;
  --ctl: #666; --ctl-hover: #333; --ctl-bg-hover: #f8f8f8; --zsep: #e6e6e6; --ring: #fff;
  --thumb-bg: #d6d6d0; --hero-bg: #c9c9c3; --layers-bg: #c6c6c0;
  --bar: #b7d2fb; --bar-hover: #8ab4f8; --bar-empty: #eceff1; --track: #e8f0fe; --lv-bg: #fce8e6;
  --switch-off: #bdc1c6; --knob: #fff; --switch-on: #8ab4f8;
  --tip-bg: #303030; --tip-text: #f2f2f2; --toast-bg: #303134; --toast-text: #f1f3f4;
  --foot-bg: rgba(255, 255, 255, .78); --foot-text: #444; --scale-line: #3c4043; --scrim: rgba(0, 0, 0, .4); --grabber: #c4c7c5;
  --panel-shadow: 0 0 20px rgba(0, 0, 0, .3); --chip-shadow: 0 1px 2px rgba(60, 64, 67, .3), 0 1px 3px 1px rgba(60, 64, 67, .15);
  --search-shadow: 0 2px 4px rgba(0, 0, 0, .2), 0 -1px 0 rgba(0, 0, 0, .02);
}
/* dark: the surfaces and text of the map apps' own dark theme (index.html sets data-theme before the first paint) */
:root[data-theme="dark"] {
  color-scheme: dark;
  --primary: #8ab4f8; --blue: #8ab4f8; --text: #e8eaed; --text-2: #bdc1c6; --text-3: #9aa0a6; --line: #5f6368; --line-2: #3c4043;
  --hover: #3a3b3e; --green: #81c995; --red: #f28b82; --purple: #c58af9; --purple-soft: #3b2d4f;
  --t-jam: #b3261e;
  --shadow: 0 1px 3px rgba(0, 0, 0, .6), 0 4px 8px 3px rgba(0, 0, 0, .3);
  --shadow-sm: 0 1px 4px rgba(0, 0, 0, .6);
  --map-bg: #1b1f24; --surface: #202124; --float: #303134; --surface-2: #28292c; --ib-hover: rgba(232, 234, 237, .1);
  --on-primary: #202124; --primary-hover: #aecbfa; --sel-bg: #394457; --sel-line: #4a5a75; --sel-text: #d2e3fc; --act-hover: #2d3a50; --purple-ink: #ecd8fd;
  --icon: #9aa0a6; --icon-2: #9aa0a6; --placeholder: #9aa0a6; --chip-text: #e8eaed;
  --ctl: #bdc1c6; --ctl-hover: #e8eaed; --ctl-bg-hover: #3c4043; --zsep: #5f6368; --ring: #5f6368;
  --thumb-bg: #3c4043; --hero-bg: #2a2b2e; --layers-bg: #2a2b2e;
  --bar: #3d5a86; --bar-hover: #5b7fb5; --bar-empty: #303134; --track: #394457; --lv-bg: #5c2b29;
  --switch-off: #5f6368; --knob: #dadce0; --switch-on: #41618f;
  --tip-bg: #e8eaed; --tip-text: #202124; --toast-bg: #e8eaed; --toast-text: #202124;
  --foot-bg: rgba(32, 33, 36, .78); --foot-text: #bdc1c6; --scale-line: #bdc1c6; --scrim: rgba(0, 0, 0, .6); --grabber: #5f6368;
  --panel-shadow: 0 0 20px rgba(0, 0, 0, .6); --chip-shadow: 0 1px 3px rgba(0, 0, 0, .55);
  --search-shadow: 0 2px 4px rgba(0, 0, 0, .5);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--map-bg); }
body { font: 400 14px/20px var(--font); color: var(--text); -webkit-font-smoothing: antialiased; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; margin: 0; cursor: pointer; -webkit-tap-highlight-color: transparent; }
button:disabled { cursor: default; }
input { font: inherit; color: inherit; }
svg { display: block; flex: none; }
[hidden] { display: none !important; }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

#map { position: fixed; inset: 0; }
#map .maplibregl-canvas { outline: none; }
.maplibregl-ctrl-attrib, .maplibregl-ctrl-logo { display: none !important; }

/* ---------------------------------------------------------------- side panel */
.panel {
  position: fixed; z-index: 5; top: 0; left: 0; bottom: 0; width: var(--panel); background: var(--surface);
  box-shadow: var(--panel-shadow); transition: transform .25s cubic-bezier(.2, 0, 0, 1); display: flex; flex-direction: column;
}
.panel.closed { transform: translateX(-100%); box-shadow: none; }
.panel-scroll { flex: 1; overflow-y: auto; overflow-x: hidden; padding-top: 72px; scrollbar-width: thin; }
.panel-scroll.flush { padding-top: 0; }
.collapse {
  position: absolute; top: 50%; left: 100%; width: 23px; height: 48px; margin-top: -24px; border-radius: 0 8px 8px 0; background: var(--surface);
  box-shadow: 1px 1px 4px rgba(0, 0, 0, .25); display: grid; place-items: center; color: var(--text-2);
}
.collapse svg { width: 20px; height: 20px; fill: currentColor; transition: transform .2s; }
.panel.closed .collapse svg { transform: rotate(180deg); }
.collapse:hover { color: var(--text); }
.panel-bar { position: absolute; left: 0; right: 0; top: 0; height: 4px; overflow: hidden; opacity: 0; transition: opacity .2s; z-index: 3; }
.busy .panel-bar { opacity: 1; }
.panel-bar::before { content: ''; position: absolute; top: 0; bottom: 0; width: 30%; background: var(--blue); animation: bar 1.2s cubic-bezier(.4, 0, .2, 1) infinite; }
@keyframes bar { from { left: -30%; } to { left: 100%; } }

/* ---------------------------------------------------------------- search box */
.top { position: fixed; z-index: 6; top: 12px; left: 16px; right: 16px; display: flex; align-items: flex-start; gap: 12px; pointer-events: none; }
.search {
  pointer-events: auto; position: relative; flex: 0 0 376px; width: 376px; background: var(--float); border-radius: 24px;
  box-shadow: var(--search-shadow); transition: border-radius .12s;
}
.panel-open .search { box-shadow: none; border: 1px solid var(--line); }
.search.open { border-radius: 24px 24px 16px 16px; box-shadow: var(--search-shadow), 0 6px 18px rgba(0, 0, 0, .12); border-color: transparent; }
.search-row { display: flex; align-items: center; height: 48px; padding: 0 4px 0 4px; }
.ib { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%; color: var(--text-2); flex: none; }
.ib svg { width: 24px; height: 24px; fill: currentColor; }
.ib:hover { background: var(--ib-hover); }
.search input { flex: 1; min-width: 0; height: 40px; border: 0; background: none; padding: 0 4px 0 6px; font-size: 15px; }
.search input::placeholder { color: var(--placeholder); }
.search input:focus-visible { outline: none; }
.search .sep { width: 1px; height: 24px; background: var(--line); margin: 0 4px; }
.search .go-run { color: var(--blue); }
.sugg { display: none; border-top: 1px solid var(--line-2); padding: 8px 0 10px; max-height: min(60vh, 420px); overflow-y: auto; }
.search.open .sugg { display: block; }
.sugg-row { display: flex; align-items: center; gap: 4px; min-height: 48px; padding: 4px 16px 4px 12px; cursor: pointer; }
.sugg-row:hover, .sugg-row.sel { background: var(--hover); }
.sugg-ic { width: 36px; display: grid; place-items: center; flex: none; }
.sugg-ic svg { width: 20px; height: 20px; fill: var(--icon-2); }
.sugg-ic.hot svg { fill: var(--purple); }
.sugg-txt { min-width: 0; display: flex; flex-direction: column; line-height: 20px; }
.sugg-main { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sugg-main b { font-weight: 500; }
.sugg-sub { font-size: 13px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sugg-empty { padding: 10px 20px; color: var(--text-3); }

.chips { pointer-events: auto; display: flex; gap: 8px; padding: 8px 2px 6px; overflow-x: auto; scrollbar-width: none; min-width: 0; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 14px 0 10px; border-radius: 16px; background: var(--float);
  color: var(--chip-text); font: 500 14px/32px var(--head); white-space: nowrap; box-shadow: var(--chip-shadow);
}
.chip:hover { background: var(--surface-2); }
.chip svg { width: 18px; height: 18px; fill: var(--icon); }
.chip.on { background: var(--sel-bg); color: var(--primary); box-shadow: 0 0 0 1px var(--sel-line) inset; }
.chip.on svg { fill: var(--primary); }
.chip.hot svg { fill: var(--purple); }

/* ---------------------------------------------------------------- home: popular places */
.home-head { padding: 8px 24px 12px; border-bottom: 1px solid var(--line-2); }
.home-head h1 { margin: 0; font: 400 22px/28px var(--head); }
.home-head p { margin: 6px 0 0; color: var(--text-3); font-size: 13px; line-height: 18px; }
.sortrow { display: flex; gap: 8px; margin-top: 12px; }
.pill { height: 32px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--line); font: 500 13px/30px var(--head); color: var(--text-2); display: inline-flex; align-items: center; gap: 4px; }
.pill:hover { background: var(--hover); }
.pill.on { background: var(--sel-bg); border-color: var(--sel-bg); color: var(--sel-text); }
.res { display: flex; gap: 12px; padding: 16px 24px; border-bottom: 1px solid var(--line-2); cursor: pointer; position: relative; }
.res:hover { background: var(--surface-2); }
.res-body { flex: 1; min-width: 0; }
.res-title { font: 500 16px/22px var(--head); color: var(--text); }
.res-title .rk { color: var(--text-3); font-weight: 400; margin-right: 2px; }
.res-line { color: var(--text-3); font-size: 14px; line-height: 20px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.res-status { font-size: 14px; line-height: 20px; color: var(--purple); font-weight: 500; }
.res-status span { color: var(--text-3); font-weight: 400; }
.res-quote { margin-top: 6px; font-size: 13px; line-height: 18px; color: var(--text-2); display: flex; gap: 6px; }
.res-quote svg { width: 16px; height: 16px; fill: var(--icon-2); margin-top: 1px; }
.res-thumb { width: 84px; height: 84px; border-radius: 8px; overflow: hidden; flex: none; position: relative; background: var(--thumb-bg); }
.tiles { position: absolute; left: 50%; top: 50%; }
.tiles img { position: absolute; width: 256px; height: 256px; max-width: none; display: block; user-select: none; -webkit-user-drag: none; }
.res-thumb .dot { position: absolute; left: 50%; top: 50%; width: 10px; height: 10px; margin: -5px 0 0 -5px; border-radius: 50%; background: var(--pin); border: 2px solid #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .5); }
.home-foot { padding: 16px 24px 28px; color: var(--text-3); font-size: 12px; line-height: 17px; }

/* ---------------------------------------------------------------- place card */
.hero { position: relative; height: 240px; background: var(--hero-bg); overflow: hidden; }
.hero .tiles img { width: 256px; height: 256px; }
.hero::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0, 0, 0, .25), transparent 35%); pointer-events: none; }
.hero-pin { position: absolute; left: 50%; top: 50%; width: 27px; height: 43px; margin: -43px 0 0 -13.5px; filter: drop-shadow(0 2px 2px rgba(0, 0, 0, .4)); z-index: 1; }
.hero-ring { position: absolute; left: 50%; top: 50%; border-radius: 50%; border: 2px dashed rgba(255, 255, 255, .85); box-shadow: 0 0 0 1px rgba(0, 0, 0, .15); transform: translate(-50%, -50%); }
.hero-back { position: absolute; z-index: 2; top: 12px; left: 12px; background: var(--float); box-shadow: var(--shadow-sm); }
.ptitle { padding: 20px 24px 0; }
.ptitle h1 { margin: 0; font: 400 22px/28px var(--head); }
.ptitle .kind { margin-top: 4px; color: var(--text-3); font-size: 14px; }
.ptitle .status { margin-top: 4px; font-size: 14px; color: var(--text-2); }
.status .ok { color: var(--purple); font-weight: 500; }
.status .no { color: var(--green); font-weight: 500; }
.status .wait { color: var(--text-3); }
.actions { display: flex; justify-content: space-around; padding: 16px 12px 16px; border-bottom: 1px solid var(--line-2); }
.act { display: flex; flex-direction: column; align-items: center; gap: 6px; width: 64px; font: 500 12px/16px var(--head); color: var(--primary); text-align: center; }
.act > span { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; border: 1px solid var(--line); background: var(--surface); transition: background .15s; }
.act > span svg { width: 20px; height: 20px; fill: var(--primary); }
.act:hover:not(:disabled) > span { background: var(--act-hover); }
.act.primary > span { background: var(--primary); border-color: var(--primary); }
.act.primary > span svg { fill: var(--on-primary); }
.act.primary:hover:not(:disabled) > span { background: var(--primary-hover); border-color: var(--primary-hover); }
.act:disabled { opacity: .45; }
.tabs { display: flex; border-bottom: 1px solid var(--line-2); padding: 0 12px; position: sticky; top: 0; background: var(--surface); z-index: 2; }
.tab { flex: 1; height: 48px; font: 500 14px/48px var(--head); color: var(--text-2); position: relative; }
.tab:hover { background: var(--surface-2); }
.tab[aria-selected="true"] { color: var(--primary); }
.tab[aria-selected="true"]::after { content: ''; position: absolute; left: 12px; right: 12px; bottom: 0; height: 3px; border-radius: 3px 3px 0 0; background: var(--primary); }
.tab .n { font-weight: 400; color: var(--text-3); margin-left: 2px; }

.rows { padding: 8px 0; border-bottom: 1px solid var(--line-2); }
.row { display: flex; gap: 20px; padding: 10px 24px; align-items: flex-start; }
.row > svg { width: 24px; height: 24px; fill: var(--primary); margin-top: -2px; }
.row-body { flex: 1; min-width: 0; }
.row-main { font-size: 14px; line-height: 20px; color: var(--text); }
.row-sub { font-size: 13px; color: var(--text-3); line-height: 18px; margin-top: 2px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; margin-top: 8px; }
.seg button { padding: 0 14px; height: 30px; font: 500 13px/30px var(--head); color: var(--text-2); }
.seg button + button { border-left: 1px solid var(--line); }
.seg button[aria-pressed="true"] { background: var(--sel-bg); color: var(--sel-text); }
.slider { width: 100%; margin: 10px 0 0; accent-color: var(--blue); height: 20px; }
.row .link { font-size: 13px; font-weight: 500; font-family: var(--head); color: var(--primary); margin-left: 8px; }

.section { padding: 16px 24px; border-bottom: 1px solid var(--line-2); }
.section h2 { margin: 0 0 4px; font: 500 16px/24px var(--head); color: var(--text); display: flex; align-items: center; justify-content: space-between; }
.section h2 select { font: 400 13px var(--font); color: var(--text-2); border: 0; background: none; cursor: pointer; }
.section .hint { color: var(--text-3); font-size: 13px; line-height: 18px; }

/* hourly bars, after the busy-hours charts of map apps */
.times { margin-top: 10px; }
.times-live { font-size: 13px; color: var(--text-2); min-height: 20px; }
.times-live b { font-weight: 500; }
.times-live .lv { display: inline-block; margin-right: 6px; padding: 0 6px; border-radius: 4px; background: var(--lv-bg); color: var(--red); font: 500 11px/18px var(--head); letter-spacing: .3px; }
.bars { display: flex; align-items: flex-end; gap: 3px; height: 92px; margin-top: 10px; border-bottom: 1px solid var(--line); position: relative; }
.bar { flex: 1; min-width: 0; background: var(--bar); border-radius: 3px 3px 0 0; position: relative; cursor: pointer; transition: background .15s; }
.bar:hover { background: var(--bar-hover); }
.bar.sel { background: var(--blue); }
.bar.now::before { content: ''; position: absolute; inset: 0; border-radius: 3px 3px 0 0; box-shadow: 0 0 0 2px var(--red) inset; }
.bar .px { position: absolute; left: 50%; bottom: calc(100% + 3px); width: 7px; height: 7px; margin-left: -3.5px; border-radius: 50%; background: var(--purple); }
.bar.empty { background: var(--bar-empty); }
.bar-lbl { position: relative; height: 16px; font-size: 11px; color: var(--text-3); margin-top: 4px; }
.bar-lbl span { position: absolute; transform: translateX(-50%); }
.times-key { display: flex; gap: 14px; margin-top: 10px; font-size: 12px; color: var(--text-3); }
.times-key i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; vertical-align: -1px; margin-right: 5px; background: var(--bar); }
.times-key i.px { border-radius: 50%; background: var(--purple); width: 8px; height: 8px; }

.kv { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; font-size: 14px; line-height: 20px; }
.kv span { color: var(--text-2); }
.kv b { font-weight: 500; text-align: right; }
.good { color: var(--green); }

.prog { padding: 16px 24px; border-bottom: 1px solid var(--line-2); }
.prog-t { font-size: 14px; color: var(--text-2); }
.prog-track { height: 4px; border-radius: 2px; background: var(--track); margin-top: 10px; overflow: hidden; }
.prog-fill { height: 100%; width: 0; background: var(--blue); transition: width .25s; }
.prog-sub { margin-top: 6px; font-size: 12px; color: var(--text-3); }
.err { color: var(--red); }

.broad { display: flex; gap: 14px; padding: 14px 24px; border-bottom: 1px solid var(--line-2); cursor: pointer; }
.broad:hover { background: var(--surface-2); }
.broad.sel { background: var(--purple-soft); }
.bpin { width: 26px; height: 26px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); background: var(--pin); display: grid; place-items: center; flex: none; margin-top: 2px; box-shadow: 0 1px 2px rgba(0, 0, 0, .3); }
.bpin b { transform: rotate(45deg); color: #fff; font: 500 12px/1 var(--head); }
.broad-name { font: 500 15px/20px var(--head); }
.broad-line { font-size: 13px; line-height: 18px; color: var(--text-2); margin-top: 2px; }
.broad-line .good { font-weight: 500; }
.note { margin: 16px 24px; padding: 12px 14px; border-radius: 8px; background: var(--surface-2); color: var(--text-2); font-size: 13px; line-height: 19px; }
.about { padding: 16px 24px 28px; color: var(--text-2); font-size: 14px; line-height: 21px; }
.about h3 { font: 500 15px/22px var(--head); color: var(--text); margin: 18px 0 4px; }
.about h3:first-child { margin-top: 0; }
.about p { margin: 0 0 8px; }
.about ul { margin: 0 0 8px; padding-left: 20px; }

/* ---------------------------------------------------------------- map controls */
.rail { position: fixed; z-index: 4; right: 16px; bottom: 28px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.btn { width: 40px; height: 40px; border-radius: 8px; background: var(--float); box-shadow: var(--shadow-sm); display: grid; place-items: center; color: var(--ctl); position: relative; }
.btn:hover { color: var(--ctl-hover); background: var(--ctl-bg-hover); }
.btn svg { width: 24px; height: 24px; fill: currentColor; }
.btn.has { color: var(--blue); }
.zoom { width: 40px; border-radius: 8px; background: var(--float); box-shadow: var(--shadow-sm); overflow: hidden; }
.zbtn { width: 40px; height: 40px; display: grid; place-items: center; color: var(--ctl); }
.zbtn:hover { color: var(--ctl-hover); background: var(--ctl-bg-hover); }
.zbtn svg { width: 24px; height: 24px; fill: currentColor; }
.zsep { height: 1px; width: 28px; margin: 0 auto; background: var(--zsep); }
@media (hover: hover) {
  .rail [data-tip]:hover::after {
    content: attr(data-tip); position: absolute; right: calc(100% + 10px); top: 50%; transform: translateY(-50%); padding: 5px 8px; border-radius: 4px;
    background: var(--tip-bg); color: var(--tip-text); font: 400 12px/16px var(--font); white-space: nowrap; pointer-events: none; animation: fade .12s .25s both;
  }
}
.layers { position: fixed; z-index: 4; left: 16px; bottom: 28px; width: 72px; height: 72px; border-radius: 8px; overflow: hidden; background: var(--layers-bg);
  box-shadow: 0 1px 4px rgba(0, 0, 0, .3), 0 0 0 2px var(--ring); transition: left .25s cubic-bezier(.2, 0, 0, 1); }
.panel-open .layers { left: calc(var(--panel) + 16px); }
.layers:hover { box-shadow: 0 2px 8px rgba(0, 0, 0, .4), 0 0 0 2px var(--ring); }
.layers .tiles img { width: 256px; height: 256px; }
.layers-lbl { position: absolute; left: 0; right: 0; bottom: 0; height: 26px; display: flex; align-items: center; justify-content: center; gap: 3px; padding-top: 8px;
  background: linear-gradient(transparent, rgba(0, 0, 0, .6)); color: #fff; font: 500 12px/14px var(--head); }
.layers-lbl svg { width: 15px; height: 15px; fill: #fff; }
.lmenu { position: fixed; z-index: 7; left: 100px; bottom: 28px; width: 316px; background: var(--surface); border-radius: 12px; box-shadow: var(--shadow); padding: 14px 16px 12px; animation: rise .15s ease-out; }
.panel-open .lmenu { left: calc(var(--panel) + 100px); }
.lmenu h3 { margin: 0 0 10px; font: 500 14px/20px var(--head); color: var(--text); }
.ltypes { display: flex; gap: 12px; margin-bottom: 12px; }
.ltype { display: flex; flex-direction: column; align-items: center; gap: 6px; font: 400 12px/16px var(--font); color: var(--text-2); }
.ltype .sw { width: 56px; height: 56px; border-radius: 8px; overflow: hidden; position: relative; border: 2px solid transparent; box-shadow: 0 0 0 1px var(--line); }
.ltype.on .sw { border-color: var(--blue); box-shadow: none; }
.ltype.on { color: var(--blue); font-weight: 500; }
.ltype .tiles img { width: 256px; height: 256px; }
.lopt { display: flex; align-items: center; justify-content: space-between; height: 40px; width: 100%; font-size: 14px; color: var(--text); border-top: 1px solid var(--line-2); text-align: left; }
.switch { width: 32px; height: 14px; border-radius: 7px; background: var(--switch-off); position: relative; flex: none; transition: background .15s; }
.switch::after { content: ''; position: absolute; top: -3px; left: -2px; width: 20px; height: 20px; border-radius: 50%; background: var(--knob); box-shadow: 0 1px 3px rgba(0, 0, 0, .4); transition: transform .15s, background .15s; }
.on > .switch { background: var(--switch-on); }
.on > .switch::after { transform: translateX(16px); background: var(--blue); }

.legend { position: fixed; z-index: 3; bottom: 26px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 12px; height: 32px; padding: 0 14px;
  background: var(--float); border-radius: 16px; box-shadow: var(--shadow-sm); font: 500 12px/32px var(--head); color: var(--text-2); white-space: nowrap; transition: left .25s cubic-bezier(.2, 0, 0, 1); }
.panel-open .legend { left: calc(50% + var(--panel) / 2); }
.legend .scale { display: flex; gap: 2px; }
.legend .scale i { width: 14px; height: 5px; border-radius: 2px; }
.legend .br { width: 26px; height: 0; border-top: 3px dashed var(--purple); }
.legend .dim { color: var(--text-3); font-weight: 400; }

.foot { position: fixed; z-index: 3; right: 0; bottom: 0; height: 16px; max-width: 100%; display: flex; align-items: center; gap: 10px; padding: 0 8px;
  background: var(--foot-bg); color: var(--foot-text); font: 400 10px/16px var(--font); white-space: nowrap; border-top-left-radius: 4px; overflow: hidden; }
.foot a { color: var(--foot-text); }
.foot .scalebar { display: flex; align-items: center; gap: 5px; flex: none; }
.foot .scalebar i { height: 5px; border: 1.5px solid var(--scale-line); border-top: 0; margin-top: -3px; display: block; }

/* ---------------------------------------------------------------- the card for a road */
.card { position: fixed; z-index: 5; left: 50%; bottom: 72px; transform: translateX(-50%); width: 400px; max-width: calc(100% - 32px); background: var(--surface); border-radius: 12px; box-shadow: var(--shadow);
  padding: 14px 44px 14px 18px; animation: rise-c .16s ease-out; }
.panel-open .card { left: calc(50% + var(--panel) / 2); }
.card-x { position: absolute; top: 4px; right: 4px; }
.card-x svg { width: 20px; height: 20px; }
.card-t { font: 500 16px/22px var(--head); }
.card-s { color: var(--text-3); font-size: 13px; line-height: 18px; }
.card-l { margin-top: 6px; font-size: 13px; line-height: 19px; color: var(--text-2); }
.card-l b { font-weight: 500; color: var(--text); }
.card-b { margin-top: 8px; padding: 8px 10px; border-radius: 8px; background: var(--purple-soft); color: var(--purple-ink); font-size: 13px; line-height: 19px; }
.card-b b { font-weight: 500; }
.tchip { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 4px; vertical-align: -1px; }

/* ---------------------------------------------------------------- right-click menu */
.ctx { position: fixed; z-index: 8; min-width: 200px; padding: 6px 0; background: var(--surface); border-radius: 8px; box-shadow: 0 2px 6px 2px rgba(60, 64, 67, .15), 0 1px 2px rgba(60, 64, 67, .3); animation: fade .1s; }
.ctx-i { display: block; width: 100%; text-align: left; padding: 0 16px; height: 36px; font: 400 14px/36px var(--font); color: var(--text); white-space: nowrap; }
.ctx-i:hover { background: var(--hover); }
.ctx-c { font-weight: 500; }
.ctx-s { color: var(--primary); font-weight: 500; }

/* ---------------------------------------------------------------- drawer, toast, pins */
.scrim { position: fixed; inset: 0; z-index: 9; background: var(--scrim); opacity: 0; transition: opacity .2s; }
.scrim.on { opacity: 1; }
.drawer { position: fixed; z-index: 10; top: 0; left: 0; bottom: 0; width: 320px; max-width: 86vw; background: var(--surface); box-shadow: 0 0 16px rgba(0, 0, 0, .28);
  transform: translateX(-104%); transition: transform .2s cubic-bezier(.2, 0, 0, 1); overflow-y: auto; padding-bottom: 16px; }
.drawer.on { transform: none; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; height: 64px; padding: 0 8px 0 24px; }
.brand { font: 400 20px/26px var(--head); color: var(--text-2); }
.brand b { font-weight: 500; color: var(--purple); }
.dr-item { display: flex; align-items: center; gap: 20px; width: 100%; height: 48px; padding: 0 24px; text-align: left; font-size: 14px; color: var(--text); }
.dr-item:hover { background: var(--hover); }
.dr-item > svg { width: 24px; height: 24px; fill: var(--icon); }
.dr-item > span { flex: 1; }
.dr-sep { height: 1px; background: var(--line-2); margin: 8px 0; }
.dr-note { padding: 8px 24px; color: var(--text-3); font-size: 12px; line-height: 17px; }
.dr-static { cursor: default; }
.dr-static:hover { background: none; }
.dr-theme { padding: 0 24px 10px 68px; }
.dr-theme .seg { display: flex; margin-top: 0; }
.dr-theme .seg button { flex: 1; padding: 0 6px; }
.dr-hint { margin-top: 6px; color: var(--text-3); font-size: 12px; line-height: 17px; }
.toast { position: fixed; z-index: 12; left: 50%; bottom: 40px; transform: translate(-50%, 20px); max-width: calc(100% - 32px); padding: 14px 16px; border-radius: 8px; background: var(--toast-bg);
  color: var(--toast-text); font-size: 14px; line-height: 20px; box-shadow: 0 3px 5px -1px rgba(0, 0, 0, .2), 0 6px 10px rgba(0, 0, 0, .14); opacity: 0; pointer-events: none; transition: opacity .18s, transform .18s; }
.toast.on { opacity: 1; transform: translate(-50%, 0); }
.pin { width: 27px; height: 43px; cursor: grab; filter: drop-shadow(0 2px 2px rgba(0, 0, 0, .35)); }
.pin svg { width: 27px; height: 43px; animation: drop .35s cubic-bezier(.3, 1.5, .6, 1); transform-origin: 50% 100%; }
.mpin { cursor: pointer; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .4)); }
.mpin .bpin { width: 24px; height: 24px; margin: 0; transition: transform .15s; }
.mpin:hover .bpin, .mpin.sel .bpin { transform: rotate(-45deg) scale(1.2); }
.hpin { cursor: pointer; display: flex; align-items: center; gap: 4px; padding: 3px 9px 3px 4px; border-radius: 14px; background: var(--float); box-shadow: 0 1px 4px rgba(0, 0, 0, .35); font: 500 12px/18px var(--head); color: var(--text); white-space: nowrap; }
.hpin i { width: 18px; height: 18px; border-radius: 50%; background: var(--pin); display: grid; place-items: center; }
.hpin i svg { width: 12px; height: 12px; fill: #fff; }
.hpin:hover { background: var(--surface-2); }
@keyframes drop { from { transform: translateY(-40px) scale(.9); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes rise-c { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translateX(-50%); } }

/* ---------------------------------------------------------------- phones: the panel is a sheet from the bottom */
@media (max-width: 720px) {
  :root { --panel: 100%; }
  .top { top: 8px; left: 8px; right: 8px; flex-direction: column; gap: 0; }
  .search, .panel-open .search { flex: none; width: 100%; box-shadow: var(--search-shadow); border: 0; }
  .chips { width: calc(100% + 16px); margin: 0 -8px; padding: 10px 8px 6px; }
  .search.open + .chips { display: none; }
  .panel { top: auto; height: 62vh; border-radius: 16px 16px 0 0; box-shadow: 0 -2px 12px rgba(0, 0, 0, .2); transition: transform .25s cubic-bezier(.2, 0, 0, 1), height .25s; }
  .panel.closed { transform: translateY(calc(100% - 64px)); box-shadow: 0 -2px 12px rgba(0, 0, 0, .2); }
  .panel.tall { height: calc(100% - 64px); }
  .panel-scroll { padding-top: 22px; }
  .panel::before { content: ''; position: absolute; top: 8px; left: 50%; width: 32px; height: 4px; margin-left: -16px; border-radius: 2px; background: var(--grabber); z-index: 4; }
  .grab { position: absolute; top: 0; left: 0; right: 0; height: 26px; z-index: 4; cursor: grab; touch-action: none; }
  .collapse { display: none; }
  .hero { height: 150px; }
  .panel-open .layers, .layers { left: 12px; bottom: calc(62vh + 12px); width: 56px; height: 56px; }
  .panel.closed ~ .layers, .closed-sheet .layers { bottom: 76px; }
  .rail { right: 12px; bottom: calc(62vh + 12px); }
  .closed-sheet .rail { bottom: 76px; }
  .zoom { display: none; }
  .panel-open .legend, .legend { left: 50%; top: 112px; bottom: auto; height: 26px; font-size: 11px; line-height: 26px; padding: 0 10px; gap: 7px; }
  .legend > span:first-child { display: none; }
  .panel-open .lmenu, .lmenu { left: 8px; right: 8px; width: auto; bottom: calc(62vh + 76px); }
  .card, .panel-open .card { left: 8px; right: 8px; width: auto; max-width: none; transform: none; bottom: calc(62vh + 56px); animation: rise .16s ease-out; }
  .foot { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
