/* The Hunt. Built on shared/css/tsm.css tokens only.
   Probability glow = --c2 (drawn on a canvas from the resolved token), search assets = --blue,
   true submarine track = --red. */
.sh-actions { max-width: 1400px; margin: 12px auto 0; display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; justify-content: space-between; }
.sh-actions > div { display: flex; gap: 8px; flex-wrap: wrap; }
.sh-flag { margin: 0; font-size: 13px; padding: 5px 10px; border: 1px dashed var(--warn); border-radius: 4px; }
.sh-flag b { color: var(--warn); }
.mt { margin-top: 14px !important; }

/* How to play */

/* Hour bar and the per-hour summary */
.sh-console { padding: 10px 14px; display: flex; flex-direction: column; gap: 8px; }
.sh-console.done .sh-tools { opacity: .5; }
.sh-hourbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 24px; }
.sh-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: center; }
.sh-row .sh-go { flex-wrap: nowrap; }
@media (max-width: 720px) { .sh-row { grid-template-columns: minmax(0, 1fr); } .sh-row .sh-go { justify-content: flex-end; } }
.sh-queue { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-width: 0; }
.sh-queue ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px; }
.sh-queue li { font-size: 12px; border: 1px solid var(--blue); background: var(--blue-soft); border-radius: 10px; padding: 1px 8px; }
.sh-queue li span { font-family: var(--mono); color: var(--muted); margin-left: 2px; }
.sh-queue li.muted { border-color: transparent; background: none; padding: 1px 0; color: var(--muted); }
.sh-lineopt { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.sh-lineopt[hidden] { display: none; }
.sh-lineopt { flex-wrap: wrap; }
.sh-rot { display: inline-flex; gap: 6px; margin-left: auto; }
.sh-rot .btn { min-height: 36px; min-width: 40px; }
.sh-compass { width: 26px; height: 26px; flex: none; }
.sh-compass circle { fill: none; stroke: var(--rule); stroke-width: 1.2; }
.sh-compass path { stroke: var(--muted); stroke-width: 1.2; }
.sh-compass line { stroke: var(--blue); stroke-width: 2.4; stroke-linecap: round; }
.sh-cursor .sh-buoy { fill: none; stroke: var(--blue); stroke-width: 1.2; pointer-events: none; }
.sh-buoy.dry, .sh-cursor .sh-buoy.dry { fill: none; stroke: var(--muted); stroke-dasharray: 2 1.5; }
.sh-effort { display: flex; flex-direction: column; gap: 4px; flex: 0 1 230px; min-width: 170px; }
.sh-pips { display: flex; gap: 3px; }
.sh-pips i { flex: 1 1 0; height: 10px; border-radius: 2px; border: 1px solid var(--rule); background: transparent; }
.sh-pips i.on { background: var(--accent); border-color: var(--accent); }
.sh-pips i.used { background: color-mix(in srgb, var(--accent) 30%, transparent); border-color: var(--accent); border-style: dashed; }
.sh-stock { margin: 0; display: flex; gap: 14px; font-size: 13px; }
.sh-stock b { font: 700 18px var(--display); }
.sh-hour { margin: 0; display: flex; align-items: baseline; gap: 6px; }
.sh-hour b { font: 700 26px var(--display); }
.sh-left { margin-left: 8px; font-size: 13px; color: var(--muted); }
.sh-meter { display: flex; flex-direction: column; gap: 4px; flex: 0 1 320px; min-width: 200px; }
.sh-meter-h { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; font-size: 13px; font-weight: 600; }
.sh-meter-h b { font: 700 22px var(--display); color: var(--good); }
.sh-meter-bar { display: block; height: 8px; border-radius: 4px; background: var(--rule); overflow: hidden; }
.sh-meter-bar i { display: block; height: 100%; width: 0; background: var(--good); transition: width .4s ease; }
.sh-say { margin: 0; padding: 9px 14px; font-size: 14px; line-height: 1.45; min-height: 1.45em; border-left: 4px solid var(--blue); }
.sh-say .pill { font-size: 10px; }

/* Map */
.sh-callout { position: absolute; transform: translate(-50%, 0); max-width: min(260px, 70%); background: var(--ink); color: var(--panel); font: 600 13px/1.35 var(--body); padding: 7px 10px; border-radius: 4px; pointer-events: none; box-shadow: 0 4px 14px rgba(0, 0, 0, .25); z-index: 10; }
.sh-callout::before { content: ""; position: absolute; left: 50%; top: -6px; margin-left: -6px; border: 6px solid transparent; border-top: 0; border-bottom-color: var(--ink); }
.sh-callout[hidden] { display: none; }
.mapbox svg:focus-visible { outline-offset: -3px; }
.sh-heat { image-rendering: auto; pointer-events: none; }
.sh-mid { text-anchor: middle; }
.sh-end { text-anchor: end; }
.sh-names .t-place { font-size: 15px; font-weight: 600; fill: var(--muted); }
.sh-names .t-sea { font-size: 16px; }
.sh-exit { fill: none; stroke: var(--muted); stroke-width: 1.2; stroke-dasharray: 2 3; }
.sh-exitlab { font: 11px var(--mono); fill: var(--muted); paint-order: stroke; stroke: var(--sea); stroke-width: 3px; }
.sh-lab { font: 11.5px var(--mono); fill: var(--ink); paint-order: stroke; stroke: var(--sea); stroke-width: 3px; stroke-linejoin: round; }
.sh-datum { fill: none; stroke: var(--ink); stroke-width: 1.4; stroke-dasharray: 7 5; opacity: .7; }
.sh-asset { fill: color-mix(in srgb, var(--blue) 10%, transparent); stroke: var(--blue); stroke-width: 1.6; }
.sh-asset.pending { stroke-dasharray: 6 4; fill: none; }
.sh-asset.done { stroke: var(--muted); fill: none; stroke-dasharray: 2 4; opacity: .7; }
.sh-alab { fill: var(--blue); font-size: 11px; }
.sh-alab.done { fill: var(--muted); }
.sh-shiptrack { fill: none; stroke: var(--blue); stroke-width: 2; opacity: .6; }
.sh-shipicon { fill: var(--blue); stroke: var(--panel); stroke-width: 1.5; }
.sh-contact path { fill: var(--ink); stroke: var(--panel); stroke-width: 1.5; }
.sh-contact.old { opacity: .45; }
.sh-contact.real path { fill: var(--red); }
.sh-contact.false { opacity: .7; }
.sh-contact .sh-x { stroke: var(--ink); stroke-width: 2; fill: none; }
.sh-truth { fill: none; stroke: var(--red); stroke-width: 2.2; }
.sh-truth.sprint { stroke-width: 5; }
.sh-truthdot { fill: var(--red); }
.sh-truthnow { fill: var(--red); stroke: var(--panel); stroke-width: 2.5; }
.sh-pros { fill: none; stroke-width: 2.5; }
.sh-pros.found { stroke: var(--good); } .sh-pros.missed { stroke: var(--bad); }
.sh-cur { fill: color-mix(in srgb, var(--blue) 6%, transparent); stroke: var(--blue); stroke-width: 1.4; stroke-dasharray: 4 3; pointer-events: none; }
.sh-cur.pros { stroke: var(--red); fill: color-mix(in srgb, var(--red) 8%, transparent); stroke-dasharray: none; stroke-width: 2; }
.sh-cross { stroke: var(--ink); stroke-width: 1.4; pointer-events: none; }
.sh-legend { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 12.5px; margin-top: -4px; padding: 0 2px; }
.sh-legend span { display: inline-flex; align-items: center; gap: 5px; }
.sh-legend i { display: inline-block; width: 14px; height: 10px; }
.lg-heat { background: linear-gradient(90deg, color-mix(in srgb, var(--c2) 15%, transparent), var(--c2)); border-radius: 2px; width: 26px !important; }
.lg-ship { width: 0 !important; height: 0 !important; border: 6px solid transparent; border-top: 0; border-bottom: 11px solid var(--blue); }
.sh-why { flex-basis: 100%; margin: 2px 0 0; font-size: 12.5px; color: var(--muted); }
.lg-contact { width: 9px !important; height: 9px !important; background: var(--ink); transform: rotate(45deg); }
.lg-asset { border: 1.6px solid var(--blue); border-radius: 50%; }
.lg-truth { height: 3px !important; background: var(--red); }
.sh-legend .rv { display: none; }
.sh-adv summary, .sh-more summary { cursor: pointer; font-family: var(--display); font-weight: 600; font-size: 15px; }
.sh-adv[open] { display: flex; flex-direction: column; gap: 10px; }
.sh-more { margin-top: 16px; border-top: 1px solid var(--rule); padding-top: 12px; display: flex; flex-direction: column; gap: 10px; }
.sh-math h3 { font-size: 17px; margin: 14px 0 4px; }
.sh-math p { margin: 0 0 6px; }
body.sh-over .sh-legend .rv { display: inline-flex; }

/* Controls */
.sh-tools { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.sh-tools button b { font-size: 13.5px; }
.sh-tools button { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.sh-th { display: flex; align-items: baseline; gap: 6px; }
.sh-th b { flex: 1 1 auto; min-width: 0; }
.sh-k { font: 500 10.5px var(--mono); color: var(--muted); border: 1px solid var(--rule); border-radius: 3px; padding: 0 4px; }
.sh-cost { font: 600 11px var(--mono); color: var(--accent); white-space: nowrap; }
.sh-tools small, .sh-beh small { color: var(--muted); font-size: 11.5px; line-height: 1.3; }
.sh-tools button:disabled { opacity: .45; cursor: default; }
.sh-prosbtn b { color: var(--red); }
.sh-go { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.sh-prosbox { border: 1px solid var(--red); background: var(--red-soft); border-radius: 4px; padding: 10px 12px; display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; justify-content: space-between; }
.sh-prosbox p { margin: 0; }
.sh-prosbox[hidden] { display: none; }
.sh-go .sh-end { padding: 9px 22px; font-size: 14px; }
.sh-end.nudge { animation: sh-pulse 1.4s ease-in-out infinite; }
@keyframes sh-pulse { 0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 70%, transparent); } 50% { box-shadow: 0 0 0 7px color-mix(in srgb, var(--accent) 0%, transparent); } }

/* Panel */
.sh-behodds { display: flex; flex-direction: column; gap: 5px; }
.sh-bo { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 8px; font-size: 13px; align-items: baseline; }
.sh-bo b { font-family: var(--mono); font-size: 12.5px; }
.sh-bo-bar { grid-column: 1 / -1; height: 6px; background: var(--rule); border-radius: 3px; overflow: hidden; }
.sh-bo-bar i { display: block; height: 100%; background: var(--c6); transition: width .4s ease; }
.sh-log { list-style: none; margin: 0; padding: 0; max-height: 260px; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; }
.sh-log { max-height: 340px; font-size: 13px; line-height: 1.4; }
.sh-log li { border-left: 3px solid var(--rule); padding: 2px 8px; }
.sh-log li:first-child { border-left-color: var(--blue); }
.sh-real { color: var(--red); } .sh-false { color: var(--muted); }
.sh-beh { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.sh-beh button { display: flex; flex-direction: column; gap: 2px; }
.sh-seed { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 12.5px; }
.sh-seed input { width: 90px; padding: 5px 6px; border: 1px solid var(--rule); border-radius: 3px; background: var(--panel); color: var(--ink); }
.sh-eq { margin: 0; font: 600 18px var(--mono); text-align: center; }
.sh-lrc { width: 100%; height: auto; }
.sh-lrc-a { stroke: none; }
.sh-lrc-a.sprint { fill: color-mix(in srgb, var(--c2) 18%, transparent); }
.sh-lrc-a.quiet { fill: color-mix(in srgb, var(--blue) 22%, transparent); }
.sh-lrc-l { fill: none; stroke-width: 2; }
.sh-lrc-l.sprint { stroke: var(--c2); } .sh-lrc-l.quiet { stroke: var(--blue); }
.sh-lrc-t { font: 11px var(--mono); } .sh-lrc-t.sprint { fill: var(--c2); } .sh-lrc-t.quiet { fill: var(--blue); }

/* Reveal and batch */
.sh-reveal { padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.sh-reveal[hidden] { display: none; }
.sh-replay { display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: end; }
.sh-chart { width: 100%; height: auto; }
.sh-chart[hidden] { display: none; }
.sh-grid { stroke: var(--rule); }
.sh-l { fill: none; stroke-width: 2.5; }
.sh-l.near { stroke: var(--c2); }
.sh-now { stroke: var(--ink); stroke-width: 1; stroke-dasharray: 2 3; }
.sh-tick { stroke-width: 3; }
.sh-tick.real { stroke: var(--red); } .sh-tick.false { stroke: var(--muted); opacity: .5; }
.sh-lg text, .sh-ct, .sh-bl { font: 12px var(--body); fill: var(--ink); }
.sh-ct { fill: var(--muted); font-size: 11px; }
.sh-bk.found { fill: var(--good); } .sh-bk.missed { fill: var(--warn); } .sh-bk.escaped { fill: var(--bad); } .sh-bk.timeout { fill: var(--muted); }
.sh-bn { font: 600 12px var(--mono); fill: var(--panel); }

/* Below */
.sh-history { margin: 0; padding-left: 0; list-style: none; display: flex; flex-direction: column; gap: 10px; font-size: 14px; }
.sh-history li { border-left: 3px solid var(--accent); padding: 2px 0 2px 10px; }
.sh-history b { font-family: var(--display); margin-right: 4px; }


.sh-narrow { display: none; }
#map.narrow .sh-narrow { display: inline; }
#map.narrow .sh-gw { display: none; }
/* Map text and marks keep a constant on-screen size: --u is SVG units per screen pixel (set in map.js). */
#map { --u: 1; }
#map .sh-lab { font-size: calc(12px * var(--u)); stroke-width: calc(3px * var(--u)); }
#map .sh-exitlab { font-size: calc(11.5px * var(--u)); stroke-width: calc(3px * var(--u)); }
#map .sh-names .t-place { font-size: calc(15px * var(--u)); }
#map .sh-names .t-sea { font-size: calc(15px * var(--u)); }
#map .tsm-grat text { font-size: calc(11px * var(--u)); }
#map path, #map line, #map circle { vector-effect: non-scaling-stroke; }
/* Desktop: the controls sit in the side panel, which stays in view beside the map. */
@media (min-width: 1021px) {
  .layout > .panel { position: sticky; top: 8px; max-height: calc(100vh - 16px); overflow-y: auto; }
  .sh-console .sh-tools { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
/* Phones and tablets: the map comes first, then its legend and the turn summary, then the controls. */
@media (max-width: 1020px) {
  .stage > .mapbox { order: 2; } .stage > .sh-legend { order: 3; margin-top: 0; }
  .stage > .sh-say { order: 4; } .stage > .sh-reveal { order: 5; }
}
body.sh-over .sh-console { display: none; }
@media (max-width: 720px) { .sh-tools { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 520px) {
  .sh-hour b { font-size: 22px; }
  .sh-effort { flex-basis: 100%; }
  .sh-legend { font-size: 12px; gap: 3px 12px; }
  .sh-replay { grid-template-columns: 1fr; }
  .sh-tools button { padding: 7px 6px; }
  .sh-tools small { font-size: 11px; }
  .sh-meter { flex-basis: 100%; }
}

/* Map marks added for the effort-per-turn version */
.sh-patrol { stroke: var(--c6); stroke-width: 2; fill: none; stroke-dasharray: none; }
.sh-leader { stroke-width: 1; opacity: .6; }
.sh-range { fill: none; stroke: var(--blue); stroke-width: 1.2; stroke-dasharray: 3 5; opacity: .8; pointer-events: none; }
.sh-cur.bad { stroke: var(--bad); fill: color-mix(in srgb, var(--bad) 8%, transparent); }
.sh-cur.line, .sh-cur.move { fill: none; stroke-width: 3; }
.sh-cur.attack { stroke: var(--red); fill: color-mix(in srgb, var(--red) 8%, transparent); stroke-dasharray: none; stroke-width: 2; }
.sh-asset.sh-line { fill: none; stroke-width: 2.4; }
.sh-asset.sh-helo { stroke: var(--c3); fill: color-mix(in srgb, var(--c3) 14%, transparent); }
.sh-asset.sh-air { fill: color-mix(in srgb, var(--blue) 6%, transparent); stroke-dasharray: 8 3; }
.sh-asset.sh-air.pending, .sh-asset.pending { stroke-dasharray: 5 4; }
.sh-buoy { fill: var(--blue); stroke: var(--panel); stroke-width: 1; }
.sh-buoy.done { fill: var(--muted); }
.sh-shipplan { fill: none; stroke: var(--blue); stroke-width: 2; stroke-dasharray: 5 4; }
.sh-shipplan.dash { stroke-dasharray: 2 3; stroke-width: 3; }
.sh-contact .sh-wedge { fill: color-mix(in srgb, var(--ink) 10%, transparent); stroke: var(--ink); stroke-width: 1; stroke-dasharray: 3 3; }
.sh-contact.real .sh-contact .sh-wedge { fill: color-mix(in srgb, var(--red) 16%, transparent); stroke: var(--red); }
.sh-contact .sh-err { fill: none; stroke: var(--ink); stroke-width: 1.2; stroke-dasharray: 2 3; }
.sh-contact.sh-c-net .sh-err { stroke: var(--c6); stroke-width: 1.6; stroke-dasharray: 6 4; }
.sh-contact.sh-c-net path:not(.sh-err) { fill: var(--c6); }
.sh-pros.queued { stroke: var(--red); stroke-dasharray: 5 4; }
.sh-truth.hide { stroke-dasharray: 3 3; }
.lg-wedge { width: 18px !important; height: 10px !important; background: color-mix(in srgb, var(--ink) 18%, transparent); clip-path: polygon(0 50%, 100% 0, 100% 100%); }
.lg-patrol { width: 12px !important; height: 12px !important; background: linear-gradient(var(--c6), var(--c6)) center / 2px 100% no-repeat, linear-gradient(var(--c6), var(--c6)) center / 100% 2px no-repeat; }
.sh-story { margin: 0; font-size: 14.5px; line-height: 1.5; }
.sh-near { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; font-size: 14px; line-height: 1.45; }
.sh-habits { margin: 4px 0 10px; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; }
.below h3 { font-size: 18px; margin: 16px 0 6px; }

/* Trailer look (Interactive Deterrence "Graphics: Trailer"; the attribute is only ever set there).
   The shared tokens are remapped by shared/css/trailer.css; these are the series colours and the few
   marks that need the night-table treatment: the glow is the red probability cloud, the player's queued
   orders are amber, sensors stay blue, the sub and its contacts red. */
:root[data-skin="trailer"] { --c2: #ff6f55; --c3: #2cc2ac; --c6: #b9a3f0; }
:root[data-skin="trailer"] .sh-callout { background: var(--panel); color: var(--ink); border: 1px solid var(--accent); box-shadow: var(--glow); font-family: var(--mono); font-weight: 400; font-size: 12px; letter-spacing: .02em; }
:root[data-skin="trailer"] .sh-callout::before { border-bottom-color: var(--accent); }
:root[data-skin="trailer"] .sh-heat { filter: url(#sh-glow) saturate(1.15); }
:root[data-skin="trailer"] #map .sh-names .t-place { font-family: var(--mono); font-weight: 400; text-transform: uppercase; letter-spacing: .1em; font-size: calc(12px * var(--u)); }
:root[data-skin="trailer"] #map.narrow .sh-names .t-place { letter-spacing: 0; text-transform: none; font-size: calc(12px * var(--u)); }
:root[data-skin="trailer"] #map .sh-names .t-sea { font-family: var(--display); font-style: italic; font-weight: 400; fill: var(--blue); fill-opacity: .6; font-size: calc(16px * var(--u)); }
:root[data-skin="trailer"] #map .tsm-grat line { stroke: var(--blue); stroke-opacity: .16; stroke-dasharray: 2 6; }
:root[data-skin="trailer"] #map .tsm-grat text { fill: var(--blue); fill-opacity: .55; font-family: var(--mono); }
:root[data-skin="trailer"] .sh-asset.pending, :root[data-skin="trailer"] .sh-shipplan { stroke: var(--accent); }
:root[data-skin="trailer"] .sh-cur:not(.bad):not(.attack) { stroke: var(--accent); fill: color-mix(in srgb, var(--accent) 7%, transparent); }
:root[data-skin="trailer"] .sh-cross { stroke: var(--accent); }
:root[data-skin="trailer"] .sh-datum { stroke: var(--red); opacity: .85; }
:root[data-skin="trailer"] .sh-truth, :root[data-skin="trailer"] .sh-truthnow, :root[data-skin="trailer"] .sh-contact.real path,
:root[data-skin="trailer"] .sh-pros, :root[data-skin="trailer"] .sh-fx > * { filter: url(#sh-glow); }
:root[data-skin="trailer"] .sh-say { border-left-color: var(--accent); font-family: var(--body); }
:root[data-skin="trailer"] .sh-hour b, :root[data-skin="trailer"] .sh-stock b, :root[data-skin="trailer"] .sh-meter-h b { font-family: var(--mono); font-weight: 600; }
:root[data-skin="trailer"] .sh-meter-bar i { box-shadow: 0 0 10px var(--good); }
:root[data-skin="trailer"] .sh-pips i.on { box-shadow: 0 0 6px color-mix(in srgb, var(--accent) 60%, transparent); }
.sh-rot kbd { font: 600 11px/1 var(--mono, ui-monospace, monospace); padding: 2px 5px; margin-left: 4px; border: 1px solid currentColor; border-radius: 3px; opacity: .8; }
@media (max-width: 720px) { .sh-rot kbd { display: none; } }
