:root {
  --ink: #0f2a33; --ink-2: #3d5961; --muted: #6f878d; --line: #d8e3e4;
  --paper: #fbfaf6; --panel: #ffffff; --chip: #eef4f3;
  --sea: #0b3d4a; --sea-2: #11697a; --lagoon: #2bb3a3; --sand: #f0dfb8; --coral: #e8664f; --sun: #f2b134;
  --good: #1f9d6b; --ok: #9cc23b; --poor: #f0a33a; --bad: #d9473a; --unk: #b9c6c8;
  --v1: #13a3b5; --v2: #f07e3c;
  --shadow: 0 6px 24px rgba(8, 40, 50, .18);
  --radius: 14px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; background: var(--sea); color: var(--ink); font: 15px/1.45 var(--font); }
button { font: inherit; color: inherit; cursor: pointer; }
#map { position: fixed; inset: 0; background: #0d4a58; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
/* Leaflet draws lines (tracks, routes, measure) into its own <svg>: keep the icon sizing above off it */
.leaflet-pane > svg { width: auto; height: auto; }

/* ---------- top bar ---------- */
.topbar { position: fixed; top: max(10px, env(safe-area-inset-top)); left: 10px; right: 10px; z-index: 1000; display: flex; gap: 8px; pointer-events: none; }
.topbar > * { pointer-events: auto; }
.brand { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border: 0; border-radius: var(--radius); background: var(--sea); color: #fff; box-shadow: var(--shadow); text-align: left; }
.brand svg { width: 24px; height: 24px; color: var(--sand); }
.brand span { display: flex; flex-direction: column; line-height: 1.1; }
.brand b { font-size: 16px; letter-spacing: .3px; }
.brand small { font-size: 11px; opacity: .75; }
.brand b i { font-style: normal; } .brand .short { display: none; }
.search { position: relative; flex: 1; max-width: 420px; }
.search input { width: 100%; height: 100%; min-height: 44px; padding: 0 14px; border: 0; border-radius: var(--radius); background: var(--panel); box-shadow: var(--shadow); font-size: 15px; color: var(--ink); }
#searchResults { position: absolute; top: 50px; left: 0; right: 0; margin: 0; padding: 4px; list-style: none; background: var(--panel); border-radius: var(--radius); box-shadow: var(--shadow); max-height: 50vh; overflow: auto; display: none; }
#searchResults.open { display: block; }
#searchResults li { padding: 8px 10px; border-radius: 9px; cursor: pointer; }
#searchResults li:hover, #searchResults li.active { background: var(--chip); }
#searchResults small { color: var(--muted); display: block; }

/* ---------- dock ---------- */
.dock { position: fixed; z-index: 1000; right: 10px; top: 50%; transform: translateY(-50%); display: flex; flex-direction: column; gap: 6px; padding: 6px; background: var(--panel); border-radius: var(--radius); box-shadow: var(--shadow); }
.dock button { display: flex; flex-direction: column; align-items: center; gap: 2px; width: 58px; padding: 7px 2px; border: 0; border-radius: 10px; background: transparent; color: var(--ink-2); font-size: 10.5px; }
.dock button:hover { background: var(--chip); }
.dock button.on { background: var(--sea); color: #fff; }

/* ---------- sheet (panel) ---------- */
.sheet { position: fixed; z-index: 1001; background: var(--paper); box-shadow: var(--shadow); display: none; overflow: hidden; }
.sheet.open { display: flex; flex-direction: column; }
#sheetBody { overflow: auto; padding: 18px 20px 28px; -webkit-overflow-scrolling: touch; }
.sheet-close { position: absolute; top: 8px; right: 10px; width: 36px; height: 36px; border: 0; border-radius: 50%; background: var(--chip); font-size: 22px; line-height: 1; z-index: 2; }
.sheet-grip { display: none; }
.sheet-back { position: absolute; top: 8px; right: 54px; height: 36px; padding: 0 12px; border: 0; border-radius: 18px; background: var(--chip); font-size: 14px; font-weight: 600; color: var(--sea-2); z-index: 2; }
.sheet-back[hidden] { display: none; }
.sheet:has(#sheetBack:not([hidden])) #sheetBody > h2:first-of-type { margin-right: 140px; }
@media (min-width: 761px) {
  .sheet { top: 74px; bottom: 14px; left: 10px; width: 400px; border-radius: var(--radius); }
}
@media (max-width: 760px) {
  /* full width so all 9 tools fit from 320 px up; it stays above the open sheet so you can switch tools */
  .dock { z-index: 1002; top: auto; left: 8px; right: 8px; bottom: max(8px, env(safe-area-inset-bottom)); transform: none; flex-direction: row; justify-content: space-between; gap: 0; padding: 3px; max-width: 520px; margin: 0 auto; }
  .dock button { flex: 1 1 0; min-width: 0; width: auto; font-size: 9.5px; padding: 6px 0; white-space: nowrap; overflow: hidden; }
  .dock button span { max-width: 100%; overflow: hidden; text-overflow: clip; }
  .brand small, .brand .full { display: none; }
  .brand .short { display: inline; }
  .sheet { left: 0; right: 0; bottom: 0; height: 58vh; border-radius: 18px 18px 0 0; }
  .sheet.tall { height: 88vh; }
  .sheet-grip { display: block; height: 22px; cursor: grab; flex: none; }
  .sheet-grip::after { content: ""; display: block; width: 44px; height: 5px; margin: 8px auto; border-radius: 3px; background: var(--line); }
  #sheetBody { padding-top: 4px; padding-bottom: 90px; }
  .coords { display: none; }
}

/* ---------- content ---------- */
h2 { margin: 0 44px 4px 0; font-size: 21px; line-height: 1.2; }
h3 { margin: 18px 0 6px; font-size: 13px; text-transform: uppercase; letter-spacing: .6px; color: var(--sea-2); }
p { margin: 6px 0; }
.sub { color: var(--muted); font-size: 13px; margin-bottom: 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 99px; background: var(--chip); font-size: 12.5px; color: var(--ink-2); border: 1px solid transparent; }
button.chip { cursor: pointer; }
button.chip.on { background: var(--sea); color: #fff; }
.chip.sky { background: #dff3f6; color: #0d6676; }
h3 .from.ok { color: #2e8b57; }
h3 .from { font-size: 11px; font-weight: 500; color: var(--muted, #6b7a80); margin-left: 4px; }
.ours-line { margin: 4px 0 10px; padding: 6px 10px; border-left: 3px solid #13a3b5; background: #eef8f9; border-radius: 0 8px 8px 0; }
.ours-line p { margin: 2px 0; } .ours-line > b { color: #0d6676; }
body.night .ours-line { background: #1a0d08; border-left-color: #ff8c7a; } body.night .ours-line > b { color: #ff8c7a; }

.chip.warn { background: #fde7e3; color: #a3352a; }
.chip.cyc { background: #ffe9c7; color: #8a5300; }
.pos { display: flex; align-items: center; gap: 8px; font-variant-numeric: tabular-nums; font-size: 14px; }
.pos button { border: 1px solid var(--line); background: var(--panel); border-radius: 8px; padding: 3px 8px; font-size: 12px; }
.stats { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.stats .stat { flex: 1 1 auto; min-width: 72px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; }
.stat small { display: block; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }
.stat b { font-size: 13px; font-weight: 600; }
.rose-row { display: flex; gap: 14px; align-items: center; margin: 6px 0 4px; }
.rose { width: 128px; height: 128px; flex: none; }
.rose svg { width: 128px; height: 128px; stroke: none; }
.rose-legend { font-size: 12.5px; color: var(--ink-2); }
.rose-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }
.coming { margin: 12px 0; padding: 10px 12px; border-left: 4px solid #e0a800; background: #fff4d6; border-radius: 0 10px 10px 0; font-size: 14px; } .coming a { color: #b3261e; font-weight: 600; }
.seo-link { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.share-btn { float: right; margin: 2px 0 0 8px; padding: 5px 11px; border: 1px solid var(--line); border-radius: 999px; background: var(--panel); color: var(--sea-2, #0d6676); font: 600 13px system-ui, sans-serif; cursor: pointer; }
.ours { margin: 14px 0; padding: 12px 14px; border-radius: 12px; background: linear-gradient(135deg, #e6f6f4, #fff6e6); border: 1px solid #cfe9e4; }
.yt-cta { margin: 16px 0 6px; padding: 10px 12px; border-radius: 10px; background: #fdecea; font-size: 14px; } .yt-cta a { color: #b3261e; font-weight: 600; text-decoration: none; }
.support { margin: 16px 0; padding: 12px 14px; border-radius: 12px; background: linear-gradient(135deg, #fff1e6, #fdecea); border: 1px solid #f3d3c8; } .support h3 { margin-top: 0; } .support ul { padding-left: 18px; margin: 6px 0 0; } .support li { margin: 6px 0; } .support a { color: #b3261e; text-decoration: none; }
.ours h3 { margin-top: 0; color: #0d7a6c; }
.caution { margin: 12px 0; padding: 10px 12px; border-radius: 12px; background: #fff1ee; border: 1px solid #f6cbc3; color: #6e2a20; }
.caution h3 { margin-top: 0; color: var(--bad); }
.people li, .list li { margin: 3px 0; }
ul.list { padding-left: 18px; margin: 4px 0; }
.marks { font-size: 13px; }
.marks button { display: block; width: 100%; text-align: left; border: 0; background: transparent; padding: 5px 0; border-bottom: 1px dashed var(--line); font-variant-numeric: tabular-nums; }
.sources { font-size: 12px; color: var(--muted); }
.navrow { display: flex; justify-content: space-between; margin-top: 18px; gap: 8px; }
.navrow button, .btn { border: 1px solid var(--line); background: var(--panel); border-radius: 10px; padding: 8px 12px; font-size: 13px; }
.btn.primary { background: var(--sea); color: #fff; border-color: var(--sea); }
.group-card { margin: 10px 0; padding: 12px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); }
.group-card h4 { margin: 0 0 4px; font-size: 16px; }
.group-card p { font-size: 13.5px; color: var(--ink-2); }
.plist { list-style: none; padding: 0; margin: 6px 0 0; }
.plist li { display: flex; align-items: center; gap: 8px; padding: 7px 4px; border-top: 1px solid var(--line); cursor: pointer; font-size: 14px; }
.plist li:hover { background: var(--chip); }
.plist .dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.plist .meta { margin-left: auto; color: var(--muted); font-size: 12px; white-space: nowrap; }
.compass { position: relative; width: 220px; height: 220px; margin: 8px auto 4px; }
.compass button { position: absolute; width: 50px; height: 50px; margin: -25px 0 0 -25px; border-radius: 50%; border: 1px solid var(--line); background: var(--panel); font-weight: 700; font-size: 13px; }
.compass button.on { background: var(--sea); color: #fff; border-color: var(--sea); }
.compass .ring { position: absolute; inset: 25px; border-radius: 50%; border: 2px dashed var(--line); }
.compass .mid { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); text-align: center; font-size: 12px; color: var(--muted); }
.legend-row { display: flex; flex-wrap: wrap; gap: 10px; font-size: 12.5px; margin: 6px 0; }
.legend-row i { display: inline-block; width: 12px; height: 12px; border-radius: 50%; margin-right: 4px; vertical-align: -2px; }
.months { display: grid; grid-template-columns: repeat(12, 1fr); gap: 3px; align-items: end; margin: 10px 0 2px; }
.months button { border: 0; padding: 0; background: transparent; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 10.5px; color: var(--muted); }
.months .bar { width: 100%; border-radius: 4px 4px 0 0; background: var(--lagoon); }
.months .cyc { width: 100%; border-radius: 0 0 4px 4px; background: var(--coral); }
.months button.on { color: var(--ink); font-weight: 700; }
.months button.on .bar { background: var(--sea); }
.month-detail { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin-top: 10px; }
.month-detail .dirs { display: grid; grid-template-columns: repeat(8, 1fr); gap: 3px; margin-top: 8px; font-size: 11px; text-align: center; }
.month-detail .dirs div { background: var(--chip); border-radius: 6px; padding: 4px 0; }
.day { padding: 10px 0; border-top: 1px solid var(--line); }
.day b { display: block; }
.day button { border: 0; background: transparent; padding: 2px 0; color: var(--sea-2); text-align: left; }
.layer-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-top: 1px solid var(--line); }
.layer-row input { width: 20px; height: 20px; }
.layer-row small { display: block; color: var(--muted); }
.kbd { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; }

/* ---------- markers ---------- */
.pin { width: 30px; height: 30px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); display: grid; place-items: center; border: 2px solid #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, .35); }
.pin svg { transform: rotate(45deg); width: 16px; height: 16px; color: #fff; stroke-width: 2.2; }
.pin.visited::after { content: ""; position: absolute; top: -5px; right: -5px; width: 11px; height: 11px; border-radius: 50%; background: var(--sun); border: 2px solid #fff; }
.pin.dim { opacity: .28; filter: grayscale(.8); }
.pin.ring { outline: 4px solid rgba(255, 255, 255, .85); }
.leaflet-tooltip.lbl { background: rgba(11, 61, 74, .88); color: #fff; border: 0; border-radius: 6px; padding: 2px 7px; font-size: 12px; box-shadow: none; }
.leaflet-tooltip.lbl::before { display: none; }
.cmark { width: 9px; height: 9px; border-radius: 50%; border: 2px solid #fff; background: #7a8f95; box-shadow: 0 0 2px rgba(0, 0, 0, .5); }
.cmark.ours { background: var(--sun); }
.leaflet-popup-content { font: 13px/1.4 var(--font); }

/* ---------- misc overlays ---------- */
.coords { position: fixed; left: 50%; transform: translateX(-50%); bottom: 10px; z-index: 999; background: rgba(255, 255, 255, .9); border-radius: 8px; padding: 3px 8px; font: 12px var(--font); font-variant-numeric: tabular-nums; }
.measure-box { position: fixed; z-index: 1002; left: 50%; top: 70px; transform: translateX(-50%); background: var(--sea); color: #fff; padding: 8px 14px; border-radius: 12px; box-shadow: var(--shadow); font-size: 14px; text-align: center; }
.measure-box input { width: 48px; border-radius: 6px; border: 0; padding: 2px 4px; text-align: center; }
.toast { position: fixed; z-index: 1003; left: 50%; bottom: 90px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 8px 14px; border-radius: 10px; opacity: 0; transition: opacity .25s; pointer-events: none; font-size: 13px; }
.toast.show { opacity: 1; }
.leaflet-control-attribution { font-size: 10px; }
body.night .leaflet-control-attribution { background: #1b0a0a !important; color: #a8544a; }
body.night .leaflet-control-attribution a { color: #c46a5c; }
@media (max-width: 760px) { .leaflet-bottom.leaflet-right { bottom: calc(max(8px, env(safe-area-inset-bottom)) + 60px); } }
/* +/- on every screen: bottom right beside the GPS button on desktop, under the search bar on phones (the sheet covers the bottom there) */
.leaflet-bottom.leaflet-right .leaflet-control-zoom { margin: 0 84px 24px 0; border: 0; box-shadow: var(--shadow); border-radius: 12px; overflow: hidden; }
.leaflet-control-zoom a { width: 44px !important; height: 44px !important; line-height: 42px !important; font-size: 24px !important; color: var(--sea) !important; background: var(--panel) !important; }
@media (max-width: 760px) {
  .leaflet-bottom.leaflet-right .leaflet-control-zoom { position: fixed; right: 10px; top: calc(max(10px, env(safe-area-inset-top)) + 56px); margin: 0; }
  .leaflet-control-zoom a { width: 40px !important; height: 40px !important; line-height: 38px !important; }
}
body.night .leaflet-control-zoom a { background: #1b0a0a !important; color: #ff8c7a !important; }

/* ---------- night mode ---------- */
body.night { --paper: #120606; --panel: #1b0a0a; --chip: #2a1010; --line: #3a1717; --ink: #ff8c7a; --ink-2: #e06a5a; --muted: #a8544a; --sea-2: #ff8c7a; }
body.night .leaflet-tile-pane { filter: grayscale(1) brightness(.45) sepia(1) hue-rotate(-50deg) saturate(4); }
/* the satellite's white sand and surf would glow bright red: keep it dim so it doesn't spoil night vision */
body.night #map.ocean .leaflet-tile-pane { filter: grayscale(1) brightness(.28) contrast(1.1) sepia(1) hue-rotate(-50deg) saturate(2.5); }
body.night .brand, body.night .dock button.on, body.night .btn.primary { background: #3a0d0d; color: #ff8c7a; }
body.night .ours { background: #220c0c; border-color: #3a1717; }
body.night .caution { background: #2a0b0b; border-color: #4a1515; color: #ff8c7a; }
body.night .coords, body.night .search input { background: #1b0a0a; color: #ff8c7a; }
body.night .pin { filter: brightness(.7) sepia(1) hue-rotate(-50deg) saturate(3); }

@media print { .dock, .topbar, .coords { display: none; } }

/* ---------- zoomed-out declutter: pins become small dots ---------- */
.z-low .pin { width: 13px; height: 13px; margin: 16px 0 0 8px; border-width: 1.5px; box-shadow: 0 1px 3px rgba(0,0,0,.4); }
.z-low .pin svg { display: none; }
.z-low .pin.visited::after { top: -4px; right: -4px; width: 7px; height: 7px; border-width: 1px; }
.z-low .pin.ring { outline-width: 3px; }
.z-mid .pin { width: 22px; height: 22px; margin: 7px 0 0 4px; }
.z-mid .pin svg { width: 12px; height: 12px; }
#sheetBody { overflow-x: hidden; overflow-wrap: anywhere; }
.day button { overflow-wrap: anywhere; }

/* ---------- tides ---------- */
.tide-curve { width: 100%; height: 80px; margin: 10px 0 4px; background: var(--chip); border-radius: 8px; }
.tide-curve line { stroke: var(--line); stroke-width: 1; vector-effect: non-scaling-stroke; }
.tide-curve line.now { stroke: var(--coral); stroke-width: 2; }
.tide-curve path { fill: none; stroke: var(--sea-2); stroke-width: 2.5; vector-effect: non-scaling-stroke; }
.tide-tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tide-tbl th { text-align: left; font-weight: 600; padding: 6px 6px 6px 0; white-space: nowrap; }
.tide-tbl th, .tide-tbl td { border-top: 1px solid var(--line); vertical-align: top; }
.tide-tbl td { padding: 6px 4px; font-variant-numeric: tabular-nums; }
.tide-tbl td b { font-weight: 600; font-size: 11px; text-transform: uppercase; color: var(--muted); display: block; }
.tide-tbl td.H b { color: var(--sea-2); }
.tide-tbl small { display: block; color: var(--muted); }
@media (max-width: 420px) { .dock button { font-size: 9px; } }

/* ---------- locate / nearby ---------- */
.locate { position: fixed; z-index: 1000; right: 10px; bottom: 44px; width: 48px; height: 48px; border-radius: 50%; border: 0;
  background: var(--panel); color: var(--sea-2); box-shadow: var(--shadow); display: grid; place-items: center; }
.locate svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.locate.on { background: #1d8fd1; color: #fff; }
@media (max-width: 760px) { .locate { bottom: calc(max(10px, env(safe-area-inset-bottom)) + 72px); } }
.linkish { border: 0; background: none; padding: 0; color: var(--sea-2); text-decoration: underline; font: inherit; cursor: pointer; }

/* ---------- sketch maps ---------- */
.sketchmaps { display: flex; gap: 8px; flex-wrap: wrap; }
.sketchmaps button { border: 1px solid var(--line); border-radius: 8px; padding: 0; background: #fff; width: calc(50% - 4px); max-width: 170px; aspect-ratio: 3 / 4; overflow: hidden; cursor: zoom-in; }
.sketchmaps img { width: 100%; height: 100%; object-fit: cover; object-position: top; display: block; }
.lightbox { position: fixed; inset: 0; z-index: 3000; background: rgba(5, 20, 25, .92); overflow: auto; display: flex; justify-content: center; align-items: flex-start; }
.lightbox[hidden] { display: none; }
.lightbox figure { margin: 0; padding: 48px 8px 24px; max-width: 900px; width: 100%; }
.lightbox img { width: 100%; height: auto; background: #fff; border-radius: 4px; cursor: zoom-in; display: block; }
.lightbox.zoom figure { max-width: none; width: 220%; }
.lightbox.zoom img { cursor: zoom-out; }
.lightbox figcaption { color: #e8f1f2; font-size: 13px; padding: 8px 4px; }
.lb-close { position: fixed; top: 10px; right: 12px; width: 40px; height: 40px; border-radius: 50%; border: 0; font-size: 26px; line-height: 1; background: #fff; color: #0b3d4a; z-index: 1; }
body.night .lightbox img { filter: invert(1) sepia(1) hue-rotate(-50deg) saturate(3) brightness(.7); }

/* ---------- tide curve: sun ---------- */
.tide-curve rect.night { fill: #0b3d4a; opacity: .13; }
.tide-curve rect.reef { fill: var(--sun); opacity: .28; }
.legend-row i.lg-reef { background: var(--sun); opacity: .6; }
.legend-row i.lg-night { background: #0b3d4a; opacity: .3; }
.tide-tbl th small { font-weight: 400; color: var(--muted); font-size: 11px; }
.tide-tbl th small.reef { color: #a77712; }
body.night .tide-curve rect.night { fill: #000; opacity: .4; }
body.night .tide-curve rect.reef { fill: #ff8c7a; opacity: .15; }
body.night button.chip.on, body.night .locate.on { background: #3a0d0d; color: #ff8c7a; }

/* ---------- measure ---------- */
.measure-box .btn { color: var(--ink); padding: 3px 10px; }
.measure-box small { display: block; font-size: 11.5px; opacity: .8; margin-top: 3px; }
.measuring { cursor: crosshair; }
.mdot { width: 22px; height: 22px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 0 0 2px #08262e, 0 2px 6px rgba(0, 0, 0, .5); background: #1f9d6b; cursor: grab; }
.mdot.end { background: #d9473a; }
.mdot.mid { background: #ffd166; }
.mdot { display: grid; place-items: center; font: 700 10px/1 var(--font); color: #08262e; }
.mdot.start, .mdot.end { color: #fff; }
.mbtns { display: flex; gap: 6px; justify-content: center; margin-top: 6px; }
.mlabel { transform: translate(-50%, -150%); width: max-content; background: #08262e; color: #ffd166; font: 700 12.5px var(--font); padding: 3px 8px; border-radius: 8px; box-shadow: 0 2px 6px rgba(0, 0, 0, .4); }

/* ---------- our videos and photos ---------- */
.vpin { display: flex; align-items: center; gap: 3px; padding: 2px 6px 2px 2px; border-radius: 8px; background: #c4302b; border: 2px solid #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, .45); color: #fff; font: 700 11px var(--font); width: max-content; }
.vpin img { width: 40px; height: 22px; object-fit: cover; border-radius: 5px; display: block; }
.z-low .vpin img { display: none; }
.vids { display: grid; gap: 8px; }
.vid { display: flex; gap: 10px; align-items: center; text-decoration: none; color: inherit; padding: 6px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
.vid:hover { background: var(--chip); }
.vthumb { position: relative; flex: none; width: 112px; aspect-ratio: 16 / 9; border-radius: 8px; overflow: hidden; background: #0b3d4a; }
.vthumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.vthumb i { position: absolute; inset: 0; margin: auto; width: 30px; height: 22px; border-radius: 6px; background: rgba(196, 48, 43, .92); color: #fff; font: normal 12px/22px var(--font); text-align: center; }
.vid b { display: block; font-size: 13.5px; line-height: 1.25; }
.vid small { color: var(--muted); font-size: 12px; }
.yt { color: #c4302b; font-size: 12px; font-weight: 700; white-space: nowrap; }
.allvids { margin-top: 14px; }
.allvids summary { cursor: pointer; font-weight: 600; color: var(--sea-2); padding: 6px 0; }
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 6px; }
.photos button { padding: 0; border: 0; border-radius: 8px; overflow: hidden; aspect-ratio: 1; cursor: zoom-in; background: var(--chip); }
.photos img { width: 100%; height: 100%; object-fit: cover; display: block; }
.lightbox.photo img { background: transparent; }
body.night .lightbox.photo img { filter: brightness(.6) sepia(.6) hue-rotate(-30deg); }

/* ---------- my notes ---------- */
.mynote { margin: 14px 0; padding: 10px 12px; border: 1px dashed var(--line); border-radius: 12px; }
.mynote h3 { margin-top: 0; }
.stars button { border: 0; background: none; font-size: 22px; line-height: 1; color: var(--line); padding: 0 2px; }
.stars button.on { color: var(--sun); }
.mynote textarea { width: 100%; margin: 6px 0 4px; padding: 8px; border: 1px solid var(--line); border-radius: 8px; font: 14px/1.4 var(--font); background: var(--panel); color: var(--ink); resize: vertical; }
.fetch { display: grid; grid-template-columns: repeat(8, 1fr); gap: 3px; text-align: center; font-size: 11px; }
.fetch div { border-radius: 6px; padding: 4px 0; }
.fetch b { display: block; font-size: 13px; }
.linkgrp { border-top: 1px solid var(--line); padding: 6px 0; }
.linkgrp summary { cursor: pointer; font-weight: 600; color: var(--sea-2); }
.linkgrp ol, .linkgrp ul { padding-left: 20px; font-size: 13.5px; }
.linkgrp li { margin: 4px 0; }
.linkgrp small { color: var(--muted); }
.fetch small { display: block; font-size: 9.5px; opacity: .8; }

/* ---------- Today card ---------- */
.now-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 6px; margin: 10px 0 4px; }
.now-strip div { background: var(--chip); border-radius: 10px; padding: 8px 10px; }
.now-strip small { display: block; color: var(--muted); font-size: 11.5px; }
.now-strip b { font-size: 16px; font-variant-numeric: tabular-nums; }
.now-strip .live { background: #fff4d6; box-shadow: inset 0 0 0 2px var(--sun); }
body.night .now-strip .live { background: #2a1a08; }

/* ---------- voyage story ---------- */
.story-go { width: 100%; margin: 10px 0 4px; padding: 11px; font-size: 15px; }
.story { position: fixed; z-index: 1002; left: 10px; top: 74px; width: 330px; background: var(--paper); border-radius: var(--radius); box-shadow: var(--shadow); padding: 10px 12px 0; overflow: hidden; }
.story[hidden] { display: none; }
.story img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 10px; display: block; margin: 6px 0; }
.story h3 { margin: 4px 0 0; font-size: 17px; color: var(--sea); text-transform: none; letter-spacing: 0; }
.st-top { display: flex; align-items: center; justify-content: space-between; color: var(--muted); }
.st-x { border: 0; background: var(--chip); border-radius: 50%; width: 30px; height: 30px; font-size: 18px; }
.st-eps { display: grid; gap: 4px; margin: 8px 0; font-size: 13px; }
.st-eps a { color: #c4302b; text-decoration: none; font-weight: 600; }
.st-ctl { display: flex; gap: 8px; align-items: center; margin: 8px 0 10px; }
.st-ctl button:not(.linkish) { width: 44px; height: 40px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); font-size: 18px; }
.st-ctl .linkish { margin-left: auto; }
.st-bar { height: 3px; margin: 0 -12px; background: var(--line); }
.st-bar i { display: block; height: 100%; width: 0; background: var(--lagoon); }

/* ---------- offline downloads ---------- */
.offrow { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; border-top: 1px solid var(--line); }
.offrow input { width: 20px; height: 20px; margin-top: 2px; }
.offrow small { display: block; color: var(--muted); }
.offbar { height: 8px; border-radius: 4px; background: var(--line); margin: 10px 0 4px; overflow: hidden; }
.offbar[hidden] { display: none; }
.offbar i { display: block; height: 100%; width: 0; background: var(--lagoon); transition: width .3s; }
.update-bar { position: fixed; z-index: 1004; left: 50%; top: 70px; transform: translateX(-50%); border: 0; border-radius: 10px; padding: 10px 16px; background: var(--sun); color: #3a2a00; font-weight: 700; box-shadow: var(--shadow); }
.update-bar[hidden] { display: none; }

/* ---------- lightbox arrows ---------- */
.lb-prev, .lb-next { display: none; position: fixed; top: 50%; transform: translateY(-50%); z-index: 1; width: 44px; height: 64px; border: 0; border-radius: 10px; background: rgba(255, 255, 255, .85); color: #0b3d4a; font-size: 30px; }
.lb-prev { left: 8px; } .lb-next { right: 8px; }
.lightbox.multi:not(.zoom) .lb-prev, .lightbox.multi:not(.zoom) .lb-next { display: block; }

/* ---------- phone polish ---------- */
.z-low .vpin { display: none; }
.stars button { min-width: 40px; min-height: 40px; }
@media (max-width: 760px) {
  .story { left: 8px; right: 8px; top: auto; bottom: calc(max(10px, env(safe-area-inset-bottom)) + 70px); width: auto; }
  .story img { aspect-ratio: auto; height: 96px; }
  .story { padding-top: 8px; }
  .st-eps { margin: 4px 0; }
  .measure-box { top: 64px; left: 10px; right: 60px; transform: none; padding: 6px 10px; font-size: 13px; }
  .measure-box small { display: none; }
  .chip { padding: 6px 11px; }
  .lb-prev, .lb-next { width: 36px; height: 52px; }
}
@media (max-width: 380px) { .dock button { font-size: 8.5px; letter-spacing: -.3px; } .dock button svg { width: 20px; height: 20px; } }

/* ---------- guide panel: trade list ---------- */
.guide-links a { display: block; padding: 2px 0; font-weight: 600; color: var(--sea); }
.trade-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 6px 0 10px; flex-wrap: wrap; }
.tcat { margin: 0 0 8px; border-bottom: 1px solid var(--line); padding-bottom: 6px; }
.tcat summary { font-weight: 600; padding: 6px 0; cursor: pointer; }
.tick { display: flex; gap: 10px; align-items: flex-start; padding: 7px 2px; font-size: 14px; line-height: 1.3; }
.tick input { width: 20px; height: 20px; flex: none; margin: 0; accent-color: var(--sea); }

@media (max-width: 420px) { .search input { padding: 0 10px; font-size: 14px; } }

/* ---------- plain-language shelter + reliability ---------- */
.trust { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin: 10px 0 4px; font-size: 13px; }
.trust div { background: var(--chip); border-radius: 10px; padding: 6px 9px; }
.trust small { display: block; font-size: 10.5px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); }
.say { display: grid; gap: 4px; margin: 4px 0 8px; font-size: 14px; }
.say-ok b { color: var(--good); }
.say-no b { color: var(--bad); }
.say-est b { color: var(--good); opacity: .8; }
.say-unk { color: var(--muted); font-size: 12.5px; }
.rose-legend b { display: block; margin-bottom: 3px; color: var(--ink); }
.check { margin: 8px 0; padding: 8px 10px; border-radius: 10px; background: #fff6e0; border: 1px solid #f3d48b; color: #6b4a00; font-size: 13.5px; }
.fetchbox { margin: 10px 0; }
.fetchbox summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--sea-2); padding: 4px 0; }
body.night .check { background: #2a1a08; border-color: #4a2a10; color: #ff8c7a; }
body.night .say-ok b, body.night .say-no b { color: #ff8c7a; }
@media (max-width: 380px) { .trust { grid-template-columns: 1fr; } }
.chip-lbl { font-size: 12px; color: var(--muted); align-self: center; margin-right: 2px; }
.pin.est { opacity: .7; border-style: dashed; }
.plist .dot.est { opacity: .5; outline: 1px dashed #7d8f93; }
.say-est { color: var(--ink-2); font-size: 13px; font-style: italic; }
.rose-legend i.lg-est { background: repeating-linear-gradient(45deg, #9cc23b77 0 3px, transparent 3px 6px); outline: 1px dashed #7d8f93; }
.sketchmaps.sketch button { width: 100%; max-width: none; aspect-ratio: 900 / 680; }
.sketchmaps.sketch img { object-fit: contain; }
#map.paper { background: #f7f0de url(paper.png); }
body.night #map.paper { background: #1a0d08; }

/* ---------- hand-lettered map names (Caveat, SIL OFL) ---------- */
@font-face { font-family: "Caveat"; src: url(fonts/Caveat.ttf) format("truetype"); font-display: swap; }
.mapname { position: absolute; transform: translate(-50%, -50%); white-space: nowrap; pointer-events: none; font-family: "Caveat", cursive;
  color: #3b2f25; line-height: 1; text-shadow: 0 0 3px #f7f0de, 0 0 3px #f7f0de, 0 0 2px #f7f0de; }
.mapname.r0 { letter-spacing: 4px; text-transform: uppercase; color: #6b5641; opacity: .8; }
.mapname.group { letter-spacing: 2px; color: #5a4632; font-style: italic; }
.mapname.r1 { font-weight: 700; }
.mapname.village { color: #6b5641; }
.mapname.peak { color: #7a5233; }
.mapname.depth { color: #2f5d6b; opacity: .8; }
.mapname.sat { color: #fff; text-shadow: 0 0 3px #000, 0 0 3px #000, 0 1px 2px #000; }
.mapname.depth.sat { color: #cfe8ef; }
body.night .mapname { color: #e9b38a; text-shadow: 0 0 3px #1a0d08, 0 0 3px #1a0d08; }
.sea-art { position: absolute; transform: translate(-50%, -50%); opacity: .75; pointer-events: none; mix-blend-mode: multiply; }
body.night .sea-art { opacity: .35; filter: invert(1) sepia(1); mix-blend-mode: normal; }
.panel-art { float: right; height: 84px; margin: -4px 0 4px 10px; }
#map.ocean { background: rgb(22, 34, 47); }   /* the satellite mosaic's open-sea colour, beyond the tiles */

/* ---------- security reports ---------- */
.secpin svg { width: 26px; height: 24px; filter: drop-shadow(0 1px 2px rgba(0,0,0,.35)); }
.sevb { display: inline-block; color: #fff; font-size: 11px; font-weight: 700; border-radius: 6px; padding: 1px 7px; margin: 1px 0; white-space: nowrap; }
.seclegend { margin: 4px 0 8px; display: flex; flex-wrap: wrap; gap: 4px; }
.seclist li { display: flex; gap: 10px; align-items: flex-start; }
.seclist .secdate { flex: none; width: 74px; font-size: 12px; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; padding-top: 2px; }
.seclist small.sub { display: block; margin: 2px 0 0; }
.chip.warn { background: #fde7e4; color: #9c2219; border: 1px solid #f3b8b1; font-weight: 600; }
.secnear { margin: 12px 0; padding: 8px 12px; border-radius: 12px; background: #fff4f2; border: 1px solid #f3c9c3; }
.secnear h3 { color: #9c2219; margin-top: 6px; }
.srcs { padding-left: 18px; font-size: 14px; }
body.night .chip.warn, body.night .secnear { background: #2a0e0a; border-color: #4a1a14; color: #ff8c7a; }
body.night .secnear h3 { color: #ff8c7a; }
body.night .secpin { filter: brightness(.7); }

/* episode moments: links to the second in the episode */
.moments { display: flex; flex-wrap: wrap; gap: 4px 8px; margin: -2px 0 8px 4px; font-size: 13px; }
.moments a { color: var(--sea, #0d6676); text-decoration: none; background: #eef8f9; border-radius: 999px; padding: 2px 8px; }
body.night .moments a { background: #1a0d08; color: #ff8c7a; }
