@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500;600;700&family=IBM+Plex+Sans+Condensed:wght@600;700&display=swap');

/* ============================================================
   UPLINK — issued hardware
   ------------------------------------------------------------
   The device is company property. It was cheap when it was new
   and it is not new. Nothing glows at rest; light means
   something is happening to you.

   Surfaces:
     .plate--print  stencilled on at the factory. Matte, bone ink.
     .plate--live   a powered readout. Phosphor, refresh tick.
   ============================================================ */

:root {
  /* ground */
  --void:  #0b0a08;   /* bituminous, warm — never pure black */
  --hull:  #16150f;
  --plate: #1e1c14;
  --raise: #26241a;
  --rule:  #35311f;

  /* ink */
  --bone:  #d8d0bc;   /* primary — aged paper under an amber bezel */
  --dim:   #8a8474;
  --ghost: #5a5648;

  /* signal — used sparingly and only when earned */
  --acid:  #c8f04a;   /* live, unlocked, interactive */
  --rust:  #e2622b;   /* hazard, sealed, warning */
  --blood: #8e1b14;   /* critical only */

  --fx-i: 0;          /* effect intensity, 0..1 — set per effect by JS */

  --gap: 14px;
  --plate-pad: 14px;

  --mono: 'IBM Plex Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  --cond: 'IBM Plex Sans Condensed', 'Roboto Condensed', ui-sans-serif, sans-serif;

  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--void);
  color: var(--bone);
  font-family: var(--mono);
  font-size: 15px;
  line-height: 1.45;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior-y: none;
}

/* The stipple. A 1px dither over everything, like a cheap panel or a badly
   printed form — this is the resting texture, NOT scanlines. Scanlines are an
   effect the GM applies. */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  opacity: .5;
  background-image:
    repeating-linear-gradient(0deg,   rgba(0,0,0,.22) 0 1px, transparent 1px 3px),
    repeating-linear-gradient(90deg,  rgba(0,0,0,.10) 0 1px, transparent 1px 3px);
}

/* Slight vignette so the panel edges feel like glass in a bezel. */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 9998;
  pointer-events: none;
  background: radial-gradient(130% 100% at 50% 40%, transparent 55%, rgba(0,0,0,.55) 100%);
}

a { color: var(--acid); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }

:focus-visible {
  outline: 2px solid var(--acid);
  outline-offset: 2px;
}

/* ---------- type roles ------------------------------------------------- */

.stencil {
  font-family: var(--cond);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.legend {
  font-size: 9.5px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--ghost);
  font-weight: 500;
}

.num {
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum' 1, 'zero' 1;
}

/* ============================================================
   THE BEZEL — the signature element.
   A persistent strip that announces everything before the
   modules catch up. It is the device's nervous system.
   ============================================================ */

.bezel {
  position: sticky;
  top: 0;
  z-index: 60;
  background: linear-gradient(180deg, #100f0a, #0b0a08);
  border-bottom: 1px solid var(--rule);
  box-shadow: 0 6px 18px rgba(0,0,0,.6);
}

.bezel__rail {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px 6px;
}

.bezel__mark {
  font-family: var(--cond);
  font-weight: 700;
  letter-spacing: .22em;
  font-size: 13px;
  color: var(--bone);
  white-space: nowrap;
}
.bezel__mark span { color: var(--rust); }

.bezel__who {
  margin-left: auto;
  text-align: right;
  line-height: 1.1;
  min-width: 0;
}
.bezel__who b {
  display: block;
  font-family: var(--cond);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: .1em;
  text-transform: uppercase;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* carrier / signal pips */
.pips { display: inline-flex; gap: 2px; align-items: flex-end; height: 12px; }
.pips i {
  display: block;
  width: 3px;
  background: var(--ghost);
  transition: background .3s;
}
.pips i:nth-child(1) { height: 4px; }
.pips i:nth-child(2) { height: 7px; }
.pips i:nth-child(3) { height: 10px; }
.pips i:nth-child(4) { height: 13px; }
.is-linked .pips i { background: var(--acid); }
.is-degraded .pips i:nth-child(n+3) { background: var(--ghost); }
.is-degraded .pips i:nth-child(-n+2) { background: var(--rust); }

/* The one-line printer. New lines type in; old ones scroll off. */
.bezel__log {
  border-top: 1px solid var(--rule);
  background: #0e0d09;
  padding: 4px 12px;
  height: 22px;
  overflow: hidden;
  font-size: 11px;
  letter-spacing: .06em;
  color: var(--dim);
  white-space: nowrap;
  text-overflow: ellipsis;
}
.bezel__log b { color: var(--acid); font-weight: 600; }
.bezel__log.is-warn b { color: var(--rust); }
.bezel__log--print { animation: printin .18s steps(6) both; }
@keyframes printin { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

/* ============================================================
   THE RAIL — bank selector, bolted to the bottom of the bezel.

   Function keys on a instrument panel, not a menu bar: square,
   flush, no rounding, and the selected one is lit rather than
   raised. It rides the sticky bezel, so it is reachable from
   anywhere in a long bank without scrolling back up.
   ============================================================ */

.rail {
  display: flex;
  border-top: 1px solid var(--rule);
  background: #0e0d09;
  overflow-x: auto;
  scrollbar-width: none;
}
.rail::-webkit-scrollbar { display: none; }
.rail[hidden] { display: none; }

.rail__tab {
  position: relative;
  flex: 1 0 auto;
  min-height: 40px;
  padding: 10px 13px 9px;
  background: none;
  border: 0;
  border-right: 1px solid var(--rule);
  font-family: var(--cond);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: .13em;
  text-transform: uppercase;
  color: var(--ghost);
  cursor: pointer;
  white-space: nowrap;
  /* The lit strip under the live tab. Drawn always so the tab does not
     change height when it lights. */
  box-shadow: inset 0 -2px 0 transparent;
}
.rail__tab:last-child { border-right: 0; }
.rail__tab:hover { color: var(--dim); }

.rail__tab.is-live {
  color: var(--bone);
  background: var(--hull);
  box-shadow: inset 0 -2px 0 var(--acid);
}

/* The mark. A bank that is not on screen says something landed in it — this
   is the entire reason the rail is a rail and not a drawer, so it is allowed
   to be the one rust-coloured thing on the bezel. */
.rail__mark {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 6px;
  height: 6px;
  background: var(--rust);
  opacity: 0;
  transition: opacity .12s linear;
}
.rail__tab.is-dirty .rail__mark { opacity: 1; animation: markpulse 1.6s ease-in-out infinite; }
@keyframes markpulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }

/* A sealed bank is worth advertising, same as a sealed plate. */
.rail__tab.is-sealed { color: var(--ghost); }
.rail__tab.is-sealed::before {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 2px;
  background: repeating-linear-gradient(90deg, var(--rust) 0 3px, transparent 3px 7px);
  opacity: .5;
}
.rail__tab.is-live.is-sealed::before { display: none; }

/* ============================================================
   PLATES — one per module
   ============================================================ */

.rack {
  padding: var(--gap);
  display: flex;
  flex-direction: column;
  gap: var(--gap);
  max-width: 720px;
  margin: 0 auto;
  padding-bottom: 96px;
}

/* Every bank stays mounted; only one is shown. Tearing the off-screen ones
   out would cost the console its scrollback and make every tab switch a
   rebuild, and there is no memory argument for it — this is twelve plates. */
.bank {
  display: none;
  flex-direction: column;
  gap: var(--gap);
}
.bank.is-live { display: flex; }

/* Which face you are looking at, in the device's own words. The rail says
   SHEET; this says what that means. */
.bank__head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: -4px;
}
.bank__label {
  font-family: var(--cond);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--dim);
}
.bank__rule { flex: 1 1 auto; height: 1px; background: var(--rule); }

.plate {
  background: var(--plate);
  border: 1px solid var(--rule);
  position: relative;
  /* Bolted down. The notch corners read as sheet metal, not a rounded card. */
  clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 10px, 100% 100%, 10px 100%, 0 calc(100% - 10px));
}

.plate__head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 7px var(--plate-pad) 6px;
  background: var(--hull);
  border-bottom: 1px solid var(--rule);
}

/* Slot addressing. This is real information — it is the GM's ordering, and
   it is how a player says "my slot 4 is doing something". Not decoration. */
.plate__slot {
  font-family: var(--cond);
  font-weight: 700;
  font-size: 10px;
  letter-spacing: .1em;
  color: var(--void);
  background: var(--dim);
  padding: 1px 5px;
  flex: none;
}

.plate__label {
  font-family: var(--cond);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  font-size: 14px;
  /* The label never wraps or shrinks — the legend gives up its space first,
     since it is flavour and the label is the addressing. */
  flex: none;
  white-space: nowrap;
}

.plate__legend {
  margin-left: auto;
  font-size: 8.5px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ghost);
  text-align: right;
  flex: 1 1 0;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.plate__body { padding: var(--plate-pad); }

/* --- live surface --- */
.plate--live { background: #131a12; border-color: #2c3a24; }
.plate--live .plate__head { background: #101710; border-bottom-color: #2c3a24; }
.plate--live .plate__slot { background: var(--acid); }
.plate--live .plate__label { color: #dff3a8; }
.plate--live .plate__body { color: #cfe6a4; }
/* the refresh tick: a hairline that crawls down a powered readout */
.plate--live::after {
  content: '';
  position: absolute;
  left: 0; right: 0; top: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(200,240,74,.5), transparent);
  animation: refresh 5.5s linear infinite;
  pointer-events: none;
}
@keyframes refresh { from { top: 0; opacity: 0; } 10% { opacity: 1; } 90% { opacity: 1; } to { top: 100%; opacity: 0; } }

/* --- sealed plate: the locked state ---
   Visible, addressed, and obviously withholding something. */
.plate--locked .plate__body {
  padding: 22px var(--plate-pad);
  text-align: center;
  background-image: repeating-linear-gradient(
    -45deg,
    rgba(226,98,43,.09) 0 8px,
    transparent 8px 16px
  );
}
.plate--locked .plate__slot { background: var(--rust); }
.plate--locked .plate__label { color: var(--dim); }
.plate--locked .seal {
  font-family: var(--cond);
  font-weight: 700;
  letter-spacing: .18em;
  font-size: 12px;
  color: var(--rust);
  border: 1px solid rgba(226,98,43,.45);
  padding: 6px 12px;
  display: inline-block;
}
/* Each sealed plate states its own reason, so this line has to be readable
   over the hazard stripes — it is content, not texture. */
.plate--locked .seal small {
  display: block;
  font-family: var(--mono);
  font-weight: 400;
  letter-spacing: .08em;
  font-size: 10.5px;
  color: var(--dim);
  margin-top: 4px;
}

/* Unsealing is a moment. The plate cracks open once. */
.plate--unsealing { animation: unseal .75s cubic-bezier(.2,.8,.2,1) both; }
@keyframes unseal {
  0%   { clip-path: inset(50% 0 50% 0); filter: brightness(3); }
  45%  { clip-path: inset(0 0 0 0);     filter: brightness(1.9); }
  100% { clip-path: inset(0 0 0 0);     filter: none; }
}

/* ============================================================
   READOUT PRIMITIVES
   ============================================================ */

.grid2, .grid3, .grid4 {
  display: grid; gap: 1px;
  background: var(--rule); border: 1px solid var(--rule);
}
.grid2 { grid-template-columns: repeat(2, 1fr); }
.grid3 { grid-template-columns: repeat(3, 1fr); }
.grid4 { grid-template-columns: repeat(4, 1fr); }

.cell {
  background: var(--plate);
  padding: 8px 6px;
  text-align: center;
}
.plate--live .cell { background: #131a12; }
.cell dt {
  font-family: var(--cond);
  font-weight: 700;
  font-size: 9px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--dim);
}
.cell dd {
  margin: 2px 0 0;
  font-size: 24px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

/* Segmented bar. Segments, not a smooth fill — this is a gauge, not a
   progress bar, and segments read at a glance across a table. */
.meter { margin: 10px 0; }
.meter__top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 10px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--dim);
  font-family: var(--cond);
  font-weight: 700;
}
.meter__val { font-family: var(--mono); font-size: 13px; color: var(--bone); font-variant-numeric: tabular-nums; }
.meter__bar {
  margin-top: 4px;
  display: flex;
  gap: 2px;
  height: 14px;
}
.meter__seg { flex: 1; background: #0d0c08; border: 1px solid var(--rule); }
.meter__seg.is-on { background: var(--acid); border-color: var(--acid); }
.meter--warn .meter__seg.is-on { background: var(--rust); border-color: var(--rust); }
.meter--crit .meter__seg.is-on { background: var(--blood); border-color: var(--blood); }

/* key/value rows */
.kv { display: grid; grid-template-columns: minmax(84px, 34%) 1fr; gap: 0; }
.kv > dt {
  font-family: var(--cond); font-weight: 700; font-size: 10px;
  letter-spacing: .12em; text-transform: uppercase; color: var(--dim);
  padding: 5px 0; border-bottom: 1px solid var(--rule);
}
.kv > dd {
  margin: 0; padding: 5px 0; border-bottom: 1px solid var(--rule);
  overflow-wrap: anywhere;
}
.kv > dt:last-of-type, .kv > dd:last-of-type { border-bottom: 0; }

.tags { display: flex; flex-wrap: wrap; gap: 5px; }
.tag {
  font-size: 11px; letter-spacing: .06em;
  border: 1px solid var(--rule); padding: 2px 7px;
  background: var(--hull);
}
.tag--x { border-color: rgba(200,240,74,.4); color: var(--acid); }

.empty {
  color: var(--ghost);
  font-size: 11px;
  letter-spacing: .1em;
  text-transform: uppercase;
  text-align: center;
  padding: 10px 0;
}

/* ============================================================
   CONTROLS
   ============================================================ */

.btn {
  font-family: var(--cond);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  font-size: 13px;
  background: var(--raise);
  color: var(--bone);
  border: 1px solid var(--rule);
  padding: 11px 16px;
  min-height: 44px;
  cursor: pointer;
  transition: background .12s, border-color .12s, color .12s;
}
.btn:hover { background: #2f2c20; border-color: var(--dim); }
.btn:active { transform: translateY(1px); }
.btn--go { background: var(--acid); color: #14180a; border-color: var(--acid); }
.btn--go:hover { background: #d4fa5c; border-color: #d4fa5c; }
.btn--warn { border-color: rgba(226,98,43,.55); color: var(--rust); }
.btn--warn:hover { background: rgba(226,98,43,.14); }
.btn--sm { padding: 5px 9px; min-height: 30px; font-size: 11px; }
.btn[disabled] { opacity: .4; cursor: not-allowed; }

.field {
  width: 100%;
  background: #0d0c08;
  border: 1px solid var(--rule);
  color: var(--bone);
  padding: 9px 10px;
  min-height: 40px;
  font-family: var(--mono);
  font-size: 14px;
}
.field:focus { border-color: var(--acid); outline: none; }
textarea.field { resize: vertical; min-height: 72px; line-height: 1.4; }
select.field { min-height: 40px; }

.lbl {
  display: block;
  font-family: var(--cond); font-weight: 700; font-size: 10px;
  letter-spacing: .14em; text-transform: uppercase; color: var(--dim);
  margin: 0 0 4px;
}

/* ============================================================
   TERMINAL (console module + login)
   ============================================================ */

.term {
  background: #080b07;
  border: 1px solid #2c3a24;
  padding: 10px;
  font-size: 13px;
  line-height: 1.5;
  color: #b9d98a;
  max-height: 46vh;
  overflow-y: auto;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}
.term__line--in  { color: var(--bone); }
.term__line--in::before { content: '> '; color: var(--acid); }
.term__line--sys { color: var(--dim); }
.term__line--err { color: var(--rust); }
.term__form { display: flex; gap: 0; margin-top: 8px; border: 1px solid #2c3a24; }
.term__prompt {
  background: #0d1209; color: var(--acid); padding: 9px 8px;
  font-weight: 700; flex: none; border-right: 1px solid #2c3a24;
}
.term__in {
  flex: 1 1 auto; min-width: 0; background: #080b07; border: 0;
  color: #cfe6a4; padding: 9px; font-family: var(--mono); font-size: 14px;
}
.term__in:focus { outline: none; }

/* A voice on the far side of the port (lib/ai.php). g0-g3 is how badly the
   mask is holding: the worse it gets, the more the line shakes and bleeds. */
.term__line--ai   { color: #f1e4cf; }
.term__line--slip { opacity: .75; }
.term__line--g2   { animation: term-jitter 2.4s steps(1) infinite; }
.term__line--ai.term__line--g3 { animation: term-jitter .9s steps(1) infinite; color: #f0b7a6; text-shadow: 1px 0 rgba(255,46,87,.55), -1px 0 rgba(0,229,255,.45); }
.term__line--wait .cursor { width: .5em; }
/* Its own voice, once, after its name is spoken: cold white, spaced out,
   perfectly still, with the rest of the terminal dimmed around it. */
.term__line--bare { color: #eef7ff; letter-spacing: .14em; text-shadow: 0 0 8px rgba(190, 225, 255, .55); }
.term { transition: background-color 1.2s ease; }
.term.is-bare { background-color: #04070b; }
.term.is-bare .term__line:not(.term__line--bare) { opacity: .28; transition: opacity 1.2s ease; }
/* The deck itself talking: HOST's security prompt and the transfer. */
.term__line--deck { color: var(--acid); }
.term__bar {
  display: inline-block; vertical-align: middle;
  width: 7em; height: .7em; margin-left: .6em;
  border: 1px solid var(--acid);
}
.term__bar i { display: block; height: 100%; width: 0; background: var(--acid); }
@keyframes term-jitter {
  0%, 88% { transform: none; }
  90%     { transform: translateX(2px); }
  94%     { transform: translateX(-1px) skewX(-6deg); }
}

/* blinking block cursor */
.cursor { display: inline-block; width: .6em; height: 1.05em; background: var(--acid); vertical-align: text-bottom; animation: blink 1.05s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* ============================================================
   INCOMING MESSAGE — full-bleed, unmissable, one tap to clear
   ============================================================ */

.incoming {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 22px;
  background: rgba(6,6,4,.86);
  backdrop-filter: blur(2px);
  animation: fadein .12s both;
}
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }

.incoming__card {
  width: 100%;
  max-width: 460px;
  background: var(--plate);
  border: 1px solid var(--acid);
  box-shadow: 0 0 0 1px rgba(200,240,74,.15), 0 20px 60px rgba(0,0,0,.8);
  animation: slam .22s cubic-bezier(.2,.9,.3,1) both;
}
@keyframes slam { from { transform: scale(.94) translateY(10px); opacity: 0; } to { transform: none; opacity: 1; } }

.incoming--urgent .incoming__card { border-color: var(--rust); box-shadow: 0 0 0 1px rgba(226,98,43,.2), 0 20px 60px rgba(0,0,0,.8); }

.incoming__head {
  background: var(--acid); color: #14180a;
  padding: 6px 12px;
  display: flex; justify-content: space-between; align-items: center;
  font-family: var(--cond); font-weight: 700;
  letter-spacing: .14em; text-transform: uppercase; font-size: 12px;
}
.incoming--urgent .incoming__head { background: var(--rust); color: #170a04; }
.incoming__body { padding: 18px 16px; font-size: 16px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; max-height: 52vh; overflow-y: auto; }
.incoming__foot { padding: 0 16px 16px; }
.incoming__foot .btn { width: 100%; }

/* ============================================================
   MODULE INTERNALS
   ============================================================ */

/* --- CREW ID --- */
.idcard {
  border-bottom: 1px solid var(--rule);
  padding-bottom: 9px;
  margin-bottom: 4px;
}
.idcard__name { font-size: 22px; line-height: 1.1; letter-spacing: .04em; }
.idcard__class { margin-top: 3px; }

/* --- BIOMONITOR --- */
.vitals__status {
  display: flex; justify-content: space-between; align-items: baseline;
  border-bottom: 1px solid #2c3a24; padding-bottom: 7px; margin-bottom: 4px;
}
.vitals__status b { font-size: 16px; letter-spacing: .12em; color: var(--acid); }
.vitals__status.is-warn b { color: #e8c33a; }
.vitals__status.is-bad b { color: var(--rust); }

/* --- CREW STATUS ---
   A row per crewmate. This plate gets read sideways, in a glance, while
   someone else is talking, so the gauge is short and inline and the status
   word carries the colour. */
.crew__row {
  display: grid;
  grid-template-columns: 7px minmax(0, 1fr) auto;
  align-items: center;
  gap: 3px 8px;
  padding: 8px 0;
  border-bottom: 1px solid #2c3a24;
}
.crew__row:first-child { padding-top: 0; }
.crew__row:last-child  { padding-bottom: 0; border-bottom: 0; }

/* The lamp is the carrier, not the body — someone can be flatlining on a
   perfect signal, and those are two different alarms. */
.crew__lamp {
  width: 7px; height: 7px;
  background: var(--acid);
  box-shadow: 0 0 6px rgba(200,240,74,.7);
}

.crew__id { display: flex; align-items: baseline; gap: 6px; min-width: 0; }
.crew__name {
  font-size: 13px; letter-spacing: .09em;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.crew__status {
  font-family: var(--cond); font-weight: 700;
  font-size: 11px; letter-spacing: .14em;
  color: var(--acid); text-align: right;
}
.crew__status.is-warn { color: #e8c33a; }
.crew__status.is-bad  { color: var(--rust); }

.crew__read { grid-column: 2 / -1; display: flex; align-items: center; gap: 8px; }
.crew__gauge.meter { flex: 1 1 auto; min-width: 54px; margin: 0; }
.crew__gauge .meter__bar { height: 9px; margin: 0; }
.crew__val { flex: none; font-size: 11.5px; color: var(--bone); }
.crew__tag {
  flex: none; font-size: 9.5px; letter-spacing: .12em;
  text-transform: uppercase; color: var(--ghost);
}
.crew__tag--stale { color: var(--rust); }

/* A suit that has stopped reporting. The row stays where it was — dropping
   a name off the list would be a worse lie than an old number. The lamp goes
   out rather than blinking: a blink means something is still trying, and
   nothing here is. */
.crew__row.is-quiet { opacity: .55; }
.crew__row.is-quiet .crew__lamp {
  background: transparent;
  border: 1px solid var(--ghost);
  box-shadow: none;
}

/* --- lists (loadout, scanner) --- */
.items { list-style: none; margin: 8px 0 0; padding: 0; }
.items__row {
  display: flex; align-items: baseline; gap: 8px;
  padding: 6px 0; border-bottom: 1px solid var(--rule);
  font-size: 13px;
}
.items__row:last-child { border-bottom: 0; }
.items__qty { flex: none; min-width: 34px; color: var(--dim); font-size: 11px; }
.items__name { flex: 1 1 auto; overflow-wrap: anywhere; }
.items__note { flex: none; font-size: 10px; letter-spacing: .1em; color: var(--ghost); text-transform: uppercase; }
.items__row.is-spent .items__name { text-decoration: line-through; color: var(--ghost); }

/* --- COMMS --- */
.msg { border-left: 2px solid var(--rule); padding: 0 0 0 9px; margin-bottom: 11px; }
.msg:last-child { margin-bottom: 0; }
.msg__head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.msg__head b { font-size: 11px; letter-spacing: .12em; color: var(--acid); }
.msg__body { font-size: 13.5px; white-space: pre-wrap; overflow-wrap: anywhere; margin-top: 2px; }

/* --- SCANNER --- */
.scope {
  position: relative;
  width: 100%;
  max-width: 230px;
  margin: 4px auto 10px;
  aspect-ratio: 1;
  border: 1px solid #2c3a24;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(200,240,74,.05), transparent 70%), #080b07;
  overflow: hidden;
}
.scope__ring { position: absolute; border: 1px solid rgba(200,240,74,.16); border-radius: 50%; inset: 0; margin: auto; }
.scope__ring--1 { width: 33%; height: 33%; }
.scope__ring--2 { width: 66%; height: 66%; }
.scope__ring--3 { width: 99%; height: 99%; }
/* The wedge is brightest at its 0deg edge and decays clockwise from there,
   so that hard edge is the beam and the fade is phosphor burning off behind
   it. The sweep therefore has to turn ANTI-clockwise — turning the other way
   drags the dead end of the trail around in front of the beam. */
.scope__sweep {
  position: absolute; inset: 0;
  background: conic-gradient(from 0deg, rgba(200,240,74,.30), transparent 26%);
  animation: sweep 3.4s linear infinite;
}
@keyframes sweep { to { transform: rotate(-360deg); } }
.blip {
  position: absolute; width: 7px; height: 7px;
  transform: translate(-50%, -50%);
  background: var(--acid);
  box-shadow: 0 0 7px rgba(200,240,74,.9);
}
/* Drifted past the 40m rim — still tracked, no longer painted. */
.blip.is-offscope { opacity: 0; }
.blip--unknown { background: var(--bone); box-shadow: 0 0 7px rgba(216,208,188,.8); animation: blink 1.4s steps(1) infinite; }
.blip--hostile { background: var(--rust); box-shadow: 0 0 9px rgba(226,98,43,.95); animation: blink .55s steps(1) infinite; }

/* --- MANIFEST / UPLINK documents --- */
.doc-entry { border-bottom: 1px solid var(--rule); padding: 8px 0; }
.doc-entry:last-child { border-bottom: 0; }
.doc-entry summary {
  cursor: pointer; list-style: none;
  display: flex; justify-content: space-between; align-items: baseline; gap: 8px;
  min-height: 32px;
}
.doc-entry summary::-webkit-details-marker { display: none; }
.doc-entry summary b { font-size: 12.5px; letter-spacing: .08em; }
.doc-entry summary::after { content: '▸'; color: var(--dim); flex: none; }
.doc-entry[open] summary::after { content: '▾'; }
.doc-entry.is-sealed {
  display: flex; justify-content: space-between; align-items: baseline; gap: 8px;
  opacity: .55;
}
.doc-entry.is-sealed b { color: var(--dim); font-size: 12.5px; letter-spacing: .08em; }
.doc {
  margin: 7px 0 2px;
  background: #0d0c08;
  border: 1px solid var(--rule);
  padding: 9px 10px;
  font-size: 12.5px;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-family: var(--mono);
}

/* Provenance. Sits above the body, quiet, because it is a fact about the
   file rather than part of it. */
.doc-from { margin: 5px 0 0; color: var(--dim); }

/* Passing a file to another suit. Deliberately plain — this is the one
   control on the device a player operates for their own reasons rather than
   because the ship told them to, and it should look like a utility, not a
   feature being advertised. */
.doc-copy {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed var(--rule);
}
.doc-copy__who {
  background: #0d0c08;
  border: 1px solid var(--rule);
  color: var(--bone);
  font-family: var(--cond);
  font-weight: 600;
  font-size: 12px;
  letter-spacing: .1em;
  text-transform: uppercase;
  padding: 7px 8px;
  min-height: 36px;
  flex: 1 1 120px;
  min-width: 0;
}
.doc-copy__note { flex: 1 0 100%; color: var(--dim); }
.doc-copy__note:empty { display: none; }

.plate--live .doc-copy__who { background: #0f150e; color: #cfe6a4; }

/* A picture inside a file — a floor plan, a deck map, a still off a camera.
   Inline it is a doorway rather than the document: a plan is unreadable at
   plate width, so the thumbnail's whole job is to say what is behind it and
   be easy to hit with a thumb. */
.doc-plan {
  display: block;
  width: 100%;
  margin: 8px 0 2px;
  padding: 0;
  background: #0d0c08;
  border: 1px solid var(--rule);
  color: var(--dim);
  font: inherit;
  text-align: left;
  cursor: zoom-in;
}
.doc-plan:hover { border-color: var(--dim); }
.doc-plan__shot {
  display: block;
  width: 100%;
  max-height: 210px;
  object-fit: contain;
  /* A plan is usually black on white and a map usually is not, so the frame
     is dark and the picture sits in it on its own terms. */
  background: #07070a;
  /* Held back a little at rest. A white survey drawing is the brightest thing
     on a device where nothing glows until something is happening to you, and
     the thumbnail is not the moment the plan matters. It comes up to full
     strength as they reach for it, and the viewer never dims it at all. */
  opacity: .86;
  transition: opacity .12s;
}
.doc-plan:hover .doc-plan__shot,
.doc-plan:focus-visible .doc-plan__shot { opacity: 1; }
.doc-plan__hint {
  display: block;
  margin: 0;
  padding: 6px 9px;
  border-top: 1px dashed var(--rule);
}
.doc-plan.is-missing { cursor: not-allowed; padding: 9px 10px; }
.doc-plan.is-missing .legend { display: block; }

/* The viewer. Full screen and its own surface: the plan is the only thing on
   it, which is the point — the rest of the device is what you were looking at
   instead of the plan. */
.plan-view {
  position: fixed;
  inset: 0;
  z-index: 210;
  display: flex;
  flex-direction: column;
  /* Solid, not a scrim. Everything behind it is what they were looking at
     instead of the plan, and a plan read over the top of a stress track is
     harder to read than it needs to be. */
  background: var(--void);
  animation: fadein .12s both;
  touch-action: none;
}
.plan-view:focus { outline: none; }

.plan-view__head,
.plan-view__bar {
  flex: none;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: var(--plate);
}
.plan-view__head { border-bottom: 1px solid var(--rule); }
.plan-view__bar  { border-top: 1px solid var(--rule); padding-bottom: max(10px, env(safe-area-inset-bottom)); }
.plan-view__bar .btn { flex: 1 1 0; }

.plan-view__title {
  flex: 1 1 auto;
  min-width: 0;
  font-family: var(--cond);
  font-size: 12.5px;
  letter-spacing: .1em;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.plan-view__pct {
  flex: none;
  font-size: 11px;
  letter-spacing: .1em;
  color: var(--dim);
  font-variant-numeric: tabular-nums;
}

.plan-view__stage {
  position: relative;
  flex: 1 1 auto;
  overflow: hidden;
  cursor: grab;
  touch-action: none;
}
.plan-view__stage.is-dragging { cursor: grabbing; }

.plan-view__img {
  position: absolute;
  top: 0;
  left: 0;
  max-width: none;          /* natural pixels — the transform does the sizing */
  transform-origin: 0 0;
  opacity: 0;
  transition: opacity .16s;
  user-select: none;
  -webkit-user-drag: none;
}
/* Held back until it has been measured and fitted, or the first frame is the
   picture at natural size in the top-left corner. */
.plan-view.is-ready .plan-view__img { opacity: 1; }

.plan-view__note {
  position: absolute;
  inset: 0;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--dim);
}
.plan-view.is-ready .plan-view__note { display: none; }

/* Nothing behind the viewer should scroll while it is up. */
html.is-viewing, html.is-viewing body { overflow: hidden; }

/* --- CONSOLE --- */
.console-wrap { display: block; }

/* ============================================================
   FORGED IN THE DARK FURNITURE
   ------------------------------------------------------------
   Geometry only. Every colour here comes from the palette
   tokens at the top of this file, so these plates are correct
   under the base look and a theme can restyle them by moving
   seven custom properties rather than by rewriting layout.

   The organising idea: a rating in this family of games is dice
   you pick up and a track is boxes you fill in, so everything
   below is DISCRETE. Nothing is a percentage bar. You read
   "three" by seeing three.
   ============================================================ */

/* --- tick tracks: the unit all of this is built from --- */
.ticks { display: flex; gap: 3px; align-items: center; flex-wrap: wrap; }
.tick {
  width: 14px; height: 14px;
  background: #0d0c08;
  border: 1px solid var(--rule);
  flex: 0 0 auto;
}
.tick.is-on { background: var(--acid); border-color: var(--acid); }

/* Pips are a rating, not a track — smaller, and they sit inline. */
.ticks--pips .tick { width: 11px; height: 11px; }

/* The stress track stretches to fill, because its length IS the
   information: seven boxes have to look like a finite runway. */
.ticks--stress { gap: 4px; }
.ticks--stress .tick { flex: 1 1 0; height: 22px; width: auto; min-width: 12px; }
.ticks--mini .tick { height: 10px; min-width: 6px; }

/* The last box is a cliff, not a box. Marking it is OVERLOAD. */
.ticks--stress .tick--last { border-color: var(--rust); position: relative; }
.ticks--stress .tick--last.is-on { background: var(--rust); border-color: var(--rust); }

.ticks--load .tick { width: 10px; height: 16px; }
.ticks--uses { gap: 2px; }
.ticks--uses .tick { width: 7px; height: 7px; }

/* --- rating rows: approaches and skills --- */
.rates { display: flex; flex-direction: column; gap: 2px; }
.rate {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 0;
  border-bottom: 1px solid var(--rule);
}
.rate:last-child { border-bottom: 0; }
.rate__id { flex: 1 1 auto; min-width: 0; }
.rate__name { display: block; font-size: 13px; line-height: 1.2; }
.rate__kw { display: block; margin-top: 1px; font-size: 8.5px; letter-spacing: .1em; }
.rate__tag { flex: 0 0 auto; }
/* An untrained skill stays on the list — a lookup surface that hides its
   zeroes makes you check whether the skill is missing or just at zero. */
.rate.is-zero .rate__name { color: var(--dim); }
.rate.is-zero .rate__kw { opacity: .5; }
.rate.is-glitched { background: rgba(226,98,43,.07); }
.rate.is-glitched .rate__name { color: var(--rust); }

/* --- stress --- */
.stress { margin: 12px 0 4px; }
.stress__top {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: 6px;
}
.stress__val { font-size: 13px; color: var(--bone); font-variant-numeric: tabular-nums; }
.stress__note { margin: 6px 0 0; }
.stress.is-hot .stress__val,
.stress.is-hot .stress__note { color: var(--rust); }

/* --- a standing condition that changes how every scene reads --- */
.hazard {
  display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap;
  margin: 0 0 12px;
  padding: 8px 10px;
  background: rgba(226,98,43,.12);
  border-left: 3px solid var(--rust);
}
.hazard b { color: var(--rust); font-size: 14px; }

/* --- the harm ladder --- */
.harm { display: flex; flex-direction: column; gap: 4px; }
.harm__row { display: flex; align-items: stretch; gap: 8px; }
.harm__lvl {
  flex: 0 0 18px;
  font-size: 15px; font-weight: 700; line-height: 26px;
  color: var(--ghost); text-align: center;
}
.harm__row.is-taken .harm__lvl { color: var(--bone); }
.harm__slots { flex: 1 1 auto; display: flex; gap: 4px; min-width: 0; }
.harm__slot {
  flex: 1 1 0; min-width: 0;
  min-height: 26px;
  padding: 4px 6px;
  background: #0d0c08;
  border: 1px solid var(--rule);
  font-size: 10px; letter-spacing: .06em; text-transform: uppercase;
  color: var(--dim);
  display: flex; align-items: center;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.harm__slot.is-on {
  background: rgba(226,98,43,.16);
  border-color: var(--rust);
  color: var(--bone);
}
/* Taken, but a breather is holding its penalty off. Still on the file. */
.harm__slot.is-ignored { opacity: .5; text-decoration: line-through; }
/* Harm that overflowed its level and had nowhere printed to go. */
.harm__slot--extra { border-style: dashed; }
.harm__row--3 .harm__slot.is-on,
.harm__row--4 .harm__slot.is-on {
  background: rgba(142,27,20,.35); border-color: var(--blood);
}
/* A fixed column, not an auto one. The penalties are different lengths, and
   letting them size themselves puts every rung of the ladder at a different
   width — which reads as four unrelated rows rather than one ladder. */
.harm__penalty {
  flex: 0 0 96px; align-self: center;
  text-align: right;
}
.harm__row--4 .harm__penalty { color: var(--blood); }

/* --- spent / available chips --- */
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  padding: 5px 10px;
  border: 1px solid var(--rule);
  background: #0d0c08;
  color: var(--ghost);
  font-family: var(--cond); font-weight: 700;
  font-size: 11px; letter-spacing: .12em; text-transform: uppercase;
  text-decoration: line-through;
}
.chip.is-on { border-color: var(--acid); color: var(--acid); text-decoration: none; }

/* --- clocks -------------------------------------------------
   A pie rather than a bar, because that is what a Forged in the
   Dark table already draws on scrap paper, and because a wedge
   reads as "how much is left" at arm's length across a table. */
.clocks { display: flex; flex-direction: column; gap: 10px; }
.clocks__item {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--rule);
}
.clocks__item:last-child { border-bottom: 0; }
.clocks__id { flex: 1 1 auto; min-width: 0; }
.clocks__id b { display: block; font-size: 13px; }
.clocks__count { flex: 0 0 auto; font-size: 13px; color: var(--dim); }
.clocks__count.is-full { color: var(--rust); }
.clocks__item.is-full .clocks__id b { color: var(--rust); }
.clocks__item.is-sealed .clocks__id b { color: var(--dim); }

.clock { flex: 0 0 auto; }
.clock__dial {
  width: 42px; height: 42px;
  border-radius: 50%;
  border: 1px solid var(--rule);
  /* Spokes on top of the wedge: first background layer paints last. */
  background:
    repeating-conic-gradient(from -90deg,
      transparent 0 calc(var(--seg) - 1.5deg),
      var(--void) calc(var(--seg) - 1.5deg) var(--seg)),
    conic-gradient(from -90deg,
      var(--acid) 0 var(--turn),
      #0d0c08 var(--turn) 360deg);
}
.clock--countdown .clock__dial {
  background:
    repeating-conic-gradient(from -90deg,
      transparent 0 calc(var(--seg) - 1.5deg),
      var(--void) calc(var(--seg) - 1.5deg) var(--seg)),
    conic-gradient(from -90deg,
      var(--rust) 0 var(--turn),
      #0d0c08 var(--turn) 360deg);
  border-color: rgba(226,98,43,.5);
}
.clock__dial.is-full { box-shadow: 0 0 0 2px rgba(226,98,43,.35); }
/* A clock they can see and cannot read. */
.clock--sealed .clock__dial {
  background: repeating-linear-gradient(45deg,
    var(--rule) 0 4px, transparent 4px 8px);
  border-style: dashed;
}

/* --- the job --- */
.run__head { margin-bottom: 10px; }
.run__obj { display: block; font-size: 19px; line-height: 1.15; margin-top: 2px; }
.run__phases {
  display: flex; gap: 3px; margin: 0 0 14px;
  overflow-x: auto; scrollbar-width: none;
}
.run__phases::-webkit-scrollbar { display: none; }
.run__phase {
  flex: 0 0 auto;
  padding: 4px 7px;
  border: 1px solid var(--rule);
  color: var(--ghost);
  font-size: 8.5px; letter-spacing: .12em; text-transform: uppercase;
  white-space: nowrap;
}
.run__phase.is-done { color: var(--dim); border-color: var(--dim); }
.run__phase.is-now {
  background: var(--acid); border-color: var(--acid);
  color: var(--void); font-weight: 700;
}

/* --- load --- */
.load {
  display: flex; align-items: center; gap: 10px;
  padding: 10px;
  background: #0d0c08;
  border: 1px solid var(--rule);
}
.load__id { flex: 1 1 auto; min-width: 0; }
.load__level { display: block; font-size: 15px; }
.load__count { flex: 0 0 auto; font-size: 14px; color: var(--bone); }
.load.is-over { border-color: var(--rust); background: rgba(226,98,43,.1); }
.load.is-over .load__count, .load.is-over .load__level { color: var(--rust); }

/* The book prints sub-options under several items ("STANDARD / PIERCING /
   EXPLOSIVE / INCENDIARY"), and letting those share the line squeezes the
   item's own name into two words a line. The note gets its own row. */
.gear { align-items: center; flex-wrap: wrap; }
.gear .items__note { flex: 1 0 100%; margin: 2px 0 0; }
.gear__cost { flex: 0 0 auto; color: var(--dim); font-size: 10px; letter-spacing: -.1em; }
.gear.is-glitched .items__name { color: var(--rust); }
.items--off { opacity: .55; }

/* --- the debt/cred track ------------------------------------
   One signed track around a centre mark, as printed. You are
   never holding both, and the sign is what matters at the end
   of the night. */
.credtrack__wrap {
  display: flex; align-items: center; gap: 8px;
  margin-top: 14px;
}
.credtrack { flex: 1 1 auto; display: flex; gap: 3px; align-items: center; }
.credtrack__lbl { flex: 0 0 auto; }
.credtrack__lbl.is-hot { color: var(--bone); }
.credtrack__box {
  flex: 1 1 0; height: 18px;
  background: #0d0c08;
  border: 1px solid var(--rule);
}
.credtrack__box.is-debt.is-on { background: var(--rust); border-color: var(--rust); }
.credtrack__box.is-cred.is-on { background: var(--acid); border-color: var(--acid); }
.credtrack__mid {
  flex: 0 0 9px; height: 9px;
  border: 1px solid var(--dim);
  transform: rotate(45deg);
}

/* --- angle, look, augments --- */
.runner__look {
  margin: 10px 0 0;
  font-size: 13px; line-height: 1.45; color: var(--dim);
}
.angle {
  padding: 9px 11px;
  border: 1px solid var(--rule);
  border-left: 3px solid var(--acid);
  background: #0d0c08;
}
.angle__word { display: block; font-size: 15px; color: var(--acid); }
.angle__detail { display: block; margin-top: 3px; font-size: 12px; color: var(--dim); }

.aug { padding: 9px 0; border-bottom: 1px solid var(--rule); }
.aug:last-of-type { border-bottom: 0; }
.aug__head { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.aug__head b { font-size: 13px; }
.aug__feature { margin: 4px 0 0; font-size: 12px; color: var(--dim); line-height: 1.4; }
.aug.is-glitched .aug__head b { color: var(--rust); }

/* --- the grid: what is watching, and how close it is --- */
/* Full-bleed across the plate body, so it reads as a band on the hardware
   rather than a notice inside it. The inset is derived from the padding
   token — hardcoding 14px here breaks it at the wider breakpoint. */
.ice {
  display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap;
  margin: calc(var(--plate-pad) * -1) calc(var(--plate-pad) * -1) 12px;
  padding: 8px var(--plate-pad);
  border-bottom: 1px solid var(--rule);
  background: #0d0c08;
}
.ice__word { font-size: 14px; }
/* Bright enough to read off a hazard field — this line is the one that says
   what the countermeasure will actually do to you. */
.ice__note { flex: 1 0 100%; color: var(--dim); }
.ice--none .ice__word { color: var(--dim); }
.ice--passive .ice__word { color: var(--bone); }
.ice--active { background: rgba(226,98,43,.12); border-bottom-color: var(--rust); }
.ice--active .ice__word { color: var(--rust); }
.ice--lethal { background: rgba(142,27,20,.3); border-bottom-color: var(--blood); }
.ice--lethal .ice__word { color: #ff6a5e; }

.trace { margin: 12px 0; }
.trace__top { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 5px; }
.trace__val { font-size: 12px; color: var(--dim); font-variant-numeric: tabular-nums; }
.trace__bar { height: 6px; background: #0d0c08; border: 1px solid var(--rule); }
.trace__fill { height: 100%; background: var(--dim); transition: width .4s linear; }
.trace.is-hot .trace__fill { background: var(--rust); }
.trace.is-hot .trace__val { color: var(--rust); }
.trace.is-found .trace__fill { background: var(--blood); }
.trace.is-found .trace__val { color: var(--blood); }

/* --- the modem: the front-panel lights, and the log while it dials --- */
.leds {
  display: flex; flex-wrap: wrap; gap: 5px;
  margin: 10px 0 2px;
}
.led {
  font-family: var(--mono); font-size: 9.5px; letter-spacing: .06em;
  color: var(--ghost);
  display: inline-flex; align-items: center; gap: 4px;
}
.led::before {
  content: ''; width: 6px; height: 6px; border-radius: 50%;
  background: #1a1912; border: 1px solid var(--rule);
}
.led.is-on { color: var(--dim); }
.led.is-on::before { background: var(--acid); border-color: var(--acid); box-shadow: 0 0 6px var(--acid); }
.led.is-alarm::before { background: var(--rust); border-color: var(--rust); box-shadow: 0 0 8px var(--rust); animation: led-alarm .5s steps(1) infinite; }
@keyframes led-alarm { 50% { opacity: .2; } }

.modem__log {
  margin: 10px 0 2px;
  min-height: 9.5em;
  background: #0d0c08;
  border: 1px solid var(--rule);
  padding: 9px 10px;
  font-family: var(--mono); font-size: 12px; line-height: 1.5;
  color: var(--acid);
  white-space: pre-wrap; overflow-wrap: anywhere;
}

@media (prefers-reduced-motion: reduce) {
  .led.is-alarm::before { animation: none; }
}

/* --- the construct: the face in the implant --- */
/* Full-bleed like the ICP band: the head is a window onto the net, not a
   picture in a frame. Its height is capped so the DECK under it stays in
   reach of a thumb on a phone. */
.construct {
  margin: calc(var(--plate-pad) * -1);
  position: relative;
  background: #05070a;   /* construct.js clears to this same black */
}
.construct__view {
  position: relative;
  height: clamp(240px, 72vw, 380px);
  overflow: hidden;
}
/* A glow and scanlines over the scene, not in it — cheap, and they stay put
   while she turns. */
.construct__view::before {
  content: ''; position: absolute; inset: 0; pointer-events: none; z-index: 1;
  background: radial-gradient(ellipse at 50% 42%, rgba(0,229,255,.08), transparent 62%);
}
.construct__view::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(0deg, rgba(0,0,0,.28) 0 1px, transparent 1px 3px);
}
.construct__gl { display: block; width: 100%; height: 100%; }
.construct__fail {
  position: absolute; inset: 0; display: grid; place-items: center;
  margin: 0; color: var(--dim); font-size: 11px; letter-spacing: .14em;
}
.construct__hud {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 8px var(--plate-pad);
  border-top: 1px solid var(--rule);
  font-size: 10px; letter-spacing: .12em; text-transform: uppercase;
}
.construct__cap { flex: 1 1 auto; color: var(--wire, var(--bone)); }
.construct__coh { display: inline-flex; align-items: center; gap: 6px; }
.construct__bars { display: inline-flex; gap: 2px; }
.construct__bars i { width: 5px; height: 10px; border: 1px solid var(--rule); }
.construct__bars i.is-on { background: var(--wire, var(--bone)); border-color: transparent; }
.construct.is-failing .construct__bars i.is-on { background: var(--rust); }
.construct__state { color: var(--wire, var(--bone)); font-variant-numeric: tabular-nums; }
.construct__state.is-off { color: var(--ghost); }
.construct__state.is-bare { color: #eef7ff; animation: term-jitter .9s steps(1) infinite; }
/* Riding in this deck: the glow is the deck's own. Let out of it, there is
   no glow at all — the matrix is lit by what is in it. */
.construct.is-passenger .construct__state { color: var(--acid); }
.construct.is-passenger .construct__view::before {
  background: radial-gradient(ellipse at 50% 42%, rgba(252,238,10,.05), transparent 62%);
}
.construct.is-loose .construct__view::before { background: none; }
.construct.is-loose .construct__state { color: var(--wire, var(--bone)); }
/* Linked to her in somebody else's deck: she comes in over the air, and a
   band of interference rolls up through the picture. */
.construct.is-peer .construct__view::after {
  background:
    linear-gradient(180deg, transparent 40%, rgba(0,229,255,.05) 47%, rgba(0,229,255,.07) 50%, transparent 58%) 0 0 / 100% 300% no-repeat,
    repeating-linear-gradient(0deg, rgba(0,0,0,.28) 0 1px, transparent 1px 3px);
  animation: peer-roll 6s linear infinite;
}
@keyframes peer-roll { to { background-position: 0 100%, 0 0; } }
@media (prefers-reduced-motion: reduce) { .construct.is-peer .construct__view::after { animation: none; } }

/* Docked: her picture, lifted out while the plate is scrolled away (see the
   dock in modules.js), in a small window pinned under the bezel. Same view,
   same classes, so every state above still dresses it. */
.construct.is-dock {
  position: fixed; right: 10px; top: 0; z-index: 70;
  margin: 0; padding: 0;
  width: clamp(104px, 30vw, 150px);
  border: 1px solid var(--wire, var(--rule));
  box-shadow: 0 0 0 1px #000, 0 6px 22px rgba(0,0,0,.7), 0 0 14px rgba(0,229,255,.18);
  cursor: pointer;
  animation: fadein .15s both;
}
.construct.is-dock .construct__view { height: auto; aspect-ratio: 1; }

/* --- shared odds and ends --- */
.tag--bad { border-color: rgba(226,98,43,.5); color: var(--rust); }
.crew__tag--bad { border-color: rgba(226,98,43,.5); color: var(--rust); }
.crew__tag--harm { color: var(--dim); }
.is-hot { color: var(--rust); }

/* ============================================================
   AMEND — the player writing on their own plate
   ------------------------------------------------------------
   Controls, not a form. The marks reuse .tick and .chip so the
   thing you write on looks like the thing you were reading a
   second ago, and so a theme that has already dressed those
   gets this for free. What is added here is only what makes
   them touchable: hit areas, a button reset, and the bar at the
   bottom of the plate that says where the edge of it is.
   ============================================================ */

/* The invitation. A hairline and one button under the contents — not in the
   plate head, which is addressing and belongs to the GM. */
.amend-bar {
  display: flex; align-items: center; gap: 8px;
  margin-top: 14px; padding-top: 10px;
  border-top: 1px dashed var(--rule);
}
.amend-bar .btn { margin-left: auto; }
.amend-bar--open { margin-top: 16px; }
.amend-bar__note { margin-right: auto; color: var(--ghost); }

/* The plate is being written on. Outlined, because a plate mid-amendment is
   a different state of the same object and the rack should say so. */
.plate.is-amending { box-shadow: inset 0 0 0 1px var(--acid); }

.amend { display: flex; flex-direction: column; gap: 14px; }
.amend__field { display: flex; flex-direction: column; gap: 6px; }
.amend__lbl {
  font-family: var(--cond); font-weight: 700;
  font-size: 10px; letter-spacing: .14em; text-transform: uppercase;
  color: var(--dim);
}
.amend__hint { margin: 0; color: var(--ghost); }

/* Buttons pretending to be marks. */
.amend .tick, .amend .chip {
  -webkit-appearance: none; appearance: none;
  font: inherit; cursor: pointer;
}
.amend .chip { min-height: 34px; padding: 7px 12px; }
.amend .chip { text-decoration: none; }
/* A switch is the size of its word. Left to the column's own stretch it would
   run the width of the plate, which reads as a button that does something
   rather than a box that is ticked. */
.amend__field > .chip { align-self: flex-start; }
.amend__rowhead .chip { flex: 0 0 auto; }
.amend__ticks { gap: 5px; }
/* Thumbs, not cursors: the read-only pip is 11px, which is unhittable. */
.amend__ticks.ticks--pips .tick { width: 26px; height: 26px; }
.amend__ticks.ticks--stress .tick { height: 32px; }

.amend__stepper { display: flex; align-items: stretch; gap: 0; max-width: 190px; }
.amend__step {
  flex: none; width: 44px;
  background: var(--hull); color: var(--bone);
  border: 1px solid var(--rule);
  font-family: var(--cond); font-weight: 700; font-size: 18px; line-height: 1;
  cursor: pointer;
}
.amend__step:active { background: var(--raise); }
.amend__num {
  flex: 1 1 auto; min-width: 0; text-align: center;
  border-left: 0; border-right: 0;
  font-variant-numeric: tabular-nums;
}

/* --- repeating rows ---
   Collapsed to one line each, because LOAD ships with the whole printed gear
   list and twenty-one open rows is not an editor anybody uses mid-run. The
   switches that get thrown constantly ride on the closed line. */
.amend__rows { display: flex; flex-direction: column; gap: 6px; }
.amend__row { border: 1px solid var(--rule); background: var(--hull); }
.amend__row[open] { border-color: var(--dim); }
.amend__rowhead {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  padding: 9px 10px; cursor: pointer; list-style: none;
  min-height: 44px;
}
.amend__rowhead::-webkit-details-marker { display: none; }
.amend__rowhead::after { content: '▸'; color: var(--dim); margin-left: auto; flex: none; }
.amend__row[open] .amend__rowhead::after { content: '▾'; }
.amend__rowname {
  font-family: var(--cond); font-weight: 700;
  font-size: 12px; letter-spacing: .08em; text-transform: uppercase;
  overflow-wrap: anywhere;
}
/* The chips sit before the marker, not after it. */
.amend__rowhead .chip { margin-left: 0; }
.amend__rowbody {
  display: flex; flex-direction: column; gap: 12px;
  padding: 10px; border-top: 1px solid var(--rule);
}
.amend__drop {
  align-self: flex-start;
  background: none; border: 1px solid rgba(226,98,43,.55); color: var(--rust);
  font-family: var(--cond); font-weight: 700;
  font-size: 10px; letter-spacing: .14em; text-transform: uppercase;
  padding: 7px 12px; min-height: 36px; cursor: pointer;
}
.amend__add {
  align-self: flex-start;
  background: none; border: 1px dashed var(--rule); color: var(--dim);
  font-family: var(--cond); font-weight: 700;
  font-size: 10px; letter-spacing: .14em; text-transform: uppercase;
  padding: 8px 14px; min-height: 40px; cursor: pointer;
}
.amend__add:hover { color: var(--bone); border-color: var(--dim); }

/* A live plate's controls sit on phosphor, so they take its ink. */
.plate--live .amend__lbl { color: #9fb987; }
.plate--live .amend__row { background: #101710; border-color: #2c3a24; }

/* ============================================================
   RESPONSIVE / A11Y
   ============================================================ */

@media (min-width: 620px) {
  :root { --gap: 18px; --plate-pad: 16px; }
  body { font-size: 15.5px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
  .plate--live::after { display: none; }
}

.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
