:root {
  --ink: #0f2230; --ink-2: #4c5f69; --ink-3: #8696a0;
  --paper: #f4f0e6; --card: #fffdf7; --line: rgba(15, 34, 48, .12); --line-2: rgba(15, 34, 48, .07);
  --deep: #0c1c27; --deep-2: #163243; --on-deep: #eaf1f3; --on-deep-2: #93a9b4; --line-deep: rgba(255, 255, 255, .12);
  --sea: #1b6a85; --sea-d: #0b3d5c; --foam: #7fd0e6; --coral: #e4693a;
  --now: #1f78b4; --peak: #e08a1e; --dry: #b8c0c3;
  --r: 10px; --shadow: 0 10px 30px rgba(12, 28, 39, .16), 0 1px 2px rgba(12, 28, 39, .08);
  --top: 52px;
  --serif: "Noto Serif SC", "Songti SC", "STSong", serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", "Noto Sans SC", sans-serif;
  color: var(--ink);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; background: var(--paper); overflow: hidden; }
body { display: grid; grid-template-rows: var(--top) minmax(0, 1fr) auto; grid-template-columns: minmax(0, 1fr); height: 100dvh; }
.leaflet-tile-container img.leaflet-tile { width: 256.6px !important; height: 256.6px !important; }
button, select, input { font: inherit; color: inherit; }
button { cursor: pointer; }
output, .d, .kpi b, .metrics b, .years td, .parts .h { font-family: var(--mono); font-variant-numeric: tabular-nums; }
:focus-visible { outline: 2px solid var(--foam); outline-offset: 2px; }

/* top bar */
.top { position: relative; display: flex; align-items: center; gap: 16px; padding: 0 18px; background: var(--deep); color: var(--on-deep); z-index: 1000; }
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; background: none; border: 0; padding: 0; text-align: left; }
.brand svg { flex: none; width: 34px; fill: none; stroke: var(--foam); stroke-width: 2.4; stroke-linecap: round; }
.site-name { font-family: var(--serif); font-size: 16px; font-weight: 700; letter-spacing: .02em; color: var(--on-deep); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crumbs { flex: 1; }
.ghost { background: none; border: 1px solid var(--line-deep); border-radius: 999px; padding: 6px 14px; font-size: 13px; color: var(--on-deep); white-space: nowrap; }
.ghost:hover { border-color: var(--foam); color: #fff; }
.ghost.icon { width: 32px; height: 32px; padding: 0; display: grid; place-items: center; }
.ghost.icon svg { width: 16px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; }
.ghost.icon[aria-expanded="true"] { border-color: var(--foam); }
/* settings popover under the top bar */
.settings-pop { position: absolute; right: 18px; top: calc(100% + 6px); z-index: 1100; width: 280px; padding: 12px 14px 10px; color: var(--ink); display: grid; gap: 8px; }
.opt { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 12.5px; }
.seg2 { display: flex; padding: 2px; border-radius: 6px; background: rgba(15, 34, 48, .06); }
.seg2 button { border: 0; background: none; border-radius: 4px; padding: 3px 10px; font-size: 12px; color: var(--ink-2); }
.seg2 button[aria-checked="true"] { background: var(--deep); color: #fff; }
.keys { margin: 4px 0 0; padding-top: 8px; border-top: 1px solid var(--line); font-size: 11px; color: var(--ink-3); }
kbd { font-family: var(--mono); font-size: 10.5px; padding: 0 4px; border-radius: 3px; box-shadow: inset 0 0 0 1px var(--line); color: var(--ink-2); }
body.no-labels .pin-label { display: none; }
body.calm .found-ring { animation: none; }

/* stage: map on the left; the park column opens on the right */
.stage { position: relative; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr); }
body[data-view="park"] .stage { grid-template-columns: minmax(0, 1fr) 0 var(--park-w, clamp(380px, 38vw, 580px)); }
/* splitters: no width of their own; a 12 px grab zone over the pane edge and a grip on hover */
.split { position: relative; z-index: 800; touch-action: none; outline: none; }
#splitX { display: none; }
body[data-view="park"] #splitX { display: block; }
.split::before { content: ""; position: absolute; inset: 0 -6px; cursor: col-resize; }
.split.h::before { inset: -6px 0; cursor: row-resize; }
.split::after { content: ""; position: absolute; left: -2px; top: 50%; width: 4px; height: 44px; margin-top: -22px; border-radius: 2px; background: var(--sea); opacity: 0; transition: opacity .15s; pointer-events: none; }
.split.h::after { left: 50%; top: -2px; width: 44px; height: 4px; margin: 0 0 0 -22px; }
.split:hover::after, .split:focus-visible::after, body.dragging .split::after { opacity: .9; }
body.dragging { cursor: col-resize; user-select: none; }
body.dragging #scene, body.dragging #map { pointer-events: none; }
/* enlarge buttons: one pane takes the whole stage */
.maxbtn { position: absolute; z-index: 700; width: 32px; height: 32px; display: grid; place-items: center; border: 0; border-radius: 50%; background: rgba(12, 28, 39, .72); backdrop-filter: blur(10px); color: var(--on-deep); }
.maxbtn:hover { background: var(--deep); color: #fff; }
.maxbtn svg { width: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.maxbtn .shrink, .maxbtn[aria-pressed="true"] .grow { display: none; }
.maxbtn[aria-pressed="true"] .shrink { display: inline; }
#overview > .maxbtn { right: 10px; bottom: 40px; display: none; }
body[data-view="park"] #overview > .maxbtn { display: grid; }
.viewer > .maxbtn { right: 48px; top: 10px; }
.panel > .maxbtn { position: sticky; float: right; top: 0; margin: -6px -8px 0 8px; background: var(--card); color: var(--ink-2); box-shadow: inset 0 0 0 1px var(--line); }
.panel > .maxbtn:hover { background: var(--deep); color: #fff; }
body[data-max="map"] .stage, body[data-max="scene"] .stage, body[data-max="panel"] .stage { grid-template-columns: minmax(0, 1fr) !important; grid-template-rows: minmax(0, 1fr) !important; }
body[data-max="map"] #park, body[data-max="map"] #splitX { display: none; }
body[data-max="scene"] #overview, body[data-max="panel"] #overview, body[data-max="scene"] #splitX, body[data-max="panel"] #splitX { display: none; }
body[data-max="scene"] #park, body[data-max="panel"] #park { border: 0; }
body[data-max="scene"] .viewer { height: 100% !important; }
body[data-max="scene"] #splitY, body[data-max="scene"] .panel, body[data-max="panel"] #splitY, body[data-max="panel"] .viewer { display: none; }
body[data-max="panel"] .panel { padding-left: max(20px, calc(50% - 380px)); padding-right: max(20px, calc(50% - 380px)); }
#overview { position: relative; min-width: 0; }
#park { position: relative; display: flex; flex-direction: column; min-height: 0; background: var(--paper); border-left: 1px solid var(--line); box-shadow: -8px 0 24px rgba(12, 28, 39, .08); z-index: 1; }
.viewer { position: relative; flex: none; height: var(--viewer-h, 46%); min-height: 120px; background: #dfe9ec; }
#map, #scene { position: absolute; inset: 0; }
/* OSM tiles toned to a pale nautical-chart blue-grey so the data marks lead */
#map { background: #d3dde0; }
#map .osm-tiles { filter: grayscale(1) sepia(.35) hue-rotate(160deg) saturate(.55) brightness(1.06) contrast(.88); }
.card { position: absolute; background: var(--card); border-radius: var(--r); box-shadow: var(--shadow); z-index: 500; }

.stats { left: 16px; top: 16px; width: 248px; padding: 14px 16px 12px; color: var(--ink-2); font-size: 12.5px; }
.kpi { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 8px; }
.kpi b { font-size: 34px; font-weight: 600; color: #15623b; line-height: 1.05; letter-spacing: -.02em; }
.kpi.pg b { font-size: 22px; color: #a33f08; }
.kpi.rv b { font-size: 18px; color: var(--ink-2); }
.kpi span { white-space: nowrap; }
.kpi + .kpi { margin-top: 4px; }
.kbar { flex: 1 0 100%; height: 3px; margin: 4px 0 2px; border-radius: 2px; background: var(--line); overflow: hidden; }
.kbar i { display: block; height: 100%; background: #15623b; transition: width .2s; }
/* legend: point shapes in ink, the NOAA level swatches by colour */
.maplegend { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); font-size: 11px; color: var(--ink-2); display: grid; gap: 7px; }
.lg-grid { display: grid; grid-template-columns: 30px repeat(6, 1fr); gap: 3px; align-items: center; }
.lg-grid > i { height: 9px; border-radius: 2px; }
.lg-grid em { text-align: center; font-family: var(--mono); font-size: 10px; font-style: normal; color: var(--ink-3); }
.lg-k { display: flex; gap: 4px; align-items: center; }
.lg-keys { display: flex; flex-wrap: wrap; gap: 3px 10px; }
.lg-keys span { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
[class^="sh-"] { display: inline-block; flex: none; width: 8px; height: 8px; background: var(--ink-2); }
.sh-park { border-radius: 50%; }
.sh-res { width: 0; height: 0; background: none; border: 4.5px solid transparent; border-top: 0; border-bottom: 8px solid var(--ink-2); }
.sh-pg { width: 7px; height: 7px; transform: rotate(45deg); }
.sh-off { border-radius: 50%; background: #fff; box-shadow: inset 0 0 0 1.2px var(--ink-3); }
.sh-edge { border-radius: 50%; background: #fff; box-shadow: inset 0 0 0 2px #1d7446; }
.lg-flood { display: flex; flex-wrap: wrap; align-items: center; gap: 3px 10px; }
.lg-flood span { display: inline-flex; align-items: center; gap: 4px; }
.lg-flood small { flex: 1 0 100%; font-family: var(--mono); font-size: 10px; color: var(--ink-3); }
.lg-hint { color: var(--ink-3); }
.fl-today, .fl-new { width: 12px; height: 8px; border-radius: 2px; }
.fl-today { background: rgba(96, 140, 176, .35); }
.fl-new { background: rgba(24, 92, 212, .65); box-shadow: inset 0 0 0 1px rgb(8, 46, 130); }
.lg-grp { display: flex; align-items: center; gap: 6px; color: var(--ink-3); }
.lg-grp i { width: 10px; height: 10px; border-radius: 50%; background: #15623b; box-shadow: 0 0 0 2px #cc540f; }
body:not(.grouped) .lg-grp { display: none; }

/* demo parks: one pill at the bottom left, opens upward into a list */
.sitelist { left: 16px; bottom: 22px; width: 248px; max-height: calc(100% - 32px); overflow: auto; }
.sitelist summary { list-style: none; cursor: pointer; padding: 9px 14px; font-size: 12.5px; font-weight: 600; color: var(--ink); display: flex; align-items: center; gap: 8px; }
.sitelist summary::-webkit-details-marker { display: none; }
.sitelist summary::after { content: "›"; margin-left: auto; color: var(--ink-3); transform: rotate(-90deg); transition: transform .15s; }
.sitelist[open] summary::after { transform: rotate(90deg); }
.sitelist[open] { padding-bottom: 6px; }
#siteItems { padding: 0 6px; }
.sitelist button { display: grid; grid-template-columns: 1fr auto; align-items: baseline; gap: 6px; width: 100%; text-align: left; background: none; border: 0; border-radius: 6px; padding: 6px 8px; }
.sitelist button:hover { background: rgba(27, 106, 133, .08); }
.sitelist b { font-size: 13px; font-weight: 600; }
.sitelist span { font-size: 11px; color: var(--ink-3); white-space: nowrap; }
.found-ring { animation: found 1.4s ease-out 3; transform-origin: center; transform-box: fill-box; }
@keyframes found { from { stroke-opacity: 1; } to { stroke-opacity: .25; } }

/* search in the top bar */
.search { position: relative; flex: 0 1 340px; min-width: 0; }
.search svg { position: absolute; left: 11px; top: 50%; width: 15px; transform: translateY(-50%); fill: none; stroke: var(--on-deep-2); stroke-width: 2; stroke-linecap: round; pointer-events: none; }
.search input { width: 100%; height: 32px; padding: 0 12px 0 32px; border: 1px solid var(--line-deep); border-radius: 999px; background: var(--deep-2); color: var(--on-deep); font-size: 13px; outline: none; }
.search input::placeholder { color: var(--on-deep-2); }
.search input:focus { border-color: var(--foam); background: #1b3b4e; }
.search ul { position: absolute; left: 0; right: 0; top: calc(100% + 6px); min-width: 300px; margin: 0; padding: 4px; list-style: none; background: var(--card); color: var(--ink); border-radius: var(--r); box-shadow: var(--shadow); max-height: 60vh; overflow: auto; }
.search li { display: grid; grid-template-columns: 14px minmax(0, 1fr) auto; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 6px; font-size: 13px; cursor: pointer; }
.search li span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search li small { color: var(--ink-3); font-size: 11px; white-space: nowrap; }
.search li:hover, .search li[aria-selected="true"] { background: rgba(27, 106, 133, .1); }
.search li.find { color: var(--sea-d); border-top: 1px solid var(--line-2); }
.search li.none, .search li.credit { display: block; cursor: default; color: var(--ink-3); font-size: 11.5px; }
.search li.credit { font-size: 10.5px; padding-top: 4px; }
.search li.none:hover, .search li.credit:hover { background: none; }
.search i.pin { width: 9px; height: 9px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); background: var(--coral); justify-self: center; }
.search i[class^="sh-"] { justify-self: center; }

.demo-label { background: var(--deep); color: var(--on-deep); border: 0; box-shadow: 0 2px 8px rgba(0, 0, 0, .2); font-size: 12px; padding: 3px 8px; border-radius: 4px; }
.demo-label::before { display: none; }
.leaflet-tooltip { font-size: 12px; border-radius: 6px; border: 0; box-shadow: var(--shadow); }
.fbars { display: inline-flex; align-items: flex-end; gap: 3px; height: 34px; margin: 4px 0 12px; }
.fbars i { position: relative; width: 14px; height: 100%; border-radius: 2px; background: linear-gradient(to top, #1d7446 var(--h), #e6ece8 var(--h)); }
.fbars em { position: absolute; top: 100%; left: 0; right: 0; text-align: center; font: 9px/12px var(--mono); font-style: normal; color: var(--ink-3); }
.leaflet-tooltip small { color: var(--ink-3); }
.kpi .rng { flex: 1 0 100%; font: 11px/1.3 var(--mono); color: var(--ink-3); }
.leaflet-control-zoom.leaflet-bar { border: 0; box-shadow: var(--shadow); }
.leaflet-control-zoom a { color: var(--ink); }
/* vendor/ ships no Leaflet images: draw the layers icon inline */
.leaflet-control-layers { border: 0 !important; box-shadow: var(--shadow) !important; }
.leaflet-control-layers-toggle { width: 34px !important; height: 34px !important; background: center / 20px no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230f2230' stroke-width='1.8' stroke-linejoin='round'%3E%3Cpath d='M12 3 2 8l10 5 10-5z'/%3E%3Cpath d='m2 13 10 5 10-5'/%3E%3C/svg%3E") !important; }
.leaflet-control-layers-expanded { padding: 8px 12px; font-size: 12.5px; }
.leaflet-container .leaflet-control-attribution { background: rgba(255, 253, 247, .8); font-size: 10.5px; }

/* park view: 3D window */
.scene-tools { position: absolute; left: 10px; top: 10px; display: flex; gap: 2px; padding: 3px; align-items: center; z-index: 500; background: rgba(12, 28, 39, .72); backdrop-filter: blur(10px); border-radius: 999px; }
.tool { min-width: 40px; border: 0; background: none; border-radius: 999px; padding: 5px 11px; font-size: 12.5px; color: var(--on-deep-2); }
.tool:hover { color: #fff; }
.tool.on { color: var(--deep); background: var(--foam); }
#exag { color: var(--on-deep); font-family: var(--mono); }
.close-park { position: absolute; right: 10px; top: 10px; z-index: 700; width: 32px; height: 32px; border-radius: 50%; border: 0; background: rgba(12, 28, 39, .72); backdrop-filter: blur(10px); font-size: 18px; line-height: 1; color: var(--on-deep); }
.close-park:hover { background: var(--deep); color: #fff; }
.loading { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(244, 240, 230, .6); z-index: 600; }
.loading > span { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--sea); animation: spin 1s linear infinite; }
.loading.building > span { display: none; }
/* terrain already shown: the build card waits in a corner and leaves the scene free to orbit */
.loading.partial { background: none; place-items: end start; padding: 0 0 54px 10px; pointer-events: none; }
.loading.partial .build { pointer-events: auto; transform: scale(.8); transform-origin: bottom left; }
.loading.partial .tide { display: none; }
.build { display: grid; justify-items: center; gap: 10px; min-width: 220px; padding: 20px 24px 16px; background: var(--card); border-radius: var(--r); box-shadow: var(--shadow); }
.build b { font-family: var(--serif); font-size: 16px; max-width: 260px; text-align: center; }
.tide { width: 72px; height: 72px; }
.tide .rim { fill: none; stroke: var(--sea); stroke-width: 2; }
.tide .level { transform: translateY(54px); transition: transform .9s ease; }
.tide .w1 { fill: var(--sea); animation: tide 2.4s linear infinite; }
.tide .w2 { fill: #8ec5d6; animation: tide 3.6s linear infinite reverse; }
@keyframes tide { to { transform: translateX(-32px); } }
.build ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 5px; font-size: 13px; min-width: 180px; }
.build li { display: flex; align-items: center; gap: 8px; color: var(--ink-2); }
.build li i { width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--dry); box-sizing: border-box; flex: none; }
.build li[data-state="active"] { color: var(--ink); }
.build li[data-state="active"] i { border-color: var(--sea); animation: pulse 1.2s ease-in-out infinite; }
.build li[data-state="done"] i { background: var(--sea); border-color: var(--sea); }
.build li small { margin-left: auto; color: #8a5200; font-size: 11.5px; }
@keyframes pulse { 50% { transform: scale(.6); opacity: .5; } }
.build time { font-family: var(--mono); font-size: 12px; color: var(--ink-2); }
.build-err { display: grid; justify-items: center; gap: 8px; max-width: 260px; text-align: center; font-size: 12.5px; color: #8a2d0a; }
.build-err p { margin: 0; }
.build-err .ghost { color: var(--ink); border-color: var(--line); }
@media (prefers-reduced-motion: reduce) { .tide .w1, .tide .w2, .build li i { animation: none !important; } }
@keyframes spin { to { transform: rotate(360deg); } }

.legend3d { left: 10px; bottom: 10px; padding: 7px 10px; font-size: 11px; color: var(--on-deep); background: rgba(12, 28, 39, .72); backdrop-filter: blur(10px); box-shadow: none; display: grid; gap: 5px; }
.legend3d .ramp { display: flex; align-items: center; gap: 6px; font-family: var(--mono); }
.legend3d .ramp i { width: 90px; height: 6px; border-radius: 3px; background: linear-gradient(90deg, #3d94bd, #2a6f98 40%, #10406b); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .25); }
.legend3d .st { margin-left: 6px; }
@media (max-width: 700px) { .legend3d { display: none; } }

/* park view: information column */
.panel { flex: 1; min-height: 0; padding: 18px 20px 12px; overflow: auto; }
.panel-head h2 { margin: 0; font-family: var(--serif); font-size: 26px; font-weight: 700; letter-spacing: .02em; line-height: 1.2; }
.panel-head p { margin: 3px 0 0; color: var(--ink-2); font-size: 13px; }
.panel-head .meta { font-family: var(--mono); font-size: 11px; color: var(--ink-3); letter-spacing: .02em; }
.caveat { margin: 12px 0 0; padding: 9px 11px; border-radius: 6px; background: #fbeedd; color: #6d4100; font-size: 12.5px; line-height: 1.5; border-left: 3px solid var(--peak); }

.nowcard { margin: 16px 0 4px; padding: 14px 14px 12px; background: var(--deep); color: var(--on-deep); border-radius: var(--r); }
.now-ctx { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 6px; font-size: 12px; color: var(--on-deep-2); }
.now-ctx b { font-family: var(--mono); font-weight: 600; color: var(--on-deep); }
.now-ctx span { margin-left: auto; font-family: var(--mono); color: var(--foam); }
.metrics { display: grid; grid-template-columns: 1.6fr 1fr 1fr 1fr; gap: 12px; margin-top: 10px; align-items: end; }
.metrics div { display: grid; gap: 2px; min-width: 0; }
.metrics b { font-size: 22px; font-weight: 500; color: var(--on-deep); white-space: nowrap; line-height: 1.1; }
.metrics b small { font-size: 11px; color: var(--on-deep-2); margin-left: 2px; }
.metrics span { font-size: 11px; color: var(--on-deep-2); white-space: nowrap; }
.metrics .hero b { font-size: 40px; color: var(--foam); letter-spacing: -.02em; }
.metrics .hero b small { font-size: 16px; color: var(--foam); }
.metrics .bar { display: block; height: 4px; margin-top: 4px; border-radius: 2px; background: rgba(255, 255, 255, .14); overflow: hidden; }
.metrics .bar i { display: block; height: 100%; background: var(--foam); }

.sec { margin-top: 20px; }
.sec-title { display: flex; align-items: baseline; gap: 8px; margin: 0 0 8px; padding-bottom: 6px; border-bottom: 1px solid var(--line); font-family: var(--serif); font-size: 15px; font-weight: 600; color: var(--ink); }
.sec-title span { margin-left: auto; font-family: var(--mono); font-size: 11px; font-weight: 400; color: var(--ink-3); }

.years table { width: 100%; border-collapse: separate; border-spacing: 3px; font-size: 12px; }
.years th { font-weight: 400; color: var(--ink-2); padding: 2px 4px; }
.years thead th { font-size: 11px; color: var(--ink-3); }
.years tbody th { text-align: left; white-space: nowrap; font-size: 12px; }
.years td { text-align: center; padding: 5px 2px; border-radius: 4px; color: var(--ink-2); background: var(--card); box-shadow: inset 0 0 0 1px var(--line); transition: background .2s, color .2s; }
.years td.hit { background: rgba(11, 61, 92, var(--a)); box-shadow: none; color: var(--ink); }
.years td.hit.dark { color: #fff; }
.years td.none { background: none; box-shadow: none; color: var(--ink-3); }
.years td.cur { box-shadow: inset 0 0 0 2px var(--coral); font-weight: 600; }

.chart { position: relative; }
.chart svg { display: block; width: 100%; }
.chart .grid { stroke: var(--line-2); }
.chart .tick { font-family: var(--mono); font-size: 9.5px; fill: var(--ink-3); }
.chart .bar-obs { fill: #a9b6bc; }
.chart .line-main { fill: none; stroke: var(--sea-d); stroke-width: 2.2; }
.chart .line-other { fill: none; stroke: #cfd6d8; stroke-width: 1.2; }
.chart .now { stroke: var(--coral); stroke-dasharray: 3 3; }
.chart .cross { stroke: var(--ink-3); }
.chart .tip { position: absolute; top: 4px; background: var(--deep); color: var(--on-deep); box-shadow: var(--shadow); border-radius: 6px; padding: 5px 8px; font-size: 11.5px; pointer-events: none; white-space: nowrap; }
.legend { display: flex; gap: 14px; font-size: 11px; color: var(--ink-2); margin-top: 4px; }
.legend i { display: inline-block; width: 12px; height: 8px; margin-right: 4px; vertical-align: middle; border-radius: 2px; }
.k-obs { background: #a9b6bc; } .k-main { background: var(--sea-d); height: 2px !important; } .k-other { background: #cfd6d8; height: 2px !important; }

.facilities, .facilities ul { list-style: none; margin: 0; padding: 0; }
.grp > button { display: flex; align-items: center; gap: 8px; width: 100%; border: 0; background: none; padding: 9px 4px; border-bottom: 1px solid var(--line-2); text-align: left; }
.grp > button:hover { background: rgba(27, 106, 133, .05); }
.grp > button::before { content: "›"; color: var(--ink-3); transition: transform .15s; width: 8px; }
.grp.open > button::before { transform: rotate(90deg); }
.grp .nm { flex: 1; font-size: 13.5px; }
.grp .n { font-family: var(--mono); font-size: 11.5px; color: var(--ink-3); }
.grp .cnt { display: flex; gap: 6px; font-family: var(--mono); font-size: 11.5px; align-items: center; min-width: 64px; justify-content: flex-end; }
.st { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 3px; }
.st.now { background: var(--now); } .st.peak { background: var(--peak); } .st.dry { background: var(--dry); }
.grp ul { padding: 4px 0 8px 14px; }
.grp li > button { display: flex; align-items: center; gap: 6px; width: 100%; border: 0; background: none; padding: 5px 6px; border-radius: 5px; font-size: 13px; text-align: left; }
.grp li > button:hover, .grp li.sel > button { background: rgba(27, 106, 133, .08); }
.grp li .nm { flex: 1; }
.grp li .d { font-size: 11.5px; color: var(--ink-2); }
.cf { font-style: normal; font-size: 10.5px; padding: 1px 6px; border-radius: 999px; border: 1px solid var(--line); color: var(--ink-2); }
.cf.official { border-color: #8fb8c4; color: var(--sea-d); }
.cf.inferred { border-style: dashed; }
.detail { margin: 4px 6px 10px; padding: 12px; background: var(--card); border-radius: 8px; box-shadow: inset 0 0 0 1px var(--line); font-size: 12.5px; }
.detail dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 0; }
.detail dt { color: var(--ink-3); } .detail dd { margin: 0; }
.detail .warn { color: #8a5200; margin: 8px 0 0; }
.detail .tier { color: var(--ink-3); font-size: 11.5px; margin: 8px 0 0; }
.parts { list-style: none; margin: 10px 0 0; padding: 8px 0 0; border-top: 1px solid var(--line); }
.parts li { display: grid; grid-template-columns: 1fr auto 52px; gap: 8px; padding: 2px 0; }
.parts .h { color: var(--ink-2); font-size: 11.5px; }
.parts .r { font-weight: 600; text-align: right; } .parts .r.yes { color: var(--now); } .parts .r.maybe { color: #8a5200; } .parts .r.no { color: var(--ink-3); font-weight: 400; }
.tasks { margin: 8px 0 0; padding-left: 18px; }
.tasks li { margin: 2px 0; }
.basis { color: var(--ink-3); font-size: 11px; margin: 6px 0 0; }

/* dock */
.dock { position: relative; display: flex; align-items: center; gap: 22px; padding: 10px 20px 12px; background: var(--deep); color: var(--on-deep); z-index: 1000; }
/* the top edge of the dock is the sea: two wave layers drift in opposite directions, faster while a playback runs */
.dock::before, .dock::after { content: ""; position: absolute; left: 0; right: 0; bottom: 100%; pointer-events: none; background-repeat: repeat-x; }
.dock::before { height: 16px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 16' preserveAspectRatio='none'%3E%3Cpath d='M0 9 C20 2 40 2 60 9 S100 16 120 9 V16 H0Z' fill='%237fd0e6'/%3E%3C/svg%3E"); background-size: 180px 16px; opacity: .45; animation: swell 11s linear infinite reverse; }
.dock::after { height: 11px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 16' preserveAspectRatio='none'%3E%3Cpath d='M0 9 C20 2 40 2 60 9 S100 16 120 9 V16 H0Z' fill='%230c1c27'/%3E%3C/svg%3E"); background-size: 120px 11px; animation: swell 7s linear infinite; }
@keyframes swell { from { background-position-x: 0; } to { background-position-x: 360px; } }
body.playing .dock::before { animation-duration: 4s; }
body.playing .dock::after { animation-duration: 2.5s; }
body.calm .dock::before, body.calm .dock::after { animation: none; }
@media (prefers-reduced-motion: reduce) { .dock::before, .dock::after { animation: none; } }
/* map controls and cards keep clear of the waves */
#map .leaflet-bottom { margin-bottom: 12px; }
.year { display: flex; align-items: center; gap: 12px; flex: 1 1 480px; min-width: 300px; }
.year output { font-size: 32px; font-weight: 600; color: #fff; width: 84px; letter-spacing: -.02em; }
.track { flex: 1; min-width: 0; display: grid; gap: 2px; }
.track input { width: 100%; margin: 0; accent-color: var(--foam); }
.ticks { display: flex; justify-content: space-between; font-family: var(--mono); font-size: 10px; color: var(--on-deep-2); }
.yplay { flex: none; width: 34px; height: 34px; border-radius: 50%; border: 1.5px solid var(--foam); background: none; color: var(--foam); font-size: 12px; }
.yplay[aria-pressed="true"] { background: var(--foam); color: var(--deep); }
.group { display: grid; gap: 5px; }
.cap { display: flex; align-items: center; gap: 8px; font-size: 11px; color: var(--on-deep-2); letter-spacing: .04em; }
.cap select { border: 1px solid var(--line-deep); border-radius: 4px; padding: 0 4px; background: var(--deep-2); color: var(--on-deep); font-size: 11px; }
.cap select:disabled { opacity: .4; }
.seg, .events { display: flex; flex-wrap: wrap; gap: 3px; }
.seg { flex-wrap: nowrap; padding: 2px; background: var(--deep-2); border-radius: 6px; }
.seg button { border: 0; background: none; border-radius: 4px; padding: 4px 10px; font-size: 12.5px; color: var(--on-deep-2); white-space: nowrap; }
.seg button:hover { color: #fff; }
.seg button[aria-checked="true"] { background: var(--foam); color: var(--deep); font-weight: 600; }
.events button { border: 1px solid var(--line-deep); background: none; border-radius: 999px; padding: 3px 10px; font-size: 12px; color: var(--on-deep); white-space: nowrap; }
.events button:hover { border-color: var(--foam); }
.events button[aria-checked="true"] { background: var(--coral); border-color: var(--coral); color: #fff; }
.play { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.primary { flex: none; width: 42px; height: 42px; border-radius: 50%; border: 0; background: var(--coral); color: #fff; font-size: 14px; box-shadow: 0 3px 12px rgba(228, 105, 58, .4); }
.primary:disabled { opacity: .3; cursor: default; box-shadow: none; }
/* the overview has no single water level: the stats card carries year, scenario and event */
body[data-view="overview"] .level { display: none; }
.level output { display: block; font-size: 20px; font-weight: 600; white-space: nowrap; color: #fff; }
.level small { font-size: 11px; color: var(--on-deep-2); white-space: nowrap; }
.spark { width: 180px; height: 46px; flex: none; }
.spark .ser { fill: none; stroke: var(--foam); stroke-width: 1.6; }
.spark .mhhw { stroke: var(--on-deep-2); stroke-dasharray: 2 3; }
.spark .cur { stroke: var(--coral); stroke-width: 2; }
.spark text { font-size: 10px; fill: var(--on-deep-2); }

dialog { border: 0; border-radius: 12px; padding: 24px 28px; max-width: 680px; max-height: 80vh; background: var(--card); box-shadow: var(--shadow); color: var(--ink); font-size: 14px; line-height: 1.65; }
dialog::backdrop { background: rgba(12, 28, 39, .45); }
dialog h2 { margin: 0 0 8px; font-family: var(--serif); font-size: 22px; }
dialog h3 { margin: 18px 0 4px; font-family: var(--serif); font-size: 15px; color: var(--sea-d); }
dialog ul { padding-left: 18px; margin: 4px 0; }
dialog .close { position: absolute; right: 14px; top: 10px; border: 0; background: none; font-size: 22px; color: var(--ink-3); }
dialog a { color: var(--sea); }

/* one row needs about 1860 px; below that the year slider takes its own row and the events share the second */
@media (max-width: 1860px) {
  .dock { flex-wrap: wrap; gap: 8px 22px; padding: 8px 20px 10px; }
  .year { flex: 1 1 100%; }
  .group.ev { flex: 1 1 360px; min-width: 0; }
}
@media (max-width: 1180px) {
  .dock { gap: 8px 18px; padding: 8px 14px 10px; }
  .spark { display: none; }
  .year output { font-size: 26px; width: 72px; }
}
@media (max-width: 700px) {
  :root { --top: 48px; }
  .top { padding: 0 12px; gap: 10px; }
  .brand { gap: 8px; }
  .brand svg { width: 26px; }
  .site-name { display: none; }
  .search { flex: 1 1 auto; }
  .search ul { min-width: 0; position: fixed; left: 8px; right: 8px; top: calc(var(--top) + 4px); }
  .top .ghost { padding: 5px 10px; font-size: 12px; }
  /* phones: the methods button keeps its label for screen readers and shows an "i" */
  #methods { width: 32px; height: 32px; padding: 0; font-size: 0; }
  #methods::before { content: "i"; font: italic 600 15px/1 var(--serif); }
  #lang { padding: 5px 8px; }
  body[data-view="park"] .stage { grid-template-columns: minmax(0, 1fr); grid-template-rows: var(--map-h, 34%) 0 minmax(0, 1fr); }
  #splitX::before { inset: -8px 0; cursor: row-resize; }
  #splitX::after { left: 50%; top: -2px; width: 44px; height: 4px; margin: 0 0 0 -22px; opacity: .5; }
  .split.h::after { opacity: .5; }
  #park { border-left: 0; border-top: 1px solid var(--line); }
  .viewer { height: var(--viewer-h, 52%); }
  .sitelist { display: none; }
  body[data-view="park"] .stats { display: none; }
  .stats { left: 8px; top: 8px; width: auto; max-width: calc(100% - 64px); padding: 8px 12px; }
  .maplegend { display: none; }
  #stats { display: flex; flex-wrap: wrap; gap: 0 14px; }
  .kpi b, .kpi.pg b, .kpi.rv b { font-size: 20px; }
  .kpi + .kpi { margin-top: 0; }
  .panel { padding: 14px 14px 10px; }
  .metrics { grid-template-columns: repeat(3, 1fr); }
  .metrics .hero { grid-column: 1 / -1; }
  .dock { gap: 6px 12px; padding: 6px 12px 8px; }
  .group { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; min-width: 0; max-width: 100%; }
  .group.ev { display: grid; gap: 4px; }
  .cap { flex: none; }
  .events button { padding: 3px 8px; }
  body[data-view="overview"] .play { display: none; }
  .year output { font-size: 22px; width: 60px; }
  .yplay { width: 30px; height: 30px; }
  .primary { width: 36px; height: 36px; }
  .seg button { padding: 4px 8px; }
  .play { margin-left: 0; }
  .year { min-width: 0; }
}
