/* GeoSketch — styles */
:root{
  --paper:#F2F4F0;
  --paper-2:#E7EBE5;
  --rule:#CFD7CE;
  --ink:#16211F;
  --muted:#66746F;
  --flag:#D6336C;      /* survey flagging pink: the "you are drawing" color */
  --flag-soft:#F9E1EA;
  --contour:#1F7A8C;   /* contour teal: links, secondary actions */
  --contour-soft:#DCEEF1;
  --danger:#B42318;
  --radius:6px;
  --font-ui:"Archivo", system-ui, sans-serif;
  --font-mono:"IBM Plex Mono", ui-monospace, monospace;
}
*{box-sizing:border-box}
html,body{height:100%;margin:0;font-family:var(--font-ui);color:var(--ink);background:var(--paper)}
button,input,select,textarea{font:inherit;color:inherit}
a{color:var(--contour)}

#app{display:grid;grid-template-columns:var(--panel-w,384px) 8px 1fr;height:100%;--panel-w:384px}
#splitter{
  cursor:col-resize;background:var(--paper-2);border-right:1px solid var(--rule);position:relative;touch-action:none;user-select:none
}
#splitter::after{content:"";position:absolute;top:50%;left:2px;width:2px;height:36px;margin-top:-18px;border-left:1px solid var(--muted);border-right:1px solid var(--muted);opacity:.6}
#splitter:hover,#splitter.dragging{background:var(--flag-soft)}
#splitter:hover::after,#splitter.dragging::after{border-color:var(--flag);opacity:1}
#splitter:focus-visible{outline:2px solid var(--contour);outline-offset:-2px}
body.resizing{cursor:col-resize}
body.resizing #stage{pointer-events:none}
@media (max-width:820px){
  #app{grid-template-columns:1fr;grid-template-rows:auto 1fr}
  #panel{max-height:46vh}
  #splitter{display:none}
}

/* ---------- Panel ---------- */
#panel{
  overflow-y:auto;border-right:1px solid var(--rule);
  background:
    radial-gradient(circle, var(--rule) 0.8px, transparent 0.9px) 0 0/16px 16px,
    var(--paper);
  padding:16px 16px 40px;
}
.brand{display:flex;align-items:baseline;gap:10px;margin:2px 0 14px}
.brand h1{font-size:22px;font-weight:700;letter-spacing:-0.02em;margin:0}
.brand .ver{font-family:var(--font-mono);font-size:11px;color:var(--muted)}

.section{background:#FBFCFA;border:1px solid var(--rule);border-radius:var(--radius);padding:12px;margin-bottom:12px;box-shadow:2px 2px 0 rgba(22,33,31,.05)}
.eyebrow{font-family:var(--font-mono);font-size:10.5px;letter-spacing:.12em;text-transform:uppercase;color:var(--muted);margin:0 0 10px;display:flex;justify-content:space-between;align-items:center;border-bottom:1px solid var(--paper-2);padding-bottom:7px}
.eyebrow > span:first-child{display:inline-flex;align-items:center;gap:7px}
.eyebrow > span:first-child::before{content:"";width:6px;height:6px;flex:none;border:1px solid var(--rule);background:var(--paper-2);transform:rotate(45deg)}
.eyebrow .count{color:var(--flag)}
.hint{font-size:12px;color:var(--muted);margin:10px 0 0;line-height:1.4;border-left:2px solid var(--rule);padding-left:9px}


.tools{display:grid;grid-template-columns:repeat(3,1fr);gap:6px}
.tool{
  border:1px solid var(--rule);background:#fff;border-radius:var(--radius);
  padding:8px 4px 6px;display:flex;flex-direction:column;align-items:center;gap:4px;cursor:pointer;
  font-size:11.5px;font-weight:500;color:var(--ink)
}
.tools-one{grid-template-columns:1fr;margin-bottom:12px}
.tools-one .tool{flex-direction:row;justify-content:center;gap:8px;padding:10px 8px;font-size:13px}
.tool svg{width:20px;height:20px;stroke:currentColor;fill:none;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
.tool:hover{border-color:var(--ink)}
.tool.active{background:var(--flag);border-color:var(--flag);color:#fff}
.tool:focus-visible,button:focus-visible,input:focus-visible,select:focus-visible,textarea:focus-visible{outline:2px solid var(--contour);outline-offset:2px}

.row{display:flex;gap:8px;align-items:center;margin-bottom:8px}
.row:last-child{margin-bottom:0}
.row label{font-size:12px;color:var(--muted);width:76px;flex:none}
.row input[type=range]{flex:1;accent-color:var(--flag)}
.row .val{font-family:var(--font-mono);font-size:11.5px;width:52px;text-align:right;color:var(--ink)}
.row input.num{flex:none;width:64px;border:1px solid var(--rule);border-radius:4px;padding:4px 6px;background:#fff;font-family:var(--font-mono);font-size:12px}
.row input[type=color]{width:38px;height:28px;border:1px solid var(--rule);border-radius:4px;padding:2px;background:#fff}
.row input[type=text],.row input[type=url],.row input[type=number],.row select,.row textarea{
  flex:1;min-width:0;border:1px solid var(--rule);border-radius:4px;padding:6px 8px;background:#fff;font-size:13px
}
.row textarea{resize:vertical;min-height:54px}
.swatches{display:flex;gap:5px;flex-wrap:wrap;flex:1}
.swatch{width:20px;height:20px;border-radius:50%;border:2px solid #fff;box-shadow:0 0 0 1px var(--rule);cursor:pointer;padding:0}
.swatch.on{box-shadow:0 0 0 2px var(--ink)}

.stamps{display:grid;grid-template-columns:repeat(6,1fr);gap:5px}
.stamp{border:1px solid var(--rule);background:#fff;border-radius:4px;padding:4px;cursor:pointer;display:block;min-width:0;overflow:hidden}
.stamp svg{width:100%;height:auto;aspect-ratio:1/1;display:block}
.stamps + .hint{margin-top:12px}
.stamp img{width:100%;height:auto;aspect-ratio:1/1;object-fit:contain;display:block}
.picpreview{display:grid;grid-template-columns:1fr 1fr;gap:8px;margin:10px 0}
.picpreview figure{margin:0;text-align:center}
.picpreview img,.picpreview .outline{width:100%;aspect-ratio:1/1;object-fit:contain;background:var(--paper-2);border:1px solid var(--rule);border-radius:4px;display:flex;align-items:center;justify-content:center;padding:6px}
.picpreview .outline svg{width:100%;height:100%}
.picpreview .outline polygon,.picpreview .outline path{fill:var(--flag)}
.picpreview figcaption{font-family:var(--font-mono);font-size:10.5px;color:var(--muted);margin-top:4px;text-transform:uppercase;letter-spacing:.08em}
.stamp svg polygon,.stamp svg path{fill:var(--muted)}
.stamp:hover{border-color:var(--ink)}
.stamp.on{border-color:var(--flag);background:var(--flag-soft)}
.stamp.on svg polygon,.stamp.on svg path{fill:var(--flag)}

.btns{display:flex;gap:6px;flex-wrap:wrap}
.section .row + .btns,.section .hint + .btns,.section .tools + .btns{border-top:1px dashed var(--rule);padding-top:10px;margin-top:10px}
.btn{
  border:1px solid var(--ink);background:#fff;border-radius:var(--radius);padding:7px 10px;font-size:12.5px;font-weight:500;cursor:pointer;
  display:inline-flex;align-items:center;gap:6px
}
.btn:hover{background:var(--paper-2)}
.btn.primary{background:var(--ink);color:#fff}
.btn.primary:hover{background:#2a3835}
.btn.flag{background:var(--flag);border-color:var(--flag);color:#fff}
.btn.flag:hover{background:#b9285a}
.btn.quiet{border-color:var(--rule);color:var(--muted)}
.btn.danger{border-color:var(--danger);color:var(--danger)}
.btn:disabled{opacity:.45;cursor:not-allowed}
.btn svg{width:14px;height:14px;stroke:currentColor;fill:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}

#props .measure{font-family:var(--font-mono);font-size:11.5px;color:var(--contour);background:var(--contour-soft);border-radius:4px;padding:6px 8px;margin:0 0 10px;min-height:0}
#props .measure:empty{display:none}
#props .fields .btns{border-top:1px dashed var(--rule);padding-top:10px;margin-top:4px}
#props .empty{font-size:12.5px;color:var(--muted);padding:6px 0}
#props.has .empty{display:none}
#props .fields{display:none}
#props.has .fields{display:block}

.tabs{display:flex;gap:4px;border-bottom:2px solid var(--rule);margin:2px 0 12px}
.tab{flex:1;border:0;background:transparent;padding:9px 4px 8px;font-size:14px;font-weight:600;color:var(--muted);cursor:pointer;
  border-bottom:3px solid transparent;margin-bottom:-2px;border-radius:4px 4px 0 0}
.tab:hover{color:var(--ink);background:var(--paper-2)}
.tab.on{color:var(--flag);border-bottom-color:var(--flag)}
.tabpage{display:none}
.tabpage.on{display:block}

.status{font-family:var(--font-mono);font-size:11px;color:var(--muted);display:flex;justify-content:space-between;gap:8px;margin-top:14px;border-top:1px solid var(--rule);padding-top:9px}
.credit{font-size:12px;color:var(--muted);margin:14px 0 0;text-align:center}
.credit a{color:var(--contour);text-decoration:none;border-bottom:1px solid var(--contour)}
.credit a:hover{color:var(--flag);border-bottom-color:var(--flag)}
.signin{font-size:12px;color:var(--muted);margin:8px 0 0}
.signin b{color:var(--contour);font-weight:500}
details summary{cursor:pointer;font-size:12.5px;color:var(--contour);margin-bottom:8px}

/* ---------- Splash ---------- */
#splash{
  position:fixed;inset:0;z-index:50;display:flex;align-items:center;justify-content:center;padding:20px;
  background:rgba(22,33,31,.45)
}
#splash.hidden{display:none}
.splash-card{
  width:min(480px,100%);background:
    radial-gradient(circle, var(--rule) 0.8px, transparent 0.9px) 0 0/16px 16px,
    var(--paper);
  border:1px solid var(--rule);border-radius:10px;box-shadow:6px 6px 0 rgba(22,33,31,.25);
  padding:26px 26px 18px
}
.splash-art{display:flex;gap:10px;margin-bottom:14px}
.splash-art::before,.splash-art::after{content:"";width:18px;height:18px;background:var(--flag);
  clip-path:polygon(50% 0,61% 35%,97% 35%,68% 57%,79% 91%,50% 70%,21% 91%,32% 57%,3% 35%,39% 35%)}
.splash-art::after{background:var(--contour);clip-path:polygon(50% 0,100% 50%,50% 100%,0 50%)}
.splash-card h2{font-size:30px;font-weight:700;letter-spacing:-0.02em;margin:0 0 10px}
.splash-tag{font-size:14px;line-height:1.55;color:var(--ink);margin:0 0 14px}
.splash-list-title{font-size:13.5px;font-weight:600;margin:0 0 6px}
.splash-list{margin:0 0 22px;padding-left:22px;font-size:13.5px;line-height:1.6;color:var(--ink)}
.splash-list li::marker{font-family:var(--font-mono);font-size:11.5px;color:var(--flag)}
.splash-foot{display:flex;align-items:flex-end;justify-content:space-between;gap:12px;border-top:1px solid var(--paper-2);padding-top:14px}
.splash-foot .btn{margin-left:auto}
.splash-credit{font-size:11.5px;color:var(--muted);margin:0 auto 0 0;text-align:left}
.splash-credit a{color:var(--muted);text-decoration:none;border-bottom:1px solid var(--rule)}
.splash-credit a:hover{color:var(--contour);border-bottom-color:var(--contour)}

/* ---------- Map stage ---------- */
#stage{position:relative;min-height:320px}
.viewbox{position:absolute;inset:0}
.viewbox.hidden{display:none}
#modeSwitch{
  position:absolute;top:15px;right:15px;z-index:5;display:flex;background:#fff;border-radius:999px;padding:3px;
  box-shadow:0 1px 3px rgba(0,0,0,.25);font-size:12.5px;font-weight:600
}
#modeSwitch button{border:0;background:transparent;border-radius:999px;padding:5px 14px;cursor:pointer;color:var(--muted)}
#modeSwitch button.on{background:var(--ink);color:#fff}
#readout{
  position:absolute;left:15px;bottom:26px;z-index:5;background:rgba(255,255,255,.92);border-radius:4px;padding:4px 8px;
  font-family:var(--font-mono);font-size:11px;color:var(--ink);pointer-events:none
}
#toasts{position:absolute;bottom:60px;left:50%;transform:translateX(-50%);z-index:9;display:flex;flex-direction:column;gap:6px;align-items:center}
.toast{background:var(--ink);color:#fff;padding:9px 14px;border-radius:var(--radius);font-size:13px;box-shadow:0 4px 14px rgba(0,0,0,.25);max-width:520px}
.toast.err{background:var(--danger)}
.toast a{color:#fff;text-decoration:underline}
@media (prefers-reduced-motion:no-preference){ .toast{animation:pop .18s ease-out} }
@keyframes pop{from{transform:translateY(6px);opacity:0}to{transform:none;opacity:1}}

/* keep ArcGIS widget chrome in the same voice */
.esri-view .esri-ui{font-family:var(--font-ui)}
