/* ==========================================================================
   KARLA 2026 · Törnbericht · Stylesheet
   ========================================================================== */
:root {
  --navy: #0b1c2e;
  --navy-2: #0f2740;
  --ink: #06111d;
  --cream: #f3e9d2;
  --cream-2: #e2d6bb;
  --muted: #9fb0c3;
  --teal: #2ec4b6;
  --cyan: #3edbf0;
  --sun: #ffb84c;
  --orange: #f28c28;
  --coral: #ff7b54;
  --line: rgba(243, 233, 210, 0.12);
  --glass: rgba(11, 28, 46, 0.72);
  --glass-2: rgba(15, 39, 64, 0.85);
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
  --radius: 18px;
  --font-display: "Fraunces", "Playfair Display", Georgia, "Times New Roman", serif;
  --font-body: "Manrope", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", "SFMono-Regular", Consolas, monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--navy);
  color: var(--cream);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
body.locked { overflow: hidden; }
img { max-width: 100%; display: block; }
a { color: var(--cyan); text-decoration: none; }
a:hover { text-decoration: underline; }
::selection { background: var(--sun); color: var(--ink); }
button { font-family: inherit; }
h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 600; line-height: 1.1; margin: 0 0 0.5em; letter-spacing: -0.01em; }
h2 { font-size: clamp(2rem, 4vw, 3.2rem); }
h3 { font-size: 1.5rem; }
p { margin: 0 0 1em; }
.mono { font-family: var(--font-mono); }
.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--teal);
  margin-bottom: 0.9rem;
  display: flex; align-items: center; gap: 0.8rem;
}
.eyebrow::before { content: ""; width: 34px; height: 1px; background: var(--teal); }
.section { position: relative; padding: clamp(4rem, 9vw, 8rem) clamp(1.2rem, 5vw, 4rem); }
.wrap { max-width: 1240px; margin: 0 auto; }
.lead { font-size: 1.25rem; color: var(--cream-2); max-width: 62ch; }
.divider { height: 1px; background: linear-gradient(90deg, transparent, var(--line) 20%, var(--line) 80%, transparent); margin: 0 auto; max-width: 1240px; }

/* --------------------------------------------------------------------------
   Reveal on scroll
   -------------------------------------------------------------------------- */
.reveal { opacity: 0; transform: translateY(26px); transition: opacity 0.9s cubic-bezier(.2,.7,.2,1), transform 0.9s cubic-bezier(.2,.7,.2,1); }
.reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .reveal { opacity: 1; transform: none; transition: none; } }

/* --------------------------------------------------------------------------
   PIN gate
   -------------------------------------------------------------------------- */
#gate {
  position: fixed; inset: 0; z-index: 3000;
  display: grid; place-items: center;
  background: radial-gradient(1200px 700px at 70% 20%, #16385a 0%, var(--navy) 45%, var(--ink) 100%);
  overflow: hidden;
  transition: opacity 0.9s ease, transform 1.2s cubic-bezier(.6,0,.3,1), visibility 0s linear 1.2s;
}
#gate.unlocked { opacity: 0; transform: translateY(-100%); visibility: hidden; }
#gate .sea { position: absolute; left: 0; right: 0; bottom: -2px; height: 32vh; pointer-events: none; }
#gate .wave { position: absolute; bottom: 0; left: 0; width: 200%; height: 100%; fill: rgba(46, 196, 182, 0.18); animation: drift 14s linear infinite; }
#gate .wave.w2 { fill: rgba(62, 219, 240, 0.12); animation-duration: 22s; animation-direction: reverse; height: 80%; }
#gate .wave.w3 { fill: rgba(11, 28, 46, 0.9); animation-duration: 30s; height: 55%; }
@keyframes drift { from { transform: translateX(0); } to { transform: translateX(-50%); } }
#gate .stars { position: absolute; inset: 0; background-image: radial-gradient(1px 1px at 20% 30%, rgba(255,255,255,.7) 50%, transparent 51%), radial-gradient(1px 1px at 70% 15%, rgba(255,255,255,.6) 50%, transparent 51%), radial-gradient(1.5px 1.5px at 40% 60%, rgba(255,255,255,.5) 50%, transparent 51%), radial-gradient(1px 1px at 85% 45%, rgba(255,255,255,.7) 50%, transparent 51%), radial-gradient(1px 1px at 10% 70%, rgba(255,255,255,.5) 50%, transparent 51%), radial-gradient(1.2px 1.2px at 55% 25%, rgba(255,255,255,.6) 50%, transparent 51%); opacity: .8; }
.gate-card {
  position: relative; z-index: 2;
  width: min(92vw, 420px);
  padding: 2.2rem 2rem 2rem;
  border-radius: 28px;
  background: rgba(6, 17, 29, 0.55);
  border: 1px solid rgba(243,233,210,.14);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
  text-align: center;
}
.gate-card .badge { width: 112px; margin: -4.6rem auto 0.6rem; filter: drop-shadow(0 12px 24px rgba(0,0,0,.5)); animation: bob 6s ease-in-out infinite; }
@keyframes bob { 0%,100% { transform: translateY(0) rotate(-2deg);} 50% { transform: translateY(-6px) rotate(2deg);} }
.gate-card h1 { font-size: 2.2rem; margin: 0.2rem 0 0; font-weight: 800; letter-spacing: 0.04em; }
.gate-card .sub { color: var(--muted); font-size: 0.95rem; margin-bottom: 1.4rem; }
.pin-dots { display: flex; justify-content: center; gap: 14px; margin: 0.4rem 0 1.4rem; }
.pin-dots span { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--teal); transition: background .15s, transform .15s; }
.pin-dots span.on { background: var(--teal); transform: scale(1.1); box-shadow: 0 0 14px rgba(46,196,182,.7); }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.keypad button {
  height: 60px; border-radius: 16px; border: 1px solid rgba(243,233,210,.12);
  background: rgba(243,233,210,.06); color: var(--cream); font-size: 1.4rem; font-family: var(--font-mono);
  cursor: pointer; transition: background .15s, transform .08s;
}
.keypad button:hover { background: rgba(243,233,210,.14); }
.keypad button:active { transform: scale(.96); }
.keypad button.ghost { background: transparent; border-color: transparent; color: var(--muted); font-size: 1.1rem; }
.gate-card .hint { margin-top: 1.2rem; font-size: 0.8rem; color: var(--muted); min-height: 1.2em; }
.gate-card.shake { animation: shake .5s cubic-bezier(.36,.07,.19,.97); }
.gate-card.shake .pin-dots span { border-color: var(--coral); }
@keyframes shake { 10%,90% { transform: translateX(-2px);} 20%,80% { transform: translateX(4px);} 30%,50%,70% { transform: translateX(-8px);} 40%,60% { transform: translateX(8px);} }

/* --------------------------------------------------------------------------
   Top bar
   -------------------------------------------------------------------------- */
#top {
  position: fixed; top: 0; left: 0; right: 0; z-index: 1200;
  display: flex; align-items: center; gap: 1rem;
  padding: 0.7rem clamp(1rem, 3vw, 2rem);
  background: linear-gradient(180deg, rgba(6,17,29,.85), rgba(6,17,29,.55));
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
  transform: translateY(-100%); transition: transform .5s ease;
}
body.unlocked #top { transform: none; }
#top .brand { display: flex; align-items: center; gap: .7rem; font-family: var(--font-display); font-weight: 800; letter-spacing: .06em; color: var(--cream); }
#top .brand img { width: 34px; height: 34px; }
#top nav { margin-left: auto; display: flex; gap: 1.2rem; font-size: .9rem; }
#top nav a { color: var(--cream-2); opacity: .85; }
#top nav a:hover { opacity: 1; text-decoration: none; color: var(--sun); }
#top .progress { position: absolute; left: 0; bottom: -1px; height: 2px; width: 0; background: linear-gradient(90deg, var(--teal), var(--sun)); transition: width .1s linear; }
@media (max-width: 800px) { #top nav { display: none; } }

/* --------------------------------------------------------------------------
   Hero
   -------------------------------------------------------------------------- */
.hero {
  position: relative; min-height: 100svh; display: grid; align-items: end;
  background: var(--ink) center/cover no-repeat;
  isolation: isolate; overflow: hidden;
}
.hero::before { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(6,17,29,.25) 0%, rgba(6,17,29,.15) 40%, rgba(11,28,46,.92) 85%, var(--navy) 100%); z-index: -1; }
.hero .poster { position: absolute; inset: 0; z-index: -2; background: center 30%/cover no-repeat; transform: scale(1.04); animation: kenburns 30s ease-in-out infinite alternate; }
@keyframes kenburns { from { transform: scale(1.04) translateY(0);} to { transform: scale(1.12) translateY(-2%);} }
.hero-inner { position: relative; width: 100%; max-width: 1240px; margin: 0 auto; padding: 8rem clamp(1.2rem, 5vw, 4rem) 7rem; display: grid; grid-template-columns: 1fr auto; gap: 2rem; align-items: end; }
.hero .kicker { font-family: var(--font-mono); letter-spacing: .3em; text-transform: uppercase; font-size: .78rem; color: var(--sun); margin-bottom: 1rem; }
.hero h1 { font-size: clamp(4rem, 13vw, 11rem); font-weight: 800; line-height: .9; letter-spacing: .02em; margin: 0 0 .3em; text-shadow: 0 10px 40px rgba(0,0,0,.5); }
.hero h1 small { display: block; font-size: .22em; font-weight: 300; letter-spacing: .3em; margin-top: .6em; color: var(--cream-2); }
.hero .route { font-size: clamp(1rem, 2vw, 1.35rem); color: var(--cream-2); font-weight: 500; }
.hero .route b { color: var(--sun); font-weight: 700; }
.hero .dates { margin-top: .8rem; font-family: var(--font-mono); color: var(--teal); font-size: .95rem; }
.hero .badge { width: clamp(130px, 16vw, 220px); filter: drop-shadow(0 18px 40px rgba(0,0,0,.55)); transform: rotate(6deg); transition: transform .6s cubic-bezier(.2,.8,.2,1); }
.hero .badge:hover { transform: rotate(-4deg) scale(1.05); }
.hero .scroll { position: absolute; left: 50%; bottom: 1.6rem; transform: translateX(-50%); font-family: var(--font-mono); font-size: .7rem; letter-spacing: .3em; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: .5rem; }
.hero .scroll i { width: 1px; height: 46px; background: linear-gradient(var(--teal), transparent); animation: pulse 2s ease-in-out infinite; }
@keyframes pulse { 0%,100% { opacity:.3; transform: scaleY(.6); transform-origin: top;} 50% { opacity:1; transform: scaleY(1);} }
.hero .waves { position: absolute; left: 0; right: 0; bottom: -1px; height: 90px; pointer-events: none; }
.hero .waves svg { width: 200%; height: 100%; animation: drift 18s linear infinite; }
@media (max-width: 800px) { .hero-inner { grid-template-columns: 1fr; } .hero .badge { justify-self: start; } }

/* --------------------------------------------------------------------------
   Intro / crew / boat
   -------------------------------------------------------------------------- */
.intro-grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: clamp(2rem, 5vw, 5rem); align-items: start; }
.crew-cards { display: grid; gap: .8rem; }
.crew-card { display: flex; gap: 1rem; align-items: center; padding: 1rem 1.2rem; border-radius: var(--radius); background: var(--glass-2); border: 1px solid var(--line); }
.crew-card .avatar { width: 54px; height: 54px; border-radius: 50%; display: grid; place-items: center; font-family: var(--font-display); font-weight: 800; color: var(--ink); background: linear-gradient(135deg, var(--sun), var(--coral)); flex: none; }
.crew-card:nth-child(2) .avatar { background: linear-gradient(135deg, var(--cyan), var(--teal)); }
.crew-card:nth-child(3) .avatar { background: linear-gradient(135deg, #c77dff, #9bf6b0); }
.crew-card b { display: block; font-size: 1.05rem; }
.crew-card span { color: var(--muted); font-size: .9rem; }
.crew-card em { margin-left: auto; font-style: normal; font-family: var(--font-mono); font-size: .75rem; letter-spacing: .15em; text-transform: uppercase; color: var(--teal); }
@media (max-width: 900px) { .intro-grid { grid-template-columns: 1fr; } }

/* --------------------------------------------------------------------------
   Stats
   -------------------------------------------------------------------------- */
.stats { background: linear-gradient(180deg, var(--navy) 0%, var(--navy-2) 100%); }
.stat-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 1rem; }
.stat { padding: 1.4rem 1.2rem 1.2rem; border-radius: var(--radius); background: rgba(6,17,29,.5); border: 1px solid var(--line); position: relative; overflow: hidden; }
.stat::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: var(--c, var(--teal)); opacity: .8; }
.stat .num { font-family: var(--font-mono); font-size: clamp(1.8rem, 3vw, 2.6rem); font-weight: 600; line-height: 1; color: var(--cream); }
.stat .num small { font-size: .45em; color: var(--muted); margin-left: .2em; }
.stat .lbl { margin-top: .6rem; font-size: .85rem; color: var(--muted); }
.stat-row2 { display: grid; grid-template-columns: 1.2fr 1fr 1fr; gap: 1rem; margin-top: 1rem; }
.panel { padding: 1.4rem; border-radius: var(--radius); background: rgba(6,17,29,.5); border: 1px solid var(--line); }
.panel h4 { font-family: var(--font-mono); font-weight: 600; font-size: .75rem; letter-spacing: .2em; text-transform: uppercase; color: var(--teal); margin: 0 0 1rem; }
.donut { display: grid; grid-template-columns: 150px 1fr; gap: 1.2rem; align-items: center; }
.donut svg { width: 150px; height: 150px; }
.donut .k { display: flex; align-items: center; gap: .6rem; font-size: .95rem; margin-bottom: .5rem; }
.donut .k i { width: 12px; height: 12px; border-radius: 3px; }
.rose svg { width: 100%; height: auto; max-height: 220px; }
.daybars { display: grid; gap: .55rem; }
.daybar { display: grid; grid-template-columns: 52px 1fr 64px; gap: .7rem; align-items: center; font-size: .85rem; }
.daybar .bar { height: 12px; border-radius: 6px; background: rgba(243,233,210,.08); overflow: hidden; display: flex; }
.daybar .bar i { display: block; height: 100%; }
.daybar .bar i.s { background: var(--c); }
.daybar .bar i.m { background: rgba(243,233,210,.35); }
.daybar b { font-family: var(--font-mono); font-weight: 600; color: var(--c); }
.daybar span { font-family: var(--font-mono); color: var(--muted); text-align: right; }
@media (max-width: 1000px) { .stat-grid { grid-template-columns: repeat(3, 1fr); } .stat-row2 { grid-template-columns: 1fr; } }
@media (max-width: 560px) { .stat-grid { grid-template-columns: repeat(2, 1fr); } }

/* --------------------------------------------------------------------------
   Map
   -------------------------------------------------------------------------- */
.map-section { padding-left: 0; padding-right: 0; }
.map-section .wrap { max-width: none; }
.map-head { max-width: 1240px; margin: 0 auto 1.6rem; padding: 0 clamp(1.2rem, 5vw, 4rem); display: grid; grid-template-columns: 1fr auto; gap: 1rem; align-items: end; }
.map-frame { position: relative; margin: 0 clamp(.6rem, 2vw, 2rem); border-radius: 24px; overflow: hidden; border: 1px solid var(--line); box-shadow: var(--shadow); background: #0a1a2b; }
#map { height: min(78vh, 820px); min-height: 480px; background: #0a1a2b; }
.leaflet-container { font-family: var(--font-body); }
.map-frame .leaflet-top, .map-frame .leaflet-bottom { z-index: 440; }
.leaflet-container a.leaflet-popup-close-button { color: var(--muted); }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: var(--glass-2); color: var(--cream); box-shadow: var(--shadow); border: 1px solid var(--line); }
.leaflet-popup-content { margin: 10px 14px; font-size: .9rem; line-height: 1.45; }
.leaflet-popup-content .pp-t { font-family: var(--font-mono); font-size: .72rem; letter-spacing: .12em; text-transform: uppercase; color: var(--teal); }
.leaflet-popup-content .pp-img { width: 220px; height: 150px; object-fit: cover; border-radius: 10px; margin: .4rem 0; cursor: zoom-in; }
.leaflet-control-layers, .leaflet-bar { border: 1px solid var(--line) !important; box-shadow: var(--shadow) !important; }
.leaflet-control-layers { background: var(--glass-2) !important; color: var(--cream); border-radius: 12px !important; }
.leaflet-control-layers-expanded { padding: 8px 12px; font-size: .85rem; }
.leaflet-bar a { background: var(--glass-2) !important; color: var(--cream) !important; border-bottom-color: var(--line) !important; }
.leaflet-control-attribution { background: rgba(6,17,29,.7) !important; color: var(--muted) !important; font-size: 10px !important; }
.leaflet-control-attribution a { color: var(--teal) !important; }

/* markers */
.mk { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--glass-2); border: 2px solid var(--c, var(--cream)); color: var(--c, var(--cream)); box-shadow: 0 4px 14px rgba(0,0,0,.5); font-size: 13px; }
.mk.big { width: 34px; height: 34px; font-size: 17px; }
.mk svg { width: 60%; height: 60%; fill: currentColor; }
.mk-ph { width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--cream); box-shadow: 0 3px 10px rgba(0,0,0,.6); overflow: hidden; background: #000; cursor: pointer; transition: transform .2s; }
.mk-ph img { width: 100%; height: 100%; object-fit: cover; }
.mk-ph:hover { transform: scale(1.5); z-index: 999; }
.mk-lbl { font-family: var(--font-mono); font-size: 11px; letter-spacing: .05em; color: var(--cream); text-shadow: 0 1px 4px #000, 0 0 10px #000; white-space: nowrap; font-weight: 600; }

/* ship */
.ship { width: 56px; height: 56px; position: relative; filter: drop-shadow(0 4px 10px rgba(0,0,0,.6)); }
.ship svg { width: 100%; height: 100%; overflow: visible; }
.ship .hull { fill: #f7f2e4; stroke: #0b1c2e; stroke-width: 1.2; }
.ship .deck { fill: #d8c9a3; }
.ship .sail { fill: rgba(255,255,255,.95); stroke: #0b1c2e; stroke-width: .8; transition: opacity .3s; }
.ship .sail.genoa { fill: rgba(243,233,210,.95); }
.ship.motor .sail { opacity: 0; }
.ship .prop { opacity: 0; fill: none; stroke: rgba(62,219,240,.9); stroke-width: 1.4; stroke-linecap: round; }
.ship.motor .prop { opacity: 1; animation: propwash .8s linear infinite; }
@keyframes propwash { from { stroke-dashoffset: 0; } to { stroke-dashoffset: -8; } }
.ship .heel { transform-origin: 32px 30px; }

/* HUD */
.hud { position: absolute; top: 14px; right: 14px; z-index: 450; width: 250px; padding: 14px 16px; border-radius: 18px; background: var(--glass); border: 1px solid var(--line); backdrop-filter: blur(12px); box-shadow: var(--shadow); font-size: .85rem; }
.hud .date { font-family: var(--font-mono); font-size: .75rem; letter-spacing: .12em; color: var(--teal); text-transform: uppercase; }
.hud .clock { font-family: var(--font-mono); font-size: 2rem; font-weight: 600; line-height: 1.1; }
.hud .daytag { display: inline-block; margin-top: .3rem; padding: .15rem .6rem; border-radius: 999px; font-size: .72rem; font-weight: 700; color: var(--ink); background: var(--c, var(--sun)); }
.hud .inst { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem .8rem; margin-top: .9rem; }
.hud .inst div { background: rgba(6,17,29,.5); border-radius: 12px; padding: .5rem .7rem; }
.hud .inst label { display: block; font-family: var(--font-mono); font-size: .62rem; letter-spacing: .15em; text-transform: uppercase; color: var(--muted); }
.hud .inst b { font-family: var(--font-mono); font-size: 1.25rem; font-weight: 600; }
.hud .inst b small { font-size: .6em; color: var(--muted); }
.hud .dials { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; margin-top: .6rem; }
.hud .dial { aspect-ratio: 1; background: rgba(6,17,29,.5); border-radius: 12px; position: relative; display: grid; place-items: center; }
.hud .dial svg { width: 88%; height: 88%; overflow: visible; }
.hud .dial label { position: absolute; bottom: 4px; left: 0; right: 0; text-align: center; font-family: var(--font-mono); font-size: .58rem; letter-spacing: .15em; text-transform: uppercase; color: var(--muted); }
.hud .status { margin-top: .8rem; display: flex; align-items: center; gap: .5rem; font-weight: 600; }
.hud .status i { width: 10px; height: 10px; border-radius: 50%; background: var(--teal); box-shadow: 0 0 10px var(--teal); }
.hud .status.motor i { background: var(--coral); box-shadow: 0 0 10px var(--coral); }
.hud .status.idle i { background: var(--muted); box-shadow: none; }
.hud .pos { margin-top: .5rem; font-family: var(--font-mono); font-size: .68rem; color: var(--muted); }
.hud-toggle { display: none; }

/* cam strip */
.cam { position: absolute; left: 14px; bottom: 14px; z-index: 450; display: flex; gap: 8px; align-items: flex-end; max-width: calc(100% - 300px); overflow: hidden; pointer-events: none; }
.cam figure { margin: 0; width: 92px; height: 68px; border-radius: 10px; overflow: hidden; border: 2px solid var(--cream); box-shadow: var(--shadow); pointer-events: auto; cursor: zoom-in; animation: pop .5s cubic-bezier(.2,.8,.2,1); position: relative; background: #000; }
.cam figure img { width: 100%; height: 100%; object-fit: cover; }
.cam figure figcaption { position: absolute; left: 0; right: 0; bottom: 0; padding: 2px 6px; font-family: var(--font-mono); font-size: .58rem; background: rgba(6,17,29,.75); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cam .camlbl { font-family: var(--font-mono); font-size: .62rem; letter-spacing: .2em; text-transform: uppercase; color: var(--cream); writing-mode: vertical-rl; transform: rotate(180deg); opacity: .7; padding-bottom: 4px; text-shadow: 0 1px 4px #000; }
@keyframes pop { from { transform: translateY(20px) scale(.9); opacity: 0;} to { transform: none; opacity: 1;} }

/* flying memory photos during playback */
.flyer { position: absolute; z-index: 455; width: 260px; margin: 0; border-radius: 14px; overflow: hidden; border: 3px solid var(--cream); box-shadow: 0 24px 60px rgba(0,0,0,.65); background: #000; cursor: zoom-in; transform-origin: center; animation: flyphoto var(--dur, 6.5s) cubic-bezier(.25,.6,.3,1) forwards; will-change: transform, opacity; }
.flyer.portrait { width: 170px; }
.flyer img { width: 100%; height: auto; display: block; }
.flyer figcaption { position: absolute; left: 0; right: 0; bottom: 0; padding: 1rem .6rem .45rem; font-size: .72rem; line-height: 1.3; background: linear-gradient(transparent, rgba(6,17,29,.92)); }
.flyer figcaption time { display: block; font-family: var(--font-mono); font-size: .62rem; color: var(--teal); }
@keyframes flyphoto {
  0%   { transform: translate(-50%, -50%) scale(.12) rotate(0deg); opacity: 0; }
  9%   { transform: translate(-50%, -50%) scale(1.04) rotate(0deg); opacity: 1; }
  15%  { transform: translate(-50%, -50%) scale(1) rotate(0deg); opacity: 1; }
  45%  { opacity: 1; }
  100% { transform: translate(calc(-50% + var(--fx, -260px)), calc(-50% + var(--fy, -280px))) scale(.72) rotate(var(--fr, -6deg)); opacity: 0; }
}
@media (max-width: 800px) { .flyer { width: 150px; } .flyer.portrait { width: 105px; } .flyer figcaption { font-size: .6rem; } }

/* video card during playback + video tiles */
.vidcard { position: absolute; right: 60px; bottom: 14px; z-index: 456; width: 320px; margin: 0; border-radius: 14px; overflow: hidden; border: 3px solid var(--cream); box-shadow: 0 24px 60px rgba(0,0,0,.65); background: #000; cursor: pointer; animation: pop .5s cubic-bezier(.2,.8,.2,1); }
.vidcard video { width: 100%; display: block; max-height: 240px; object-fit: cover; }
.vidcard .vc-cap { position: absolute; left: 0; right: 0; bottom: 0; padding: 1rem .6rem .45rem; font-size: .72rem; line-height: 1.3; background: linear-gradient(transparent, rgba(6,17,29,.92)); pointer-events: none; }
.vidcard .vc-cap time { display: block; font-family: var(--font-mono); font-size: .62rem; color: var(--teal); }
.vidcard .vc-badge { position: absolute; top: 8px; left: 8px; font-family: var(--font-mono); font-size: .62rem; letter-spacing: .1em; background: rgba(255,123,84,.92); color: #fff; padding: 2px 7px; border-radius: 6px; }
.vidcard .vc-badge::before { content: "●"; margin-right: .35rem; animation: blink 1s steps(2) infinite; }
@keyframes blink { to { opacity: .2; } }
.vidcard.out { animation: vidout .6s ease forwards; }
.vidcard.tl { right: auto; bottom: auto; left: 14px; top: 246px; }
.vidcard.portrait { width: 190px; }
.vidcard.portrait video { max-height: 330px; }
@keyframes vidout { to { transform: translateY(30px); opacity: 0; } }
.mk-vid { width: 22px; height: 22px; border-radius: 50%; background: rgba(255,123,84,.85); color: #fff; display: grid; place-items: center; font-size: 9px; border: 1.5px solid rgba(243,233,210,.85); box-shadow: 0 2px 6px rgba(0,0,0,.5); cursor: pointer; padding-left: 1px; transition: transform .15s, background .15s; }
.mk-vid:hover { transform: scale(1.35); background: var(--coral); }
.photos figure.vid::after { content: "▶"; position: absolute; inset: 0; display: grid; place-items: center; font-size: 2.4rem; color: #fff; text-shadow: 0 2px 12px rgba(0,0,0,.8); opacity: .9; pointer-events: none; }
.photos figure.vid .play { position: absolute; top: 8px; left: 8px; background: rgba(255,123,84,.92); color: #fff; font-family: var(--font-mono); font-size: .66rem; padding: .15rem .5rem; border-radius: 999px; z-index: 1; }
#lightbox .stage video { max-width: 100%; max-height: calc(100vh - 170px); border-radius: 8px; box-shadow: var(--shadow); background: #000; }
@media (max-width: 800px) { .vidcard { width: 170px; right: 10px; bottom: 58px; } .vidcard.portrait { width: 110px; } .vidcard.tl { left: 10px; top: 150px; } .vidcard video { max-height: 130px; } .vidcard.portrait video { max-height: 190px; } }

/* night stop card */
.nightstop { position: absolute; inset: 0; z-index: 470; display: grid; place-items: center; background: radial-gradient(ellipse at center, rgba(6,17,29,.35), rgba(6,17,29,.75)); backdrop-filter: blur(3px); animation: fade .4s ease; }
.night-card { position: relative; width: min(92%, 480px); padding: 1.5rem 1.6rem 1.4rem; border-radius: 22px; background: var(--glass-2); border: 1px solid var(--line); border-top: 4px solid var(--c, var(--sun)); box-shadow: var(--shadow); backdrop-filter: blur(16px); animation: popcard .55s cubic-bezier(.2,.9,.2,1.15); text-align: center; }
@keyframes popcard { from { transform: translateY(30px) scale(.9); opacity: 0; } to { transform: none; opacity: 1; } }
.night-card .nk { font-family: var(--font-mono); font-size: .7rem; letter-spacing: .25em; text-transform: uppercase; color: var(--c, var(--sun)); }
.night-card h3 { font-size: 2rem; margin: .3rem 0 .2rem; }
.night-card .where { color: var(--cream-2); font-size: .95rem; display: flex; justify-content: center; align-items: center; gap: .5rem; }
.night-card .where svg { width: 18px; height: 18px; fill: var(--c, var(--sun)); }
.night-card .food { margin: .8rem 0 .2rem; font-family: var(--font-display); font-style: italic; font-weight: 300; font-size: 1.15rem; color: var(--cream); }
.night-card .nstats { display: flex; justify-content: center; flex-wrap: wrap; gap: .4rem .9rem; margin: .7rem 0 .2rem; font-family: var(--font-mono); font-size: .75rem; color: var(--muted); }
.night-card .nstats b { color: var(--cream); font-weight: 600; }
.night-card .nphotos { display: flex; justify-content: center; gap: .5rem; margin: .9rem 0 .2rem; }
.night-card .nphotos img { width: 84px; height: 62px; object-fit: cover; border-radius: 10px; border: 2px solid var(--cream); cursor: zoom-in; transition: transform .2s; box-shadow: 0 6px 16px rgba(0,0,0,.4); }
.night-card .nphotos img:hover { transform: scale(1.08) rotate(-2deg); }
.night-card .btn.go { margin-top: 1rem; font-size: .9rem; padding: .75rem 1.4rem; border-color: var(--c, var(--sun)); color: var(--c, var(--sun)); }
.night-card .btn.go:hover { background: var(--c, var(--sun)); color: var(--ink); }
.night-card .hintk { margin-top: .5rem; font-family: var(--font-mono); font-size: .62rem; color: var(--muted); }
.emoji-fx { position: absolute; inset: 0; pointer-events: none; overflow: visible; }
.emoji-fx span { position: absolute; bottom: 20%; font-size: 30px; opacity: 0; animation: emojifly 2.6s cubic-bezier(.2,.7,.3,1) forwards; filter: drop-shadow(0 4px 8px rgba(0,0,0,.5)); }
@keyframes emojifly { 0% { transform: translateY(0) scale(.5) rotate(0); opacity: 0; } 12% { opacity: 1; } 100% { transform: translateY(-320px) translateX(var(--dx, 0px)) scale(1.4) rotate(var(--rot, 20deg)); opacity: 0; } }
@media (max-width: 800px) { .night-card { padding: 1.1rem 1rem 1rem; } .night-card h3 { font-size: 1.5rem; } .night-card .nphotos img { width: 64px; height: 48px; } }

/* legend */
.legend { position: absolute; left: 14px; top: 14px; z-index: 450; padding: 10px 12px; border-radius: 14px; background: var(--glass); border: 1px solid var(--line); backdrop-filter: blur(12px); font-size: .74rem; display: grid; gap: 4px; }
.legend div { display: flex; align-items: center; gap: 8px; }
.legend i { width: 22px; height: 3px; background: var(--c); border-radius: 2px; }
.legend div:nth-last-child(2) i { background: var(--cream); }
.legend i.dash { background: repeating-linear-gradient(90deg, var(--cream) 0 3px, transparent 3px 8px); }

/* controls */
.controls { margin: 1rem clamp(.6rem, 2vw, 2rem) 0; padding: 1rem 1.2rem; border-radius: 20px; background: var(--glass-2); border: 1px solid var(--line); display: grid; grid-template-columns: auto 1fr; gap: 1rem 1.4rem; align-items: center; }
.controls .play { width: 56px; height: 56px; border-radius: 50%; border: 0; background: linear-gradient(135deg, var(--sun), var(--orange)); color: var(--ink); font-size: 1.4rem; cursor: pointer; display: grid; place-items: center; box-shadow: 0 8px 24px rgba(242,140,40,.35); transition: transform .15s; }
.controls .play:hover { transform: scale(1.06); }
.controls .play svg { width: 22px; height: 22px; fill: currentColor; }
.controls .timeline { position: relative; }
.controls input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 34px; background: transparent; margin: 0; cursor: pointer; }
.controls input[type=range]::-webkit-slider-runnable-track { height: 8px; border-radius: 4px; background: var(--trackbg, rgba(243,233,210,.15)); }
.controls input[type=range]::-moz-range-track { height: 8px; border-radius: 4px; background: var(--trackbg, rgba(243,233,210,.15)); }
.controls input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 22px; height: 22px; border-radius: 50%; background: var(--cream); border: 3px solid var(--navy); margin-top: -7px; box-shadow: 0 2px 10px rgba(0,0,0,.5); }
.controls input[type=range]::-moz-range-thumb { width: 16px; height: 16px; border-radius: 50%; background: var(--cream); border: 3px solid var(--navy); }
.controls .ticks { display: flex; justify-content: space-between; font-family: var(--font-mono); font-size: .68rem; color: var(--muted); padding: 0 4px; }
.controls .row2 { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: .6rem 1rem; align-items: center; }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.chip { border: 1px solid var(--line); background: rgba(6,17,29,.5); color: var(--cream); padding: .32rem .75rem; border-radius: 999px; font-size: .78rem; cursor: pointer; font-family: var(--font-mono); display: inline-flex; align-items: center; gap: .45rem; transition: background .15s, border-color .15s; }
.chip i { width: 9px; height: 9px; border-radius: 50%; background: var(--c); }
.chip:hover, .chip.on { background: rgba(243,233,210,.12); border-color: var(--c, var(--cream)); }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.seg button { border: 0; background: transparent; color: var(--muted); padding: .35rem .7rem; font-family: var(--font-mono); font-size: .75rem; cursor: pointer; }
.seg button.on { background: var(--teal); color: var(--ink); font-weight: 700; }
.toggle { display: inline-flex; align-items: center; gap: .5rem; font-size: .8rem; color: var(--cream-2); cursor: pointer; user-select: none; }
.toggle input { accent-color: var(--teal); width: 16px; height: 16px; }
.controls .kbd { margin-left: auto; font-family: var(--font-mono); font-size: .68rem; color: var(--muted); }
.controls kbd { border: 1px solid var(--line); border-radius: 5px; padding: 0 5px; background: rgba(6,17,29,.6); }
@media (max-width: 800px) {
  .hud { left: 10px; right: 10px; top: 10px; width: auto; padding: 8px 12px 10px; font-size: .75rem; display: grid; grid-template-columns: auto 1fr; gap: 0 .9rem; align-items: center; }
  .hud .date { grid-column: 1; font-size: .62rem; }
  .hud .clock { grid-column: 1; font-size: 1.5rem; }
  .hud .daytag { grid-column: 1; justify-self: start; font-size: .62rem; margin-top: .15rem; }
  .hud .inst { grid-column: 2; grid-row: 1 / span 3; grid-template-columns: repeat(2, 1fr); gap: .35rem .5rem; margin-top: 0; }
  .hud .inst div { padding: .3rem .5rem; }
  .hud .inst b { font-size: .95rem; }
  .hud .status { grid-column: 1 / -1; margin-top: .5rem; font-size: .75rem; }
  .hud .dials, .hud .pos { display: none; }
  .cam { max-width: calc(100% - 28px); }
  .cam figure { width: 70px; height: 52px; }
  .legend { display: none; }
  .controls { grid-template-columns: 1fr; }
  .controls .ticks { font-size: .6rem; white-space: nowrap; }
  .controls .ticks span:nth-child(even) { display: none; }
  .controls .kbd { display: none; }
}

/* --------------------------------------------------------------------------
   Chapters
   -------------------------------------------------------------------------- */
.chapters { background: linear-gradient(180deg, var(--navy-2) 0%, var(--navy) 12%, var(--navy) 100%); }
.prolog { display: grid; grid-template-columns: 1fr 1.4fr; gap: 2rem; align-items: start; padding: 2rem 0 4rem; }
.prolog .txt h3 { font-size: 2rem; }
.prolog .txt .when { font-family: var(--font-mono); color: var(--teal); font-size: .8rem; letter-spacing: .2em; text-transform: uppercase; margin-bottom: .6rem; }
.chapter { display: grid; grid-template-columns: 300px 1fr; gap: clamp(1.5rem, 4vw, 4rem); padding: 4rem 0; border-top: 1px solid var(--line); position: relative; }
.chapter .side { position: sticky; top: 90px; align-self: start; }
.chapter .daynum { font-family: var(--font-display); font-size: 6rem; font-weight: 800; line-height: .8; color: var(--c); letter-spacing: -.04em; }
.chapter .daynum small { display: block; font-family: var(--font-mono); font-size: .8rem; letter-spacing: .3em; text-transform: uppercase; color: var(--muted); margin-bottom: .6rem; font-weight: 400; }
.chapter .date { font-family: var(--font-mono); color: var(--teal); margin: 1rem 0 .3rem; font-size: .9rem; }
.chapter h3 { font-size: 2.2rem; margin: 0 0 .4rem; }
.chapter .fromto { color: var(--cream-2); font-size: 1rem; line-height: 1.4; }
.chapter .fromto b { color: var(--cream); }
.chapter .fromto .via { display: block; color: var(--muted); font-size: .88rem; margin-top: .2rem; }
.chapter .kpis { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; margin-top: 1.3rem; }
.chapter .kpi { background: rgba(6,17,29,.5); border: 1px solid var(--line); border-radius: 12px; padding: .55rem .75rem; }
.chapter .kpi b { display: block; font-family: var(--font-mono); font-size: 1.15rem; font-weight: 600; color: var(--cream); }
.chapter .kpi b small { font-size: .6em; color: var(--muted); }
.chapter .kpi span { font-size: .72rem; color: var(--muted); }
.chapter .night { margin-top: 1rem; font-size: .85rem; color: var(--cream-2); display: flex; align-items: center; gap: .5rem; }
.chapter .night svg { width: 18px; height: 18px; fill: var(--c); }
.chapter .side .goto { margin-top: 1rem; display: inline-flex; align-items: center; gap: .4rem; font-size: .8rem; font-family: var(--font-mono); color: var(--c); border: 1px solid var(--c); border-radius: 999px; padding: .35rem .8rem; cursor: pointer; background: transparent; }
.chapter .side .goto:hover { background: var(--c); color: var(--ink); }
.chapter .body .narr p { font-size: 1.1rem; color: var(--cream-2); max-width: 70ch; }
.chapter .body .narr p:first-child::first-letter { font-family: var(--font-display); font-size: 3.4em; float: left; line-height: .8; margin: .08em .12em 0 0; color: var(--c); font-weight: 800; }
.hl { display: flex; flex-wrap: wrap; gap: .5rem; margin: 1.4rem 0; }
.hl span { border: 1px solid var(--line); background: rgba(6,17,29,.45); padding: .35rem .8rem; border-radius: 999px; font-size: .82rem; color: var(--cream-2); }
.hl span::before { content: "✦ "; color: var(--c); }
.wxstrip { display: grid; grid-template-columns: repeat(5, 1fr); gap: .6rem; margin: 1.4rem 0; }
.wxstrip div { background: rgba(6,17,29,.5); border: 1px solid var(--line); border-radius: 12px; padding: .6rem .8rem; display: flex; align-items: center; gap: .6rem; font-size: .85rem; }
.wxstrip svg { width: 26px; height: 26px; flex: none; }
.wxstrip b { display: block; font-family: var(--font-mono); font-size: 1rem; }
.wxstrip small { color: var(--muted); font-size: .7rem; }
.spark { margin: 1.2rem 0; padding: 1rem 1rem .6rem; background: rgba(6,17,29,.5); border: 1px solid var(--line); border-radius: 14px; }
.spark h4 { margin: 0 0 .4rem; font-family: var(--font-mono); font-size: .68rem; letter-spacing: .2em; text-transform: uppercase; color: var(--muted); font-weight: 500; display: flex; justify-content: space-between; }
.spark svg { width: 100%; height: 120px; display: block; overflow: visible; }
.spark .lgd { display: flex; gap: 1rem; font-size: .7rem; color: var(--muted); margin-top: .4rem; font-family: var(--font-mono); }
.spark .lgd i { display: inline-block; width: 14px; height: 8px; border-radius: 2px; vertical-align: middle; margin-right: 4px; }
.evlist { list-style: none; margin: 1.4rem 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: .4rem .9rem; }
.evlist li { display: grid; grid-template-columns: 52px 22px 1fr; align-items: center; gap: .5rem; font-size: .85rem; padding: .3rem 0; border-bottom: 1px dashed var(--line); cursor: pointer; }
.evlist li:hover { color: var(--sun); }
.evlist time { font-family: var(--font-mono); color: var(--teal); font-size: .8rem; }
.evlist svg { width: 18px; height: 18px; fill: var(--cream-2); }
.photos { columns: 3 220px; column-gap: .8rem; margin-top: 1.6rem; }
.photos figure { margin: 0 0 .8rem; break-inside: avoid; border-radius: 12px; overflow: hidden; position: relative; cursor: zoom-in; background: #0a1a2b; border: 1px solid var(--line); }
.photos figure img { width: 100%; height: auto; transition: transform .6s cubic-bezier(.2,.8,.2,1); }
.photos figure:hover img { transform: scale(1.04); }
.photos figcaption { position: absolute; left: 0; right: 0; bottom: 0; padding: 1.6rem .8rem .6rem; font-size: .78rem; background: linear-gradient(transparent, rgba(6,17,29,.9)); opacity: 0; transition: opacity .3s; }
.photos figure:hover figcaption { opacity: 1; }
.photos figcaption time { display: block; font-family: var(--font-mono); font-size: .65rem; color: var(--teal); }
.epilog { padding: 4rem 0 1rem; border-top: 1px solid var(--line); display: grid; grid-template-columns: 1.4fr 1fr; gap: 2rem; align-items: center; }
.epilog figure { margin: 0; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); }
@media (max-width: 900px) {
  .chapter { grid-template-columns: 1fr; }
  .chapter .side { position: static; }
  .chapter .daynum { font-size: 4rem; }
  .prolog, .epilog { grid-template-columns: 1fr; }
  .wxstrip { grid-template-columns: repeat(2, 1fr); }
}

/* --------------------------------------------------------------------------
   Weather / logbook / boat
   -------------------------------------------------------------------------- */
.wx-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: .8rem; }
.wx-card { padding: 1.1rem 1rem; border-radius: var(--radius); background: rgba(6,17,29,.5); border: 1px solid var(--line); border-top: 3px solid var(--c); }
.wx-card .d { font-family: var(--font-mono); font-size: .72rem; color: var(--muted); }
.wx-card .t { font-family: var(--font-display); font-size: 1.15rem; margin: .2rem 0 .6rem; }
.wx-card .arrow { width: 54px; height: 54px; margin: .2rem auto .4rem; }
.wx-card .arrow svg { width: 100%; height: 100%; }
.wx-card .row { display: flex; justify-content: space-between; font-size: .8rem; padding: .22rem 0; border-top: 1px dashed var(--line); }
.wx-card .row b { font-family: var(--font-mono); font-weight: 600; }
.wx-note { margin-top: 1rem; font-size: .8rem; color: var(--muted); max-width: 80ch; }
@media (max-width: 1000px) { .wx-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 560px) { .wx-grid { grid-template-columns: repeat(2, 1fr); } }

.logbook { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--line); background: rgba(6,17,29,.5); }
.logbook table { width: 100%; border-collapse: collapse; font-size: .85rem; min-width: 640px; }
.logbook th, .logbook td { text-align: left; padding: .55rem .9rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
.logbook th { font-family: var(--font-mono); font-size: .68rem; letter-spacing: .2em; text-transform: uppercase; color: var(--teal); font-weight: 600; position: sticky; top: 0; background: var(--navy-2); }
.logbook td.mono { font-family: var(--font-mono); color: var(--muted); font-size: .78rem; }
.logbook tr:hover td { background: rgba(243,233,210,.05); cursor: pointer; }
.logbook .dd { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--c); margin-right: .5rem; vertical-align: middle; }
details.logwrap summary { cursor: pointer; list-style: none; display: inline-flex; align-items: center; gap: .6rem; font-family: var(--font-mono); font-size: .8rem; color: var(--sun); border: 1px solid var(--sun); padding: .5rem 1rem; border-radius: 999px; margin-bottom: 1rem; }
details.logwrap summary::-webkit-details-marker { display: none; }
details.logwrap[open] summary { opacity: .7; }

.boat-grid { display: grid; grid-template-columns: 1.1fr 1fr; gap: 2rem; align-items: start; }
.boat-card { padding: 1.6rem; border-radius: var(--radius); background: rgba(6,17,29,.5); border: 1px solid var(--line); }
.boat-card .name { font-family: var(--font-display); font-size: 2.4rem; font-weight: 800; letter-spacing: .04em; }
.boat-card .model { color: var(--sun); font-family: var(--font-mono); font-size: .85rem; letter-spacing: .15em; text-transform: uppercase; }
.specs { display: grid; grid-template-columns: repeat(3, 1fr); gap: .6rem; margin: 1.2rem 0; }
.specs div { background: rgba(243,233,210,.05); border-radius: 12px; padding: .55rem .75rem; }
.specs b { display: block; font-family: var(--font-mono); font-size: 1rem; font-weight: 600; }
.specs span { font-size: .7rem; color: var(--muted); letter-spacing: .08em; text-transform: uppercase; }
.equip { display: flex; flex-wrap: wrap; gap: .4rem; }
.equip span { font-size: .78rem; border: 1px solid var(--line); border-radius: 999px; padding: .25rem .7rem; color: var(--cream-2); }
.boat-svg { width: 100%; max-width: 520px; margin: 0 auto; display: block; }
.dl { display: flex; flex-wrap: wrap; gap: .7rem; margin-top: 1.2rem; }
.btn { display: inline-flex; align-items: center; gap: .5rem; padding: .6rem 1.1rem; border-radius: 999px; border: 1px solid var(--teal); color: var(--teal); font-family: var(--font-mono); font-size: .8rem; background: transparent; cursor: pointer; transition: background .15s, color .15s; }
.btn:hover { background: var(--teal); color: var(--ink); text-decoration: none; }
.btn.sun { border-color: var(--sun); color: var(--sun); }
.btn.sun:hover { background: var(--sun); color: var(--ink); }
.chart-divider { height: clamp(220px, 32vw, 420px); background: center/cover no-repeat; position: relative; }
.chart-divider::before { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, var(--navy) 0%, rgba(11,28,46,.35) 20%, rgba(11,28,46,.35) 80%, var(--navy) 100%); }
.chart-divider blockquote { position: absolute; inset: 0; display: grid; place-items: center; margin: 0; padding: 1rem; text-align: center; font-family: var(--font-display); font-size: clamp(1.4rem, 3vw, 2.4rem); font-style: italic; font-weight: 300; color: var(--cream); text-shadow: 0 4px 24px rgba(0,0,0,.7); }
.chart-divider blockquote small { display: block; font-family: var(--font-mono); font-style: normal; font-size: .8rem; letter-spacing: .25em; text-transform: uppercase; color: var(--sun); margin-top: .8rem; }
@media (max-width: 900px) { .boat-grid { grid-template-columns: 1fr; } .specs { grid-template-columns: repeat(2, 1fr); } }

/* --------------------------------------------------------------------------
   Mooring game
   -------------------------------------------------------------------------- */
.game-frame { position: relative; border-radius: 22px; overflow: hidden; border: 1px solid var(--line); box-shadow: var(--shadow); background: #0f5c8c; margin-top: 1.5rem; }
#gameCanvas { display: block; width: 100%; aspect-ratio: 960 / 600; height: auto; outline: none; touch-action: none; }
.game-ready { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(6,17,29,.35); }
.gr-ready { text-align: center; padding: 1.4rem 1.8rem; border-radius: 22px; background: var(--glass-2); border: 1px solid var(--line); box-shadow: var(--shadow); animation: popcard .5s cubic-bezier(.2,.9,.2,1.15); }
.gr-ready .btn { font-size: 1.05rem; padding: .9rem 1.6rem; margin-top: .3rem; }
.gr-ready .hintk { margin-top: .7rem; font-family: var(--font-mono); font-size: .65rem; color: var(--muted); }
.game-start, .game-result { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(6,17,29,.72); backdrop-filter: blur(5px); padding: 1rem; overflow: auto; }
.gs-inner { width: min(100%, 760px); }
.gs-inner .nk, .gr-card .nk { font-family: var(--font-mono); font-size: .7rem; letter-spacing: .25em; text-transform: uppercase; color: var(--sun); text-align: center; margin-bottom: .8rem; }
.harbours { display: grid; grid-template-columns: repeat(2, 1fr); gap: .6rem; }
.hb { text-align: left; padding: .8rem 1rem; border-radius: 14px; background: var(--glass-2); border: 1px solid var(--line); color: var(--cream); cursor: pointer; transition: border-color .15s, transform .15s; position: relative; }
.hb:hover { border-color: var(--sun); transform: translateY(-2px); }
.hb b { display: block; font-family: var(--font-display); font-size: 1.15rem; }
.hb span { display: block; font-family: var(--font-mono); font-size: .66rem; color: var(--teal); margin-top: .15rem; }
.hb em { display: block; font-size: .8rem; color: var(--muted); font-style: normal; margin-top: .3rem; }
.hb i { position: absolute; top: .7rem; right: .8rem; font-family: var(--font-mono); font-size: .65rem; color: var(--sun); font-style: normal; }
.gs-help { margin-top: .9rem; font-size: .78rem; color: var(--cream-2); line-height: 1.5; text-align: center; }
.gs-help b { color: var(--sun); }
.gr-card { position: relative; width: min(100%, 460px); padding: 1.4rem 1.5rem; border-radius: 22px; background: var(--glass-2); border: 1px solid var(--line); border-top: 4px solid var(--sun); box-shadow: var(--shadow); text-align: center; animation: popcard .55s cubic-bezier(.2,.9,.2,1.15); }
.gr-card h3 { font-size: 1.7rem; margin: .2rem 0; color: var(--sun); }
.gr-score { font-family: var(--font-mono); font-size: 2.2rem; font-weight: 600; }
.gr-card ul { list-style: none; padding: 0; margin: .8rem 0; font-size: .82rem; color: var(--muted); max-height: 160px; overflow: auto; }
.gr-card li { padding: .15rem 0; border-bottom: 1px dashed var(--line); }
.gr-card li.plus { color: #9bf6b0; } .gr-card li.minus { color: var(--coral); }
.gr-best { font-family: var(--font-mono); font-size: .7rem; color: var(--muted); }
.gr-btns { display: flex; justify-content: center; gap: .6rem; margin-top: 1rem; }
.game-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: .5rem; margin-top: .8rem; }
.game-actions .act { padding: .7rem 1.1rem; border-radius: 999px; border: 1px solid var(--line); background: var(--glass-2); color: var(--cream); font-family: var(--font-body); font-weight: 700; font-size: .9rem; cursor: pointer; transition: transform .1s, border-color .15s, opacity .2s; user-select: none; }
.game-actions .act:disabled { opacity: .35; cursor: default; }
.game-actions .act:not(:disabled):hover { border-color: var(--sun); transform: translateY(-1px); }
.game-actions .act:not(:disabled):active { transform: scale(.96); }
.game-actions .act.big { padding-left: 1.6rem; padding-right: 1.6rem; }
.game-actions .act.pulse:not(:disabled) { border-color: var(--sun); box-shadow: 0 0 0 0 rgba(255,184,76,.6); animation: actpulse 1.4s ease-out infinite; }
@keyframes actpulse { 0% { box-shadow: 0 0 0 0 rgba(255,184,76,.55); } 100% { box-shadow: 0 0 0 14px rgba(255,184,76,0); } }
.game-pad button.wide3 { grid-column: 1 / -1; }
.game-bar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .8rem; margin-top: .9rem; }
.game-tools { display: flex; gap: .5rem; flex-wrap: wrap; margin-left: auto; }
.game-pad { display: none; grid-template-columns: repeat(3, 1fr); gap: .4rem; width: 100%; max-width: 420px; }
.game-pad button { padding: .8rem .4rem; border-radius: 12px; border: 1px solid var(--line); background: var(--glass-2); color: var(--cream); font-family: var(--font-mono); font-size: .75rem; user-select: none; -webkit-user-select: none; touch-action: none; }
.game-pad button.on { background: var(--teal); color: var(--ink); }
.game-pad button.wide { font-weight: 700; }
@media (pointer: coarse) { .game-pad { display: grid; } }
@media (max-width: 700px) { .harbours { grid-template-columns: 1fr; } .gs-help { display: none; } .game-tools { margin-left: 0; } }

footer { padding: 3rem clamp(1.2rem, 5vw, 4rem) 4rem; border-top: 1px solid var(--line); color: var(--muted); font-size: .82rem; text-align: center; }
footer img { width: 64px; margin: 0 auto 1rem; opacity: .9; }
footer p { max-width: 70ch; margin: .3rem auto; }
footer a { color: var(--teal); }

/* --------------------------------------------------------------------------
   Lightbox
   -------------------------------------------------------------------------- */
#lightbox { position: fixed; inset: 0; z-index: 2000; background: rgba(6,17,29,.94); backdrop-filter: blur(10px); display: grid; grid-template-rows: 1fr auto; animation: fade .25s ease; }
@keyframes fade { from { opacity: 0;} to { opacity: 1;} }
#lightbox .stage { position: relative; display: grid; place-items: center; padding: 3.5rem 4.5rem 1rem; min-height: 0; }
#lightbox .stage img { max-width: 100%; max-height: calc(100vh - 170px); object-fit: contain; border-radius: 8px; box-shadow: var(--shadow); animation: zoom .3s cubic-bezier(.2,.8,.2,1); }
@keyframes zoom { from { transform: scale(.96); opacity: 0;} to { transform: none; opacity: 1;} }
#lightbox .cap { padding: .6rem clamp(1rem, 4vw, 3rem) 1.6rem; display: grid; grid-template-columns: 1fr auto; gap: 1rem; align-items: center; }
#lightbox .cap h4 { font-size: 1.3rem; margin: 0 0 .2rem; }
#lightbox .cap .meta { font-family: var(--font-mono); font-size: .75rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: 1rem; }
#lightbox .cap .meta b { color: var(--teal); font-weight: 500; }
#lightbox .nav { position: absolute; top: 50%; transform: translateY(-50%); width: 52px; height: 52px; border-radius: 50%; border: 1px solid var(--line); background: var(--glass); color: var(--cream); font-size: 1.4rem; cursor: pointer; display: grid; place-items: center; }
#lightbox .nav:hover { background: var(--glass-2); border-color: var(--cream); }
#lightbox .prev { left: 1rem; } #lightbox .next { right: 1rem; }
#lightbox .close { position: absolute; top: 1rem; right: 1rem; width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line); background: var(--glass); color: var(--cream); font-size: 1.2rem; cursor: pointer; }
#lightbox .counter { position: absolute; top: 1.3rem; left: 1.4rem; font-family: var(--font-mono); font-size: .75rem; color: var(--muted); }
@media (max-width: 700px) { #lightbox .stage { padding: 3.5rem .6rem .6rem; } #lightbox .nav { width: 40px; height: 40px; } #lightbox .cap { grid-template-columns: 1fr; } }

/* --------------------------------------------------------------------------
   Toast
   -------------------------------------------------------------------------- */
.toast { position: fixed; left: 50%; bottom: 1.5rem; transform: translate(-50%, 20px); z-index: 2100; background: var(--glass-2); border: 1px solid var(--line); padding: .6rem 1rem; border-radius: 999px; font-size: .85rem; opacity: 0; transition: opacity .3s, transform .3s; pointer-events: none; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media print {
  #gate, #top, .controls, .hud, .cam, .legend, #lightbox, .hero .scroll { display: none !important; }
  body { background: #fff; color: #000; }
  .chapter { break-inside: avoid; }
}
