:root {
  color-scheme: light;
  --ink: #252525;
  --muted: #62605f;
  --accent: #8c1d2c;
  --paper: #faf9f7;
  --line: #d9d5d1;
  font-family: Arial, Helvetica, sans-serif;
  color: var(--ink);
  background: var(--paper);
}

* { box-sizing: border-box; }
body { margin: 0; }
a { color: var(--accent); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
button, select, input { font: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 4px; }
.skip-link { position: absolute; top: -100px; left: 16px; z-index: 1000; padding: 12px; background: white; }
.skip-link:focus { top: 12px; }
.app-shell { display: grid; grid-template-columns: minmax(0, 1fr) 370px; height: 100vh; height: 100dvh; min-height: 520px; }
#map { position: relative; z-index: 1; min-width: 0; min-height: 0; background: #e8e9e6; }
.control-panel { padding: 26px; overflow-y: auto; border-left: 1px solid var(--line); }
.back-link { display: inline-block; font-size: 13px; line-height: 1.5; }
.eyebrow { margin: 32px 0 12px; color: var(--accent); font-size: 12px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; }
h1 { margin: 0; font-size: 29px; line-height: 1.15; font-weight: 600; letter-spacing: -.025em; }
.deck { margin: 16px 0 24px; color: var(--muted); font-size: 15px; line-height: 1.5; }
.controls { display: grid; gap: 18px; }
.control label { display: block; margin-bottom: 8px; font-size: 14px; font-weight: 600; }
.control select { width: 100%; min-height: 44px; padding: 8px 12px; border: 1px solid #a7a09b; border-radius: 2px; background: white; color: var(--ink); font-size: 16px; }
.control select:disabled, input:disabled { cursor: wait; opacity: .6; }
.map-scale-heading { display: grid; gap: 5px; margin-bottom: 10px; font-size: 14px; }
.map-scale-heading strong { font-weight: 600; }
.map-scale-heading span { color: var(--muted); font-size: 13px; }
.map-scale-bar { height: 12px; }
.gradient-scale { background: linear-gradient(90deg, #fff7bc, #fec44f 25%, #e96b3f 50%, #a33a73 75%, #351a54); }
.share-scale { background: linear-gradient(90deg, #eef5f2, #b9dcd4 25%, #71b8ad 50%, #2d8e8b 75%, #0c5867); }
.map-scale-ticks { display: flex; justify-content: space-between; margin-top: 6px; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.missing-key { display: flex; align-items: center; gap: 6px; margin: 10px 0 0; color: var(--muted); font-size: 12px; }
.missing-key span { width: 13px; height: 13px; background: #d9dedf; border: 1px solid #babdbd; }
.overlay-control { display: flex; align-items: center; gap: 10px; min-height: 30px; font-size: 14px; cursor: pointer; }
.overlay-control input { margin: 0; width: 18px; height: 18px; accent-color: var(--accent); }
.map-note { display: grid; gap: 8px; margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--line); font-size: 14px; line-height: 1.5; }
.map-note strong { font-weight: 600; }
.map-note > span { color: var(--muted); }
.selected-note { border-top-color: var(--accent); }
.selected-note .selected-id { color: var(--ink); }
.selected-grid b { display: block; color: var(--ink); font-weight: 600; }
#clear-selection { margin: 12px 0 0; min-height: 40px; padding: 8px 12px; border: 1px solid var(--accent); border-radius: 2px; background: transparent; color: var(--accent); cursor: pointer; font-size: 14px; }
.method-note { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); font-size: 14px; line-height: 1.55; }
.method-note summary { cursor: pointer; font-weight: 600; }
.method-note p { color: var(--muted); }
.method-note strong { color: var(--ink); }
.panel-footer { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); font-size: 12px; line-height: 1.5; color: var(--muted); }
.panel-footer p { margin: 0 0 6px; }
.leaflet-container { font-family: inherit; }
.leaflet-tile-pane { filter: grayscale(.85) contrast(.85) brightness(1.08); }
.leaflet-control-zoom { border: 1px solid var(--line) !important; border-radius: 2px !important; box-shadow: none !important; }
.leaflet-control-zoom a { width: 36px !important; height: 36px !important; line-height: 36px !important; border-radius: 0 !important; color: var(--ink); }
.leaflet-control-attribution { font-size: 11px; background: rgba(255, 255, 255, .94) !important; }
.leaflet-control-attribution a { color: #555; }
.map-label { border: 1px solid var(--line) !important; border-radius: 2px !important; background: white !important; color: var(--ink) !important; box-shadow: 0 2px 10px #0002 !important; }
.map-tooltip { display: grid; gap: 5px; padding: 6px; font-size: 13px; line-height: 1.35; }
.map-tooltip > span { color: var(--muted); font-size: 10px; letter-spacing: .06em; }
.map-tooltip > strong { margin-bottom: 4px; font-size: 14px; }
.leaflet-interactive { cursor: pointer; }

@media (max-width: 760px) {
  .app-shell { display: flex; flex-direction: column; height: auto; min-height: 100dvh; }
  .control-panel { display: contents; }
  .control-panel > * { margin-left: 22px; margin-right: 22px; }
  .back-link { order: 0; margin-top: 20px; }
  .eyebrow { order: 1; margin-top: 20px; }
  h1 { order: 2; max-width: 520px; font-size: 27px; }
  .deck { order: 3; margin-top: 12px; margin-bottom: 20px; }
  .controls { order: 4; }
  #map { order: 5; height: 65svh; min-height: 420px; margin-top: 20px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
  .map-note { order: 6; }
  #clear-selection { order: 7; align-self: flex-start; }
  .method-note { order: 8; }
  .panel-footer { order: 9; margin-bottom: 24px; }
  noscript { order: 10; }
  .map-scale-heading { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px; }
  .method-note, .panel-footer { margin-top: 16px; padding-top: 14px; }
}
