:root {
  --ink: #12202f;
  --ink-2: #4a5a6a;
  --line: #dde3e9;
  --paper: #f6f8fa;
  --sea: #0b3954;
  --alert: #e03131;
  --warn: #f08c00;
  --seismic: #c2255c;
  --vessel: #1c7ed6;
  --rig: #5f3dc4;
  --subsea: #0c8599;
  --site: #868e96;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --sans: "IBM Plex Sans", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { font: 14px/1.5 var(--sans); color: var(--ink); background: #fff; display: flex; flex-direction: column; }
[hidden] { display: none !important; }
button { font: 500 13px var(--sans); border-radius: 8px; padding: 6px 14px; cursor: pointer; border: 1px solid var(--sea); background: var(--sea); color: #fff; }
button:disabled { opacity: 0.45; cursor: default; }
select { font: 13.5px var(--sans); padding: 5px 8px; border: 1px solid var(--line); border-radius: 7px; background: #fff; color: var(--ink); }

/* header */
header { position: relative; overflow: hidden; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 10px 18px; color: #fff;
  background:
    radial-gradient(ellipse 60% 140% at 8% 0%, rgba(99, 230, 190, 0.16), transparent 60%),
    radial-gradient(ellipse 50% 160% at 100% 100%, rgba(28, 126, 214, 0.28), transparent 65%),
    linear-gradient(100deg, #062236 0%, #0b3954 55%, #0d4466 100%); }
header::before { content: ""; position: absolute; inset: 0; pointer-events: none; opacity: 0.22;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='520' height='120' viewBox='0 0 520 120'%3E%3Cg fill='none' stroke='%239fd8f5' stroke-width='0.7'%3E%3Cpath d='M0 92c60-22 120-30 190-14s130 20 200-4 100-18 130-10'/%3E%3Cpath d='M0 70c70-24 140-30 210-12s120 16 190-8 90-14 120-6'/%3E%3Cpath d='M0 48c80-22 150-26 220-10s110 12 180-10 90-12 120-4'/%3E%3Cpath d='M0 26c90-18 160-22 230-8s100 8 170-12 90-10 120-2'/%3E%3C/g%3E%3C/svg%3E");
  background-size: 520px 120px; }
header > * { position: relative; }
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.mark { width: 40px; height: 40px; flex: none; }
.mark .ring { fill: none; stroke: #9fd8f5; stroke-opacity: 0.35; stroke-width: 1; }
.mark .beam { stroke: #63e6be; stroke-width: 1.3; }
.mark .sweep { transform-origin: 22px 22px; animation: sweep 4s linear infinite; }
.mark .blip { fill: #ff8787; opacity: 0; animation: blip 4s linear infinite; }
.mark .blip.b { animation-delay: 2.2s; }
@keyframes sweep { to { transform: rotate(360deg); } }
@keyframes blip { 0%, 4% { opacity: 0; } 8% { opacity: 1; } 60% { opacity: 0.15; } 100% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .mark .sweep, .mark .blip { animation: none; } .mark .blip { opacity: 0.8; } }
.titles { min-width: 0; }
.brand h1 { margin: 0; font-size: 19px; font-weight: 600; letter-spacing: 0.01em; line-height: 1.2; }
.brand h1 span { color: #63e6be; font-weight: 500; }
.brand p { margin: 1px 0 0; font-size: 12.5px; color: #c5dbe8; }
.hdr-right { display: flex; align-items: center; gap: 8px; flex: none; }
.pill { display: inline-flex; align-items: center; gap: 6px; font: 500 11.5px var(--sans); padding: 3px 10px; border-radius: 99px; white-space: nowrap;
  color: #dcecf5; background: rgba(255, 255, 255, 0.08); border: 1px solid rgba(255, 255, 255, 0.16); }
.pill.live i { width: 7px; height: 7px; border-radius: 50%; background: #63e6be; box-shadow: 0 0 0 0 rgba(99, 230, 190, 0.6); animation: pulse 2.4s ease-out infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 7px rgba(99, 230, 190, 0); } 100% { box-shadow: 0 0 0 0 rgba(99, 230, 190, 0); } }
@media (prefers-reduced-motion: reduce) { .pill.live i { animation: none; } }
button.pill.ai { cursor: pointer; background: linear-gradient(90deg, rgba(151, 117, 250, 0.28), rgba(99, 230, 190, 0.22)); border-color: rgba(190, 170, 255, 0.45); }
button.pill.ai::before { content: "✦"; font-size: 10px; color: #d0bfff; }
button.pill.ai:hover { border-color: #d0bfff; }
.icon { background: none; border: 0; color: #fff; font-size: 19px; cursor: pointer; opacity: 0.8; padding: 4px; }
.icon:hover { opacity: 1; }

/* toolbar */
.toolbar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 18px; padding: 10px 18px; border-bottom: 1px solid var(--line); position: relative; z-index: 5; background: #fff; }
.field { display: flex; flex-direction: column; gap: 3px; }
.field > span { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-2); font-weight: 500; }
#op { min-width: 210px; font-weight: 500; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg button { background: #fff; color: var(--ink-2); border: 0; border-radius: 0; padding: 5px 12px; border-right: 1px solid var(--line); }
.seg button:last-child { border-right: 0; }
.seg button[aria-checked="true"] { background: var(--sea); color: #fff; }
.seg button[data-p="custom"][aria-checked="true"] { background: var(--ink-2); }
.seg button:disabled { opacity: 1; color: #b8c1ca; }

.rules { position: relative; }
.rules summary { list-style: none; cursor: pointer; font-weight: 500; font-size: 13px; padding: 5px 12px; border: 1px solid var(--line); border-radius: 8px; color: var(--sea); user-select: none; }
.rules summary::-webkit-details-marker { display: none; }
.rules summary::after { content: " ▾"; }
.rules[open] summary { border-color: var(--sea); }
.rules-body { position: absolute; top: calc(100% + 6px); left: 0; width: min(560px, calc(100vw - 24px)); max-height: min(78vh, 760px); overflow-y: auto; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 8px 28px rgba(10,25,40,0.18); padding: 6px 14px 12px; }
.rules fieldset { border: 0; padding: 0; margin: 10px 0 0; }
.rules legend { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-2); font-weight: 500; padding: 0; margin-bottom: 3px; }
.rules label { display: flex; align-items: center; gap: 7px; font-size: 13px; padding: 2px 0; cursor: pointer; }
.rules label small { color: var(--ink-2); margin-left: auto; font-size: 11.5px; }
.rules select { padding: 2px 6px; font-size: 12.5px; }
.example { background: var(--paper); color: var(--sea); border-color: var(--line); margin-left: auto; }
.example:hover { border-color: var(--sea); background: #fff; }

/* main */
main { flex: 1; display: grid; grid-template-columns: minmax(0, 5fr) minmax(460px, 7fr); min-height: 0; }
.map-wrap { position: relative; min-height: 0; }
#map { position: absolute; inset: 0; background: #e8eef3; }
.legend { position: absolute; top: 10px; left: 10px; background: rgba(255,255,255,0.95); border-radius: 8px; padding: 7px 10px; font-size: 12.5px; box-shadow: 0 1px 4px rgba(0,0,0,0.15); }
.legend summary { cursor: pointer; font-weight: 500; font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-2); list-style: none; }
.legend summary::-webkit-details-marker { display: none; }
.legend summary::after { content: " ▾"; }
.legend:not([open]) summary::after { content: " ▸"; }
.legend .items { display: grid; gap: 3px; margin-top: 5px; }
.legend .row { display: flex; align-items: center; gap: 7px; }
.sw { width: 11px; height: 11px; border-radius: 50%; display: inline-block; background: var(--c); flex-shrink: 0; }
.sw.mine { box-shadow: 0 0 0 2px #fff, 0 0 0 3.5px var(--ink); }
.sw.line { width: 16px; height: 3px; border-radius: 2px; background: var(--alert); }

.timebar { position: absolute; left: 10px; right: 10px; bottom: 28px; display: flex; align-items: center; gap: 10px; background: rgba(255,255,255,0.96); border-radius: 10px; padding: 7px 12px; box-shadow: 0 1px 6px rgba(0,0,0,0.18); }
.icon-btn { width: 32px; height: 32px; padding: 0; border-radius: 50%; font-size: 13px; flex-shrink: 0; }
#date { flex: 1; accent-color: var(--sea); }
#date-label { font: 500 13px var(--mono); white-space: nowrap; min-width: 92px; text-align: right; }

/* side panel */
.side { display: flex; flex-direction: column; border-left: 1px solid var(--line); background: var(--paper); min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.side > * { flex-shrink: 0; }
.summary { padding: 10px 16px; background: #fff; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.summary .big { font-size: 22px; font-weight: 600; font-family: var(--mono); margin-right: 6px; }
.summary .sub { color: var(--ink-2); font-size: 12.5px; }
.summary .fresh { margin-top: 3px; }
.linkish { background: none; border: 0; padding: 0; color: var(--sea); text-decoration: underline; font: inherit; cursor: pointer; border-radius: 0; }
.linkish:disabled { color: var(--ink-2); text-decoration: none; cursor: default; opacity: 1; }
.linkish.on { font-weight: 600; }
.chip.new { background: #e6fcf5; border-color: #96f2d7; color: #087f5b; }
.years { display: flex; gap: 4px; padding: 8px 12px; background: #fff; border-bottom: 1px solid var(--line); overflow-x: auto; }
.years button { background: none; color: var(--ink-2); border: 1px solid var(--line); padding: 3px 8px 2px; display: flex; flex-direction: column; align-items: center; min-width: 50px; flex-shrink: 0; }
.years button b { font-family: var(--mono); font-size: 14px; color: var(--ink); font-weight: 500; }
.years button b.zero { color: #b8c1ca; }
.years button small { font-size: 11px; }
.years button[aria-pressed="true"] { border-color: var(--sea); background: #e7f0f6; }
.timeline-wrap { background: #fff; border-bottom: 1px solid var(--line); padding: 4px 8px 2px; }
#timeline { width: 100%; height: 132px; display: block; }
#timeline .today { stroke: #087f5b; stroke-width: 1.5; }
#timeline .today-t { font: 600 10px var(--sans); fill: #087f5b; }
#timeline .axis text { font: 10px var(--mono); fill: var(--ink-2); }
#timeline .axis line { stroke: var(--line); }
#timeline .bar { cursor: pointer; }
#timeline .bar:hover, #timeline .bar.sel { stroke: var(--ink); stroke-width: 1.5; }
#timeline .now { stroke: var(--ink); stroke-width: 1.5; stroke-dasharray: 3 2; }

.list { flex: 1 0 auto; padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; }
.list > * { flex-shrink: 0; }
.empty { color: var(--ink-2); font-size: 13px; padding: 10px 4px; }
.alert { background: #fff; border: 1px solid var(--line); border-left: 4px solid var(--sev, var(--warn)); border-radius: 8px; padding: 8px 10px; cursor: pointer; }
.alert:hover { border-color: #b8c4cf; border-left-color: var(--sev, var(--warn)); }
.alert.sel { box-shadow: 0 0 0 2px var(--sea); }
.alert.live { background: #fff8f0; }
.alert .top { display: flex; align-items: baseline; gap: 8px; }
.alert .kind { font-weight: 600; font-size: 13.5px; flex: 1; }
.alert .score { font: 500 11.5px var(--mono); color: var(--ink-2); }
.alert .when { font: 12px var(--mono); color: var(--ink-2); }
.alert .who { display: grid; grid-template-columns: auto 1fr; gap: 1px 8px; margin-top: 5px; font-size: 12.5px; }
.alert .who .tag { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-2); padding-top: 2px; white-space: nowrap; }
.alert .who .act { min-width: 0; }
.alert .who .act b { font-weight: 500; }
.alert .who .act .ref { font: 11px var(--mono); color: var(--ink-2); }
.alert .why { margin-top: 5px; display: flex; flex-wrap: wrap; gap: 4px; }
.chip { font-size: 11px; padding: 1px 7px; border-radius: 99px; background: var(--paper); border: 1px solid var(--line); color: var(--ink-2); white-space: nowrap; }
.chip.hot { background: #fff0f0; border-color: #ffc9c9; color: #c92a2a; }
.chip.soft { border-style: dashed; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--c); margin-right: 5px; vertical-align: 0; }
.more { font-size: 12px; color: var(--ink-2); text-align: center; padding: 4px; }
.more button { background: none; color: var(--sea); border: 0; padding: 2px 6px; text-decoration: underline; }

.side footer { font-size: 11px; color: var(--ink-2); padding: 6px 16px 8px; background: #fff; border-top: 1px solid var(--line); }
.side footer a { color: inherit; }

dialog { border: 0; border-radius: 10px; padding: 20px 22px; max-width: 480px; box-shadow: 0 10px 40px rgba(0,0,0,0.25); }
dialog h2 { margin: 0 0 6px; font-size: 16px; }
dialog p { font-size: 13.5px; color: var(--ink); margin: 0 0 10px; }
dialog p.small { font-size: 12.5px; color: var(--ink-2); }
dialog .row { display: flex; justify-content: flex-end; }
dialog::backdrop { background: rgba(10, 25, 40, 0.45); }

.maplibregl-popup-content { font: 12px/1.45 var(--sans); padding: 8px 10px; max-width: 280px; }
.pop h4 { margin: 0 0 4px; font-size: 12.5px; }
.pop ul { margin: 0; padding-left: 0; list-style: none; }
.pop li { margin: 2px 0; }
.pop .mine { font-weight: 600; }

@media (max-width: 860px) {
  header { padding: 8px 12px; gap: 8px; }
  .mark { width: 32px; height: 32px; }
  .brand { gap: 9px; }
  .brand h1 { font-size: 16px; }
  .brand p { font-size: 11px; }
  .pill.live { display: none; }
  .hdr-right { gap: 2px; }
  .toolbar { padding: 8px 12px; gap: 8px 12px; }
  #op { min-width: 0; width: 100%; font-size: 16px; }
  .toolbar > .field:first-child { flex: 1 1 100%; }
  .example { margin-left: 0; }
  html, body { height: auto; }
  main { display: block; }
  .map-wrap { height: 52vh; }
  .side { border-left: 0; border-top: 1px solid var(--line); }
  .list { overflow: visible; }
  .side { overflow: visible; }
  .legend { font-size: 11.5px; padding: 5px 8px; }
  .timebar { bottom: 20px; }
}

/* rules: pairing grid and sliders */
.rules .hint { font-size: 12px; color: var(--ink-2); margin: 8px 0 0; }
.grid-wrap { overflow-x: auto; }
table.grid { border-collapse: collapse; font-size: 11.5px; margin-top: 2px; }
table.grid th { font-weight: 500; color: var(--ink-2); padding: 2px 3px; white-space: nowrap; text-align: left; }
table.grid tr:first-child th { text-align: center; font-size: 10.5px; }
table.grid tr:first-child th .dot { display: block; margin: 0 auto 2px; }
table.grid td { padding: 1px 2px; text-align: center; }
table.grid select { padding: 1px 2px; font: 500 12px var(--mono); width: 40px; border-radius: 5px; background: #e7f0f6; border-color: #a5c3d6; }
table.grid select.off { background: #fff; border-color: var(--line); color: #b8c1ca; font-weight: 400; }
.quick { display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
button.mini { background: #fff; color: var(--sea); border: 1px solid var(--line); padding: 2px 8px; font-size: 12px; }
button.mini:hover { border-color: var(--sea); }
.rules label.sl { display: grid; grid-template-columns: 1fr auto; gap: 0 8px; align-items: center; padding: 4px 0 2px; }
.rules label.sl input[type=range] { grid-column: 1 / -1; width: 100%; accent-color: var(--sea); }
.rules label.sl output { font: 500 12px var(--mono); color: var(--sea); }
.rules label.sl input:disabled { opacity: 0.4; }

/* score breakdown */
.calc { margin-top: 5px; font-size: 12px; }
.calc summary { cursor: pointer; color: var(--ink-2); font-size: 11.5px; width: fit-content; }
.calc table { border-collapse: collapse; margin-top: 3px; width: 100%; }
.calc td { padding: 1px 0; vertical-align: top; }
.calc td:last-child { text-align: right; font: 12px var(--mono); white-space: nowrap; padding-left: 10px; }
.calc td small { color: var(--ink-2); }
.calc tr.tot td { border-top: 1px solid var(--line); font-weight: 600; padding-top: 2px; }

/* feedback */
.fb { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin-top: 6px; padding-top: 6px; border-top: 1px dashed var(--line); font-size: 12px; color: var(--ink-2); }
.fb span { margin-right: 2px; }
.fb button { background: #fff; color: var(--ink-2); border: 1px solid var(--line); padding: 1px 9px; font-size: 12px; border-radius: 99px; }
.fb button:hover { border-color: var(--ink-2); }



.fb-note { flex: 1 1 160px; min-width: 120px; font: 12px var(--sans); padding: 2px 7px; border: 1px solid var(--line); border-radius: 6px; }
.fbtn { margin-left: auto; }
#fb-dialog { max-width: 620px; width: calc(100vw - 32px); }
#fb-text { width: 100%; font: 12px/1.45 var(--mono); border: 1px solid var(--line); border-radius: 7px; padding: 8px; resize: vertical; }
dialog .row { gap: 6px; align-items: center; margin-top: 8px; }
dialog .grow { flex: 1; }
button.ghost { background: #fff; color: var(--sea); border-color: var(--line); }
@media (max-width: 860px) {
  .fbtn { margin-left: 0; }
  table.grid select { width: 34px; font-size: 11px; }
  table.grid th { font-size: 10px; padding: 2px 1px; }
  .rules-body { position: fixed; left: 12px; right: 12px; top: 120px; width: auto; max-height: calc(100vh - 140px); }
}

.ref abbr { text-decoration: underline dotted #adb5bd; text-underline-offset: 2px; cursor: help; }
.pend { color: #946c00; background: #fff9db; border-radius: 4px; padding: 0 4px; }
dialog h3 { font-size: 14px; margin: 14px 0 4px; }
dialog ul.small { margin: 4px 0 8px; padding-left: 18px; font-size: 12.5px; color: var(--ink-2); }
dialog ul.small li { margin: 3px 0; }
#about { max-height: 88vh; overflow-y: auto; }

/* sign-up and send forms */
dialog label.fld { display: block; font-size: 12.5px; color: var(--ink-2); margin: 8px 0; }
dialog label.fld input, dialog label.fld textarea { display: block; width: 100%; margin-top: 3px; font: 14px var(--sans); padding: 6px 8px; border: 1px solid var(--line); border-radius: 7px; color: var(--ink); }
dialog label.tick { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; margin: 8px 0; }
dialog label.tick input { margin-top: 3px; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.msg { font-size: 13px; min-height: 1em; margin: 4px 0; }
.msg.err { color: #c92a2a; }
.msg.ok { color: #087f5b; }
#signup { max-width: 480px; width: calc(100vw - 32px); }

/* coming up / look back */
.modes { display: flex; gap: 0; padding: 8px 12px 0; background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 3; }
.modes button { background: none; color: var(--ink-2); border: 0; border-bottom: 2.5px solid transparent; border-radius: 0; padding: 6px 14px 7px; font: 600 14px var(--sans); }
.modes button b { display: inline-block; min-width: 22px; margin-left: 4px; padding: 0 6px; border-radius: 99px; background: #e7f0f6; color: var(--sea); font: 600 12px var(--mono); }
.modes button[aria-selected="true"] { color: var(--sea); border-bottom-color: var(--sea); }
.modes button:hover { color: var(--sea); }
.summary .ask { margin-top: 4px; color: #5c4400; background: #fff9db; border-radius: 6px; padding: 3px 8px; width: fit-content; }
.hint-bar { display: flex; align-items: center; gap: 10px; padding: 8px 14px; background: #e6fcf5; border-bottom: 1px solid #b2f2bb; font-size: 13px; color: #0b5d45; }
.hint-bar span { flex: 1; }
.hint-bar button { background: #fff; color: #087f5b; border-color: #8ce99a; padding: 3px 10px; font-size: 12px; flex: none; }
.alert .sev { font: 600 11px var(--sans); padding: 1px 8px; border-radius: 99px; letter-spacing: 0.02em; }
.sev-high { background: #fff5f5; color: #c92a2a; border: 1px solid #ffc9c9; }
.sev-medium { background: #fff4e6; color: #d9480f; border: 1px solid #ffd8a8; }
.sev-low { background: #fff9db; color: #946c00; border: 1px solid #ffec99; }
.alert .when b { color: var(--ink); font-weight: 600; }
.alert .when .now-tag { color: #c92a2a; }
.alert .who.notags { grid-template-columns: 1fr; }
.fb button { display: inline-flex; align-items: center; gap: 4px; }
.fb button span { font-size: 11.5px; }
.map-date { font: 12px var(--sans); color: var(--ink-2); white-space: nowrap; }
.map-date output { font: 500 12.5px var(--mono); color: var(--ink); }
.rules .hint.key { font-size: 11.5px; margin-top: 4px; }
.sw.hotblk { background: rgba(224, 49, 49, 0.18); border: 1px solid #e03131; border-radius: 2px; }
@media (max-width: 860px) {
  main { display: flex; flex-direction: column; }
  .side { order: 1; border-top: 0; }
  .map-wrap { order: 2; height: 46vh; border-top: 1px solid var(--line); }
  .fb button span { display: none; }
  .fb button { padding: 2px 10px; font-size: 14px; }
  .modes button { flex: 1; }
  #timeline { height: 110px; }
}

/* feedback buttons: site accents, thumbs down in grey */
.fb .ic { width: 15px; height: 15px; fill: currentColor; flex: none; }
.fb button[data-v="real"]:hover { color: #087f5b; border-color: #63e6be; }
.fb button[data-v="not"]:hover { color: #495057; border-color: #adb5bd; }
.fb button[data-v="unsure"]:hover { color: var(--sea); border-color: #a5c3d6; }
.fb button.on.real { background: #e6fcf5; border-color: #63e6be; color: #087f5b; }
.fb button.on.not { background: #f1f3f5; border-color: #adb5bd; color: #343a40; }
.fb button.on.unsure { background: #e7f0f6; border-color: #a5c3d6; color: var(--sea); }
.summary .ask { color: var(--sea); background: #e7f0f6; }
