/*
 * The interface.
 *
 * Layout and components only — every colour, face and corner radius comes from
 * a custom property that a theme sets. See themes/README.md; the values below
 * are a plain fallback for the case where a theme's stylesheet fails to load,
 * so the page is still usable rather than unstyled.
 */

:root {
  --bg:        #12141a;
  --panel:     #181c24;
  --panel-2:   #1f242e;
  --ink:       #d6dae2;
  --ink-dim:   #838b98;
  --ink-bright:#ffffff;
  --rule:      #2b323d;
  --accent:    #6fd3c4;
  --danger:    #f0776a;
  --shadow:    0 1px 3px rgba(0,0,0,.5);
  --font:      ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --font-ui:   system-ui, -apple-system, "Segoe UI", sans-serif;
  --radius:    4px;
  --scanlines: 0;
  --glow:      none;
  --board-bg:  #0d1014;
}

* { box-sizing: border-box; }

/* Several things here are display:flex or display:grid, and a bare `hidden`
   attribute loses to any of them. This is the one rule that makes hiding work. */
[hidden] { display: none !important; }

html, body {
  /* Every theme is dark, and without this the browser draws native controls —
     selects, number spinners, scrollbars — in its light palette on top of them. */
  color-scheme: dark;
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 13px;
}

body { display: flex; flex-direction: column; overflow: hidden; }

/* The phosphor look: a faint horizontal ruling over the whole page. Off for
   every other style, so it costs nothing to leave in the markup. */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 50;
  opacity: calc(var(--scanlines) * .35);
  background: repeating-linear-gradient(
    to bottom,
    rgba(0,0,0,0) 0px, rgba(0,0,0,0) 2px,
    rgba(0,0,0,.5) 3px, rgba(0,0,0,.5) 3px
  );
}

/* Some browsers and extensions recolour a page they think is light. Painting
   the surfaces explicitly, and saying the scheme out loud above, keeps the
   themes looking like themselves. */
select, input, button, textarea { color-scheme: dark; }

/* ── top bar ─────────────────────────────────────────────────────────── */

.bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--rule);
  background: var(--panel);
  flex: 0 0 auto;
  white-space: nowrap;
}

.brand { display: flex; align-items: baseline; gap: 9px; flex: 0 0 auto; }

/* OSI is the way in and out of administering this copy, and says nothing
   about it: a button with none of a button's furniture, and none of a link's
   either. It brightens under the pointer, which is as far as it goes, and
   wears the accent while somebody is signed in. */
.mark {
  font-family: var(--font);
  font-size: inherit;
  font-weight: 700;
  letter-spacing: .18em;
  color: var(--ink-bright);
  text-shadow: var(--glow);
  background: none;
  border: 0;
  padding: 0;
  margin: 0;
  cursor: pointer;
  transition: color .12s;
}
.mark:hover { color: var(--accent); }
.mark:focus-visible { outline: 1px solid var(--ink-dim); outline-offset: 3px; }
.mark.admin { color: var(--accent); }
.title { color: var(--ink-dim); letter-spacing: .04em; }

/* The transport gains a zoom dial and a follow button once a battle is running,
   which is more than the bar can hold on a laptop. The wordier furniture is
   what goes first. */
@media (max-width: 1360px) { .title { display: none; } }
@media (max-width: 1320px) { .dial > span { display: none; } }

/* Every number in the simulator sits in a box as wide as the widest it can
   show, and every digit is the same width, so nothing moves as they count. */
.clock, .transport, .arena { font-variant-numeric: tabular-nums; }

.clock { display: flex; gap: 14px; margin-left: auto; font-family: var(--font); flex: 0 0 auto; }
.readout { display: flex; gap: 6px; align-items: baseline; }
.readout label { color: var(--ink-dim); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; }
.readout b { color: var(--ink-bright); text-align: right; }
#cycleCount { min-width: 8ch; }   /* 999,999 — the longest time limit */
#tickCount { min-width: 8ch; }

.transport { display: flex; align-items: center; gap: 8px; }
.transport .sep { width: 1px; height: 20px; background: var(--rule); margin: 0 3px; }
/* The debugger's stepping buttons, gone with it but still holding their place. */
.transport.no-debugger .step { visibility: hidden; }

.dial { display: flex; align-items: center; gap: 4px; font-size: 11px; color: var(--ink-dim); }
.dial > span { margin-right: 2px; }
.dial .btn.icon { padding: 4px 6px; }
.dial b { color: var(--ink-bright); font-family: var(--font); min-width: 6ch; text-align: center; }   /* 0.010× */
.btn.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink, #0a0b06); }

/* A dropdown rather than a row of chips, so a project with twenty themes costs
   the bar exactly as much room as one with four. */
.themes { margin-left: auto; flex: 0 0 auto; }
.themes select { font-size: 11px; padding: 4px 7px; min-width: 96px; }
.transport .btn, .transport select { font-size: 11px; padding: 4px 8px; }

/*
 * One control, everywhere.
 *
 * Buttons, view switches, tabs, selects and text inputs are the same box: same
 * height, border, radius and type size, so any row that mixes them lines up.
 * Only emphasis differs, and only by a class — `primary` for the one action a
 * screen is about, `on` for a toggle that is currently on.
 */
.btn,
.chip,
.tab,
select,
input[type=text],
input[type=number],
textarea {
  font: inherit;
  font-size: 12px;
  line-height: 1.25;
  padding: 5px 9px;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--panel-2);
  color: var(--ink);
}

.btn, .chip, .tab { cursor: pointer; white-space: nowrap; text-decoration: none; }
.btn:hover:not(:disabled),
.chip:hover:not(:disabled),
.tab:hover:not(:disabled) { border-color: var(--ink-dim); color: var(--ink-bright); }
.btn:disabled, .chip:disabled, .tab:disabled { opacity: .4; cursor: default; }

select { cursor: pointer; }
select:hover { border-color: var(--ink-dim); }

input[type=text]:focus,
input[type=number]:focus,
select:focus,
textarea:focus { outline: none; border-color: var(--ink-dim); }

.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--bg); font-weight: 600; }
.btn.primary:hover:not(:disabled) { color: var(--bg); filter: brightness(1.08); }
.btn.danger  { color: var(--danger); border-color: var(--danger); background: transparent; }
.btn.danger:hover:not(:disabled) { color: var(--danger); background: color-mix(in srgb, var(--danger) 14%, transparent); }

/* On, in the sense of a pressed toggle. */
.btn.on, .chip.on, .tab.on { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.btn.on:hover, .chip.on:hover, .tab.on:hover { color: var(--bg); }

.btn.big { padding: 8px 20px; }

/* The step controls are glyphs: two symbols side by side read faster than two
   similar phrases, and the tooltip carries the name and the shortcut. */
.btn.icon { padding: 4px 8px; line-height: 0; }
.btn.icon svg { width: 15px; height: 15px; display: block; fill: currentColor; stroke: currentColor; }
.btn.icon:disabled svg { opacity: .55; }

/* Begin, Pause and Resume are one button in three states. Begin is the only one
   that is an invitation, so it is the only one that looks like one. */
.btn.run { min-width: 74px; }
.btn.run.running { background: var(--panel-2); border-color: var(--rule); color: var(--ink); font-weight: 400; }
.btn.run.running:hover { color: var(--ink-bright); border-color: var(--ink-dim); }

/* ── layout ──────────────────────────────────────────────────────────── */

#app { flex: 1 1 auto; min-height: 0; overflow: hidden; display: flex; }

.panel {
  background: var(--panel);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* ── setup ───────────────────────────────────────────────────────────── */

.setup { margin: 18px auto; padding: 20px 24px; width: 100%; overflow: auto; }
/* The title row: the name of the screen, and what the roster costs in a box
   of its own over the third column, which is where the roster is. */
.setup-head { display: flex; align-items: center; gap: 26px; margin: 0 0 14px; }
.setup-head h1 { margin: 0; flex: 1 1 auto; }
.setup h1 { font-size: 15px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-bright); }
.credits-box {
  flex: 0 0 calc((100% - 220px - 52px) / 2); margin: 0; padding: 5px 10px;
  display: flex; align-items: baseline; gap: 5px;
  border: 1px solid var(--rule); border-radius: var(--radius); background: var(--board-bg);
}
.cr-count { font-family: var(--font); font-size: 10px; color: var(--ink-dim); letter-spacing: .04em; }
.cr-dot { color: var(--ink-dim); font-size: 10px; }
.cr-total {
  font-family: var(--font); font-size: 13px; font-weight: 700; letter-spacing: .02em;
  color: var(--ink-bright); font-variant-numeric: tabular-nums; text-shadow: var(--glow);
  margin-left: auto;
}
.cr-unit { font-family: var(--font); font-size: 9px; letter-spacing: .1em; color: var(--ink-dim); }
.credits-box.over .cr-total { color: var(--danger); }
.credits-box.over { border-color: color-mix(in srgb, var(--danger) 45%, var(--rule)); }

.setup-grid { display: grid; grid-template-columns: 220px 1fr 1fr; gap: 16px 26px; align-items: start; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field label { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-dim); margin-top: 6px; }
.field > label:first-child, .vitals + label, .instruments-row + label { margin-top: 0; }
.row { display: flex; gap: 6px; }
.row > select, .row > input { flex: 1 1 auto; min-width: 0; }

/* Under the battlefield: what the roster costs, and whether the simulator
   would take it. It fills whatever the column has left — basis 0, so what is
   in it never asks for room and the page cannot be pushed about by it. */
.setup-grid > .field:first-child { align-self: stretch; }
.status-box {
  flex: 1 1 0; min-height: 84px; margin-top: 6px; padding: 7px 10px 8px;
  display: flex; flex-direction: column; gap: 4px; overflow: hidden;
  border: 1px solid var(--rule); border-radius: var(--radius); background: var(--board-bg);
}
.sb-head {
  margin: 0;
  font-size: 10px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-dim);
}
.sb-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; font-family: var(--font); font-size: 11px; line-height: 1.5; }
.sb-ok { margin: 0; color: var(--accent); letter-spacing: .04em; }
.sb-wrong { margin: 0 0 5px; color: var(--danger); }
.sb-wrong:last-child { margin-bottom: 0; }
.status-box.wrong { border-color: color-mix(in srgb, var(--danger) 45%, var(--rule)); }

/* The Cybertanks picker: a drop-down of our own, so it can stay open while
   Option is held and add a cybertank with every click. */
.picker { position: relative; flex: 1 1 auto; min-width: 0; }
.picker-btn { display: flex; align-items: center; gap: 6px; width: 100%; text-align: left; font: inherit; font-size: 12px; line-height: 1.25; padding: 5px 9px; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--panel-2); color: var(--ink); cursor: pointer; }
.picker-btn:hover, .picker-btn:focus, .picker-btn[aria-expanded="true"] { outline: none; border-color: var(--ink-dim); }
.picker-text { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.picker-caret { color: var(--ink-dim); font-size: 10px; }
.picker-list {
  position: absolute; left: 0; right: 0; top: calc(100% + 3px); z-index: 30;
  margin: 0; padding: 4px 0; list-style: none; max-height: 340px; overflow-y: auto;
  border: 1px solid var(--ink-dim); border-radius: var(--radius); background: var(--panel-2);
  box-shadow: 0 10px 24px -8px rgba(0,0,0,.7); font-size: 12px;
}
.picker-list li { display: flex; align-items: center; gap: 8px; padding: 4px 9px; cursor: pointer; white-space: nowrap; }
.picker-list li > span { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.picker-list li.picker-group { cursor: default; padding: 6px 9px 2px; font-size: 10px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); border-top: 1px solid var(--rule); }
.picker-list li.picker-group:first-child { border-top: 0; }
.picker-list li.hi { background: color-mix(in srgb, var(--ink) 12%, transparent); }
.picker-list li.on { color: var(--accent); }
.picker-list li[aria-disabled="true"] { opacity: .4; cursor: default; }
.picker-count { flex: 0 0 auto; font-weight: 600; font-size: 10px; color: var(--ink-dim); }
.picker-list li.on .picker-count { color: var(--accent); }
.picker-list li.added { animation: picker-added .45s ease-out; }
@keyframes picker-added { 0% { background: color-mix(in srgb, var(--accent) 45%, transparent); } 100% { background: transparent; } }

.hint { margin: 2px 0 0; font-size: 11px; color: var(--ink-dim); line-height: 1.5; }
.error { color: var(--danger); font-size: 12px; white-space: pre-wrap; font-family: var(--font); }

/* Square, and as wide as the column — the battlefield picker above it and the
   button below it both fill the width, and a preview that did not lined the
   column up against nothing. The bitmap stays 192 square; this only scales it. */
#fieldPreview {
  width: 100%;
  aspect-ratio: 1 / 1;
  height: auto;
  margin-top: 8px;
  border: 1px solid var(--rule);
  image-rendering: pixelated;
  background: var(--board-bg);
}

/* ── the terminal under the battlefield ──────────────────────────────────
   Decoration. As wide as the picker above it, a dozen lines tall, and the
   newest line is always at the bottom with the rest scrolled up behind it. */
/* Under the first two columns; the third is the roster's, however long it gets.
   A long roster makes the grid taller than the first two columns need, and
   the spare height all goes to the second row, so the terminal stays put
   under the settings rather than drifting down the middle of the page. */
.setup-grid { grid-template-rows: auto 1fr; }
.setup-grid > .ticker { grid-column: 1 / 3; grid-row: 2; }
.setup-grid > .entrants { grid-column: 3; grid-row: 1 / 3; }

.ticker {
  height: 13.5em;
  padding: 6px 8px;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--board-bg);
  font-family: var(--font);
  font-size: 10px;
  line-height: 1.5;
  color: var(--ink-dim);
  white-space: pre;
  user-select: none;
  text-shadow: var(--glow);
}
/* The lines scroll inside the frame; the frame itself never does, so the
   sound switch folded into its corner stays in the corner. */
.ticker .tk-scroll { height: 100%; overflow: hidden; }
.ticker .tk-line { opacity: .72; animation: tk-in .18s ease-out; }
.ticker .tk-line.dim { opacity: .42; }
.ticker .tk-line.echo { opacity: 1; color: var(--accent); }
.ticker .tk-line.done { opacity: .85; }
.ticker .tk-cursor { display: inline-block; width: .6em; height: 1.1em; vertical-align: text-bottom;
  background: var(--accent); opacity: .8; animation: tk-blink 1.1s steps(1) infinite; }
@keyframes tk-in { from { opacity: 0; transform: translateY(3px); } }
@keyframes tk-blink { 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .ticker .tk-line { animation: none; }
  .ticker .tk-cursor { animation: none; }
}

.roster { list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-direction: column; gap: 5px; }
.roster li {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 8px;
  background: var(--panel-2);
  border: 1px solid var(--rule);
  border-left: 3px solid var(--team);
  border-radius: var(--radius);
  font-size: 12px;
}
.roster .who { flex: 1 1 auto; font-family: var(--font); color: var(--ink-bright); }
.roster .kind { font-size: 10px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-dim); }
/* What it has done, where the row used to say TANK. */
.roster .record { font-size: 10px; color: var(--ink-dim); font-variant-numeric: tabular-nums; white-space: nowrap; letter-spacing: .02em; }
.roster input[type=number] { width: 56px; }
.roster select { width: auto; padding: 3px 6px; font-size: 11px; }
.roster button, .watches li button {
  background: none; border: 0; color: var(--ink-dim); cursor: pointer;
  font: inherit; font-size: 14px; line-height: 1; padding: 0 3px;
}
.roster button:hover, .watches li button:hover { color: var(--danger); }

.setup-actions { margin-top: 22px; display: flex; align-items: center; gap: 16px; }

/* ── arena ───────────────────────────────────────────────────────────── */

.arena {
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: var(--left, 268px) minmax(0,1fr) var(--right, 380px);
  gap: 10px;
  padding: 10px;
  min-height: 0;
}
.arena.fold-left  { --left: 26px; }
.arena.fold-right { --right: 26px; }

/* The debugger switched off in Settings: for Test drive only, so a simulation
   is the instruments and the board, with no third column at all. */
.arena.no-debug { grid-template-columns: var(--left, 268px) minmax(0,1fr); }
.arena.no-debug #debugger { display: none; }

/* A folded panel keeps a spine so you can still see what it is and click it
   back open; everything inside it stops taking up room. */
.panel-head { display: flex; align-items: center; gap: 6px; padding: 0 0 6px; border-bottom: 1px solid var(--rule); margin-bottom: 6px; }
.panel-title { font-size: 10px; text-transform: uppercase; letter-spacing: .1em; color: var(--ink-dim); flex: 1 1 auto; }
.fold {
  background: transparent; border: 1px solid var(--rule); border-radius: var(--radius);
  color: var(--ink-dim); cursor: pointer; font: inherit; font-size: 12px;
  line-height: 1.25; padding: 4px 8px;
}
.fold:hover { color: var(--ink-bright); border-color: var(--ink-dim); }
.panel-body { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; gap: 8px; overflow-y: auto; }
.panel-spine {
  display: none;
  writing-mode: vertical-rl;
  font-size: 10px; text-transform: uppercase; letter-spacing: .14em;
  color: var(--ink-dim); cursor: pointer; padding: 6px 0;
}

.arena.fold-left  #instruments > .panel-head,
.arena.fold-left  #instruments > .panel-body,
.arena.fold-right #debugger   > .panel-head,
.arena.fold-right #debugger   > .panel-body { display: none; }
.arena.fold-left  #instruments > .panel-spine,
.arena.fold-right #debugger   > .panel-spine { display: block; }
.arena.fold-left  #instruments,
.arena.fold-right #debugger { align-items: center; padding: 6px 2px; }

.board-wrap { position: relative; min-width: 0; min-height: 0; overflow: hidden;
  background: var(--board-bg); border: 1px solid var(--rule); border-radius: var(--radius); }
#board { display: block; image-rendering: pixelated; cursor: grab; }
#board.dragging { cursor: grabbing; }
#board.smooth { image-rendering: auto; }

/* ── instrument panels ───────────────────────────────────────────────── */

/* Both side panels can be dragged wider. A compiled listing has lines that a
   fixed column cuts in half, and how wide is wide enough depends on the tank. */
.grip {
  position: absolute; top: 0; bottom: 0; width: 9px; z-index: 3;
  cursor: col-resize;
}
.grip[data-grip="left"]  { right: -5px; }
.grip[data-grip="right"] { left: -5px; }
.grip::after {
  content: ""; position: absolute; top: 50%; transform: translateY(-50%);
  left: 3px; width: 3px; height: 28px; border-radius: 2px;
  background: var(--rule); transition: background .12s;
}
.grip:hover::after, .grip.dragging::after { background: var(--ink-dim); }
.arena.fold-left #instruments .grip, .arena.fold-right #debugger .grip { display: none; }

.instruments { padding: 8px; display: flex; flex-direction: column; min-height: 0; position: relative; }

.tankcard {
  padding: 7px 9px;
  background: var(--panel-2);
  border: 1px solid var(--rule);
  border-left: 3px solid var(--team);
  border-radius: var(--radius);
  cursor: pointer;
}
.tankcard.watched { border-color: var(--ink); border-left-color: var(--team); }
.tankcard.dead { opacity: .45; }

.tankcard .name { display: flex; align-items: baseline; gap: 6px; font-family: var(--font); color: var(--ink-bright); font-size: 12px; }
.tankcard .name .num { color: var(--ink-dim); font-size: 10px; }
.tankcard .name .flag { margin-left: auto; font-size: 10px; letter-spacing: .06em; color: var(--accent); text-transform: uppercase; }
.tankcard .chassis { font-size: 10px; color: var(--ink-dim); margin: 3px 0 6px; }

.meter { display: grid; grid-template-columns: 42px 1fr 30px; gap: 5px; align-items: center; font-size: 10px; margin-bottom: 2px; }
.meter label { color: var(--ink-dim); text-transform: uppercase; letter-spacing: .04em; }
.meter .track { height: 5px; background: rgba(255,255,255,.09); border-radius: 3px; overflow: hidden; }
.meter .fill { height: 100%; background: var(--accent); transition: width .12s linear; }
.meter .fill.warn { background: #ffb648; }
.meter .fill.bad  { background: var(--danger); }
.meter .val { text-align: right; font-variant-numeric: tabular-nums; color: var(--ink-dim); }

/* ── debugger ────────────────────────────────────────────────────────── */

.debugger { display: flex; flex-direction: column; min-height: 0; padding: 8px; position: relative; }
.debug-head { display: flex; gap: 8px; align-items: center; }
.debug-head select { flex: 1 1 auto; min-width: 0; }
/* It shares the tabs row, and it is never abbreviated — the panel has a
   minimum width wide enough to hold the whole readout instead. */
.pcbadge {
  flex: 0 0 auto;
  margin-left: 6px;
  font-family: var(--font);
  font-size: 11px;
  color: var(--ink-dim);
  white-space: nowrap;
}
.pcbadge b { display: inline-block; min-width: 4ch; text-align: right; font-weight: 400; color: var(--ink); }
.pcbadge .busy { display: inline-block; min-width: 12ch; }   /* 9999 cyc busy */

/* Code and Log share the panel; the variables stay under both. */
/* Wrapping is a safety net, not the plan: the panel's minimum width fits the
   whole row, but a four-digit program counter should push the arrow onto a
   second line rather than off the edge. */
.tabs { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; flex: 0 0 auto; }
.tab { text-transform: uppercase; letter-spacing: .08em; font-size: 11px; }
.tab.dl { margin-left: auto; }

.watch { display: flex; gap: 4px; flex: 0 0 auto; }
.watch input { flex: 1 1 auto; min-width: 0; font-family: var(--font); font-size: 11px; padding: 4px 7px; }
.watch input.bad { border-color: var(--danger); color: var(--danger); }
.tab.dl.off { opacity: .35; pointer-events: none; }
.watches { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px; flex: 0 0 auto; }
.watches li {
  display: flex; align-items: center; gap: 5px;
  font-family: var(--font); font-size: 10px;
  padding: 2px 5px; border: 1px solid var(--rule); border-radius: var(--radius);
  color: var(--ink-dim);
}
.watches li b { color: var(--ink-bright); font-weight: 400; }


/* The battle log, and the events in it. */
.log {
  flex: 1 1 auto; overflow-y: auto; margin: 0;
  font-family: var(--font); font-size: 10.5px; line-height: 1.6;
  background: var(--bg); border: 1px solid var(--rule); border-radius: var(--radius);
  padding: 4px 6px;
}
.log div { display: flex; gap: 7px; white-space: pre; }
.log .at { color: var(--ink-dim); min-width: 9ch; text-align: right; }
.log .who { min-width: 9ch; overflow: hidden; text-overflow: ellipsis; }
.log .what { color: var(--ink); }
.log .kind-destroyed .what, .log .kind-hqDown .what { color: var(--danger); }
.log .kind-hit .what { color: var(--ink-bright); }
.log .kind-break .what { color: var(--accent); }
.log .kind-scan .what, .log .kind-transmit .what { color: var(--ink-dim); }

.listing {
  flex: 1 1 auto;
  overflow-y: auto;
  margin: 0;
  padding: 0;
  list-style: none;
  font-family: var(--font);
  font-size: 11px;
  line-height: 1.55;
  background: var(--bg);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
}
.listing li { display: flex; gap: 8px; padding: 0 8px 0 4px; white-space: pre; cursor: pointer; }
.listing li .src { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.listing li:hover { background: rgba(127,127,127,.12); }
.listing li .bp {
  width: 9px; min-width: 9px; align-self: center; height: 9px; border-radius: 50%;
  border: 1px solid transparent;
}
.listing li:hover .bp { border-color: var(--ink-dim); }
.listing li.broken .bp { background: var(--danger); border-color: var(--danger); }
.listing li .pc { color: var(--ink-dim); min-width: 3ch; text-align: right; }
.listing li .lbl { color: var(--accent); }
.listing li.locked-note { cursor: default; padding: 10px 12px; white-space: normal; line-height: 1.5; color: var(--ink-dim); }
.listing li.locked-note .src { color: var(--ink-dim); }
.listing li .src { color: var(--ink); }
.listing li .cyc { margin-left: auto; color: var(--ink-dim); font-size: 10px; }
.listing li.here { background: var(--ink); }
.listing li.here .pc, .listing li.here .src, .listing li.here .lbl, .listing li.here .cyc { color: var(--bg); }
/* Still paying for the previous instruction: this line is next, not running. */
.listing li.here.waiting { background: transparent; box-shadow: inset 0 0 0 1px var(--ink-dim); }
.listing li.here.waiting .pc, .listing li.here.waiting .lbl,
.listing li.here.waiting .cyc { color: var(--ink-dim); }
.listing li.here.waiting .src { color: var(--ink); }

.listing li.here.broken { background: var(--danger); }
.listing li.here.broken .bp { background: var(--bg); border-color: var(--bg); }
.listing li.label-row { padding-top: 4px; }

/* Half the debugger column, rather than the third it used to get. Fifty-odd
   variables in one column is a tall list whatever you do — the names run to
   thirteen characters, so a second column cannot fit one at this width — but
   half the height shows about twice as many at a glance. */
.vars {
  flex: 0 0 auto;
  max-height: 50%;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 2px 10px;
  font-family: var(--font);
  font-size: 10px;
  border-top: 1px solid var(--rule);
  padding-top: 8px;
}
.vars div { display: flex; justify-content: space-between; gap: 6px; }
.vars .k { color: var(--ink-dim); }
.vars .v { color: var(--ink-bright); font-variant-numeric: tabular-nums; }
.vars .changed .v { color: var(--accent); }
.vars .mine .k { color: var(--ink); }
.vars .mine .k::before { content: "·"; margin-right: 3px; color: var(--accent); }

/* ── the end-of-battle banner ────────────────────────────────────────── */

.banner {
  position: absolute;
  inset: auto 0 0 0;
  margin: 0 12px 12px;
  padding: 16px 20px;
  background: var(--panel);
  border: 1px solid var(--ink);
  border-radius: var(--radius);
  box-shadow: 0 -8px 40px rgba(0,0,0,.6);
  animation: rise .25s ease-out;
  max-height: 72%;
  overflow: auto;
}
@keyframes rise { from { transform: translateY(14px); opacity: 0; } }

.banner h2 { margin: 0 0 2px; font-size: 17px; color: var(--ink-bright); letter-spacing: .04em; }
.banner .why { margin: 0 0 12px; color: var(--ink-dim); font-size: 12px; }
.banner table { width: 100%; border-collapse: collapse; font-family: var(--font); font-size: 11px; }
.banner th { text-align: left; font-weight: 500; color: var(--ink-dim); text-transform: uppercase; letter-spacing: .06em; font-size: 10px; padding: 0 8px 5px 0; }
.banner td { padding: 3px 8px 3px 0; border-top: 1px solid var(--rule); font-variant-numeric: tabular-nums; }
.banner td.who { color: var(--ink-bright); }
.banner tr.out td { color: var(--ink-dim); }
.banner tr.won td.who { color: var(--accent); font-weight: 700; }
.banner .actions { margin-top: 14px; display: flex; gap: 8px; }

@media (max-width: 1180px) {
  .arena { --left: 220px; --right: 26px; }
  .arena:not(.fold-right) #debugger > .panel-head,
  .arena:not(.fold-right) #debugger > .panel-body { display: none; }
  .arena #debugger > .panel-spine { display: block; }
  .transport .step { visibility: hidden; }
  .setup-grid { grid-template-columns: 1fr 1fr; grid-template-rows: auto; }
  /* Two columns, so the box over the right-hand one is half the width less
     the gap, rather than a third. */
  .credits-box { flex-basis: calc((100% - 26px) / 2); }
  .setup-grid > .entrants { grid-column: auto; grid-row: auto; }
  .setup-grid > .ticker { grid-column: 1 / -1; grid-row: auto; }
}

/* ── workshop ────────────────────────────────────────────────────────── */

.workshop {
  position: relative;
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: minmax(0,1fr) 250px;
  gap: 10px;
  padding: 10px;
  min-height: 0;
}

.views { display: flex; gap: 4px; flex: 0 0 auto; }

.shelf { display: flex; flex-direction: column; padding: 8px; min-height: 0; gap: 8px; }
/* Two on the first line, the third across the second — a grid rather than a
   wrap, so the layout does not change shape with the panel's width. */
.shelf-kind { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.shelf-kind .btn { text-align: center; padding: 4px 6px; font-size: 10px; }
.shelf-kind .btn:last-child { grid-column: 1 / -1; }

.files { list-style: none; margin: 0; padding: 0; flex: 1 1 auto; overflow-y: auto; }
.files li {
  padding: 5px 8px; border-radius: var(--radius); cursor: pointer;
  font-family: var(--font); font-size: 12px; color: var(--ink-dim);
  display: flex; align-items: baseline; gap: 6px;
}
.files li:hover { background: var(--panel-2); color: var(--ink); }
.files li.on { background: var(--ink); color: var(--bg); }
.files li .ext { margin-left: auto; font-size: 9px; text-transform: uppercase; letter-spacing: .06em; opacity: .7; }

.editor { display: flex; flex-direction: column; min-height: 0; padding: 8px; }
/* ── the code editor ──────────────────────────────────────────────────────
   A textarea with a ruler beside it. The textarea keeps native undo,
   selection and keyboard handling; the gutter only has to agree with it about
   where the lines are — which it can, because wrap="off" means one line of
   text is one line on screen. Everything metric here has to match the
   textarea exactly or the numbers drift as you scroll. */

.code {
  flex: 1 1 auto; min-height: 0;
  display: flex;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--bg);
  overflow: hidden;
}

.gutter {
  flex: 0 0 auto;
  overflow: hidden;
  padding: 8px 7px 8px 9px;
  font-family: var(--font);
  font-size: 12px;
  line-height: 1.55;
  text-align: right;
  color: var(--ink-dim);
  background: var(--panel);
  border-right: 1px solid var(--rule);
  user-select: none;
  -webkit-user-select: none;
  font-variant-numeric: tabular-nums;
}
.gutter b { display: block; font-weight: 400; cursor: pointer; }
.gutter b:hover { color: var(--ink-bright); }
.gutter b.here { color: var(--ink-bright); }
.gutter b.bad { color: var(--danger); font-weight: 700; }

.editor .code textarea {
  flex: 1 1 auto; min-height: 0; resize: none;
  font-family: var(--font); line-height: 1.55;
  font-size: 12px;
  padding: 8px 10px;
  border: 0; border-radius: 0;
  background: var(--bg);
  tab-size: 2;
}

/* ── the language at the writer's elbow ─────────────────────────────────
   The highlighter is a <pre> laid under the textarea with the very same
   metrics — font, size, line height, padding, tab size — so its colour sits
   exactly under the letters; the textarea's own text goes transparent over it
   and keeps its caret and selection. */
.code-body { position: relative; flex: 1 1 auto; min-width: 0; display: flex; }
.code-body textarea { position: relative; z-index: 1; width: 100%; }
.code-body textarea.lit { color: transparent; caret-color: var(--ink); background: transparent; }
.code-body .hl {
  position: absolute; inset: 0; margin: 0; overflow: hidden; pointer-events: none;
  font-family: var(--font); font-size: 12px; line-height: 1.55; padding: 8px 10px; tab-size: 2;
  white-space: pre; color: var(--ink); background: var(--bg);
}
.hl-comment { color: var(--ink-dim); }
.hl-note { color: var(--ink-dim); opacity: .75; font-style: italic; }
.hl-section { color: var(--ink-bright); font-weight: 700; }
.hl-key { color: var(--ink-dim); }
.hl-value { color: var(--ink); }
.hl-label { color: var(--accent); }
.hl-keyword { color: var(--ink-bright); font-weight: 600; }
.hl-ins { color: var(--ink); }
.hl-sysvar { color: color-mix(in srgb, var(--accent) 55%, var(--ink)); }
.hl-var { color: color-mix(in srgb, var(--ink-bright) 60%, var(--ink)); }
.hl-num { color: var(--ink-bright); }
.hl-op, .hl-paren { color: var(--ink-dim); }
.hl-string { color: var(--ink-bright); }

/* What the caret is on, in a strip under the code. Three lines tall whatever
   is in it — an instruction with a long tip, a variable, nothing — so the
   editor above never changes size as the caret moves; more than three scrolls. */
.caret-help {
  flex: 0 0 auto; margin-top: 6px; padding: 4px 8px;
  height: calc(3 * 1.5em + 10px); overflow-y: auto;
  display: flex; align-items: baseline; align-content: flex-start; gap: 4px 10px; flex-wrap: wrap;
  border: 1px solid var(--rule); border-radius: var(--radius); background: var(--panel-2);
  font-family: var(--font); font-size: 11px; line-height: 1.5; color: var(--ink-dim); cursor: pointer;
}
.caret-help.idle { cursor: default; }
.caret-help .empty { color: var(--ink-dim); opacity: .7; flex-basis: 100%; }
.caret-help b { color: var(--ink-bright); font-weight: 600; white-space: nowrap; }
.caret-help i { font-style: normal; color: var(--accent); font-variant-numeric: tabular-nums; white-space: nowrap; }
.caret-help span { color: var(--ink); }
.caret-help em { font-style: normal; color: var(--ink-dim); flex-basis: 100%; }
.caret-help:hover { border-color: var(--ink-dim); }

/* A ranking page: Markdown the simulator wrote, read in the editor's place. */
.doc-view { display: block; overflow-y: auto; padding: 14px 18px; background: var(--panel); }
.doc-view .markdown { max-width: 62em; }
.doc-view .markdown table { font-size: 11px; }

/* The cheat sheet: the panel's other face. */
.side-tabs { gap: 4px; }
.side-tabs .credits { margin-left: auto; }
.cheat-sheet { display: flex; flex-direction: column; min-height: 0; gap: 6px; }
.cs-find input { width: 100%; font-size: 11px; padding: 4px 8px; }
.cs-note { margin: 0; font-size: 10px; line-height: 1.45; color: var(--ink-dim); }
.cs-list { flex: 1 1 auto; min-height: 0; overflow-y: auto; font-family: var(--font); }
.cs-group { border-top: 1px solid var(--rule); }
.cs-group summary { cursor: pointer; padding: 5px 2px; font-size: 10px; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-dim); list-style: none; display: flex; }
.cs-group summary::before { content: '▸'; margin-right: 6px; }
.cs-group[open] summary::before { content: '▾'; }
.cs-group summary i { margin-left: auto; font-style: normal; color: var(--ink-dim); }
.cs-row { display: grid; grid-template-columns: 1fr auto; gap: 0 6px; padding: 3px 4px 4px; font-size: 11px; cursor: pointer; border-radius: var(--radius); }
.cs-row:hover { background: color-mix(in srgb, var(--ink) 10%, transparent); }
.cs-row b { color: var(--ink-bright); font-weight: 600; word-break: break-word; }
.cs-row > i { font-style: normal; color: var(--accent); font-variant-numeric: tabular-nums; font-size: 10px; }
.cs-row small { grid-column: 1 / -1; color: var(--ink-dim); font-size: 10px; }
.cs-row span { grid-column: 1 / -1; color: var(--ink-dim); font-size: 10px; line-height: 1.4; }
.cs-row em { grid-column: 1 / -1; font-style: normal; color: var(--danger); font-size: 10px; }
.cs-row .cs-var { color: color-mix(in srgb, var(--accent) 55%, var(--ink-bright)); }
.cs-row.cs-lit { animation: cs-lit 1.2s ease-out; }
@keyframes cs-lit { 0% { background: color-mix(in srgb, var(--accent) 40%, transparent); } 100% { background: transparent; } }

/* The walkthrough strip: what to do next, above the code. */
.guide {
  flex: 0 0 auto; margin: 0 0 8px; padding: 8px 12px 10px;
  border: 1px solid var(--accent); border-radius: var(--radius);
  background: color-mix(in srgb, var(--accent) 7%, var(--panel-2));
}
.guide-head { display: flex; align-items: center; gap: 10px; font-size: 11px; color: var(--ink-dim); }
.guide-head b { color: var(--ink-bright); font-size: 12px; }
.guide-dots { display: flex; gap: 4px; }
.guide-dots i { width: 8px; height: 8px; border-radius: 50%; border: 1px solid var(--ink-dim); }
.guide-dots i.done { background: var(--accent); border-color: var(--accent); }
.guide-dots i.now { border-color: var(--accent); box-shadow: 0 0 6px var(--accent); }
.guide-step { margin-left: auto; font-family: var(--font); }
.guide-say { margin: 6px 0 0; font-size: 12px; line-height: 1.55; color: var(--ink); max-width: 90ch; }
.guide-say code { font-family: var(--font); color: var(--ink-bright); background: color-mix(in srgb, var(--ink) 10%, transparent); padding: 0 4px; border-radius: 2px; }
.guide-acts { display: flex; gap: 6px; margin-top: 8px; }

/* The label picker in the header. */
.label-pick { font-size: 11px; padding: 4px 7px; max-width: 180px; }

.saved { font-size: 10px; color: var(--ink-dim); letter-spacing: .05em; text-transform: uppercase; }
.saved.dirty { color: var(--accent); }

/* What the file is, and where the pointer is, on one line: the name and size
   on the left, the cell under the cursor hard right. */
/* The cap and the scrolling belong to the row, not to what is in it. A
   percentage height needs a parent with a definite one, and this row's is its
   content — put max-height on .problems here and it collapses to a sliver. */
.status-row {
  flex: 0 0 auto;
  max-height: 30%;
  overflow-y: auto;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-top: 8px;
}

.problems {
  flex: 1 1 auto; min-width: 0;
  font-family: var(--font); font-size: 11px; line-height: 1.6;
}
.problems .row-err { color: var(--danger); cursor: pointer; }
.problems .row-warn { color: var(--ink-dim); }
.problems .row-lint { color: color-mix(in srgb, var(--danger) 55%, var(--ink)); cursor: pointer; }
.problems .row-lint::before { content: '⚠ '; }
.problems .row-ok { color: var(--accent); }
.problems .hint { color: var(--ink-dim); margin: 0 0 0 2ch; }

.designer, .painter { display: flex; flex-direction: column; min-height: 0; padding: 8px; }
.credits { font-family: var(--font); font-size: 11px; color: var(--ink-bright); }
.credits.over { color: var(--danger); }

.designer .part { margin-bottom: 10px; }
.designer .part > label {
  display: block; font-size: 10px; text-transform: uppercase; letter-spacing: .08em;
  color: var(--ink-dim); margin-bottom: 3px;
}
.designer select { width: 100%; }
.designer .specials { display: flex; flex-direction: column; gap: 2px; }
.designer .specials label {
  display: flex; align-items: center; gap: 6px; font-size: 11px; cursor: pointer;
  color: var(--ink-dim);
}
.designer .specials label:hover { color: var(--ink); }
.designer .specials input { accent-color: var(--accent); }
.designer .specials .cost { margin-left: auto; font-family: var(--font); font-size: 10px; }

.palette { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin-bottom: 8px; }
.palette button {
  display: flex; align-items: center; gap: 5px;
  font: inherit; font-size: 10px; line-height: 1.25; padding: 5px 7px; cursor: pointer;
  border: 1px solid var(--rule); border-radius: var(--radius);
  background: var(--panel-2); color: var(--ink-dim);
  text-align: left; white-space: nowrap; overflow: hidden;
}
.palette button:hover { color: var(--ink-bright); border-color: var(--ink-dim); }
.palette button.on { border-color: var(--ink); color: var(--ink-bright); }
.palette button i { width: 12px; height: 12px; border-radius: 2px; display: block; flex: 0 0 auto; }

.tool-row { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 8px; }
.tool-row .btn { flex: 1 1 auto; font-size: 11px; padding: 5px 7px; }
.size-row .mini { flex: 1 1 40px; }
.size-row .btn { flex: 0 0 auto; }

.mini { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; font-size: 10px;
  text-transform: uppercase; letter-spacing: .06em; color: var(--ink-dim); }
.mini input[type=range] { flex: 1 1 auto; accent-color: var(--accent); }
.mini input[type=text], .mini input[type=number] { flex: 1 1 auto; min-width: 0; }
.mini b { color: var(--ink-bright); font-family: var(--font); min-width: 2ch; text-align: right; }

.zone-row select { flex: 0 0 auto; width: 3.6em; padding: 3px 4px; }
.scan-row select { flex: 1 1 auto; min-width: 0; padding: 3px 4px; font-size: 10px; }
.scan-row .btn { flex: 0 0 auto; font-size: 11px; padding: 5px 9px; }
/* A marker tool in hand: the terrain palette and brush are not what a click
   does, and they fade to say so. Picking a terrain brings them back. */
.painter.marking .palette, .painter.marking .mini:has(#brush) { opacity: .45; }
.zone-row .btn { flex: 1 1 auto; font-size: 11px; padding: 5px 7px; }

.zoom-row .btn { flex: 0 0 auto; }
.zoom-row .btn.icon { padding: 4px 6px; }
.zoom-row b { min-width: 4ch; text-align: center; text-transform: none; }
.zoom-row small { flex: 1 1 auto; white-space: nowrap; font-family: var(--font); font-size: 10px;
  letter-spacing: 0; text-transform: none; color: var(--ink-dim); font-variant-numeric: tabular-nums; }

/* The battlefield itself is the editor, so it gets the room the text had. */
.canvas-wrap {
  flex: 1 1 auto; min-height: 0; position: relative;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg); border: 1px solid var(--rule); border-radius: var(--radius);
  overflow: hidden;
}
#paintCanvas { image-rendering: pixelated; cursor: crosshair; max-width: 100%; max-height: 100%; }
/* It used to sit inside the field graphic, over whatever you were painting. */
.cursor-at {
  flex: 0 0 auto;
  position: sticky;
  top: 0;
  font-family: var(--font); font-size: 11px; line-height: 1.6;
  color: var(--ink-dim);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  pointer-events: none;
}

/* With the canvas open the text is a drawer, not the main event. */
.editor.drawing .panes { flex: 0 0 auto; height: 150px; margin-top: 8px; }
.editor.drawing:not(.showing-source) .panes { display: none; }

/* A theme is two files that only make sense together, so they are edited
   together — side by side, each with its own ruler. */
.panes { flex: 1 1 auto; min-height: 0; display: flex; gap: 8px; }
.panes > .code { flex: 1 1 50%; min-width: 0; }

.editor.theming .code { position: relative; }
.editor.theming .code::after {
  content: attr(data-label);
  position: absolute;
  top: 0; right: 0;
  padding: 2px 7px;
  font-family: var(--font);
  font-size: 10px;
  color: var(--ink-dim);
  background: var(--panel);
  border-left: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  border-radius: 0 var(--radius) 0 var(--radius);
  pointer-events: none;
}

@media (max-width: 1180px) {
  .workshop { grid-template-columns: 170px minmax(0,1fr); }
  .designer, .painter { display: none; }
}

/* The capsules a cybertank is built out of, and how much of it each accounts
   for. Clicking one opens it. */
.includes { list-style: none; display: flex; flex-wrap: wrap; gap: 4px; margin: 8px 0 0; padding: 0; }

/* ── the Finder ──────────────────────────────────────────────────────────
   Takes the editor's place until something is open, and whenever Files is
   pressed. With no chassis or terrain panel to show, it has the width. */
.editor.finding .panes, .editor.finding .status-row, .editor.finding .includes, .editor.finding .canvas-wrap, .editor.finding .caret-help { display: none !important; }
.workshop:has(.editor.finding), .workshop:has(#designer[hidden]):has(#painter[hidden]) { grid-template-columns: minmax(0, 1fr); }
.finder { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; gap: 8px; margin-top: 2px; }
.fd-item.recent .fd-icon { color: var(--accent); }
.fd-bar { display: flex; align-items: center; gap: 10px; flex: 1 1 auto; min-width: 0; }
/* The path, on both faces of the header: every crumb the same face and size,
   the one you are in brightest, the ones you can go back to lit on hover. */
.fd-path { display: flex; align-items: center; gap: 8px; min-width: 0; font-family: var(--font); font-size: 12px; font-weight: 600; color: var(--ink-dim); }
.fd-path b { color: var(--ink-bright); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fd-up { background: none; border: 0; padding: 0; color: var(--ink); font: inherit; cursor: pointer; display: inline-flex; align-items: center; }
/* A crumb in the trail: an icon and a word. The icons are the punctuation,
   so there is nothing between them but the gap. */
.fd-crumb { display: inline-flex; align-items: center; min-width: 0; color: var(--ink-dim); font-weight: 600; }
.fd-crumb:last-child { color: var(--ink-bright); }
button.fd-crumb { cursor: pointer; }
button.fd-crumb:hover { color: var(--ink-bright); }
button.fd-crumb:hover .fd-crumb-icon { color: var(--accent); }
.fd-crumb-icon { color: var(--ink-dim); transition: color .12s; }
.fd-path b { display: inline-flex; align-items: center; }
.fd-crumb-icon { display: inline-block; width: 16px; height: 16px; margin-right: 6px; flex: 0 0 auto; }
.fd-crumb-icon svg { width: 100%; height: 100%; display: block; }
.fd-list tr.recent .fd-mini { color: var(--accent); }
.fd-wide { white-space: normal; max-width: none; }
.fd-up:hover { color: var(--ink-bright); text-decoration: underline; }
/* A crumb that is only a place name, not a way back. */
.fd-here { display: inline-flex; align-items: center; color: var(--ink-dim); cursor: default; }
.editor-title { flex: 1 1 auto; }
.fd-count { margin-left: auto; font-size: 11px; color: var(--ink-dim); font-variant-numeric: tabular-nums; }
.fd-views { display: flex; gap: 4px; }
.fd-views .btn.icon svg { width: 13px; height: 13px; }
.fd-tools { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.fd-tools .btn { font-size: 11px; padding: 4px 10px; }
.fd-gap { flex: 1 1 auto; }
.fd-blurb { margin: 0; font-size: 11px; color: var(--ink-dim); line-height: 1.5; }
.fd-body { flex: 1 1 auto; min-height: 0; overflow: auto; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--bg); }
.fd-empty { margin: 0; padding: 40px 16px; text-align: center; color: var(--ink-dim); font-size: 12px; }

/* Icons: a grid, the name under each, the selection inverted the way a
   Macintosh did it. */
.fd-icons { display: grid; grid-template-columns: repeat(auto-fill, 104px); gap: 6px; padding: 12px; align-content: start; }
.fd-desktop { grid-template-columns: repeat(auto-fill, 120px); padding: 20px; gap: 10px; }
.fd-item { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 4px; border-radius: var(--radius);
  cursor: default; user-select: none; text-align: center; color: var(--ink); }
.fd-item .fd-icon { width: 44px; height: 44px; color: var(--ink); }
.fd-item .fd-icon svg { width: 100%; height: 100%; }
.fd-desktop .fd-item .fd-icon { width: 52px; height: 52px; }
.fd-item .fd-name { font-family: var(--font); font-size: 11px; line-height: 1.25; max-width: 100%; overflow-wrap: anywhere; padding: 1px 4px; border-radius: 2px; }
.fd-item .fd-sub { font-size: 9px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-dim); }
.fd-item:hover .fd-icon { color: var(--ink-bright); }
.fd-item.on .fd-name { background: var(--ink); color: var(--bg); }
.fd-item.on .fd-icon { color: var(--accent); }

/* The list: columns you can sort by. */
.fd-list { width: 100%; border-collapse: collapse; font-family: var(--font); font-size: 12px; }
.fd-list th { position: sticky; top: 0; background: var(--panel-2); text-align: left; font-weight: 500; font-size: 10px; text-transform: uppercase;
  letter-spacing: .06em; color: var(--ink-dim); padding: 6px 10px; border-bottom: 1px solid var(--rule); cursor: pointer; user-select: none; white-space: nowrap; }
.fd-list th.on { color: var(--ink-bright); }
.fd-list th.on.asc::after { content: " ▲"; font-size: 8px; }
.fd-list th.on.desc::after { content: " ▼"; font-size: 8px; }
.fd-list td { padding: 5px 10px; border-bottom: 1px solid var(--rule); white-space: nowrap; color: var(--ink); cursor: default; user-select: none; }
.fd-list tr:hover td { background: var(--panel-2); }
.fd-list tr.on td { background: var(--ink); color: var(--bg); }
.fd-list tr.on td .fd-mini { color: var(--bg); }
.fd-cell-name { display: flex; align-items: center; gap: 8px; }
.fd-mini { width: 18px; height: 18px; flex: 0 0 auto; color: var(--ink-dim); }
.fd-mini svg { width: 100%; height: 100%; }
.fd-num { text-align: right; font-variant-numeric: tabular-nums; }
.fd-when { font-family: var(--font); font-variant-numeric: tabular-nums; white-space: nowrap; }
.fd-note { margin: 8px 0 0; padding: 0 8px; font-size: 10px; color: var(--ink-dim); letter-spacing: .04em; }
.fd-mono { font-variant-numeric: tabular-nums; }
.fd-dim { color: var(--ink-dim); max-width: 260px; overflow: hidden; text-overflow: ellipsis; }
.fd-keep { font-style: normal; font-size: 9px; text-transform: uppercase; letter-spacing: .06em; color: var(--accent); margin-left: 6px; }

/* The menu under the right button. */
.fd-menu { position: fixed; z-index: 40; min-width: 160px; padding: 4px; background: var(--panel); border: 1px solid var(--ink-dim);
  border-radius: var(--radius); box-shadow: 0 8px 24px rgba(0,0,0,.5); display: flex; flex-direction: column; }
.fd-menu button { background: none; border: 0; text-align: left; padding: 6px 12px; font: inherit; font-size: 12px; color: var(--ink); cursor: pointer; border-radius: 2px; }
.fd-menu button:hover:not(:disabled) { background: var(--ink); color: var(--bg); }
.fd-menu button:disabled { color: var(--ink-dim); opacity: .5; cursor: default; }

/* Find: a magnifier in the header that opens into a bar, and the same bar
   above the manual. The current match is the bright one. */
.find-bar { display: inline-flex; align-items: center; gap: 4px; flex: 1 1 auto; min-width: 0; }
.find-bar input[type=text] { width: 150px; min-width: 60px; padding: 3px 8px; font-size: 12px; }
.find-bar #replaceText { width: 130px; margin-left: 6px; }
.find-bar .btn { padding: 3px 8px; font-size: 11px; }
.find-bar .btn.icon { font-size: 15px; line-height: 1; padding: 1px 7px; }
.find-count { font-family: var(--font); font-size: 10px; color: var(--ink-dim); min-width: 5.5ch; white-space: nowrap; font-variant-numeric: tabular-nums; }
.find-count.none { color: var(--danger); }
.editor-head.finding-text .editor-title { display: none; }
.manual-find { display: flex; align-items: center; gap: 4px; margin: -4px 0 4px; }
.manual-find input[type=text] { flex: 1 1 auto; max-width: 320px; }
mark.hit { background: color-mix(in srgb, var(--accent) 35%, transparent); color: inherit; border-radius: 2px; padding: 0 1px; }
mark.hit.cur { background: var(--accent); color: var(--accent-ink, #0a0b06); }

/* The header wears one face at a time, at one height: the tallest thing on
   either face is a button, and the bar is sized for one so the content below
   never moves when the face changes. */
.editor-head { min-height: 36px; }
.editor-controls { display: contents; }
.editor.finding .editor-controls { display: none; }
.finder-bar { display: none; }
.editor.finding .finder-bar { display: flex; flex: 1 1 auto; align-items: center; gap: 10px; min-width: 0; }
#closeFile { flex: 0 0 auto; padding: 4px 6px; }
.includes li {
  display: flex; align-items: baseline; gap: 5px;
  font-family: var(--font); font-size: 10px;
  padding: 3px 7px; border: 1px solid var(--rule); border-radius: var(--radius);
  color: var(--ink-dim); cursor: pointer;
}
.includes li:hover { color: var(--ink-bright); border-color: var(--ink-dim); }
.includes li b { color: var(--ink); font-weight: 400; }
.includes li span { opacity: .7; }

/* ── modals ───────────────────────────────────────────────────────────────
   Two questions, asked the same way wherever they come up: which one, and
   what shall it be called. Everything here is theme variables, so a dialog
   belongs to whichever theme is on. */

.modal {
  padding: 0;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--ink);
  font-family: var(--font-ui);
  min-width: 320px;
  max-width: min(90vw, 460px);
  box-shadow: var(--shadow);
}

.modal::backdrop { background: rgba(0, 0, 0, .55); }

.modal form { display: flex; flex-direction: column; gap: 14px; padding: 18px 20px 16px; }

.modal h2 {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-bright);
  text-shadow: var(--glow);
}

.modal-body { display: flex; flex-direction: column; gap: 6px; }
.modal-label { font-size: 11px; color: var(--ink-dim); }
.modal-check { display: flex; align-items: center; gap: 7px; margin-top: 4px; font-size: 11px; color: var(--ink-dim); cursor: pointer; }
.modal-check input { accent-color: var(--accent); margin: 0; }

.modal-body input[type=text],
.modal-body input[type=password],
.modal-body select {
  width: 100%;
  padding: 7px 9px;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--panel-2);
  color: var(--ink);
  font-family: var(--font);
  font-size: 13px;
}

.modal-body input[type=password]:focus,
.modal-body input[type=text]:focus,
.modal-body select:focus { outline: none; border-color: var(--accent); }

.modal-message { margin: 0; font-size: 13px; line-height: 1.45; }
.modal-detail { margin: 0; font-size: 11px; color: var(--ink-dim); line-height: 1.45; }

.modal-error { margin: 0; font-size: 11px; color: var(--danger); }

.modal-actions { display: flex; justify-content: flex-end; gap: 8px; }
.modal-actions .btn.danger { background: var(--danger); border-color: var(--danger); color: var(--accent-ink, #0a0b06); }


/* ── sound ────────────────────────────────────────────────────────────── */

/* The top bar keeps only the way in. Everything sound does is behind it,
   including whether it does anything at all — the button lights when it will. */
/* Config, in the top bar, is an ordinary button like Simulate and Workshop —
   it opens every setting, not only the sound's. It is also the master
   switch's indicator: the danger colour while sound is off, and a flash on
   the change the way every other switch does it. */
.config-open.muted { color: var(--danger); border-color: var(--danger); }
.config-open.flash { animation: mute-flash-stay 1.1s ease-out both; }
@keyframes mute-flash-stay { 0% { transform: scale(1.15); } 30% { transform: scale(1); } 100% { transform: scale(1); } }

.sound-master {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 10px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--rule);
}
.sound-vol { display: flex; align-items: center; gap: 8px; font-size: 11px; color: var(--ink-dim); }
.sound-vol input[type=range] { width: 110px; accent-color: var(--accent); }
.sound-vol input[type=range]:disabled { opacity: .35; }

.sound-kinds { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 14px; }
.sound-kind { display: flex; align-items: center; gap: 7px; font-size: 12px; cursor: pointer; }
.sound-kind input { accent-color: var(--accent); }
.sound-kinds.off { opacity: .4; pointer-events: none; }

/* The capsule picker sits past Save, with room to read as a separate thing. */
.include-pick { margin-left: 10px; }

/* ── chassis help ─────────────────────────────────────────────────────── */

.panel-foot { margin-top: auto; padding-top: 8px; display: flex; justify-content: flex-end; }
.help-dot { border-radius: 50%; width: 22px; height: 22px; padding: 0; line-height: 1; font-size: 12px; }

.modal.help { max-width: min(94vw, 720px); }
/* Block, not flex. .modal-body is a flex column for the little dialogs whose
   children are form controls; here the children are documents, and a flex item
   shrinks below its own content when the container is capped — which squashed
   tall code blocks and tables down to a sliver. */
.modal.help .modal-body { display: block; max-height: 66vh; overflow-y: auto; }

.help-group { margin: 0 0 18px; }
.help-group:last-child { margin-bottom: 0; }
.help-group h3 {
  margin: 0 0 5px;
  font-size: 11px; letter-spacing: .09em; text-transform: uppercase;
  color: var(--ink-bright);
}
.help-group p { margin: 0 0 9px; font-size: 12px; line-height: 1.6; }

.help-table { width: 100%; border-collapse: collapse; font-size: 11px; }
.help-table tr.fitted td, .help-item.fitted b { color: var(--ink-bright); }
.help-table tr.fitted { background: color-mix(in srgb, var(--accent) 9%, transparent); }
.help-table .note { display: block; margin-top: 2px; color: var(--ink-dim); line-height: 1.45; }
.fit { font-style: normal; font-size: 9px; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); margin-left: 6px; }
.help-here > h3 { color: var(--accent); }
/* The ? beside a chassis slot or a special item: the same button as the one
   at the foot of the panel, smaller, at the right of its row. */
.help-dot.mini { width: 16px; height: 16px; font-size: 10px; margin-left: auto; flex: 0 0 auto; color: var(--ink); display: inline-flex; align-items: center; justify-content: center; padding-bottom: 1px; }
.designer .part > label { display: flex; align-items: center; gap: 6px; }
.designer .specials label .help-dot.mini { margin-left: 4px; }
.help-table td { padding: 3px 10px 3px 0; border-bottom: 1px solid var(--rule); vertical-align: top; }
.help-table .n { color: var(--ink-bright); font-family: var(--font); white-space: nowrap; }
.help-table .c { text-align: right; color: var(--ink-dim); font-variant-numeric: tabular-nums; white-space: nowrap; }
.help-table .d { color: var(--ink-dim); line-height: 1.55; }

.help-item { padding: 7px 0; border-bottom: 1px solid var(--rule); }
.help-item b { color: var(--ink-bright); font-weight: 600; font-size: 12px; }
.help-item .cost { float: right; color: var(--ink-dim); font-size: 11px; font-variant-numeric: tabular-nums; }
.help-item p { margin: 3px 0 0; font-size: 12px; line-height: 1.6; color: var(--ink); }
.help-cmds { margin: 5px 0 0; display: flex; flex-wrap: wrap; gap: 4px; }
.help-cmds code {
  font-family: var(--font); font-size: 10px;
  padding: 1px 6px;
  border: 1px solid var(--rule); border-radius: var(--radius);
  color: var(--accent);
}

/* ── the manual ───────────────────────────────────────────────────────── */

.modal.manual { max-width: min(96vw, 860px); }
.modal.manual .modal-body { display: block; max-height: 70vh; overflow-y: auto; }
.modal.manual .modal-actions { align-items: center; justify-content: space-between; }
.manual-src { font-family: var(--font); font-size: 10px; color: var(--ink-dim); }

.markdown { font-size: 12px; line-height: 1.65; }
.markdown h1 { margin: 0 0 8px; font-size: 15px; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-bright); }
.markdown h2 { margin: 20px 0 6px; font-size: 13px; color: var(--ink-bright); }
.markdown h3 { margin: 16px 0 5px; font-size: 11px; letter-spacing: .07em; text-transform: uppercase; color: var(--accent); }
.markdown h4 { margin: 12px 0 4px; font-size: 11px; color: var(--ink-bright); }
.markdown p { margin: 0 0 9px; }
.markdown hr { border: 0; border-top: 1px solid var(--rule); margin: 14px 0; }
.markdown ul { margin: 0 0 9px; padding-left: 18px; }
.markdown li { margin: 2px 0; }
.markdown code { font-family: var(--font); font-size: 11px; color: var(--accent); }
.markdown pre {
  margin: 0 0 10px; padding: 8px 10px; overflow-x: auto;
  background: var(--panel-2); border: 1px solid var(--rule); border-radius: var(--radius);
}
.markdown pre code { color: var(--ink); }

.markdown table { width: 100%; border-collapse: collapse; margin: 0 0 12px; font-size: 11px; }
.markdown th {
  padding: 3px 8px 4px 0; border-bottom: 1px solid var(--rule);
  font-weight: 400; font-size: 10px; letter-spacing: .06em;
  text-transform: uppercase; color: var(--ink-dim);
}
.markdown td { padding: 3px 8px 3px 0; border-bottom: 1px solid var(--rule); vertical-align: top; }
.markdown td code { white-space: nowrap; }

/* An empty log panel reads as a broken one, so it explains itself instead. */
.log-empty { margin: 0; padding: 6px 2px; color: var(--ink-dim); font-size: 11px; line-height: 1.6; }

/* Settings sections: the sound panel grew into the place preferences live. */
.settings-block { padding-bottom: 12px; margin-bottom: 12px; border-bottom: 1px solid var(--rule); }
.settings-block:last-of-type { padding-bottom: 0; margin-bottom: 0; border-bottom: 0; }
.settings-block h3 {
  margin: 0 0 7px;
  font-size: 10px; letter-spacing: .09em; text-transform: uppercase;
  color: var(--ink-dim);
}
.settings-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 12px; }
.settings-row select { flex: 0 1 auto; min-width: 0; }

/* The hull preview sits with its dropdown, because "saucer" means nothing
   until you have seen one. */
.hull-pick { display: flex; align-items: center; gap: 10px; }
.hull-pick canvas {
  width: 44px; height: 44px;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--board-bg);
}


/* ── effects ─────────────────────────────────────────────────────────────
   Switched by attributes on <html> that fx.js keeps up to date: data-crt,
   data-motion and data-ambience are "full", "reduced" or "off". Everything
   below is decoration; the page reads the same with all of it off. */

/* The CRT look. The scanlines above are the theme's own; these are the rest
   of the tube — the dark corners, a faint flicker, a bar rolling down. */
html[data-crt="full"] body::before, html[data-crt="reduced"] body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 49;
  background: radial-gradient(ellipse at center, rgba(0,0,0,0) 58%, rgba(0,0,0,.42) 100%);
}
html[data-crt="full"] body::after {
  animation: crt-flicker 3.7s steps(1) infinite;
}
html[data-crt="full"] #app::after {
  content: "";
  position: fixed;
  left: 0; right: 0;
  height: 90px;
  top: -90px;
  pointer-events: none;
  z-index: 48;
  background: linear-gradient(to bottom, rgba(255,255,255,0), rgba(255,255,255,.035) 50%, rgba(255,255,255,0));
  animation: crt-roll 9s linear infinite;
}
@keyframes crt-flicker {
  0%, 92%, 100% { opacity: calc(var(--scanlines) * .35); }
  93% { opacity: calc(var(--scanlines) * .30); }
  95% { opacity: calc(var(--scanlines) * .40); }
  97% { opacity: calc(var(--scanlines) * .33); }
}
@keyframes crt-roll { to { transform: translateY(calc(100vh + 180px)); } }

/* The tube warming up, once, when the page arrives. */
#app.crt-on {
  animation: crt-on .9s cubic-bezier(.2, .8, .3, 1) both;
  transform-origin: center;
}
@keyframes crt-on {
  0%   { transform: scaleY(.004) scaleX(.6); filter: brightness(6); opacity: 1; }
  35%  { transform: scaleY(.004) scaleX(1.02); filter: brightness(4); }
  60%  { transform: scaleY(1) scaleX(1); filter: brightness(1.8); }
  100% { transform: none; filter: none; }
}

/* A wipe when the view changes: the new screen comes in from the top under a
   bright line, or simply settles in when the CRT look is off. */
#app.wipe { animation: view-in .28s ease-out both; }
html[data-crt="full"] #app.wipe, html[data-crt="reduced"] #app.wipe {
  animation: view-wipe .36s linear both;
}
@keyframes view-in { from { opacity: 0; transform: translateY(6px); } }
@keyframes view-wipe {
  from { clip-path: inset(0 0 100% 0); filter: brightness(1.6); }
  70%  { filter: brightness(1.6); }
  to   { clip-path: inset(0 0 0 0); filter: none; }
}

/* Buttons that answer the hand. */
html[data-motion="full"] .btn:hover:not(:disabled) { box-shadow: 0 0 0 1px var(--accent) inset, 0 0 10px -2px var(--accent); }
html[data-motion="full"] .btn.primary:hover:not(:disabled), html[data-motion="full"] .btn.on:hover:not(:disabled) { box-shadow: 0 0 12px -1px var(--accent); }

/* An instrument card that has just taken a hit. */
html[data-motion="full"] .tankcard.hit, html[data-motion="reduced"] .tankcard.hit {
  border-color: var(--danger);
  box-shadow: 0 0 0 1px var(--danger) inset, 0 0 12px -2px var(--danger);
}
html[data-motion="full"] .tankcard.hit .meter .fill { filter: brightness(1.5); }

/* The verdict, stamped rather than slid. */
html[data-motion="full"] .banner { animation: stamp .42s cubic-bezier(.2, 1.4, .4, 1) both; }
@keyframes stamp {
  0%   { transform: scale(1.18); opacity: 0; filter: brightness(2); }
  55%  { transform: scale(.985); opacity: 1; filter: brightness(1.3); }
  100% { transform: none; filter: none; }
}

/* The line the debugger is on, breathing. */
html[data-motion="full"] .listing li.here:not(.waiting) { animation: here-pulse 1.4s ease-in-out infinite; }
@keyframes here-pulse { 50% { box-shadow: 0 0 10px -2px var(--ink); } }

/* Ambience: the battlefield thumbnail revealing itself line by line, and the
   line the caret is on in the Workshop's editor. */
html[data-ambience="full"] #fieldPreview.reveal, html[data-ambience="reduced"] #fieldPreview.reveal {
  animation: reveal .55s steps(24) both;
}
@keyframes reveal { from { clip-path: inset(0 0 100% 0); } to { clip-path: inset(0 0 0 0); } }
html[data-ambience="full"] .gutter b.here { color: var(--accent); text-shadow: 0 0 6px var(--accent); animation: caret-pulse 1.6s ease-in-out infinite; }
html[data-ambience="reduced"] .gutter b.here { color: var(--accent); }
@keyframes caret-pulse { 50% { opacity: .55; } }

/* A sound's switch sits on the thing that makes the sound, marked by a
   triangle folded into its bottom-right corner in the border's colour —
   filled while the sound is on, hollow while it is off — whose tooltip names
   the sound. An instrument is the switch itself as well; anything with a job
   of its own has only the corner and the badge. The badge is a speaker in the
   top corner that shows on hover, and for a moment after a click to say the
   switch took; it does not stay. */
.instrument, .sounding { position: relative; }
.instrument .snd-corner { color: var(--rule); }
/* Two pixels down and right of where its box would put it, so the fold sits
   on the border itself rather than just inside it. */
.snd-corner { position: absolute; right: 1px; bottom: 1px; width: 11px; height: 11px; color: var(--rule); cursor: pointer; z-index: 2; transition: color .12s; transform: translate(2px, 2px); }
.snd-corner svg { width: 100%; height: 100%; display: block; }
.snd-corner .snd-fold { fill: currentColor; }
.snd-corner .snd-edge { fill: none; stroke: currentColor; stroke-width: 1; }
.muted .snd-corner .snd-fold { fill: none; }
.snd-corner:hover { color: var(--ink-dim); }
.mute-badge { position: absolute; top: 4px; right: 6px; width: 14px; height: 14px; color: var(--ink-dim); opacity: 0; transition: opacity .12s; pointer-events: none; z-index: 2; }
.mute-badge svg { width: 100%; height: 100%; display: block; }
.mute-badge .slash { display: none; }
.sounding .mute-badge { cursor: pointer; }
.instrument:hover .mute-badge, .sounding:hover .mute-badge { opacity: .9; }
.muted .mute-badge { color: var(--danger); }
.muted .mute-badge .wave { display: none; }
.muted .mute-badge .slash { display: block; }
.flash .mute-badge { animation: mute-flash 1.1s ease-out both; }
@keyframes mute-flash { 0% { opacity: 1; transform: scale(1.5); } 25% { opacity: 1; transform: scale(1); } 75% { opacity: 1; } 100% { opacity: 0; } }
/* A switch next to a button rather than on it: the spot is the corner mark,
   sat at the foot of the row, and the badge flashes over it. */
.snd-spot { display: inline-flex; align-items: center; width: 16px; height: 16px; flex: 0 0 auto; align-self: flex-end; position: relative; }
.snd-spot .mute-badge.inline { position: absolute; left: 1px; top: 0; width: 14px; height: 14px; }
.snd-spot .snd-corner { right: 0; bottom: 0; }
.snd-spot:hover .mute-badge, .status-row:hover .mute-badge { opacity: .9; }
.tools-switch { margin: -4px 0 6px auto; }
.status-row .mute-badge.inline { position: static; margin-left: 6px; }
.status-row .snd-corner { position: static; margin-left: 4px; align-self: flex-end; flex: 0 0 auto; }
#codeWrap.sounding .mute-badge { top: 6px; right: 14px; }
#codeWrap.sounding .snd-corner { right: 14px; bottom: 2px; }
.canvas-wrap.sounding .mute-badge { top: 6px; right: 8px; }
.builder-wrap { display: block; width: 64px; height: 64px; flex: 0 0 auto; }
.builder-wrap .mute-badge { top: 0; right: 0; }
.builder-wrap .snd-corner { right: 5px; bottom: 5px; }
.ticker.instrument .mute-badge { top: 6px; right: 8px; }

/* The instruments on the setup screen: a builder with a diagnostics
   teleprinter beside it above the roster, and lights with an equalizer over
   the middle column. Decoration, hidden with the rest of the ambience. */
.instruments-row { display: flex; gap: 8px; align-items: stretch; margin-bottom: 10px; }
.builder { display: block; width: 64px; height: 64px; flex: 0 0 auto; border-radius: 50%; border: 1px solid var(--rule); background: var(--board-bg); }
.diag {
  flex: 1 1 auto; min-width: 0; height: 64px; padding: 4px 8px;
  border: 1px solid var(--rule); border-radius: var(--radius); background: var(--board-bg);
  font-family: var(--font); font-size: 10px; line-height: 1.4; color: var(--ink-dim);
  white-space: pre; user-select: none; text-shadow: var(--glow);
}
.diag .dg-lines { display: flex; flex-direction: column; justify-content: flex-end; height: 100%; overflow: hidden; }
.diag .dg-line { opacity: .75; animation: tk-in .18s ease-out; }
.diag .dg-line.head { opacity: 1; color: var(--ink); }
.diag .dg-line.warn { opacity: 1; color: var(--danger); }
.diag .dg-line.dim { opacity: .45; }
.vitals {
  display: flex; gap: 8px; align-items: stretch; margin-bottom: 4px; height: 64px;
  border: 1px solid var(--rule); border-radius: var(--radius); background: var(--board-bg); padding: 4px;
}
.vt-lights { display: grid; grid-template-columns: repeat(5, auto); grid-template-rows: 1fr 1fr 1fr; gap: 1px 9px; padding: 1px 6px; align-content: center; flex: 0 0 auto; }
.vt-light { display: flex; align-items: center; gap: 5px; font-family: var(--font); font-size: 8px; letter-spacing: .08em; color: var(--ink-dim); }
.vt-light i { width: 7px; height: 7px; border-radius: 50%; background: var(--rule); box-shadow: inset 0 0 2px rgba(0,0,0,.6); transition: background .08s, box-shadow .08s; }
.vt-light.on i { background: var(--accent); box-shadow: 0 0 6px var(--accent); }
.vt-light[data-light="seal"].on i, .vt-light[data-light="team"].on i, .vt-light[data-light="hq"].on i { background: var(--ink); box-shadow: 0 0 6px var(--ink); }
.vt-eq { flex: 1 1 auto; min-width: 0; height: 100%; width: 100%; }
html[data-ambience="off"] .instruments-row, html[data-ambience="off"] .vitals { display: none; }
@media (prefers-reduced-motion: reduce) { .diag .dg-line { animation: none; } }

/* Tabs across the top of the settings dialog, now that it has more than one
   screen of options. */
.modal-tabs { display: flex; gap: 4px; }
.modal-tabs .tab { padding: 4px 12px; }
.modal-tabs .tab.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink, #0a0b06); }
.modal [data-pane]:not(.on) { display: none; }
.modal-pane { display: flex; flex-direction: column; gap: 6px; }
.settings-block .modal-detail { margin: 6px 0 0; }
.fx-areas { grid-template-columns: 1fr; margin-top: 6px; }
