/* TP-assistant — same look as Watchkeeper: five tones (Day, Ocean, Dusk, Night, Neon). The chart stays dark navy; notices and routes are drawn in bright colours. */
/* Watchkeeper Deep: the same five tones as the app (values copied from Watchkeeper index.html) */
html[data-wk-tone=day]{color-scheme:light;--wk-ocean:linear-gradient(180deg,#C4F2F5 0%,#86D6E2 50%,#4FB0C6 100%);--wk-glass:rgba(255,255,255,.58);--wk-glass2:rgba(255,255,255,.42);--wk-solid:#E9F8FA;--wk-line:rgba(4,34,47,.16);--wk-ink:#04222F;--wk-muted:#2F5F70;--wk-accent:#0A7A83;--wk-accent2:#075E65;--wk-btn:#0A7A83;--wk-brass:#9A6E14;--wk-brass-soft:#F0D58E;--wk-red:#B3261E;--wk-green:#1D7A4C;--wk-amber:#8A5A00;--wk-header:rgba(235,250,252,.72)}
html[data-wk-tone=ocean]{color-scheme:dark;--wk-ocean:linear-gradient(180deg,#1D6FA6 0%,#0D4A85 50%,#05214A 100%);--wk-glass:rgba(8,40,82,.55);--wk-glass2:rgba(255,255,255,.08);--wk-solid:#0B3366;--wk-line:rgba(234,245,255,.16);--wk-ink:#EAF5FF;--wk-muted:#A8C8E4;--wk-accent:#FFC15E;--wk-accent2:#FFD58A;--wk-btn:#1F6FBF;--wk-brass:#FFC15E;--wk-brass-soft:#FFD58A;--wk-red:#FF8A7A;--wk-green:#7DD8A6;--wk-amber:#FFC15E;--wk-header:rgba(6,34,70,.72)}
html[data-wk-tone=dusk]{color-scheme:dark;--wk-ocean:linear-gradient(180deg,#5B4E8C 0%,#2D5A82 55%,#0E2340 100%);--wk-glass:rgba(30,40,80,.50);--wk-glass2:rgba(255,255,255,.08);--wk-solid:#2A3566;--wk-line:rgba(243,238,248,.16);--wk-ink:#F3EEF8;--wk-muted:#C3B8DA;--wk-accent:#FF9A6B;--wk-accent2:#FFC2A3;--wk-btn:#C2603A;--wk-brass:#FFC98A;--wk-brass-soft:#FFD9A8;--wk-red:#FF8A7A;--wk-green:#8EE0B4;--wk-amber:#FFC98A;--wk-header:rgba(36,40,84,.72)}
html[data-wk-tone=night]{color-scheme:dark;--wk-ocean:linear-gradient(180deg,#03141F 0%,#021019 55%,#000508 100%);--wk-glass:rgba(4,24,30,.62);--wk-glass2:rgba(79,242,227,.05);--wk-solid:#04161D;--wk-line:rgba(79,242,227,.12);--wk-ink:#8FE9DF;--wk-muted:#5E9E98;--wk-accent:#2FC9BC;--wk-accent2:#7FE9DE;--wk-btn:#138A80;--wk-brass:#C9A45A;--wk-brass-soft:#D9B866;--wk-red:#E8705F;--wk-green:#5DBF8C;--wk-amber:#D9AE4B;--wk-header:rgba(1,12,16,.78)}
html[data-wk-tone=neon]{color-scheme:dark;--wk-ocean:linear-gradient(180deg,#24092C 0%,#14051A 55%,#050106 100%);--wk-glass:rgba(30,6,34,.58);--wk-glass2:rgba(255,120,220,.07);--wk-solid:#1E0824;--wk-line:rgba(255,120,220,.18);--wk-ink:#F7EFFF;--wk-muted:#B994C8;--wk-accent:#FF4FB8;--wk-accent2:#FF9BD8;--wk-btn:#C8338E;--wk-brass:#FFB24A;--wk-brass-soft:#FFC77A;--wk-red:#FF6B7A;--wk-green:#6EE0B0;--wk-amber:#FFB24A;--wk-header:rgba(26,6,30,.78)}
html { --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --deep: var(--wk-solid); --glass: var(--wk-glass); --glass2: var(--wk-glass2); --line: var(--wk-line);
  --ink: var(--wk-ink); --dim: var(--wk-muted); --acc: var(--wk-accent); --btn: var(--wk-btn); --bad: var(--wk-red); --ok: var(--wk-green);
  /* chart colours, the same in every tone */
  --on: #FFD60A; --on2: #FF9F1C; --off: #8A9BB5; --rt1: #00E5FF; }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; overscroll-behavior: none; }
body { font: 15px/1.4 var(--font); color: var(--ink); -webkit-font-smoothing: antialiased; background: var(--wk-ocean); background-attachment: fixed; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; }
.hide { display: none !important; }
.app { position: fixed; inset: 0; display: flex; flex-direction: column; }

/* ---------- top bar ---------- */
.bar { flex: none; display: flex; align-items: center; gap: 12px; padding: 8px 12px; padding-top: max(8px, env(safe-area-inset-top));
  background: var(--glass); border-bottom: 1px solid var(--line); -webkit-backdrop-filter: blur(10px) saturate(1.8); backdrop-filter: blur(10px) saturate(1.8); z-index: 600; }
.brand { display: flex; align-items: center; gap: 8px; min-width: 0; }
.brand svg { width: 26px; height: 26px; flex: none; }
.brand h1 { margin: 0; font-size: 17px; font-weight: 750; white-space: nowrap; }
.steps { display: flex; gap: 6px; margin-left: auto; }
.steps button { display: flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--glass2); color: var(--dim);
  padding: 5px 11px 5px 6px; border-radius: 99px; cursor: pointer; font-size: 13px; font-weight: 650; white-space: nowrap; }
.steps button b { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-size: 11.5px; background: var(--line); color: var(--ink); }
.steps button[aria-current=step] { color: var(--ink); border-color: var(--acc); }
.steps button[aria-current=step] b { background: var(--btn); color: #fff; }
.steps button.done b { background: var(--ok); color: #fff; }
.steps button:disabled { opacity: .45; cursor: default; }
.tone { display: inline-flex; align-items: center; gap: 6px; padding: 6px 11px; border-radius: 99px; border: 1px solid var(--line); background: var(--glass2); cursor: pointer; font-size: 12px; font-weight: 700; }
.tone svg { width: 16px; height: 16px; transition: transform .6s cubic-bezier(.34,1.56,.64,1); }
.tone.spin svg { transform: rotate(360deg); }
@media (max-width: 760px) { .steps button span { display: none; } .steps button { padding: 5px; } .tone span { display: none; } .brand h1 { font-size: 16px; } }

/* ---------- chart ---------- */
.map-wrap { position: relative; flex: 1; min-height: 0; }
#map { position: absolute; inset: 0; background: #0B1A2E; }
.leaflet-container { font: 13px/1.35 var(--font); }
.legend { position: absolute; left: 466px; top: 10px; z-index: 450; display: flex; flex-wrap: wrap; gap: 6px; max-width: calc(100% - 80px); pointer-events: none; }
.legend span { display: inline-flex; align-items: center; gap: 6px; padding: 4px 9px; border-radius: 99px; background: rgba(6,16,30,.78); color: #E8F1FF;
  border: 1px solid rgba(255,255,255,.14); font-size: 12px; font-weight: 650; }
.legend i { width: 14px; height: 4px; border-radius: 2px; display: inline-block; }
.legend i.dot { width: 10px; height: 10px; border-radius: 50%; }
.tp-glow { filter: drop-shadow(0 0 4px rgba(255,214,10,.9)) drop-shadow(0 0 10px rgba(255,159,28,.55)); }
.rt-glow { filter: drop-shadow(0 0 3px rgba(0,229,255,.75)); }
.leaflet-popup-content-wrapper { border-radius: 12px; background: #0E2036; color: #EAF3FF; box-shadow: 0 10px 30px rgba(0,0,0,.45); }
.leaflet-popup-tip { background: #0E2036; }
.leaflet-popup-content { margin: 11px 13px; font-size: 13px; }
.pop b { font-size: 14px; color: #FFD60A; }
.pop .muted { color: #9DB2CC; }
.leaflet-container a.leaflet-popup-close-button { color: #9DB2CC; }

/* ---------- the step window ---------- */
.panel { position: absolute; z-index: 1100; left: 12px; top: 12px; bottom: 12px; width: min(440px, calc(100% - 24px)); display: flex; flex-direction: column;
  background: var(--glass); border: 1px solid var(--line); border-radius: 20px; overflow: hidden;
  -webkit-backdrop-filter: blur(16px) saturate(1.8); backdrop-filter: blur(16px) saturate(1.8); box-shadow: 0 18px 50px -12px rgba(0,0,0,.55);
  transition: transform .38s cubic-bezier(.2,.9,.25,1), opacity .3s; }
.panel.leave { transform: translateX(-24px); opacity: 0; }
.panel.enter { animation: pIn .38s cubic-bezier(.2,.9,.25,1); }
@keyframes pIn { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }
.panel.small { bottom: auto; }
.p-head { flex: none; padding: 16px 18px 8px; }
.p-head .kick { font-size: 11.5px; font-weight: 800; letter-spacing: .14em; color: var(--acc); text-transform: uppercase; }
.p-head h2 { margin: 4px 0 4px; font-size: 20px; line-height: 1.2; }
.p-head p { margin: 0; color: var(--dim); font-size: 13.5px; }
.p-body { flex: 1; min-height: 0; overflow: auto; padding: 6px 18px 12px; -webkit-overflow-scrolling: touch; }
.p-foot { flex: none; display: flex; gap: 10px; padding: 12px 18px; padding-bottom: max(12px, env(safe-area-inset-bottom)); border-top: 1px solid var(--line); }
.p-foot .grow { flex: 1; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 13px; padding: 12px 18px; cursor: pointer; font-weight: 750; font-size: 15px;
  background: var(--btn); color: #fff; box-shadow: inset 0 1px 0 rgba(255,255,255,.3), 0 6px 18px -8px rgba(0,0,0,.5); }
.btn:disabled { opacity: .45; cursor: default; }
.btn.ghost { background: var(--glass2); color: var(--ink); border: 1px solid var(--line); box-shadow: none; }
.btn.small { padding: 8px 12px; font-size: 13.5px; border-radius: 11px; }
.btn:active:not(:disabled) { transform: scale(.98); }
@media (max-width: 760px) {
  .panel { left: 8px; right: 8px; width: auto; top: auto; bottom: 8px; max-height: 64%; border-radius: 22px; }
  .panel.tall { max-height: 74%; }
  .panel.leave { transform: translateY(30px); }
  @keyframes pIn { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
  .legend { top: 8px; left: 8px; }
  .stat b { font-size: 17px; } .stat div { padding: 6px; } .p-head h2 { font-size: 18px; } .p-head { padding: 12px 16px 6px; }
}

/* drop zone */
.drop { display: block; border: 2px dashed var(--line); border-radius: 16px; padding: 18px 14px; text-align: center; cursor: pointer; background: var(--glass2); transition: border-color .2s, background .2s; }
.drop.over { border-color: var(--acc); background: rgba(127,233,222,.08); }
.drop svg { width: 34px; height: 34px; color: var(--acc); }
.drop b { display: block; margin-top: 4px; font-size: 15px; }
.drop small { display: block; color: var(--dim); margin-top: 2px; }
textarea { width: 100%; min-height: 96px; margin-top: 10px; border-radius: 12px; border: 1px solid var(--line); background: var(--glass2); padding: 10px; font-size: 13px; resize: vertical; }
.chips { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.chip { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 12px; background: var(--glass2); border: 1px solid var(--line); font-size: 13.5px; }
.chip .sw { width: 14px; height: 14px; border-radius: 4px; flex: none; box-shadow: 0 0 8px currentColor; }
.chip .t { flex: 1; min-width: 0; }
.chip .t b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip .t small { color: var(--dim); }
.chip .x { border: 0; background: none; cursor: pointer; color: var(--dim); font-size: 16px; padding: 2px 6px; }
.note { margin-top: 10px; font-size: 13px; color: var(--dim); }
.note.bad { color: var(--bad); }
.note.good { color: var(--ok); }
.stat { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 6px 0 12px; }
.stat div { padding: 9px 8px; border-radius: 12px; background: var(--glass2); border: 1px solid var(--line); text-align: center; }
.stat b { display: block; font-size: 20px; }
.stat small { color: var(--dim); font-size: 11.5px; }

/* range */
.range { padding: 12px; border-radius: 14px; background: var(--glass2); border: 1px solid var(--line); margin-bottom: 12px; }
.range .row { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.range .row b { font-size: 22px; color: var(--acc); }
.range input[type=range] { width: 100%; margin: 10px 0 2px; accent-color: var(--btn); }
.range label.all { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--dim); cursor: pointer; }
.field { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.field label { font-size: 13px; color: var(--dim); }
.field select { flex: 1; padding: 9px 10px; border-radius: 11px; border: 1px solid var(--line); background: var(--glass2); }
.list { display: flex; flex-direction: column; gap: 6px; }
.nt { display: flex; gap: 10px; align-items: flex-start; padding: 9px 10px; border-radius: 12px; border: 1px solid var(--line); background: var(--glass2); cursor: pointer; transition: opacity .25s; }
.nt .dot { width: 12px; height: 12px; border-radius: 50%; margin-top: 4px; flex: none; background: var(--on); box-shadow: 0 0 10px var(--on); }
.nt.out { opacity: .5; }
.nt.out .dot { background: var(--off); box-shadow: none; }
.nt .t { flex: 1; min-width: 0; font-size: 13px; }
.nt .t b { font-size: 13.5px; }
.nt .t small { display: block; color: var(--dim); }
.nt .d { font-size: 12px; color: var(--dim); white-space: nowrap; }
.sec { margin: 14px 0 6px; font-size: 11.5px; font-weight: 800; letter-spacing: .12em; color: var(--dim); text-transform: uppercase; }
.linkbtn { border: 0; background: none; color: var(--acc); cursor: pointer; padding: 0; font-weight: 700; font-size: 13px; }
.files { margin-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.files a { display: flex; justify-content: space-between; gap: 10px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--glass2); color: var(--ink); text-decoration: none; font-size: 13.5px; }
.files a b { color: var(--acc); }

/* dialogs */
.dlg { position: fixed; inset: 0; z-index: 1300; display: flex; align-items: center; justify-content: center; padding: 18px; background: rgba(0,6,12,.55);
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); opacity: 0; pointer-events: none; transition: opacity .2s; }
.dlg.on { opacity: 1; pointer-events: auto; }
.dlg .box { width: min(480px, 100%); max-height: 90vh; overflow: auto; background: var(--deep); border: 1px solid var(--line); border-radius: 20px; padding: 20px; box-shadow: 0 24px 60px rgba(0,0,0,.5);
  transform: translateY(12px) scale(.98); transition: transform .25s; }
.dlg.on .box { transform: none; }
.dlg h3 { margin: 0 0 8px; font-size: 19px; }
.dlg p { margin: 0 0 10px; color: var(--dim); font-size: 14px; }
.dlg .btns { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.teach .row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.teach input { width: 70px; padding: 8px; border-radius: 10px; border: 1px solid var(--line); background: var(--glass2); text-align: center; }
table.aio { width: 100%; border-collapse: collapse; font-size: 12.5px; }
table.aio td, table.aio th { padding: 5px 6px; border-bottom: 1px solid var(--line); text-align: left; }
.foot-c { position: absolute; right: 10px; bottom: 6px; z-index: 450; font-size: 11px; color: rgba(220,232,250,.7); pointer-events: none; }
@media (max-width: 760px) { .foot-c { display: none; } }
@media (prefers-reduced-motion: reduce) { .panel, .panel.enter, .dlg, .dlg .box { animation: none; transition: none; } }

/* keep / leave out by hand */
.tick { position: relative; flex: none; width: 22px; height: 22px; margin-top: 1px; cursor: pointer; }
.tick input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; z-index: 1; }
.tick i { position: absolute; inset: 0; border-radius: 7px; border: 2px solid var(--off); background: transparent; transition: background .15s, border-color .15s; }
.tick input:checked + i { background: var(--on); border-color: var(--on); box-shadow: 0 0 10px rgba(255,214,10,.6); }
.tick input:checked + i::after { content: ""; position: absolute; left: 6px; top: 2px; width: 6px; height: 11px; border: solid #1A1300; border-width: 0 2.5px 2.5px 0; transform: rotate(45deg); }
.tick input:focus-visible + i { outline: 2px solid var(--acc); outline-offset: 2px; }
.nt .hand { font-style: normal; font-size: 11px; font-weight: 700; color: var(--acc); }
.pop-btn { margin-top: 8px; width: 100%; padding: 7px 10px; border-radius: 9px; border: 1px solid rgba(255,214,10,.6); background: rgba(255,214,10,.12); color: #FFE680; font: 700 12.5px var(--font); cursor: pointer; }

/* phone: the window folds down so the chart can be seen */
.fold { display: none; }
@media (max-width: 760px) {
  .panel { max-height: 50%; transition: max-height .32s cubic-bezier(.2,.9,.25,1), transform .38s, opacity .3s; }
  .panel.tall { max-height: 58%; }
  .fold { display: block; width: 100%; height: 18px; margin: -6px 0 4px; border: 0; background: none; cursor: pointer; padding: 0; }
  .fold span { display: block; width: 42px; height: 5px; border-radius: 3px; margin: 0 auto; background: var(--dim); opacity: .7; }
  .panel.min { max-height: 128px; }
  .panel.min .p-body, .panel.min .p-head p { display: none; }
  .panel.min .p-head h2 { font-size: 16px; }
  .p-head p { font-size: 12.5px; }
}

/* ---------- inside Watchkeeper ---------- */
html.in-hub, html.in-hub body { background: transparent; }
html.in-hub .tone { display: none; }
.copy { flex: none; text-align: center; font-size: 11px; color: var(--dim); opacity: .8; padding: 0 12px 8px; margin-top: -4px; }
@media (max-width: 760px) { .panel.min .copy { display: none; } }

/* ---------- opening animation (T&P NTMs) ---------- */
.intro { position: fixed; inset: 0; z-index: 3000; display: grid; place-content: center; justify-items: center; gap: 6px; background: var(--wk-ocean); --cx: 50%; --cy: 44%; }
html.in-hub .intro { background: var(--wk-solid); }
.intro svg { width: min(64vw, 300px); height: auto; overflow: visible; }
.intro .grid path { fill: none; stroke: var(--line); stroke-width: 1.2; stroke-dasharray: 300; stroke-dashoffset: 300; }
.intro .rt { fill: none; stroke: #00E5FF; stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 420; stroke-dashoffset: 420; filter: drop-shadow(0 0 5px rgba(0,229,255,.8)); }
.intro .tp { fill: rgba(255,159,28,.45); stroke: #FFD60A; stroke-width: 3; stroke-linejoin: round; opacity: 0; transform-box: fill-box; transform-origin: center; transform: scale(.3);
  filter: drop-shadow(0 0 6px rgba(255,214,10,.9)); }
.intro .ship { fill: var(--ink); opacity: 0; }
.intro-t { text-align: center; opacity: 0; transform: translateY(8px); }
.intro-t b { display: block; font-size: clamp(26px, 6.5vw, 36px); font-weight: 800; letter-spacing: -.01em; color: var(--ink); }
.intro-t span { font-size: 14px; color: var(--dim); }
.intro.play .grid path { animation: iDraw .7s ease-out forwards; }
.intro.play .rt { animation: iDraw 1s .25s cubic-bezier(.4,.1,.2,1) forwards; }
.intro.play .tp { animation: iPop .45s cubic-bezier(.3,1.5,.5,1) forwards; }
.intro.play .tp.a { animation-delay: .65s; } .intro.play .tp.b { animation-delay: .85s; } .intro.play .tp.c { animation-delay: 1.05s; }
.intro.play .ship { animation: iFade .4s 1.15s forwards; }
.intro.play .intro-t { animation: iUp .5s .95s ease-out forwards; }
.intro.open { animation: iOpen .75s cubic-bezier(.5,0,.2,1) forwards; }
@keyframes iDraw { to { stroke-dashoffset: 0; } }
@keyframes iPop { to { opacity: 1; transform: none; } }
@keyframes iFade { to { opacity: 1; } }
@keyframes iUp { to { opacity: 1; transform: none; } }
@keyframes iOpen { from { clip-path: circle(150% at var(--cx) var(--cy)); } to { clip-path: circle(0% at var(--cx) var(--cy)); opacity: .6; } }
@media (prefers-reduced-motion: reduce) { .intro { display: none; } }

/* Nav.War bits */
.nw-glow { filter: drop-shadow(0 0 4px rgba(255,79,110,.9)) drop-shadow(0 0 10px rgba(255,79,110,.45)); }
.seg-t { display: flex; gap: 6px; margin-bottom: 10px; }
.seg-t button { flex: 1; padding: 8px 6px; border-radius: 10px; border: 1px solid var(--line); background: var(--glass2); color: var(--ink); font-weight: 700; font-size: 13px; cursor: pointer; }
.seg-t button.on { background: var(--btn); color: #fff; border-color: transparent; }
.shp { display: inline-block; margin-top: 3px; font-size: 11.5px; color: var(--dim); }
.shp select { font-size: 11.5px; padding: 1px 2px; border-radius: 6px; border: 1px solid var(--line); background: var(--glass2); }
.nt .d { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.nt .d .x { border: 0; background: none; cursor: pointer; font-size: 14px; padding: 2px; opacity: .75; }
.field input:not([type]) { min-width: 0; }

/* drop-down lists: the list itself must have a solid background and the tone's ink, or the words vanish */
select { background-color: var(--wk-solid) !important; color: var(--wk-ink) !important; color-scheme: inherit; }
select option, select optgroup { background-color: var(--wk-solid); color: var(--wk-ink); }
html[data-wk-tone=day] select, html[data-wk-tone=day] select option { background-color: #FFFFFF; color: #04222F; }
/* clear all */
.clear { display: inline-flex; align-items: center; gap: 6px; padding: 6px 11px; border-radius: 99px; border: 1px solid var(--line); background: var(--glass2); cursor: pointer; font-size: 12px; font-weight: 700; color: var(--ink); }
.clear svg { width: 15px; height: 15px; }
@media (max-width: 760px) { .clear span { display: none; } .clear { padding: 6px 8px; } }
