:root {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #263c40;
  font-size: 16px;
  color-scheme: light;
  --accent: #167e83;
  --muted: #6e7d7e;
  --surface: #fffffff0;
  --shadow: 0 4px 24px #19393618, 0 1px 4px #19393610;
  --bottom: max(20px, env(safe-area-inset-bottom));
}
* { box-sizing: border-box; }
body { margin: 0; }
[hidden] { display: none !important; }
#map { position: fixed; inset: 0; background: #dce2df; }
button, input, select { font: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
button, .layer-row, input { touch-action: manipulation; }
button { color: inherit; }
button:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible {
  outline: 3px solid var(--accent); outline-offset: 3px;
}
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.search-box, .map-tools > button, .zoom, .layers, .imagery-timeline {
  background: var(--surface); box-shadow: var(--shadow);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border: 1px solid #ffffffa6;
}
.search-box {
  position: fixed; top: 20px; left: 20px; z-index: 510;
  width: min(350px, calc(100vw - 440px)); display: flex; align-items: center; border-radius: 28px;
  padding: 2px 5px; transition: box-shadow .18s;
}
.search-box:focus-within { box-shadow: 0 0 0 2px #167e8333, var(--shadow); }
.search-box input { width: 100%; min-width: 0; height: 48px; border: 0; background: transparent; font-size: 15px; color: inherit; outline: none; }
.search-box input::placeholder { color: var(--muted); }
.search-box input::-webkit-search-cancel-button { display: none; }
.search-box > button { border: 0; background: transparent; color: var(--muted); flex: 0 0 42px; height: 44px; display: grid; place-items: center; border-radius: 50%; }
.search-box #search-results {
  position: absolute; top: calc(100% + 8px); left: 0; right: 0; background: #fffffff7;
  border-radius: 20px; max-height: min(50dvh, 380px); overflow: auto; overscroll-behavior: contain; box-shadow: var(--shadow); padding: 6px;
}
.search-result { display: block; width: 100%; text-align: left; border: 0; border-radius: 14px; padding: 14px 12px; background: transparent; }
.search-result + .search-result { border-top: 1px solid #e5eae8; }
.search-result strong { font-size: 14px; font-weight: 600; }
.search-result small { display: block; color: var(--muted); margin-top: 5px; line-height: 1.4; }
.search-empty { padding: 16px; font-size: 14px; color: var(--muted); }
.map-tools { position: fixed; z-index: 500; right: 20px; top: 20px; display: flex; flex-direction: column; gap: 10px; }
.map-tools button { display: grid; place-items: center; width: 46px; height: 46px; border: 0; border-radius: 50%; }
.map-tools button.active { background: var(--accent); color: white; }
.zoom { overflow: hidden; border-radius: 24px; }
.zoom button { border-radius: 0; background: transparent; box-shadow: none; font-size: 24px; font-weight: 400; }
.zoom button + button { border-top: 1px solid #263c4014; }
.layers { position: fixed; z-index: 520; top: 20px; right: 80px; width: 320px; border-radius: 24px; overflow: hidden; animation: reveal .2s ease-out; }
.layers.collapsed { display: none; }
.sheet-heading { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px 4px 20px; }
.sheet-heading h2 { margin: 0; font-size: 18px; font-weight: 650; letter-spacing: -.4px; }
.sheet-heading button { background: transparent; color: var(--accent); border: 0; padding: 12px; min-height: 44px; font-size: 14px; font-weight: 600; border-radius: 12px; }
#layer-content { padding: 0 16px 20px; max-height: calc(100dvh - 110px); overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
.section-label { font-size: 11px; letter-spacing: 1.1px; text-transform: uppercase; font-weight: 600; color: var(--muted); margin: 20px 4px 10px; }
.base-picker { display: flex; padding: 3px; border-radius: 12px; background: #e6ebe9; margin-bottom: 10px; }
.base-picker button { width: 50%; min-height: 40px; border: 0; background: transparent; border-radius: 9px; font-size: 14px; font-weight: 600; transition: background .16s, box-shadow .16s; }
.base-picker button[aria-pressed="true"] { background: white; box-shadow: 0 2px 5px #233e3b18; }
.select-label { display: block; font-size: 12px; color: var(--muted); margin: 14px 4px 7px; }
select { width: 100%; min-height: 44px; padding: 10px; border: 1px solid #d9e2df; border-radius: 12px; background: #fff; color: inherit; font-size: 13px; }
.layer-row { display: flex; gap: 12px; align-items: center; min-height: 48px; cursor: pointer; position: relative; font-size: 14px; padding: 0 6px; }
.layer-row + .layer-row { border-top: 1px solid #233e3b0a; }
.layer-row small { font-size: 11px; color: var(--muted); }
.layer-row input { position: absolute; right: 0; width: 50px; height: 44px; opacity: 0; cursor: pointer; margin: 0; }
.switch { margin-left: auto; flex: 0 0 40px; height: 24px; border-radius: 20px; background: #c5cecb; pointer-events: none; transition: background .18s; }
.switch::after { content: ""; display: block; width: 20px; height: 20px; border-radius: 50%; background: white; margin: 2px; box-shadow: 0 1px 3px #0002; transition: transform .18s; }
.layer-row input:checked + .switch { background: var(--accent); }
.layer-row input:checked + .switch::after { transform: translateX(16px); }
.layer-row input:focus-visible + .switch { outline: 3px solid var(--accent); outline-offset: 4px; }
.swatch, .terrain-swatch { flex: 0 0 18px; height: 18px; border-radius: 5px; }
.terrain-swatch { background: linear-gradient(135deg, #4e605c, #cbd1bf 43%, #687d71 45%, #e1e4d6 69%, #93a395); }
.wetness { background: linear-gradient(135deg, #c9e1e7, #167eb6); }
.streams { background: #1264b4; }
.water { background: #49a5d1; }
.buildings { background: #9b785b; border: 1px solid #5e4939; }
.line-swatch { flex: 0 0 18px; height: 0; border-top: 2px solid; }
.parcels { border-color: #a77e37; }
.roads { border-color: #fff; outline: 1px solid #59676b; }
.trails { border-top: 2px dashed #a54050; }
.map-guide { margin-top: 18px; border-top: 1px solid #263c4014; padding: 4px; }
.map-guide summary { padding: 14px 0 4px; cursor: pointer; color: var(--muted); font-size: 12px; }
.wetness-legend { margin-top: 17px; }
.wetness-ramp { height: 6px; border-radius: 5px; background: linear-gradient(90deg, #e4ebeb, #9dc7d3 29%, #438eb7 71%, #16457f); }
.wetness-ticks { display: flex; justify-content: space-between; margin-top: 8px; font-size: 12px; color: #315b6a; }
.wetness-ticks > span:nth-child(2) { text-align: center; }
.wetness-ticks > span:last-child { text-align: right; }
.wetness-ticks small { display: block; margin-top: 3px; font-size: 10px; color: var(--muted); }
.layer-note { font-size: 11px; line-height: 1.6; color: var(--muted); margin: 12px 0 0; }
.status { position: fixed; z-index: 530; bottom: 65px; left: 50%; transform: translateX(-50%); padding: 12px 18px; border-radius: 18px; background: #263c40ef; color: white; font-size: 14px; width: max-content; max-width: min(90vw, 460px); box-shadow: var(--shadow); transition: opacity .2s; pointer-events: none; }
.status.hidden { opacity: 0; }
.map-position { position: fixed; z-index: 450; bottom: 22px; left: 20px; display: flex; gap: 12px; font-size: 10px; color: #4c6264; padding: 6px 10px; background: #ffffffbd; border-radius: 20px; font-variant-numeric: tabular-nums; pointer-events: none; }
.maplibregl-ctrl-bottom-right .maplibregl-ctrl-scale { margin-bottom: 26px; margin-right: 20px; background: #ffffffbd; font-size: 10px; border-color: #6d7d82; }
.maplibregl-ctrl-attrib { font-size: 10px; }
.maplibregl-popup-content { font-size: 14px; line-height: 1.5; padding: 8px; border-radius: 18px; max-height: 65dvh; overflow: auto; box-shadow: var(--shadow); }
.maplibregl-popup-close-button { width: 30px; height: 30px; }
.maplibregl-canvas { -webkit-touch-callout: none; }
.maplibregl-canvas:focus-visible { outline: 3px solid var(--accent); outline-offset: -3px; }
.location-dot { width: 18px; height: 18px; border: 3px solid white; background: #167de3; border-radius: 50%; box-shadow: 0 0 0 2px #167de366, 0 2px 7px #0004; }
.point-menu { display: grid; min-width: 190px; }
.point-menu button { border: 0; border-radius: 10px; background: transparent; text-align: left; padding: 14px; min-height: 48px; }
dialog { color: #263c40; border: 1px solid #ffffffa6; border-radius: 26px; width: min(94vw, 500px); max-height: 85dvh; padding: 24px; box-shadow: 0 16px 80px #0003; }
dialog::backdrop { background: #152d3644; backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
dialog h2 { font-size: 22px; margin: 10px 0 24px; letter-spacing: -.5px; }
dialog h3 { margin-bottom: 10px; }
dialog dl { margin: 12px 0 24px; }
dialog dt { color: var(--muted); font-size: 12px; margin-top: 14px; }
dialog dd { margin: 4px 0; overflow-wrap: anywhere; }
dialog button { border: 0; border-radius: 12px; min-height: 44px; padding: 10px 14px; background: #e7f2f1; color: var(--accent); }
.share-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.close-details { float: right; }
#details-body { clear: both; }
#details-body p { line-height: 1.5; }
#details-body input { width: 100%; padding: 12px; border: 1px solid #afc6c8; border-radius: 12px; margin-bottom: 12px; }
#osm-status { position: fixed; z-index: 515; top: 84px; left: 20px; width: min(350px, calc(100vw - 100px)); background: #fff4df; color: #644008; padding: 12px 16px; border-radius: 16px; font-size: 12px; line-height: 1.5; box-shadow: var(--shadow); }
.imagery-timeline { position: fixed; z-index: 490; left: 50%; transform: translateX(-50%); bottom: 28px; width: min(440px, calc(100vw - 40px)); padding: 8px 14px 12px; border-radius: 24px; }
.timeline-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.timeline-heading strong { display: block; font-size: 15px; font-weight: 600; }
.timeline-heading small { display: block; margin-top: 3px; color: var(--muted); font-size: 12px; }
.imagery-timeline button { border: 0; background: transparent; color: var(--accent); min-width: 44px; height: 44px; border-radius: 50%; font-size: 25px; }
.imagery-timeline button:disabled { color: #a8b7b9; cursor: default; }
.timeline-controls { display: flex; align-items: center; gap: 8px; }
.timeline-controls input { min-width: 0; width: 100%; height: 36px; accent-color: var(--accent); cursor: pointer; touch-action: pan-y; }
.timeline-ends { display: flex; justify-content: space-between; color: var(--muted); font-size: 10px; padding-inline: 52px; }
.timeline-visible .status { bottom: 185px; }
@media (hover: hover) {
  button:hover:not(:disabled), .search-result:focus-visible { background-color: #e5efeb; }
  .map-tools button.active:hover { background: #11666b; }
}
@media (max-width: 760px) {
  .search-box { top: auto; bottom: var(--bottom); left: 12px; width: calc(100% - 24px); }
  .search-box input { font-size: 16px; }
  .search-box #search-results { top: auto; bottom: calc(100% + 10px); max-height: min(42dvh, 300px); }
  .map-tools { top: auto; right: 14px; bottom: calc(var(--bottom) + 72px); gap: 10px; }
  .zoom { display: none; }
  .map-tools #home { order: -1; }
  .layers { top: auto; bottom: calc(var(--bottom) + 66px); left: 12px; right: 12px; width: auto; border-radius: 26px; }
  .layers::before { content: ""; display: block; width: 32px; height: 4px; border-radius: 4px; background: #bac5c2; margin: 9px auto 0; }
  .sheet-heading { padding-top: 2px; }
  #layer-content { max-height: calc(100dvh - var(--bottom) - 175px); padding-bottom: 16px; }
  .layers-open .map-tools { visibility: hidden; }
  .map-position { display: none; }
  .status { top: max(12px, env(safe-area-inset-top)); bottom: auto; }
  .maplibregl-ctrl-bottom-right .maplibregl-ctrl-scale { margin-bottom: calc(var(--bottom) + 77px); margin-right: 78px; }
  .maplibregl-ctrl-attrib { max-width: 100vw; }
  #osm-status { top: max(12px, env(safe-area-inset-top)); left: 12px; width: calc(100% - 24px); }
  .imagery-timeline { left: 12px; right: 72px; width: auto; transform: none; bottom: calc(var(--bottom) + 66px); padding-inline: 10px; }
  .layers-open .imagery-timeline { display: none; }
  .timeline-visible .maplibregl-ctrl-bottom-right .maplibregl-ctrl-scale { margin-bottom: calc(var(--bottom) + 220px); }
  .timeline-visible .status { bottom: auto; }
  .layers-open .status { top: max(12px, env(safe-area-inset-top)); bottom: auto; }
  dialog { margin: auto 0 0; width: 100%; max-width: none; max-height: 85dvh; border-radius: 26px 26px 0 0; padding-bottom: max(24px, env(safe-area-inset-bottom)); }
}
@keyframes reveal { from { opacity: 0; translate: 0 8px; } to { opacity: 1; translate: 0 0; } }
@media (prefers-reduced-motion: reduce) { *, *::after { transition: none !important; animation: none !important; } }

.swatch.conserved{background:rgba(57,131,75,.25);border:1.5px solid #28683c}
/* Measurement modes keep their readout clear of search and date controls. */
#survey-panel{position:fixed;z-index:510;left:50%;transform:translateX(-50%);bottom:28px;width:min(450px,calc(100vw - 40px));padding:12px 16px;border-radius:20px;background:rgba(255,255,255,.96);box-shadow:0 6px 30px #15383c26;backdrop-filter:blur(16px)}
#survey-panel[hidden]{display:none}.survey-heading{display:flex;align-items:center;justify-content:space-between;gap:12px}#survey-panel button{border:0;background:transparent;color:#087e8b;min-height:44px;padding:8px 10px;border-radius:10px}#survey-panel button:disabled{opacity:.4}#survey-value{display:block;font-size:22px;font-weight:650;font-variant-numeric:tabular-nums}#survey-panel p{font-size:12px;margin:6px 0;color:#536c73}#survey-coordinates{font-size:11px;font-variant-numeric:tabular-nums}#measure-actions{display:flex;gap:8px}#measure-actions[hidden]{display:none}#measure-add{background:#087e8b!important;color:white!important;margin-right:auto}.survey-selector{display:grid;place-items:center;width:52px;height:52px;border-radius:50%;border:3px solid #087e8b;background:#ffffff73;color:#087e8b;font-size:36px;line-height:1;box-shadow:0 2px 12px #0004;cursor:grab;touch-action:none;user-select:none}.survey-selector:active{cursor:grabbing}.survey-active .imagery-timeline{display:none}
@media(max-width:760px){#survey-panel{left:12px;right:12px;width:auto;transform:none;bottom:var(--bottom)}.survey-active .search-box{display:none}.survey-active .map-tools{bottom:auto;top:calc(env(safe-area-inset-top) + 14px)}.survey-active #home,.survey-active .zoom{display:none}}
