:root {
  --bg: #110f0a;
  --card: #20211a;
  --card-grad: linear-gradient(180deg, #22231b 0%, #191a13 100%);
  --line: #34362b;
  --fg: #ECE7D9;
  --muted: #9c9684;
  --accent: #8FD15E;       /* ork green — primary / positive / interactive */
  --accent-fg: #14130d;    /* dark text on the green */
  --gold: #C8A24C;         /* stat numbers / highlights */
  --bar: #8FD15E;
  --err: #3a1a14;
  --err-fg: #e0a995;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font: 15px/1.5 'Barlow', system-ui, -apple-system, sans-serif;
  background: radial-gradient(135% 95% at 50% -12%, #1d1b13 0%, #110f0a 62%) var(--bg);
  color: var(--fg);
}

/* Headings — Oswald, uppercase, letter-spaced (mirrors the BossG landing page). */
h1, h2, h3 {
  font-family: 'Oswald', sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #F0EBDC;
}

/* Header — mirrors the BossG landing page exactly (rivets, textured ground,
   gold underline, centered inner container) so the SIM is indistinguishable
   from the site; the active "Sim" tab is the only page marker. */
header {
  position: relative;
  border-bottom: 2px solid var(--gold);
  box-shadow: inset 0 -3px 0 rgba(143, 209, 94, 0.18), 0 6px 26px rgba(0, 0, 0, 0.55);
  background-image:
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.022) 0 1px, transparent 1px 3px),
    linear-gradient(180deg, #2c2d23 0%, #1c1d16 100%);
}
/* Centered inner container, aligned on the SIM's main (max-width 1140px). */
.header-inner {
  max-width: 1140px;
  margin: 0 auto;
  padding: 16px 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

/* Decorative corner rivets (4). */
.rivet {
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #7a7a64, #19190f);
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.6), inset 0 0 0 1px rgba(0, 0, 0, 0.35);
}
.rivet-tl { top: 11px; left: 16px; }
.rivet-tr { top: 11px; right: 16px; }
.rivet-bl { bottom: 11px; left: 16px; }
.rivet-br { bottom: 11px; right: 16px; }

.brand { display: flex; align-items: center; gap: 16px; }

/* Segmented nav toggle — mirrors the BossG landing-page header (Auth / Sim / Guild Management). */
.nav-toggle {
  display: inline-flex;
  background: #14130d;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 3px;
  gap: 2px;
}
.nav-seg {
  display: inline-flex;
  align-items: center;
  padding: 7px 15px;
  border-radius: 5px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font-family: 'Barlow', sans-serif;
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}
.nav-seg:hover { color: var(--fg); }
.nav-seg.active {
  border-color: #4e8a2c;
  background: linear-gradient(180deg, #3f6b29, #2b4c1c);
  color: #dbefc7;
  font-weight: 700;
}
/* Avatar box — 48×48, overflow-clipped; image anchored top so the skull crown
   stays in frame (object-position:center top), matching the site. */
.brand-img {
  width: 48px;
  height: 48px;
  border: 2px solid var(--gold);
  border-radius: 7px;
  overflow: hidden;
  flex-shrink: 0;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.5), 0 0 16px -2px rgba(143, 209, 94, 0.35);
  background: #1a1a12;
}
.brand-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  display: block;
}

header h1 {
  margin: 0;
  font-family: 'Oswald', sans-serif;
  font-weight: 600;
  font-size: 21px;
  letter-spacing: 0.05em;
  line-height: 1;
  color: #F0EBDC;
  text-transform: uppercase;
}
/* Subtitle below the title (not inline). */
.brand-text .sub {
  margin: 5px 0 0;
  font-family: 'Barlow Semi Condensed', sans-serif;
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: #9c9684;
}

main {
  max-width: 1140px;
  margin: 0 auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.card {
  background: var(--card-grad);
  border: 1px solid var(--line);
  border-top: 2px solid var(--gold);
  border-radius: 10px;
  padding: 16px 18px;
  box-shadow: 0 2px 12px -4px rgba(0, 0, 0, 0.6);
}
.card h2 {
  margin: 0 0 12px;
  padding-bottom: 8px;
  font-size: 17px;
  font-weight: 600;
  border-bottom: 1px solid var(--line);
}
.card h3 { margin: 0 0 8px; font-size: 14px; font-weight: 500; color: var(--muted); }

/* Card header carrying a right-aligned control (e.g. the Result Table/Charts toggle):
   the row owns the underline, the inner <h2> drops its own border/margin. */
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}
.card-head h2 { margin: 0; padding: 0; border: none; }

/* Chart canvas needs a sized container (Chart.js maintainAspectRatio:false). */
.chart-box { position: relative; height: 340px; margin-top: 12px; }

/* Chart header row: the chart picker + the drill-down "back" button (buff contribution). */
.chart-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
#chart-back {
  background: #14130d; border: 1px solid var(--line); color: var(--fg);
  border-radius: 5px; padding: 7px 12px; cursor: pointer; font-weight: 600;
}
#chart-back:hover { border-color: var(--accent); color: var(--accent); }
#chart-caption { margin: 8px 0 0; }

.hint {
  font-family: 'Barlow', sans-serif;
  text-transform: none;
  letter-spacing: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 400;
}
.warn { color: var(--gold); font-size: 13px; }
.hidden { display: none; }

label { display: flex; flex-direction: column; gap: 4px; max-width: 520px; }
.card > label { margin-bottom: 10px; }
.row { display: flex; gap: 16px; flex-wrap: wrap; }
.row label { max-width: 220px; }
.chk { flex-direction: row; align-items: center; gap: 8px; max-width: none; white-space: nowrap; }
.chk input[type=checkbox] { width: auto; }
#custom-armor-label { gap: 12px; }               /* extra breathing room before the armor input */

select, input, button {
  font: inherit;
  color: var(--fg);
  background: #14130d;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px 8px;
}
input.num { width: 70px; }
#custom-armor-value { width: 100px; }        /* fits a 5-digit armor value (e.g. 10000) without clipping */
select:focus, input:focus { outline: 1px solid var(--accent); }

button {
  cursor: pointer;
  background: #2c2d23;
}
button:hover { border-color: var(--accent); }
button.primary {
  background: linear-gradient(180deg, #8FD15E 0%, #5d9a36 100%);
  color: var(--accent-fg);
  border-color: #4e8a2c;
  font-family: 'Oswald', sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
  padding: 10px 20px;
  align-self: flex-start;
}
button.primary:hover { border-color: var(--gold); }

table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: 6px 10px; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 600; font-size: 13px; }

#team-table { max-width: 760px; margin-bottom: 12px; }
.traits-cell { width: 100%; }
.trait-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.trait-chip {
  display: inline-block;
  font-size: 12px;
  padding: 1px 7px;
  border-radius: 10px;
  background: linear-gradient(180deg, #2c2d23, #22231b);
  color: var(--fg);
  border: 1px solid var(--line);
  white-space: nowrap;
  cursor: help;
}
/* Boss-ability chip — same shape as a trait chip, indigo/violet to set abilities apart from traits. */
.ability-chip {
  display: inline-block;
  font-size: 12px;
  padding: 1px 7px;
  border-radius: 10px;
  background: linear-gradient(180deg, #2a2438, #211d2e);
  color: var(--fg);
  border: 1px solid #4b3f6b;
  white-space: nowrap;
  cursor: help;
}
td .muted { color: var(--muted); }
.muted { color: var(--muted); }
.armor-line { font-size: 15px; color: var(--fg); margin: 8px 0 4px; }
.armor-line strong { font-weight: 700; color: var(--gold); }
#boss-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 4px 0; }
#plan-wrap { overflow-x: auto; }              /* safety net on very small screens */
#plan-table { width: auto; }                  /* auto layout: columns sized to content */
#log-wrap { overflow-x: auto; }               /* 10-col log scrolls inside its card on mobile, not out of it */
#plan-table th, #plan-table td { padding: 4px 8px; }
#plan-table th { white-space: nowrap; }
#plan-table td:first-child, #plan-table th:first-child { white-space: nowrap; padding-right: 16px; }
#plan-table select { min-width: 84px; }
.cell { display: flex; align-items: center; gap: 5px; white-space: nowrap; }
.cell .ctxbox {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 12px;
  color: var(--muted);
  cursor: pointer;
  flex-direction: row;
}
.cell .ctxbox input { margin: 0; }
.cell .ctx-counter { width: 40px; padding: 2px 4px; }

/* Per-turn activation-order: clickable column header + reorder popover. */
.turn-th { cursor: pointer; user-select: none; }
.turn-th:hover { color: var(--accent); }
.order-pop {
  position: fixed;
  z-index: 50;
  min-width: 180px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45);
  padding: 8px;
  font-size: 13px;
}
.order-pop-title { color: var(--muted); font-size: 12px; margin-bottom: 6px; }
.order-pop-empty { color: var(--muted); font-style: italic; }
.order-pop-list { list-style: none; margin: 0; padding: 0; counter-reset: ord; }
.order-pop-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 3px 0;
}
.order-pop-item::before { counter-increment: ord; content: counter(ord) ". "; color: var(--muted); }
.order-name { flex: 1; }
.order-arrows { display: inline-flex; gap: 4px; }
.order-arrow {
  cursor: pointer;
  width: 22px;
  padding: 1px 0;
  background: var(--bg);
  color: var(--fg);
  border: 1px solid var(--line);
  border-radius: 4px;
}
.order-arrow:disabled { opacity: 0.3; cursor: default; }
.order-arrow:not(:disabled):hover { border-color: var(--accent); color: var(--accent); }

.total { font-size: 18px; margin: 6px 0 16px; }
.total strong {
  font-family: 'Oswald', sans-serif;
  letter-spacing: 0.02em;
  color: var(--gold);
  font-size: 24px;
}

.grid2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
@media (max-width: 720px) { .grid2 { grid-template-columns: 1fr; } }

.bar { height: 14px; background: var(--bar); border-radius: 3px; min-width: 2px; }

.errors {
  background: var(--err);
  color: var(--err-fg);
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 14px;
}
.errors ul { margin: 6px 0 0; padding-left: 20px; }

details { margin-top: 16px; }
summary { cursor: pointer; color: var(--muted); }
details table { margin-top: 10px; font-size: 13px; }
.log-filter { display: inline-flex; align-items: center; gap: 8px; margin-top: 10px; font-size: 13px; color: var(--muted); }
.log-filter select { min-width: 140px; }

/* Scenario export/import */
#scenario-controls { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; flex-wrap: wrap; }
#scenario-status.ok { color: var(--bar); }
#scenario-status.err { color: #cf7a5e; }
#scenario-io {
  width: 100%;
  box-sizing: border-box;
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  resize: vertical;
  background: #14130d;
  color: var(--fg);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
}

/* Clickable log rows → toggle the auditable formula detail sub-row. */
#log .log-row { cursor: pointer; }
#log .log-row:hover { background: #1c1d16; }
#log tr.detail td { border-bottom: 1px solid var(--line); background: #14130d; padding: 8px 12px; }
#log pre.trace {
  margin: 0;
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  line-height: 1.5;
  color: var(--fg);
  white-space: pre-wrap;
  word-break: break-word;
}

/* ── Battlefield (hex board) ─────────────────────────────────────────────── */
.board-toolbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 12px;
}
.turn-tabs { display: inline-flex; gap: 2px; background: #14130d; border: 1px solid var(--line); border-radius: 8px; padding: 3px; }
.turn-tab {
  background: transparent; color: var(--muted); border: 0; border-radius: 6px;
  padding: 5px 11px; font: 600 13px/1 "Barlow Semi Condensed", sans-serif; cursor: pointer;
}
.turn-tab:hover { color: var(--fg); }
.turn-tab.active { background: linear-gradient(180deg, #3f6b29, #2b4c1c); color: var(--fg); }
.turn-tab .cnt { color: var(--gold); margin-left: 4px; font-size: 11px; }
button.ghost {
  background: transparent; color: var(--muted); border: 1px solid var(--line);
  border-radius: 6px; padding: 5px 10px; cursor: pointer; font-size: 13px;
}
button.ghost:hover { color: var(--fg); border-color: var(--gold); }
#copy-prev-turn, #clear-turn { min-width: 11em; text-align: center; }  /* equal, tidy toolbar buttons */

/* "Edit high ground" toggle: clearly active while editing (explains why unit drags don't move), with a
   brief flash when the user tries to drag over the board in that mode. */
#terrain-label.active {
  color: var(--fg); border-radius: 6px; padding: 3px 8px;
  background: rgba(200, 162, 76, .18); outline: 1px solid var(--gold);
}
#terrain-label.flash { animation: terrain-flash .5s ease; }
@keyframes terrain-flash {
  0%, 100% { background: rgba(200, 162, 76, .18); }
  35%      { background: rgba(200, 162, 76, .7); }
}

.board-layout { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.board-stage {
  position: relative;
  flex: 1 1 420px; min-width: 320px; background: radial-gradient(120% 90% at 50% 0%, #1a1c12, #100f0a);
  border: 1px solid var(--line); border-radius: 10px; padding: 10px;
}
#board-svg { width: 100%; height: auto; display: block; touch-action: none; }
/* HTML token overlay, aligned to the SVG box (board-stage padding = 10px). Empty areas let
   clicks fall through to the hexes; only the tokens are interactive. */
#token-layer { position: absolute; left: 10px; top: 10px; right: 10px; bottom: 10px; pointer-events: none; }

.hex { fill: #1e1f16; stroke: #34362b; stroke-width: 2; transition: fill .08s; }
.hex.free { cursor: pointer; }
.hex.free:hover { fill: #2a2c1f; }
.hex.hg { fill: #2c3a1c; stroke: #5e7a2e; }            /* high ground */
.hex.hg:hover { fill: #36481f; }
.hex.boss { fill: #2a1416; stroke: #6e2b2b; cursor: not-allowed; }
.hex.boss.hg { fill: #34281a; stroke: #7a5a2e; }
.hex.summon-fp { fill: #16303a; stroke: #2e6a7a; }     /* deployed multi-hex summon body (Galatian = 3 hexes) */
.hex.summon-fp.hg { fill: #1a343a; stroke: #2e7a6a; }
.hex.drop-ok { fill: #3a5224; stroke: var(--accent); }
.hex.terrain-edit { cursor: crosshair; }   /* editable on every hex, incl. boss, while editing HG */

/* Charge active (Boss G / Lucien / Dante): start → arrival. The arrival-pick highlights the valid
   boss-adjacent hexes; the arrow + ghost show where the charger came from (drawn in the SVG, under tokens). */
.hex.charge-target { fill: #294a2a; stroke: var(--accent); stroke-width: 2; cursor: pointer; }
.hex.charge-target:hover { fill: #356a34; }
.charge-arrow { stroke: var(--accent); stroke-width: 2; stroke-dasharray: 4 3; fill: none; }
.charge-arrowhead { fill: var(--accent); }
.charge-ghost { fill: rgba(255, 255, 255, .05); stroke: var(--accent); stroke-width: 1.5; stroke-dasharray: 3 3; opacity: .75; }

/* Placed unit tokens (HTML overlay, positioned in % of the SVG viewBox). */
.board-token {
  position: absolute; transform: translate(-50%, -50%); width: 11%; aspect-ratio: 1;
  pointer-events: auto; cursor: grab; touch-action: none;
}
.board-token:active { cursor: grabbing; }
.board-token:hover { z-index: 6; }        /* bring a hovered token (and its order badge) above neighbours */
.board-token img {
  width: 100%; height: 100%; border-radius: 50%; object-fit: cover;
  background: #222; border: 2px solid #14130d; box-shadow: 0 1px 4px rgba(0,0,0,.6);
  /* let the token div be the drag source (a native img drag would hijack the gesture) */
  pointer-events: none; user-select: none; -webkit-user-drag: none;
}
.board-token .tok-badges { position: absolute; top: -6px; right: -8px; display: flex; flex-direction: column; gap: 2px; }
.board-token .tok-badge {
  font: 700 10px/1 "JetBrains Mono", monospace; color: var(--accent-fg);
  background: var(--accent); border: 1px solid #14130d; border-radius: 6px; padding: 2px 4px; cursor: pointer;
}
/* While a token is being dragged, ALL placed tokens (incl. the dragged one) ignore pointer events so
   elementFromPoint hit-tests the hex / pool underneath, not a token. Safe here because the pointer-drag
   controller tracks the gesture via window-level listeners, not the source element. */
#board-card.dragging .board-token { pointer-events: none; }
/* While editing high ground, tokens don't block clicks to the hex underneath. */
#board-card.terrain-mode .board-token { pointer-events: none; }

/* Floating clone that follows the finger/cursor during a pointer-drag (mouse + touch). Centered on the
   pointer, never intercepts hit-testing. */
.drag-ghost {
  position: fixed; left: 0; top: 0; transform: translate(-50%, -50%); z-index: 9999;
  width: 44px; height: 44px; pointer-events: none; opacity: .9; filter: drop-shadow(0 2px 6px rgba(0,0,0,.6));
}
.drag-ghost img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; background: #222; border: 2px solid var(--accent); }

/* Spore Mine token: the Spore Mine portrait on the board (smaller + an acid-green ring to read as a
   mine, not a unit); in the pool it shows the Biovore portrait like any other pool token. */
.board-token.mine-token { width: 8%; }
.board-token.mine-token img { border-color: #d6f24a; }

/* align-self: stretch → the pool fills the board's height so the WHOLE right column is a drop target
   (return-to-pool by drag), not just its content-sized top. */
.pool { flex: 0 0 220px; min-width: 200px; align-self: stretch; border-radius: 10px; transition: box-shadow .1s, background .1s; }
.pool.drop-ok { background: #1c2412; box-shadow: 0 0 0 2px var(--accent) inset; }
.pool h3 { margin: 0 0 4px; }
.pool-list { display: flex; flex-direction: column; gap: 7px; margin-top: 8px; }
.pool-token {
  display: flex; align-items: center; gap: 9px; background: #14130d;
  border: 1px solid var(--line); border-radius: 9px; padding: 6px 9px; cursor: grab; user-select: none;
  touch-action: none; /* a touch-drag starting here must drag the token, not scroll the page */
}
.pool-token:hover { border-color: var(--gold); }
.pool-token.dragging { opacity: .45; pointer-events: none; } /* don't shadow elementFromPoint mid-drag */
.pool-token.disabled { opacity: .4; cursor: not-allowed; border-style: dashed; }
.pool-token img { width: 34px; height: 34px; border-radius: 50%; background: #222; object-fit: cover; flex: 0 0 auto; }
.pool-token .pt-name { font: 600 13px/1.15 "Barlow", sans-serif; }
.pool-token .pt-sub { color: var(--muted); font-size: 11px; }
.pool-empty { color: var(--muted); font-size: 12px; font-style: italic; }
/* Off-board Machine of War per-turn active selector (Galatian, M33) */
.pool-token.mow-selector { display: block; cursor: default; border-color: #2e6a7a; }
.pool-token.mow-selector:hover { border-color: #2e6a7a; }
.mow-buttons { display: flex; gap: 5px; margin-top: 6px; flex-wrap: wrap; }
.mow-btn { font: 600 12px/1 "Barlow", sans-serif; padding: 5px 9px; border-radius: 7px; cursor: pointer;
  background: #14130d; color: var(--fg); border: 1px solid var(--line); }
.mow-btn:hover:not(:disabled) { border-color: var(--gold); }
.mow-btn.on { background: #16303a; border-color: #2e6a7a; color: #cdeaf2; }
.mow-btn:disabled { opacity: .35; cursor: not-allowed; }

/* token action / context popover */
.popover {
  position: absolute; z-index: 50; background: var(--card); border: 1px solid var(--gold);
  border-radius: 10px; padding: 11px 12px; min-width: 190px; max-width: 260px;
  box-shadow: 0 10px 30px rgba(0,0,0,.55);
}
.popover.hidden { display: none; }
.popover h4 { margin: 0 0 8px; font: 700 13px/1 "Oswald", sans-serif; display: flex; align-items: center; gap: 8px; }
.popover h4 img { width: 26px; height: 26px; border-radius: 50%; }
/* Scope-grouped ctx sections (Havyr/Laviscus merged popover): a muted subheader above each group. */
.pop-section { margin: 8px 0 3px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.pop-modes { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; margin-bottom: 9px; }
.pop-modes-cap { font-size: 12px; font-weight: 600; color: var(--muted); margin-right: 2px; }
.pop-mode {
  background: #14130d; color: var(--fg); border: 1px solid var(--line); border-radius: 6px;
  padding: 5px 9px; cursor: pointer; font-size: 12px; font-weight: 600;
}
.pop-mode:hover:not(:disabled) { border-color: var(--gold); }
.pop-mode.sel { background: linear-gradient(180deg, #3f6b29, #2b4c1c); border-color: var(--accent); }
.pop-mode:disabled { opacity: .35; cursor: not-allowed; }
/* ↑/↓ intra-turn reorder row (token popover). */
.pop-reorder { display: flex; align-items: center; gap: 5px; margin-bottom: 9px; }
.pop-reorder-cap { font-size: 12px; font-weight: 600; color: var(--muted); margin-right: 2px; }
.pop-reorder-btn {
  background: #14130d; color: var(--fg); border: 1px solid var(--line); border-radius: 6px;
  padding: 3px 9px; cursor: pointer; font-size: 13px; font-weight: 700; line-height: 1;
}
.pop-reorder-btn:hover:not(:disabled) { border-color: var(--gold); }
.pop-reorder-btn:disabled { opacity: .3; cursor: not-allowed; }
.pop-ctx { display: flex; flex-direction: column; gap: 5px; border-top: 1px solid var(--line); padding-top: 8px; margin-top: 2px; }
.pop-section + .pop-ctx { border-top: 0; padding-top: 0; margin-top: 0; } /* the subheader already separates it */
.pop-ctx label { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--fg); }
.pop-ctx input[type=number] { width: 48px; }
