/* topo-il interface. The rules for what goes where, button types, wording and
   notices are in docs/ux-spec.md; shared pieces are marked "shared". */
:root{
  /* "לעם" family palette (as on over.org.il, docs/branding.md): --brand is the
     header teal, --accent the key brand teal for buttons, links and focus */
  --bg:#ffffff; --fg:#111827; --muted:#464F5E; --line:#E5E7EB; --accent:#065B76; --accent-2:#E8F5F9;
  --brand:#044E66; --brand-deep:#003647; --surface-2:#F1F5F9;
  --soft:#F1F5F9; --danger:#b3261e; --danger-bg:#fbe9e7; --ok-bg:#e5f5ea; --ok-fg:#1b6b3a; --warn-bg:#fdf1e3; --warn-fg:#8a4b0c;
  --shadow:0 4px 18px rgba(20,30,25,.18); --r:14px; --btn-h:34px;
  font-family:"Rubik",system-ui,"Segoe UI","Noto Sans Hebrew",Arial,sans-serif;
}
*{box-sizing:border-box}
[hidden]{display:none!important}
html,body{margin:0;height:100%;overflow:hidden;color:var(--fg)}
#map{position:absolute;inset:0}
button{font:inherit;color:inherit;cursor:pointer}
svg{width:20px;height:20px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
:focus-visible{outline:3px solid var(--accent);outline-offset:2px}
/* links inside panel text (menu links keep their own colour) */
.fine a,.panel-foot a{color:var(--accent)}

/* ---------- top bar (start side) ---------- */
#top{position:absolute;top:12px;right:12px;z-index:5;display:flex;gap:10px;align-items:flex-start;max-width:calc(100% - 90px)}
.brand{display:flex;align-items:center;gap:6px;background:var(--brand);color:#fff;border-radius:var(--r);box-shadow:var(--shadow);padding:9px 12px;font-weight:700;white-space:nowrap;height:42px}
.brand svg{fill:#fff;stroke:none}
.brand svg .snow{fill:#9CD9EA}
#search{position:relative;width:320px;max-width:100%}
#btn-help{display:flex;align-items:center;gap:6px;background:var(--accent);color:#fff;border-radius:var(--r);box-shadow:var(--shadow);padding:9px 13px;font-weight:700;text-decoration:none;white-space:nowrap;height:42px}
#btn-help:hover{filter:brightness(1.1)}
#btn-about{display:flex;align-items:center;gap:6px;background:var(--bg);color:var(--accent);border-radius:var(--r);box-shadow:var(--shadow);padding:9px 13px;font-weight:700;text-decoration:none;white-space:nowrap;height:42px}
#btn-about:hover{background:var(--accent-2)}
/* the header menu (help, about, settings) */
#menu-wrap{position:relative}
#btn-help{border:0;font:inherit;font-weight:700;cursor:pointer}
#btn-help .chev{width:16px;height:16px;margin-inline-start:-2px;transition:transform .15s}
#btn-help.on .chev{transform:rotate(180deg)}
#menu{position:absolute;top:48px;right:0;z-index:9;width:280px;background:var(--bg);border-radius:var(--r);box-shadow:var(--shadow);padding:6px}
#menu>a{display:flex;align-items:center;gap:8px;padding:9px 10px;border-radius:9px;color:var(--fg);text-decoration:none;font-size:14px}
#menu>a:hover{background:var(--accent-2)}
#menu>a svg{color:var(--accent);flex:none}
#menu .menu-set{border-top:1px solid var(--line);margin-top:4px;padding:2px 8px 4px}
#menu h3{font-size:13px;margin:8px 0 4px;color:var(--muted);font-weight:600}
#q{width:100%;height:42px;border:0;border-radius:var(--r);box-shadow:var(--shadow);padding:11px 14px;font:inherit;outline:none;background:var(--bg)}
#q:focus{box-shadow:0 0 0 2px var(--accent),var(--shadow)}
#results{position:absolute;top:48px;right:0;left:0;margin:0;padding:6px;list-style:none;background:var(--bg);border-radius:var(--r);box-shadow:var(--shadow);max-height:50vh;overflow:auto}
#results li{padding:8px 10px;border-radius:9px;cursor:pointer;display:flex;gap:6px;align-items:center}
#results li:hover,#results li.sel{background:var(--accent-2)}
#results li .t{flex:1}
#results li small{color:var(--muted);display:block}
#results li.credit{font-size:11px;color:var(--muted);cursor:default;padding-top:6px;border-top:1px solid var(--line)}
#results li.credit:hover{background:none}

/* ---------- tool column (end side, since the UI reads right to left) ---------- */
#tools{position:absolute;top:12px;left:12px;z-index:5;display:flex;flex-direction:column;gap:10px}
/* shared: icon tool button */
.tool{width:42px;height:42px;border:0;border-radius:12px;background:var(--bg);box-shadow:var(--shadow);display:grid;place-items:center;flex:none}
.tool:hover{background:var(--accent-2)}
.tool.on,.tool.on:hover{background:var(--accent);color:#fff}
.tool b{font-size:13px}
/* two cards: the view (layers, 3D, north, location), then tools that act on it */
.tgroup{display:flex;flex-direction:column;background:var(--bg);border-radius:14px;box-shadow:var(--shadow);overflow:hidden;flex:none}
.tgroup .tool{width:44px;height:42px;border-radius:0;box-shadow:none;background:transparent}
.tgroup .tool+.tool{border-top:1px solid var(--line)}
.tgroup .tool:hover{background:var(--accent-2)}
.tgroup .tool.on,.tgroup .tool.on:hover{background:var(--accent);color:#fff}
/* value beside a slider: click to type an exact number (numedit.js) */
output.editable{cursor:text;border-bottom:1px dashed #94A3B8;padding:0 2px;border-radius:3px}
output.editable:hover,output.editable:focus-visible{background:var(--accent-2);color:var(--fg);outline:none}
input.numedit{width:76px;font:inherit;font-size:13px;padding:1px 4px;border:1px solid var(--accent);border-radius:6px;text-align:left;color:var(--fg)}
.numedit-u{margin-inline-start:4px;color:var(--muted)}

/* ---------- shared: floating panel beside the tool column ---------- */
.pop{position:absolute;top:12px;left:64px;z-index:7;background:var(--bg);border-radius:var(--r);box-shadow:var(--shadow);padding:8px 14px 12px;width:280px;max-height:calc(100% - 110px);overflow:auto}
.pop h3{font-size:13px;margin:10px 0 6px;color:var(--muted);font-weight:600;display:flex;justify-content:space-between}
.pop input[type=range]{width:100%;accent-color:var(--accent)}
/* "where the view is from" is a standing readout: it steps aside while another panel is open */
body.pop-open #cam{display:none}
#cam{width:240px;font-size:13px}
#cam dl{grid-template-columns:auto 1fr;gap:3px 10px;margin:0;font-size:13px}
#cam dd{white-space:nowrap;font-variant-numeric:tabular-nums;display:flex;align-items:center;gap:5px}
#cam-needle{width:16px;height:16px;fill:var(--accent);flex:none}
#cam .fine{margin:6px 0 0}

/* shared: panel heading (floating panels and the bottom dock): title, info, small actions, close */
.ph{display:flex;gap:8px;align-items:center;min-height:32px;font-size:13.5px;flex-wrap:nowrap}
.ph>b{font-size:14.5px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;min-width:0}
.ph .info{flex:1;min-width:0;color:var(--muted);font-variant-numeric:tabular-nums;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-size:13px}
.pop .ph>b{flex:1}
.ph .seg{margin:0;padding:2px;flex:none}
.ph .seg button{padding:3px 8px;font-size:12px;flex:none}
.ph .btn{min-height:28px;padding:3px 9px;font-size:12px;flex:none}
/* shared: the one close button */
.x{flex:none;width:32px;height:32px;border:0;border-radius:8px;background:none;display:grid;place-items:center;color:var(--muted);padding:0;font-size:0}
.x::before{content:"";width:14px;height:14px;background:currentColor;
  -webkit-mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 14'%3E%3Cpath d='M2 2l10 10M12 2 2 12' stroke='black' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E") center/contain no-repeat;
  mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 14'%3E%3Cpath d='M2 2l10 10M12 2 2 12' stroke='black' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E") center/contain no-repeat}
.x:hover{background:var(--accent-2);color:var(--fg)}

/* ---------- shared: controls ---------- */
.seg{display:flex;background:var(--surface-2);border-radius:11px;padding:3px;gap:2px;margin:6px 0}
.seg button{flex:1;border:0;background:transparent;border-radius:9px;padding:7px 4px;font-size:13px;min-width:0}
.seg button.on{background:#fff;box-shadow:0 1px 4px rgba(0,0,0,.12);font-weight:600}
.seg.small button{font-size:12px;padding:6px 2px}
/* six base maps: two rows of three */
#base{flex-wrap:wrap}
#base button{flex:1 0 30%}
.chips{display:flex;gap:6px;flex-wrap:wrap;margin:4px 0 8px}
.chips button{border:1px solid var(--line);background:#fff;border-radius:999px;padding:3px 10px;font-size:12px}
.chips button:hover{border-color:var(--accent)}
.chk{display:flex;gap:8px;align-items:center;margin:6px 0;font-size:14px}
.chk input{accent-color:var(--accent);width:16px;height:16px;margin:0;flex:none}
.chk.inline{display:inline-flex;margin:0}
.slider{display:block;margin:10px 0 2px;font-size:14px}
.slider output{float:left;color:var(--muted);font-variant-numeric:tabular-nums}
.slider input{width:100%;margin-top:4px;accent-color:var(--accent)}
details .slider{display:flex;gap:8px;align-items:center}
details .slider input{flex:1;margin:0}
summary{cursor:pointer;color:var(--muted);font-size:13px;margin:8px 0}
select{font:inherit;font-size:13.5px;padding:5px 8px;border:1px solid var(--line);border-radius:9px;background:#fff}

/* shared: buttons. primary .btn, secondary .btn.ghost, quiet .btn.quiet (clear, undo) */
.btn{display:inline-flex;align-items:center;justify-content:center;gap:6px;min-height:var(--btn-h);border:1px solid var(--accent);background:var(--accent);color:#fff;border-radius:10px;padding:5px 12px;font-size:13.5px;line-height:1.2}
.btn:hover{filter:brightness(1.08)}
.btn.ghost{background:#fff;color:var(--accent)}
.btn.ghost:hover{background:var(--accent-2);filter:none}
.btn.quiet{background:transparent;border-color:transparent;color:var(--muted);padding-inline:8px}
.btn.quiet:hover{background:var(--soft);color:var(--fg);filter:none}
.btn.on{background:var(--accent);color:#fff}
.btn:disabled{opacity:.45;cursor:default;filter:none}
.btn svg{width:16px;height:16px}
.row{display:flex;gap:8px;flex-wrap:wrap;align-items:center;margin:8px 0}
/* shared: the action row of a panel: main action first, "clear" pushed to the end */
.actions{display:flex;gap:8px;flex-wrap:wrap;align-items:center;margin:12px 0 4px}
.actions .end{margin-inline-start:auto}
.actions .count{color:var(--muted);font-size:12.5px;font-variant-numeric:tabular-nums}
.link{border:0;background:none;padding:0;color:var(--accent);text-decoration:underline dotted;direction:ltr;font-variant-numeric:tabular-nums}

/* ---------- mode panel (side sheet; bottom sheet on phones) ---------- */
#sheet{position:absolute;z-index:4;top:70px;right:12px;width:330px;max-height:calc(100% - 160px);overflow:auto;background:var(--bg);border-radius:var(--r);box-shadow:var(--shadow);padding:6px 16px 14px}
#sheet h2{font-size:17px;margin:10px 0 6px;padding-inline-end:30px}
#sheet h3.sub{font-size:13px;color:var(--muted);font-weight:600;margin:14px 0 2px}
#sheet-grip{display:none}
#sheet-close{position:absolute;top:8px;left:8px;z-index:2}
body.sheet-closed #sheet{display:none}
.hint{color:var(--muted);font-size:13.5px;line-height:1.45;margin:4px 0 10px}
.fine{color:var(--muted);font-size:12px;line-height:1.45;margin:10px 0 0}
/* shared: the long notes on sources and accuracy, folded */
details.about{margin:12px 0 0;border-top:1px solid var(--line);padding-top:2px}
details.about summary{margin:6px 0 2px;font-size:12.5px}
details.about .fine{margin:6px 0 0}
.panel-foot{margin:12px 0 0;font-size:12px;color:var(--muted)}
.big{font-size:30px;font-weight:700;font-variant-numeric:tabular-nums;margin:6px 0}
.big small{font-size:13px;font-weight:400;color:var(--muted)}
dl{display:grid;grid-template-columns:auto 1fr;gap:4px 12px;margin:6px 0;font-size:14px}
dt{color:var(--muted)} dd{margin:0}
.pts{background:var(--soft);border-radius:12px;padding:8px 10px;margin:6px 0}
.pt{display:flex;align-items:center;gap:8px;padding:3px 0;font-size:14px}
.dot{display:inline-grid;place-items:center;width:22px;height:22px;border-radius:50%;color:#fff;font-style:normal;font-size:12px;font-weight:700;flex:none}
.dot.a{background:#1f7a4d} .dot.b{background:#c0392b}
.stats{background:var(--soft);border-radius:12px;padding:8px 10px;margin:10px 0;font-size:14px;line-height:1.5}
.stats small{color:var(--muted)}
/* shared: a result or warning that stays in the panel */
.notice{border-radius:12px;padding:9px 11px;margin:10px 0;font-size:13.5px;line-height:1.45;background:var(--soft)}
.notice.ok{background:var(--ok-bg);color:var(--ok-fg);font-weight:600}
.notice.error{background:var(--danger-bg);color:var(--danger)}
.notice.warn{background:var(--warn-bg);color:var(--warn-fg);font-size:12.5px}
/* shared: loading. .loading for short waits, .progress when progress is known */
.progress{height:6px;background:#E5E7EB;border-radius:3px;overflow:hidden;margin:8px 0}
.progress i{display:block;height:100%;width:0;background:var(--accent);transition:width .2s}
.progress.indet i{width:35%!important;animation:indet 1.1s ease-in-out infinite}
@keyframes indet{from{transform:translateX(100%)}to{transform:translateX(-300%)}}
.loading{color:var(--muted);font-size:13px;padding:8px 0}
.loading::before,#toast.t-loading::before{content:"";display:inline-block;width:12px;height:12px;border:2px solid var(--accent);border-top-color:transparent;border-radius:50%;margin-left:7px;animation:spin .8s linear infinite;vertical-align:-2px}
@keyframes spin{to{transform:rotate(360deg)}}

/* shared: legend. swatches or lines with a word, or a ramp with a word at each end */
.legend{display:flex;align-items:center;gap:4px 10px;flex-wrap:wrap;font-size:12.5px;color:var(--muted);margin-top:10px}
.legend .k{display:inline-flex;align-items:center;gap:5px;white-space:nowrap}
.legend i{display:inline-block;width:14px;height:14px;border-radius:4px;flex:none}
.legend i.ln{width:16px;height:4px;border-radius:2px}
.legend i.ln.w3{height:6px}
.legend.grad{flex-wrap:nowrap;gap:6px}
.legend.grad i{flex:1;height:10px;background:linear-gradient(to right,#d7301f,#f3e3d3 50%,#2166ac)}
.legend .ramp{display:inline-flex;flex:1;min-width:80px}
.legend .ramp i{flex:1;height:12px;width:auto;border-radius:0}
.legend .ramp i:first-child{border-radius:0 4px 4px 0}.legend .ramp i:last-child{border-radius:4px 0 0 4px}

/* route cards */
.route{border:1.5px solid var(--line);border-radius:12px;padding:9px 11px;margin:8px 0;cursor:pointer;background:#fff}
.route.on{border-color:var(--accent);box-shadow:0 0 0 2px var(--accent-2)}
.route .h{display:flex;justify-content:space-between;font-weight:600;font-size:14px}
.route .h small{font-weight:400;color:var(--muted)}
.route .m{display:flex;gap:12px;flex-wrap:wrap;font-size:13px;color:var(--muted);margin-top:4px;font-variant-numeric:tabular-nums}
.route .m b{color:var(--fg)}

/* ---------- shared: bottom dock (profile, section, panorama, flight player) ---------- */
.dock{position:absolute;z-index:6;bottom:84px;left:12px;right:356px;background:var(--bg);border-radius:var(--r);box-shadow:var(--shadow);padding:4px 8px 8px 10px;display:flex;flex-direction:column}
body.sheet-closed .dock{right:12px}
.dock canvas{flex:1;width:100%;min-height:0}
#profile{height:170px}
#pano{height:240px}
#pano canvas{border-radius:8px;touch-action:none;cursor:grab}
#pano canvas:active{cursor:grabbing}
body.flying #pano,body.flying #profile{display:none}
.pk-list{list-style:none;margin:8px 0 0;padding:0;max-height:220px;overflow:auto}
.pk-list li{display:flex;justify-content:space-between;gap:8px;padding:5px 6px;border-radius:8px;cursor:pointer;font-size:13px}
.pk-list li:hover{background:var(--accent-2)}
.pk-list li span{color:var(--muted);font-variant-numeric:tabular-nums;white-space:nowrap}

/* ---------- modes bar ---------- */
#modes{position:absolute;z-index:5;bottom:16px;left:50%;transform:translateX(-50%);display:flex;gap:4px;background:var(--bg);border-radius:18px;box-shadow:var(--shadow);padding:5px}
#modes button{border:0;background:transparent;border-radius:14px;padding:7px 14px;display:flex;flex-direction:column;align-items:center;gap:2px;font-size:12.5px;min-width:68px}
#modes button:hover{background:var(--accent-2)}
#modes button.on{background:var(--accent);color:#fff}
#modes svg{width:22px;height:22px}
/* the tools item names the running tool; its label may be long */
#modes button>span{max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
#nav-tool-ic{display:contents}

#readout{position:absolute;z-index:3;bottom:16px;left:12px;background:rgba(255,255,255,.92);border-radius:10px;padding:5px 10px;font-size:12.5px;font-variant-numeric:tabular-nums;box-shadow:0 1px 6px rgba(0,0,0,.15);pointer-events:none;min-height:1em}
#readout:empty{display:none}

/* ---------- shared: notices (util.js notify) ---------- */
#toast{position:absolute;z-index:20;top:66px;left:50%;transform:translateX(-50%);max-width:min(460px,calc(100% - 130px));background:#111827;color:#fff;border-radius:12px;padding:9px 15px;font-size:14px;line-height:1.4;box-shadow:var(--shadow);cursor:pointer;text-align:center}
#toast.t-success{background:var(--ok-fg)}
#toast.t-success::before{content:"✓";font-weight:700;margin-left:7px}
#toast.t-error{background:var(--danger)}
#toast.t-error::before{content:"!";display:inline-grid;place-items:center;width:18px;height:18px;border-radius:50%;background:#fff;color:var(--danger);font-weight:800;font-size:12px;margin-left:7px;vertical-align:1px}
#toast.t-loading::before{border-color:#fff;border-top-color:transparent}

.maplibregl-ctrl-bottom-left{bottom:46px}
.maplibregl-ctrl-attrib{font-size:11px}
.maplibregl-ctrl-bottom-right{bottom:0;max-width:calc(50% - 280px)}

/* map markers */
.marker-pin{width:26px;height:26px;border-radius:50% 50% 50% 0;transform:rotate(-45deg);border:2px solid #fff;box-shadow:0 2px 6px rgba(0,0,0,.35);display:grid;place-items:center}
.marker-pin span{transform:rotate(45deg);color:#fff;font-weight:700;font-size:12px}
.marker-eye{width:30px;height:30px;border-radius:50%;background:#1f4fa8;border:3px solid #fff;box-shadow:0 2px 8px rgba(0,0,0,.4);display:grid;place-items:center;color:#fff;cursor:grab}
.marker-eye svg{width:16px;height:16px}
.hover-dot{width:12px;height:12px;border-radius:50%;background:#fff;border:3px solid #1d2420;pointer-events:none}
.marker-target{width:22px;height:22px;border-radius:50%;background:#e67e22;border:3px solid #fff;box-shadow:0 0 0 2px #e67e22,0 2px 8px rgba(0,0,0,.4);cursor:grab}
.marker-outlet{width:16px;height:16px;border-radius:50%;background:#c62828;border:3px solid #fff;box-shadow:0 1px 6px rgba(0,0,0,.45)}

/* ---------- flight player ---------- */
#fly-bar{max-width:720px;margin-inline-start:auto;flex-direction:row;gap:10px;align-items:center;padding:8px 10px}
#fly-bar .tool{box-shadow:none;background:var(--surface-2)}
#fly-bar .tool.on{background:var(--accent);color:#fff}
#fly-play .i-pause,#fly-play.on .i-play{display:none}
#fly-play.on .i-pause{display:block}
#fly-play svg.i-play{fill:currentColor}
#fly-rec{color:var(--danger)}
#fly-rec.on{background:var(--danger)!important;color:#fff}
.fb-mid{flex:1;min-width:0}
.fb-mid input{width:100%;accent-color:#6b3fa0;margin:0}
.fb-txt{display:flex;justify-content:space-between;gap:8px;font-size:12px;color:var(--muted);font-variant-numeric:tabular-nums;white-space:nowrap}
.fb-txt span{overflow:hidden;text-overflow:ellipsis}
#fly-time{direction:ltr;unicode-bidi:isolate;flex:none}
/* while flying the map gets the whole screen, the player bar stays */
body.flying #sheet,body.flying #top,body.flying #tools,body.flying #modes,body.flying #readout,body.flying .pop:not(#cam){display:none}
body.flying #fly-bar{bottom:44px;right:12px;margin:0 auto;opacity:.35;transition:opacity .3s}
body.flying #fly-bar:hover{opacity:1}
body.recording #fly-bar{opacity:0;pointer-events:none}
body.recording #fly-rec{pointer-events:auto}

/* ---------- drainage ---------- */
.dr-chk{gap:14px}
.fine.dr-tight{margin-top:4px}
#dr-trunc .btn{margin-top:6px}

/* ---------- phones: bottom sheet ---------- */
@media (max-width:760px){
  /* --sb: from the bottom of the screen to just above the mode bar. main.js measures it
     (--sheet-bot); the fallback covers the Android gesture bar under edge-to-edge Chrome.
     dvh, not vh: vh is the height with Chrome's address bar hidden, so 42vh ran too tall. */
  :root{--btn-h:40px;--sb:var(--sheet-bot,calc(74px + max(10px,env(safe-area-inset-bottom))))}
  /* search results drop over the tool column and stop above the mode panel */
  #top{left:12px;right:12px;max-width:none;z-index:8}
  #results{max-height:max(160px,calc(100dvh - 72px - var(--sb) - var(--sheet-h,0px)))}
  .brand span{display:none}
  #btn-help{padding:9px 10px}
  #btn-help span{display:none}
  #btn-about{padding:9px 10px}
  #btn-about span{display:none}
  #search{flex:1;width:auto}
  /* the column ends above the panel; when it does not fit it wraps into a second column
     (ltr, so the new column grows into the map, not off the edge) */
  #tools{top:66px;gap:6px;flex-wrap:wrap;direction:ltr;align-content:flex-start;
    max-height:calc(100vh - 76px - var(--sb) - var(--sheet-h,0px) - var(--dock-h,0px));max-height:calc(100dvh - 76px - var(--sb) - var(--sheet-h,0px) - var(--dock-h,0px))}
  /* below two rows of room (a tall panel on a short screen) the panel covers the column */
  body.tools-hide #tools{display:none}
  .tool{width:38px;height:38px;border-radius:11px}
  .tgroup .tool{width:40px;height:38px;border-radius:0}
  /* a floating panel ends above the mode panel (which folds when one opens) */
  .pop{top:66px;left:60px;width:auto;right:12px;max-height:calc(100% - 74px - var(--sb) - var(--sheet-h,0px))}
  #cam{width:auto}
  /* three heights: folded (.min, the title only), half (default) and full (.full, up to the search bar).
     The panel ends above the mode bar and scrolls on its own. */
  #sheet{top:auto;bottom:var(--sb);right:8px;left:8px;width:auto;padding-top:0;transition:max-height .2s ease;overscroll-behavior:contain;
    max-height:42vh;max-height:min(42dvh,calc(100dvh - var(--sb) - 74px))}
  #sheet.full{max-height:calc(100vh - var(--sb) - 62px);max-height:calc(100dvh - var(--sb) - 62px)}
  #sheet.min{max-height:52px;overflow:hidden}
  #sheet.drag{transition:none;overflow:hidden}
  /* the handle is the whole top strip: tap toggles, swipe down closes, swipe up opens */
  #sheet-grip{display:block;position:sticky;top:0;z-index:1;width:calc(100% + 32px);height:30px;margin:0 -16px -6px;border:0;padding:0;background:var(--bg);touch-action:none}
  #sheet-grip::before{content:"";display:block;width:44px;height:5px;border-radius:3px;background:#CBD5E1;margin:10px auto 0}
  #sheet.min h2{margin-top:2px}
  #sheet-close{top:2px}
  /* the dock sits on the sheet and covers the tool column, never the other way round */
  .dock{left:8px;right:8px;bottom:calc(var(--sb) + var(--sheet-h,42vh) + 8px);max-height:calc(100dvh - 62px - var(--sb) - var(--sheet-h,42vh) - 8px)}
  /* the dock never runs up under the search bar: it gets shorter instead */
  #profile,#pano,#section{min-height:110px}
  /* a full panel leaves no room for the dock; it comes back when the panel is lowered */
  body.sheet-full:not(.flying) .dock{display:none}
  #profile{height:130px}
  #pano{height:200px;padding:4px 6px 6px}
  .ph .btn{min-height:28px}
  #modes{bottom:max(10px,env(safe-area-inset-bottom));width:calc(100% - 16px);justify-content:space-around}
  /* five fixed destinations (Material and the iOS HIG cap a bottom bar at five) */
  #modes{gap:2px}
  #modes button{min-width:0;flex:1 1 0;padding:6px 2px;font-size:11.5px}
  #menu{position:fixed;top:62px;right:12px;left:12px;width:auto}
  #readout{display:none}
  /* between the tool column and the screen edge, so it does not sit on the tools */
  #toast{top:62px;left:58px;right:12px;transform:none;width:fit-content;max-width:none;margin-inline:auto}
  body.flying #fly-bar{opacity:.8;bottom:max(10px,env(safe-area-inset-bottom))}
  body.flying .maplibregl-ctrl-bottom-right{bottom:calc(74px + max(10px,env(safe-area-inset-bottom)))}
  body.flying #cam{display:none}
  /* keep the credits above the mode bar and the panel */
  /* open credits stop short of the tool column (two columns wide at most) */
  .maplibregl-ctrl-bottom-right{bottom:calc(var(--sb) + var(--sheet-h,0px) - 4px);max-width:calc(100% - 100px)}
  body.sheet-full:not(.flying) .maplibregl-ctrl-bottom-right{display:none}
  .maplibregl-ctrl-bottom-left{bottom:auto;top:66px;left:auto;right:8px}
}

/* a phone on its side: too short for a bottom sheet, so the panel goes back to the side
   (start side, under the search bar), the dock and the credits sit beside it */
@media (max-width:760px) and (max-height:500px){
  #sheet,#sheet.full{left:auto;width:min(330px,48%);max-height:calc(100vh - var(--sb) - 62px);max-height:calc(100dvh - var(--sb) - 62px)}
  #tools{max-height:calc(100vh - 76px - var(--sb) - var(--dock-h,0px));max-height:calc(100dvh - 76px - var(--sb) - var(--dock-h,0px))}
  .pop{max-height:calc(100% - 74px - var(--sb))}
  .dock{right:calc(min(330px,48%) + 16px);bottom:calc(var(--sb) + 8px);max-height:calc(100dvh - 70px - var(--sb))}
  body.sheet-closed .dock{right:8px}
  .maplibregl-ctrl-bottom-right{bottom:calc(var(--sb) - 4px);right:calc(min(330px,48%) + 8px);max-width:calc(52% - 108px)}
  body.sheet-closed .maplibregl-ctrl-bottom-right{right:0}
  .maplibregl-ctrl-bottom-left{right:calc(min(330px,48%) + 16px)}
  body.sheet-closed .maplibregl-ctrl-bottom-left{right:8px}
}

/* small pieces that follow the shared rules */
#results li .btn{min-height:26px;padding:2px 9px;font-size:12px}
#fly-count:not(:empty)::after{content:" · "}
.touch .kbd-only{display:none}
.pts{position:relative}
#ride-swap{position:absolute;left:6px;top:50%;transform:translateY(-50%);min-height:30px;font-size:12.5px}

/* imported route files (static/js/tracks.js); the panel itself is a shared .pop */
#trk-pop{width:310px}
.trk-list{list-style:none;margin:4px 0 0;padding:0}
.trk-file{border:1.5px solid var(--line);border-inline-start:5px solid var(--c);border-radius:12px;padding:6px 10px 4px;margin:8px 0}
.trk-h{display:flex;align-items:center;gap:7px;min-height:30px}
.trk-h .sw{width:12px;height:12px;border-radius:50%;background:var(--c);flex:none}
.trk-h b{flex:0 1 auto;font-size:14px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0}
.trk-h .info{flex:1 1 0;min-width:0;overflow:hidden;text-overflow:ellipsis;color:var(--muted);font-size:12px;white-space:nowrap}
.trk-h .trk-rm{min-height:28px;font-size:12.5px;padding:2px 6px}
.trk-line{border-top:1px solid var(--line);padding:5px 0 2px}
.trk-line .n{font-size:13px;font-weight:600;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.trk-line .m{display:flex;gap:4px 10px;flex-wrap:wrap;font-size:12.5px;color:var(--muted);font-variant-numeric:tabular-nums}
.trk-line .m b{color:var(--fg)}
.trk-line .m .loading{padding:0}
.trk-line .row,.trk-act{margin:5px 0}
.trk-line .btn,.trk-act .btn{min-height:30px;padding:3px 10px;font-size:12.5px}
.trk-file .notice{margin:6px 0;padding:6px 9px}
.trk-file>.fine{margin:4px 0}
#trk-drop{position:fixed;inset:0;z-index:30;background:rgba(6,91,118,.18);border:4px dashed var(--accent);display:grid;place-items:center;pointer-events:none}
#trk-drop div{background:var(--bg);border-radius:var(--r);box-shadow:var(--shadow);padding:14px 22px;font-weight:700;font-size:16px}
#fly-sel button.on,#fly-file .chips button.on,#fly-snap-kinds button.on{background:var(--accent);border-color:var(--accent);color:#fff}
#fly-sel button.own{font-weight:700}
#fly-sel button.own::after{content:"";display:inline-block;width:6px;height:6px;border-radius:50%;background:#e8a33d;margin-inline-start:4px;vertical-align:middle}
#fly-sel-note:empty{display:none}
.dial-row{display:flex;gap:12px;align-items:center;margin:4px 0 6px}
.dial-side{flex:1;min-width:0}
.dial-side .fine{margin:2px 0 0}
#fly-dial{width:140px;height:140px;flex:none;touch-action:none;cursor:grab;user-select:none}
#fly-dial:active{cursor:grabbing}
#fly-dial:focus-visible{outline:2px solid var(--accent);border-radius:50%}
#fly-dial .dial-face{fill:var(--surface-2);stroke:#CBD5E1;stroke-width:1.5}
#fly-dial .tick{stroke:#94A3B8;stroke-width:1}
#fly-dial .tick.major{stroke:#111827;stroke-width:2}
#fly-dial .tick-l{font-size:9px;fill:#464F5E;text-anchor:middle;dominant-baseline:middle}
#fly-dial .dial-plane{fill:#6b3fa0}
#fly-dial .dial-needle{stroke:var(--accent);stroke-width:3;stroke-linecap:round}
#fly-dial .dial-knob{fill:#fff;stroke:var(--accent);stroke-width:3}
#fly-yaw-chips button.on{background:var(--accent);border-color:var(--accent);color:#fff}
#fly-file{background:var(--soft);border-radius:12px;padding:6px 10px;margin:8px 0}
#fly-file .fine{margin:4px 0}
#fly-file .row{margin:4px 0}
.marker-pin.fly-own,.fly-dot.fly-own{box-shadow:0 0 0 3px #e8a33d}
.marker-pin.fly-sel,.fly-dot.fly-sel{box-shadow:0 0 0 3px #fff,0 0 0 6px var(--accent);z-index:2}
.fly-dot{width:10px;height:10px;border-radius:50%;background:#6b3fa0;border:2px solid #fff;box-shadow:0 1px 4px rgba(0,0,0,.35);cursor:grab}
.fly-dot.fly-along{width:8px;height:8px;border-width:1.5px}
@media (max-width:760px){
  #trk-pop{width:auto}
  .trk-line .btn,.trk-act .btn{min-height:36px}
}
/* real-estate mode */
.re-legend{flex-wrap:wrap}
.re-legend .re-unit{width:100%}
.re-legend .re-ramp{min-width:100%;direction:ltr}
.re-legend .re-ends{display:flex;justify-content:space-between;width:100%;flex-direction:row-reverse}
.re-info{background:var(--surface-2);border-radius:10px;padding:8px 10px;font-size:13.5px;line-height:1.55;margin:10px 0 0}

/* ---------- computers: the nav bar is a rail on the start side, the panel beside it ----------
   (docs/ux-research.md §4.2). main.js sets --lbar-w (the map controls' width), so the
   dock and the tool chip start beside them. */
@media (min-width:761px){
  #modes{top:66px;right:12px;left:auto;bottom:auto;transform:none;flex-direction:column;gap:2px;padding:4px;border-radius:14px}
  #modes button{width:62px;min-width:0;padding:7px 2px 6px;gap:2px;font-size:11.5px;border-radius:10px}
  #modes svg{width:20px;height:20px}
  #sheet{right:90px;top:66px}
  #tools{width:62px}
  .tgroup .tool{width:62px}
  .dock{left:var(--lbar-w,80px);right:434px;bottom:48px}
  .maplibregl-ctrl-bottom-right{max-width:calc(100% - 120px)}
}
@media (min-width:761px) and (max-height:700px){
  #modes button{padding:4px 2px 3px;font-size:11px}
  #modes svg{width:18px;height:18px}
}
/* light and shadow mode */
.sun-date{display:flex;align-items:center;gap:8px;margin:6px 0;font-size:14px}
.sun-date input{flex:1;min-width:0;font:inherit;padding:6px 8px;border:1px solid #CBD5E1;border-radius:9px;background:#fff}

.wx-pop .maplibregl-popup-content{padding:10px 12px 10px 26px;font:13px/1.4 inherit}
.wx-pop .wx-t{font-size:22px;font-weight:700}
.wx-pop dl{display:grid;grid-template-columns:auto 1fr;gap:2px 10px;margin:4px 0}
.wx-pop dt{color:var(--muted)}
.wx-pop dd{margin:0}
.wx-pop .fine{margin:4px 0 0;font-size:11px;color:var(--muted)}

/* OVER map layers (overlayers.js) */
.ov-q{width:100%;box-sizing:border-box;height:34px;border:1px solid var(--line);border-radius:10px;padding:5px 10px;font:inherit;font-size:13.5px;background:var(--bg)}
.ov-results{list-style:none;margin:6px 0 0;padding:0;max-height:260px;overflow:auto;border:1px solid var(--line);border-radius:10px}
.ov-results li{display:flex;gap:8px;align-items:center;padding:6px 8px;border-bottom:1px solid var(--line)}
.ov-results li:last-child{border-bottom:0}
.ov-results li.fine{display:block;margin:0}
.ov-results .t{flex:1;min-width:0;font-size:13px;line-height:1.3}
.ov-results .t small{display:block;color:var(--muted);font-size:11.5px}
.ov-results .btn{min-height:28px;padding:3px 9px;font-size:12px;flex:none}
#ov-on{margin-top:8px}
.ov-row{display:grid;grid-template-columns:1fr auto;align-items:start;border-top:1px solid var(--line);padding-top:4px}
.ov-row .chk{margin:4px 0;font-size:13.5px}
.ov-row .chk span{min-width:0;overflow-wrap:anywhere}
.ov-row .fine{grid-column:1/-1;margin:0 0 4px}
.ov-row .ov-note{color:#9a5b00}
.ov-sw{display:inline-block;width:12px;height:12px;border-radius:3px;flex:none;vertical-align:-1px;margin-inline-end:4px}
.ov-pop .maplibregl-popup-content{max-height:340px;overflow:auto}
.ov-pop .ov-h{display:block;margin:0 0 6px 18px}
.ov-pop dl{display:grid;grid-template-columns:auto 1fr;gap:2px 10px;margin:0;font-size:12.5px}
.ov-pop dt{color:var(--muted);overflow-wrap:anywhere;max-width:120px}
.ov-pop dd{margin:0;overflow-wrap:anywhere}
.ov-pop .ov-sec+.ov-sec{border-top:1px solid var(--line,#ddd);margin-top:8px;padding-top:8px}
.ov-pop .ov-sec+.ov-sec .ov-h{margin-inline-end:0}
.ov-pop .ov-sep{border:0;border-top:1px dashed var(--line,#ddd);margin:6px 0}
/* measure mode */
.meas-vtx{width:12px;height:12px;border-radius:50%;background:#fff;border:2.5px solid #1f6fd1;box-shadow:0 1px 4px rgba(0,0,0,.35);cursor:grab}
.meas-vtx.end{width:15px;height:15px;background:#1f6fd1;border-color:#fff}
.meas-vtx.snapped{box-shadow:0 0 0 2px #e8a33d,0 1px 4px rgba(0,0,0,.35)}
.meas-lbl{pointer-events:none;background:rgba(255,255,255,.92);color:#123;border-radius:7px;padding:1px 6px;font-size:12px;font-weight:600;white-space:nowrap;box-shadow:0 1px 3px rgba(0,0,0,.25);direction:rtl;font-variant-numeric:tabular-nums}
.meas-lbl.total{background:#1f6fd1;color:#fff;font-size:13px;padding:2px 8px}
#ms-kinds button.on{background:var(--accent);border-color:var(--accent);color:#fff}
#ms-stats .big{font-size:26px}
#ms-stats dl{margin:4px 0 0}
#ms-stats .loading{padding:0;font-size:12.5px}
#ms-legs table{width:100%;border-collapse:collapse;font-size:13px;font-variant-numeric:tabular-nums}
#ms-legs td{padding:3px 4px;border-top:1px solid var(--line)}
#ms-legs td.mut{color:var(--muted);font-size:12px}
@media (max-width:760px){
  .meas-vtx{width:18px;height:18px}
  .meas-vtx.end{width:21px;height:21px}
}

/* parcel card (buildings mode, parcelcard.js) */
.pc-card{margin:12px 0 0;border-top:1px solid var(--line);padding-top:6px}
.pc-card .ph{display:flex;align-items:center;gap:8px;margin:2px 0 4px}
.pc-card .ph b{flex:1;font-size:15px}
.pc-s{padding:4px 10px;margin:4px 0}
.pc-r{display:flex;justify-content:space-between;gap:10px;padding:2px 0;border-bottom:1px solid rgba(0,0,0,.05)}
.pc-r:last-child{border-bottom:0}
.pc-r span{color:var(--muted)}
.pc-r b{font-weight:600;text-align:end}
.pc-r small{color:var(--muted);font-weight:400}
.pc-na{color:var(--muted);font-weight:400;font-style:italic}
.pc-deals{width:100%;border-collapse:collapse;font-size:12.5px;margin:6px 0}
.pc-deals th{color:var(--muted);font-weight:600;text-align:start;border-bottom:1px solid var(--line);padding:3px 4px}
.pc-deals td{padding:3px 4px;border-bottom:1px solid rgba(0,0,0,.05)}
.pc-deals tr.x{display:none}
.pc-more{margin:2px 0 6px}
.pc-bars{margin:6px 0;font-size:12.5px}
.pc-bar{display:flex;align-items:center;gap:6px;margin:3px 0}
.pc-bar span{width:52px;color:var(--muted)}
.pc-bar i{height:10px;border-radius:5px;background:#2c7bb6;flex:none;max-width:calc(100% - 140px)}
.pc-bar i.c1{background:#00a6ca}.pc-bar i.c2{background:#90a4ae}
.pc-spark{margin:6px 0}
.pc-spark small{color:var(--muted);font-size:12px}
.pc-spark svg{width:100%;height:auto;display:block}
.pc-spark polyline{fill:none;stroke:#2c7bb6;stroke-width:2}
.pc-spark circle{fill:#2c7bb6}
.pc-spark text{font-size:10px;fill:var(--muted)}
.pc-verdict{margin:6px 0;font-size:13.5px;line-height:1.5}
.pc-cmp{margin:6px 0 8px;font-size:12.5px}
.pc-cmp-r{display:grid;grid-template-columns:minmax(92px,42%) 1fr 38px;align-items:center;gap:6px;margin:3px 0}
.pc-cmp-r span{color:var(--muted);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.pc-cmp-r i{height:10px;background:var(--soft);border-radius:5px;overflow:hidden;display:block}
.pc-cmp-r b{display:block;height:100%;background:#90a4ae;border-radius:5px}
.pc-cmp-r.me span{color:inherit;font-weight:600}
.pc-cmp-r.me b{background:#d7191c}
.pc-cmp-r em{font-style:normal;font-weight:600;text-align:end}
.pc-cmp small{color:var(--muted);font-size:11.5px}
.pc-ranks{margin:4px 0 6px;padding-inline-start:18px;font-size:12.5px;line-height:1.6}
.pc-ranks small{color:var(--muted)}
.pc-trend polyline{fill:none;stroke-width:2}
.pc-trend line.base{stroke:var(--line);stroke-width:1}
.pc-leg{display:flex;flex-wrap:wrap;gap:10px;font-size:11.5px;color:var(--muted)}
.pc-leg i{display:inline-block;width:12px;height:3px;border-radius:2px;margin-inline-end:4px;vertical-align:middle}
.pc-crime td.hi{background:#fde3cf;font-weight:600}
.pc-crime td.lo{background:#dcf0dc}
/* satellite layers (satlayers.js) */
.sat-opts{margin:0 24px 8px 0}
.sat-opts select{width:100%;margin:2px 0 4px;font:inherit;font-size:13px;padding:4px}
.sat-ramp{display:grid;grid-template-columns:1fr 1fr;font-size:11.5px;color:var(--muted);margin-top:4px}
.sat-ramp i{grid-column:1/3;height:10px;border-radius:3px}
.sat-ramp span:last-child{text-align:left}
.sat-classes{display:flex;flex-wrap:wrap;gap:3px 10px;font-size:12px}
.sat-classes i{display:inline-block;width:10px;height:10px;border-radius:2px;margin-left:4px;vertical-align:-1px;box-shadow:0 0 0 1px rgba(0,0,0,.15)}
.sat-legend{width:100%;max-width:260px;display:block;margin:2px 0;direction:ltr}
#layers h3.sub{font-size:13px;color:var(--muted);font-weight:600;margin:10px 0 2px}
/* annual Sentinel base map, zoomed in past its detail */
#s2-note{position:absolute;top:64px;left:50%;transform:translateX(-50%);z-index:6;background:var(--bg);box-shadow:var(--shadow);border-radius:20px;padding:6px 8px 6px 14px;font-size:13px;display:flex;gap:8px;align-items:center;max-width:calc(100% - 140px)}
#s2-note[hidden]{display:none}
#s2-note button{border:0;border-radius:14px;padding:4px 10px;font:inherit;font-size:12.5px;cursor:pointer;white-space:nowrap;flex:none}
#s2-note .go{background:var(--accent);color:#fff}
#s2-note .x{background:transparent;padding:0;width:28px;height:28px;font-size:0}
/* time-lapse of the Sentinel-2 base map (timelapse.js) */
.tl-play{display:flex;align-items:center;gap:6px;flex-wrap:wrap;font-size:12.5px;margin:10px 0 2px}
.tl-play select{font:inherit;font-size:12.5px;padding:3px;min-width:0}
#tl-bar{position:absolute;bottom:72px;left:50%;transform:translateX(-50%);z-index:6;background:var(--bg);box-shadow:var(--shadow);border-radius:14px;padding:8px 12px 10px;min-width:250px;max-width:calc(100% - 24px)}
#tl-bar[hidden]{display:none}
#tl-bar .tl-head{display:flex;align-items:center;justify-content:space-between;gap:8px}
#tl-now{font-size:19px;white-space:nowrap}
#tl-load{display:block;font-size:12px;color:var(--muted);min-height:15px}
#tl-bar .tl-ctl{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
#tl-bar-play{border:0;border-radius:50%;width:36px;height:36px;background:var(--accent);color:#fff;font-size:15px;cursor:pointer;flex:none}
#tl-rec{min-height:32px}
#tl-hint{margin:0 0 8px;font-size:12.5px;max-width:300px;line-height:1.45;background:#fff6dc;border-radius:8px;padding:6px 8px}
#tl-hint .btn{min-height:26px;padding:2px 10px;font-size:12px;margin-top:4px}
#tl-rec.on{background:#c0392b;border-color:#c0392b;color:#fff}
#tl-bar .chk{font-size:12.5px;margin:0}
/* OVER feature card on phones: a card above the mode bar instead of a popup */
#ov-card{position:absolute;z-index:6;left:8px;right:8px;bottom:calc(var(--sb,90px) + 8px);max-height:45vh;max-height:45dvh;overflow:auto;
  background:var(--bg);border-radius:var(--r);box-shadow:var(--shadow);padding:10px 14px 8px;overscroll-behavior:contain}
#ov-card[hidden]{display:none}
#ov-card-x{position:sticky;top:0;float:left;margin:-4px -6px 0 0;background:var(--bg)}
#ov-card dl,#moag-card dl{grid-template-columns:minmax(0,38%) minmax(0,1fr)}
#ov-card dt,#moag-card dt{max-width:none}

/* layers panel: search on top filters the toggles; chips for the layers that are on (layerpanel.js) */
#layers>.ov-q{margin:4px 0 2px}
#layers .ly-miss{display:none}
#layers.filtering>p.fine,#layers.filtering>h3.sub,#layers.filtering>input[type=range]{display:none}
#ly-on h3{margin-top:8px}
#ly-chips{margin:2px 0 4px}
.ly-chip-w{display:inline-flex;align-items:center;background:var(--accent-2);border:1px solid var(--accent);border-radius:999px;padding-inline-end:1px}
.ly-chip-w.sel{box-shadow:0 0 0 2px var(--accent)}
#ly-chips .ly-chip-op{display:inline-flex;align-items:center;gap:5px;border:0;background:none;padding:3px 4px 3px 10px;font-size:12px;color:var(--fg)}
#ly-chips .ly-chip-op small{color:var(--accent);font-size:12px}
#ly-chips .ly-chip-op i{width:10px;height:10px;border-radius:3px;flex:none}
#ly-chips .ly-chip-w .x{width:22px;height:22px;border:0;padding:0}
#ly-op{display:flex;align-items:center;gap:8px;font-size:12.5px;margin:2px 0 6px}
#ly-op[hidden]{display:none}
#ly-op span{flex:none;max-width:40%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--muted)}
#ly-op input{flex:1;min-width:0;accent-color:var(--accent)}
#ly-op output{flex:none;width:3.2em;font-variant-numeric:tabular-nums}

/* ---------- panes in the side panel (main.js showPane) ---------- */
#sheet>[data-pane]{display:none}
body[data-pane=tools] #sheet>[data-pane=tools]{display:block}
body:not([data-pane=mode]) #sheet>section[data-panel]{display:none}
body:not([data-pane=mode]) #sheet-close{display:none}
/* the old floating panels, now panes: no frame of their own */
#sheet>.pop{position:static;width:auto;max-height:none;overflow:visible;box-shadow:none;border-radius:0;padding:0;z-index:auto;background:none}
#sheet>.pop+.pop:not([hidden]){border-top:1px solid var(--line);margin-top:12px;padding-top:4px}
#sheet>.pop .ph,#sheet>[data-pane] .ph{padding-top:6px}
#sheet>[data-pane] .ph b{font-size:17px}
/* the tools list */
.tl-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:4px;margin:4px 0 6px}
.tl-item{border:0;background:var(--surface-2);border-radius:11px;padding:8px 2px 7px;display:flex;flex-direction:column;align-items:center;gap:4px;font-size:12px;line-height:1.2;min-width:0;text-align:center}
.tl-item:hover{background:var(--accent-2)}
.tl-item svg{width:22px;height:22px}
body[data-mode=ride] .tl-item[data-mode=ride],body[data-mode=sight] .tl-item[data-mode=sight],body[data-mode=dominance] .tl-item[data-mode=dominance],
body[data-mode=drainage] .tl-item[data-mode=drainage],body[data-mode=sun] .tl-item[data-mode=sun],body[data-mode=realestate] .tl-item[data-mode=realestate],
body[data-mode=buildings] .tl-item[data-mode=buildings],body[data-mode=measure] .tl-item[data-mode=measure],body[data-mode=flight] .tl-item[data-mode=flight]{background:var(--accent);color:#fff}
/* the running tool, when its panel is not the one in view */
#tool-chip{position:absolute;z-index:6;top:12px;left:var(--lbar-w,80px);display:flex;align-items:center;gap:2px;background:var(--accent-2);border-radius:999px;box-shadow:var(--shadow);padding:3px 4px 3px 6px}
#chip-back{display:flex;align-items:center;gap:6px;border:0;background:none;font:inherit;font-size:14px;padding:4px 6px;cursor:pointer;color:var(--fg)}
#chip-back svg{width:18px;height:18px;color:var(--accent)}
#chip-back .fine{margin:0;color:var(--muted)}
#tool-chip .x{position:static}
#tool-chip[hidden],body.flying #tool-chip{display:none}
/* phones: the nav bar names the running tool */
@media (max-width:760px){#tool-chip{display:none}}

/* ---------- one card for a click, in the explore panel ---------- */
#sheet .feat-card{margin:10px 0 0;background:var(--surface-2);border-radius:10px;padding:8px 10px;font-size:13.5px}
#sheet #ov-card{position:relative;left:auto;right:auto;bottom:auto;z-index:auto;max-height:none;overflow:visible;box-shadow:none}
#sheet #moag-card{position:relative;left:auto;right:auto;bottom:auto;z-index:auto;max-height:none;overflow:visible;box-shadow:none}
#sheet #ov-card-x{position:absolute;top:2px;left:2px;float:none;margin:0;background:none}
#sheet #moag-card-x{position:absolute;top:2px;left:2px;float:none;margin:0;background:none}
#sheet #ov-card .ov-h{display:block;margin:0 0 6px 26px}
#sheet #moag-card .ov-h{display:block;margin:0 0 6px 26px}
#sheet #ov-card dl{display:grid;gap:2px 10px;margin:0;font-size:12.5px}
#sheet #moag-card dl{display:grid;gap:2px 10px;margin:0;font-size:12.5px}
#sheet #ov-card dd{margin:0;overflow-wrap:anywhere}
#sheet #moag-card dd{margin:0;overflow-wrap:anywhere}
#sheet #ov-card dt{color:var(--muted);overflow-wrap:anywhere}
#sheet #moag-card dt{color:var(--muted);overflow-wrap:anywhere}
#sheet #ov-card .ov-sec+.ov-sec{border-top:1px solid var(--line);margin-top:8px;padding-top:8px}
#sheet #moag-card .ov-sec+.ov-sec{border-top:1px solid var(--line);margin-top:8px;padding-top:8px}
#sheet #ov-card .ov-sep{border:0;border-top:1px dashed var(--line);margin:6px 0}
#sheet #moag-card .ov-sep{border:0;border-top:1px dashed var(--line);margin:6px 0}
#wx-card .wx-t{font-size:22px;font-weight:700}
#wx-card dl{display:grid;grid-template-columns:auto 1fr;gap:2px 10px;margin:4px 0}
#wx-card dt{color:var(--muted)}
#wx-card dd{margin:0}
#wx-card .fine{margin:4px 0 0;font-size:11px}
#sheet .pc-card.feat-card{background:none;padding:6px 0 0}

/* base map choices with a small drawn swatch of each (no extra downloads) */
#base.thumbs button{display:flex;flex-direction:column;align-items:center;gap:4px;padding:6px 4px 5px;font-size:12.5px;line-height:1.2}
.bt{display:block;width:100%;max-width:74px;height:34px;border-radius:7px;border:1px solid rgba(0,0,0,.08)}
#base.thumbs button.on .bt{outline:2px solid var(--accent);outline-offset:1px}
.bt-terrain{background:repeating-radial-gradient(circle at 70% 60%,transparent 0 6px,rgba(140,110,70,.35) 6px 7px),linear-gradient(135deg,#e8e2cf,#cfd8b4 60%,#b9c79a)}
.bt-sat{background:radial-gradient(circle at 30% 40%,#6d7a4f 0 18%,transparent 19%),radial-gradient(circle at 75% 70%,#8c7b5a 0 22%,transparent 23%),linear-gradient(135deg,#5b6b44,#9a8f6c 55%,#c7b993)}
.bt-streets{background:linear-gradient(90deg,transparent 46%,#fff 46% 54%,transparent 54%),linear-gradient(0deg,transparent 40%,#f6d28b 40% 48%,transparent 48%),#ece9e2}
.bt-osm{background:linear-gradient(60deg,transparent 45%,#f9b26b 45% 52%,transparent 52%),linear-gradient(-20deg,transparent 60%,#fff 60% 65%,transparent 65%),linear-gradient(135deg,#f2efe9,#cfe5c5)}
.bt-m15{background:radial-gradient(circle at 60% 35%,#b9a98a 0 20%,transparent 21%),linear-gradient(135deg,#7e8a62,#b3a684 60%,#d8cdb0);filter:sepia(.25)}
.bt-s2{background:linear-gradient(90deg,#6e7f52 0 33%,#9a8d62 33% 66%,#c8b88e 66%);position:relative}

/* ---------- phase 4: saved layer sets, the first-visit note, tools in the search ---------- */
#ly-on h3 .link{direction:rtl;font-size:12.5px;font-weight:600;color:var(--accent)}
.ly-set-w{display:inline-flex;align-items:center;border:1px solid var(--line);border-radius:999px;background:#fff;padding-inline-end:2px}
.ly-set-w .ly-set{border:0;background:none;padding:3px 10px;font-size:12.5px;cursor:pointer}
.ly-set-w .x{width:22px;height:22px}
#ly-save-form{display:flex;gap:6px;align-items:center;margin:4px 0}
#ly-save-form[hidden]{display:none}
#ly-save-form input{flex:1;min-width:0}
#tools-hint{position:fixed;z-index:9;max-width:260px;background:var(--fg);color:#fff;border-radius:12px;box-shadow:var(--shadow);padding:10px 12px;font-size:13.5px;line-height:1.45;display:flex;flex-direction:column;gap:8px}
#tools-hint[hidden]{display:none}
#tools-hint .btn{align-self:flex-start;color:#fff;border-color:rgba(255,255,255,.6);background:transparent}
#results li.cmd .t small{color:var(--accent)}

/* phones: a click in explore opens the sheet low ("peek": the title and the height);
   the hint above the card goes once a point is picked */
@media (max-width:760px){
  #sheet.peek{max-height:var(--peek-h,170px);overflow:hidden}
  section[data-panel=explore]:has(#pt-card:not([hidden])) #pt-hint{display:none}
}
