/* THE GRID — GRID/OS visual system
   Palette: Thames night #0a0e13 · steel panel #10161f · bulkhead line #223041
            vellum text #c7d3df · redacted #64768a · ops blue #5ca8cf
            flash red #e5484d · caution amber #d9a13c                       */

:root {
  --bg: #0a0e13;
  --panel: #10161f;
  --panel-2: #141c27;
  --line: #223041;
  --line-soft: #1a2532;
  --text: #c7d3df;
  --muted: #64768a;
  --blue: #5ca8cf;
  --blue-dim: #2c5a72;
  --red: #e5484d;
  --amber: #d9a13c;
  --ok: #58b98a;
  --font-ui: "IBM Plex Sans", system-ui, sans-serif;
  --font-disp: "IBM Plex Sans Condensed", "IBM Plex Sans", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body { height: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.55;
  overflow: hidden;
}

.hidden { display: none !important; }
.mono { font-family: var(--font-mono); }

/* faint vignette so the screen reads as a lit console in a dark room */
body::after {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 5;
  background: radial-gradient(ellipse at 50% 38%, transparent 55%, rgba(0,0,0,0.42) 100%);
}

/* alarm state: the room goes red at the edges */
body.alarm::after {
  background:
    radial-gradient(ellipse at 50% 38%, transparent 52%, rgba(120,10,14,0.5) 100%);
  animation: alarmthrob 0.9s ease-in-out infinite alternate;
}
@keyframes alarmthrob { from { opacity: 0.55; } to { opacity: 1; } }

/* ---- Boot ------------------------------------------------------------- */

#boot {
  position: fixed; inset: 0; z-index: 40;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
}
#boot-inner { width: min(680px, 88vw); }
#boot-mark, #st-mark {
  font-family: var(--font-disp); font-weight: 700; letter-spacing: 0.08em;
  font-size: 30px; color: var(--text);
}
#boot-mark span, #st-mark span { color: var(--blue); font-weight: 500; }
#boot-mark { margin-bottom: 28px; font-size: 44px; }
#boot-out { min-height: 300px; }
.boot-line {
  font-family: var(--font-mono); font-size: 13px; color: var(--muted);
  padding: 3px 0; letter-spacing: 0.02em;
}
.boot-glitch {
  color: var(--red) !important;
  text-shadow: 1.5px 0 rgba(92,168,207,0.9), -1.5px 0 rgba(229,72,77,0.7);
  animation: bootjitter 0.14s steps(2) infinite;
}
.boot-suppressed { color: #3d4b5c !important; font-style: italic; }
@keyframes bootjitter {
  0% { transform: translateX(0); }
  50% { transform: translateX(2px); }
  100% { transform: translateX(-1px); }
}

/* fsociety easter egg: one violent second of chromatic shake */
body.glitched #shell {
  animation: glitchshake 0.15s steps(2) 9;
}
@keyframes glitchshake {
  0%   { transform: translate(0); filter: none; }
  25%  { transform: translate(-6px, 2px); filter: drop-shadow(3px 0 rgba(229,72,77,0.85)) drop-shadow(-3px 0 rgba(92,168,207,0.85)); }
  50%  { transform: translate(5px, -2px); filter: hue-rotate(-40deg) saturate(2.2); }
  75%  { transform: translate(-4px, -1px); filter: drop-shadow(-3px 0 rgba(229,72,77,0.85)) drop-shadow(3px 0 rgba(92,168,207,0.85)); }
  100% { transform: translate(0); filter: none; }
}

.boot-form { margin-top: 26px; }
.boot-label {
  display: block; margin: 20px 0 8px;
  font-family: var(--font-disp); font-weight: 600; font-size: 12px;
  letter-spacing: 0.28em; color: var(--blue);
}
.boot-row { display: flex; align-items: center; gap: 10px; border-bottom: 1px solid var(--line); padding-bottom: 8px; }
.boot-caret { color: var(--red); font-family: var(--font-mono); }
#b-name {
  flex: 1; background: none; border: none; outline: none;
  color: var(--text); font-family: var(--font-mono); font-size: 18px;
  text-transform: uppercase; letter-spacing: 0.06em; caret-color: var(--red);
}
.boot-actions { margin-top: 26px; display: flex; gap: 12px; }

/* ---- Shell frame -------------------------------------------------------- */

#shell {
  height: 100vh; height: 100dvh;
  display: flex; flex-direction: column;
}

.banner {
  flex: none; text-align: center;
  font-family: var(--font-disp); font-weight: 700; font-size: 11px;
  letter-spacing: 0.42em; text-indent: 0.42em;
  padding: 5px 8px;
  background: #0d1420; color: var(--muted);
  border-bottom: 1px solid var(--line-soft);
  transition: background 0.4s, color 0.4s;
}
#banner-bot { border-bottom: none; border-top: 1px solid var(--line-soft); }
body.live .banner { background: var(--red); color: #fff1f1; }

#statusbar {
  flex: none; display: flex; align-items: center; gap: 26px;
  padding: 10px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}
#st-mark { font-size: 19px; }
.st-item { font-family: var(--font-mono); font-size: 12.5px; white-space: nowrap; }
.st-label {
  font-family: var(--font-disp); font-weight: 600; font-size: 10px;
  letter-spacing: 0.22em; color: var(--muted); margin-right: 6px;
}
.st-dim { color: var(--muted); }
.st-spring { flex: 1; }
#st-clock { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.st-btn {
  background: none; border: 1px solid var(--line); color: var(--muted);
  font-family: var(--font-disp); font-weight: 600; font-size: 10px; letter-spacing: 0.18em;
  padding: 4px 10px; cursor: pointer; border-radius: 2px;
}
.st-btn:hover { color: var(--text); border-color: var(--muted); }

.threat { font-weight: 600; }
.threat-substantial { color: var(--amber); }
.threat-severe { color: #e07840; }
.threat-critical { color: var(--red); animation: blink 1.6s step-end infinite; }
@keyframes blink { 50% { opacity: 0.35; } }

.pips { display: inline-flex; gap: 5px; vertical-align: middle; }
.pip { width: 9px; height: 9px; border: 1px solid var(--line); display: inline-block; background: transparent; }
.pip-hot { background: var(--red); border-color: var(--red); }

/* ---- Trace strip (signature) --------------------------------------------- */

#tracestrip {
  flex: none; display: flex; align-items: center; gap: 14px;
  padding: 7px 18px;
  background: #120e0a;
  border-bottom: 1px solid #3a2c14;
}
#trace-word {
  font-family: var(--font-disp); font-weight: 700; font-size: 11px;
  letter-spacing: 0.34em; color: var(--amber);
}
#trace-bar {
  flex: 1; height: 8px; background: #1c1610;
  border: 1px solid #3a2c14;
}
#trace-fill {
  height: 100%; width: 0;
  background: repeating-linear-gradient(-45deg, var(--amber) 0 8px, #b07f26 8px 16px);
  transition: width 0.12s linear;
}
#trace-fill.trace-hot {
  background: repeating-linear-gradient(-45deg, var(--red) 0 8px, #a32328 8px 16px);
}
#trace-pct { font-size: 12px; color: var(--amber); min-width: 66px; text-align: right; }

/* ---- Main region ------------------------------------------------------------ */

#main { flex: 1; display: flex; min-height: 0; }

#dock {
  flex: none; width: 178px;
  border-right: 1px solid var(--line);
  background: var(--panel);
  display: flex; flex-direction: column; padding: 14px 0;
}
.dock-item {
  display: flex; align-items: baseline; gap: 10px;
  background: none; border: none; border-left: 2px solid transparent;
  color: var(--muted); text-align: left; cursor: pointer;
  padding: 11px 16px; font-family: var(--font-disp);
}
.dock-item:hover { color: var(--text); background: var(--panel-2); }
.dock-item.on { color: var(--text); border-left-color: var(--blue); background: var(--panel-2); }
.dock-item.hot { color: var(--red); }
.dock-item.hot.on { border-left-color: var(--red); }
.dock-tag { font-family: var(--font-mono); font-size: 10px; color: var(--blue-dim); }
.dock-item.hot .dock-tag { color: var(--red); }
.dock-label { font-weight: 600; font-size: 12.5px; letter-spacing: 0.14em; }
.dock-badge {
  margin-left: auto; font-family: var(--font-mono); font-size: 10.5px;
  background: var(--blue); color: #06121a; border-radius: 8px;
  padding: 0 6px; line-height: 16px;
}

#viewport { flex: 1; overflow-y: auto; padding: 26px 32px 44px; min-width: 0; }

/* ---- Screen furniture --------------------------------------------------------- */

.scr-head {
  display: flex; justify-content: space-between; align-items: flex-end; gap: 20px;
  margin-bottom: 22px; padding-bottom: 14px; border-bottom: 1px solid var(--line);
}
.kicker {
  font-family: var(--font-disp); font-weight: 600; font-size: 10.5px;
  letter-spacing: 0.3em; color: var(--muted); margin-bottom: 4px;
}
.scr-title {
  font-family: var(--font-disp); font-weight: 700; font-size: 27px;
  letter-spacing: 0.06em; line-height: 1.1;
}
.scr-head-right { text-align: right; }
.map-target-label { font-family: var(--font-mono); font-size: 13px; color: var(--red); }
.head-count { font-family: var(--font-mono); font-size: 13px; color: var(--blue); }

.empty { color: var(--muted); font-family: var(--font-mono); font-size: 13px; padding: 40px 0; }
.pane-note { margin-top: 14px; font-size: 12.5px; color: var(--muted); }
.ok { color: var(--ok); font-family: var(--font-disp); font-weight: 600; font-size: 11px; letter-spacing: 0.18em; }
.hot { color: var(--red); }

/* ---- Buttons ------------------------------------------------------------------ */

.btn {
  font-family: var(--font-disp); font-weight: 600; font-size: 11.5px;
  letter-spacing: 0.18em; text-indent: 0.09em;
  color: var(--text); background: var(--panel-2);
  border: 1px solid var(--line); border-radius: 2px;
  padding: 9px 16px; cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}
.btn:hover:not(:disabled) { border-color: var(--blue); color: #eaf3fa; }
.btn:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.btn:disabled { opacity: 0.38; cursor: default; }
.btn-primary { background: #16303f; border-color: var(--blue-dim); color: #bfe0f2; }
.btn-primary:hover:not(:disabled) { background: #1b3c4f; }
.btn-danger { background: #38141a; border-color: #6e2229; color: #f4b9bc; }
.btn-danger:hover:not(:disabled) { border-color: var(--red); color: #ffdadb; }
.btn-quiet { background: none; color: var(--muted); }
.btn-small { padding: 4px 10px; font-size: 10px; }
.btn-big { padding: 13px 26px; font-size: 13px; }

/* ---- Ops board ------------------------------------------------------------------ */

.op-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; }
.op-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 3px;
  padding: 18px 20px; display: flex; flex-direction: column; gap: 8px;
  transition: border-color 0.15s;
}
.op-card.on { border-color: var(--blue-dim); background: var(--panel-2); }
.op-card.op-locked { opacity: 0.55; }
.op-card.op-complete { opacity: 0.75; }
.op-card.op-finale:not(.op-locked) { border-color: #6e2229; }
.op-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.op-code { font-family: var(--font-disp); font-weight: 700; font-size: 17px; letter-spacing: 0.08em; }
.op-class {
  font-family: var(--font-disp); font-weight: 700; font-size: 9.5px; letter-spacing: 0.2em;
  padding: 3px 8px; border: 1px solid; white-space: nowrap;
}
.cls-official { color: var(--muted); border-color: var(--line); }
.cls-secret { color: var(--amber); border-color: #4d3a17; }
.cls-top { color: var(--red); border-color: #6e2229; }
.op-tier { font-family: var(--font-mono); font-size: 10.5px; color: var(--blue); letter-spacing: 0.06em; }
.op-summary { font-size: 13.5px; color: var(--text); flex: 1; }
.op-locked .op-summary { color: var(--muted); font-style: italic; }
.op-foot { display: flex; gap: 10px; align-items: center; margin-top: 6px; flex-wrap: wrap; }
.op-done { font-family: var(--font-disp); font-weight: 600; font-size: 11px; letter-spacing: 0.16em; color: var(--ok); }

/* Sabotage arc block */
.arc-block {
  grid-column: 1 / -1;
  border: 1px solid #4d3a17; border-left: 3px solid var(--amber);
  background: linear-gradient(180deg, rgba(217,161,60,0.05), transparent 60%);
  border-radius: 3px; padding: 16px 18px;
}
.arc-block.arc-complete { border-color: #1e4232; border-left-color: var(--ok); background: none; }
.arc-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 16px; }
.arc-kicker { font-family: var(--font-disp); font-weight: 600; font-size: 10px; letter-spacing: 0.28em; color: var(--amber); margin-bottom: 3px; }
.arc-complete .arc-kicker { color: var(--ok); }
.arc-name { font-family: var(--font-disp); font-weight: 700; font-size: 20px; letter-spacing: 0.06em; }
.arc-status { font-family: var(--font-mono); font-size: 11px; color: var(--muted); white-space: nowrap; }
.arc-status-alert { color: var(--red); }
.arc-track { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.arc-step { position: relative; display: flex; flex-direction: column; }
.arc-step .op-card { flex: 1; }
.arc-badge {
  position: absolute; top: -8px; left: -8px; z-index: 2;
  width: 24px; height: 24px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-disp); font-weight: 700; font-size: 12px;
  background: var(--panel); border: 1px solid var(--line); color: var(--muted);
}
.arc-badge-live { border-color: var(--amber); color: var(--amber); }
.arc-badge-done { border-color: var(--ok); color: var(--ok); }
.arc-phase-name { font-family: var(--font-disp); font-weight: 600; font-size: 9.5px; letter-spacing: 0.22em; color: var(--muted); margin: 0 0 6px 22px; }

/* ---- Network map ------------------------------------------------------------------- */

.map-layout {
  display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px;
  align-items: start;
}
.map-wrap {
  border: 1px solid var(--line); background: var(--panel);
  border-radius: 3px; overflow: hidden; position: relative;
}
#mapsvg { display: block; width: 100%; height: auto; max-height: 62vh; }
.map-legend {
  display: flex; flex-wrap: wrap; gap: 14px; align-items: center;
  padding: 8px 12px; border-top: 1px solid var(--line-soft);
  font-family: var(--font-mono); font-size: 10.5px; color: var(--muted);
}
.map-legend span { display: inline-flex; align-items: center; gap: 5px; }
.lg { width: 9px; height: 9px; display: inline-block; border-radius: 50%; }
.lg-home { border-radius: 0; background: var(--blue); }
.lg-relay { background: var(--muted); }
.lg-ghost { background: #a795e0; }
.lg-target { background: var(--red); transform: rotate(45deg); border-radius: 0; }
.lg-lock-note { color: var(--red); margin-left: auto; }

.coast { fill: #141d2b; stroke: #2b3d55; stroke-width: 0.18; stroke-linejoin: round; }
.grat { stroke: var(--line-soft); stroke-width: 0.06; }

.region-zone { fill: rgba(92,168,207,0.02); stroke: var(--line-soft); stroke-width: 0.08; stroke-dasharray: 0.5 0.5; }
.region-zone-lock { fill: rgba(229,72,77,0.06); stroke: var(--red); stroke-width: 0.14; stroke-dasharray: 0.8 0.6; }
.region-label {
  font-family: var(--font-disp); font-weight: 700; font-size: 3px; letter-spacing: 0.3px;
  fill: #33475f; opacity: 0.6; pointer-events: none;
}
.region-label-lock { fill: var(--red); opacity: 0.9; }

.route-line {
  stroke: var(--blue); stroke-width: 0.3; opacity: 0.9; fill: none;
  stroke-dasharray: 1.2 0.7;
}
.route-final { stroke: var(--red); }
.route-live { animation: routeflow 0.7s linear infinite; }
@keyframes routeflow { to { stroke-dashoffset: -1.9; } }

.node { cursor: default; outline: none; }
.node.bounce { cursor: pointer; }
.node-hit { fill: transparent; }
.node-dot { fill: var(--muted); transition: fill 0.15s; }
.node-halo {
  fill: none; stroke: var(--blue); stroke-width: 0.16;
  stroke-dasharray: 0.6 0.45; opacity: 0; transition: opacity 0.15s;
}
.node.bounce:hover .node-dot, .node.bounce:focus-visible .node-dot { fill: var(--text); }
.node.bounce:hover .node-halo, .node.bounce:focus-visible .node-halo { opacity: 0.75; }
.node.picked .node-dot { fill: var(--blue); }
.node.picked .node-halo { opacity: 1; stroke-dasharray: none; }
.node.rgn-US .node-dot { fill: #4fd0c0; }
.node.rgn-ME .node-dot { fill: #d9a13c; }
.node-valid-ring { fill: none; stroke: var(--red); stroke-width: 0.16; opacity: 0.8; animation: ringpulse 1.8s ease-out infinite; }
.node.ghost .node-dot { fill: #7f6fae; }
.node.ghost .node-halo { stroke: #a795e0; }
.node.ghost.picked .node-dot { fill: #a795e0; }
.node-home { fill: var(--blue); }
.node-target { fill: var(--red); }
.node-bracket { fill: none; stroke: var(--red); stroke-width: 0.2; opacity: 0.85; }
.node-ring { fill: none; stroke: var(--red); stroke-width: 0.18; opacity: 0.7; animation: ringpulse 2s ease-out infinite; }
@keyframes ringpulse { 0% { r: 1.6; opacity: 0.8; } 100% { r: 3.4; opacity: 0; } }

.node-label {
  font-family: var(--font-mono); font-size: 1.6px; letter-spacing: 0.08px;
  fill: var(--muted); pointer-events: none;
  paint-order: stroke; stroke: rgba(10, 14, 19, 0.9); stroke-width: 0.4px;
}
.node.picked .node-label, .node.home .node-label { fill: var(--text); }
.node.target .node-label { fill: var(--red); }

.hopchip circle { fill: #16303f; stroke: var(--blue); stroke-width: 0.14; }
.hopchip text { font-family: var(--font-mono); font-size: 1.6px; font-weight: 600; fill: #bfe0f2; }

/* Side console */
.map-side { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.side-panel {
  border: 1px solid var(--line); background: var(--panel); border-radius: 3px;
  padding: 14px 16px; display: flex; flex-direction: column; gap: 10px;
}
.chip-col { display: flex; flex-direction: column; gap: 6px; }
.chip {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--font-mono); font-size: 11px; color: var(--text);
  border: 1px solid var(--line); border-radius: 2px;
  padding: 5px 8px; background: var(--panel-2);
}
.chip-tag {
  font-family: var(--font-disp); font-weight: 700; font-size: 9px; letter-spacing: 0.14em;
  color: var(--blue); min-width: 16px;
}
.chip-origin { border-left: 2px solid var(--blue); }
.chip-target { border-left: 2px solid var(--red); }
.chip-target .chip-tag { color: var(--red); }
.chip-ghost { border-left: 2px solid #7f6fae; }
.chip-ghost .chip-tag { color: #a795e0; }
.chip-note { font-size: 9px; color: #a795e0; letter-spacing: 0.1em; }
.chip-x {
  margin-left: auto; background: none; border: none; cursor: pointer;
  color: var(--muted); font-size: 14px; line-height: 1; padding: 0 2px;
}
.chip-x:hover { color: var(--red); }
.chip-x:focus-visible { outline: 2px solid var(--blue); outline-offset: 1px; }

.trace-big {
  font-family: var(--font-disp); font-weight: 700; font-size: 34px;
  color: var(--amber); line-height: 1; letter-spacing: 0.03em;
}
.trace-big.trace-dim { color: var(--muted); font-size: 22px; }
.trace-unit { font-size: 18px; font-weight: 600; color: var(--muted); margin-left: 2px; }
.side-note { font-size: 12px; color: var(--muted); }
.side-warn { font-size: 12.5px; color: var(--red); font-weight: 600; }
.side-caution { font-size: 12.5px; color: var(--amber); }
.side-hint { font-size: 12px; color: var(--muted); padding: 0 2px; }
.side-lock {
  margin-top: 4px; font-family: var(--font-disp); font-weight: 600; font-size: 11px;
  letter-spacing: 0.12em; color: var(--amber);
  border: 1px solid #4d3a17; border-radius: 2px; padding: 5px 8px;
}
.side-lock-ok { color: var(--ok); border-color: #1e4232; }

.map-actions { display: flex; flex-direction: column; gap: 10px; }
.map-actions .btn-big { width: 100%; }

/* ---- Remote / live link --------------------------------------------------------------- */

.auth-pane {
  border: 1px solid var(--line); background: var(--panel); border-radius: 3px;
  padding: 34px; text-align: center;
}
.auth-host { color: var(--muted); font-size: 13px; margin: 6px 0 30px; }
.crack-row { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; margin-bottom: 26px; }
.crack-ch {
  font-family: var(--font-mono); font-size: 30px; width: 46px; line-height: 62px;
  border: 1px solid var(--line); background: var(--bg); border-radius: 2px;
  color: var(--muted);
}
.crack-ch.spin { color: var(--amber); border-color: #4d3a17; }
.crack-ch.locked { color: #dff2ea; border-color: var(--ok); background: #10241c; }
.auth-note { color: var(--muted); font-size: 13px; margin-bottom: 22px; }
.auth-actions { display: flex; justify-content: center; }

.inside-pane { border: 1px solid var(--line); background: var(--panel); border-radius: 3px; }
.tabs { display: flex; border-bottom: 1px solid var(--line); }
.tab {
  background: none; border: none; border-bottom: 2px solid transparent;
  font-family: var(--font-disp); font-weight: 600; font-size: 12px; letter-spacing: 0.18em;
  color: var(--muted); padding: 13px 22px; cursor: pointer;
}
.tab.on { color: var(--text); border-bottom-color: var(--blue); }
.tab-count {
  font-family: var(--font-mono); font-size: 10.5px; margin-left: 6px;
  color: var(--amber);
}

.vault-bar {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 20px; border-bottom: 1px solid var(--line); flex-wrap: wrap;
}
.vault-pips { display: inline-flex; gap: 5px; }
.vslot { width: 14px; height: 10px; border: 1px solid var(--blue-dim); background: transparent; display: inline-block; }
.vslot-full { background: var(--blue); border-color: var(--blue); }
.vault-count { font-size: 11.5px; color: var(--muted); }
.vault-mux { font-size: 10.5px; color: var(--ok); margin-left: auto; letter-spacing: 0.1em; }

/* Facial-recognition enrolment board */
.facegrid-head { display: flex; justify-content: space-between; align-items: center; padding: 11px 20px; border-bottom: 1px solid var(--line); }
.facegrid-tool { font-size: 10.5px; color: var(--ok); letter-spacing: 0.1em; }
.facegrid-notool { font-size: 10.5px; color: var(--amber); letter-spacing: 0.1em; }
.face-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 14px; padding: 18px 20px; }
.face-cell {
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 3px;
  padding: 10px; cursor: pointer; text-align: center; color: var(--text);
  display: flex; flex-direction: column; gap: 8px; transition: border-color 0.15s, transform 0.1s;
}
.face-cell:hover:not(:disabled) { border-color: var(--red); transform: translateY(-2px); }
.face-cell:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.face-cell:disabled { cursor: default; }
.face-cell.face-locked { opacity: 0.72; }
.face-cell.face-done { border-color: #1e4232; }
.face-pic { position: relative; border-radius: 2px; overflow: hidden; background: #0e1621; aspect-ratio: 5 / 6; }
.face-svg { display: block; width: 100%; height: 100%; }
.face-img { display: block; width: 100%; height: 100%; object-fit: cover; }
.face-scan {
  position: absolute; inset: 0;
  background: repeating-linear-gradient(0deg, rgba(88,185,138,0.14) 0 2px, transparent 2px 4px);
  mix-blend-mode: screen;
}
.face-cap { font-size: 10.5px; color: var(--muted); letter-spacing: 0.04em; }
.face-state { font-family: var(--font-disp); font-weight: 600; font-size: 9.5px; letter-spacing: 0.14em; color: var(--muted); min-height: 12px; }
.face-locked .face-state { color: var(--amber); }
.face-prog { display: block; height: 6px; background: var(--bg); border: 1px solid #6e2229; }
.face-prog i { display: block; height: 100%; background: var(--red); }

.file-list, .log-list { padding: 6px 0; min-height: 200px; }
.file-act-row .file-name { color: var(--amber); }
.file-row .file-flag { font-family: var(--font-mono); }
.file-row, .log-row {
  display: flex; align-items: center; gap: 14px;
  padding: 9px 20px; border-bottom: 1px solid var(--line-soft);
}
.file-row:last-child, .log-row:last-child { border-bottom: none; }
.file-flag { width: 14px; color: var(--red); flex: none; }
.file-name { flex: 1; font-size: 13px; min-width: 0; overflow-wrap: anywhere; }
.file-row.flagged .file-name { color: #e8f1f8; }
.file-size { color: var(--muted); font-size: 12px; width: 70px; text-align: right; flex: none; }
.file-act { width: 190px; display: flex; justify-content: flex-end; align-items: center; gap: 8px; flex: none; }

.bar { width: 120px; height: 7px; background: var(--bg); border: 1px solid var(--line); display: inline-block; }
.bar i { display: block; height: 100%; background: var(--blue); transition: width 0.1s linear; }
.bar-red i { background: var(--red); }
.bar-pct { font-size: 11px; color: var(--muted); width: 38px; text-align: right; }

.log-ts { color: var(--muted); font-size: 11.5px; flex: none; }
.log-owner { font-family: var(--font-disp); font-weight: 700; font-size: 9px; letter-spacing: 0.12em; padding: 2px 6px; border: 1px solid; border-radius: 2px; flex: none; }
.log-owner-you { color: var(--amber); border-color: #4d3a17; }
.log-owner-sys { color: var(--muted); border-color: var(--line); }
.log-row.log-system .log-txt { color: var(--muted); }
.log-txt { flex: 1; font-size: 12px; color: var(--amber); min-width: 0; overflow-wrap: anywhere; }
.log-act { flex: none; width: 130px; display: flex; justify-content: flex-end; }
.log-empty { padding: 30px 20px; color: var(--ok); font-family: var(--font-mono); font-size: 12.5px; }
.log-foot { display: flex; align-items: center; gap: 18px; padding: 14px 20px; border-top: 1px solid var(--line); }
.log-foot .pane-note { margin: 0; }

/* ---- Comms ---------------------------------------------------------------------------- */

.msg-list { display: flex; flex-direction: column; gap: 10px; max-width: 780px; }
.msg { border: 1px solid var(--line); background: var(--panel); border-radius: 3px; }
.msg-head {
  display: flex; align-items: center; gap: 12px; width: 100%;
  background: none; border: none; cursor: pointer; text-align: left;
  padding: 13px 18px; color: var(--text);
}
.msg-dot { width: 7px; height: 7px; border-radius: 50%; background: transparent; flex: none; }
.msg.unread .msg-dot { background: var(--blue); }
.msg-from {
  font-family: var(--font-disp); font-weight: 600; font-size: 11px; letter-spacing: 0.14em;
  color: var(--muted); flex: none; width: 250px;
}
.msg.unread .msg-from { color: var(--blue); }
.msg-subj { flex: 1; font-size: 13.5px; min-width: 0; }
.msg.unread .msg-subj { font-weight: 600; }
.msg-time { color: var(--muted); font-size: 11.5px; flex: none; }
.msg-body { padding: 2px 18px 16px 37px; color: var(--text); max-width: 640px; }
.msg-body p { margin-bottom: 10px; font-size: 13.5px; }

/* ---- Tech Ops --------------------------------------------------------------------------- */

.tool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.tool-card {
  border: 1px solid var(--line); background: var(--panel); border-radius: 3px;
  padding: 18px 20px; display: flex; flex-direction: column; gap: 10px;
}
.tool-card.owned { border-color: #1e4232; }
.tool-card.gated { opacity: 0.6; }
.tool-top { display: flex; justify-content: space-between; align-items: baseline; }
.tool-name { font-family: var(--font-disp); font-weight: 700; font-size: 16px; letter-spacing: 0.08em; }
.tool-form { font-size: 10.5px; color: var(--muted); }
.tool-desc { font-size: 13px; color: var(--text); flex: 1; }
.tool-card.gated .tool-desc { color: var(--muted); font-style: italic; }
.tool-gate { font-family: var(--font-disp); font-weight: 600; font-size: 10.5px; letter-spacing: 0.18em; color: var(--amber); }
.tool-prov { font-family: var(--font-disp); font-weight: 600; font-size: 10.5px; letter-spacing: 0.18em; color: var(--blue); animation: blink 1.4s step-end infinite; }
.tool-card.provisioning { border-color: var(--blue-dim); }
.tool-foot { display: flex; }
.prov-banner {
  border: 1px solid var(--blue-dim); background: #10222e; border-radius: 3px;
  padding: 12px 16px; margin-bottom: 16px; font-size: 13px; color: var(--text);
}
.prov-banner .kicker { display: inline; color: var(--blue); margin-right: 6px; }

/* ---- Ticker ------------------------------------------------------------------------------- */

#ticker {
  flex: none; display: flex; align-items: center; gap: 14px;
  padding: 6px 18px; border-top: 1px solid var(--line);
  background: var(--panel);
}
.ticker-label {
  font-family: var(--font-disp); font-weight: 700; font-size: 9.5px;
  letter-spacing: 0.3em; color: var(--blue-dim); flex: none;
}
#ticker-text {
  font-family: var(--font-mono); font-size: 11.5px; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ---- Modals -------------------------------------------------------------------------------- */

#modal {
  position: fixed; inset: 0; z-index: 30;
  background: rgba(4, 7, 11, 0.82);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.modal-card {
  width: min(640px, 100%); max-height: 86vh; overflow-y: auto;
  background: var(--panel); border: 1px solid var(--line); border-radius: 3px;
  padding: 30px 34px;
  box-shadow: 0 30px 80px rgba(0,0,0,0.6);
}
.modal-danger { border-color: #6e2229; }
.modal-actions { display: flex; gap: 12px; margin-top: 26px; flex-wrap: wrap; }

.doc p { margin-bottom: 12px; font-size: 14px; }
.doc-title { font-family: var(--font-disp); font-weight: 700; font-size: 24px; letter-spacing: 0.05em; margin: 4px 0 16px; }
.doc-stamp {
  display: inline-block; font-family: var(--font-disp); font-weight: 700;
  font-size: 11px; letter-spacing: 0.3em; text-indent: 0.15em;
  border: 1.5px solid; padding: 5px 12px; margin-bottom: 16px;
  transform: rotate(-1.2deg);
}
.doc-objectives { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 14px; }
.doc-objectives ul { list-style: none; }
.doc-objectives li { font-family: var(--font-mono); font-size: 12.5px; padding: 4px 0 4px 18px; position: relative; }
.doc-objectives li::before { content: "▸"; position: absolute; left: 0; color: var(--blue); }
.doc-reward { color: var(--ok); font-family: var(--font-mono); font-size: 12.5px; }

/* ---- Responsive ------------------------------------------------------------------------------ */

@media (max-width: 820px) {
  body { overflow: auto; }
  #shell { height: auto; min-height: 100dvh; }
  #main { flex-direction: column; }
  #dock { width: 100%; flex-direction: row; overflow-x: auto; padding: 0; border-right: none; border-bottom: 1px solid var(--line); }
  .dock-item { border-left: none; border-bottom: 2px solid transparent; padding: 12px 14px; flex: none; }
  .dock-item.on { border-bottom-color: var(--blue); }
  .dock-tag { display: none; }
  #viewport { padding: 18px 16px 40px; overflow: visible; }
  #statusbar { gap: 14px; flex-wrap: wrap; padding: 10px 14px; }
  .msg-from { width: auto; }
  .msg-head { flex-wrap: wrap; }
  .file-act { width: auto; }
  .crack-ch { font-size: 20px; width: 32px; line-height: 44px; }
  .map-layout { grid-template-columns: 1fr; }
  #mapsvg { max-height: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
