:root{
  color-scheme: light dark;
  --face:#ece6d5; --face-2:#ddd5bf; --ink:#1c1e1d; --ink-2:#555a56; --rule:rgba(28,30,29,.25);
  --glass:rgba(236,230,213,.9); --brass:#b48638; --brass-hi:#e3c47c; --astern:#a8321f;
  --port:#b23a2b; --stbd:#2e7a4d; --amber:#f0b44c; --title:#f2ede1; --focus:#f0b44c;
  box-sizing:border-box;
  padding-top:env(safe-area-inset-top,0px); padding-bottom:env(safe-area-inset-bottom,0px);
}
@media (prefers-color-scheme: dark){
  :root:not([data-theme="light"]){
    --face:#14181a; --face-2:#1e2427; --ink:#ebe5d4; --ink-2:#a3a7a2; --rule:rgba(235,229,212,.2);
    --glass:rgba(16,20,22,.86); color-scheme:dark;
  }
}
:root[data-theme="dark"]{
  --face:#14181a; --face-2:#1e2427; --ink:#ebe5d4; --ink-2:#a3a7a2; --rule:rgba(235,229,212,.2);
  --glass:rgba(16,20,22,.86); color-scheme:dark;
}
*,*::before,*::after{box-sizing:inherit}
[hidden]{display:none !important}
html{height:100%; scroll-padding-top:env(safe-area-inset-top,0px)}
body{
  height:100%; margin:0; overflow:hidden; background:#0b1114; color:var(--ink);
  font-family:"Big Shoulders Text","Arial Narrow","Roboto Condensed",system-ui,sans-serif;
  -webkit-user-select:none; user-select:none; -webkit-tap-highlight-color:transparent;
}
#c{position:fixed; inset:0; width:100%; height:100%; display:block; touch-action:none; outline:none}
button,input{font:inherit; color:inherit}
:focus-visible{outline:2px solid var(--focus); outline-offset:2px}

.hud{transition:opacity .35s ease}
body.clean .hud{opacity:0; pointer-events:none}
body.intro-on .hud{opacity:0; pointer-events:none}

/* readout */
.log{
  position:fixed; top:calc(env(safe-area-inset-top,0px) + 12px); left:calc(env(safe-area-inset-left,0px) + 12px);
  display:flex; gap:18px; padding:8px 14px 7px; background:var(--glass); border-radius:4px 14px 4px 4px;
  -webkit-backdrop-filter:blur(8px); backdrop-filter:blur(8px);
}
.log div{display:flex; flex-direction:column; min-width:44px}
.dgauge{position:fixed; right:14px; top:50%; transform:translateY(-50%); height:min(52vh,340px); aspect-ratio:92/300; pointer-events:none; overflow:visible}
.dgauge svg{width:100%; height:100%; overflow:visible; font-family:inherit}
.dgauge .dgw{stroke:rgba(190,230,224,.55); stroke-width:2}.dgauge .dgs,.dgauge .dgb{stroke:rgba(225,240,236,.8); stroke-width:2}
.dgauge .dgt line{stroke:rgba(190,230,224,.5); stroke-width:1.2}.dgauge .dgt text,.dgauge .dgl{fill:rgba(225,240,236,.75); font-size:10px}
.dgauge .dgv{fill:#f2ede1; font-size:12px; font-weight:600}.dgauge .dgk{fill:#e0573f}.dgauge .dgc{fill:#f0b44c}.dgauge .dgy{fill:#f0b44c; font-size:11px; font-weight:600}
.log b{font-family:"Big Shoulders Display","Arial Narrow",sans-serif; font-weight:800; font-size:28px; line-height:1; font-variant-numeric:tabular-nums; letter-spacing:.01em}
.log small{font-size:13px; color:var(--ink-2); margin-top:2px}
.log b sup{font-size:.55em; vertical-align:.5em; margin-left:1px}

/* tools */
.tools{position:fixed; top:calc(env(safe-area-inset-top,0px) + 12px); right:calc(env(safe-area-inset-right,0px) + 12px); display:flex; gap:6px}
.tbtn{
  height:44px; min-width:44px; padding:0 12px; border:0; border-radius:4px; background:var(--glass); cursor:pointer;
  display:inline-flex; align-items:center; gap:7px; font-weight:700; font-size:16px;
  -webkit-backdrop-filter:blur(8px); backdrop-filter:blur(8px);
}
.tbtn svg{width:20px; height:20px; fill:none; stroke:currentColor; stroke-width:1.8; stroke-linecap:round; stroke-linejoin:round}
.tbtn[aria-pressed="true"]{box-shadow:inset 0 -3px 0 var(--brass)}
#camBtn{min-width:128px; justify-content:flex-start}

/* notice */
.notice{
  position:fixed; top:calc(env(safe-area-inset-top,0px) + 74px); left:50%; transform:translateX(-50%);
  padding:7px 14px; border-radius:4px; background:rgba(12,16,18,.78); color:#f4ead2; font-weight:700; font-size:17px;
  white-space:nowrap; opacity:0; transition:opacity .4s ease; pointer-events:none; max-width:calc(100vw - 24px); overflow:hidden; text-overflow:ellipsis;
}
.notice.on{opacity:1}
.notice.warn{color:#ffd28a}

/* helm controls */
.helm{
  position:fixed; bottom:calc(env(safe-area-inset-bottom,0px) + 12px); display:flex; flex-direction:column; align-items:center;
  padding:8px 8px 6px; background:var(--glass); border-radius:110px 110px 6px 6px;
  -webkit-backdrop-filter:blur(8px); backdrop-filter:blur(8px);
}
#teleBox{left:calc(env(safe-area-inset-left,0px) + 12px)}
#rudBox{right:calc(env(safe-area-inset-right,0px) + 12px)}
.helm svg{width:210px; height:auto; display:block; touch-action:none; cursor:pointer}
.helm .cap{font-size:15px; font-weight:700; margin-top:1px; font-variant-numeric:tabular-nums}
.helm .cap span{color:var(--ink-2); font-weight:600}

/* panel */
.panel{
  position:fixed; top:calc(env(safe-area-inset-top,0px) + 64px); right:calc(env(safe-area-inset-right,0px) + 12px);
  width:min(300px, calc(100vw - 24px)); max-height:calc(100% - 300px); min-height:160px; overflow:auto;
  padding:14px 16px 16px; background:var(--glass); border-radius:4px; display:none;
  -webkit-backdrop-filter:blur(10px); backdrop-filter:blur(10px);
}
.panel.open{display:block}
.row{margin-bottom:14px}
.row .lab{display:flex; justify-content:space-between; font-weight:700; font-size:16px; margin-bottom:4px}
.row .lab span{color:var(--ink-2); font-weight:600; font-variant-numeric:tabular-nums}
input[type=range]{width:100%; accent-color:var(--brass); height:28px}
.seg{display:grid; grid-template-columns:repeat(3,1fr); border:1px solid var(--rule); border-radius:4px; overflow:hidden}
.seg button{border:0; background:transparent; padding:8px 0; font-weight:700; font-size:15px; cursor:pointer}
.seg button+button{border-left:1px solid var(--rule)}
.seg button[aria-pressed="true"]{background:var(--ink); color:var(--face)}
.tog{display:flex; align-items:center; justify-content:space-between; padding:7px 0; font-weight:700; font-size:16px; cursor:pointer; border-top:1px solid var(--rule)}
.tog input{width:20px; height:20px; accent-color:var(--brass)}
.big{
  width:100%; margin:12px 0 4px; padding:12px; border:0; border-radius:4px; cursor:pointer;
  background:var(--ink); color:var(--face); font-weight:800; font-size:18px; font-family:"Big Shoulders Display","Arial Narrow",sans-serif; letter-spacing:.01em;
}
.big:disabled{opacity:.45; cursor:default}
.keys{font-size:14px; line-height:1.45; color:var(--ink-2); margin-top:10px}
.keys kbd{font:inherit; font-weight:700; color:var(--ink)}

/* letterbox */
.lb{position:fixed; left:0; right:0; height:var(--lb,0px); background:#000; pointer-events:none; z-index:2; transition:height .5s ease}
.lb.t{top:0} .lb.b{bottom:0}

/* intro */
.intro{
  position:fixed; inset:0; z-index:5; display:flex; flex-direction:column; justify-content:flex-end;
  padding:clamp(22px,6vw,72px); padding-bottom:calc(env(safe-area-inset-bottom,0px) + clamp(28px,6vw,72px));
  color:var(--title); background:linear-gradient(to top, rgba(5,9,11,.9) 0%, rgba(5,9,11,.55) 38%, rgba(5,9,11,0) 72%);
  transition:opacity .9s ease;
}
.intro.gone{opacity:0; pointer-events:none}
.intro h1{
  margin:0; font-family:"Big Shoulders Display","Arial Narrow",sans-serif; font-weight:800;
  font-size:clamp(48px,12.5vw,184px); line-height:.84; letter-spacing:-.005em; text-transform:uppercase;
}
.intro .where{font-size:clamp(18px,2.2vw,24px); font-weight:600; margin:14px 0 0}
.intro p{max-width:34em; font-size:18px; line-height:1.45; margin:10px 0 0; color:rgba(242,237,225,.82); font-weight:500}
.intro blockquote{margin:18px 0 0; font-size:19px; line-height:1.35; color:rgba(242,237,225,.92)}
.intro blockquote cite{display:block; font-style:normal; font-size:15px; color:rgba(242,237,225,.62); margin-top:3px}
.intro .go{
  align-self:flex-start; margin-top:24px; padding:14px 26px; border:0; border-radius:3px; cursor:pointer;
  background:var(--title); color:#121614; font-family:"Big Shoulders Display","Arial Narrow",sans-serif; font-weight:800; font-size:22px;
}
.intro .hint{font-size:15px; color:rgba(242,237,225,.6); margin-top:12px}
#fail{position:fixed; inset:0; display:grid; place-items:center; padding:24px; color:#f2ede1; font-size:20px; text-align:center; z-index:9}

@media (max-width:620px){
  .log{gap:12px; padding:6px 10px}
  .log b{font-size:23px}
  .log small{font-size:12px}
  .log .wind{display:none}
  .log .depth{display:none}
  .dgauge{right:6px; height:min(46vh,300px)}
  .helm svg{width:min(42vw,176px)}
  .helm .cap{font-size:14px}
  #camBtn{min-width:44px}
  #camBtn .nm{display:none}
  .notice{top:calc(env(safe-area-inset-top,0px) + 64px); font-size:15px}
}
@media (max-width:380px){ .log .seas{display:none} }
@media (prefers-reduced-motion: reduce){ .hud,.intro,.lb,.notice{transition:none} }
:root{ --water:#d8e1df; --land:#e7dfc8; --coast:#7d8c89; --track:#1c1e1d; --fitz:#a8321f; --anderson:#3d5f52; --mine:#c88a1e; }
@media (prefers-color-scheme: dark){ :root:not([data-theme="light"]){ --water:#13222a; --land:#1c2220; --coast:#4f6266; --track:#ebe5d4; --fitz:#e0573f; --anderson:#7fb39d; --mine:#f0b44c; } }
:root[data-theme="dark"]{ --water:#13222a; --land:#1c2220; --coast:#4f6266; --track:#ebe5d4; --fitz:#e0573f; --anderson:#7fb39d; --mine:#f0b44c; }

/* voyage bar */
.voy{
  position:fixed; z-index:6; left:50%; transform:translateX(-50%); bottom:calc(env(safe-area-inset-bottom,0px) + 12px);
  display:flex; align-items:center; gap:8px; padding:6px 8px; background:var(--glass); border-radius:4px;
  -webkit-backdrop-filter:blur(8px); backdrop-filter:blur(8px);
}
.voy .clock{display:flex; flex-direction:column; line-height:1; min-width:92px; padding:0 4px}
.voy .clock small{font-size:13px; color:var(--ink-2); font-weight:600; white-space:nowrap}
.voy .clock b{font-family:"Big Shoulders Display","Arial Narrow",sans-serif; font-weight:800; font-size:25px; font-variant-numeric:tabular-nums; margin-top:3px; white-space:nowrap}
.warp{display:flex; border:1px solid var(--rule); border-radius:4px; overflow:hidden}
.warp button{border:0; background:transparent; height:36px; padding:0 9px; font-weight:700; font-size:15px; cursor:pointer; font-variant-numeric:tabular-nums}
.warp button+button{border-left:1px solid var(--rule)}
.warp button[aria-pressed="true"]{background:var(--ink); color:var(--face)}
#warpSel{display:none; height:36px; border:1px solid var(--rule); border-radius:4px; background:transparent; font-weight:700; font-size:16px; padding:0 6px}
.ibtn{height:36px; min-width:36px; border:0; background:transparent; border-radius:4px; display:inline-flex; align-items:center; justify-content:center; gap:6px; padding:0 8px; font-weight:700; font-size:16px; cursor:pointer; white-space:nowrap}
.ibtn svg{width:20px; height:20px; fill:none; stroke:currentColor; stroke-width:1.9; stroke-linecap:round; stroke-linejoin:round}
.ibtn.fill svg{fill:currentColor; stroke:none}
#rejoin{background:var(--amber); color:#1c1e1d}
body.map-on .helm, body.map-on .mini, body.map-on .log, body.map-on .tools, body.map-on .notice{display:none}
@media (max-width:1099px){
  .voy{left:calc(env(safe-area-inset-left,0px) + 12px); right:calc(env(safe-area-inset-right,0px) + 12px); transform:none; justify-content:space-between;
       bottom:calc(env(safe-area-inset-bottom,0px) + 20px + var(--helmH,150px))}
  body.map-on .voy{bottom:calc(env(safe-area-inset-bottom,0px) + 12px)}
}
@media (max-width:760px){ .seg2 button{padding:0 9px; font-size:14px} .windcard{font-size:14px; padding:4px 8px 4px 4px} .legend{bottom:calc(env(safe-area-inset-bottom,0px) + 64px); font-size:13px} .legend p{display:none} .warp{display:none} #warpSel{display:block} #mapBtn span{display:none} .voy .clock b{font-size:22px} }

/* minimap */
.mini{position:fixed; top:calc(env(safe-area-inset-top,0px) + 82px); left:calc(env(safe-area-inset-left,0px) + 12px); width:250px; height:168px; border-radius:4px; overflow:hidden; cursor:pointer; background:var(--land); box-shadow:0 0 0 1px var(--rule)}
.mini svg{width:100%; height:100%; display:block; touch-action:none; cursor:grab}
.mini svg.dragging,.mapview svg.dragging{cursor:grabbing}
.mapview svg{cursor:grab}
.minire{position:absolute; right:6px; bottom:6px; height:26px; padding:0 10px; border-radius:13px; border:0; background:rgba(18,24,26,.86); color:#f2ede1; font:600 12px/26px inherit; cursor:pointer; box-shadow:0 0 0 1px var(--rule)}
.zbtns button{min-width:40px; font-size:20px; line-height:1}
@media (max-width:999px), (max-height:640px){ .mini{display:none} }

/* full map */
.mapview{position:fixed; inset:0; z-index:5; background:var(--land)}
.mapview svg{position:absolute; inset:0; width:100%; height:100%; display:block; touch-action:none}
.mapbar{position:absolute; top:calc(env(safe-area-inset-top,0px) + 12px); left:calc(env(safe-area-inset-left,0px) + 12px); right:calc(env(safe-area-inset-right,0px) + 12px); display:flex; justify-content:space-between; align-items:flex-start; gap:8px; pointer-events:none}
.mapbar > *{pointer-events:auto}
.windcard{display:flex; align-items:center; gap:8px; padding:6px 12px 6px 8px; white-space:nowrap; background:var(--glass); border-radius:4px; font-weight:700; font-size:16px}
.windcard svg{width:28px; height:28px}
.windcard path{fill:var(--ink)}
.mapctl{display:flex; gap:6px}
.seg2{display:flex; background:var(--glass); border-radius:4px; overflow:hidden}
.seg2 button{border:0; background:transparent; height:44px; padding:0 12px; white-space:nowrap; font-weight:700; font-size:15px; cursor:pointer}
.seg2 button[aria-pressed="true"]{background:var(--ink); color:var(--face)}
.legend{position:absolute; left:calc(env(safe-area-inset-left,0px) + 12px); bottom:calc(env(safe-area-inset-bottom,0px) + 70px); display:flex; flex-wrap:wrap; gap:4px 14px; max-width:min(560px, calc(100vw - 24px)); padding:8px 12px; background:var(--glass); border-radius:4px; font-size:14px; font-weight:600; color:var(--ink-2)}
.legend i{display:inline-block; width:22px; height:0; border-top:3px solid; vertical-align:middle; margin-right:6px}
.legend .lf{border-color:var(--fitz)} .legend .lr{border-color:var(--track); border-top-style:dashed; opacity:.7} .legend .la{border-color:var(--anderson); border-top-style:dotted} .legend .lm{border-color:var(--mine)}
.legend p{flex-basis:100%; margin:2px 0 0; font-weight:500; font-size:13px}
.maptxt{font-family:"Big Shoulders Text","Arial Narrow",sans-serif; font-weight:700; fill:var(--ink-2); paint-order:stroke; stroke:var(--land); stroke-width:3px; stroke-linejoin:round}
.maptxt.w{stroke:var(--water)} .maptxt.big{fill:var(--ink); font-size:15px}
.mom{cursor:pointer}
.mom circle{fill:var(--water); stroke:var(--track); stroke-width:1.5}
.mom:hover circle,.mom:focus circle{fill:var(--amber)}

/* moments list */
.moments{display:flex; flex-direction:column; margin-top:6px}
.moments h3{font-size:14px; font-weight:700; color:var(--ink-2); margin:10px 0 2px}
.moments button{display:grid; grid-template-columns:62px 1fr; gap:8px; text-align:left; border:0; background:transparent; padding:7px 4px; border-top:1px solid var(--rule); cursor:pointer; font-size:15px; line-height:1.3; font-weight:500}
.moments button b{font-weight:700; font-variant-numeric:tabular-nums}
.moments button.now{background:var(--face-2)}
.note{font-size:13px; color:var(--ink-2); margin:2px 0 6px; line-height:1.35}
.tog input:disabled{opacity:.4}

/* end card */
.endcard{position:fixed; inset:0; z-index:8; display:grid; place-items:center; padding:24px; background:rgba(4,8,10,.78); color:var(--title)}
.endcard > div{max-width:30em}
.endcard .when{font-family:"Big Shoulders Display","Arial Narrow",sans-serif; font-weight:800; font-size:clamp(34px,6vw,56px); line-height:1}
.endcard p{font-size:19px; line-height:1.5; color:rgba(242,237,225,.88); margin:14px 0 0}
.endcard .coords{font-size:15px; color:rgba(242,237,225,.6)}
.endcard .btns{display:flex; gap:10px; margin-top:24px; flex-wrap:wrap}
.endcard button{padding:12px 20px; border:0; border-radius:3px; cursor:pointer; font-family:"Big Shoulders Display","Arial Narrow",sans-serif; font-weight:800; font-size:19px}
.endcard .b1{background:var(--title); color:#121614} .endcard .b2{background:transparent; color:var(--title); box-shadow:inset 0 0 0 1.5px rgba(242,237,225,.6)}
.intro .go2{background:transparent; color:var(--title); box-shadow:inset 0 0 0 1.5px rgba(242,237,225,.6); margin-left:10px}
.notice{white-space:normal; text-align:center; line-height:1.3}
