*{box-sizing:border-box}
:root{color-scheme:dark;--page:#08110d;--surface:#101d16;--line:#304b3d;--text:#e8f1eb;--muted:#a9beb2;--green:#a3e8b8;--protected:#dc8b80;--select:#f0c76b;font:16px/1.55 system-ui,sans-serif}
[hidden]{display:none!important}
body{margin:0;background:radial-gradient(ellipse at 15% 0,#203b2c,var(--page) 45rem);color:var(--text)}
header{display:flex;justify-content:space-between;align-items:center;flex-wrap:wrap;gap:10px;padding:12px max(16px,calc((100% - 1180px)/2));border-bottom:1px solid var(--line);background:var(--page);color:var(--muted)}
header a{display:flex;align-items:center;gap:10px}
a{color:var(--green);text-underline-offset:4px}
main{max-width:1180px;margin:auto;padding:clamp(20px,5vw,54px) 16px 56px}
h1{font:700 clamp(2.4rem,7vw,4.4rem)/1.05 system-ui;margin:0;letter-spacing:-.045em}
h2{font-size:1.25rem;margin:0}
p{margin:8px 0;color:var(--muted)}
.lede{margin-bottom:24px}
.import{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,340px),1fr));gap:12px}
.import>div,.board,#gate{padding:clamp(13px,3vw,23px);border:1px solid var(--line);border-radius:12px;background:var(--surface);min-width:0}
.board{margin:14px 0}.heading,.actions{display:flex;align-items:center;flex-wrap:wrap;gap:9px}.heading{justify-content:space-between}
button,input{font:inherit;color:inherit}
button{padding:7px 12px;min-height:42px;background:#182b21;border:1px solid #4b6c59;border-radius:6px;cursor:pointer}
button:enabled:hover{background:#284936}button:disabled{opacity:.5;cursor:default}
button.primary{margin-top:14px;background:var(--green);color:#10251a;font-weight:700}
button.primary:enabled:hover{background:#c6f3d3}
:focus-visible{outline:2px solid var(--green);outline-offset:3px}
input:not([type=checkbox]){padding:6px;border:1px solid var(--line);border-radius:5px;background:var(--page);max-width:100%}
input[type=checkbox]{accent-color:var(--green)}
.file,.check{display:block;margin:9px 0}.file input{display:block;margin:6px 0}
canvas{display:block;width:100%;height:auto;margin-top:10px;border:1px solid #456152;border-radius:6px;cursor:crosshair}
.coords input{width:85px}
.legend{display:flex;flex-wrap:wrap;gap:6px 17px;padding:0;list-style:none;color:var(--muted)}
.legend li::before{content:"";display:inline-block;width:10px;height:10px;margin-right:6px;background:#3b7956;border-radius:2px}
.legend .selected::before{background:var(--select)}.legend .protected::before{background:var(--protected)}.legend .car::before{background:#83cfea;border-radius:50%}
.table{overflow:auto;margin:12px 0;max-height:360px;border:1px solid var(--line)}table{width:100%;border-collapse:collapse;text-align:left;white-space:nowrap}td,th{padding:8px 12px;border-bottom:1px solid var(--line)}
pre{white-space:pre-wrap;overflow-wrap:anywhere;max-height:240px;overflow:auto}

#selection{border:1px solid var(--line);margin:14px 0 0;padding:10px;min-width:0;border-radius:6px}
#selection legend{padding-inline:6px;color:var(--muted)}
#selection .coords+.coords{margin-top:10px}
#copy{margin-top:14px}

.map-mode{margin-top:10px}
.map-mode label{padding:6px 8px;border:1px solid var(--line);border-radius:6px;white-space:nowrap}
.map-mode input{accent-color:var(--green)}
canvas{touch-action:none}
canvas[data-mode="pan"]{cursor:grab}
canvas[data-mode="pan"]:active{cursor:grabbing}
.legend .claim::before{background:#ffb5a7;border-radius:50%}
.map-credit{font-size:.85rem}
.claims{display:flex;flex-wrap:wrap;gap:8px;max-height:180px;overflow:auto;margin:8px 0 14px}
.claims button{text-align:left}

canvas[data-dragging="pan"]{cursor:grabbing}
.legend .empty::before{background:#edbd5045;border:1px solid #edbd50b0}

#population-layers{border:1px solid var(--line);margin:12px 0;padding:8px 12px;min-width:0;border-radius:6px}
#population-layers legend{padding-inline:6px;color:var(--muted)}
#population-status{margin:6px 0 0;font-size:.85rem}
.legend .apop::before{background:#b9ee8b;border-radius:50%}
.legend .zpop::before{background:#d1a2ff;border-radius:0}
