:root {
  --ink: #183d42;
  --muted: #64767a;
  --paper: #fafbf7;
  --line: #dde4de;
  --accent: #d66e3e;
  --deep: #76bccd;
  --small: #aad6cf;
  --shallow: #e5d8a8;
  --mainland: #54755b;
  --island: #97b580;
  --lake: #83aed2;
}
* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; }
body { height: 100vh; height: 100dvh; color: var(--ink); font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; background: #e6efec; }
button, input, summary { -webkit-tap-highlight-color: transparent; }
button, input { font: inherit; }
button, summary, label { touch-action: manipulation; }
button:focus-visible, input:focus-visible, summary:focus-visible, a:focus-visible { outline: 3px solid #d66e3e; outline-offset: 3px; }
#map { position: fixed; top: 0; left: 0; height: 100vh; height: 100dvh; width: 100%; background: #c1d9df; }
.atlas-panel { position: fixed; z-index: 800; top: 22px; bottom: 24px; left: 22px; width: 314px; display: flex; flex-direction: column; background: var(--paper); border: 1px solid #fff; border-radius: 14px; box-shadow: 0 6px 30px #123c4529; overflow: hidden; }
.panel-header { padding: 25px 25px 17px; }
.eyebrow { font-size: 9px; font-weight: 750; letter-spacing: 1.85px; display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.compass-mark { background: var(--ink); color: var(--paper); width: 24px; height: 24px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 19px; font-weight: 300; }
h1 { font-size: 32px; line-height: 1.04; font-weight: 650; letter-spacing: -1.4px; margin: 19px 0 10px; }
.title-dot { color: var(--accent); }
.intro { font-size: 12px; line-height: 1.6; color: var(--muted); margin: 0; }
.notice { font-size: 8px; font-weight: 750; letter-spacing: .8px; margin-top: 16px; display: flex; align-items: center; gap: 6px; color: #97512d; }
.notice > span { border: 1px solid #c9976d; width: 13px; height: 13px; border-radius: 50%; text-align: center; line-height: 12px; font-size: 9px; }
details { border-top: 1px solid var(--line); min-height: 0; overflow-y: auto; scrollbar-width: thin; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
summary { cursor: pointer; list-style: none; padding: 15px 25px 0; font-size: 12px; font-weight: 700; }
summary::-webkit-details-marker { display: none; }
.summary-chevron { display: none; }
.controls-content { padding: 15px 25px 18px; }
.section-caption { font-size: 9px; font-weight: 750; letter-spacing: 1.25px; }
.view-buttons { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 5px; margin-top: 9px; }
.view-buttons button { background: transparent; border: 1px solid #cdd8d0; color: var(--ink); border-radius: 5px; padding: 8px 3px; font-size: 10px; font-weight: 600; cursor: pointer; }
.view-buttons button:hover { background: #e9eee7; }
.view-buttons button.active { background: var(--ink); border-color: var(--ink); color: white; }
.layer-caption { margin-top: 23px; display: flex; justify-content: space-between; align-items: baseline; }
.layer-caption > span { letter-spacing: 0; font-size: 8px; font-weight: 400; color: var(--muted); }
.layer-controls { margin-top: 9px; }
.layer-row { display: flex; align-items: center; min-height: 30px; gap: 9px; cursor: pointer; font-size: 11px; }
.layer-row input, .basemap-control input { width: 13px; height: 13px; margin: 0; accent-color: var(--ink); cursor: pointer; flex-shrink: 0; }
.layer-row .layer-label { flex: 1; }
.layer-row .feature-count { font-variant-numeric: tabular-nums; font-size: 9px; color: #7c8d88; }
.layer-row.pending { opacity: .55; }
.layer-row.failed { color: #a23f32; }
.layer-row.zoom-hidden .layer-label { color: var(--muted); }
.layer-swatch, .key-swatch { width: 12px; height: 12px; border-radius: 2px; display: inline-block; flex-shrink: 0; }
.layer-swatch.mainland { background: var(--mainland); }
.layer-swatch.island { background: var(--island); }
.layer-swatch.sea { background: var(--deep); }
.layer-swatch.depth { background: linear-gradient(90deg, var(--deep) 0 33%, var(--small) 33% 66%, var(--shallow) 66%); }
.layer-swatch.lake { background: var(--lake); }
.layer-swatch.fairway { border-top: 2px dashed #cd5c32; height: 2px; border-radius: 0; }
.layer-swatch.hazard { background: #bd3345; width: 10px; height: 10px; transform: rotate(45deg); border: 1px solid #fff; }
.layer-swatch.seamark { background: #fffae8; border: 2px solid #324c5e; width: 10px; height: 10px; border-radius: 50%; }
.layer-swatch.harbour { color: #315e79; font-size: 16px; line-height: 10px; }
.layer-swatch.label { color: var(--ink); font-size: 12px; font-family: Georgia, serif; font-style: italic; }
.depth-key { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 12px 0; margin: 12px 0; }
.depth-key > div { font-size: 10px; display: flex; gap: 9px; align-items: center; margin: 5px 0; color: #5d716e; }
.depth-key > div > span:last-child { flex: 1; display: flex; justify-content: space-between; }
.depth-key strong { font-weight: 600; color: var(--ink); }
.key-swatch.deep { background: var(--deep); }
.key-swatch.small { background: var(--small); }
.key-swatch.shallow { background: var(--shallow); }
.basemap-control { display: flex; align-items: center; gap: 9px; font-size: 10px; cursor: pointer; min-height: 24px; }
.external-mark { margin-left: auto; font-size: 14px; color: var(--muted); }
.method-note { margin: 12px 0 0; font-size: 9px; line-height: 1.65; color: #7c8983; }
.panel-footer { border-top: 1px solid var(--line); margin-top: auto; padding: 13px 25px 15px; flex-shrink: 0; }
#dataset-status { font-size: 10px; font-weight: 600; display: flex; gap: 6px; align-items: center; }
.status-dot { display: inline-block; width: 5px; height: 5px; border-radius: 50%; background: #50826b; }
.status-dot.loading { background: var(--accent); animation: pulse 1.2s infinite; }
.status-dot.error { background: #bb3846; }
.dataset-stats { font-size: 9px; color: var(--muted); margin-top: 6px; }
.panel-footer p { font-size: 8px; color: #81908b; margin: 6px 0 0; }
.panel-footer a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 2px; }
.map-heading { position: absolute; z-index: 500; top: 30px; right: 30px; display: flex; flex-direction: column; gap: 5px; text-align: right; color: #244b54; pointer-events: none; text-shadow: 0 1px 4px #fff; }
.map-heading span:first-child { font-family: Georgia, serif; font-style: italic; font-size: 24px; }
.map-heading span:last-child { font-size: 8px; font-weight: 650; letter-spacing: 2.4px; }
.map-error { position: absolute; z-index: 1100; left: 50%; top: 20px; transform: translateX(-50%); width: min(480px, calc(100% - 32px)); padding: 16px; background: #fff3e4; color: #7d3725; border: 1px solid #e8bd92; border-radius: 8px; box-shadow: 0 3px 20px #0002; font-size: 13px; line-height: 1.6; }
.maplibregl-map { font-family: inherit; }
.maplibregl-ctrl-group { border: 0; border-radius: 8px; box-shadow: 0 2px 12px #214c4926 !important; overflow: hidden; background: var(--paper); }
.maplibregl-ctrl-group button { width: 40px; height: 40px; }
.maplibregl-ctrl-top-right { top: 94px; right: 14px; }
.maplibregl-ctrl-bottom-right .maplibregl-ctrl { margin-right: 24px; margin-bottom: 8px; }
.maplibregl-ctrl-bottom-right .maplibregl-ctrl-attrib { margin-bottom: 3px; }
.maplibregl-ctrl-attrib { max-width: calc(100vw - 350px); font-size: 9px; background: #fafbf7e8; }
.maplibregl-ctrl-attrib.maplibregl-compact { min-height: 24px; }
.maplibregl-ctrl-scale { background: #fafbf7b8; border-color: #4d6b6a; color: var(--ink); font-size: 9px; }
.maplibregl-popup-content { padding: 15px 24px 15px 18px; min-width: 150px; border-radius: 8px; }
.maplibregl-popup-close-button { width: 30px; height: 30px; font-size: 19px; color: var(--ink); }
.feature-popup h3 { font-size: 15px; margin: 0 0 7px; color: var(--ink); }
.feature-popup p { font-size: 11px; margin: 4px 0; color: #59716f; }
.feature-popup .popup-category { font-size: 9px; text-transform: uppercase; letter-spacing: 1px; color: #be643b; margin-bottom: 5px; }
.feature-popup a { color: #326c88; }
@keyframes pulse { 50% { opacity: .3; } }
@media (prefers-reduced-motion: reduce) { .status-dot.loading { animation: none; } }
@media (max-height: 820px) and (min-width: 701px) {
  .panel-header { padding-top: 18px; padding-bottom: 13px; }
  h1 { font-size: 29px; margin-top: 12px; }
  .intro { font-size: 11px; }
  .notice { margin-top: 10px; }
  .controls-content { padding-top: 12px; }
  .layer-caption { margin-top: 17px; }
  .layer-row { min-height: 27px; }
}
@media (max-width: 700px) {
  .atlas-panel { top: auto; left: max(10px, env(safe-area-inset-left)); right: max(10px, env(safe-area-inset-right)); bottom: max(13px, env(safe-area-inset-bottom)); width: auto; max-height: 67vh; max-height: 67dvh; border-radius: 12px; }
  .panel-header { padding: 15px 18px 12px; }
  .eyebrow { font-size: 8px; letter-spacing: 1.6px; }
  .compass-mark { width: 19px; height: 19px; font-size: 16px; }
  h1 { font-size: 23px; letter-spacing: -.75px; margin: 8px 0 0; }
  h1 br { display: none; }
  .intro { display: none; }
  .notice { font-size: 7px; margin-top: 8px; letter-spacing: .6px; }
  .notice > span { height: 11px; width: 11px; font-size: 8px; line-height: 10px; }
  details { flex-shrink: 1; }
  summary { padding: 13px 18px; min-height: 44px; font-size: 12px; display: flex; justify-content: space-between; align-items: center; }
  .summary-chevron { display: inline-block; font-size: 17px; line-height: 12px; transition: transform .15s; }
  details[open] .summary-chevron { transform: rotate(180deg); }
  .controls-content { padding: 1px 18px 17px; }
  .view-buttons button { padding: 11px 3px; font-size: 11px; }
  .layer-row { min-height: 40px; font-size: 12px; }
  .layer-row input, .basemap-control input { width: 16px; height: 16px; }
  .layer-controls { display: grid; grid-template-columns: 1fr 1fr; column-gap: 15px; }
  .layer-row { gap: 7px; }
  .layer-row .feature-count { display: none; }
  .depth-key > div { font-size: 11px; margin: 8px 0; }
  .basemap-control { min-height: 32px; font-size: 12px; }
  .method-note { font-size: 10px; }
  .panel-footer { padding: 11px 18px; display: grid; grid-template-columns: 1fr auto; gap: 3px 12px; }
  .panel-footer p { grid-column: 1 / -1; margin: 0; }
  .dataset-stats { margin: 0; font-size: 8px; text-align: right; align-self: center; }
  #dataset-status { font-size: 9px; }
  .map-heading { top: max(22px, env(safe-area-inset-top)); right: 18px; }
  .map-heading span:first-child { font-size: 21px; }
  .map-heading span:last-child { font-size: 7px; letter-spacing: 1.6px; }
  .maplibregl-ctrl-top-right { top: max(80px, calc(env(safe-area-inset-top) + 65px)); right: max(5px, env(safe-area-inset-right)); }
  .maplibregl-ctrl-group button { width: 44px; height: 44px; }
  .maplibregl-ctrl-bottom-right .maplibregl-ctrl { margin-right: 8px; margin-bottom: 0; }
  .maplibregl-ctrl-attrib { max-width: 100vw; font-size: 8px; }
  .maplibregl-ctrl-scale { position: fixed; left: max(15px, env(safe-area-inset-left)); top: max(25px, env(safe-area-inset-top)); }
  .maplibregl-popup-content { max-width: calc(100vw - 40px); }
}
