:root {
  --ink: #0a101c;
  --ink-2: #101a2b;
  --ink-3: #182438;
  --navy: #0d1b33;
  --brass: #c9a45c;
  --gold: #e8c77d;
  --gold-hi: #f6dfa4;
  --terra: #d4693f;
  --terra-hi: #ef8a5e;
  --parch: #f1e6cc;
  --parch-dim: #cbbd9c;
  --muted: #9aa3b5;
  --line: rgba(201, 164, 92, 0.32);
  --panel: rgba(10, 16, 28, 0.94);
  --panel-text: var(--parch);
  --panel-sub: #c9bfa6;
  --panel-line: rgba(201, 164, 92, 0.35);
  --display: "Cinzel", "Trajan Pro", Georgia, serif;
  --serif: "Cormorant Garamond", Georgia, serif;
  --ui: "Space Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --r: 18px;
}
body.sun {
  --panel: rgba(246, 239, 222, 0.98);
  --panel-text: #17110a;
  --panel-sub: #4a3d28;
  --panel-line: rgba(120, 88, 30, 0.45);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--ink); color: var(--parch); font-family: var(--ui); overflow: hidden; }
button { font: inherit; color: inherit; cursor: pointer; }
[hidden] { display: none !important; }
#map { position: fixed; inset: 0; }
.maplibregl-ctrl-attrib { background: rgba(10,16,28,.72) !important; color: var(--muted); font-size: 10px; }
.maplibregl-ctrl-attrib a { color: var(--parch-dim) !important; }
.maplibregl-ctrl-attrib-button { filter: invert(.85) sepia(.4); }
.maplibregl-ctrl-bottom-right { bottom: calc(var(--bottom-ui, 150px) + var(--safe-b)); right: 6px; }

/* ---------- HUD layer ---------- */
.hud-grid {
  position: fixed; inset: 0; pointer-events: none; z-index: 1;
  background:
    radial-gradient(ellipse at 50% 45%, transparent 55%, rgba(5, 8, 15, 0.55) 100%),
    repeating-linear-gradient(0deg, rgba(201,164,92,0.045) 0 1px, transparent 1px 72px),
    repeating-linear-gradient(90deg, rgba(201,164,92,0.045) 0 1px, transparent 1px 72px);
  transition: opacity .8s;
}
body.view-day .hud-grid { opacity: .55; }
.hud-corners i { position: fixed; width: 22px; height: 22px; border-color: rgba(232,199,125,.55); border-style: solid; pointer-events: none; z-index: 2; }
.hud-corners i:nth-child(1) { top: calc(8px + var(--safe-t)); left: 8px; border-width: 1.5px 0 0 1.5px; }
.hud-corners i:nth-child(2) { top: calc(8px + var(--safe-t)); right: 8px; border-width: 1.5px 1.5px 0 0; }
.hud-corners i:nth-child(3) { bottom: calc(8px + var(--safe-b)); left: 8px; border-width: 0 0 1.5px 1.5px; }
.hud-corners i:nth-child(4) { bottom: calc(8px + var(--safe-b)); right: 8px; border-width: 0 1.5px 1.5px 0; }
.hud-readout {
  position: fixed; left: 16px; bottom: calc(var(--bottom-ui, 150px) + 14px + var(--safe-b)); z-index: 3;
  font: 500 10.5px/1.35 var(--mono); letter-spacing: .08em; color: rgba(232,199,125,.8);
  text-shadow: 0 1px 2px #000; pointer-events: none; text-transform: uppercase;
}
.compass {
  position: fixed; right: 14px; bottom: calc(var(--bottom-ui, 150px) + 40px + var(--safe-b)); z-index: 3;
  width: 54px; height: 54px; padding: 0; border: 0; border-radius: 50%;
  background: radial-gradient(circle, rgba(16,26,43,.92), rgba(10,16,28,.92)); box-shadow: 0 0 0 1px var(--line), 0 6px 20px rgba(0,0,0,.5);
}
.compass svg { width: 100%; height: 100%; transition: transform .25s linear; }
.c-ring { fill: none; stroke: var(--brass); stroke-width: 1.5; opacity: .8; }
.c-ring2 { fill: none; stroke: var(--brass); stroke-width: .8; stroke-dasharray: 2 3; opacity: .6; }
.c-ticks path { stroke: var(--brass); stroke-width: 1.4; opacity: .8; }
.c-star { fill: var(--terra-hi); }
.c-star-dim { fill: rgba(201,164,92,.5); }
.c-n { font: 700 13px var(--display); fill: var(--parch); text-anchor: middle; dominant-baseline: middle; }

/* ---------- top bar ---------- */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 10;
  display: flex; align-items: center; gap: 10px;
  padding: calc(12px + var(--safe-t)) 14px 10px 16px;
  background: linear-gradient(180deg, rgba(8,12,22,.94) 0%, rgba(8,12,22,.75) 70%, rgba(8,12,22,0) 100%);
}
.brand { flex: 1; min-width: 0; }
.brand-kicker { font: 600 11px/1.2 var(--ui); letter-spacing: .22em; text-transform: uppercase; color: var(--brass); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-title { font: 700 24px/1.1 var(--display); letter-spacing: .06em; color: var(--parch); text-shadow: 0 2px 10px rgba(0,0,0,.6); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-right { display: flex; align-items: center; gap: 8px; }
.countdown {
  display: flex; flex-direction: column; align-items: flex-end;
  padding: 6px 12px; border-radius: 12px; border: 1px solid var(--line);
  background: rgba(13,27,51,.7); line-height: 1.05;
}
.countdown .cd-k { font: 600 9.5px var(--ui); letter-spacing: .2em; color: var(--brass); text-transform: uppercase; }
.countdown .cd-v { font: 700 19px var(--ui); color: var(--gold-hi); font-variant-numeric: tabular-nums; letter-spacing: .02em; }
.icon-btn {
  width: 46px; height: 46px; border-radius: 50%; border: 1px solid var(--line); background: rgba(13,27,51,.75);
  display: grid; place-items: center; padding: 0; flex: none;
}
.icon-btn svg { width: 22px; height: 22px; fill: none; stroke: var(--parch); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
#btnMenu svg circle { fill: var(--parch); stroke: none; }
.menu {
  position: fixed; top: calc(70px + var(--safe-t)); right: 12px; z-index: 30; min-width: 240px;
  background: var(--panel); border: 1px solid var(--panel-line); border-radius: 16px; padding: 6px; box-shadow: 0 16px 40px rgba(0,0,0,.6);
  display: flex; flex-direction: column;
}
.menu button { text-align: left; background: none; border: 0; color: var(--panel-text); padding: 14px 14px; font-size: 16px; border-radius: 10px; min-height: 48px; }
.menu button:active, .menu button:hover { background: rgba(201,164,92,.14); }
.menu .danger { color: var(--terra-hi); }
body.sun .menu .danger { color: #a3401a; }

/* ---------- timeline strip ---------- */
.timeline {
  position: fixed; left: 0; right: 0; top: calc(70px + var(--safe-t)); z-index: 9;
  display: flex; align-items: center; gap: 0; overflow-x: auto; scrollbar-width: none;
  padding: 6px 14px 10px; scroll-snap-type: x proximity;
  mask-image: linear-gradient(90deg, transparent 0, #000 14px, #000 calc(100% - 14px), transparent 100%);
}
.timeline::-webkit-scrollbar { display: none; }
.tl-stop {
  flex: none; display: flex; align-items: center; gap: 8px; scroll-snap-align: center;
  height: 44px; padding: 0 12px 0 5px; border-radius: 22px; border: 1px solid var(--line);
  background: rgba(10,16,28,.88); color: var(--parch); font: 600 14px var(--ui); white-space: nowrap;
}
.tl-n { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font: 700 16px var(--ui); background: var(--ink-3); color: var(--gold-hi); border: 1.5px solid var(--brass); }
.tl-stop.food .tl-n { border-color: var(--terra); }
.tl-stop.done { opacity: .62; }
.tl-stop.done .tl-n { background: var(--brass); color: var(--ink); }
.tl-stop.current { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold), 0 0 18px rgba(232,199,125,.35); }
.tl-stop.current .tl-n { background: var(--terra); border-color: var(--gold-hi); color: #fff; }
.tl-leg { flex: none; display: flex; align-items: center; gap: 4px; padding: 0 6px; font: 600 12px var(--ui); color: var(--gold); white-space: nowrap; text-shadow: 0 1px 3px #000; }
.tl-leg::before, .tl-leg::after { content: ""; width: 10px; border-top: 2px dotted rgba(232,199,125,.7); }
.tl-ctx { flex: none; margin-left: 10px; height: 44px; padding: 0 14px; border-radius: 22px; border: 1px dashed var(--line); background: rgba(10,16,28,.82); color: var(--parch-dim); font: 600 13px var(--ui); white-space: nowrap; display: flex; align-items: center; gap: 6px; }

/* ---------- ports rail (region view) ---------- */
.rail {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 8;
  display: flex; gap: 10px; overflow-x: auto; scrollbar-width: none; scroll-snap-type: x proximity;
  padding: 14px 16px calc(16px + var(--safe-b)); scroll-padding-inline: 16px;
  background: linear-gradient(0deg, rgba(8,12,22,.96) 0%, rgba(8,12,22,.8) 70%, rgba(8,12,22,0) 100%);
}
.rail::-webkit-scrollbar { display: none; }
.rail-card {
  flex: none; min-width: 132px; max-width: 220px; min-height: 96px; scroll-snap-align: start; text-align: left;
  border-radius: 16px; border: 1px solid var(--line); background: rgba(13,22,40,.92); padding: 12px 12px 10px;
  display: flex; flex-direction: column; gap: 3px; position: relative;
}
.rail-card .rc-date { font: 600 11px var(--ui); letter-spacing: .14em; text-transform: uppercase; color: var(--brass); }
.rail-card .rc-name { font: 700 17px/1.15 var(--display); color: var(--parch); letter-spacing: .03em; }
.rail-card .rc-sub { font: italic 600 15px/1.1 var(--serif); color: var(--parch-dim); }
.rail-card .rc-tag { margin-top: auto; font: 600 11px var(--ui); letter-spacing: .08em; color: var(--muted); text-transform: uppercase; }
.rail-card.ready { border-color: var(--gold); background: linear-gradient(160deg, rgba(212,105,63,.28), rgba(13,22,40,.95) 60%); box-shadow: 0 0 22px rgba(232,199,125,.18); }
.rail-card.ready .rc-tag { color: var(--gold-hi); }
.rail-card.ready .rc-tag::before { content: "● "; color: var(--terra-hi); }

/* ---------- floating day actions ---------- */
.fab-row {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 8; display: flex; gap: 10px; align-items: stretch;
  padding: 14px 16px calc(16px + var(--safe-b));
  background: linear-gradient(0deg, rgba(8,12,22,.92) 0%, rgba(8,12,22,.6) 70%, rgba(8,12,22,0) 100%);
}
.btn { border: 0; border-radius: 16px; font: 700 18px var(--ui); min-height: 56px; padding: 0 18px; display: inline-flex; align-items: center; justify-content: center; gap: 10px; text-decoration: none; }
.btn-xl { min-height: 64px; }
.btn-gold { background: linear-gradient(180deg, var(--gold-hi), var(--gold) 45%, #c99a45); color: #1a1205; box-shadow: 0 6px 20px rgba(232,199,125,.25), inset 0 1px 0 rgba(255,255,255,.6); }
.btn-terra { background: linear-gradient(180deg, var(--terra-hi), var(--terra)); color: #fff; box-shadow: 0 6px 20px rgba(212,105,63,.3), inset 0 1px 0 rgba(255,255,255,.35); }
.btn-ghost { background: transparent; border: 1.5px solid var(--panel-line); color: var(--panel-text); font-weight: 600; font-size: 16px; }
.btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
#btnNext { flex: 1; flex-direction: column; gap: 0; align-items: flex-start; text-align: left; padding: 8px 20px; }
.fab-k { font: 700 12px var(--ui); letter-spacing: .2em; text-transform: uppercase; opacity: .75; }
.fab-v { font: 700 19px/1.2 var(--ui); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.passport-btn { width: 64px; height: 64px; border-radius: 16px; border: 1.5px dashed var(--terra); background: rgba(13,22,40,.92); }
.passport-count { font: 700 15px var(--ui); color: var(--terra-hi); }
.passport-btn::before { content: "PASS"; display: block; font: 700 9px var(--ui); letter-spacing: .2em; color: var(--parch-dim); margin-bottom: -14px; transform: translateY(-12px); }

/* ---------- bottom sheet ---------- */
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  max-height: 64vh; overflow-y: auto; overscroll-behavior: contain;
  background: var(--panel); color: var(--panel-text);
  border-top: 1px solid var(--panel-line); border-radius: 24px 24px 0 0;
  box-shadow: 0 -18px 50px rgba(0,0,0,.55);
  padding: 22px 20px calc(20px + var(--safe-b));
  animation: sheetIn .35s cubic-bezier(.2,.9,.25,1);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.sheet::before { content: ""; position: absolute; top: 8px; left: 50%; width: 44px; height: 4px; margin-left: -22px; border-radius: 2px; background: var(--panel-line); }
@keyframes sheetIn { from { transform: translateY(40px); opacity: 0; } }
.sheet-close { position: absolute; top: 14px; right: 14px; background: transparent; }
.sheet-close svg { stroke: var(--panel-text); }
.kicker { font: 700 12px var(--ui); letter-spacing: .22em; text-transform: uppercase; color: var(--brass); display: flex; align-items: center; gap: 8px; }
body.sun .kicker { color: #8a5a12; }
.kicker .roman { font: 600 13px var(--display); letter-spacing: .12em; color: var(--terra-hi); }
body.sun .kicker .roman { color: #a3401a; }
.s-title { font: 700 28px/1.12 var(--display); letter-spacing: .02em; margin: 6px 48px 2px 0; }
.s-what { font: italic 600 20px/1.25 var(--serif); color: var(--panel-sub); margin: 0 0 12px; }
.s-meta { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 14px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 999px; border: 1px solid var(--panel-line); font: 600 14px var(--ui); color: var(--panel-text); }
.chip.walk::before { content: ""; width: 14px; border-top: 3px dotted var(--gold); }
body.sun .chip.walk::before { border-color: #8a5a12; }
.chip.food { border-color: var(--terra); color: var(--terra-hi); }
body.sun .chip.food { color: #a3401a; }
.s-body { font: 400 17px/1.5 var(--ui); margin: 0 0 14px; }
.s-sect { border-top: 1px solid var(--panel-line); padding: 12px 0 2px; }
.s-sect h4 { margin: 0 0 4px; font: 700 12px var(--ui); letter-spacing: .2em; text-transform: uppercase; color: var(--brass); }
body.sun .s-sect h4 { color: #8a5a12; }
.s-sect p { margin: 0 0 10px; font: 400 17px/1.45 var(--ui); }
.s-addr { font: 500 15px/1.4 var(--ui); color: var(--panel-sub); }
.s-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 16px -20px calc(-20px - var(--safe-b)); padding: 12px 20px calc(16px + var(--safe-b)); position: sticky; bottom: calc(-20px - var(--safe-b)); background: linear-gradient(0deg, var(--panel) 80%, transparent); }
.s-actions .btn { width: 100%; }
.s-actions .wide { grid-column: 1 / -1; }

/* next-stop mode */
.ns { display: grid; grid-template-columns: auto 1fr; gap: 4px 16px; align-items: center; }
.ns-medal {
  grid-row: span 2; width: 78px; height: 78px; border-radius: 50%; display: grid; place-items: center;
  background: radial-gradient(circle at 35% 30%, #ef8a5e, #b9502a 70%); color: #fff; font: 700 38px var(--ui);
  box-shadow: 0 0 0 3px var(--panel), 0 0 0 5px var(--gold), 0 0 30px rgba(239,138,94,.5);
}
.ns-kicker { align-self: end; }
.ns-name { font: 700 27px/1.1 var(--display); align-self: start; margin-right: 40px; }
.ns-from { margin: 14px 0 6px; font: 600 16px var(--ui); color: var(--panel-sub); display: flex; align-items: center; gap: 8px; }
.ns-from b { color: var(--panel-text); font-size: 20px; }
.ns-why { font: italic 600 22px/1.3 var(--serif); margin: 4px 0 4px; }
.ns-actions { display: grid; grid-template-columns: 1.25fr 1fr; gap: 12px; margin-top: 16px; }
.ns-actions .btn { min-height: 66px; font-size: 20px; }
.ns-links { display: flex; justify-content: space-between; margin-top: 12px; }
.ns-links button { background: none; border: 0; color: var(--panel-sub); font: 600 15px var(--ui); padding: 10px 4px; min-height: 44px; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--panel-line); }
.progress { display: flex; gap: 5px; margin: 0 0 14px; }
.progress i { flex: 1; height: 5px; border-radius: 3px; background: rgba(201,164,92,.22); }
.progress i.done { background: var(--brass); }
.progress i.cur { background: var(--terra-hi); box-shadow: 0 0 8px rgba(239,138,94,.7); }

/* passport */
.stamps { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 14px; margin-top: 14px; }
.stamp {
  aspect-ratio: 1; border-radius: 50%; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
  border: 2px dashed rgba(201,164,92,.35); color: var(--panel-sub); padding: 14px; position: relative; background: none;
}
.stamp .st-n { font: 700 13px var(--ui); letter-spacing: .1em; opacity: .8; }
.stamp .st-item { font: 700 15px/1.15 var(--display); margin: 4px 0 2px; }
.stamp .st-place { font: italic 600 15px var(--serif); }
.stamp .st-date { font: 600 10px var(--display); letter-spacing: .14em; margin-top: 4px; opacity: .8; }
.stamp.on { border: 3px double var(--terra-hi); color: var(--terra-hi); transform: rotate(var(--rot, -8deg)); box-shadow: inset 0 0 0 5px rgba(239,138,94,.08); }
body.sun .stamp.on { color: #a3401a; border-color: #a3401a; }
.stamp.on.fresh { animation: thunk .5s cubic-bezier(.3,1.6,.5,1); }
@keyframes thunk { 0% { transform: scale(1.6) rotate(-20deg); opacity: 0; } 100% { transform: rotate(var(--rot, -8deg)); opacity: 1; } }

/* ---------- map markers ---------- */
.beacon { position: relative; width: 0; height: 0; cursor: pointer; }
.beacon-hit { position: absolute; left: -24px; top: -24px; width: 48px; height: 48px; border-radius: 50%; background: none; border: 0; padding: 0; }
.beacon-core { position: absolute; left: -7px; top: -7px; width: 14px; height: 14px; border-radius: 50%; background: var(--gold-hi); box-shadow: 0 0 0 3px rgba(10,16,28,.9), 0 0 0 4.5px var(--gold), 0 0 18px 4px rgba(232,199,125,.65); pointer-events: none; }
.beacon-pulse { position: absolute; left: -18px; top: -18px; width: 36px; height: 36px; border-radius: 50%; border: 1.5px solid var(--gold); animation: pulse 2.6s ease-out infinite; pointer-events: none; }
.beacon.ready .beacon-core { background: #fff; box-shadow: 0 0 0 3px rgba(10,16,28,.9), 0 0 0 5px var(--terra-hi), 0 0 22px 6px rgba(239,138,94,.75); }
.beacon.ready .beacon-pulse { border-color: var(--terra-hi); }
.beacon.sea .beacon-core { width: 10px; height: 10px; left: -5px; top: -5px; background: transparent; box-shadow: 0 0 0 1.5px var(--gold); }
.beacon.sea .beacon-pulse { display: none; }
@keyframes pulse { 0% { transform: scale(.4); opacity: .9; } 100% { transform: scale(1.6); opacity: 0; } }
.beacon-label { position: absolute; white-space: nowrap; pointer-events: none; text-shadow: 0 1px 3px #000, 0 0 10px rgba(0,0,0,.9); line-height: 1.05; }
.beacon-label .bl-name { font: 700 14px var(--display); letter-spacing: .05em; color: var(--parch); }
.beacon-label .bl-date { font: 600 10.5px var(--ui); letter-spacing: .12em; color: var(--gold); text-transform: uppercase; }
.beacon.ready .bl-name { color: #fff; font-size: 16px; }
.beacon.sea .bl-name { font: italic 600 15px var(--serif); color: var(--parch-dim); letter-spacing: .02em; }
.beacon-label.right { left: 16px; top: -14px; }
.beacon-label.left { right: 16px; top: -14px; text-align: right; }
.beacon-label.top { bottom: 14px; left: 0; transform: translateX(-50%); text-align: center; }
.beacon-label.bottom { top: 14px; left: 0; transform: translateX(-50%); text-align: center; }
.sea-label { font: italic 500 22px var(--serif); color: rgba(232,199,125,.42); letter-spacing: .3em; text-transform: uppercase; white-space: nowrap; pointer-events: none; text-shadow: 0 0 8px rgba(0,0,0,.6); }
.ship { width: 34px; height: 34px; pointer-events: none; filter: drop-shadow(0 0 6px rgba(232,199,125,.7)); }
.ship svg { width: 100%; height: 100%; }

.pin {
  width: 48px; height: 48px; border-radius: 50%; padding: 0; border: 0; position: relative;
  display: grid; place-items: center; background: radial-gradient(circle at 35% 30%, #22324d, #0c1424 75%);
  box-shadow: 0 0 0 2.5px var(--gold), 0 0 0 5px rgba(10,16,28,.9), 0 0 0 6px rgba(232,199,125,.5), 0 6px 16px rgba(0,0,0,.6);
  color: #fff; font: 700 22px/1 var(--ui); font-variant-numeric: tabular-nums; text-shadow: 0 1px 2px #000;
  animation: pinIn .45s cubic-bezier(.3,1.5,.5,1) both;
}
.pin.food { box-shadow: 0 0 0 2.5px var(--terra-hi), 0 0 0 5px rgba(10,16,28,.9), 0 0 0 6px rgba(239,138,94,.5), 0 6px 16px rgba(0,0,0,.6); }
.pin.done { background: radial-gradient(circle at 35% 30%, var(--gold-hi), #b8893a 80%); color: #1a1205; text-shadow: none; opacity: .88; }
.pin.done::after { content: "✓"; position: absolute; right: -4px; top: -4px; width: 20px; height: 20px; border-radius: 50%; background: var(--ink); color: var(--gold-hi); font: 700 12px/20px var(--ui); text-align: center; box-shadow: 0 0 0 1.5px var(--gold); }
.pin.current { background: radial-gradient(circle at 35% 30%, #ef8a5e, #b9502a 75%); width: 56px; height: 56px; font-size: 26px; box-shadow: 0 0 0 3px var(--gold-hi), 0 0 0 6px rgba(10,16,28,.9), 0 0 24px 8px rgba(239,138,94,.55); z-index: 5; }
.pin.current::before { content: ""; position: absolute; inset: -10px; border-radius: 50%; border: 2px solid var(--terra-hi); animation: pulse 2s ease-out infinite; }
.pin.dim { opacity: .45; }
.pin.selected { outline: 3px solid #fff; outline-offset: 5px; }
@keyframes pinIn { from { transform: scale(0); opacity: 0; } }
.pin-wrap { width: 0; height: 0; position: relative; overflow: visible; }
.pin-wrap > .pin { position: absolute; left: 0; top: 0; translate: -50% -50%; }
.maplibregl-marker.top { z-index: 5; }
body.pins-far .pin { width: 36px; height: 36px; font-size: 17px; box-shadow: 0 0 0 2px var(--gold), 0 0 0 4px rgba(10,16,28,.9), 0 4px 10px rgba(0,0,0,.6); }
body.pins-far .pin.food { box-shadow: 0 0 0 2px var(--terra-hi), 0 0 0 4px rgba(10,16,28,.9), 0 4px 10px rgba(0,0,0,.6); }
body.pins-far .pin.current { width: 46px; height: 46px; font-size: 21px; }
body.pins-far .pin.done::after { width: 16px; height: 16px; font-size: 10px; line-height: 16px; }


/* ---------- photo gallery ---------- */
.gal { margin: 0 0 14px; }
.gal-viewport {
  display: flex; gap: 10px;
  overflow-x: auto; scroll-snap-type: x mandatory;
  scroll-behavior: smooth; -webkit-overflow-scrolling: touch;
  margin: 0 -20px; padding: 0 20px 4px;
  scrollbar-width: none;
}
.gal-viewport::-webkit-scrollbar { display: none; }
.gal-slide {
  flex: 0 0 calc(100% - 32px); scroll-snap-align: start; scroll-snap-stop: always;
  border: 0; padding: 0; background: rgba(0,0,0,.25);
  border-radius: 14px; overflow: hidden; cursor: zoom-in;
  aspect-ratio: 16 / 10; position: relative;
  box-shadow: 0 0 0 1px var(--panel-line);
}
.gal-slide img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  background: linear-gradient(135deg, #1a2438, #0c1424);
}
.gal-dots {
  display: flex; justify-content: center; gap: 7px; margin: 10px 0 6px;
}
.gal-dot {
  width: 7px; height: 7px; border-radius: 50%; padding: 0; border: 0;
  background: rgba(201,164,92,.28); transition: .2s;
}
.gal-dot.on { background: var(--gold); box-shadow: 0 0 8px rgba(232,199,125,.55); transform: scale(1.15); }
body.sun .gal-dot.on { background: #8a5a12; box-shadow: none; }
.gal-credit {
  font: 500 11.5px/1.35 var(--ui); color: var(--panel-sub); opacity: .85;
  letter-spacing: .02em; text-align: center; padding: 0 4px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.gal-compact .gal-slide { flex-basis: calc(100% - 40px); aspect-ratio: 2 / 1; border-radius: 12px; }
.gal-compact .gal-credit { font-size: 10.5px; }
.gal-compact { margin: 10px 0 8px; }

/* lightbox */
.lightbox {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(5, 8, 15, .94);
  display: flex; flex-direction: column;
  animation: lbIn .25s ease-out;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
@keyframes lbIn { from { opacity: 0; } }
.lb-close {
  position: absolute; top: calc(12px + var(--safe-t)); right: 14px; z-index: 2;
  background: rgba(13,27,51,.85);
}
.lb-close svg { stroke: var(--parch); }
.lb-viewport {
  flex: 1; display: flex; overflow-x: auto; scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch; scrollbar-width: none;
  align-items: stretch;
}
.lb-viewport::-webkit-scrollbar { display: none; }
.lb-slide {
  flex: 0 0 100%; scroll-snap-align: center; scroll-snap-stop: always;
  display: grid; place-items: center; padding: 64px 16px 100px;
  box-sizing: border-box;
}
.lb-slide img {
  max-width: 100%; max-height: calc(100vh - 180px); object-fit: contain;
  border-radius: 8px; box-shadow: 0 12px 40px rgba(0,0,0,.55);
}
.lb-caption {
  position: absolute; left: 0; right: 0; bottom: calc(28px + var(--safe-b));
  text-align: center; padding: 0 20px;
  font: 500 13px/1.4 var(--ui); color: var(--parch-dim);
  display: flex; flex-direction: column; gap: 2px; align-items: center;
  pointer-events: none;
}
.lb-caption strong { font: 600 14px var(--ui); color: var(--parch); }
.lb-caption a { color: var(--gold); pointer-events: auto; text-decoration: underline; text-underline-offset: 2px; }
.lb-dots {
  position: absolute; left: 0; right: 0; bottom: calc(10px + var(--safe-b));
  display: flex; justify-content: center; gap: 6px; pointer-events: none;
}
.lb-dots i { width: 6px; height: 6px; border-radius: 50%; background: rgba(232,199,125,.3); }
.lb-dots i.on { background: var(--gold); }
body.lightbox-open { overflow: hidden; }

/* ---------- toast / loading ---------- */
.toast { position: fixed; left: 50%; top: calc(130px + var(--safe-t)); transform: translate(-50%, -10px); z-index: 40; opacity: 0; pointer-events: none;
  background: var(--panel); color: var(--panel-text); border: 1px solid var(--panel-line); padding: 12px 18px; border-radius: 14px; font: 600 15px var(--ui); transition: .3s; max-width: 90vw; text-align: center; }
.toast.on { opacity: 1; transform: translate(-50%, 0); }
.loading { position: fixed; inset: 0; z-index: 50; display: grid; place-content: center; justify-items: center; gap: 18px; background: var(--ink); transition: opacity .8s; }
.loading.off { opacity: 0; pointer-events: none; }
.loading-ring { width: 64px; height: 64px; border-radius: 50%; border: 2px solid rgba(201,164,92,.25); border-top-color: var(--gold); animation: spin 1.1s linear infinite; }
.loading-t { font: italic 600 20px var(--serif); color: var(--parch-dim); letter-spacing: .04em; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- desktop ---------- */
@media (min-width: 900px) {
  .sheet { left: 20px; right: auto; bottom: auto; top: calc(150px + var(--safe-t)); width: 410px; max-height: calc(100vh - 260px); border-radius: 22px; border: 1px solid var(--panel-line); }
  body.view-region .sheet { top: auto; bottom: 150px; max-height: calc(100vh - 320px); }
  .sheet::before { display: none; }
  .fab-row { right: auto; width: 450px; background: none; }
  .rail-card:first-child { margin-left: auto; } .rail-card:last-child { margin-right: auto; }
  .rail { background: linear-gradient(0deg, rgba(8,12,22,.9) 0%, rgba(8,12,22,0) 100%); }
  .topbar { padding-left: 24px; padding-right: 22px; }
  .brand-title { font-size: 28px; }
  .timeline { padding-left: 20px; }
  .hud-readout { left: auto; right: 84px; text-align: right; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }

@media (max-width: 899px) {
  .beacon-label .bl-name { font-size: 12.5px; }
  .beacon.ready .bl-name { font-size: 14.5px; }
  .beacon-label .bl-date { font-size: 9.5px; letter-spacing: .1em; }
  .beacon-label.right { left: 13px; top: -12px; }
  .beacon-label.left { right: 13px; top: -12px; }
  .beacon-label.top { bottom: 11px; }
  .beacon-label.bottom { top: 11px; }
}

@media (max-width: 899px) { body.sheet-open .compass, body.sheet-open .hud-readout { display: none; } }

/* voyage title block (region view) */
.voyage-title { position: fixed; z-index: 7; left: 0; right: 0; top: calc(78px + var(--safe-t)); padding: 14px 16px 22px; pointer-events: none; text-align: center; text-shadow: 0 2px 12px rgba(0,0,0,.85);
  background: radial-gradient(ellipse 70% 62% at 50% 50%, rgba(8,12,22,.9) 0%, rgba(8,12,22,.7) 55%, rgba(8,12,22,0) 100%); }
.vt-k { font: 600 12px var(--display); letter-spacing: .3em; color: var(--terra-hi); }
.vt-t { font: 700 30px/1.1 var(--display); letter-spacing: .06em; color: var(--parch); margin-top: 6px; }
.vt-rule { display: flex; align-items: center; gap: 10px; justify-content: center; margin: 8px auto 8px; max-width: 260px; color: var(--brass); font-style: normal; }
.vt-rule span { flex: 1; height: 1px; background: linear-gradient(90deg, transparent, var(--brass), transparent); }
.vt-rule i { font-style: normal; font-size: 12px; }
.vt-s { font: 600 14px var(--ui); color: var(--parch-dim); letter-spacing: .02em; }
.vt-s2 { font: italic 600 17px var(--serif); color: var(--gold); margin-top: 3px; }
@media (min-width: 900px) {
  .voyage-title { right: auto; left: 12px; top: auto; bottom: 150px; text-align: left; background: radial-gradient(ellipse 65% 60% at 40% 50%, rgba(8,12,22,.85) 0%, rgba(8,12,22,.55) 60%, rgba(8,12,22,0) 100%); }
  .vt-rule { margin-left: 0; justify-content: flex-start; }
  .vt-t { font-size: 34px; }
}
