:root{--a:#16a34a;--b:#dc2626;--ink:#111;--muted:#666}
html,body{height:100%;overflow:hidden;overscroll-behavior:none;-webkit-text-size-adjust:100%;-webkit-tap-highlight-color:transparent;-webkit-touch-callout:none;margin:0;font:15px/1.35 system-ui,-apple-system,sans-serif;color:var(--ink)}
#map{position:absolute;inset:0}
#panel{position:absolute;z-index:1000;top:max(8px,env(safe-area-inset-top));left:8px;width:min(380px,calc(100vw - 16px));background:#fff;border-radius:12px;box-shadow:0 2px 14px #0003;padding:10px}
.field{position:relative;display:flex;align-items:center;gap:8px;margin-bottom:8px}
.dot{flex:none;width:24px;height:24px;border-radius:50%;color:#fff;font-weight:700;font-size:13px;display:grid;place-items:center}
.dot.a{background:var(--a)}.dot.b{background:var(--b)}
input,select{font:inherit;min-width:0;flex:1;padding:8px 10px;border:1px solid #ccc;border-radius:8px;background:#fff}
#swap{flex:none;border:1px solid #ccc;background:#fff;border-radius:8px;width:36px;height:36px;font-size:18px}
.opts{display:flex;gap:6px}.opts select{font-size:13px;padding:6px}
.sugg{position:absolute;left:32px;right:0;top:100%;z-index:5;background:#fff;border-radius:8px;box-shadow:0 4px 14px #0004;overflow:hidden}
.sugg div{padding:9px 10px;border-bottom:1px solid #eee;cursor:pointer;font-size:14px}
.sugg div:hover{background:#f2f2f2}
#result{margin-top:8px}
.big{font-size:20px;font-weight:650}
.meta{color:var(--muted);font-size:13px;margin-top:2px}
.bar{display:flex;height:8px;border-radius:4px;overflow:hidden;margin:8px 0 4px}
.legend{display:flex;flex-wrap:wrap;gap:2px 10px;font-size:12px;color:var(--muted)}
.legend i{display:inline-block;width:10px;height:10px;border-radius:2px;margin-right:4px;vertical-align:-1px}
#status{font-size:12px;color:var(--muted);margin-top:6px}
.err{color:#b91c1c}
@media(max-width:600px){#panel{left:5px;right:5px;width:auto;top:max(5px,env(safe-area-inset-top))}.opts select{flex:1;max-width:none}}

/* native feel: no page zoom/selection; 16px inputs stop iOS focus-zoom; zoom only inside the map */
body{touch-action:manipulation;-webkit-user-select:none;user-select:none}
#map{touch-action:none}
input,select{font-size:16px!important;-webkit-user-select:text;user-select:text}
button{touch-action:manipulation;-webkit-appearance:none}
#panel{max-height:calc(100dvh - 16px - env(safe-area-inset-top));overflow:auto;overscroll-behavior:contain;padding-bottom:max(10px,env(safe-area-inset-bottom))}
.net{display:flex;align-items:center;gap:6px;font-size:13px;color:var(--muted);margin-top:6px}.net input{flex:none;min-width:0;width:16px;height:16px;padding:0}
.maplibregl-ctrl-attrib{font-size:11px}

/* compact mobile layout: slim top bar, options behind the gear, result as bottom sheet */
#panel{padding:6px}
#panel .field{margin-bottom:6px}#panel .field:last-of-type{margin-bottom:0}
#panel input{padding:7px 10px}
#swap,#locate,#gear{flex:none;border:1px solid #ccc;background:#fff;border-radius:8px;width:36px;height:36px;font-size:18px;padding:0}
#gear[aria-expanded=true]{background:#e5e7eb}
#opts{margin-top:8px}#opts[hidden]{display:none}
.linkbtn{border:0;background:none;color:#b91c1c;font:inherit;font-size:13px;padding:6px 0 0;margin-top:2px}
#sheet{position:absolute;z-index:1000;left:5px;right:5px;bottom:max(5px,env(safe-area-inset-bottom));max-width:520px;background:#fff;border-radius:14px;box-shadow:0 2px 14px #0004;padding:6px 12px 10px}
#sheet[hidden]{display:none}
.grab{width:36px;height:4px;border-radius:2px;background:#ccc;margin:0 auto 6px}
#result{margin-top:0}
#sheet .legend,#sheet .meta .more{display:none}
#sheet.open .legend{display:flex}
#sheet:not(.open) .meta{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.maplibregl-ctrl-bottom-right,.maplibregl-ctrl-bottom-left{transition:bottom .2s}
@media(min-width:601px){#sheet{left:8px;right:auto;width:380px;bottom:max(8px,env(safe-area-inset-bottom))}}
.dot.v{background:#7c3aed}.rm{flex:none;border:1px solid #ccc;background:#fff;border-radius:8px;width:36px;height:36px;font-size:20px;padding:0;color:#666}
.linkbtn.plus{color:#2563eb;font-size:14px;padding:4px 0}
.dot{touch-action:none;cursor:grab}.field.dragging{position:relative;z-index:10;opacity:.85;background:#fff;box-shadow:0 4px 14px #0004;border-radius:8px}.field.dropat{outline:2px dashed #7c3aed;outline-offset:2px;border-radius:8px}
.field{transition:transform .15s}.field.dragging{transition:none}
#sheet .profile{display:none;margin-top:10px}#sheet.open .profile{display:block}
.profile svg{width:100%;height:80px;display:block;touch-action:none;background:#f6fbf7;border-radius:6px}
.plab{display:flex;justify-content:space-between;font-size:12px;color:var(--muted);margin-top:2px}
.hoverdot{width:14px;height:14px;border-radius:50%;background:#111;border:2px solid #fff;box-shadow:0 0 4px #0008}

#fields[hidden],#summary[hidden],#done[hidden],#hint[hidden]{display:none!important}
#summary{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:4px 4px;font-weight:600;cursor:pointer}
#sumtext{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
#summary .edit{flex:none;font-weight:500;font-size:13px;color:#2563eb}
#done{flex:none;border:0;background:#16a34a;color:#fff;border-radius:8px;width:36px;height:36px;font-size:18px;padding:0}
#hint{position:absolute;z-index:900;left:50%;transform:translateX(-50%);bottom:max(44px,calc(env(safe-area-inset-bottom) + 36px));background:#111c;color:#fff;border-radius:18px;padding:8px 14px;font-size:14px;pointer-events:none;white-space:nowrap}
.maplibregl-ctrl-bottom-right,.maplibregl-ctrl-bottom-left{margin-bottom:var(--sheet-h,0px);transition:margin .2s}
@media(min-width:601px){.maplibregl-ctrl-bottom-right,.maplibregl-ctrl-bottom-left{margin-bottom:0}}
