/* Ontario Hunting web app - layout and look. Palette (0.6 "clean modern", same as the phone app): ink, green, white, slate;
 * red / orange / green stay for legal warnings. Phone (< 900 px): floating search, bottom tab bar, drag-able sheets.
 * PC: top bar, side panel with tabs, card on the right. Light / dark (auto + Me ▸ Settings). */
:root {
  /* 0.6 clean modern (as the Backcountry app): ink #0F172A, green #16A34A, white surfaces, slate text, 16 px corners.
     The --g* names are kept from the forest palette so older rules still work: ink, ink, green, green tint, white */
  --g900: #0F172A; --g700: #0F172A; --g600: #16A34A; --g400: #DCFCE7; --g100: #FFFFFF;
  --bg: #F8FAFC; --surface: #ffffff; --surface2: #F1F5F9; --line: #E2E8F0; --text: #0F172A; --muted: #56606F;   /* (roadmap 104: 5.8:1 on surface2, was 4.3) */
  --bar: #0F172A; --bar-text: #fff; --primary: #0F172A; --primary-text: #fff; --accent: #16A34A; --hl: #DCFCE7;
  --link: #15803D; --danger: #DC2626; --warn: #EA580C; --ok: #16A34A; --green: #16A34A; --green-ink: #166534;
  --shadow: 0 6px 24px rgba(15, 23, 42, .14); --r: 16px; --tap: 48px; --tabh: 64px; --fs: 1.125rem; --side: 360px;
  color-scheme: light;
}
:root.is-dark {
  --g900: #0B0F14; --g700: #F1F5F9; --g600: #4ADE80; --g400: #14532D; --g100: #F1F5F9;
  --bg: #0B0F14; --surface: #10161C; --surface2: #1A222C; --line: #2A3441; --text: #F1F5F9; --muted: #94A3B8;
  --bar: #0B0F14; --primary: #F1F5F9; --primary-text: #0B0F14; --accent: #4ADE80; --hl: #14532D; --link: #4ADE80;
  --green: #4ADE80; --green-ink: #BBF7D0; --shadow: 0 6px 24px rgba(0, 0, 0, .5);
  color-scheme: dark;
}
:root[data-text="large"] { --fs: 16.5px; }
@media (max-width: 839px) { :root { --fs: 15.5px; } :root[data-text="large"] { --fs: 17.5px; } }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overscroll-behavior: none; font: var(--fs)/1.45 Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
             color: var(--text); background: var(--bg); -webkit-tap-highlight-color: transparent; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
input[type=checkbox], input[type=radio] { accent-color: var(--primary); width: 20px; height: 20px; }
a { color: var(--link); }
.hint { font-size: .85em; color: var(--muted); }
.error { color: var(--danger); font-size: .9em; }
[hidden] { display: none !important; }
button.primary, .primary { background: var(--primary); color: var(--primary-text); border: 0; border-radius: 10px; font-weight: 600; }
button.wide { width: 100%; min-height: var(--tap); margin-top: 8px; }

/* ---------------------------------------------------------------- top bar (PC) */
body { display: flex; flex-direction: column; }
#bar { display: flex; align-items: center; gap: 8px; height: 58px; padding: 0 12px; background: var(--bar); color: var(--bar-text); flex: none; z-index: 15; }
.brand { display: flex; align-items: center; gap: 8px; font-size: 1.1em; white-space: nowrap; margin-right: 6px; }
.brand .logo { font-size: 1.4em; }
@media (max-width: 1500px) { .brand b { display: none; } }
#views { min-width: 0; flex: 0 1 auto; }
#views { display: flex; gap: 4px; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
#views button, #species, .top-btn, #date { height: 38px; border: 0; border-radius: 999px; padding: 0 12px; background: rgba(255,255,255,.12);
  color: #fff; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
#views button:hover, .top-btn:hover, #date:hover { background: rgba(255,255,255,.2); }
#views button.on { background: var(--g100); color: var(--g900); font-weight: 700; }
:root.is-dark #views button.on { background: var(--g400); color: var(--g900); }
#species { appearance: none; padding-right: 14px; max-width: 150px; }
#species option { color: #000; }
.top-btn.primary { background: var(--g400); color: var(--g900); font-weight: 700; }
#search-box { position: relative; margin-left: auto; flex: 0 1 360px; display: flex; align-items: center; }
.search-icon { position: absolute; left: 12px; font-size: .9em; opacity: .7; pointer-events: none; }
#search { width: 100%; height: 40px; border: 0; border-radius: 999px; padding: 0 14px 0 36px; background: var(--surface); color: var(--text); outline: none; }
#search:focus { box-shadow: 0 0 0 3px var(--g400); }
#results { position: absolute; right: 0; top: 46px; z-index: 40; width: 420px; max-width: 92vw; max-height: 65vh; overflow: auto; margin: 0; padding: 6px 0;
  list-style: none; background: var(--surface); color: var(--text); border-radius: var(--r); box-shadow: var(--shadow); }
#results li { padding: 10px 14px; cursor: pointer; }
#results li.head { font-size: .78em; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; cursor: default; padding: 10px 14px 4px; }
#results li:not(.head):hover, #results li.sel { background: var(--surface2); }
#date { position: relative; cursor: pointer; }
#date.set { background: var(--g400); color: var(--g900); font-weight: 700; }
#hunt-date { position: absolute; inset: 0; opacity: 0; width: 100%; cursor: pointer; }
#date-today { display: none; }

/* ---------------------------------------------------------------- main + side panel (PC) */
main { position: relative; flex: 1; min-height: 0; display: flex; }
#side { width: var(--side); flex: none; display: flex; flex-direction: column; background: var(--surface); border-right: 1px solid var(--line);
        transition: margin-left .2s ease; z-index: 12; min-height: 0; }
body.side-closed:not(.phone) #side { margin-left: calc(-1 * var(--side)); }
#side .sheet-handle { display: none; }
.side-tabs { display: flex; border-bottom: 1px solid var(--line); flex: none; }
.side-tabs button { flex: 1; min-height: var(--tap); border: 0; background: none; color: var(--muted); font-weight: 600; border-bottom: 3px solid transparent; }
.side-tabs button[aria-selected=true] { color: var(--text); border-bottom-color: var(--accent); }
.side-tabs .side-collapse { flex: 0 0 44px; font-size: 1.2em; }
.pane { flex: 1; overflow-y: auto; padding: 12px 14px 24px; min-height: 0; }
.pane h2 { font-size: 1.05em; margin: 4px 0 10px; }
.pane h3 { font-size: .8em; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 18px 0 8px; }
#side-open { position: absolute; left: 12px; top: 12px; z-index: 11; width: var(--tap); height: var(--tap); border-radius: 12px; border: 0;
             background: var(--surface); color: var(--text); box-shadow: var(--shadow); font-size: 1.2em; display: none; }
body.side-closed:not(.phone) #side-open { display: block; }
body.side-closed:not(.phone) .maplibregl-ctrl-top-left { margin-top: 60px; }
#map { flex: 1; min-width: 0; }
.field { display: flex; flex-direction: column; gap: 4px; font-weight: 600; font-size: .9em; margin-bottom: 8px; }
.field select, .dialog input, .dialog select, .dialog textarea, .setting select, #spot-filter {
  min-height: 44px; border: 1px solid var(--line); border-radius: 10px; padding: 6px 10px; background: var(--surface); color: var(--text); width: 100%; }

/* layers list + legend */
#layers details { border-bottom: 1px solid var(--line); }
#layers summary { padding: 12px 4px; font-weight: 700; cursor: pointer; list-style: none; display: flex; justify-content: space-between; }
#layers summary::after { content: '▾'; color: var(--muted); transition: transform .15s; }
#layers details:not([open]) summary::after { transform: rotate(-90deg); }
#layers label { display: flex; gap: 10px; align-items: flex-start; padding: 8px 4px 8px 6px; cursor: pointer; border-radius: 8px; min-height: 40px; }
#layers label:hover { background: var(--surface2); }
#layers label.out { color: var(--muted); }
#layers label .t { flex: 1; min-width: 0; }
.sw { display: inline-block; flex: none; width: 18px; height: 13px; margin: 3px 0 0; background: var(--c); border: 1px solid rgba(0,0,0,.35); border-radius: 3px; }
.sw-line { height: 0; border: 0; border-top: 3px solid var(--c); margin-top: 9px; border-radius: 0; }
.sw-point { width: 12px; height: 12px; border-radius: 50%; }
.sw-pat { background: repeating-linear-gradient(45deg, var(--c) 0 2px, transparent 2px 5px); }
ul.legend { list-style: none; margin: -4px 0 8px 36px; padding: 0; font-size: .85em; color: var(--muted); }
ul.legend li { display: flex; align-items: flex-start; gap: 6px; margin: 3px 0; }
ul.legend li.note { font-style: italic; }

/* lists, chips, tools grid, settings */
.big-list { display: flex; flex-direction: column; gap: 8px; }
.big-list button { min-height: 52px; border: 1px solid var(--line); background: var(--surface2); color: var(--text); border-radius: 12px; text-align: left;
                   padding: 10px 14px; font-weight: 600; display: flex; flex-direction: column; justify-content: center; }
.big-list button small { font-weight: 400; color: var(--muted); font-size: .85em; }
.big-list button.on { background: var(--hl); border-color: var(--accent); color: var(--text); }
:root:not(.is-dark) .big-list button.on { color: var(--g900); }
.chip-list { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { min-height: 40px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface2); color: var(--text); }
.chip.on { background: var(--accent); color: var(--g900); border-color: var(--accent); font-weight: 700; }
.lidar-box { margin: 4px 0 12px; }
.lidar-box .chip { min-height: 36px; padding: 0 12px; font-weight: 600; }
.lidar-op { display: flex; align-items: center; gap: 10px; font-weight: 400; color: var(--muted); }
.lidar-op input { flex: 1; accent-color: var(--accent); }
.lidar-op[hidden] { display: none; }
.lidar-legend { font-weight: 400; font-size: .85em; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; }
.lidar-legend i { display: inline-block; width: 14px; height: 14px; border-radius: 3px; vertical-align: -2px; margin-right: 4px; border: 1px solid var(--line); }
.lidar-legend .ramp { width: 100%; height: 10px; border-radius: 5px; border: 1px solid var(--line); }
.tool-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.tool-grid button { min-height: 84px; border: 1px solid var(--line); background: var(--surface2); color: var(--text); border-radius: 14px; padding: 8px 6px;
                    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; font-size: .82em; font-weight: 600; text-align: center; line-height: 1.15; }
.tool-grid button span { font-size: 1.7em; }
.tool-grid button:hover, .big-list button:hover { border-color: var(--accent); }
.setting { display: flex; flex-direction: column; gap: 6px; margin: 12px 0; font-weight: 600; font-size: .92em; }
.seg { display: flex; background: var(--surface2); border: 1px solid var(--line); border-radius: 12px; padding: 3px; gap: 3px; }
.seg button { flex: 1; min-height: 40px; border: 0; border-radius: 9px; background: none; color: var(--muted); font-weight: 600; }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 4px rgba(0,0,0,.15); }
:root.is-dark .seg button.on { background: var(--g600); color: #fff; }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: var(--tap); padding: 4px 2px; border-bottom: 1px solid var(--line); }
#pane-me details { border-top: 1px solid var(--line); padding: 4px 0; }
#pane-me summary { padding: 12px 0; font-weight: 700; cursor: pointer; list-style: none; display: flex; justify-content: space-between; }
#pane-me summary::after { content: '▾'; color: var(--muted); }
#pane-me details:not([open]) summary::after { transform: rotate(-90deg); }
.me-head { display: flex; align-items: center; gap: 12px; margin: 4px 0 8px; }
.me-head > div:nth-child(2) { flex: 1; }
.me-head button { min-height: 40px; border: 1px solid var(--line); background: var(--surface2); color: var(--text); border-radius: 10px; padding: 0 12px; }
.avatar { width: 44px; height: 44px; border-radius: 50%; background: var(--accent); color: var(--g900); display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 1.2em; flex: none; }
#spot-filter { margin-bottom: 8px; }
.spot { display: flex; align-items: center; gap: 10px; min-height: 56px; padding: 6px 4px; border-bottom: 1px solid var(--line); cursor: pointer; }
.spot:hover { background: var(--surface2); }
.spot .ic { font-size: 1.3em; width: 28px; text-align: center; }
.spot .tx { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.spot .tx small { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.spot .go { width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface2); }
.popover { position: fixed; z-index: 60; width: 320px; background: var(--surface); border-radius: var(--r); box-shadow: var(--shadow); padding: 10px; }

/* ---------------------------------------------------------------- the card */
#card { position: absolute; right: 12px; top: 12px; bottom: 12px; width: 430px; max-width: calc(100% - 24px); display: flex; flex-direction: column;
        background: var(--surface); border-radius: var(--r); box-shadow: var(--shadow); z-index: 14; overflow: hidden; }
#card-head { position: relative; flex: none; padding: 12px 56px 10px 16px; border-bottom: 1px solid var(--line); background: var(--surface); touch-action: none; }
#card-head .sheet-handle { display: none; }
#card-close { position: absolute; top: 6px; right: 6px; width: var(--tap); height: var(--tap); border: 0; border-radius: 12px; background: none; color: var(--muted); font-size: 1.7em; line-height: 1; }
#card-close:hover { background: var(--surface2); }
#card-peek:empty::before { content: "What's here"; font-weight: 700; }
.pk-title { font-size: 1.12em; font-weight: 750; display: flex; align-items: center; gap: 8px; line-height: 1.25; }
.tone { width: 14px; height: 14px; border-radius: 50%; flex: none; background: #868e96; box-shadow: 0 0 0 3px rgba(0,0,0,.06); }
.tone-green { background: var(--ok); } .tone-red { background: var(--danger); } .tone-orange { background: var(--warn); } .tone-purple { background: #7b2cbf; }
.pk-row { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 4px; color: var(--muted); font-size: .9em; }
.pk-warn { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.pk-warn span { background: rgba(193, 18, 31, .12); color: var(--danger); border-radius: 999px; padding: 3px 10px; font-size: .85em; font-weight: 700; }
:root.is-dark .pk-warn span { background: rgba(255, 90, 90, .16); color: #ff8f8f; }
#card-body { flex: 1; overflow-y: auto; padding: 6px 16px 28px; overscroll-behavior: contain; }
#card .loading { color: var(--muted); }
#card details { margin: 2px 0; border-bottom: 1px solid var(--line); }
#card details > summary { cursor: pointer; padding: 11px 2px; min-height: 44px; }
#card details details { margin: 2px 0 2px 4px; border: 0; }
#card details details > summary { padding: 8px 2px; min-height: 40px; }
.hit-head { display: flex; align-items: center; gap: 6px; margin: 16px 0 6px; padding: 8px 10px; background: var(--surface2); border-radius: 10px; font-size: .92em; }
.hit-head.here { margin-top: 6px; font-weight: 700; display: none; }
.hit-head.lake { display: flex; background: rgba(76, 201, 240, .15); }
.badge { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 22px; height: 22px; border-radius: 50%; background: var(--g900); color: #fff;
         font-size: .78em; font-weight: 700; border: 2px solid #ffbe0b; }
details.land-fold { margin-top: 12px; border-top: 2px solid var(--line); padding-top: 4px; }
details.land-fold > summary { cursor: pointer; padding: 12px 0; }
.point-tools { background: var(--surface2); border-radius: 12px; padding: 10px 12px; margin: 6px 0 10px; }
.point-tools button { min-height: 40px; margin: 3px 6px 3px 0; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--text); }
.point-tools img { display: block; max-width: 100%; max-height: 240px; margin-top: 8px; border-radius: 10px; cursor: zoom-in; }
/* the server's card HTML has inline light-theme colours: tone them down in the dark */
:root.is-dark #card-body [style*="background:#f1f3f5"] { background: var(--surface2) !important; }
:root.is-dark #card-body font[color="#6c757d"], :root.is-dark #card-body font[color="#868e96"], :root.is-dark #card-body [style*="color:#495057"],
:root.is-dark #card-body [style*="color:#555"], :root.is-dark #card-body [style*="color:#666"], :root.is-dark #card-body span[style*="color:#666"] { color: var(--muted) !important; }
:root.is-dark #card-body font[color="#343a40"], :root.is-dark #card-body font[color="#1d3557"], :root.is-dark #card-body font[color="#111"] { color: var(--text) !important; }
:root.is-dark #card-body div[style*="background:#fff"] { background: transparent !important; color: var(--text) !important; }
:root.is-dark #card-body table[border], :root.is-dark #card-body table[border] td, :root.is-dark #card-body table[border] th { border-color: var(--line) !important; }

/* field guide inside cards */
a.hunting-id { display: inline-flex; align-items: center; min-height: 36px; margin: 6px 0 2px; padding: 0 12px; border: 1px solid var(--line); border-radius: 999px;
               background: var(--surface2); color: var(--text); text-decoration: none; font-size: .9em; font-weight: 600; }
a.hunting-id.open { background: var(--g700); color: #fff; border-color: var(--g700); }
.guide { margin: 8px 0 10px; padding: 10px; background: var(--surface2); border-radius: 12px; font-size: .92em; }
.g-photos { display: flex; gap: 8px; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 4px; }
.g-photos figure { margin: 0; flex: 0 0 min(260px, 85%); scroll-snap-align: start; }
.g-photos img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 8px; display: block; background: var(--line); cursor: zoom-in; }
.g-photos figcaption { font-size: .78em; color: var(--muted); margin-top: 3px; line-height: 1.25; }
.g-photos figcaption b { font-size: 1.05em; color: var(--text); }
.g-photos figcaption a { color: var(--muted); }
.g-photos figure.g-drawing img { object-fit: contain; background: #fff; border: 1px solid var(--line); }
.g-sec { margin-top: 10px; }
.g-h { font-weight: 700; }
.g-sec ul { margin: 3px 0 0; padding-left: 20px; }
.g-sec li { margin: 3px 0; }
.g-legal { border-left: 3px solid var(--ok); padding-left: 8px; }
.g-warn { border-left: 3px solid var(--danger); padding-left: 8px; }
.g-more { margin-top: 10px; color: var(--muted); }

/* ---------------------------------------------------------------- map buttons, controls */
#fabs { position: absolute; right: 12px; bottom: 36px; z-index: 11; display: flex; flex-direction: column; gap: 10px; }
.fab { width: 54px; height: 54px; border-radius: 50%; border: 0; background: var(--surface); color: var(--g700); box-shadow: var(--shadow); font-size: 1.6em;
       display: flex; align-items: center; justify-content: center; }
:root.is-dark .fab { color: var(--g400); }
#fab-compass span { display: inline-block; color: var(--danger); transition: transform .15s; }
body.card-open:not(.phone) #fabs { right: 456px; }
.maplibregl-ctrl-geolocate { display: none !important; }
.maplibregl-ctrl-group { background: var(--surface); border-radius: 12px; box-shadow: var(--shadow); overflow: hidden; }
.maplibregl-ctrl-group button { width: 40px; height: 40px; }
:root.is-dark .maplibregl-ctrl-group button .maplibregl-ctrl-icon { filter: invert(1); }
.maplibregl-ctrl-scale { background: rgba(255,255,255,.8); border-color: var(--g900); color: var(--g900); }
:root.dim-map .maplibregl-canvas { filter: brightness(.72) saturate(.9); }
:root.dim-map.topo-on .maplibregl-canvas { filter: none; }
#tools-btn, #tools-menu { display: none !important; }

/* ---------------------------------------------------------------- dialogs, mode bar, toast, tool panel */
.dialog { position: absolute; left: 50%; top: 40px; transform: translateX(-50%); z-index: 50; width: 420px; max-width: calc(100% - 20px); max-height: calc(100% - 60px);
          overflow: auto; background: var(--surface); color: var(--text); border-radius: var(--r); box-shadow: var(--shadow); padding: 16px 18px; }
.dialog h2 { font-size: 1.15em; margin: 0 0 10px; }
.dialog label { display: block; margin: 10px 0; font-weight: 600; font-size: .9em; }
.dialog label input, .dialog label select, .dialog label textarea { display: block; margin-top: 4px; }
.dialog label.check { display: flex; gap: 8px; align-items: center; font-weight: 400; }
.dialog label.check input { width: 20px; min-height: 0; }
.dialog .buttons { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }
.dialog .buttons button { min-height: 44px; padding: 0 18px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface2); color: var(--text); }
.dialog .buttons button.primary { background: var(--primary); color: var(--primary-text); border: 0; }
#print-estimate { font-size: .85em; color: var(--muted); min-height: 2.6em; }
#print-estimate.warn { color: var(--warn); }
#point-winds { border: 1px solid var(--line); border-radius: 10px; padding: 6px 10px; margin: 8px 0; }
#point-winds legend { font-size: .9em; font-weight: 600; }
#point-winds label { display: inline-flex; align-items: center; gap: 4px; margin: 4px 10px 4px 0; font-weight: 600; }
#point-winds label input { display: inline-block; width: 20px; min-height: 0; margin: 0; }
#mode-bar { position: absolute; left: 50%; top: 12px; transform: translateX(-50%); z-index: 30; background: var(--g900); color: #fff; border-radius: var(--r);
            padding: 10px 12px; box-shadow: var(--shadow); width: max-content; max-width: calc(100% - 24px); }
.mode-buttons { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
#mode-bar button { min-height: 42px; padding: 0 14px; border-radius: 10px; border: 1px solid rgba(255,255,255,.3); background: rgba(255,255,255,.1); color: #fff; }
#mode-bar button.primary { background: var(--g400); color: var(--g900); border: 0; }
#toast { position: absolute; left: 50%; bottom: 40px; transform: translateX(-50%); z-index: 70; background: var(--g900); color: #fff; border-radius: 12px; padding: 12px 16px;
         max-width: min(90%, 520px); box-shadow: var(--shadow); }
#tool-panel { position: absolute; z-index: 20; top: 12px; left: 50%; transform: translateX(-50%); width: min(400px, calc(100% - 24px)); max-height: 60vh; overflow-y: auto;
              background: var(--surface); color: var(--text); border-radius: var(--r); box-shadow: var(--shadow); padding: 10px 14px; font-size: .95em; }
.tp-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; font-size: 1.05em; }
#tp-close { width: 44px; height: 44px; border: 0; background: none; color: var(--muted); font-size: 1.6em; line-height: 1; border-radius: 10px; }
.tp-read { margin: 6px 0; }
.tp-buttons { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
#tool-panel button:not(#tp-close) { min-height: 42px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface2); color: var(--text); }
#tool-panel label { display: block; margin: 6px 0; font-weight: 600; font-size: .9em; }
#tool-panel input:not([type=range]):not([type=checkbox]), #tool-panel select { min-height: 42px; border: 1px solid var(--line); border-radius: 10px; padding: 4px 10px;
  background: var(--surface); color: var(--text); max-width: 100%; }
#tool-panel input[type=range] { width: 100%; accent-color: var(--primary); }
.tp-coords { border-collapse: collapse; width: 100%; }
.tp-coords th { text-align: left; font-weight: 600; padding: 4px 6px 4px 0; white-space: nowrap; }
.tp-coords td { padding: 4px; font-family: ui-monospace, monospace; font-size: .85em; }
.tp-coords button { min-height: 34px !important; }
.tp-chart { width: 100%; height: auto; background: var(--surface2); border: 1px solid var(--line); border-radius: 8px; }
:root.is-dark .tp-chart text { fill: var(--text); }
.tp-arrow-wrap { text-align: center; }
.tp-arrow { display: inline-block; font-size: 4.5rem; line-height: 1; color: var(--g600); transition: transform .2s; }
#swipe-map { position: absolute; inset: 0; z-index: 5; pointer-events: none; }
#swipe-bar { position: absolute; top: 0; bottom: 0; z-index: 6; width: 4px; margin-left: -2px; background: #fff; box-shadow: 0 0 4px rgba(0,0,0,.5); cursor: ew-resize; touch-action: none; }
#swipe-bar span { position: absolute; top: 50%; left: -20px; width: 44px; height: 44px; margin-top: -22px; border-radius: 50%; background: #fff; color: var(--g900);
                  box-shadow: 0 1px 4px rgba(0,0,0,.4); display: flex; align-items: center; justify-content: center; font-size: 1.25rem; }
#tabbar { display: none; }

/* ---------------------------------------------------------------- phone */
@media (max-width: 839px) {
  :root { --tabh: calc(64px + env(safe-area-inset-bottom, 0px)); }
  #bar { position: fixed; top: 0; left: 0; right: 0; height: auto; padding: calc(8px + env(safe-area-inset-top, 0px)) 10px 8px; background: none; gap: 8px; pointer-events: none; }
  #bar > * { pointer-events: auto; }
  .brand, #views, #species, #add-btn, #account-btn { display: none !important; }
  #search-box { flex: 1; margin: 0; }
  #search { height: 50px; box-shadow: var(--shadow); font-size: 1rem; }
  #date { height: 50px; padding: 0 14px; background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
  #date.set { background: var(--g400); color: var(--g900); }
  #date-label { font-weight: 700; }
  #results { position: fixed; left: 10px; right: 10px; top: calc(66px + env(safe-area-inset-top, 0px)); width: auto; max-height: 60vh; }
  main { position: fixed; left: 0; right: 0; top: 0; bottom: var(--tabh); }
  #side, #card { position: fixed; left: 0; right: 0; top: auto; bottom: var(--tabh); width: auto; max-width: none; margin: 0 !important; border: 0;
                 border-radius: 28px 28px 0 0; box-shadow: 0 -6px 24px rgba(0,0,0,.22); z-index: 18; height: 52vh;
                 transition: height .34s cubic-bezier(.2, .9, .25, 1);   /* one curve for every move: fast out, soft landing */
                 display: flex; flex-direction: column; background: var(--surface); }
  #side.dragging, #card.dragging { transition: none; }
  #card { z-index: 19; }
  #side .sheet-handle, #card-head .sheet-handle { display: block; width: 32px; height: 4px; border-radius: 2px; background: var(--muted); opacity: .4; margin: 10px auto 8px; flex: none; }
  #side .sheet-handle { touch-action: none; }
  #card-head { padding: 0 56px 10px 16px; cursor: grab; }
  #card-close { top: 10px; }
  .side-tabs { display: none; }
  .hit-head.here { display: none; }
  #fabs { position: fixed; right: 12px; bottom: calc(var(--tabh) + 18px); }
  body.sheet-open #fabs { display: none; }
  .maplibregl-ctrl-top-left .maplibregl-ctrl-zoom-in, .maplibregl-ctrl-top-left .maplibregl-ctrl-zoom-out { display: none; }
  .maplibregl-ctrl-top-left { display: none; }
  .maplibregl-ctrl-bottom-left, .maplibregl-ctrl-bottom-right { bottom: 0; }
  #tabbar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; height: var(--tabh); padding-bottom: env(safe-area-inset-bottom, 0px); z-index: 25;
            background: var(--surface); border-top: 1px solid var(--line); }
  #tabbar button { flex: 1; border: 0; background: none; color: var(--muted); display: flex; flex-direction: column; align-items: center; justify-content: center;
                   gap: 2px; font-size: .75em; font-weight: 600; position: relative; }
  #tabbar button span { font-size: 1.55em; line-height: 1; filter: grayscale(.4); }
  #tabbar button.on { color: var(--text); }
  #tabbar button.on span { filter: none; }
  #tabbar button.on::before { content: ''; position: absolute; top: 0; left: 25%; right: 25%; height: 3px; border-radius: 0 0 3px 3px; background: var(--accent); }
  #pane-views:not([hidden]) { display: block; }
  .dialog { top: calc(10px + env(safe-area-inset-top, 0px)); left: 10px; right: 10px; transform: none; width: auto; max-width: none; max-height: calc(100% - 20px); }
  #mode-bar { top: calc(70px + env(safe-area-inset-top, 0px)); left: 10px; right: 10px; transform: none; width: auto; }
  #toast { bottom: calc(var(--tabh) + 84px); position: fixed; }
  #tool-panel { position: fixed; top: auto; bottom: calc(var(--tabh) + 8px); left: 8px; right: 8px; width: auto; transform: none; max-height: 48vh; }
  .tool-grid { grid-template-columns: repeat(3, 1fr); }
  .popover { left: 10px; right: 10px; width: auto; }
}

/* ---------------------------------------------------------------- photo viewer (lightbox.js) */
#lightbox { position: fixed; inset: 0; z-index: 1000; background: #0b120b; display: none; flex-direction: column; }
#lightbox.open { display: flex; }
#lightbox .lb-stage { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; overflow: hidden; touch-action: none; cursor: zoom-in; }
#lightbox img { max-width: 100%; max-height: 100%; object-fit: contain; transform-origin: center; user-select: none; -webkit-user-drag: none; }
#lightbox .lb-cap { position: relative; z-index: 1; background: #0b120b; color: #e9ecef; font-size: 0.8125rem; padding: 8px 16px calc(14px + env(safe-area-inset-bottom, 0px)); text-align: center; max-height: 25vh; overflow: auto; }
#lightbox .lb-cap a { color: #ced4da; }
#lightbox button { position: absolute; z-index: 2; border: 1px solid rgba(255,255,255,.35); background: rgba(0,0,0,.5); color: #fff; border-radius: 50%;
                   width: 48px; height: 48px; font-size: 1.875rem; line-height: 1; cursor: pointer; }
#lightbox .lb-close { top: calc(10px + env(safe-area-inset-top, 0px)); right: 10px; }
#lightbox .lb-prev { left: 10px; top: 50%; margin-top: -24px; }
#lightbox .lb-next { right: 10px; top: 50%; margin-top: -24px; }

/* hiking: difficulty tones, the trail card's elevation profile + buttons */
.tone-blue { background: #1e88e5; } .tone-black { background: #111; } .tone-grey { background: #868e96; }
.hike-profile { margin: 4px 0 8px; }
.hike-profile .prof { width: 100%; height: auto; max-width: 480px; display: block; }
.prof-line { fill: none; stroke: var(--accent, #4f772d); stroke-width: 2; }
.prof-fill { fill: var(--accent, #4f772d); opacity: .15; }
.hike-profile text { font-size: 0.625rem; fill: var(--muted, #6c757d); }
.hike-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0 10px; }
.hike-actions .btn { display: inline-block; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line, #ccc); text-decoration: none; color: inherit; font-weight: 600; }

.hike-row { display: block; width: 100%; text-align: left; padding: 10px 8px; border: 0; border-bottom: 1px solid var(--line, #ddd); background: none; color: inherit; cursor: pointer; }
.hike-row .tone { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; }
#tp-body .chip.on { background: var(--hl); color: var(--green-ink); }

.g-banner { font-weight: 700; padding: 8px; margin: 6px 0; }
h2.g-group { margin-top: 28px; border-bottom: 2px solid currentColor; }

.hit-head.extra { display: flex; margin-top: 6px; background: rgba(29, 127, 196, .12); }
.hit-head.extra small { color: var(--muted); font-weight: 400; }

/* the card: what you tapped that has no card of its own (land, parks, WMU, closures) - named above What's here */
.tapped-quiet { margin: 4px 0 8px; padding: 6px 8px; border-radius: 6px; background: var(--surface2);
    font-size: 0.8125rem; line-height: 1.6; }
.tapped-quiet span { display: inline-flex; align-items: center; gap: 4px; margin-right: 10px; font-weight: 600; }
.tapped-quiet small { color: var(--muted); font-weight: normal; }

/* first-open "not legal advice" note: centred over everything, the map dimmed behind it */
#terms-dialog { position: fixed; top: 50%; left: 50%; right: auto; bottom: auto; transform: translate(-50%, -50%); z-index: 1000;
    width: min(420px, calc(100% - 24px)); max-width: none; max-height: calc(100% - 32px); margin: 0;
    box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .45), var(--shadow); }
#terms-dialog ul { padding-left: 20px; }

/* under every card: share / report */
.card-actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 18px 0 6px; padding-top: 12px; border-top: 1px solid var(--line); }
.card-actions button { flex: 1 1 140px; min-height: 42px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface2); color: var(--text); font-weight: 600; }
#report-dialog { position: fixed; top: 50%; left: 50%; right: auto; transform: translate(-50%, -50%); z-index: 1000;
    width: min(440px, calc(100% - 24px)); max-width: none; max-height: calc(100% - 32px);
    box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .45), var(--shadow); }
#report-dialog textarea, #report-dialog input, #report-dialog select { width: 100%; box-sizing: border-box; }
#me-reports .report { padding: 8px 0; border-bottom: 1px solid var(--line); }
#me-reports .report button { margin: 6px 6px 0 0; min-height: 36px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface2); color: var(--text); }

/* find a layer */
#layer-filter { width: 100%; box-sizing: border-box; margin: 6px 0 8px; min-height: 40px; padding: 0 12px; border-radius: 10px;
    border: 1px solid var(--line); background: var(--surface); color: var(--text); font-size: 1em; }

/* ================================================================ 0.6 clean modern: Inter, line icons, the app's controls */
@font-face { font-family: Inter; src: url(fonts/ui/Inter-Regular.woff2) format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: Inter; src: url(fonts/ui/Inter-Medium.woff2) format('woff2'); font-weight: 500; font-display: swap; }
@font-face { font-family: Inter; src: url(fonts/ui/Inter-SemiBold.woff2) format('woff2'); font-weight: 600; font-display: swap; }
@font-face { font-family: Inter; src: url(fonts/ui/Inter-Bold.woff2) format('woff2'); font-weight: 700 800; font-display: swap; }
@font-face { font-family: 'Material Symbols Outlined'; src: url(fonts/ui/material-symbols.woff2) format('woff2'); font-weight: 400; font-display: block; }
html, body { -webkit-font-smoothing: antialiased; }
.ms { font-family: 'Material Symbols Outlined'; font-weight: normal; font-style: normal; font-size: 1.25em; line-height: 1; letter-spacing: normal;
      text-transform: none; display: inline-block; white-space: nowrap; direction: ltr; vertical-align: -0.22em; font-feature-settings: 'liga';
      -webkit-font-smoothing: antialiased; font-variation-settings: 'FILL' 0, 'wght' 400, 'opsz' 24; }
.has-ms { gap: 8px; }
b, strong { font-weight: 600; }

/* top bar (PC): ink, white pills */
#bar { height: 60px; padding: 0 16px; }
.brand { gap: 10px; font-weight: 700; letter-spacing: -.01em; }
.brand .logo { display: inline-flex; font-size: 1em; }
#views button, #species, .top-btn, #date { height: 36px; background: rgba(255,255,255,.08); font-weight: 500; padding: 0 14px; }
#views button.on, :root.is-dark #views button.on { background: #fff; color: #0F172A; font-weight: 600; }
#date.set { background: #DCFCE7; color: #166534; font-weight: 600; }
.top-btn.primary { background: var(--green); color: #fff; font-weight: 600; }
:root.is-dark .top-btn.primary { color: #0B0F14; }
#search { border-radius: 12px; height: 40px; }
#search:focus { box-shadow: 0 0 0 3px rgba(22,163,74,.35); }
.search-icon .ms { font-size: 1.25rem; color: var(--muted); }
.search-icon { opacity: 1; display: inline-flex; }

/* side panel */
.side-tabs button { font-weight: 500; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.side-tabs button[aria-selected=true] { color: var(--text); font-weight: 600; border-bottom-color: var(--green); }
.pane h3 { font-size: 0.75rem; font-weight: 700; letter-spacing: .08em; }
.field select, .dialog input, .dialog select, .dialog textarea, .setting select, #spot-filter, #layer-filter {
  border-radius: 12px; border-color: var(--line); background: var(--surface2); }
#layer-filter { min-height: 44px; border: 0; }

/* buttons */
button.primary, .primary { border-radius: 12px; }
.big-list button { border-radius: 14px; background: var(--surface); flex-direction: row; align-items: center; justify-content: flex-start; flex-wrap: wrap;
                   gap: 0 12px; font-weight: 600; }
.big-list button > .ms { width: 40px; height: 40px; border-radius: 12px; background: var(--surface2); display: inline-flex; align-items: center;
                         justify-content: center; font-size: 1.375rem; flex: none; }
.big-list button small { flex-basis: 100%; padding-left: 52px; margin-top: -4px; }
.big-list button.on { background: var(--hl); border-color: var(--green); }
.big-list button:hover, .tool-grid button:hover { border-color: var(--line2, #CBD5E1); background: var(--surface2); }
.chip { min-height: 36px; border-radius: 999px; border-color: var(--line); background: var(--surface); font-weight: 500; }
.chip.on { background: var(--primary); color: var(--primary-text); border-color: var(--primary); font-weight: 600; }
.lidar-box .chip.on, #tp-body .chip.on { background: var(--hl); color: var(--green-ink); border-color: transparent; }
.tool-grid button { background: var(--surface); border-radius: 16px; font-weight: 500; }
.tool-grid button span, .tool-grid button .ms { font-size: 1.625rem; color: var(--text); }
.seg { border: 0; padding: 4px; gap: 4px; border-radius: 12px; }
.seg button { min-height: 36px; font-weight: 500; }
.seg button.on, :root.is-dark .seg button.on { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: 0 1px 3px rgba(15,23,42,.14); }
:root.is-dark .seg button.on { background: var(--line); }
input[type=checkbox], input[type=radio] { accent-color: var(--green); }
.avatar { background: var(--hl); color: var(--green-ink); }

/* layers: switch-style toggles */
#layers summary { font-weight: 600; }
#layers label { align-items: center; }
#layers input[type=checkbox] { appearance: none; -webkit-appearance: none; flex: none; order: 9; width: 40px; height: 24px; margin: 0 0 0 auto; border-radius: 12px;
  background: var(--line); position: relative; cursor: pointer; transition: background .15s; }
#layers input[type=checkbox]::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 2px rgba(15,23,42,.3); transition: left .15s; }
#layers input[type=checkbox]:checked { background: var(--green); }
#layers input[type=checkbox]:checked::after { left: 19px; }
.sw { border-radius: 3px; border-color: rgba(15,23,42,.18); }
ul.legend { margin-left: 30px; }

/* the card */
#card-head { padding: 14px 56px 12px 18px; }
.pk-title { font-size: 1.15em; font-weight: 700; letter-spacing: -.01em; }
.tone { width: 10px; height: 10px; box-shadow: none; }
.pk-row { gap: 6px; margin-top: 8px; color: var(--text); font-size: .88em; }
.pk-row span { background: var(--surface2); border-radius: 8px; padding: 4px 10px; font-weight: 500; display: inline-flex; align-items: center; gap: 6px; }
.pk-row span .ms { font-size: 1rem; color: var(--muted); }
.pk-warn span, :root.is-dark .pk-warn span { border-radius: 8px; font-weight: 600; }
:root:not(.is-dark) .pk-warn span { background: #FEE2E2; color: #991B1B; }
#card-close { border-radius: 50%; width: 36px; height: 36px; top: 12px; right: 12px; background: var(--surface2); font-size: 1.3em; }
#card-body { background: var(--bg); padding: 8px 14px 28px; }
#card-body > details, #card-body .land-fold { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 0 14px; margin: 8px 0; }
#card-body > details > summary { font-weight: 600; display: flex; align-items: center; gap: 8px; list-style: none; }
#card-body > details > summary::-webkit-details-marker { display: none; }
#card-body > details > summary::after { content: 'expand_more'; font-family: 'Material Symbols Outlined'; margin-left: auto; color: var(--muted); font-size: 1.375rem;
  transition: transform .15s; font-weight: normal; }
#card-body > details[open] > summary::after { transform: rotate(180deg); }
#card-body > details > summary .ms { color: var(--green); }
#card details details { border-top: 1px solid var(--line); margin: 0; }
.hit-head { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.hit-head.lake { background: rgba(14, 165, 233, .08); }
.badge { background: #0F172A; }
.card-actions { border-top: 0; }
.card-actions button { border-radius: 12px; min-height: 46px; background: var(--surface); display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.card-actions button:first-child { background: var(--primary); color: var(--primary-text); border-color: var(--primary); }
a.hunting-id { border-radius: 12px; background: var(--surface); }
a.hunting-id.open { background: var(--primary); color: var(--primary-text); border-color: var(--primary); }

/* map buttons: white rounded squares, one style */
#fabs { gap: 12px; }
.fab, :root.is-dark .fab { width: 48px; height: 48px; border-radius: 14px; color: var(--text); font-size: 1.375rem; box-shadow: 0 4px 16px rgba(15,23,42,.16); }
.fab .ms { font-size: 1.5rem; }
.maplibregl-ctrl-group { border-radius: 14px; }
.maplibregl-ctrl-scale { border-color: #0F172A; color: #0F172A; border-radius: 0 0 3px 3px; }

/* dialogs, bars, toast */
.dialog { border-radius: 20px; padding: 20px 22px; }
.dialog h2 { font-weight: 700; letter-spacing: -.01em; display: flex; align-items: center; gap: 8px; }
.dialog .buttons button { border-radius: 12px; font-weight: 600; }
#mode-bar, #toast { background: #0F172A; color: #fff; }
:root.is-dark #mode-bar, :root.is-dark #toast { background: #1A222C; }
#mode-bar button.primary { background: var(--green); color: #fff; }
#tool-panel { border-radius: 18px; }
#tool-panel button:not(#tp-close), .point-tools button { border-radius: 12px; display: inline-flex; align-items: center; gap: 6px; }
.tp-arrow { color: var(--green); }

@media (max-width: 839px) {
  #bar { padding: calc(8px + env(safe-area-inset-top, 0px)) 16px 8px; }
  #search { height: 48px; border-radius: 14px; }
  #date { height: 48px; border-radius: 14px; background: var(--surface); color: var(--text); font-weight: 500; }
  #date.set { background: #DCFCE7; color: #166534; }
  :root.is-dark #date.set { background: #14532D; color: #BBF7D0; }
  #side, #card { border-radius: 22px 22px 0 0; box-shadow: 0 -4px 24px rgba(15,23,42,.14); }
  #side .sheet-handle, #card-head .sheet-handle { width: 36px; height: 4px; background: #CBD5E1; }
  :root.is-dark #side .sheet-handle, :root.is-dark #card-head .sheet-handle { background: #334155; }
  #fabs { right: 16px; }
  #tabbar button { font-weight: 500; font-size: 0.6875rem; gap: 3px; }
  #tabbar button span, #tabbar button .ms { font-size: 1.5rem; filter: none; }
  #tabbar button.on { color: var(--green); font-weight: 600; }
  #tabbar button.on::before { display: none; }
}

/* cell tower card (build_cell.py) */
.cell-badge { display: inline-block; padding: 1px 9px; margin: 2px 2px 2px 0; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface); font-weight: 600; font-size: 0.8125rem; }
.cell-ll { font-variant-numeric: tabular-nums; }
.cell-copy { margin-left: 6px; padding: 2px 10px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface);
  color: inherit; font: inherit; font-size: 0.8125rem; cursor: pointer; }

/* 3D button (map controls, top left) */
.maplibregl-ctrl-group .btn-3d { width: 48px; height: 48px; font: 700 0.9375rem/1 inherit; color: var(--text); }
.maplibregl-ctrl-group .btn-3d.on, .maplibregl-ctrl-group .btn-3d.on:hover { background: var(--text) !important; color: var(--bg) !important; }

/* Plan a trip (plan.js, redesign phase 3) */
#pane-plan h3 { margin: 18px 0 6px; }
.plan-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: end; }
.plan-row .field { flex: 1; min-width: 130px; }
.plan-btn { min-height: 44px; padding: 8px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font: inherit; font-weight: 600; cursor: pointer; margin: 4px 0; }
.plan-btn.primary { background: var(--text); color: var(--bg); border-color: var(--text); }
.plan-btn.danger { color: var(--danger); }
.plan-back { border: 0; background: none; color: var(--link); font: inherit; cursor: pointer; padding: 8px 0; }
.plan-list { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.plan-trip { text-align: left; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font: inherit; cursor: pointer; min-height: 48px; }
.plan-trip small { display: block; color: var(--muted); margin-top: 2px; }
.plan-trip.past { opacity: .6; }
.plan-table-wrap { overflow-x: auto; margin: 0 -4px; }
.plan-table { width: 100%; border-collapse: collapse; font-size: 0.8125rem; }
.plan-table th { text-align: left; font-weight: 600; color: var(--muted); padding: 6px 4px; border-bottom: 1px solid var(--line); cursor: pointer; white-space: nowrap; }
.plan-table th.on { color: var(--text); }
.plan-table td { padding: 8px 4px; border-bottom: 1px solid var(--line); vertical-align: top; }
.plan-table tr[data-fly] { cursor: pointer; }
.plan-table tr[data-fly]:hover td { background: var(--surface2); }
.plan-score { letter-spacing: 1px; color: var(--text); white-space: nowrap; }
.plan-star { border: 0; background: none; font-size: 1.25rem; cursor: pointer; color: var(--muted); min-width: 32px; min-height: 32px; }
.plan-star.on { color: #d97706; }
.plan-st { display: inline-block; width: 18px; text-align: center; font-weight: 700; }
.plan-st-ok { color: #0369A1; } .plan-st-check { color: #B45309; } .plan-st-no { color: #9F1239; }
#pane-plan textarea { width: 100%; box-sizing: border-box; font: inherit; padding: 8px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--text); }
.plan-save { margin-top: 12px; }

/* (2026-11-18) your own version of a mode + fil's "save as default"; the quick swap chip in the view bar */
#mode-tools:empty { display: none; }
#mode-tools { margin: 0 0 10px; display: grid; gap: 6px; }
#mode-tools .hint { margin: 0; }
#mode-tools .linkish { background: none; border: 0; padding: 0; color: var(--g600, #16A34A); font: inherit; font-weight: 600; cursor: pointer; text-decoration: underline; }
#mode-tools .btn-secondary { border: 1px solid currentColor; background: transparent; color: inherit; border-radius: 10px; padding: 8px 10px; font: inherit; cursor: pointer; text-align: left; }
#views button.swap { font-weight: 700; }
#views button.swap[hidden] { display: none; }

/* basemap chip (2026-11-18): bottom left over the map, a small drop-down */
#bm-chip { position: relative; margin: 8px 0 0 10px; clear: both; }
#bm-btn { display: inline-flex; align-items: center; justify-content: center; gap: 0; width: 36px; height: 36px; padding: 0; border: 0; border-radius: 999px; background: var(--surface);
  color: var(--text); font: inherit; font-weight: 600; box-shadow: 0 4px 16px rgba(15,23,42,.16); cursor: pointer; }
#bm-btn .ic svg, #bm-menu .ic svg { width: 16px; height: 16px; display: block; }
#bm-btn .caret, #bm-btn .t { display: none; }
#bm-btn .ic svg { width: 20px; height: 20px; }
#bm-menu { position: absolute; left: 0; top: 40px; min-width: 150px; background: var(--surface); color: var(--text); border-radius: 12px; padding: 4px;
  box-shadow: 0 8px 28px rgba(15,23,42,.22); display: grid; }
#bm-menu[hidden] { display: none; }
#bm-menu button { display: flex; align-items: center; gap: 8px; padding: 9px 10px; border: 0; background: none; color: inherit; font: inherit; border-radius: 8px; cursor: pointer; text-align: left; }
#bm-menu button:hover { background: rgba(127,127,127,.12); }
#bm-menu .ok { margin-left: auto; font-weight: 700; }

/* ---- the tap card's six parts (tier.js, 2026-11-19) */
.tier { display: flex; flex-direction: column; gap: 10px; margin: 2px 0 8px; }
.tier-kind { display: flex; align-items: center; gap: 8px; font-size: 0.7188rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.tier-sw { width: 12px; height: 12px; border-radius: 3px; background: #6c757d; }
.tier-sw.tone-green { background: #16A34A; } .tier-sw.tone-blue { background: #2563EB; } .tier-sw.tone-red { background: #DC2626; }
.tier-sw.tone-orange { background: #EA580C; } .tier-sw.tone-purple { background: #7B2CBF; }
.tier-title { margin: -4px 0 0; font-size: 1.3125rem; line-height: 1.2; font-weight: 700; }
.tier-sub { font-size: 0.8125rem; color: var(--muted); margin-top: -6px; }
.tier-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.tier-chips span { font-size: 0.7812rem; padding: 4px 10px; border-radius: 999px; background: var(--surface2); font-weight: 500; }
.tier-verdict, .tier-alert { display: flex; gap: 10px; align-items: center; padding: 11px 12px; border-radius: 14px; font-weight: 600; line-height: 1.3; }
.tier-verdict { font-size: 0.9688rem; }
.tier-alert { font-size: 0.875rem; padding: 9px 12px; border-radius: 12px; }
.tier-mark { flex: none; width: 24px; height: 24px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
             color: #fff; font-size: 0.8125rem; font-weight: 700; background: #64748B; }
.st-ok { background: #DCFCE7; color: #166534; } .st-ok .tier-mark { background: #16A34A; }
.st-check { background: #FFEDD5; color: #9A3412; } .st-check .tier-mark { background: #EA580C; }
.st-no { background: #FEE2E2; color: #991B1B; } .st-no .tier-mark { background: #DC2626; }
.st-neutral { background: var(--surface2); color: var(--text); }
.st-ink-ok { color: #166534; font-weight: 600; } .st-ink-check { color: #9A3412; font-weight: 600; } .st-ink-no { color: #991B1B; font-weight: 600; }
.tier-here { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.tier-fact { display: flex; flex-direction: column; gap: 2px; padding: 9px 11px; border-radius: 12px; background: var(--surface2); min-width: 0; }
.tf-l, .tier-cap { font-size: 0.6875rem; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.tf-v { font-size: 0.9062rem; font-weight: 700; line-height: 1.3; }
.tf-n { font-size: 0.7812rem; color: var(--muted); line-height: 1.3; }
.tier-next { display: flex; flex-direction: column; gap: 4px; }
.tier-next .tn { display: flex; gap: 10px; align-items: baseline; font-size: 0.875rem; }
.tier-next .tn b { min-width: 84px; font-size: 0.8125rem; color: var(--green-ink); }
.tier-quiet { font-size: 0.8125rem; color: var(--green-ink); }
details.tier-all { border-top: 1px solid var(--line); margin-top: 6px; }
details.tier-all > summary { min-height: 48px; display: flex; align-items: center; font-weight: 600; font-size: 0.9375rem; cursor: pointer; }
:root.is-dark .st-ok { background: #14532D; color: #BBF7D0; } :root.is-dark .st-check { background: #431407; color: #FED7AA; }
:root.is-dark .st-no { background: #450A0A; color: #FECACA; }
:root.is-dark .st-ink-ok { color: #86EFAC; } :root.is-dark .st-ink-check { color: #FDBA74; } :root.is-dark .st-ink-no { color: #FCA5A5; }
#card:not([data-state="full"]) #card-body .tier > .in-strip { display: none; }   /* full card: the big header scrolls with the body */
.tier-strip { gap: 6px; margin: 0; padding-right: 8px; }
.tier-strip .tier-verdict { margin-top: 4px; }
/* the chips: every layer under the finger (2026-11-19) */
.tier-mapchips { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.mc-hint { text-transform: none; letter-spacing: 0; font-weight: 400; margin-left: 6px; }
.mc-row { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.mc-row::-webkit-scrollbar { display: none; }
.mchip { flex: none; display: inline-flex; align-items: center; gap: 7px; min-height: 36px; padding: 0 12px; border-radius: 999px;
         border: 0; background: var(--surface2); color: var(--text); font: inherit; font-size: 0.8125rem; font-weight: 500; cursor: pointer;
         -webkit-touch-callout: none; user-select: none; touch-action: pan-x; }
.mchip.on { background: var(--text); color: var(--surface); }
.mchip.off span { text-decoration: line-through; opacity: .6; }
.mchip.off .sw { opacity: .3; }
.mc-row { mask-image: linear-gradient(90deg, #000 85%, transparent); -webkit-mask-image: linear-gradient(90deg, #000 85%, transparent); padding-right: 24px; }

/* (2026-11-19) the sheet's parts: actions in reach on the short card, the layer a swipe picked, a compact bar when full */
.tier-actions { display: flex; gap: 8px; margin-top: 2px; }
.tier-actions > * { flex: none; min-height: 40px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface);
                    color: var(--text); font: inherit; font-size: 0.8438rem; font-weight: 600; display: inline-flex; align-items: center; text-decoration: none; cursor: pointer; }
.tier-actions .ta-main { background: var(--primary); color: var(--primary-text); border-color: var(--primary); }
.tier-pick { display: flex; align-items: center; gap: 8px; font-size: 0.8125rem; padding: 8px 10px; border-radius: 10px; background: var(--surface2); }
.tier-pick[hidden] { display: none; }
#card[data-state="full"] .tier-strip > :not(.tier-title) { display: none; }
#card[data-state="full"] .tier-strip .tier-title { font-size: 1.0625rem; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#card[data-state="full"] #card-head { box-shadow: 0 1px 0 var(--line); }
.tier-sw.tone-yellow { background: #E9C23B; }
/* (roadmap 28/30/34) layer groups: counts, turn all off, zoom-in notes, the colours page */
#layers summary .gcount { color: var(--muted); font-weight: 400; font-size: .9em; }
#layers summary .goff { float: right; border: 0; background: none; color: var(--link); font: inherit; font-size: .85em; cursor: pointer; padding: 0 4px; }
#layers label.needs-zoom::after { content: "Zoom in to see it"; display: block; margin-left: 28px; font-size: .82em; color: var(--link); }
.linkish { border: 0; background: none; color: var(--link); font: inherit; padding: 6px 0; cursor: pointer; text-align: left; }
#colours-dialog { border: 0; border-radius: 20px; padding: 20px 22px; max-width: 440px; background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
#colours-dialog::backdrop { background: rgba(0,0,0,.4); }
#colours-dialog ul { list-style: none; padding: 0; margin: 8px 0; display: flex; flex-direction: column; gap: 10px; }
#colours-dialog li { display: grid; grid-template-columns: 20px 1fr; column-gap: 10px; font-size: 0.875rem; }
#colours-dialog li i { width: 16px; height: 16px; border-radius: 4px; background: var(--c); grid-row: span 2; margin-top: 2px; }
#colours-dialog li b { display: block; }
#colours-dialog form button { margin-top: 8px; min-height: 40px; padding: 0 18px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface2); color: var(--text); font: inherit; }

/* ---- 2026-11-19: for hunters who aren't map people (simple.js) */
#big-here { position: absolute; left: calc(var(--side) + 12px); bottom: 36px; z-index: 11; display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
body.side-closed:not(.phone) #big-here { left: 12px; }
.big-ask { min-height: 58px; padding: 0 24px; border: 0; border-radius: 999px; background: #2b8a3e; color: #fff;
           font-size: 1.2em; font-weight: 700; box-shadow: var(--shadow); cursor: pointer; }
.big-ask:disabled { opacity: .75; }
.big-ask, .big-chip { display: inline-flex; align-items: center; gap: 8px; }
.big-ic { width: 24px; height: 24px; flex: none; }
.big-chip { min-height: 50px; padding: 0 18px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--text, inherit);
            font-size: 1.05em; font-weight: 600; box-shadow: var(--shadow); cursor: pointer; }
.big-primary { width: 100%; min-height: 54px; border: 0; border-radius: 14px; background: #2b8a3e; color: #fff; font-size: 1.1em; font-weight: 700; cursor: pointer; }
.big-outline { min-height: 50px; padding: 0 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); color: inherit; font-size: 1.05em; font-weight: 600; cursor: pointer; }
#reset-map { width: 100%; margin: 4px 0 10px; }
.detail-row { display: flex; align-items: center; gap: 12px; padding: 8px 0; cursor: pointer; }
.detail-row span { flex: 1; display: flex; flex-direction: column; }
.detail-row small { color: var(--muted); font-weight: 400; }
.detail-row input { width: 22px; height: 22px; }
.tier-note { font-size: 0.75rem; color: var(--muted); margin-top: 6px; }
#answer-dialog, #help-dialog { width: min(480px, calc(100vw - 32px)); padding: 0; border: 0; border-radius: 22px; overflow: hidden; background: var(--surface); color: inherit; }
#answer-dialog::backdrop, #help-dialog::backdrop { background: rgba(0,0,0,.5); }
.ans-top { padding: 20px; color: #fff; background: #495057; }
#answer-dialog.ans-ok .ans-top { background: #2b8a3e; }
#answer-dialog.ans-no .ans-top { background: #c0262d; }
#answer-dialog.ans-private .ans-top { background: #5b5b5b; }
#answer-dialog.ans-check .ans-top { background: #f2a900; color: #212529; }
.ans-where { font-size: 0.9375rem; }
#ans-head { margin: 4px 0; font-size: 1.75rem; line-height: 1.15; }
#ans-verdict { margin: 0; font-size: 1.25rem; }
.ans-body { padding: 18px 20px 20px; display: flex; flex-direction: column; gap: 12px; }
#ans-place { margin: 0; font-size: 1.125rem; font-weight: 600; }
#ans-alerts { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; font-size: 1.0625rem; }
#ans-alerts .st-no { color: #c0262d; } #ans-alerts .st-check { color: #c45200; }
.ans-note { margin: 0; font-size: 0.875rem; color: var(--muted); }
.ans-row { display: flex; gap: 8px; } .ans-row > * { flex: 1; }
#help-dialog { padding: 20px; } #help-dialog h2 { margin: 0 0 8px; font-size: 1.5rem; } #help-dialog p { font-size: 1.0625rem; }
#help-text { width: 100%; box-sizing: border-box; font-size: 1.125rem; padding: 10px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: inherit; }
.help-shot { display: flex; align-items: center; gap: 8px; font-size: 1.0625rem; margin: 10px 0; }
.help-shot input { width: 22px; height: 22px; }
@media (max-width: 839px) {
  #big-here { position: fixed; left: 12px; bottom: calc(var(--tabh) + 62px); }
  body.card-open #big-here { display: none; }
}

/* ================================================================ 2026-11-20: the shell as the phone app (ui.js)
   tabs Map · Today · Guide · Saved; Layers + Tools on the map; the card in the left panel on a PC; the map's chips */
.pane-top { display: flex; align-items: center; gap: 8px; margin: -4px 0 8px; }
.pane-top h2 { margin: 0; }
.pane-back { border: 0; background: var(--surface2); color: var(--text); border-radius: 999px; min-height: 36px; padding: 0 12px; font: inherit; font-weight: 600; cursor: pointer; }
.big-tonal { width: 100%; min-height: 52px; margin: 14px 0 6px; border: 0; border-radius: 14px; background: var(--hl); color: var(--green-ink, var(--text));
             font: inherit; font-size: 1.02em; font-weight: 600; display: flex; align-items: center; gap: 8px; padding: 0 16px; cursor: pointer; text-align: left; }
.big-tonal .chev { margin-left: auto; font-size: 1.3em; }
#me-maplayers { margin: 4px 0 12px; }
#qk-count { color: var(--muted); font-weight: 500; }
.qk-pills, .qk-kids > div { display: flex; flex-wrap: wrap; gap: 8px; }
.qk-pills .chip { min-height: 44px; padding: 0 18px; font-size: 1.02em; }
.qk-kids { margin-top: 10px; padding: 10px 12px; border-radius: 14px; background: var(--surface2); }
.qk-kids small { display: block; color: var(--muted); margin-bottom: 6px; }
.chip.small { min-height: 34px; font-size: .92em; }
.chip.small.on { background: var(--hl); color: var(--green-ink, var(--text)); border-color: transparent; }
#qk-bm { display: flex; }
#qk-bm button { flex: 1; }
/* a layer row outside the list (favourites, on now): name + a switch that presses the real one */
.qk-row { display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 6px 2px; border-bottom: 1px solid var(--line); cursor: pointer; }
.qk-row .t { flex: 1; font-weight: 500; }
.qk-row input, #detail-switch { appearance: none; -webkit-appearance: none; flex: none; width: 44px; height: 26px; margin: 0; border-radius: 13px; background: var(--line);
  position: relative; cursor: pointer; transition: background .15s; }
.qk-row input::after, #detail-switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 2px rgba(15,23,42,.3); transition: left .15s; }
.qk-row input:checked, #detail-switch:checked { background: var(--green); }
.qk-row input:checked::after, #detail-switch:checked::after { left: 21px; }
#ml-on:empty { display: none; }
#ml-on { margin-bottom: 8px; }
/* Map layers: activity folds, closed by default, a star on each layer */
#layers details > summary, .ml-fold > summary { min-height: 52px; align-items: center; font-size: 1.02em; }
#layers .star { order: 8; flex: none; width: 36px; height: 36px; border: 0; border-radius: 50%; background: none; color: var(--muted); font-size: 1.25rem;
                line-height: 1; cursor: pointer; margin-left: auto; }
#layers .star.on { color: #E0A526; }
#layers .star:hover { background: var(--surface2); }
#layers label .t { order: 1; }
#layers input[type=checkbox] { margin-left: 4px; }
.ml-fold { border-bottom: 1px solid var(--line); }
.ml-fold > summary { padding: 12px 4px; font-weight: 600; cursor: pointer; list-style: none; display: flex; justify-content: space-between; }
.ml-fold > summary::after { content: '▾'; color: var(--muted); }
.ml-fold:not([open]) > summary::after { transform: rotate(-90deg); }
.ml-fold > :not(summary) { margin: 0 4px 12px; }
#ml-hunt-extra { padding: 4px 6px 8px; }
.lidar-op { display: flex; align-items: center; gap: 10px; font-size: .9em; color: var(--muted); }
.lidar-op input { flex: 1; }
/* the map's chips: the view you're in + Clear map (top left, under the zoom buttons on a PC, under the search on a phone) */
#map-chips { position: absolute; left: calc(var(--side) + 56px); top: 12px; z-index: 11; display: flex; gap: 8px; }
body.side-closed:not(.phone) #map-chips { left: 120px; }
.map-chip { min-height: 40px; padding: 0 14px; border: 0; border-radius: 999px; background: var(--surface); color: var(--text); font: inherit; font-weight: 500;
            box-shadow: 0 4px 16px rgba(15,23,42,.16); cursor: pointer; display: inline-flex; align-items: center; gap: 4px; }
.map-chip b { font-weight: 700; }
.map-chip.on { background: var(--text); color: var(--bg); }
/* map buttons: Layers + Tools with a word under the icon, as the phone; + for adding (logged in) */
.fab-label { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0; width: 56px !important; height: 56px !important; }
.fab-label small { font-size: 0.6875rem; font-weight: 600; line-height: 1.1; }
.fab-label .ms { font-size: 1.375rem; }
.fab-add { background: var(--green) !important; color: #fff !important; width: 56px !important; height: 56px !important; }
.fab-add[hidden], #fab-compass[hidden] { display: none; }
/* the card in the left panel on a PC: it covers the panel you came from; ← Back */
body:not(.phone) #card { left: 0; right: auto; top: 0; bottom: 0; width: var(--side); max-width: none; border-radius: 0; border: 0; border-right: 1px solid var(--line);
                         box-shadow: 4px 0 18px rgba(15,23,42,.10); z-index: 13; }
body:not(.phone) #card-head { padding: 12px 16px 12px 60px; }
body:not(.phone) #card-close { left: 10px; right: auto; font-size: 1.2em; }
body.card-open:not(.phone) #fabs { right: 12px; }
body.card-open.side-closed:not(.phone) #big-here, body.card-open.side-closed:not(.phone) #map-chips { left: calc(var(--side) + 12px); }
body.card-open.side-closed:not(.phone) #map-chips { left: calc(var(--side) + 56px); }
/* too far out for a card: one button that zooms in there */
.zoom-here { padding: 6px 0 10px; }
.zoom-here p { margin: 4px 0 12px; font-size: 1.05em; }
/* Today */
.td-date { color: var(--muted); font-weight: 600; font-size: .92em; }
.td-h { font-size: 1.7em !important; margin: 2px 0 12px !important; letter-spacing: -.01em; }
.td-light { background: #0F172A; color: #fff; border-radius: 18px; padding: 16px; display: grid; gap: 8px; }
.td-light .td-row { display: flex; justify-content: space-between; font-size: .85em; color: #CBD5E1; font-weight: 600; }
.td-big { font-size: 1.9em; font-weight: 700; }
.td-bar { height: 8px; border-radius: 4px; background: #334155; overflow: hidden; }
.td-bar i { display: block; height: 100%; background: #7DD3FC; }
.td-light small { color: #CBD5E1; }
.td-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.td-tile { background: var(--surface2); border-radius: 16px; padding: 12px; display: grid; gap: 2px; }
.td-tile small, .td-tile span { color: var(--muted); font-size: .88em; }
.td-open { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.td-open li { background: var(--surface2); border-radius: 12px; padding: 10px 12px; display: grid; gap: 2px; }
.td-open small { color: var(--muted); }
.td-acts { margin-top: 14px; }
/* Guide */
#g-lookup { padding: 10px 12px; border-radius: 14px; background: var(--surface2); }
.g-form { display: flex; gap: 10px; margin-bottom: 10px; }
.g-form label { display: grid; gap: 4px; font-size: .88em; font-weight: 600; }
.g-form input { min-height: 44px; border: 1px solid var(--line); border-radius: 10px; padding: 0 10px; background: var(--surface); color: var(--text); font: inherit; }
#g-wmu { width: 90px; text-transform: uppercase; }
.me-links { margin-top: 14px; }
@media (max-width: 839px) {
  /* you: the avatar by the search (as the phone app) */
  #account-btn { display: inline-flex !important; width: 50px; height: 50px; padding: 0; justify-content: center; border-radius: 50%; background: var(--surface);
                 color: var(--text); box-shadow: var(--shadow); font-size: 0; }
  #account-btn::before { content: attr(data-initial); font-size: 1.125rem; font-weight: 700; }
  #account-btn[data-initial=""]::before, #account-btn:not([data-initial])::before { content: 'person'; font-family: 'Material Symbols Outlined'; font-size: 1.5rem; font-weight: 400; }
  #account-btn > * { display: none; }
  #map-chips { position: fixed; left: 10px; right: 70px; top: calc(68px + env(safe-area-inset-top, 0px)); overflow-x: auto; scrollbar-width: none; }
  .map-chip { min-height: 40px; white-space: nowrap; flex: none; }
  body.sheet-open #map-chips { display: none; }
  /* 3D sits under the date, not behind it; the credits (i) clear of the buttons */
  .maplibregl-ctrl-top-right { top: calc(62px + env(safe-area-inset-top, 0px)); }
  #fabs { bottom: calc(var(--tabh) + 34px); }
}

/* ================================================================ 2026-11-21: an atlas, not a toy (fil: "way too big, way too dumbed
   down - like the Crown Land Use Policy Atlas, but better organized"). The old text sizes (14.5 / 15.5 px) in rem so the
   browser's size and Large / Largest still work; the whole layer tree and every tool in view; normal-size map buttons.
   Kept from the morning's pass: contrast (green #15803D, edges 3:1), focus rings, words on buttons, no confirm(), the truck bar. */
:root { --fs: .90625rem; --side: 360px; --edge: #64748B; --focus: #1D4ED8; --on-green: #fff;
        --g600: #15803D; --accent: #15803D; --green: #15803D; --ok: #15803D; --link: #15803D; }
:root.is-dark { --g600: #4ADE80; --accent: #4ADE80; --green: #4ADE80; --ok: #4ADE80; --link: #4ADE80; --focus: #93C5FD; --on-green: #0B0F14; }
:root[data-text="large"] { --fs: .90625rem; }
@media (max-width: 839px) { :root, :root[data-text="large"] { --fs: .96875rem; } }
html { font-size: 100%; }
:root[data-text="large"] { font-size: 112.5%; }
:root[data-text="largest"] { font-size: 125%; }
body { font-size: var(--fs); }
@media (min-width: 1440px) { :root { --side: 400px; } }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
#search:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; }

/* headings: sentence case (the 11 px capitals were hard to read), atlas-small */
.pane h3, :root .pane h3 { font-size: .8125rem; font-weight: 700; text-transform: none; letter-spacing: 0; color: var(--muted); margin: 16px 0 6px; }
.tier-kind, .tf-l, .tier-cap, #results li.head { text-transform: none; letter-spacing: 0; }

/* control edges you can see (3:1) - sizes as before */
.chip, .seg, .big-list button, .tool-grid button, .big-chip, .big-outline, .map-chip, .card-actions button, .tier-actions > *, .mchip,
.field select, .dialog input, .dialog select, .dialog textarea, .setting select, #spot-filter, #layer-filter, .plan-btn,
.dialog .buttons button, .point-tools button, .spot .go, .fab, #bm-btn { border: 1px solid var(--edge); }
.seg button.on, :root.is-dark .seg button.on { background: var(--primary); color: var(--primary-text); }
#layers input[type=checkbox], .qk-row input, #detail-switch { background: var(--edge); }
#layers input[type=checkbox]:checked, .qk-row input:checked, #detail-switch:checked { background: var(--green); }
.top-btn.primary, .fab-add, #mode-bar button.primary, .big-ask, .big-primary { background: var(--green) !important; color: var(--on-green) !important; }
#answer-dialog.ans-ok .ans-top { background: #15803D; }
#card-close, body:not(.phone) #card-close { width: auto; min-width: 40px; padding: 0 12px; border: 1px solid var(--edge); border-radius: 10px; font-size: .875rem; font-weight: 600; color: var(--text); }
#card-head { padding-right: 92px; }
body:not(.phone) #card-head { padding: 12px 16px 12px 96px; }

/* ---- the Layers panel, atlas-style: what you're out for (one row), the background, then the whole tree with its legend */
#pane-layers > h2 { margin: 2px 0 8px; }
.qk-pills { display: flex; flex-wrap: wrap; gap: 6px; }
.qk-pills .chip { min-height: 36px; padding: 0 14px; font-weight: 600; }
.qk-pills .chip small { display: none; }
.qk-pills .chip.on { background: var(--primary); color: var(--primary-text); border-color: var(--primary); }
.qk-kids { margin-top: 8px; padding: 8px 10px; }
#qk-bm { gap: 4px; }
#ml-all { margin-top: 10px; border-top: 1px solid var(--line); }
#ml-all .detail-row { padding: 10px 0 6px; }
#ml-on h3 { margin-top: 10px; }
#layer-filter { min-height: 40px; }
#layers details > summary, .ml-fold > summary { min-height: 44px; font-size: .95em; }
#layers label { min-height: 36px; padding: 5px 4px 5px 6px; }
#layers label .t { font-size: .95em; }
ul.legend { font-size: .8em; }
#reset-map { margin-top: 14px; }

/* tools: every tool, three to a row; the everyday four first with a short line under them */
.tool-grid button small { display: block; font-weight: 400; color: var(--muted); font-size: .78em; }

/* map buttons: the old 48 px squares, a small word under Layers / Tools / Aerial / Find me */
.fab-label { width: 52px !important; height: 52px !important; }
.fab-label .ms, .fab-label > span:not(.ic) { font-size: 20px; }
.fab-label small { font-size: .6875rem; font-weight: 600; line-height: 1.1; color: var(--text); }
.fab-add small { color: inherit; }
#fab-bm { display: none; }
#fab-bm .ic svg { width: 20px; height: 20px; display: block; }
#zoom-fabs { display: none; }
.zoom-fab { width: 48px; height: 44px; border: 1px solid var(--edge); background: var(--surface); color: var(--text); font-size: 1.4rem; line-height: 1; cursor: pointer;
            box-shadow: 0 4px 16px rgba(15,23,42,.16); }
.zoom-fab:first-child { border-radius: 14px 14px 0 0; border-bottom-width: 0; }
.zoom-fab:last-child { border-radius: 0 0 14px 14px; }
#bm-chip, .maplibregl-ctrl-group .btn-3d { font-size: .875rem; }
#bm-btn { width: auto; height: 40px; padding: 0 12px; gap: 6px; }
#bm-btn .t, #bm-btn .caret { display: inline; }
#bm-menu { top: 44px; }
#map-chips { left: calc(var(--side) + 64px); }
body.card-open.side-closed:not(.phone) #map-chips { left: calc(var(--side) + 64px); }
body.side-closed:not(.phone) #map-chips { left: 120px; }
.map-chip .sub { color: var(--muted); font-weight: 500; }

/* the card's layer chips wrap; picking one shows its buttons */
.mc-row { flex-wrap: wrap; overflow: visible; mask-image: none; -webkit-mask-image: none; padding-right: 0; }
.tier-pick { flex-wrap: wrap; }
.tier-pick .pick-acts { display: flex; flex-wrap: wrap; gap: 6px; width: 100%; margin-top: 6px; }
.tier-pick .pick-acts button { min-height: 36px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--edge); background: var(--surface); color: var(--text); font: inherit; font-weight: 600; cursor: pointer; }

#results li.none { color: var(--muted); cursor: default; line-height: 1.4; }
#results { max-height: 65vh; max-height: 65dvh; }

/* the truck bar, our dialogs */
#truck-bar { position: absolute; left: 50%; top: 12px; transform: translateX(-50%); z-index: 30; width: min(520px, calc(100% - 24px)); background: #0F172A; color: #fff;
             border-radius: 16px; padding: 12px 14px; box-shadow: var(--shadow); }
:root.is-dark #truck-bar { background: #1A222C; }
#truck-bar p { margin: 0 0 8px; font-weight: 600; }
#truck-bar .tb-acts { display: flex; flex-wrap: wrap; gap: 6px; }
#truck-bar button { min-height: 40px; padding: 0 12px; border-radius: 10px; border: 1px solid rgba(255,255,255,.45); background: rgba(255,255,255,.08); color: #fff; font: inherit; font-weight: 600; cursor: pointer; }
#truck-bar button.danger { border-color: #FCA5A5; color: #FECACA; }
#truck-bar button.primary { background: var(--green) !important; color: var(--on-green) !important; border: 0; }
#keys-dialog, .ask-dialog { border: 0; border-radius: 18px; padding: 18px 20px; width: min(420px, calc(100vw - 32px)); background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
#keys-dialog::backdrop, .ask-dialog::backdrop { background: rgba(0,0,0,.45); }
#keys-dialog dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; margin: 10px 0 14px; }
#keys-dialog dt { font-weight: 700; } #keys-dialog dd { margin: 0; }
#keys-dialog button { min-height: 40px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--edge); background: var(--surface2); color: var(--text); font: inherit; font-weight: 600; }
.ask-dialog h3 { margin: 0 0 6px; font-size: 1.1em; }
.ask-dialog p { margin: 0 0 12px; }
.ask-dialog textarea { width: 100%; box-sizing: border-box; font: inherit; padding: 8px; border-radius: 10px; border: 1px solid var(--edge); background: var(--surface2); color: var(--text); margin-bottom: 12px; }
.ask-row { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.ask-row button { min-height: 42px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--edge); background: var(--surface); color: var(--text); font: inherit; font-weight: 600; cursor: pointer; }
.ask-row button.primary { background: var(--green); color: var(--on-green); border-color: var(--green); }
.ask-row button.danger { background: #B91C1C; color: #fff; border-color: #B91C1C; }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 12px; top: -80px; z-index: 2000; padding: 10px 14px; border-radius: 10px; background: var(--surface); color: var(--text); font-weight: 700; }
.skip:focus { top: 12px; }

/* ------------------------------------------------ phones and tablets (the touch shell, < 840) */
@media (max-width: 839px) {
  #fab-bm { display: flex; }
  #zoom-fabs { display: flex; flex-direction: column; position: fixed; z-index: 11; right: calc(16px + env(safe-area-inset-right, 0px)); bottom: calc(var(--tabh) + 34px); }
  #fabs { bottom: calc(var(--tabh) + 134px); }
  body.sheet-open #zoom-fabs { display: none; }
  #map-chips { flex-wrap: wrap; overflow: visible; }
  #bar { padding-left: calc(16px + env(safe-area-inset-left, 0px)); padding-right: calc(16px + env(safe-area-inset-right, 0px)); }
  #truck-bar { position: fixed; top: calc(70px + env(safe-area-inset-top, 0px)); }
  #tabbar button { font-size: .75rem; }
}
/* tablets (600-839): the panel and the card float beside the map instead of covering its bottom half */
@media (min-width: 600px) and (max-width: 839px) {
  #side, #card { left: calc(12px + env(safe-area-inset-left, 0px)); right: auto; width: min(380px, calc(100vw - 120px)); top: calc(70px + env(safe-area-inset-top, 0px));
                 bottom: calc(var(--tabh) + 12px); height: auto !important; border-radius: 20px; box-shadow: var(--shadow); }
  #side .sheet-handle, #card-head .sheet-handle { display: none; }
  #card-head { cursor: default; }
  body.sheet-open #fabs { display: flex; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; scroll-behavior: auto !important; }
}
@media (prefers-contrast: more) {
  :root:not(.is-dark) { --muted: #334155; --line: #94A3B8; }
}
.qk-row { min-height: 40px; padding: 4px 2px; }
.qk-row .t { font-size: .95em; }
.fab-label { width: auto !important; min-width: 52px; padding: 0 6px; }
.fab-label small { white-space: nowrap; }
/* (2026-11-21) atlas pieces: group boxes, the Legend view, "Layers at this spot" */
#layers details > summary .gall { flex: none; width: 20px; height: 20px; margin: 0 10px 0 0; accent-color: var(--green); appearance: auto; -webkit-appearance: checkbox;
                                  background: none; order: 0; }
#layers details > summary .gall::after { display: none; }
#layers details > summary { justify-content: flex-start; gap: 0; }
#layers details > summary .gcount { margin-left: 6px; }
#layers details > summary::after { margin-left: auto; }
#layers summary .goff { float: none; margin-left: 8px; }
#ml-mode { margin: 10px 0 8px; }
#ml-mode button { min-height: 36px; }
#ml-legend .lg-item { padding: 8px 0; border-bottom: 1px solid var(--line); }
#ml-legend .lg-h { display: flex; align-items: center; gap: 8px; }
#ml-legend ul.legend { margin: 6px 0 0 4px; }
details.ident { border-top: 1px solid var(--line); margin-top: 8px; }
details.ident > summary { min-height: 44px; display: flex; align-items: center; font-weight: 600; cursor: pointer; }
.ident-row { padding: 8px 0; border-bottom: 1px solid var(--line); }
.ident-h { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.ident-h span { color: var(--muted); }
.ident-row table { width: 100%; border-collapse: collapse; margin-top: 6px; font-size: .88em; }
.ident-row th { text-align: left; font-weight: 600; color: var(--muted); padding: 3px 8px 3px 0; width: 40%; vertical-align: top; }
.ident-row td { padding: 3px 0; word-break: break-word; }
/* (2026-11-21) "Layers at this spot": the card's main list, right under the verdict */
.tier-layers { display: flex; flex-direction: column; gap: 0; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); overflow: hidden; }
.tl-cap { padding: 10px 14px 6px; font-weight: 700; font-size: .92em; }
.tl-cap span { color: var(--muted); font-weight: 500; }
.tl-row { border-top: 1px solid var(--line); }
.tl-row.tl-more { display: none; }
.tier-layers.all .tl-row.tl-more { display: block; }
.tl-row > summary { list-style: none; display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 6px 14px; cursor: pointer; }
.tl-row > summary::-webkit-details-marker { display: none; }
.tl-row > summary::after { content: 'expand_more'; font-family: 'Material Symbols Outlined'; font-size: 22px; color: var(--muted); margin-left: auto; transition: transform .15s; }
.tl-row[open] > summary::after { transform: rotate(180deg); }
.tl-row > summary:hover { background: var(--surface2); }
.tl-row.on > summary { background: var(--hl); }
.tl-row.off .tl-t b { text-decoration: line-through; color: var(--muted); }
.tl-sw { flex: none; width: 18px; display: inline-flex; justify-content: center; }
.tl-sw .sw { margin: 0; }
.tl-t { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.tl-t b { font-weight: 600; }
.tl-t small { color: var(--muted); font-size: .86em; }
.tl-body { padding: 2px 14px 12px 42px; }
.tl-body table { width: 100%; border-collapse: collapse; font-size: .88em; margin: 2px 0 8px; }
.tl-body th { text-align: left; font-weight: 600; color: var(--muted); padding: 3px 8px 3px 0; width: 42%; vertical-align: top; }
.tl-body td { padding: 3px 0; word-break: break-word; }
.tl-acts { display: flex; flex-wrap: wrap; gap: 6px; }
.tl-acts button { min-height: 36px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--edge); background: var(--surface); color: var(--text); font: inherit; font-size: .9em; font-weight: 600; cursor: pointer; }
.tl-showmore { border: 0; border-top: 1px solid var(--line); background: none; color: var(--link); font: inherit; font-weight: 600; min-height: 44px; cursor: pointer; }
details.ident { display: none; }
/* (2026-11-21) every card line can say why it's there */
[data-why] { cursor: pointer; position: relative; }
[data-why]:hover { filter: brightness(.97); }
.why-i { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 16px; height: 16px; margin-left: auto; border-radius: 50%;
         border: 1px solid currentColor; font-size: 11px; font-weight: 700; font-style: normal; opacity: .55; }
.tier-fact .tf-l { display: flex; align-items: center; gap: 6px; }
.tier-next .tn .why-i { margin-left: 6px; }
.why-box { margin: -4px 0 4px; padding: 10px 12px; border-radius: 12px; background: var(--surface2); border: 1px solid var(--line); font-size: .9em; line-height: 1.4; }
.why-box p { margin: 4px 0 0; } .why-box .why-src { color: var(--muted); }
.why-box a { display: inline-block; margin-top: 6px; font-weight: 600; }
.tier-here .why-box { grid-column: 1 / -1; margin: 0; }
