:root {
  color-scheme: dark;
  --bg: #141d23; --panel: #19242b; --inset: #10191f; --raised: #26353e;
  --line: #354751; --soft-line: #2b3b44; --ink: #f0f4f3; --muted: #b6c4ca;
  --accent: #b2ebce; --accent-ink: #142d23; --warm: #f4c38c;
  font-family: "Segoe UI Variable Text", "Segoe UI", sans-serif; font-size: 100%;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; height: 100dvh; display: flex; flex-direction: column; overflow: hidden; background: var(--bg); color: var(--ink); }
button, input, textarea { font: inherit; }
button { cursor: pointer; background: transparent; border: 0; color: inherit; }
button:disabled { opacity: .4; cursor: default; }
button, input, textarea, summary, a { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button:hover { background-color: var(--raised); }
h1, h2, h3, p { margin: 0; }
h1, h2 { font-size: 1.375rem; font-weight: 650; letter-spacing: -.025em; }
h3 { font-size: .875rem; font-weight: 600; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark { display: grid; place-items: center; width: 36px; height: 36px; flex: none; border-radius: 9px;
  border: 1px solid #45655d; color: var(--accent); background: #203931; }
.brand-mark .icon { width: 22px; height: 22px; }
svg.icon { width: 18px; height: 18px; display: block; flex: none; stroke: currentColor; stroke-width: 1.65; fill: none; stroke-linecap: round; stroke-linejoin: round; pointer-events: none; }
.map-toolbar, .heading-row, .toggle-row, .side-footer, .progress-heading, .dialog-actions { display: flex; align-items: center; }
.map-toolbar { position: absolute; z-index: 550; top: 14px; right: 16px; gap: 6px; padding: 4px; border: 1px solid #465256; border-radius: 9px; background: #192327f5; box-shadow: 0 2px 8px #0003; }
.map-switch { position: relative; display: grid; grid-template-columns: repeat(2, 1fr); align-items: center; height: 32px; padding: 2px; border: 1px solid #526165; border-radius: 18px; background: var(--inset); color: var(--muted); cursor: pointer; }
.map-switch input { position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: inherit; }
.map-switch::before { content: ""; position: absolute; inset: 2px auto 2px 2px; width: calc(50% - 2px); border-radius: inherit; background: var(--accent); transition: transform 160ms ease, background-color 160ms ease; }
.map-switch:has(input:checked)::before { transform: translateX(100%); }
.map-switch span { position: relative; display: grid; place-items: center; }
.map-switch input:not(:checked) + span, .map-switch input:checked ~ span:last-child { color: var(--accent-ink); }
.map-switch:hover { border-color: var(--muted); }
.map-switch:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.style-switch span { padding-inline: 8px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.theme-switch { width: 64px; }
.theme-switch::before { background: #f1d194; }
.theme-switch:has(input:checked)::before { background: #bacee8; }
.theme-switch svg { width: 16px; height: 16px; }
@media (prefers-reduced-motion: reduce) { .map-switch::before { transition: none; } }
.map-toolbar .icon-button { width: 32px; height: 30px; }
.icon-button, .map-button { display: inline-grid; place-items: center; border-radius: 6px; width: 33px; height: 33px; flex: none; }
.subtle { color: var(--muted); }
.workspace { flex: 1; min-height: 0; display: flex; }
aside { width: clamp(280px, 25vw, 350px); flex-shrink: 0; display: flex; flex-direction: column; z-index: 3; background: var(--panel); border-right: 1px solid var(--line); }
.side-top { padding: 22px 20px 12px; }
.heading-row { justify-content: space-between; gap: 10px; }
.heading-row .icon-button { margin-right: -4px; }
.search-box { display: flex; align-items: center; gap: 9px; padding: 0 10px; height: 43px; margin: 18px 0 21px; border: 1px solid #435057; border-radius: 8px; background: var(--inset); color: var(--muted); }
.search-box:focus-within { border-color: var(--accent); }
.search-box svg { width: 16px; }
.search-box input { background: transparent; flex: 1; min-width: 0; border: 0; outline: 0; color: var(--ink); font-size: 1rem; }
.search-box input::placeholder { color: #9ca9a8; }
kbd { border: 1px solid var(--line); border-radius: 3px; font: 10px "Segoe UI",sans-serif; padding: 2px 4px; white-space: nowrap; }
.progress-heading { justify-content: space-between; gap: 6px; }
.progress-heading h3 { font-size: .875rem; }
#progress-count, .result-count, .category-count, .group-count { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 12px; }
#progress-count { color: var(--accent); }
progress { display: block; width: 100%; height: 4px; margin: 9px 0 13px; border: 0; appearance: none; }
progress::-webkit-progress-bar { background: #39464a; border-radius: 2px; }
progress::-webkit-progress-value { background: var(--accent); border-radius: 2px; }
.toggle-row { position: relative; justify-content: space-between; font-size: .875rem; color: #c3ccc9; cursor: pointer; min-height: 30px; }
.toggle-row input { position: absolute; right: 1px; opacity: 0; }
.toggle-row:has(input:disabled) { opacity: .45; cursor: default; }
.switch { width: 29px; height: 16px; border-radius: 20px; border: 1px solid #59666a; background: #303b40; padding: 2px; }
.switch::after { content: ""; display: block; width: 10px; height: 10px; border-radius: 50%; background: #c2cbc8; }
input:checked + .switch { background: var(--accent); border-color: var(--accent); }
input:checked + .switch::after { background: var(--accent-ink); transform: translateX(12px); }
input:focus-visible + .switch, .category-check input:focus-visible + .check-shape { outline: 2px solid var(--accent); outline-offset: 2px; }
.scroll-region { overflow: auto; flex: 1; min-height: 0; border-top: 1px solid var(--soft-line); scrollbar-width: thin; scrollbar-color: #52615e transparent; }
.list-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 17px 20px 9px; }
.list-heading h3 { font-size: .75rem; font-weight: 650; color: var(--muted); letter-spacing: .09em; text-transform: uppercase; }
.text-button { padding: 3px; color: var(--accent); font-size: .875rem; }
.group { margin: 0 13px 4px; }
.group-row { display: flex; align-items: center; gap: 6px; }
.group-toggle { margin: 0 8px 0 auto; width: 15px; height: 15px; cursor: pointer; accent-color: var(--group-color); }
.group-row .chevron { margin-left: auto; }
.group-head, .category-check, .result-row { display: flex; align-items: center; width: 100%; text-align: left; }
.group-head { padding: 7px; gap: 9px; min-height: 39px; border-radius: 5px; font-size: 14px; font-weight: 600; }
.group-icon, .detail-icon { display: grid; place-items: center; flex-shrink: 0; width: 27px; height: 27px; border-radius: 7px; color: var(--group-color, var(--accent)); background: color-mix(in srgb, var(--group-color, var(--accent)) 13%, transparent); }
.group-icon svg { width: 16px; height: 16px; }
.group-head .group-count { margin-left: auto; font-weight: 400; font-size: 11px; }
.chevron { display: grid; color: var(--muted); }
.chevron svg { width: 13px; height: 13px; }
.group-head[aria-expanded=true] .chevron { transform: rotate(90deg); }
.category-check { gap: 9px; padding: 7px 9px 7px 16px; cursor: pointer; border-radius: 4px; position: relative; color: #d1d9d5; font-size: .875rem; line-height: 1.3; }
.category-check:hover { background: var(--raised); }
.category-check input { opacity: 0; position: absolute; width: 16px; height: 16px; margin: 0; }
.check-shape { width: 14px; height: 14px; flex: none; border: 1px solid #6b7778; border-radius: 3px; display: grid; place-items: center; }
.category-check input:checked + .check-shape { color: var(--group-color); border-color: var(--group-color); background: color-mix(in srgb, var(--group-color) 13%, transparent); }
.category-check input:checked + .check-shape::after { content: ""; width: 6px; height: 3px; border-left: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: translateY(-1px) rotate(-45deg); }
.category-count { margin-left: auto; white-space: nowrap; font-size: 11px; }
.result-row { padding: 9px 20px; gap: 10px; border-bottom: 1px solid var(--soft-line); }
.result-row strong, .result-row small { display: block; overflow-wrap: anywhere; }
.result-row strong { font-size: .9375rem; font-weight: 550; }
.result-row small { font-size: .8125rem; color: var(--muted); margin-top: 2px; }
.result-row .found-mark { margin-left: auto; color: var(--accent); }
.empty { padding: 9px 20px 16px; color: var(--muted); font-size: 13px; line-height: 1.6; }
.more { margin: 9px 20px; }
.back { margin: 0 17px 7px; }
.area-shortcuts { padding: 16px 20px 20px; border-top: 1px solid var(--soft-line); margin-top: 13px; }
.area-shortcuts h3 { color: var(--muted); font-size: .75rem; font-weight: 650; letter-spacing: .09em; text-transform: uppercase; }
.area-buttons { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.area-button { border: 1px solid #415055; color: #d6e0de; padding: 6px 9px; font-size: .875rem; border-radius: 6px; }
.side-footer { padding: 10px 15px; border-top: 1px solid var(--line); gap: 4px; }
.footer-button { display: flex; flex: 1; align-items: center; gap: 10px; padding: 8px; font-weight: 550; border-radius: 5px; }
.footer-button[aria-pressed=true] { color: var(--warm); background: var(--raised); }
#pin-count { margin-left: auto; color: var(--muted); font-size: 12px; }
.map-shell { flex: 1; position: relative; min-width: 0; min-height: 0; isolation: isolate; background: #1a2b37; }
#map { position: absolute; inset: 0; background: #182a34; }
body[data-theme=day] #map { background: #a2cad0; }
.leaflet-area-selection-pane { z-index: 350; pointer-events: none; }
.selected-area { stroke: #8ef9d5; stroke-width: 3px; fill: #2ee3a9; fill-opacity: .36; }
body[data-theme=day] .selected-area { stroke: #006c5a; fill: #19b797; fill-opacity: .36; }
#map.placing, #map.placing .leaflet-interactive { cursor: crosshair; }
#map-status, #notice { padding: 10px 16px; border: 1px solid var(--line); border-radius: 7px; background: var(--panel); color: var(--ink); box-shadow: 0 5px 22px #0004; }
#map-status { z-index: 500; position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); text-align: center; }
#expand, .map-controls, #credits, #placement, #detail { z-index: 550; position: absolute; }
#expand { left: 15px; top: 15px; }
.map-controls { bottom: 41px; right: 16px; display: flex; flex-direction: column; gap: 4px; }
.map-button, #credits { background: #192327f5; border: 1px solid #465256; color: var(--ink); box-shadow: 0 2px 8px #0003; }
.map-button { width: 36px; height: 36px; }
.map-button:hover, #credits:hover { background: var(--raised); }
#credits { bottom: 7px; right: 8px; padding: 3px 7px; border-radius: 3px; color: #c4cecb; font-size: 10px; }
.map-marker { background: transparent; border: 0; }
.area-selected .map-marker:not(:hover):not(:focus-visible) { opacity: .38; }
.leaflet-marker-icon.map-label { display: grid; place-items: center; white-space: nowrap; pointer-events: none; color: var(--map-secondary); }
.map-label span { -webkit-text-stroke: 3px var(--map-halo); paint-order: stroke fill; }
.label-city span { color: var(--map-label); -webkit-text-stroke-width: 4px; }
.label-route span { -webkit-text-stroke: 0; padding: 0 3px; border-radius: 3px; color: var(--map-label); border: 1px solid var(--map-routeBorder); background: var(--map-routeFill); }
.map-dot, .map-cluster { width: 100%; height: 100%; display: grid; place-items: center; font: 600 12px "Segoe UI", sans-serif; box-shadow: 0 1px 5px #080e11aa; }
.map-dot { color: #18201f; background: var(--marker-color); border: 2px solid #1b282a; border-radius: 50% 50% 50% 3px; transform: rotate(-45deg); }
.map-dot svg { width: 12px; height: 12px; stroke-width: 2; transform: rotate(45deg); }
.map-dot.found { background: #657770; color: white; }
.map-cluster { border: 1px solid #afcfc1; border-radius: 100%; background: #263c38; color: #e6f5e9; }
.overview-cluster { font-size: 10px; font-variant-numeric: tabular-nums; background: #263c38e8; border-color: #93b2a5; }
.search-marker { --match-ring: #a6ffda; }
body[data-theme=day] .search-marker { --match-ring: #006650; }
.search-marker .map-dot, .search-marker .map-cluster {
  border: 2px solid #153a2e; box-shadow: 0 0 0 2px var(--match-ring), 0 0 0 3px #f0fff2, 0 2px 6px #0d1e1c99;
}
:is(.search-marker, .expanded-marker) .map-dot { border-radius: 50%; transform: none; }
:is(.search-marker, .expanded-marker) .map-dot svg { transform: none; }
.expanded-marker .map-dot { outline: 2px solid #f0fff2; }
.search-marker .map-cluster { background: #bbf5d7; color: #17392d; font-variant-numeric: tabular-nums; }
.map-marker:focus-visible { outline-offset: 3px; border-radius: 50%; }
.leaflet-tooltip.map-tooltip { font: 12px "Segoe UI",sans-serif; color: var(--ink); border: 1px solid var(--line); background: #182326f5; white-space: normal; max-width: 240px; }
#placement, #detail { border: 1px solid #4a595b; background: #1d272cfa; box-shadow: 0 8px 30px #0005; border-radius: 9px; }
#placement { top: 62px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 9px; padding: 6px 7px 6px 12px; font-size: 12px; width: max-content; max-width: calc(100% - 28px); }
#place-center { color: var(--accent); border: 1px solid var(--line); padding: 5px 8px; border-radius: 4px; }
#detail { left: 16px; bottom: 34px; width: min(320px, calc(100% - 82px)); padding: 15px; max-height: calc(100% - 100px); overflow: auto; scrollbar-width: thin; }
.detail-top { display: flex; align-items: center; gap: 8px; margin-bottom: 9px; color: var(--muted); font-size: 11px; letter-spacing: .015em; }
.detail-top .icon-button { margin: -5px -4px -5px auto; }
.detail-icon { width: 23px; height: 23px; }
.detail-icon svg { width: 14px; height: 14px; }
#detail h2 { font-size: 19px; overflow-wrap: anywhere; line-height: 1.25; }
#detail p { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.5; color: #c1cdca; font-size: 1rem; margin-top: 6px; }
.detail-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 5px; margin-top: 13px; }
.action, .dialog-actions button { display: inline-flex; align-items: center; gap: 6px; padding: 7px 10px; min-height: 30px; border: 1px solid #49565a; border-radius: 5px; font-size: 12px; }
.action svg, .dialog-actions svg { width: 15px; height: 15px; }
.primary, .primary:hover { background: var(--accent); color: var(--accent-ink); font-weight: 650; border-color: transparent !important; }
.primary:hover { background: #c7efd5; }
.danger { color: #ffb4a6; }
dialog { width: min(430px, calc(100vw - 32px)); max-height: calc(100dvh - 34px); padding: 24px; background: var(--panel); color: var(--ink); border: 1px solid #536165; border-radius: 12px; box-shadow: 0 16px 70px #0008; }
dialog::backdrop { background: #0b1015aa; }
dialog .heading-row { margin-bottom: 20px; }
dialog p { color: var(--muted); margin: 7px 0; font-size: 1rem; line-height: 1.55; }
dialog .form-error { color: #ffb4a6; font-size: .875rem; }
.dialog-actions { flex-wrap: wrap; gap: 7px; margin: 13px 0 0; }
.source-info { border-top: 1px solid var(--line); margin-top: 20px; padding-top: 16px; overflow-wrap: anywhere; }
.source-info a { color: var(--accent); }
#pin-form label { display: block; font-size: 13px; margin: 11px 0 6px; font-weight: 550; }
#pin-form input, #pin-form textarea { display: block; width: 100%; background: var(--inset); color: var(--ink); border: 1px solid #4b585e; padding: 8px; border-radius: 5px; resize: vertical; }
#pin-form .dialog-actions { justify-content: flex-end; }
#notice { position: fixed; bottom: 15px; left: 50%; transform: translateX(-50%); z-index: 1000; max-width: min(430px, 92vw); text-align: center; font-size: 13px; }
@media (max-width: 750px) { aside { width: 252px; } .side-top { padding: 13px 14px 9px; } .group { margin-inline: 8px; } .search-box { margin-bottom: 15px; } .list-heading { padding-inline: 14px; } .category-check { padding-left: 12px; } }
@media (max-width: 590px) {
  #shortcut { display: none; }
  .workspace { position: relative; }
  aside { position: absolute; inset: 0 auto 0 0; box-shadow: 5px 0 15px #0004; width: min(310px, 86vw); }
  #sidebar:not([hidden]) + .map-shell .map-toolbar { display: grid; grid-template-columns: 1fr auto; justify-items: end; }
  #sidebar:not([hidden]) + .map-shell .style-switch { grid-column: 1 / -1; }
  #sidebar:not([hidden]) + .map-shell #detail { display: none; }
}
@media (max-height: 610px) { .side-top { padding-top: 8px; padding-bottom: 5px; } .search-box { margin-block: 5px 10px; height: 34px; } .side-footer { padding-block: 4px; } progress { margin-bottom: 4px; } }
