/* Forty Days — night-chart theme.
   Sea ink, umber for Iran, chart blue for the coalition, amber for oil. */
:root {
  --ink: #08121a;
  --panel: #0e1c27;
  --panel-2: #132533;
  --raise: #1a3042;
  --line: #213747;
  --line-2: #31506a;
  --paper: #efe8d6;
  --text: #cbd4d7;
  --muted: #8399a6;
  --faint: #5a7080;
  --blue: #62b2ee;
  --blue-deep: #1f4f78;
  --red: #f0634a;
  --red-deep: #7a2a1d;
  --amber: #e9ae3f;
  --green: #7fc79d;
  --serif: 'Newsreader', 'Iowan Old Style', 'Palatino Linotype', Georgia, serif;
  --sans: 'Archivo', 'Helvetica Neue', Arial, sans-serif;
  --tight: 82%;
  --tighter: 70%;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--ink);
  color: var(--text);
  font: 400 13px/1.45 var(--sans);
  font-stretch: 92%;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; text-align: inherit; }
button:disabled { cursor: not-allowed; }
:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }
[hidden] { display: none !important; }
h1, h2, h3, p { margin: 0; }
.num { font-variant-numeric: tabular-nums; }
.est::before { content: '≈'; opacity: 0.6; margin-right: 1px; }

/* ---------- frame ---------- */
.app {
  display: grid;
  grid-template-columns: 304px minmax(0, 1fr) 348px;
  grid-template-rows: auto minmax(0, 1fr) auto;
  grid-template-areas: 'top top top' 'orders map intel' 'wire wire wire';
  height: 100vh;
  height: 100dvh;
}
.top { grid-area: top; }
.orders { grid-area: orders; }
.mapwrap { grid-area: map; }
.intel { grid-area: intel; }
.wire { grid-area: wire; }

/* ---------- top strip ---------- */
.top {
  display: flex; align-items: stretch;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  min-height: 62px;
}
.brand { display: flex; flex-direction: column; justify-content: center; padding: 0 18px 0 16px; width: 304px; flex: none; border-right: 1px solid var(--line); }
.brand .mark { font: italic 500 25px/1 var(--serif); color: var(--paper); letter-spacing: -0.01em; }
.brand .side { margin-top: 5px; font-size: 11.5px; font-stretch: var(--tight); color: var(--muted); }
.brand .side b { font-weight: 600; }
.side-CO b { color: var(--blue); }
.side-IR b { color: var(--red); }

.clock { display: flex; flex-direction: column; justify-content: center; padding: 0 18px; border-right: 1px solid var(--line); flex: none; }
.clock .date { font: 500 17px/1.1 var(--serif); color: var(--paper); white-space: nowrap; }
.clock .day { font-size: 11.5px; font-stretch: var(--tight); color: var(--muted); margin-top: 3px; }
.clock .ticks { display: flex; gap: 2px; margin-top: 6px; }
.clock .ticks i { width: 7px; height: 3px; background: var(--line-2); flex: none; }
.clock .ticks i.done { background: var(--muted); }
.clock .ticks i.now { background: var(--amber); }

.gauges { display: flex; flex: 1; min-width: 0; }
.gauge { flex: 1 1 0; min-width: 0; padding: 9px 8px 8px 9px; border-right: 1px solid var(--line); display: flex; flex-direction: column; justify-content: center; position: relative; }
.gauge .lab { font-size: 11px; font-stretch: var(--tight); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gauge .row { display: flex; align-items: baseline; gap: 7px; margin-top: 1px; }
.gauge .val { font-size: 21px; font-weight: 600; font-stretch: 86%; color: var(--paper); line-height: 1.1; }
.gauge .val small { font-size: 12px; font-weight: 500; color: var(--muted); margin-left: 1px; }
.gauge .delta { font-size: 11px; font-stretch: var(--tight); color: var(--faint); white-space: nowrap; }
.gauge .delta.up { color: var(--amber); }
.gauge .delta.dn { color: var(--muted); }
.gauge .bar { height: 3px; background: var(--line); margin-top: 6px; position: relative; }
.gauge .bar i { position: absolute; left: 0; top: 0; bottom: 0; background: var(--muted); }
.gauge.oil .val { color: var(--amber); }
.gauge.oil .bar i, .gauge.flow .bar i { background: var(--amber); }
.gauge.co .bar i { background: var(--blue); }
.gauge.ir .bar i { background: var(--red); }
.gauge svg.spark { display: block; width: 100%; height: 11px; margin-top: 2px; overflow: visible; }
.gauge.warn .val { color: var(--red); }

.topbtns { display: flex; align-items: center; gap: 6px; padding: 0 10px; flex: none; }
.ghost { padding: 6px 10px; border: 1px solid var(--line-2); color: var(--text); font-size: 12px; font-stretch: var(--tight); }
.ghost:hover { background: var(--raise); color: var(--paper); }

/* ---------- side panels ---------- */
.orders, .intel { background: var(--panel); display: flex; flex-direction: column; min-height: 0; }
.orders { border-right: 1px solid var(--line); }
.intel { border-left: 1px solid var(--line); }
.scroll { overflow-y: auto; min-height: 0; flex: 1; scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }

.phead { padding: 13px 16px 11px; border-bottom: 1px solid var(--line); }
.phead h2 { font: 500 17px/1.2 var(--serif); color: var(--paper); }
.phead .sub { color: var(--muted); font-size: 12px; font-stretch: var(--tight); margin-top: 4px; display: flex; align-items: center; gap: 8px; }
.pips { display: inline-flex; gap: 3px; }
.pips i { width: 9px; height: 9px; border: 1px solid var(--muted); border-radius: 50%; }
.pips i.on { background: var(--paper); border-color: var(--paper); }
.pips i.used { background: var(--amber); border-color: var(--amber); }

.cat { padding: 10px 16px 3px; font-size: 11.5px; font-stretch: var(--tight); color: var(--faint); font-weight: 600; }
.op {
  display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 8px;
  width: 100%; padding: 6px 16px; border-left: 2px solid transparent;
}
.op .nm { color: var(--text); font-weight: 500; }
.op .cost { display: inline-flex; gap: 2px; }
.op .cost i { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); }
.op .cost.free { font-size: 11px; color: var(--faint); }
.op:hover:not(.off), .op:focus-visible:not(.off) { background: var(--panel-2); border-left-color: var(--amber); }
.op:hover:not(.off) .nm { color: var(--paper); }
.op.off .nm { color: var(--faint); }
.op.off .cost i { background: var(--line-2); }
.op.armed { background: var(--raise); border-left-color: var(--amber); }
.op.armed .nm { color: var(--paper); }
.op .why { grid-column: 1 / -1; font-size: 11px; font-stretch: var(--tight); color: var(--faint); margin-top: -3px; }

.plan { border-top: 1px solid var(--line); background: var(--panel-2); flex: none; max-height: 46%; display: flex; flex-direction: column; }
.plan h3 { font: 500 14px/1.2 var(--serif); color: var(--paper); padding: 10px 16px 6px; }
.plan .list { overflow-y: auto; padding: 0 8px 4px 16px; min-height: 0; }
.plan .empty { color: var(--muted); font: italic 400 13.5px/1.4 var(--serif); padding: 0 8px 8px 0; }
.ord { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: start; padding: 4px 0; border-top: 1px solid var(--line); }
.ord:first-child { border-top: 0; }
.ord .t { color: var(--paper); font-weight: 500; }
.ord .s { color: var(--muted); font-size: 12px; font-stretch: var(--tight); }
.ord .x { color: var(--faint); width: 22px; height: 22px; text-align: center; line-height: 20px; font-size: 15px; }
.ord .x:hover { color: var(--red); }
.doctrine { padding: 6px 16px 2px; display: grid; grid-template-columns: auto 1fr; gap: 4px 10px; align-items: center; font-size: 12px; font-stretch: var(--tight); color: var(--muted); border-top: 1px solid var(--line); }
.seg { display: inline-flex; border: 1px solid var(--line-2); }
.seg button { padding: 2px 8px; font-size: 11.5px; color: var(--muted); }
.seg button + button { border-left: 1px solid var(--line-2); }
.seg button[aria-pressed='true'] { background: var(--raise); color: var(--paper); }
.go { margin: 10px 16px 14px; padding: 11px 14px; background: var(--amber); color: #1b1304; font-weight: 700; font-size: 14px; font-stretch: 96%; text-align: center; }
.go:hover { background: #f6c259; }
.go:disabled { background: var(--line-2); color: var(--faint); }

/* ---------- map ---------- */
.mapwrap { position: relative; min-width: 0; min-height: 0; background: #0a1822; overflow: hidden; }
#map { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: grab; touch-action: none; }
#map.drag { cursor: grabbing; }
#map.pick { cursor: crosshair; }
#map.hot { cursor: pointer; }
.map-tools { position: absolute; top: 12px; right: 12px; display: flex; flex-direction: column; border: 1px solid var(--line-2); background: rgba(14, 28, 39, 0.9); }
.map-tools button { width: 32px; height: 28px; text-align: center; font-size: 15px; color: var(--text); }
.map-tools button:last-child { font-size: 11px; }
.map-tools button + button { border-top: 1px solid var(--line-2); }
.map-tools button:hover { background: var(--raise); color: var(--paper); }
.legend { position: absolute; left: 12px; top: 12px; display: flex; flex-wrap: wrap; gap: 4px 12px; max-width: 62%; font-size: 11.5px; font-stretch: var(--tight); color: var(--muted); pointer-events: none; }
.legend span { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.legend svg { width: 12px; height: 12px; overflow: visible; }

.banner { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); background: var(--amber); color: #1b1304; padding: 7px 14px; font-weight: 600; display: flex; gap: 14px; align-items: center; box-shadow: 0 6px 24px rgba(0, 0, 0, 0.45); white-space: nowrap; z-index: 3; }
.banner button { text-decoration: underline; font-weight: 500; }

.sitecard { position: absolute; left: 12px; bottom: 12px; width: 330px; max-width: calc(100% - 24px); background: rgba(14, 28, 39, 0.96); border: 1px solid var(--line-2); padding: 13px 15px 12px; box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5); z-index: 2; }
.sitecard .kind { font-size: 11.5px; font-stretch: var(--tight); color: var(--muted); display: flex; justify-content: space-between; gap: 8px; padding-right: 26px; }
.sitecard h3 { font: 500 19px/1.2 var(--serif); color: var(--paper); margin: 2px 22px 6px 0; }
.sitecard p { font: 400 14px/1.42 var(--serif); color: var(--text); }
.sitecard .close { position: absolute; right: 8px; top: 8px; width: 24px; height: 24px; text-align: center; color: var(--muted); font-size: 16px; }
.sitecard .close:hover { color: var(--paper); }
.meter { display: grid; grid-template-columns: auto 1fr auto; gap: 8px; align-items: center; margin: 8px 0 0; font-size: 12px; font-stretch: var(--tight); color: var(--muted); }
.meter .track { height: 4px; background: var(--line); position: relative; }
.meter .track i { position: absolute; left: 0; top: 0; bottom: 0; }
.meter b { color: var(--paper); font-weight: 600; }
.sitecard .facts { margin-top: 8px; font-size: 12px; font-stretch: var(--tight); color: var(--muted); display: grid; grid-template-columns: 1fr 1fr; gap: 2px 12px; }
.sitecard .facts b { color: var(--paper); font-weight: 600; }
.sitecard .warn { margin-top: 8px; font: italic 400 13px/1.35 var(--serif); color: var(--amber); }
.sitecard { max-height: calc(100% - 24px); overflow-y: auto; scrollbar-width: thin; }
.sitecard .facts .wide { grid-column: 1 / -1; }
.sitecard .real1 { margin-top: 9px; padding-left: 9px; border-left: 2px solid var(--line-2); font: 400 13px/1.38 var(--serif); color: var(--muted); }
.sitecard .real1 b { font: 600 11.5px/1.2 var(--sans); font-stretch: var(--tight); color: var(--text); }
.sitecard .fxline { margin-top: 4px; font-size: 12px; font-stretch: var(--tight); color: var(--muted); }
.sitecard .fxline.live { color: var(--amber); }
.sitecard .hist { margin-top: 12px; padding-top: 9px; border-top: 1px solid var(--line); }
.sitecard .hist h4 { font-size: 11.5px; font-weight: 600; font-stretch: var(--tight); color: var(--muted); margin: 0 0 4px; }
.sitecard .hist .ln { font: 400 13px/1.38 var(--serif); color: var(--text); padding: 3px 0 3px 9px; border-left: 2px solid var(--line-2); margin-top: 4px; }
.sitecard .hist .ln.CO { border-left-color: var(--blue); }
.sitecard .hist .ln.IR { border-left-color: var(--red); }
.sitecard .hist .ln b { font: 600 11.5px/1.2 var(--sans); font-stretch: var(--tight); color: var(--muted); margin-right: 4px; }
.acts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 11px; }
.act { padding: 5px 9px; border: 1px solid var(--line-2); color: var(--paper); font-size: 12px; font-weight: 500; font-stretch: var(--tight); display: inline-flex; align-items: center; gap: 6px; }
.act:hover:not(:disabled) { background: var(--amber); border-color: var(--amber); color: #1b1304; }
.act:disabled { color: var(--faint); border-color: var(--line); }
.act .cost { display: inline-flex; gap: 2px; }
.act .cost i { width: 5px; height: 5px; border-radius: 50%; background: currentColor; opacity: 0.7; }

.feed { position: absolute; right: 12px; bottom: 12px; width: 400px; max-width: calc(100% - 24px); background: rgba(8, 18, 26, 0.94); border: 1px solid var(--line-2); padding: 12px 15px; z-index: 4; box-shadow: 0 10px 40px rgba(0, 0, 0, 0.55); }
.feed .who { font-size: 11.5px; font-stretch: var(--tight); font-weight: 600; display: flex; justify-content: space-between; }
.feed .who.CO { color: var(--blue); }
.feed .who.IR { color: var(--red); }
.feed .who span:last-child { color: var(--faint); font-weight: 400; }
.feed h4 { font: 500 17px/1.25 var(--serif); color: var(--paper); margin: 3px 0 4px; }
.feed p { font: 400 14px/1.42 var(--serif); color: var(--text); min-height: 3.9em; }
.feed .ctl { display: flex; justify-content: flex-end; gap: 6px; margin-top: 8px; }

/* ---------- intel ---------- */
.tabs { display: flex; border-bottom: 1px solid var(--line); flex: none; }
.tabs button { flex: 1; padding: 12px 4px 10px; text-align: center; color: var(--muted); font-weight: 500; border-bottom: 2px solid transparent; }
.tabs button:hover { color: var(--paper); }
.tabs button[aria-selected='true'] { color: var(--paper); border-bottom-color: var(--amber); }
.pane { padding: 4px 16px 18px; }
.sec { margin-top: 14px; }
.sec > h3 { font: 500 15px/1.2 var(--serif); color: var(--paper); padding-bottom: 5px; border-bottom: 1px solid var(--line); margin-bottom: 6px; display: flex; justify-content: space-between; align-items: baseline; }
.sec > h3 small { font: 400 11.5px/1 var(--sans); font-stretch: var(--tight); color: var(--faint); }
.stat { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; padding: 4px 0; align-items: baseline; }
.stat .k { color: var(--text); }
.stat .v { color: var(--paper); font-weight: 600; text-align: right; }
.stat .v small { color: var(--muted); font-weight: 400; }
.stat .b { grid-column: 1 / -1; height: 3px; background: var(--line); position: relative; }
.stat .b i { position: absolute; left: 0; top: 0; bottom: 0; background: var(--muted); }
.stat .b i.co { background: var(--blue); }
.stat .b i.ir { background: var(--red); }
.stat .b i.am { background: var(--amber); }
.stat .n { grid-column: 1 / -1; color: var(--faint); font-size: 11.5px; font-stretch: var(--tight); }
.chips { display: flex; flex-wrap: wrap; gap: 4px; padding: 2px 0 4px; }
.chip { font-size: 11.5px; font-stretch: var(--tight); padding: 2px 7px; border: 1px solid var(--line-2); color: var(--text); }
.chip.on { border-color: var(--blue); color: var(--blue); }
.chip.hot { border-color: var(--red); color: var(--red); }
.chip.off { color: var(--faint); border-color: var(--line); text-decoration: line-through; }
.note { font: italic 400 13.5px/1.4 var(--serif); color: var(--muted); padding: 4px 0; }

.actor { padding: 11px 0 12px; border-bottom: 1px solid var(--line); }
.actor:last-child { border-bottom: 0; }
.actor .hd { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.actor .hd b { font: 500 15.5px/1.2 var(--serif); color: var(--paper); }
.actor .hd span { font-size: 11.5px; font-stretch: var(--tight); color: var(--muted); text-align: right; }
.stance { position: relative; height: 16px; margin: 7px 0 2px; }
.stance::before { content: ''; position: absolute; left: 0; right: 0; top: 7px; height: 2px; background: linear-gradient(90deg, var(--red-deep), var(--line-2) 45%, var(--line-2) 55%, var(--blue-deep)); }
.stance .mid { position: absolute; left: 50%; top: 3px; width: 1px; height: 10px; background: var(--faint); }
.stance .thr { position: absolute; top: 4px; width: 1px; height: 8px; background: var(--muted); opacity: 0.6; }
.stance .dot { position: absolute; top: 3px; width: 10px; height: 10px; margin-left: -5px; border-radius: 50%; background: var(--paper); border: 2px solid var(--panel); box-shadow: 0 0 0 1px var(--paper); }
.stance-ends { display: flex; justify-content: space-between; font-size: 11px; font-stretch: var(--tight); color: var(--faint); }
.actor p { font: 400 13.5px/1.4 var(--serif); color: var(--text); margin-top: 6px; }
.actor .fx { margin-top: 6px; font-size: 12px; font-stretch: var(--tight); color: var(--muted); }
.actor .fx.live { color: var(--amber); }

.bigfig { display: flex; align-items: baseline; gap: 10px; margin-top: 12px; }
.bigfig .n { font-size: 40px; font-weight: 600; font-stretch: 80%; color: var(--amber); line-height: 1; }
.bigfig .u { color: var(--muted); font-size: 12px; font-stretch: var(--tight); }
.chart { width: 100%; height: 132px; margin-top: 8px; display: block; overflow: visible; }
.chart text { font: 400 10px var(--sans); fill: var(--faint); font-stretch: var(--tight); }

.logturn { margin-top: 14px; }
.logturn > h3 { font: 500 15px/1.2 var(--serif); color: var(--paper); border-bottom: 1px solid var(--line); padding-bottom: 5px; margin-bottom: 6px; }
.logturn .hl { font: 500 14px/1.38 var(--serif); color: var(--paper); padding: 3px 0 3px 10px; border-left: 2px solid var(--muted); margin: 5px 0; }
.hl.co { border-left-color: var(--blue); }
.hl.ir { border-left-color: var(--red); }
.hl.mkt { border-left-color: var(--amber); }
.hl.big { border-left-color: var(--paper); }
.hl.bad { border-left-color: var(--red); }
.logline { padding: 4px 0; font-size: 12.5px; color: var(--text); }
.logline b { font-weight: 600; }
.logline.CO b { color: var(--blue); }
.logline.IR b { color: var(--red); }

/* ---------- wire ---------- */
.wire { display: flex; align-items: center; gap: 0; background: var(--panel); border-top: 1px solid var(--line); height: 32px; overflow: hidden; white-space: nowrap; }
.wire .tag { flex: none; padding: 0 12px 0 16px; color: var(--amber); font-weight: 600; font-size: 12px; font-stretch: var(--tight); }
.wire .items { display: flex; gap: 28px; overflow: hidden; font: 400 14px/1 var(--serif); color: var(--text); min-width: 0; }
.wire .items span:first-child { color: var(--paper); }
.wire .items span + span::before { content: ''; display: inline-block; width: 5px; height: 5px; background: var(--line-2); transform: rotate(45deg); margin-right: 28px; vertical-align: middle; }

/* ---------- op hover card ---------- */
.opcard { position: fixed; z-index: 30; width: 310px; background: #0b1822; border: 1px solid var(--line-2); padding: 13px 15px; box-shadow: 0 14px 44px rgba(0, 0, 0, 0.6); pointer-events: none; }
.opcard h4 { font: 500 17px/1.2 var(--serif); color: var(--paper); margin: 0 0 5px; }
.opcard p { font: 400 14px/1.42 var(--serif); color: var(--text); }
.opcard .fact { margin-top: 9px; padding-top: 8px; border-top: 1px solid var(--line); font-style: italic; color: var(--muted); }
.opcard .need { margin-top: 8px; color: var(--amber); font: 500 12px/1.3 var(--sans); font-stretch: var(--tight); }
.opcard .meta { font-size: 11.5px; font-stretch: var(--tight); color: var(--muted); margin-bottom: 3px; }

/* ---------- overlays ---------- */
.scrim { position: fixed; inset: 0; z-index: 60; background: rgba(4, 10, 15, 0.72); display: grid; place-items: center; padding: 20px; overflow-y: auto; }
.scrim.clear { background: rgba(4, 10, 15, 0.35); }
.sheet { background: var(--panel); border: 1px solid var(--line-2); width: min(760px, 100%); max-height: calc(100dvh - 40px); overflow-y: auto; box-shadow: 0 24px 80px rgba(0, 0, 0, 0.7); scrollbar-width: thin; }
.sheet.narrow { width: min(430px, 100%); }
.sheet.wide { width: min(940px, 100%); }
.sheet header { padding: 20px 24px 14px; border-bottom: 1px solid var(--line); }
.sheet header .pre { color: var(--muted); font-size: 12px; font-stretch: var(--tight); }
.sheet header h2 { font: 500 27px/1.15 var(--serif); color: var(--paper); margin-top: 2px; letter-spacing: -0.01em; }
.sheet .body { padding: 16px 24px 6px; }
.sheet .body p.lead { font: 400 16.5px/1.5 var(--serif); color: var(--text); max-width: 62ch; }
.sheet footer { padding: 14px 24px 20px; display: flex; justify-content: flex-end; gap: 10px; align-items: center; }
.btn { padding: 10px 18px; background: var(--amber); color: #1b1304; font-weight: 700; font-size: 14px; }
.btn:hover { background: #f6c259; }
.btn.alt { background: none; border: 1px solid var(--line-2); color: var(--paper); font-weight: 500; }
.btn.alt:hover { background: var(--raise); }

.pick { display: grid; gap: 0; }
.pick button { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; padding: 11px 24px; border-top: 1px solid var(--line); align-items: baseline; }
.pick button:hover:not(:disabled), .pick button:focus-visible { background: var(--panel-2); }
.pick button b { font: 500 16px/1.25 var(--serif); color: var(--paper); }
.pick button span { color: var(--muted); font-size: 12px; font-stretch: var(--tight); }
.pick button em { grid-column: 1 / -1; font: 400 13.5px/1.38 var(--serif); color: var(--muted); font-style: normal; }
.pick button:disabled b { color: var(--faint); }

.heads { margin: 2px 0 10px; }
.heads .hl { font: 500 16.5px/1.38 var(--serif); color: var(--paper); padding: 2px 0 2px 12px; border-left: 2px solid var(--muted); margin: 8px 0; }
.deltas { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); margin: 14px 0 6px; }
.deltas > div { background: var(--panel); padding: 9px 11px; }
.deltas .k { font-size: 11.5px; font-stretch: var(--tight); color: var(--muted); }
.deltas .v { font-size: 18px; font-weight: 600; font-stretch: 86%; color: var(--paper); }
.deltas .d { font-size: 11.5px; font-stretch: var(--tight); color: var(--faint); }
.deltas .d.up { color: var(--amber); }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 0 26px; margin-top: 10px; }
.cols h3 { font: 500 15px/1.2 var(--serif); padding-bottom: 5px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.cols h3.CO { color: var(--blue); }
.cols h3.IR { color: var(--red); }
.cols .ln { padding: 5px 0; font-size: 12.5px; border-bottom: 1px solid var(--line); }
.cols .ln:last-child { border-bottom: 0; }
.cols .ln b { color: var(--paper); font-weight: 600; display: block; }

/* ---------- start ---------- */
.start { position: fixed; inset: 0; z-index: 50; overflow-y: auto; background: linear-gradient(90deg, rgba(8, 18, 26, 0.96) 0%, rgba(8, 18, 26, 0.86) 38%, rgba(8, 18, 26, 0.25) 78%, rgba(8, 18, 26, 0.1) 100%); display: grid; align-items: center; }
/* behind the opening screen the map runs edge to edge */
body.at-start .app { grid-template-columns: 0 minmax(0, 1fr) 0; grid-template-rows: 0 minmax(0, 1fr) 0; }
body.at-start .top, body.at-start .orders, body.at-start .intel, body.at-start .wire, body.at-start .legend, body.at-start .map-tools { display: none; }
.start .in { width: min(640px, 100%); padding: 44px 48px; margin-left: clamp(0px, 6vw, 110px); }
.start .when { font-size: 13px; font-stretch: var(--tight); color: var(--amber); font-weight: 600; }
.start h1 { font: italic 400 clamp(56px, 7.5vw, 96px)/0.92 var(--serif); color: var(--paper); letter-spacing: -0.035em; margin: 10px 0 18px -4px; }
.start .dek { font: 400 19px/1.45 var(--serif); color: var(--text); max-width: 54ch; }
.sides { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 28px; }
.sidebtn { padding: 15px 16px 14px; border: 1px solid var(--line-2); background: rgba(14, 28, 39, 0.78); display: flex; flex-direction: column; justify-content: flex-start; align-items: stretch; }
.sidebtn b { display: block; font: 500 20px/1.2 var(--serif); color: var(--paper); }
.sidebtn .w { display: block; font-size: 12px; font-stretch: var(--tight); margin-top: 2px; }
.sidebtn.CO .w { color: var(--blue); }
.sidebtn.IR .w { color: var(--red); }
.sidebtn p { font: 400 14px/1.42 var(--serif); color: var(--muted); margin-top: 8px; }
.sidebtn:hover { background: var(--panel-2); }
.sidebtn[aria-pressed='true'] { background: var(--panel-2); }
.sidebtn.CO[aria-pressed='true'] { border-color: var(--blue); box-shadow: inset 0 3px 0 var(--blue); }
.sidebtn.IR[aria-pressed='true'] { border-color: var(--red); box-shadow: inset 0 3px 0 var(--red); }
.startrow { display: flex; align-items: center; gap: 16px; margin-top: 18px; flex-wrap: wrap; }
.startrow .lab { color: var(--muted); font-size: 12.5px; font-stretch: var(--tight); }
.startrow .seg button { padding: 6px 12px; font-size: 13px; }
.start .btn { font-size: 15px; padding: 12px 24px; }
.pbs { margin-top: 26px; border-top: 1px solid var(--line-2); padding-top: 14px; }
.pbs h2 { font: 500 18px/1.2 var(--serif); color: var(--paper); }
.pbs p { font: 400 14px/1.42 var(--serif); color: var(--muted); margin: 3px 0 8px; max-width: 60ch; }
.pbs button { display: grid; grid-template-columns: 170px 76px 1fr; gap: 10px; align-items: baseline; width: 100%; padding: 6px 8px; border-top: 1px solid var(--line); }
.pbs button:hover { background: var(--panel-2); }
.pbs button b { font: 500 15.5px/1.25 var(--serif); color: var(--paper); }
.pbs button span { font-size: 12px; font-stretch: var(--tight); }
.pbs button span.CO { color: var(--blue); }
.pbs button span.IR { color: var(--red); }
.pbs button em { font: 400 13.5px/1.3 var(--serif); font-style: normal; color: var(--text); }
.start .fine { margin-top: 26px; font-size: 12px; font-stretch: var(--tight); color: var(--faint); max-width: 62ch; line-height: 1.5; }
.start .resume { margin-left: 4px; }

/* ---------- end ---------- */
.verdict { font: italic 400 46px/1.02 var(--serif); letter-spacing: -0.02em; color: var(--paper); margin-top: 4px; }
.balance { position: relative; height: 44px; margin: 22px 0 6px; }
.balance .rail { position: absolute; left: 0; right: 0; top: 16px; height: 6px; background: linear-gradient(90deg, var(--red) 0%, var(--red-deep) 30%, var(--line-2) 50%, var(--blue-deep) 70%, var(--blue) 100%); }
.balance .pin { position: absolute; top: 4px; width: 2px; height: 30px; background: var(--paper); }
.balance .pin::after { content: attr(data-l); position: absolute; top: -17px; left: 50%; transform: translateX(-50%); white-space: nowrap; font-size: 11.5px; font-stretch: var(--tight); color: var(--paper); font-weight: 600; }
.balance .pin.hist { background: var(--muted); height: 18px; top: 10px; }
.balance .pin.hist::after { top: 22px; color: var(--muted); font-weight: 400; }
.balance-ends { display: flex; justify-content: space-between; font-size: 11.5px; font-stretch: var(--tight); color: var(--muted); margin-top: 10px; }
.parts { margin-top: 16px; }
.part { display: grid; grid-template-columns: 220px 1fr 54px; gap: 12px; align-items: center; padding: 5px 0; }
.part .tr { height: 5px; background: var(--line); position: relative; }
.part .tr i { position: absolute; left: 0; top: 0; bottom: 0; background: var(--blue); }
.part .v { text-align: right; color: var(--paper); font-weight: 600; }
.tally { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); margin-top: 16px; }
.tally > div { background: var(--panel); padding: 9px 11px; }
.tally .k { font-size: 11.5px; font-stretch: var(--tight); color: var(--muted); }
.tally .v { font-size: 18px; font-weight: 600; font-stretch: 86%; color: var(--paper); }
.real { margin-top: 18px; }
.real h3 { font: 500 16px/1.2 var(--serif); color: var(--paper); margin-bottom: 6px; }
.real li { font: 400 14px/1.45 var(--serif); color: var(--text); margin: 3px 0; }
.real ul { margin: 0; padding-left: 18px; }
.help h3 { font: 500 17px/1.2 var(--serif); color: var(--paper); margin: 14px 0 4px; }
.help p, .help li { font: 400 15px/1.5 var(--serif); color: var(--text); max-width: 66ch; }
.help ul { margin: 4px 0; padding-left: 18px; }

/* ---------- small screens ---------- */
@media (max-width: 1180px) {
  .app { grid-template-columns: 270px minmax(0, 1fr) 300px; }
  .brand { width: 270px; }
  .gauge .val { font-size: 18px; }
  .gauge { padding: 8px 10px; }
}
@media (max-width: 920px) {
  body { overflow: auto; }
  .app { grid-template-columns: 1fr; grid-template-rows: auto 62vh auto auto auto; grid-template-areas: 'top' 'map' 'orders' 'intel' 'wire'; height: auto; }
  .top { flex-wrap: wrap; }
  .brand { width: auto; flex: 1; padding: 10px 16px; }
  .clock { padding: 10px 16px; border-right: 0; }
  .gauges { flex-basis: 100%; overflow-x: auto; border-top: 1px solid var(--line); }
  .gauge { min-width: 124px; }
  .topbtns { order: 2; flex-basis: 100%; justify-content: flex-end; padding: 6px 12px; border-top: 1px solid var(--line); }
  .gauges { order: 3; }
  .orders, .intel { border: 0; border-top: 1px solid var(--line); }
  .plan { max-height: none; }
  .scroll { overflow: visible; }
  .start .in { padding: 28px 20px; margin-left: 0; }
  .sides, .cols { grid-template-columns: 1fr; }
  .deltas, .tally { grid-template-columns: repeat(2, 1fr); }
  .part { grid-template-columns: 1fr 80px 44px; }
  .feed, .sitecard { width: auto; left: 12px; right: 12px; }
  .opcard { display: none; }
}
/* set from Settings; follows the system's reduced-motion preference until changed */
body.still * { animation: none !important; transition: none !important; }

/* ---------- photographs ---------- */
.ph { margin: 0; position: relative; overflow: hidden; background: #0a1620; }
.ph img { display: block; width: 100%; height: 132px; object-fit: cover; filter: saturate(0.82) contrast(1.05) brightness(0.9); animation: photo-in 0.5s ease-out both; }
.ph figcaption { position: absolute; left: 0; right: 0; bottom: 0; padding: 18px 10px 6px; font-size: 11px; line-height: 1.3; font-stretch: var(--tight); color: var(--paper); background: linear-gradient(180deg, rgba(8, 18, 26, 0), rgba(8, 18, 26, 0.88)); }
.ph figcaption span { color: var(--muted); }
.opcard .ph { margin: -13px -15px 11px; }
.sitecard .ph.wide { margin: -13px -15px 10px; }
.sitecard .ph.wide img { height: 118px; }
.sitecard .close { z-index: 2; background: rgba(8, 18, 26, 0.7); border-radius: 50%; }
.ph.thumb { width: 104px; flex: none; border: 1px solid var(--line-2); }
.ph.thumb img { height: 66px; }
.ph.thumb figcaption { display: none; }
.feed .fx { display: flex; gap: 12px; align-items: flex-start; }
.feed .fx > div { flex: 1; min-width: 0; }
.feed p { margin-top: 8px; }

/* ---------- motion ---------- */
@keyframes photo-in { from { opacity: 0; transform: scale(1.06); } to { opacity: 1; transform: none; } }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes slide-in { from { opacity: 0; transform: translateX(-12px); background: rgba(233, 174, 63, 0.25); } to { opacity: 1; transform: none; background: transparent; } }
@keyframes gauge-pop { 0% { opacity: 0.55; } 100% { opacity: 1; } }
.scrim { animation: fade 0.18s ease-out both; }
.sheet { animation: rise 0.26s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
.feed .fx, .feed p { animation: fade 0.3s ease-out both; }
.sitecard:not([hidden]) { animation: rise 0.22s ease-out both; }
.ord.fresh { animation: slide-in 0.45s ease-out both; }
.banner:not([hidden]) { animation: rise 0.2s ease-out both; }
.gauge .bar i, .stat .b i, .meter .track i, .part .tr i { transition: width 0.5s ease-out; }
.start.intro .in > * { animation: rise 0.7s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
.start.intro .in > *:nth-child(2) { animation-delay: 0.08s; }
.start.intro .in > *:nth-child(3) { animation-delay: 0.2s; }
.start.intro .in > *:nth-child(4) { animation-delay: 0.32s; }
.start.intro .in > *:nth-child(n + 5) { animation-delay: 0.44s; }
.balance .pin:not(.hist) { animation: pin-drop 0.9s 0.3s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
@keyframes pin-drop { from { opacity: 0; transform: translateY(-18px); } to { opacity: 1; transform: none; } }
.part .tr i { animation: grow 0.9s 0.2s ease-out both; transform-origin: left; }
@keyframes grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }

/* ---------- sound button and settings ---------- */
.ghost.icon { padding: 6px 8px; display: inline-grid; place-items: center; color: var(--paper); }
.ghost.icon[aria-pressed='false'] { color: var(--faint); }
.ghost.icon svg { display: block; }
.startbar { position: absolute; top: 18px; right: 22px; display: flex; gap: 6px; z-index: 1; }
.startbar .ghost { background: rgba(8, 18, 26, 0.7); }
.settings .body { padding-bottom: 4px; }
.settings h3 { font: 600 12.5px/1 var(--sans); font-stretch: var(--tight); color: var(--amber); margin: 20px 0 4px; }
.settings h3:first-child { margin-top: 2px; }
.settings .none { color: var(--muted); font-size: 13.5px; padding: 8px 0; }
.sw, .settings .row, .sl { display: flex; align-items: center; justify-content: space-between; gap: 16px; width: 100%; min-height: 44px; padding: 7px 0; border-bottom: 1px solid var(--line); text-align: left; color: var(--text); font-size: 14px; }
.sw b { font-weight: 500; color: var(--paper); display: block; }
.sw em { font-style: normal; display: block; font-size: 12px; color: var(--muted); font-stretch: var(--tight); margin-top: 1px; }
.sw i { flex: none; width: 38px; height: 20px; border: 1px solid var(--line-2); background: var(--ink); position: relative; transition: background 0.15s, border-color 0.15s; }
.sw i::after { content: ''; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; background: var(--faint); transition: transform 0.15s, background 0.15s; }
.sw[aria-checked='true'] i { background: rgba(233, 174, 63, 0.18); border-color: var(--amber); }
.sw[aria-checked='true'] i::after { transform: translateX(18px); background: var(--amber); }
.sw:hover b { color: #fff; }
.settings .seg button { padding: 6px 12px; font-size: 13px; }
.vols { padding-left: 14px; border-left: 2px solid var(--line); margin: 2px 0 0 2px; transition: opacity 0.15s; }
.vols.off { opacity: 0.35; pointer-events: none; }
.vols .ghost { margin: 10px 0 2px; }
.sl span { flex: none; width: 62px; color: var(--paper); }
.sl output { flex: none; width: 30px; text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); font-size: 13px; }
.sl input { flex: 1; min-width: 0; height: 24px; margin: 0; background: none; -webkit-appearance: none; appearance: none; cursor: pointer; }
.sl input::-webkit-slider-runnable-track { height: 3px; background: var(--line-2); }
.sl input::-moz-range-track { height: 3px; background: var(--line-2); }
.sl input::-webkit-slider-thumb { -webkit-appearance: none; width: 12px; height: 18px; margin-top: -7.5px; background: var(--amber); border: 0; border-radius: 0; }
.sl input::-moz-range-thumb { width: 12px; height: 18px; background: var(--amber); border: 0; border-radius: 0; }
.sl input:focus-visible, .sw:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.settings footer { flex-wrap: wrap; }
