:root{
  --bg:#f4f8fb; --panel:#ffffff; --ink:#12202c; --muted:#5a6b7a; --line:#d9e3ec;
  --accent:#0b6fa4; --accent-ink:#ffffff; --chip:#e8f1f8;
}
@media (prefers-color-scheme: dark){
  :root:not([data-theme="light"]){
    --bg:#0e171f; --panel:#15212b; --ink:#e6eef5; --muted:#92a4b4; --line:#26384a;
    --accent:#4cb0e6; --accent-ink:#06202f; --chip:#1d2f3d;
  }
}
:root[data-theme="dark"]{
  --bg:#0e171f; --panel:#15212b; --ink:#e6eef5; --muted:#92a4b4; --line:#26384a;
  --accent:#4cb0e6; --accent-ink:#06202f; --chip:#1d2f3d;
}
*{box-sizing:border-box}
html,body{height:100%;margin:0}
body{background:var(--bg);color:var(--ink);font:15px/1.45 system-ui,-apple-system,"Segoe UI",Roboto,sans-serif;display:flex;flex-direction:column}

.top{background:var(--panel);border-bottom:1px solid var(--line);padding:10px 16px;display:grid;gap:8px}
.brand h1{font-size:18px;margin:0;letter-spacing:.2px}
.brand p{margin:0;color:var(--muted);font-size:13px}
.controls{display:flex;gap:8px;flex-wrap:wrap}
.controls input,.controls select,.controls button{
  font:inherit;color:var(--ink);background:var(--bg);border:1px solid var(--line);border-radius:8px;padding:7px 10px;min-height:36px}
.controls input{flex:1 1 220px;min-width:0}
.controls button{cursor:pointer;background:var(--chip)}
.chips{display:flex;gap:6px;flex-wrap:wrap}
.chip{display:inline-flex;align-items:center;gap:6px;border:1px solid var(--line);background:var(--bg);color:var(--ink);
  border-radius:999px;padding:4px 10px;font-size:13px;cursor:pointer;min-height:30px}
.chip .flags{font-size:15px}
.chip-lbl{white-space:nowrap}
.chip[aria-pressed="false"]{opacity:.45}
.chip b{font-weight:600;color:var(--muted)}

.layout{flex:1;min-height:0;display:grid;grid-template-columns:340px 1fr}
.list-pane{background:var(--panel);border-right:1px solid var(--line);overflow:auto;display:flex;flex-direction:column;min-height:0}
.list-head{padding:8px 16px;color:var(--muted);font-size:13px;border-bottom:1px solid var(--line);position:sticky;top:0;background:var(--panel);z-index:1}
#list{list-style:none;margin:0;padding:0;flex:1}
#list li{border-bottom:1px solid var(--line)}
#list button{all:unset;box-sizing:border-box;display:grid;grid-template-columns:auto 1fr;gap:2px 10px;width:100%;padding:9px 16px;cursor:pointer}
#list button:hover,#list button:focus-visible{background:var(--chip)}
#list .dot{width:12px;height:12px;border-radius:50%;margin-top:5px;grid-row:span 2}
#list .nm{font-weight:600}
#list .sub{color:var(--muted);font-size:13px}
.safety{margin:0;padding:12px 16px;color:var(--muted);font-size:12px;border-top:1px solid var(--line)}
.map-pane{position:relative;min-height:0}
#map{position:absolute;inset:0}

.pop{min-width:290px;max-width:300px;font:14px/1.4 system-ui,sans-serif;color:#12202c}
.pop h3{margin:0 0 2px;font-size:16px}
.pop .ja{color:#5a6b7a;font-size:12px;margin-bottom:4px}
.pop .rate{margin:2px 0 6px;font-weight:600}
.pop .rate span{letter-spacing:1px}
.pop .btns{display:flex;flex-wrap:wrap;gap:6px;margin:8px 0}
.pop a.btn,.pop button.btn{display:inline-block;background:#0b6fa4;color:#fff;text-decoration:none;border:0;border-radius:7px;padding:6px 10px;font:600 13px system-ui;cursor:pointer}
.pop a.btn.alt{background:#e8f1f8;color:#0b4f75}
.pop .fac{margin-top:6px;font-size:13px}
.pop .fac div{margin:2px 0}
.pop .fac small{color:#5a6b7a}
.pop .warn{color:#9a5b00;font-size:12px}

@media (max-width:760px){
  .layout{grid-template-columns:1fr;grid-template-rows:55vh 1fr}
  .map-pane{order:-1}
  .list-pane{border-right:0;border-top:1px solid var(--line)}
  body{height:100dvh}
}

/* ---- pins, flags, ratings ---- */
.pin-wrap{background:none;border:0}
.pin{width:28px;height:28px;border-radius:50%;border:2px solid #fff;box-shadow:0 1px 4px rgba(0,0,0,.5);
  color:#fff;font:700 11px/24px system-ui,sans-serif;text-align:center;text-shadow:0 0 2px rgba(0,0,0,.6);letter-spacing:-.2px}
.leaflet-tooltip.pin-label{background:rgba(255,255,255,.93);border:0;color:#12202c;font:600 11px/1.2 system-ui,sans-serif;
  padding:2px 6px;border-radius:5px;box-shadow:0 1px 3px rgba(0,0,0,.35)}
.leaflet-tooltip.pin-label::before{display:none}
.labels-off .pin-label{display:none}
.flags{display:inline-flex;gap:2px;vertical-align:middle}
.flag{width:1.1em;height:.8em;display:block}
.flag-ch{font-size:1em;line-height:1}
.dot{display:inline-block;color:#fff;font:700 10px/12px system-ui;text-align:center;text-shadow:0 0 2px rgba(0,0,0,.6)}
#list .dot{width:22px;height:22px;border-radius:50%;line-height:22px;margin-top:0;grid-row:span 2;font-size:10px}
.pop .row{display:flex;align-items:center;gap:6px;flex-wrap:wrap;margin:3px 0}
.pop .lbl{color:#5a6b7a;font-size:12px;min-width:62px}
.pop .note{font-size:12px;color:#5a6b7a;margin:0 0 4px}
.pop .stars{color:#e0a020;letter-spacing:1px}
.pop .rate-in{display:flex;align-items:center;gap:2px;margin:4px 0}
.pop .rate-in small{color:#5a6b7a;margin-right:6px}
.pop .st{all:unset;cursor:pointer;font-size:22px;line-height:1;color:#b9c6d2;padding:2px}
.pop .st:hover,.pop .st:focus-visible,.pop .st.on{color:#e0a020}
.pop .st:hover ~ .st{color:#b9c6d2}

.pop .other{font-size:12px;color:#5a6b7a;margin:0 0 6px}
.pop .other a{color:#0b6fa4}

/* ---- community submissions ---- */
.controls button.primary,.submit-dlg button.primary{background:var(--accent);color:var(--accent-ink);border-color:var(--accent);font-weight:600}
.controls button[hidden]{display:none}
.pick-banner{position:fixed;left:50%;top:14px;transform:translateX(-50%);z-index:2000;background:#12202c;color:#fff;
  padding:10px 16px;border-radius:999px;font:600 14px system-ui,sans-serif;box-shadow:0 4px 16px rgba(0,0,0,.4);max-width:92vw;text-align:center}
.pick-banner[hidden]{display:none}
#map.picking,#map.picking .leaflet-grab{cursor:crosshair}
.submit-dlg{border:1px solid var(--line);border-radius:14px;background:var(--panel);color:var(--ink);padding:0;width:min(560px,94vw);max-height:92dvh}
.submit-dlg::backdrop{background:rgba(8,16,24,.55)}
.submit-dlg form{padding:18px 20px;display:grid;gap:12px;overflow:auto;max-height:92dvh}
.submit-dlg h2{margin:0;font-size:20px}
.submit-dlg .hint,.submit-dlg small{color:var(--muted);font-size:12.5px;font-weight:400}
.submit-dlg p.hint{margin:0}
.submit-dlg label{display:grid;gap:4px;font-weight:600;font-size:13.5px}
.submit-dlg input,.submit-dlg select,.submit-dlg textarea{font:inherit;font-weight:400;color:var(--ink);background:var(--bg);
  border:1px solid var(--line);border-radius:8px;padding:8px 10px;min-height:38px;width:100%}
.submit-dlg textarea{resize:vertical}
.submit-dlg fieldset{border:1px solid var(--line);border-radius:10px;padding:10px 12px;display:grid;gap:8px;margin:0}
.submit-dlg legend{font-weight:600;font-size:13.5px;padding:0 6px}
.submit-dlg .two{display:grid;grid-template-columns:1fr 1fr;gap:10px}
.submit-dlg .actions{display:flex;justify-content:flex-end;gap:8px}
.submit-dlg button{font:inherit;border:1px solid var(--line);border-radius:8px;padding:8px 14px;min-height:38px;cursor:pointer;color:var(--ink);background:var(--chip)}
.submit-dlg button:disabled{opacity:.55;cursor:default}
.submit-dlg button.secondary{justify-self:start}
.submit-dlg .msg{margin:0;min-height:1.2em;font-size:14px}
.submit-dlg .msg.ok{color:#1f8a4c;font-weight:600}
.submit-dlg .msg.err{color:#c0392b;font-weight:600}
.submit-dlg .hp{position:absolute;left:-9999px;width:1px;height:1px;opacity:0}
@media (max-width:560px){.submit-dlg .two{grid-template-columns:1fr}}

/* ---- weather & sea window (weather.js) ---- */
.wx-card{position:absolute;z-index:1100;width:min(380px,calc(100% - 16px));max-height:calc(100% - 16px);display:flex;flex-direction:column;
  background:#fff;color:#12202c;border-radius:12px;box-shadow:0 6px 24px rgba(0,0,0,.35);font:13px/1.35 system-ui,sans-serif;overflow:hidden}
.wx-card[hidden]{display:none}
.wx-card header{display:flex;align-items:center;gap:8px;padding:8px 10px 8px 12px;background:#0b6fa4;color:#fff}
.wx-card h3{margin:0;font-size:14px;flex:1;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.wx-x{all:unset;cursor:pointer;font-size:22px;line-height:1;padding:0 4px}
.wx-body{padding:10px 12px;overflow:auto;flex:1;min-height:0}
.wx-body h4{margin:10px 0 4px;font-size:13px}
.wx-body h4 small,.wx-body small{color:#5a6b7a;font-weight:400}
.wx-sum{display:flex;gap:10px;align-items:center}
.wx-big{font-size:30px;line-height:1}
.wx-verdict{font-weight:600;margin-top:2px}
.wx-verdict.good{color:#1f8a4c}.wx-verdict.fair{color:#b67600}.wx-verdict.poor{color:#c0392b}
.wx-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(110px,1fr));gap:6px;margin-top:8px}
.wx-cell{background:#f1f6fa;border-radius:8px;padding:5px 7px;display:grid;gap:1px}
.wx-cell span{color:#5a6b7a;font-size:11.5px}
.wx-cell b{font-size:14px}
.wx-cell small{color:#5a6b7a;font-size:11px}
.wx-arr{display:inline-block;font-weight:700;color:#0b6fa4}
.wx-tides{display:flex;flex-wrap:wrap;gap:4px 10px}
.wx-tides .hi b{color:#0b6fa4}.wx-tides .lo b{color:#8a5a00}
.wx-tide{width:100%;height:84px;margin-top:4px;display:block}
.wx-tide-fill{fill:rgba(11,111,164,.15)}.wx-tide-line{fill:none;stroke:#0b6fa4;stroke-width:1.6}
.wx-tide-day{stroke:#c9d6e0;stroke-width:1}.wx-tide-now{stroke:#d32030;stroke-width:1.5;stroke-dasharray:3 2}
.wx-tide-pt{fill:#0b6fa4}.wx-tide text{font-size:9px;fill:#5a6b7a}
.wx-hours{display:grid;grid-template-columns:repeat(8,1fr);gap:2px;text-align:center;font-size:11px}
.wx-hours div{display:grid;gap:1px;background:#f1f6fa;border-radius:6px;padding:3px 0}
.wx-hours b{font-size:15px;font-weight:400}
.wx-days div{padding:2px 0;border-bottom:1px solid #e4ecf2}
.wx-links{margin:8px 0 2px;font-size:12px}
.wx-links a,.wx-note a{color:#0b6fa4}
.wx-note{color:#5a6b7a;font-size:11.5px;margin-top:6px}
@media (max-width:760px){.wx-hours{grid-template-columns:repeat(4,1fr)}}

/* ---- details buttons: weather toggle, photos, reviews ---- */
.pop a.btn.alt{background:#0b6fa4;color:#fff}                 /* every details button uses the same style */
.pop button.btn[data-wx].on{background:#1f8a4c}
.pop button.btn[data-wx].on::after{content:" ✓"}
.pop .btns{margin:6px 0}
.pop .lnk{all:unset;cursor:pointer;color:#0b6fa4;font-size:13px;text-decoration:underline;display:block;margin:2px 0 4px}
.pop .ph{all:unset;display:block;position:relative;cursor:zoom-in;margin:0 0 8px;width:100%;height:150px;border-radius:8px;overflow:hidden;background:#dfe8ef}
.pop .ph img{width:100%;height:100%;object-fit:cover;display:block}
.pop .ph-n{position:absolute;right:6px;bottom:6px;background:rgba(0,0,0,.65);color:#fff;font:600 12px system-ui;padding:2px 7px;border-radius:999px}
.pop .ph:focus-visible{outline:3px solid #0b6fa4}
.lightbox{position:fixed;inset:0;z-index:5000;background:rgba(5,10,15,.92);display:flex;align-items:center;justify-content:center}
.lightbox[hidden]{display:none}
.lightbox figure{margin:0;max-width:min(1100px,84vw);max-height:92vh;display:flex;flex-direction:column;align-items:center;gap:8px}
.lightbox img{max-width:100%;max-height:82vh;object-fit:contain;border-radius:6px;background:#111}
.lightbox figcaption{color:#e6eef5;font:14px system-ui;text-align:center}
.lightbox .lb-n{color:#9fb3c4;margin-right:6px}
.lightbox button{all:unset;cursor:pointer;color:#fff;position:absolute;width:48px;height:48px;border-radius:50%;background:rgba(255,255,255,.14);
  font:300 34px/46px system-ui;text-align:center}
.lightbox button:hover,.lightbox button:focus-visible{background:rgba(255,255,255,.3)}
.lightbox button[hidden]{display:none}
.lightbox .lb-x{top:16px;right:16px}
.lightbox .lb-prev{left:16px;top:50%;transform:translateY(-50%)}
.lightbox .lb-next{right:16px;top:50%;transform:translateY(-50%)}
.ph-prev{max-width:100%;max-height:220px;border-radius:8px;justify-self:start}
.ph-prev[hidden]{display:none}
.rev-list{display:grid;gap:10px;max-height:38vh;overflow:auto}
.rev-list article{border-bottom:1px solid var(--line);padding-bottom:8px}
.rev-list p{margin:4px 0 0;white-space:pre-wrap;overflow-wrap:anywhere}
.rev-list .stars,.rev-stars .st.on{color:#e0a020}
.rev-stars .st{all:unset;cursor:pointer;font-size:28px;line-height:1;color:#b9c6d2;padding:0 2px}
.submit-dlg .rev-stars button{border:0;background:none;min-height:0;padding:0 2px}

/* ---- diving conditions line (top of the details) + pictures inside reviews ---- */
.pop .cond{margin:0 18px 6px 0;font-size:14px}
.pop .cond small{color:#5a6b7a}
.pop .cond .good{color:#1f8a4c}.pop .cond .fair{color:#b67600}.pop .cond .poor{color:#c0392b}
.rev-ph{display:flex;gap:6px;flex-wrap:wrap;margin-top:6px}
.submit-dlg .rev-ph button{all:unset;cursor:zoom-in;width:84px;height:64px;border-radius:6px;overflow:hidden;background:var(--chip)}
.rev-ph img{width:100%;height:100%;object-fit:cover;display:block}

/* ---- buoy pins, group markers, list cards (sites in view) ---- */
.buoy{width:32px;height:42px;display:block;filter:drop-shadow(0 1px 3px rgba(0,0,0,.6))}
.buoy text{font:700 10.5px system-ui,sans-serif;fill:#fff;paint-order:stroke;stroke:rgba(0,0,0,.45);stroke-width:1.6px}
.grp{width:38px;height:38px;border-radius:50%;background:#0b6fa4;border:3px solid #fff;color:#fff;font:700 14px/32px system-ui,sans-serif;
  text-align:center;box-shadow:0 1px 5px rgba(0,0,0,.55)}
#list button{grid-template-columns:72px 1fr;gap:1px 10px;align-items:start;padding:10px 12px}
#list .thumb{grid-row:1 / span 3;position:relative;width:72px;height:54px;border-radius:7px;overflow:hidden;background:var(--chip);display:block}
#list .thumb img{width:100%;height:100%;object-fit:cover;display:block}
#list .thumb .dot{position:absolute;left:3px;top:3px;width:20px;height:20px;line-height:20px;margin:0;border:1.5px solid #fff}
#list .thumb.none{color:#fff;font:700 18px/54px system-ui,sans-serif;text-align:center;text-shadow:0 0 3px rgba(0,0,0,.6);opacity:.9}
#list .desc{color:var(--muted);font-size:12.5px;line-height:1.35;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
#list li.empty{padding:16px;color:var(--muted);font-size:13px}

/* site description in the details popup */
.pdesc{margin:8px 0;line-height:1.45;white-space:pre-line}
