/*
 * BattleBytes — theatre map UI (HUD, layer chips, scrubber, intel panel,
 * tooltip, overview news column, MapLibre control skin).
 *
 * Why: all chrome around the paper map is our own DOM, built by
 * static/js/theatre/theatre.js. Every colour/font comes from tokens.css so the
 * light/dark switch on :root carries through. Mobile-first: under 720 px the
 * intel panel is a 55vh bottom sheet, chips wrap, the scrubber spans the
 * width. No blinking or looping animation anywhere — only short slides.
 */

.theatre {
  --panel-w: 360px;
  --chips-top: var(--theatre-chips-top, 12px);
  --attrib-h: 22px;
  position: relative;
  height: 100%;
  min-height: 320px;
  overflow: hidden;
  background: var(--paper);
  color: var(--ink);
  font: 400 14px/1.45 var(--font-ui);
  -webkit-text-size-adjust: 100%;
}
.theatre *, .theatre *::before, .theatre *::after { box-sizing: border-box; }
.theatre .mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.theatre-stage { position: absolute; inset: 0; }
.theatre .theatre-map.maplibregl-map, .theatre .theatre-map { position: absolute; inset: 0; background: var(--paper); }
.theatre :focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }

/* ---------- shared bits ---------- */
.theatre .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 32px; padding: 0 12px;
  font: 600 12px/1 var(--font-display); letter-spacing: .08em; text-transform: uppercase;
  color: var(--ink); background: var(--surface-2); text-decoration: none;
  border: 1px solid var(--line-strong); border-radius: 2px; cursor: pointer;
  transition: border-color 180ms var(--ease), color 180ms var(--ease);
}
.theatre .btn:hover { border-color: var(--amber); color: var(--amber); }
.theatre .btn:disabled { opacity: .55; cursor: default; }
.theatre .btn--amber { color: var(--amber); border-color: var(--amber-dim); background: color-mix(in srgb, var(--surface) 85%, transparent); }

.status-chip, .chip {
  display: inline-flex; align-items: center; height: 20px; padding: 0 7px;
  font: 600 11px/1 var(--font-display); letter-spacing: .1em; text-transform: uppercase;
  border: 1px solid var(--line-strong); border-radius: 2px; color: var(--ink-muted); white-space: nowrap;
}
.status-chip--active { color: var(--red); border-color: color-mix(in srgb, var(--red) 70%, transparent); }
.status-chip--watch { color: var(--amber); border-color: var(--amber-dim); }
.status-chip--frozen, .status-chip--ceasefire { color: var(--blue); border-color: color-mix(in srgb, var(--blue) 70%, transparent); }

/* ---------- top overlay: HUD + layer chips ---------- */
.theatre-top {
  position: absolute; z-index: 3; top: 8px; left: 8px; right: 8px;
  display: flex; flex-direction: column; gap: 8px; pointer-events: none;
}
.theatre-top > * { pointer-events: auto; }
.theatre-hud {
  align-self: flex-start; max-width: 100%;
  padding: 9px 12px 10px;
  background: color-mix(in srgb, var(--surface) 90%, transparent);
  border: 1px solid var(--line); border-radius: 4px;
}
.theatre-hud__row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.theatre-hud__title {
  margin: 0; font: 700 20px/1.1 var(--font-display); letter-spacing: .06em; text-transform: uppercase; color: var(--ink);
}
.theatre-hud__meta { display: flex; gap: 12px; margin-top: 4px; font-size: 11px; color: var(--ink-muted); letter-spacing: .04em; }
.theatre-hud__date { color: var(--amber); }
.mock-banner {
  margin: 8px 0 0; padding: 4px 8px; display: inline-block;
  font: 600 11px/1.3 var(--font-display); letter-spacing: .08em; text-transform: uppercase;
  color: var(--amber); border: 1px solid var(--amber); border-radius: 2px;
}

.layer-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.layer-chip {
  display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 8px 0 6px;
  font: 600 11px/1 var(--font-display); letter-spacing: .08em; text-transform: uppercase;
  color: var(--ink-faint); background: color-mix(in srgb, var(--surface) 90%, transparent);
  border: 1px solid var(--line); border-radius: 2px; cursor: pointer;
  transition: color 180ms var(--ease), border-color 180ms var(--ease);
}
.layer-chip__sw { display: inline-flex; width: 22px; justify-content: center; opacity: .4; transition: opacity 180ms var(--ease); }
.layer-chip__sw svg { display: block; }
.layer-chip[aria-pressed="true"] { color: var(--ink); border-color: var(--line-strong); }
.layer-chip[aria-pressed="true"] .layer-chip__sw { opacity: 1; }
.layer-chip:hover { border-color: var(--amber-dim); }

@media (max-width: 719.98px) {
  .theatre-hud { padding: 8px 10px 9px; }
  .theatre-hud__title { font-size: 18px; }
  .mock-banner { margin-top: 6px; font-size: 10.5px; padding: 3px 6px; }
  .layer-chip { height: 26px; gap: 4px; padding: 0 7px 0 4px; font-size: 10.5px; }
  .layer-chip__sw { width: 18px; }
  .layer-chip__sw svg { max-width: 18px; height: auto; }
}

/* ---------- scrubber ---------- */
.scrubber {
  position: absolute; z-index: 3; left: 8px; right: 8px; bottom: calc(var(--attrib-h) + 6px);
  display: grid; grid-template-columns: 36px 1fr auto; align-items: center; gap: 10px;
  padding: 8px 12px 6px 8px;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  border: 1px solid var(--line); border-radius: 4px;
  transition: left 280ms var(--ease), right 280ms var(--ease);
}
.scrubber__play {
  width: 36px; height: 36px; display: grid; place-items: center;
  color: var(--amber); background: transparent; border: 1px solid var(--amber-dim); border-radius: 2px; cursor: pointer;
}
.scrubber__play[aria-pressed="true"] { background: color-mix(in srgb, var(--amber) 14%, transparent); }
.scrubber__track { position: relative; padding-bottom: 16px; min-width: 0; }
.scrubber__date { font-size: 12px; color: var(--amber); white-space: nowrap; }
.scrubber__range {
  -webkit-appearance: none; appearance: none; display: block; width: 100%; height: 22px; margin: 0;
  background: transparent; cursor: pointer; --pct: 100%;
}
.scrubber__range::-webkit-slider-runnable-track {
  height: 2px; border-radius: 0;
  background: linear-gradient(to right, var(--amber) 0 var(--pct), var(--line-strong) var(--pct) 100%);
}
.scrubber__range::-moz-range-track { height: 2px; background: var(--line-strong); }
.scrubber__range::-moz-range-progress { height: 2px; background: var(--amber); }
.scrubber__range::-webkit-slider-thumb {
  -webkit-appearance: none; width: 14px; height: 14px; margin-top: -6px;
  background: var(--surface); border: 2px solid var(--amber); border-radius: 2px; transform: rotate(45deg);
}
.scrubber__range::-moz-range-thumb { width: 12px; height: 12px; background: var(--surface); border: 2px solid var(--amber); border-radius: 2px; transform: rotate(45deg); }
.scrubber__ticks { position: absolute; left: 7px; right: 7px; top: 14px; height: 18px; }
.scrubber__tick {
  position: absolute; top: 0; left: calc(var(--i) / var(--n) * 100%); transform: translateX(-50%);
  padding: 6px 2px 0; border: 0; background: none; cursor: pointer;
  font: 400 10px/1 var(--font-mono); letter-spacing: .04em; color: var(--ink-faint); white-space: nowrap;
}
.scrubber__tick::before { content: ""; position: absolute; top: 0; left: 50%; width: 1px; height: 4px; background: var(--line-strong); }
.scrubber__tick:first-child { transform: translateX(-7px); }
.scrubber__tick:first-child::before { left: 7px; }
.scrubber__tick:last-child { transform: translateX(calc(-100% + 7px)); }
.scrubber__tick:last-child::before { left: auto; right: 7px; }
.scrubber__tick.is-current { color: var(--amber); }

/* ---------- scrubber: full history (long range) ----------
 * Calendar-day axis over every map edit; month ticks, year labels at January,
 * date readout + 1x/4x speed on the right, "changed hands" strip below.
 * The strip is one row that scrolls sideways, so its height never changes
 * during playback (no jumping). Loading = a quiet dotted underline. */
.scrubber--history {
  grid-template-columns: 36px minmax(0, 1fr) auto;
  grid-template-areas: "play track meta" "strip strip strip";
  row-gap: 6px; padding-bottom: 7px;
}
.scrubber--history .scrubber__play { grid-area: play; }
.scrubber--history .scrubber__track { grid-area: track; padding-bottom: 18px; }
.scrubber__meta { grid-area: meta; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.scrubber--history .scrubber__date { min-width: 10ch; text-align: right; text-decoration: underline transparent; text-underline-offset: 3px; }
.scrubber--history .scrubber__date.is-loading { color: var(--ink-muted); text-decoration: underline dotted var(--ink-faint); }
.scrubber__speed {
  height: 22px; min-width: 34px; padding: 0 6px;
  font: 600 11px/1 var(--font-mono); color: var(--ink-muted);
  background: transparent; border: 1px solid var(--line-strong); border-radius: 2px; cursor: pointer;
  transition: color 180ms var(--ease), border-color 180ms var(--ease);
}
.scrubber__speed:hover { color: var(--amber); border-color: var(--amber-dim); }
.scrubber__speed[aria-pressed="true"] { color: var(--amber); border-color: var(--amber-dim); background: color-mix(in srgb, var(--amber) 12%, transparent); }
.scrubber__months { position: absolute; left: 7px; right: 7px; top: 15px; height: 20px; pointer-events: none; }
.scrubber__month { position: absolute; top: 0; left: calc(var(--p) * 100%); width: 1px; height: 4px; background: var(--line-strong); }
.scrubber__month.has-year { height: 7px; background: var(--ink-faint); }
.scrubber__month.is-start { background: transparent; }
.scrubber__year {
  position: absolute; top: 8px; left: 0; transform: translateX(-50%);
  font: 400 10px/1 var(--font-mono); letter-spacing: .04em; color: var(--ink-faint); white-space: nowrap;
}
.scrubber__month.is-start .scrubber__year { transform: translateX(-7px); }
.scrubber__month.is-end .scrubber__year { transform: translateX(-100%); }

.changed-strip {
  grid-area: strip; display: flex; align-items: center; gap: 8px; min-width: 0;
  padding-top: 6px; border-top: 1px solid var(--line);
}
.changed-strip__label {
  flex: 0 0 auto; font: 600 10.5px/1 var(--font-display); letter-spacing: .12em; text-transform: uppercase; color: var(--ink-muted);
}
.changed-strip__list {
  flex: 1 1 auto; min-width: 0; display: flex; gap: 4px; margin: 0; padding: 0; list-style: none;
  overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none;
}
.changed-strip__list::-webkit-scrollbar { display: none; }
.changed-strip__list > li { flex: 0 0 auto; }
.changed-strip__empty { font: 400 11px/24px var(--font-ui); color: var(--ink-faint); white-space: nowrap; }
.changed-strip__more { flex: 0 0 auto; font-size: 11px; color: var(--ink-faint); }
.changed-strip__more:empty { display: none; }
.changed-chip {
  display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 8px 0 6px;
  font: 500 12px/1 var(--font-ui); color: var(--ink); white-space: nowrap;
  background: var(--surface-2); border: 1px solid var(--line); border-left: 3px solid var(--ink-faint); border-radius: 2px; cursor: pointer;
  transition: border-color 180ms var(--ease), color 180ms var(--ease);
}
.changed-chip:hover { border-color: var(--amber-dim); color: var(--amber); }
.changed-chip--hostile { border-left-color: var(--red); }
.changed-chip--friendly { border-left-color: var(--blue); }
.changed-chip--neutral { border-left-color: var(--green); }
.changed-chip--unknown { border-left-color: var(--amber); }
.changed-chip__date { font-size: 10.5px; color: var(--ink-muted); }

@media (min-width: 720px) {
  .theatre .scrubber--history { width: min(760px, calc(100% - 24px)); }
  .theatre.panel-open .scrubber.scrubber--history { width: min(760px, calc(100% - var(--panel-w) - 24px)); }
}

/* ---------- tooltip ---------- */
.theatre-tip {
  position: absolute; z-index: 4; top: 0; left: 0; max-width: 260px; pointer-events: none;
  padding: 5px 8px; font: 500 13px/1.3 var(--font-ui); color: var(--ink);
  background: var(--surface-2); border: 1px solid var(--line-strong); border-radius: 2px;
}
.theatre-tip[hidden] { display: none; }

/* ---------- intel panel: bottom sheet (mobile first) ---------- */
.intel-panel {
  position: fixed; z-index: 20; left: 0; right: 0; bottom: 0; height: 55vh; height: 55dvh;
  display: flex; flex-direction: column;
  background: var(--surface); color: var(--ink);
  border-top: 1px solid var(--line-strong); border-radius: 4px 4px 0 0; box-shadow: var(--shadow);
  transform: translateY(105%); visibility: hidden;
  transition: transform 280ms var(--ease), visibility 0s linear 280ms;
  overscroll-behavior: contain;
}
.intel-panel.open { transform: translateY(0); visibility: visible; transition: transform 280ms var(--ease), visibility 0s; }
.intel-panel.dragging { transition: none; }
.intel-panel__handle { flex: 0 0 auto; display: grid; place-items: center; height: 22px; cursor: grab; touch-action: none; }
.intel-panel__handle span { width: 40px; height: 4px; border-radius: 2px; background: var(--line-strong); }
.intel-panel__close {
  position: absolute; top: 10px; right: 10px; z-index: 1; width: 32px; height: 32px; display: grid; place-items: center;
  color: var(--ink-muted); background: var(--surface-2); border: 1px solid var(--line); border-radius: 2px; cursor: pointer;
}
.intel-panel__close:hover { color: var(--ink); border-color: var(--line-strong); }
.intel-panel__body { flex: 1 1 auto; overflow-y: auto; padding: 4px 16px 20px; }

.intel-head { display: grid; grid-template-columns: 56px 1fr; gap: 12px; align-items: center; padding-right: 40px; }
.intel-head__sym svg { display: block; }
.intel-head__title { margin: 0; font: 700 22px/1.12 var(--font-display); letter-spacing: .02em; color: var(--ink); }
.intel-head__time { display: block; margin-top: 4px; font-size: 12px; color: var(--amber); }
.intel-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 10px; }
.chip--hostile { color: var(--red); border-color: color-mix(in srgb, var(--red) 60%, transparent); }
.chip--friendly { color: var(--blue); border-color: color-mix(in srgb, var(--blue) 60%, transparent); }
.chip--neutral { color: var(--green); border-color: color-mix(in srgb, var(--green) 60%, transparent); }
.chip--unknown { color: var(--amber); border-color: var(--amber-dim); }
.chip--type { color: var(--ink); }
.chip--mock { color: var(--amber); border-style: dashed; border-color: var(--amber-dim); }
.chip--report { color: var(--amber); border-color: var(--amber-dim); }
.intel-conf { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-muted); }
.intel-conf strong { font-weight: 600; color: var(--ink); }
.intel-conf__ring { color: var(--paper-ink); display: inline-flex; }
.intel-summary { margin: 12px 0 4px; font-size: 15px; line-height: 1.5; color: var(--ink); }
.intel-sec { margin-top: 18px; display: grid; gap: 8px; }
.intel-sec h3 {
  margin: 0; padding-bottom: 6px; border-bottom: 1px solid var(--line);
  font: 600 12px/1 var(--font-display); letter-spacing: .12em; text-transform: uppercase; color: var(--ink-muted);
}
.intel-foot { margin: 18px 0 0; font-size: 11px; color: var(--ink-faint); }

.media-facade {
  position: relative; aspect-ratio: 16 / 9; width: 100%; overflow: hidden;
  background: var(--paper) center / cover no-repeat; border: 1px solid var(--line); border-radius: 2px; color: var(--paper-ink);
}
.media-facade__ph { position: absolute; inset: 0; }
.media-facade__ph svg { display: block; }
.media-facade iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.media-facade__cap {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 8px 10px;
  display: grid; grid-template-columns: 1fr auto; grid-template-rows: auto auto; column-gap: 10px; align-items: center;
  background: linear-gradient(to top, color-mix(in srgb, var(--paper) 96%, transparent), color-mix(in srgb, var(--paper) 70%, transparent));
}
.media-facade__title { font: 600 13px/1.25 var(--font-ui); color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.media-facade__note { grid-row: 2; font: 400 11px/1.3 var(--font-mono); color: var(--ink-muted); }
.media-facade__load { grid-row: 1 / span 2; grid-column: 2; }

.xcard { padding: 10px 12px; border: 1px solid var(--line); border-radius: 2px; background: var(--surface-2); }
.xcard__head { display: flex; align-items: center; gap: 8px; }
.xcard__mark {
  width: 22px; height: 22px; display: grid; place-items: center;
  font: 700 12px/1 var(--font-display); color: var(--ink); border: 1px solid var(--line-strong); border-radius: 2px;
}
.xcard__author { font: 500 13px/1 var(--font-mono); color: var(--ink); }
.xcard__text { margin: 8px 0 0; font-size: 14px; }
.xcard__actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.xcard__embed:not(:empty) { margin-top: 10px; }

.intel-news { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.intel-news li { display: grid; gap: 2px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.intel-news li:last-child { border-bottom: 0; }
.intel-news__outlet { font: 600 11px/1 var(--font-display); letter-spacing: .1em; text-transform: uppercase; color: var(--ink-muted); }
.intel-news a { color: var(--ink); text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 3px; }
.intel-news a:hover { color: var(--amber); text-decoration-color: var(--amber); }

/* ---------- overview: news column ---------- */
.theatre[data-mode="overview"] { display: flex; flex-direction: column; overflow-y: auto; overflow-x: hidden; }
.theatre[data-mode="overview"] .theatre-stage { position: relative; inset: auto; flex: 0 0 auto; height: 64vh; min-height: 300px; }
.theatre[data-mode="overview"] .theatre-map { position: absolute; inset: 0; }
.theatre-side { flex: 1 0 auto; padding: 16px; background: var(--surface); border-top: 1px solid var(--line); }
.theatre-side__title {
  margin: 0 0 10px; font: 600 14px/1 var(--font-display); letter-spacing: .12em; text-transform: uppercase; color: var(--ink-muted);
}
.theatre-side__empty { margin: 0; color: var(--ink-faint); font-size: 13px; }

/* ---------- MapLibre control skin ---------- */
.theatre .maplibregl-ctrl-bottom-right, .theatre .maplibregl-ctrl-bottom-left { z-index: 2; }
.theatre .maplibregl-ctrl.maplibregl-ctrl-attrib {
  margin: 0; padding: 3px 8px; max-width: 100%;
  font: 400 10px/16px var(--font-ui); color: var(--ink-muted);
  background: color-mix(in srgb, var(--paper) 85%, transparent);
}
.theatre .maplibregl-ctrl-attrib a { color: var(--ink-muted); }
.theatre .maplibregl-ctrl-attrib a:hover { color: var(--ink); }
.theatre .maplibregl-canvas:focus-visible { outline: 2px solid var(--amber-dim); outline-offset: -2px; }

/* ---------- desktop / tablet ---------- */
@media (min-width: 720px) {
  .theatre-top { top: 12px; left: 12px; right: 12px; flex-direction: row; justify-content: space-between; align-items: flex-start; gap: 12px;
    transition: right 280ms var(--ease); }
  .theatre-hud { max-width: min(460px, 60%); padding: 10px 14px 12px; }
  .theatre-hud__title { font-size: 24px; }
  .layer-chips { flex-direction: column; align-items: stretch; flex-wrap: nowrap; margin-top: calc(var(--chips-top) - 12px); }
  .layer-chip { height: 30px; }
  .scrubber { left: 50%; right: auto; width: min(640px, calc(100% - 24px)); transform: translateX(-50%); bottom: calc(var(--attrib-h) + 10px);
    transition: left 280ms var(--ease); }

  .intel-panel {
    position: absolute; top: 0; bottom: 0; left: auto; right: 0; width: var(--panel-w); height: auto;
    border-top: 0; border-left: 1px solid var(--line-strong); border-radius: 0;
    transform: translateX(100%);
  }
  .intel-panel.open { transform: translateX(0); }
  .intel-panel__handle { display: none; }
  .intel-panel__body { padding: 16px 18px 24px; }
  .theatre.panel-open .theatre-top { right: calc(var(--panel-w) + 12px); }
  .theatre.panel-open .scrubber { left: calc((100% - var(--panel-w)) / 2); width: min(640px, calc(100% - var(--panel-w) - 24px)); }
  .theatre.panel-open .maplibregl-ctrl-bottom-right { right: var(--panel-w); }

  .theatre[data-mode="overview"] { display: grid; grid-template-columns: 1fr 340px; overflow: hidden; }
  .theatre[data-mode="overview"] .theatre-stage { height: auto; min-height: 0; }
  .theatre-side { overflow-y: auto; border-top: 0; border-left: 1px solid var(--line); padding: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  .theatre *, .theatre *::before, .theatre *::after { transition-duration: 0s !important; }
}

/* real-data banner: informational, not a warning */
.theatre .mock-banner.data-banner { color: var(--ink-muted); border-color: var(--line-strong); background: transparent; }

/* ---------- full history: stretch the crawl has not reached (dotted, masks the track) ---------- */
.scrubber__gap {
  position: absolute; top: -5px; height: 2px;
  left: calc(var(--a) * 100%); width: calc((var(--b) - var(--a)) * 100%);
  background: repeating-linear-gradient(90deg, var(--ink-faint) 0 2px, var(--surface) 2px 6px);
}

/* ---------- brief button + sheet (daily / weekly / monthly "what changed") ----------
 * Button: bottom-right above the attribution; where the scrubber could reach
 * it (narrow desktops, mobile) it sits above the scrubber (--scrub-h is set by
 * theatre.js). Sheet: 420px right rail on desktop, 70vh bottom sheet on mobile. */
.brief-btn {
  position: absolute; z-index: 3; right: 8px; bottom: calc(var(--attrib-h) + 6px + var(--scrub-h, 0px) + 8px);
  display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 12px;
  font: 700 13px/1 var(--font-display); letter-spacing: .1em; text-transform: uppercase;
  color: var(--amber); background: color-mix(in srgb, var(--surface) 92%, transparent);
  border: 1px solid var(--amber-dim); border-radius: 2px; cursor: pointer;
  transition: border-color 180ms var(--ease), background-color 180ms var(--ease), right 280ms var(--ease);
}
.brief-btn:hover { border-color: var(--amber); background: color-mix(in srgb, var(--amber) 12%, var(--surface)); }
.brief-btn[aria-expanded="true"] { background: color-mix(in srgb, var(--amber) 14%, var(--surface)); }
.brief-btn__d { font: 500 11px/1 var(--font-mono); letter-spacing: .02em; color: var(--ink-muted); }
.brief-btn__d::before { content: "·"; margin-right: 8px; color: var(--amber-dim); }

.brief-sheet {
  position: fixed; z-index: 20; left: 0; right: 0; bottom: 0; height: 70vh; height: 70dvh;
  display: flex; flex-direction: column;
  background: var(--surface); color: var(--ink);
  border-top: 1px solid var(--line-strong); border-radius: 4px 4px 0 0; box-shadow: var(--shadow);
  transform: translateY(105%); visibility: hidden;
  transition: transform 280ms var(--ease), visibility 0s linear 280ms;
  overscroll-behavior: contain;
}
.brief-sheet.open { transform: translateY(0); visibility: visible; transition: transform 280ms var(--ease), visibility 0s; }
.brief-sheet.dragging { transition: none; }
.brief-sheet__handle { flex: 0 0 auto; display: grid; place-items: center; height: 18px; cursor: grab; touch-action: none; }
.brief-sheet__handle span { width: 40px; height: 4px; border-radius: 2px; background: var(--line-strong); }
.brief-sheet__head { flex: 0 0 auto; position: relative; padding: 4px 56px 10px 16px; }
.brief-sheet__title { margin: 0; font: 700 15px/32px var(--font-display); letter-spacing: .12em; text-transform: uppercase; color: var(--amber); }
.brief-sheet__theatre { color: var(--ink-muted); font-weight: 600; }
.brief-sheet .brief-sheet__close { top: 4px; right: 12px; }
.brief-tabs { flex: 0 0 auto; display: grid; grid-template-columns: repeat(3, 1fr); margin: 0 16px; }
.brief-tab {
  height: 32px; margin-left: -1px; cursor: pointer;
  font: 600 12px/1 var(--font-display); letter-spacing: .12em; text-transform: uppercase; color: var(--ink-muted);
  background: transparent; border: 1px solid var(--line-strong); border-radius: 0;
  transition: color 180ms var(--ease), border-color 180ms var(--ease), background-color 180ms var(--ease);
}
.brief-tab:first-child { margin-left: 0; border-radius: 2px 0 0 2px; }
.brief-tab:last-child { border-radius: 0 2px 2px 0; }
.brief-tab:hover { color: var(--ink); }
.brief-tab[aria-selected="true"] { position: relative; color: var(--amber); border-color: var(--amber-dim); background: color-mix(in srgb, var(--amber) 10%, transparent); }
.brief-sheet__body { flex: 1 1 auto; overflow-y: auto; padding: 14px 16px 24px; }
.brief-sheet__body:focus-visible { outline-offset: -2px; }

.brief-empty { margin: 8px 0 0; font-size: 14px; color: var(--ink-muted); }
.brief-empty--tz { font-size: 11px; color: var(--ink-faint); letter-spacing: .04em; }
.brief-when__kicker { margin: 0; font: 600 11px/1 var(--font-display); letter-spacing: .14em; text-transform: uppercase; color: var(--amber); }
.brief-when__title { margin: 6px 0 0; font: 700 22px/1.15 var(--font-display); letter-spacing: .02em; color: var(--ink); }
.brief-when__zone { margin: 4px 0 0; font-size: 11px; color: var(--ink-muted); letter-spacing: .02em; }
.brief-sheet .mock-banner { margin-top: 10px; }
.brief-narrative { margin-top: 14px; }
.brief-narrative p { margin: 0 0 10px; font: 400 15px/1.6 var(--font-serif); color: var(--ink); }
.brief-ribbon {
  display: inline-block; margin: 0 0 10px !important; padding: 3px 8px;
  font: 600 11px/1.3 var(--font-display) !important; letter-spacing: .12em; text-transform: uppercase;
  color: var(--amber) !important; background: color-mix(in srgb, var(--amber) 12%, transparent); border: 1px solid var(--amber); border-radius: 2px;
}
.brief-bullets { margin: 12px 0 0; padding: 0 0 0 16px; display: grid; gap: 4px; font-size: 13.5px; line-height: 1.45; color: var(--ink-muted); list-style: square; }
.brief-bullets li::marker { color: var(--line-strong); }
.brief-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(84px, 1fr)); gap: 6px; margin-top: 14px; }
.brief-stat { display: grid; gap: 4px; padding: 8px 9px; min-width: 0; border: 1px solid var(--line); border-radius: 2px; background: var(--surface-2); }
.brief-stat__v { font-size: 20px; line-height: 1; color: var(--ink); white-space: nowrap; }
.brief-stat__v--hostile { color: var(--red); }
.brief-stat__v--friendly { color: var(--blue); }
.brief-stat__v--neutral { color: var(--green); }
.brief-stat__v--unknown { color: var(--amber); }
.brief-stat__k { font: 600 10.5px/1.2 var(--font-display); letter-spacing: .1em; text-transform: uppercase; color: var(--ink-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brief-sec { margin-top: 18px; }
.brief-sec h4 {
  margin: 0 0 8px; padding-bottom: 6px; border-bottom: 1px solid var(--line);
  font: 600 12px/1 var(--font-display); letter-spacing: .12em; text-transform: uppercase; color: var(--ink-muted);
}
.brief-vs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 0; padding: 0; list-style: none; }
.brief-vs__item { display: grid; gap: 3px; }
.brief-vs__k { font: 600 10.5px/1 var(--font-display); letter-spacing: .1em; text-transform: uppercase; color: var(--ink-faint); }
.brief-vs__v { font-size: 14px; color: var(--ink-muted); }
.brief-vs__v.is-up, .brief-vs__v.is-down { color: var(--ink); }
.brief-places { display: grid; gap: 4px; margin: 0; padding: 0; list-style: none; }
.brief-places__row {
  width: 100%; display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 8px; padding: 6px 8px 6px 7px;
  font: 500 13px/1.25 var(--font-ui); color: var(--ink); text-align: left;
  background: var(--surface-2); border: 1px solid var(--line); border-left: 3px solid var(--ink-faint); border-radius: 2px;
}
button.brief-places__row { cursor: pointer; transition: border-color 180ms var(--ease), color 180ms var(--ease); }
button.brief-places__row:hover { border-top-color: var(--amber-dim); border-right-color: var(--amber-dim); border-bottom-color: var(--amber-dim); color: var(--amber); }
.brief-places__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brief-places__to { font-size: 12px; color: var(--ink-muted); white-space: nowrap; }
.brief-places__date { font-size: 11px; color: var(--ink-faint); }
.brief-places__more { font-size: 11px; color: var(--ink-faint); padding: 2px 0 0 4px; }
.brief-foot { margin: 18px 0 0; font-size: 11px; color: var(--ink-faint); }
.brief-foot a { color: var(--ink-muted); }

/* ---------- posture: HUD column, Posture Index tile, class chips ---------- */
.theatre-hudcol { align-self: flex-start; display: flex; flex-direction: column; gap: 8px; max-width: 100%; min-width: 0; }
.theatre-hudcol .theatre-hud { max-width: 100%; align-self: stretch; }
.posture-tile {
  padding: 9px 12px 10px; min-width: 0;
  background: color-mix(in srgb, var(--surface) 90%, transparent); border: 1px solid var(--line); border-radius: 4px;
}
.posture-tile__empty { margin: 0; font-size: 12px; color: var(--ink-faint); }
.posture-tile__head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.posture-tile__title { margin: 0; font: 600 12px/1 var(--font-display); letter-spacing: .14em; text-transform: uppercase; color: var(--amber); }
.posture-tile__flag { padding: 2px 5px; font-size: 10px; color: var(--ink-muted); border: 1px solid var(--line-strong); border-radius: 2px; white-space: nowrap; }
.posture-tile__warm { margin: 8px 0 0; font: 700 15px/1.2 var(--font-display); letter-spacing: .08em; text-transform: uppercase; color: var(--ink); }
.posture-tile__warm .mono { font: 500 12px/1 var(--font-mono); letter-spacing: 0; text-transform: none; color: var(--ink-muted); }
.posture-tile__main { display: flex; align-items: baseline; flex-wrap: wrap; gap: 2px 6px; margin-top: 6px; }
.posture-tile__num { font-size: 34px; line-height: 1; font-weight: 500; color: var(--amber); }
.posture-tile__of { font-size: 12px; color: var(--ink-faint); margin-right: 8px; }
.posture-tile__comps { display: flex; flex-wrap: wrap; gap: 2px 10px; margin: 0; padding: 0; list-style: none; font-size: 12px; color: var(--ink); }
.posture-tile__comps li { display: inline-flex; gap: 5px; align-items: baseline; }
.posture-tile__comps li.is-off { color: var(--ink-faint); }
.posture-tile__k { font: 600 10.5px/1 var(--font-display); letter-spacing: .1em; text-transform: uppercase; color: var(--ink-muted); }
.posture-tile__row { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; margin-top: 9px; padding-top: 8px; border-top: 1px solid var(--line); }
.posture-tile__flights { display: grid; gap: 4px; min-width: 0; }
.posture-tile__total { font-size: 18px; line-height: 1; color: var(--ink); }
.posture-tile__cls { display: flex; flex-wrap: wrap; gap: 2px 10px; margin: 0; padding: 0; list-style: none; font-size: 11px; color: var(--ink-muted); }
.posture-tile__cls li { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.posture-tile__sw svg { display: block; }
.posture-tile__spark { flex: 0 0 auto; display: grid; gap: 4px; justify-items: end; }
.posture-spark { display: block; overflow: visible; }

.layer-chip__n { margin-left: auto; padding-left: 8px; font-size: 10.5px; font-weight: 400; color: var(--ink-faint); letter-spacing: 0; }
.layer-chip[aria-pressed="true"] .layer-chip__n { color: var(--ink-muted); }
.layer-chips__rule { flex: 0 0 auto; align-self: stretch; width: 1px; background: var(--line); }
@media (max-width: 719.98px) {
  .theatre[data-mode="posture"] .layer-chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; overscroll-behavior-x: contain; margin: 0 -8px; padding: 0 8px; }
  .theatre[data-mode="posture"] .layer-chips::-webkit-scrollbar { display: none; }
  .theatre[data-mode="posture"] .layer-chip { flex: 0 0 auto; }
  .theatre[data-mode="posture"] .theatre-hudcol { width: 100%; }
  .posture-tile { padding: 7px 10px 8px; }
  .posture-tile__num { font-size: 28px; }
  .posture-tile__row { margin-top: 6px; padding-top: 6px; }
  .posture-tile__cls { display: none; }   /* the class chips below carry the per-class counts on phones */
}

/* intel panel: aircraft */
.intel-head__sym--ac { width: 56px; height: 56px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 2px; background: var(--paper); }
.intel-head__sym--ac svg { transform: rotate(var(--rot, 0deg)); }
.chip--ac { color: var(--ac); border-color: color-mix(in srgb, var(--ac) 60%, transparent); }
.intel-dl { display: grid; grid-template-columns: 84px minmax(0, 1fr); margin: 12px 0 0; }
.intel-dl dt, .intel-dl dd { margin: 0; padding: 7px 0; border-bottom: 1px solid var(--line); }
.intel-dl dt { font: 600 11px/1.4 var(--font-display); letter-spacing: .1em; text-transform: uppercase; color: var(--ink-muted); }
.intel-dl dd { font-size: 13px; color: var(--ink); overflow-wrap: anywhere; }

@media (min-width: 720px) {
  .brief-btn { right: 12px; bottom: calc(var(--attrib-h) + 10px); }
  .theatre.panel-open .brief-btn { right: calc(var(--panel-w) + 12px); }
  .theatre-hudcol { max-width: min(460px, 60%); }
  .layer-chips__rule { width: auto; height: 1px; margin: 2px 0; }

  .brief-sheet {
    position: absolute; top: 0; bottom: 0; left: auto; right: 0; width: 420px; height: auto;
    border-top: 0; border-left: 1px solid var(--line-strong); border-radius: 0;
    transform: translateX(100%);
  }
  .brief-sheet.open { transform: translateX(0); }
  .brief-sheet__handle { display: none; }
  .brief-sheet__head { padding-top: 12px; }
  .brief-sheet .brief-sheet__close { top: 12px; }
  .brief-sheet__body { padding: 16px 18px 24px; }
  .theatre.brief-open .theatre-top { right: calc(420px + 12px); }
  .theatre.brief-open .scrubber { left: calc((100% - 420px) / 2); width: min(640px, calc(100% - 420px - 24px)); }
  .theatre.brief-open .scrubber.scrubber--history { width: min(760px, calc(100% - 420px - 24px)); }
  .theatre.brief-open .maplibregl-ctrl-bottom-right { right: 420px; }
}
/* desktop widths where the centred scrubber reaches the right edge: lift the button above it */
@media (min-width: 720px) and (max-width: 1099.98px) {
  .theatre[data-mode="deep"] .brief-btn { bottom: calc(var(--attrib-h) + 10px + var(--scrub-h, 0px) + 8px); }
}

/* ---------- posture: index components, bases, Taiwan MND tile, Japan JSO strip ---------- */
.posture-tile__w { font-size: 11px; color: var(--ink-muted); }
.pi-comps { margin-top: 8px; }
.pi-comps__sum, .fold-tile__head { display: flex; align-items: center; gap: 8px; cursor: pointer; list-style: none; }
.pi-comps__sum::-webkit-details-marker, .fold-tile__head::-webkit-details-marker { display: none; }
.pi-comps__sum::after, .fold-tile__head::after {
  content: ""; flex: 0 0 auto; width: 6px; height: 6px; margin-left: auto; margin-right: 2px;
  border-right: 1.5px solid var(--ink-muted); border-bottom: 1.5px solid var(--ink-muted);
  transform: translateY(-2px) rotate(45deg); transition: transform 180ms var(--ease);
}
.pi-comps[open] > .pi-comps__sum::after, .fold-tile[open] > .fold-tile__head::after { transform: translateY(1px) rotate(-135deg); }
.pi-comps__sum:focus-visible, .fold-tile__head:focus-visible { outline: 2px solid var(--amber-dim); outline-offset: 2px; }
.pi-comps__hint { font-size: 10.5px; color: var(--ink-faint); }
.pi-table { margin: 6px 0 0; padding: 0; list-style: none; display: grid; gap: 1px; }
.pi-row { display: grid; grid-template-columns: minmax(0, 1fr) 52px 52px 46px 38px; align-items: center; column-gap: 6px; min-height: 19px; font-size: 11.5px; color: var(--ink); }
.pi-row--head { min-height: 14px; font: 600 9.5px/1 var(--font-display); letter-spacing: .1em; text-transform: uppercase; color: var(--ink-faint); }
.pi-row--head span:nth-child(2), .pi-row--head span:nth-child(3) { text-align: right; }
.pi-row__k { font: 600 10.5px/1.2 var(--font-display); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pi-row__v, .pi-row__m { text-align: right; white-space: nowrap; }
.pi-row__m { color: var(--ink-muted); }
.pi-row__bar { display: flex; align-items: center; }
.pi-row__bar svg { display: block; }
.pi-row__z { text-align: right; font-size: 11px; white-space: nowrap; }
.pi-row.is-off, .pi-row.is-off .pi-row__k, .pi-row.is-off .pi-row__m { color: var(--ink-faint); }

/* fold tiles (MND, JSO): summary line; body folds on phones */
.fold-tile__head { min-height: 18px; }
.fold-tile__sum { font-size: 10.5px; color: var(--ink-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.fold-tile[open] .fold-tile__sum { display: none; }
.fold-tile__body { margin-top: 7px; }
.tile-attrib { margin: 7px 0 0; font-size: 10px; line-height: 1.35; color: var(--ink-faint); }

.mnd-when { margin: 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 4px; font-size: 11px; color: var(--ink); }
.mnd-when__p { color: var(--ink-muted); }
.mnd-latest {
  margin-left: auto; height: 20px; padding: 0 7px; font: 600 10.5px/1 var(--font-display); letter-spacing: .1em; text-transform: uppercase;
  color: var(--amber); background: none; border: 1px solid var(--amber-dim); border-radius: 2px; cursor: pointer;
}
.mnd-stats { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; margin: 8px 0 8px; }
.mnd-stat { min-width: 0; }
.mnd-stat dt { font: 600 9.5px/1.1 var(--font-display); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mnd-stat dd { margin: 3px 0 0; font-size: 17px; line-height: 1; color: var(--ink); }
.mnd-stat--air dd { color: color-mix(in srgb, var(--red) 55%, var(--ink)); }
.mnd-chartbox { position: relative; }
.mnd-chart { display: block; overflow: visible; }
.mnd-bar { cursor: pointer; outline: none; }
.mnd-bar > rect:first-child { transition: fill 180ms var(--ease); }
.mnd-bar:hover > rect:first-child { fill: color-mix(in srgb, var(--ink) 7%, transparent); }
.mnd-bar:focus-visible > rect:first-child { fill: color-mix(in srgb, var(--amber) 14%, transparent); }
.mnd-axis { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 3px; font-size: 10px; color: var(--ink-faint); }
.mnd-legend { display: inline-flex; align-items: center; gap: 4px; color: var(--ink-muted); }
.mnd-legend span { margin-right: 4px; }
.mnd-key { display: inline-block; width: 7px; height: 7px; }
.mnd-key--ac { background: color-mix(in srgb, var(--red) 38%, transparent); }
.mnd-key--adiz { background: var(--red); }
.mnd-key--ships { width: 10px; height: 1.5px; background: var(--ink-muted); }
.mnd-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; margin-top: 7px; font-size: 12px; }
.mnd-link { color: var(--amber); text-decoration: none; border-bottom: 1px solid var(--amber-dim); }
.mnd-link:hover { color: var(--ink); }
.mnd-link--btn { padding: 0; font: inherit; background: none; border-width: 0 0 1px; cursor: pointer; }
.mnd-nomap { color: var(--ink-faint); font-size: 11px; }
.mnd-fig { margin: 14px 0 0; }
.mnd-fig img { display: block; width: 100%; height: auto; min-height: 120px; background: var(--paper); border: 1px solid var(--line); }
.mnd-fig figcaption { margin-top: 5px; font-size: 10px; line-height: 1.35; color: var(--ink-faint); }

.jso-list { margin: 0; padding: 0; list-style: none; }
.jso-list li + li { border-top: 1px solid var(--line); }
.jso-row { display: grid; grid-template-columns: 44px minmax(0, auto) minmax(0, 1fr); column-gap: 8px; align-items: baseline; padding: 4px 0; font-size: 12px; line-height: 1.35; color: var(--ink); text-decoration: none; }
a.jso-row:hover .jso-row__t { color: var(--amber); }
a.jso-row:focus-visible { outline: 2px solid var(--amber-dim); outline-offset: 1px; }
.jso-row__d { font-size: 11px; color: var(--ink-muted); white-space: nowrap; }
.jso-row__n { font: 600 10.5px/1.35 var(--font-display); letter-spacing: .08em; text-transform: uppercase; white-space: nowrap; }
.jso-row__n--red { color: var(--red); }
.jso-row__n--blue { color: var(--blue); }
.jso-row__n--neutral { color: var(--ink-muted); }
.jso-row__t { min-width: 0; overflow-wrap: anywhere; transition: color 180ms var(--ease); }

/* intel panel: base / MND */
.intel-head__sym--base { width: 56px; height: 56px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 2px; background: var(--paper); }
.chip--bloc-red { color: var(--red); border-color: color-mix(in srgb, var(--red) 60%, transparent); }
.chip--bloc-blue { color: var(--blue); border-color: color-mix(in srgb, var(--blue) 60%, transparent); }
.intel-links { margin-top: 14px; }

/* posture HUD column: fixed width on wider screens; it scrolls inside the map when the tiles outgrow it */
.theatre[data-mode="posture"] .theatre-top { bottom: calc(var(--attrib-h) + 10px); }
.theatre[data-mode="posture"] .theatre-hudcol { max-height: 58%; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
@media (min-width: 720px) {
  .theatre[data-mode="posture"] .theatre-hudcol { width: min(410px, 60%); max-height: 100%; }
}
@media (max-width: 719.98px) {
  .mnd-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .pi-row { grid-template-columns: minmax(0, 1fr) 48px 48px 46px 36px; }
}
@media (max-width: 719.98px) {
  .fold-tile { padding: 6px 10px 7px; }
}
