* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: #f5f4ed; color: #233125; font: 16px system-ui, sans-serif; }
main { width: min(100% - 32px, 1100px); margin: 24px auto; }
header, .controls, form { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; }
header { justify-content: space-between; }
h1 { margin: 4px 0; font: 700 clamp(2rem, 6vw, 3.25rem) Georgia, serif; }
a { color: #284e39; }
fieldset { display: flex; flex-wrap: wrap; gap: 10px; margin: 0; padding: 8px 12px; border: 1px solid #b9c2b2; border-radius: 8px; }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:not(.pin, #place) { padding: 8px 12px; border: 1px solid #284e39; border-radius: 8px; background: #284e39; color: white; }
button[aria-pressed="true"] { outline: 2px solid #284e39; outline-offset: 2px; }
form { margin-bottom: 12px; }
#status:empty { display: none; }
.zoom-controls { display: flex; gap: 4px; }
button:disabled { opacity: .55; cursor: default; }
.map-viewport { width: min(100%, 112.5vh); margin: 12px auto 0; max-height: 75vh; overflow: auto; touch-action: none; }
.map { position: relative; width: var(--map-width, 100%); }
#background { display: block; width: 100%; height: auto; background: #d9dfd2; }
#place { position: absolute; inset: 0; border: 0; background: transparent; cursor: crosshair; }
.pin { position: absolute; transform: translate(-50%, -50%); display: grid; place-items: center; min-width: 34px; min-height: 34px; padding: 2px; border-radius: 50%; border: 2px solid #284e39; background: #fffdf2; color: #233125; }
#draft { pointer-events: none; }
.map:has(#place:not([hidden])) #markers { pointer-events: none; }
footer { margin-top: 8px; font-size: .85rem; }

.map-viewport.zoomed { cursor: grab; overscroll-behavior: contain; }
.map-viewport.dragging, .map-viewport.dragging #place { cursor: grabbing; user-select: none; }
#features { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.feature { fill: none; stroke-width: 4; vector-effect: non-scaling-stroke; stroke-linejoin: round; stroke-linecap: round; }
.feature.trail { stroke: #ffd360; stroke-dasharray: 9 6; }
.feature.creek { stroke: #1478c8; }
.feature.region { fill: #b5de6855; stroke: #52832e; }
.feature.draft { opacity: .8; }
.feature-vertex { fill: #fffdf2; stroke: #284e39; stroke-width: 2; vector-effect: non-scaling-stroke; }
#feature-form { gap: 8px; }
#feature-list { padding-left: 1.4em; }
#feature-list li + li { margin-top: 6px; }
#feature-list .delete-feature { margin-inline-start: 10px; padding: 3px 8px; border-color: #9c2c22; background: transparent; color: #9c2c22; }
dialog { width: min(92vw, 640px); max-height: 90dvh; border: 1px solid #b9c2b2; border-radius: 12px; color: inherit; background: #fffdf2; }
dialog::backdrop { background: #15221899; }
dialog h2 { margin: 0 0 12px; }
#landmark-form { display: grid; justify-items: start; }
#landmark-form > *, #landmark-form select, #landmark-form input { max-width: 100%; }
#landmark-details { margin-bottom: 12px; }
.gallery { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; margin-bottom: 12px; }
.gallery:empty { display: none; }
.gallery img { display: block; width: 100%; max-height: 65vh; object-fit: contain; }
#existing-photos { grid-template-columns: repeat(3, minmax(0, 1fr)); }
#existing-photos img { max-height: 120px; }
#delete-landmark { border-color: #9c2c22; background: #9c2c22; }
