@font-face {
  font-family: "VT323";
  src: url("assets/fonts/VT323-Regular.ttf") format("truetype");
  font-display: block;
  font-style: normal;
  font-weight: 400;
}

:root {
  color-scheme: dark;
  --black: #050706;
  --shell: #33372f;
  --shell-dark: #171a17;
  --panel: #0b100d;
  --panel-raised: #151b16;
  --screen: #07100b;
  --line: #596050;
  --line-dark: #20251f;
  --text: #d1d7bd;
  --muted: #828a77;
  --green: #87b85f;
  --green-bright: #c1da8f;
  --amber: #d5a33c;
  --red: #b84c39;
  --blue: #739a91;
  --stage-scale: 1;
  --terminal-font: "VT323", monospace;
  font-family: var(--terminal-font);
  font-feature-settings: "liga" 0, "calt" 0;
  font-variant-ligatures: none;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-width: 320px;
  min-height: 100%;
}

body {
  display: grid;
  min-height: 100svh;
  margin: 0;
  place-items: center;
  overflow: hidden;
  color: var(--text);
  background:
    radial-gradient(circle at 50% 42%, #242822 0, #11130f 36%, #050605 76%),
    #050605;
}

body::before {
  position: fixed;
  inset: 0;
  background:
    repeating-linear-gradient(90deg, transparent 0 63px, rgba(143, 153, 121, 0.025) 64px),
    repeating-linear-gradient(0deg, transparent 0 63px, rgba(143, 153, 121, 0.018) 64px);
  content: "";
  pointer-events: none;
}

button,
input,
select {
  font: inherit;
}

button,
select {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--green-bright);
  outline-offset: 2px;
}

.terminal-mount {
  position: relative;
  width: 640px;
  height: 480px;
}

.terminal-stage {
  position: absolute;
  top: 0;
  left: 0;
  display: grid;
  grid-template-rows: 46px minmax(0, 1fr) 32px;
  gap: 6px;
  width: 640px;
  height: 480px;
  padding: 8px;
  overflow: hidden;
  transform: scale(var(--stage-scale));
  transform-origin: top left;
  border: 2px solid #6c715f;
  border-right-color: #20231e;
  border-bottom-color: #1b1e19;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.045), transparent 18%),
    repeating-linear-gradient(90deg, transparent 0 7px, rgba(255, 255, 255, 0.01) 8px),
    var(--shell);
  box-shadow:
    inset 0 0 0 2px #151814,
    inset 0 0 0 3px #515649,
    0 18px 70px rgba(0, 0, 0, 0.75);
  -webkit-font-smoothing: none;
}

.terminal-stage::after {
  position: absolute;
  inset: 0;
  z-index: 20;
  background: repeating-linear-gradient(
    0deg,
    transparent 0,
    transparent 2px,
    rgba(4, 7, 4, 0.28) 2px,
    rgba(4, 7, 4, 0.28) 3px
  );
  content: "";
  opacity: 0.26;
  pointer-events: none;
}

.boot-sequence {
  position: absolute;
  inset: 8px;
  z-index: 40;
  display: grid;
  place-items: stretch;
  border: 1px solid #28352a;
  background:
    repeating-linear-gradient(0deg, transparent 0 2px, rgba(0, 0, 0, 0.28) 2px 3px),
    #030805;
  color: var(--green-bright);
  text-shadow: 0 0 5px rgba(135, 184, 95, 0.45);
}

.boot-sequence[hidden] {
  display: none;
}

.boot-screen {
  display: grid;
  grid-template-rows: auto auto auto auto minmax(0, 1fr);
  gap: 14px;
  width: min(560px, 100%);
  height: 100%;
  padding: 30px 32px 26px;
}

.boot-screen p {
  margin: 0;
}

.boot-banner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: baseline;
  padding-bottom: 10px;
  border-bottom: 1px solid #3c5139;
}

.boot-vendor {
  grid-column: 1 / -1;
  color: var(--amber);
  font-size: 11px;
  letter-spacing: 3px;
  text-transform: uppercase;
}

.boot-bios {
  margin-top: 2px !important;
  color: var(--green-bright);
  font-size: 23px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.boot-node {
  color: #6f8268;
  font-size: 11px;
  letter-spacing: 1.4px;
  text-transform: uppercase;
}

/* The self-test rows persist as they report, so a long voice download reads as
   a machine working through a list rather than one line sitting still. */
.boot-checks {
  display: grid;
  gap: 5px;
  min-height: 92px;
  margin: 0;
  padding: 0;
  align-content: start;
  list-style: none;
}

.boot-checks li {
  display: grid;
  grid-template-columns: auto minmax(14px, 1fr) auto;
  align-items: baseline;
  gap: 7px;
  font-size: 12px;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  animation: boot-check-in 140ms steps(2, end);
}

.boot-check-label {
  color: #9fb392;
}

.boot-check-leader {
  height: 1px;
  border-bottom: 1px dotted #43563f;
  transform: translateY(-3px);
}

.boot-check-status {
  min-width: 62px;
  color: var(--green-bright);
  text-align: right;
}

.boot-checks li[data-state="busy"] .boot-check-status {
  color: var(--amber);
}

.boot-checks li[data-state="busy"] .boot-check-label {
  color: var(--text);
}

.boot-checks li[data-state="warn"] .boot-check-status {
  color: #e58b74;
}

.boot-route {
  align-self: end;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 9px;
  padding-top: 10px;
  border-top: 1px solid #2c3a2a;
  color: #6b7a63;
  font-size: 10px;
  letter-spacing: 1.1px;
  text-transform: uppercase;
}

.boot-route b {
  color: #93a888;
  font-weight: 400;
}

@keyframes boot-check-in {
  from { opacity: 0; }
}

.boot-message {
  min-height: 18px;
  color: #b9ceaa;
  font-size: 13px;
  letter-spacing: 0.6px;
  text-transform: uppercase;
}

.boot-message i {
  font-style: normal;
  animation: boot-cursor 520ms steps(1, end) infinite;
}

.boot-progress {
  height: 14px;
  padding: 2px;
  border: 1px solid #40533e;
  background: #020402;
  box-shadow: inset 0 0 10px #000;
}

.boot-progress span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--green);
  box-shadow: 0 0 6px rgba(135, 184, 95, 0.55);
  transition: width 180ms steps(4, end);
}

@keyframes boot-cursor {
  50% { opacity: 0; }
}

.terminal-rivets::before,
.terminal-rivets::after {
  position: absolute;
  top: 4px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #11130f;
  box-shadow: inset 1px 1px #757967, 0 468px #11130f;
  content: "";
}

.terminal-rivets {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.terminal-rivets::before {
  left: 4px;
}

.terminal-rivets::after {
  right: 4px;
}

.terminal-header,
.terminal-controls,
.video-module,
.comms-module,
.intercom-module,
.gate-module {
  border: 1px solid var(--line-dark);
  border-top-color: #707663;
  border-left-color: #666c5b;
  background: var(--shell-dark);
  box-shadow: inset 0 0 0 1px #080a08;
}

.terminal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 9px;
}

.terminal-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.brand-mark {
  display: grid;
  width: 35px;
  height: 31px;
  place-items: center;
  border: 1px solid #626855;
  background: #20241e;
  color: var(--amber);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1px;
  box-shadow: inset 0 0 0 2px #0c0f0c;
}

.terminal-brand p,
.terminal-brand h1 {
  margin: 0;
  text-transform: uppercase;
}

.terminal-brand p {
  color: var(--muted);
  font-size: 8px;
  letter-spacing: 1.1px;
}

.terminal-brand h1 {
  margin-top: 2px;
  color: #d7d9c2;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.7px;
}

.header-readouts {
  display: flex;
  align-items: stretch;
  gap: 5px;
}

.status-readout {
  display: grid;
  grid-template-columns: 7px auto;
  min-width: 65px;
  padding: 3px 5px;
  border: 1px solid #2b3028;
  background: #0c0f0c;
  color: var(--muted);
  font-size: 8px;
  line-height: 1.15;
  text-transform: uppercase;
}

.status-readout strong {
  grid-column: 2;
  color: var(--text);
  font-size: 10px;
  font-weight: 400;
}

.status-lamp,
.lamp {
  display: inline-block;
  width: 5px;
  height: 5px;
  border: 1px solid #080908;
  border-radius: 50%;
  background: #262b25;
  box-shadow: inset 0 0 2px #000;
}

.status-lamp--green,
.lamp--on {
  background: var(--green);
  box-shadow: 0 0 5px rgba(135, 184, 95, 0.65);
}

.status-lamp--red {
  background: var(--red);
  box-shadow: 0 0 5px rgba(184, 76, 57, 0.65);
}

.header-readouts time {
  align-self: center;
  padding: 0 3px 0 6px;
  color: var(--green-bright);
  font-size: 17px;
  letter-spacing: 1px;
}

.terminal-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 212px;
  gap: 6px;
  min-height: 0;
}

.video-module,
.comms-module {
  min-width: 0;
  min-height: 0;
  padding: 6px;
}

.video-module {
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(rgba(19, 23, 18, 0.92), rgba(9, 12, 9, 0.97)),
    repeating-linear-gradient(135deg, transparent 0 7px, rgba(213, 163, 60, 0.04) 8px 9px);
}

.video-module::after {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 10px;
  background: repeating-linear-gradient(135deg, #171a15 0 6px, #a77c2d 6px 10px);
  content: "";
  opacity: 0.42;
}

.module-heading,
.subtitle-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #a5aa93;
  font-size: 9px;
  letter-spacing: 0.7px;
  line-height: 1;
  text-transform: uppercase;
}

.module-heading {
  height: 16px;
  padding: 0 3px;
  border-bottom: 1px solid #30362c;
}

.module-heading span:last-child,
.subtitle-heading span:last-child {
  color: var(--green);
}

.arthur-viewport {
  position: relative;
  width: 192px;
  height: 144px;
  margin: 7px auto 0;
  overflow: hidden;
  border: 2px solid #090b09;
  outline: 1px solid #626954;
  background: #020403;
  box-shadow: inset 0 0 20px #000;
}

.arthur-viewport img {
  display: block;
  width: 96px;
  height: 72px;
  object-fit: cover;
  object-position: 50% 24%;
  transform: scale(2);
  transform-origin: top left;
  image-rendering: pixelated;
  filter: saturate(0.46) sepia(0.12) contrast(1.34) brightness(0.76);
}

.arthur-viewport.is-speaking {
  outline-color: var(--amber);
  box-shadow: 0 0 8px rgba(213, 163, 60, 0.24), inset 0 0 18px #000;
}

.arthur-viewport.is-glitching img {
  animation: signal-glitch 180ms steps(2, end) both;
}

@keyframes signal-glitch {
  0% { transform: scale(2) translate(0, 0); filter: saturate(0.2) contrast(1.8) brightness(0.9); }
  32% { transform: scale(2) translate(-1px, 1px); }
  58% { transform: scale(2) translate(1px, 0); filter: saturate(0.7) contrast(1.5) brightness(0.66); }
  100% { transform: scale(2) translate(0, 0); }
}

.video-scan,
.arthur-viewport::after {
  position: absolute;
  inset: 0;
  content: "";
  pointer-events: none;
}

.video-scan {
  z-index: 3;
  background:
    repeating-linear-gradient(
      0deg,
      rgba(0, 0, 0, 0.24) 0,
      rgba(0, 0, 0, 0.24) 1px,
      transparent 1px,
      transparent 3px
    ),
    repeating-conic-gradient(rgba(199, 211, 166, 0.055) 0 25%, transparent 0 50%) 0 0 / 2px 2px;
  mix-blend-mode: multiply;
}

.arthur-viewport::after {
  background:
    linear-gradient(90deg, rgba(112, 147, 107, 0.08), transparent 22%, transparent 78%, rgba(112, 147, 107, 0.07)),
    radial-gradient(circle at 51% 35%, transparent 0 33%, rgba(0, 0, 0, 0.21) 82%);
}

.tracking-corners {
  position: absolute;
  inset: 7px;
  border: solid rgba(183, 208, 144, 0.38);
  border-width: 1px 0 0 1px;
  width: 13px;
  height: 13px;
}

.tracking-corners::after {
  position: absolute;
  top: 113px;
  left: 158px;
  width: 13px;
  height: 13px;
  border: solid rgba(183, 208, 144, 0.38);
  border-width: 0 1px 1px 0;
  content: "";
}

.signal-label {
  position: absolute;
  right: 4px;
  bottom: 3px;
  z-index: 2;
  padding: 2px 3px;
  background: rgba(3, 7, 4, 0.75);
  color: rgba(192, 218, 148, 0.72);
  font-size: 8px;
  text-transform: uppercase;
}

.identity-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 7px 3px 0;
  padding: 5px 6px;
  border: 1px solid #30352c;
  border-left: 3px solid var(--amber);
  background: #0a0d0a;
  text-transform: uppercase;
}

.identity-strip span,
.identity-code {
  display: block;
  color: var(--muted);
  font-size: 8px;
  line-height: 1.35;
}

.identity-strip strong {
  display: block;
  margin-top: 1px;
  color: #e2dfc7;
  font-size: 15px;
  letter-spacing: 1px;
}

.identity-code {
  text-align: right;
}

.system-lamps {
  display: flex;
  gap: 11px;
  margin: 8px 5px 0;
  color: #777e6d;
  font-size: 8px;
  text-transform: uppercase;
}

.system-lamps .lamp {
  margin-right: 3px;
}

.system-lamps b {
  color: var(--green);
  font: inherit;
  font-weight: 400;
}

.audio-deck {
  display: grid;
  gap: 6px;
  margin: 12px 4px 0;
  padding: 6px;
  border: 1px solid #2e342b;
  background: #090c09;
}

.audio-buttons {
  display: grid;
  grid-template-columns: 1.25fr 1fr 0.8fr;
  gap: 3px;
}

#audio-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.audio-deck button {
  min-width: 0;
  height: 22px;
  padding: 0 4px;
  border: 1px solid #565d4e;
  border-right-color: #20241e;
  border-bottom-color: #20241e;
  border-radius: 0;
  background: #282d26;
  color: #c9cdb7;
  font-size: 8px;
  font-weight: 700;
  text-transform: uppercase;
}

.audio-deck button:hover:not(:disabled) {
  background: #41483a;
  color: #fffde2;
}

.audio-deck button:disabled {
  cursor: not-allowed;
  opacity: 0.38;
}

.audio-deck button[aria-pressed="false"] {
  color: #9b6f64;
}

.volume-control {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  align-items: center;
  gap: 5px;
  color: #737b69;
  font-size: 8px;
  text-transform: uppercase;
}

.volume-control input {
  width: 100%;
  height: 12px;
  margin: 0;
  accent-color: var(--green);
  cursor: pointer;
}

.comms-module {
  display: grid;
  grid-template-rows: 86px minmax(0, 1fr) auto;
  gap: 5px;
  background: #10140f;
}

.current-message-panel {
  padding: 6px 8px;
  overflow: hidden;
  border: 1px solid #414838;
  border-top-color: #70775e;
  background:
    linear-gradient(180deg, rgba(135, 184, 95, 0.055), transparent 35%),
    var(--screen);
  box-shadow: inset 0 0 12px rgba(0, 0, 0, 0.78);
}

.subtitle-heading {
  padding-bottom: 5px;
  border-bottom: 1px solid #223023;
}

#subtitle-text {
  display: -webkit-box;
  margin: 8px 0 0;
  overflow: hidden;
  color: var(--green-bright);
  font-family: var(--terminal-font);
  font-size: 14px;
  letter-spacing: 0.15px;
  line-height: 1.35;
  text-shadow: 0 0 4px rgba(135, 184, 95, 0.25);
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.player-endpoint {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 162px;
  gap: 6px;
  min-height: 0;
  padding: 5px;
  overflow: hidden;
  border: 1px solid #30362c;
  background: #090c09;
}

.player-copy {
  display: grid;
  grid-template-rows: 16px minmax(0, 1fr);
  min-height: 0;
}

.player-copy .module-heading {
  padding: 0 2px 4px;
}

.player-copy .module-heading b {
  font: inherit;
}

.player-message {
  margin: 6px 0 0;
  padding: 9px;
  overflow: hidden;
  border: 1px solid #29332f;
  background:
    linear-gradient(180deg, rgba(90, 133, 126, 0.045), transparent 45%),
    #080d0b;
  color: #a9beb6;
  font-size: 13px;
  line-height: 1.35;
  text-wrap: pretty;
}

/* Phase 16: compact intercom beside the exterior gate feed */

.intercom-module,
.gate-module {
  min-width: 0;
  min-height: 0;
  padding: 6px;
}

.intercom-module {
  display: grid;
  grid-template-columns: 152px minmax(0, 1fr);
  grid-template-rows: 16px minmax(0, 1fr) 46px 42px 48px;
  gap: 4px;
  overflow: hidden;
  background:
    linear-gradient(rgba(19, 23, 18, 0.94), rgba(8, 11, 8, 0.98)),
    repeating-linear-gradient(135deg, transparent 0 7px, rgba(213, 163, 60, 0.035) 8px 9px);
}

.intercom-feeds {
  grid-column: 1;
  grid-row: 2;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  min-height: 0;
}

.intercom-module .module-heading,
.intercom-module .player-endpoint,
.intercom-module .player-form,
.intercom-module .intercom-controls {
  grid-column: 1 / -1;
}

.intercom-module .current-message-panel {
  grid-column: 2;
  grid-row: 2;
}

.channel-card {
  display: grid;
  grid-template-rows: minmax(0, 1fr) 20px;
  gap: 3px;
  min-width: 0;
  min-height: 0;
}

.intercom-module .arthur-viewport {
  width: 100%;
  height: 100%;
  margin: 0;
}

.intercom-module .arthur-viewport img {
  width: 62%;
  height: 62%;
  object-position: 50% 24%;
  transform: scale(1.61);
}

.intercom-module .tracking-corners {
  inset: 7px;
  width: 13px;
  height: 13px;
}

.intercom-module .tracking-corners::after {
  display: none;
}

.channel-id {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  padding: 2px 4px;
  border-left: 2px solid var(--amber);
  background: #080b08;
  color: var(--muted);
  font-size: 7px;
  line-height: 1;
  text-transform: uppercase;
}

.channel-id strong {
  overflow: hidden;
  color: #e2dfc7;
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.5px;
  text-overflow: ellipsis;
}

.intercom-module .current-message-panel {
  padding: 6px 7px;
}

.intercom-module #subtitle-text {
  margin-top: 5px;
  font-size: 12px;
  line-height: 1.2;
  -webkit-line-clamp: 3;
}

.intercom-module .player-endpoint {
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: 14px minmax(0, 1fr);
  gap: 2px;
  padding: 3px;
}

.intercom-module .player-endpoint .module-heading {
  height: 14px;
  padding: 0 2px;
}

.intercom-module .player-message {
  margin: 0;
  padding: 4px 5px;
  font-size: 10px;
  line-height: 1.15;
}

.intercom-module .player-form input {
  height: 27px;
}

.intercom-module .player-form button {
  width: 54px;
}

.intercom-module .input-hint {
  margin-top: 2px;
  font-size: 9px;
}

.intercom-controls {
  display: block;
  min-height: 0;
}

.intercom-module .audio-deck {
  grid-template-columns: minmax(0, 1fr) 83px;
  align-items: center;
  gap: 4px;
  margin: 0;
  padding: 4px;
}

.intercom-module .audio-deck button {
  height: 22px;
  font-size: 7px;
}

.intercom-module #audio-toggle {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.intercom-module #audio-toggle b {
  color: var(--green-bright);
  font-size: 6px;
  font-weight: 400;
}

.intercom-module .volume-control {
  grid-template-columns: 17px minmax(0, 1fr);
  gap: 3px;
  font-size: 7px;
}

.gate-module {
  position: relative;
  display: grid;
  grid-template-rows: 16px minmax(0, 1fr) 27px;
  gap: 5px;
  overflow: hidden;
  background: #0a0d0a;
}

.gate-viewport {
  position: relative;
  min-height: 0;
  overflow: hidden;
  border: 2px solid #090b09;
  outline: 1px solid #5e6453;
  background: #020403;
  box-shadow: inset 0 0 18px #000;
}

.gate-viewport img {
  display: block;
  width: 100%;
  height: 100%;
  /* The portrait plate matches this viewport; keep both gate leaves in view. */
  object-fit: contain;
  object-position: center;
  image-rendering: pixelated;
  /* The plate is a genuine night exposure: mean luma 27/255, only 2% of pixels
     above 60. At this monitor size it needs the gain a low-light CCTV camera
     would actually be running, not a tasteful grade. */
  filter: saturate(0.6) contrast(1.32) brightness(1.85);
}

.gate-scan {
  position: absolute;
  inset: 0;
  z-index: 2;
  background:
    repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.2) 0 1px, transparent 1px 3px),
    radial-gradient(ellipse at center, transparent 52%, rgba(0, 0, 0, 0.32));
  pointer-events: none;
}

.gate-camera-label {
  position: absolute;
  right: 5px;
  bottom: 4px;
  z-index: 3;
  padding: 2px 4px;
  background: rgba(3, 6, 4, 0.78);
  color: rgba(207, 188, 126, 0.82);
  font-size: 8px;
  letter-spacing: 0.4px;
}

.gate-module.is-opening {
  outline: 1px solid rgba(213, 163, 60, 0.7);
  box-shadow: inset 0 0 16px rgba(213, 163, 60, 0.08);
}

.gate-module.is-open .module-heading span:last-child,
.gate-module.is-open #gate-barrier-state {
  color: var(--green-bright);
  text-shadow: 0 0 4px rgba(135, 184, 95, 0.4);
}

.gate-status-strip {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 4px 7px;
  border-left: 3px solid var(--amber);
  background: #10140f;
  color: #7b8270;
  font-size: 8px;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

.gate-status-strip span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gate-status-strip strong {
  color: #c4c8b3;
  font-weight: 400;
}

.gate-module .outcome {
  top: 32px;
  right: 14px;
  bottom: 42px;
  left: 14px;
  width: auto;
  padding: 6px 8px;
  background: rgba(5, 12, 7, 0.9);
}

.gate-module .outcome {
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 7px;
  padding: 16px 14px;
}

/* display: grid outranks the hidden attribute, which left an empty 90%-black
   ending card over the camera for the whole encounter. */
.outcome[hidden] {
  display: none;
}

.gate-module .outcome-title {
  font-size: 19px;
  line-height: 1.05;
}

.gate-module .outcome-code {
  margin-top: 2px;
  padding: 1px 4px;
  font-size: 9px;
}

.gate-module .outcome p {
  margin: 0;
  font-size: 9px;
  line-height: 1.35;
}

/* The one line telling a player how to play again was hidden here and unreadable
   in its backup location, so the encounter ended with no way forward. */
.gate-module .outcome small {
  display: block;
  margin-top: 2px;
  padding-top: 7px;
  border-top: 1px solid currentColor;
  color: currentColor;
  font-size: 9px;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  opacity: 0.92;
}

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

.player-form {
  min-width: 0;
}

.player-form label {
  display: block;
  margin: 0 0 3px 2px;
  color: #8f967f;
  font-size: 8px;
  letter-spacing: 0.6px;
  text-transform: uppercase;
}

.input-row {
  display: flex;
  min-width: 0;
  gap: 4px;
}

.player-form input {
  min-width: 0;
  height: 27px;
  flex: 1;
  padding: 5px 7px;
  border: 1px solid #4b5344;
  border-right-color: #272c25;
  border-bottom-color: #272c25;
  border-radius: 0;
  outline: 0;
  background: #050805;
  color: var(--green-bright);
  font-size: 12px;
  caret-color: var(--amber);
}

.player-form input::placeholder {
  color: #4f574a;
}

.player-form button,
.hardware-controls button,
.debug-header button {
  border: 1px solid #686f5d;
  border-right-color: #20241e;
  border-bottom-color: #20241e;
  border-radius: 0;
  background: #32372e;
  color: #d0d2bd;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  box-shadow: inset 1px 1px rgba(255, 255, 255, 0.04);
}

.player-form button {
  display: flex;
  width: 62px;
  align-items: center;
  justify-content: space-between;
  padding: 0 7px;
}

.player-form button:hover:not(:disabled),
.hardware-controls button:hover,
.debug-header button:hover {
  background: #444a3d;
  color: #fffde2;
}

.player-form input:disabled,
.player-form button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.input-hint {
  margin: 3px 0 0 2px;
  color: var(--amber);
  font-size: 8px;
  letter-spacing: 0.4px;
}

.input-hint[data-tone="warn"] {
  color: #e2705a;
}

.outcome {
  position: absolute;
  z-index: 8;
  top: 109px;
  right: 15px;
  width: 390px;
  padding: 16px;
  border: 2px solid currentColor;
  background: rgba(5, 12, 7, 0.97);
  color: var(--green-bright);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1px;
  line-height: 1.5;
  text-align: center;
  text-transform: uppercase;
  box-shadow: 0 8px 28px #000, inset 0 0 34px rgba(0, 0, 0, 0.75);
  animation: outcome-stamp 220ms steps(3, end);
}

@keyframes outcome-stamp {
  from { opacity: 0; transform: scale(1.06); }
}

.outcome-title,
.outcome-code,
.outcome small {
  display: block;
}

.outcome-title {
  font-size: 21px;
  letter-spacing: 1.5px;
  text-shadow: 0 0 12px currentColor;
}

.outcome-code {
  margin-top: 3px;
  padding: 3px 5px;
  border: 1px solid currentColor;
  font-size: 11px;
}

.outcome p {
  margin: 12px 0;
  color: var(--text);
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0.4px;
  text-transform: none;
}

.outcome small {
  color: var(--muted);
  font-size: 9px;
  font-weight: 400;
}

.outcome--refused {
  border-width: 2px 2px 2px 6px;
  background:
    repeating-linear-gradient(135deg, rgba(225, 183, 91, 0.07) 0 7px, transparent 7px 14px),
    rgba(17, 13, 4, 0.97);
  color: #e1b75b;
}

.outcome--expelled {
  border-width: 3px;
  background:
    repeating-linear-gradient(45deg, rgba(229, 139, 116, 0.09) 0 6px, transparent 6px 12px),
    rgba(22, 8, 5, 0.97);
  color: #e58b74;
  animation: outcome-stamp 220ms steps(3, end), outcome-warning 180ms steps(2, end) 2 220ms;
}

.outcome--entry-granted {
  border-style: double;
  border-width: 4px;
  background: rgba(5, 14, 7, 0.97);
  color: #9fd66d;
}

.outcome--locked-out {
  border-style: double;
  border-width: 4px;
  background:
    repeating-linear-gradient(135deg, rgba(184, 76, 57, 0.08) 0 7px, transparent 7px 14px),
    rgba(20, 5, 5, 0.98);
  color: #f06a53;
}

@keyframes outcome-warning {
  50% { filter: brightness(1.6); }
}

.terminal-controls {
  display: block;
  align-items: center;
  padding: 3px 7px;
}

.provider-control {
  display: grid;
  grid-template-columns: 105px minmax(0, 1fr);
  align-items: center;
  gap: 5px;
  min-width: 0;
}

.provider-control label {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 8px;
  text-transform: uppercase;
}

.provider-control select {
  min-width: 0;
  height: 22px;
  padding: 2px 4px;
  border: 1px solid #4f5648;
  border-radius: 0;
  background: #0b0f0b;
  color: var(--text);
  font-size: 9px;
}

#provider-note {
  overflow: hidden;
  color: #62695a;
  font-size: 8px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.provider-status {
  position: absolute;
  right: 8px;
  bottom: 39px;
  left: 8px;
  z-index: 10;
  margin: 0;
  padding: 6px 8px;
  border: 1px solid var(--red);
  background: #1b0d0a;
  color: #dfa192;
  font-size: 9px;
}

.hardware-controls {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  width: 100%;
  gap: 4px;
}

.hardware-controls button {
  height: 23px;
  padding: 0 7px;
}

.hardware-controls kbd {
  margin-left: 3px;
  color: var(--amber);
  font: inherit;
}

.reset-button {
  color: #e2bb6a !important;
}

body.effects-off .video-scan,
body.effects-off .gate-scan,
body.effects-off .terminal-stage::after,
body.effects-off::before {
  display: none;
}

/* Developer drawer */

.debug-dialog,
.credits-dialog {
  width: min(760px, calc(100vw - 28px));
  max-width: none;
  max-height: min(760px, calc(100vh - 28px));
  padding: 0;
  overflow: hidden;
  border: 1px solid #6b725f;
  border-radius: 0;
  background: #10140f;
  color: var(--text);
  box-shadow: 0 24px 100px #000;
}

.debug-dialog::backdrop,
.credits-dialog::backdrop {
  background: rgba(0, 0, 0, 0.82);
  backdrop-filter: blur(2px);
}

.debug-panel,
.credits-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  max-height: min(760px, calc(100vh - 28px));
}

.credits-dialog {
  width: min(560px, calc(100vw - 28px));
}

.credits-scroll {
  overflow: auto;
  padding: 18px;
  background:
    repeating-linear-gradient(0deg, transparent 0 2px, rgba(0, 0, 0, 0.2) 2px 3px),
    #090d09;
}

.credits-lede {
  margin: 0 0 16px;
  color: var(--green-bright);
  font-size: 18px;
}

.credits-list {
  display: grid;
  gap: 1px;
  margin: 0;
  border: 1px solid #32382f;
  background: #32382f;
}

.credits-list div {
  display: grid;
  grid-template-columns: 155px minmax(0, 1fr);
  gap: 14px;
  padding: 9px 10px;
  background: #0d120d;
}

.credits-list dt {
  color: var(--amber);
  text-transform: uppercase;
}

.credits-list dd {
  margin: 0;
  color: #adb59e;
}

.credits-note {
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.debug-header,
.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.debug-header {
  padding: 14px 16px;
  border-bottom: 1px solid #3c4237;
  background: #22271f;
}

.debug-header h2,
.debug-header p {
  margin: 0;
}

.debug-header h2 {
  margin-top: 3px;
  font-size: 19px;
  text-transform: uppercase;
}

.debug-header button {
  padding: 8px 12px;
}

.debug-header-actions {
  display: flex;
  align-items: center;
  gap: 7px;
}

#debug-log-status {
  min-width: 48px;
  color: var(--muted);
  font-size: 9px;
  text-align: right;
  text-transform: uppercase;
}

#debug-export {
  color: var(--green-bright);
}

.debug-scroll {
  display: grid;
  grid-template-columns: 1fr 1fr;
  overflow: auto;
}

.debug-section {
  min-width: 0;
  padding: 15px 16px;
  border-right: 1px solid #2c3129;
  border-bottom: 1px solid #2c3129;
}

.debug-section h3 {
  margin: 0 0 12px;
  color: #babfa9;
  font-size: 12px;
  letter-spacing: 0.8px;
  text-transform: uppercase;
}

.system-settings .section-heading {
  margin-bottom: 12px;
}

.system-settings .section-heading button {
  padding: 5px 9px;
  border: 1px solid #686f5d;
  border-right-color: #20241e;
  border-bottom-color: #20241e;
  border-radius: 0;
  background: #32372e;
  color: #d0d2bd;
  font: inherit;
  font-size: 9px;
  text-transform: uppercase;
}

.section-heading h3 {
  margin: 0;
}

.section-heading > span {
  color: var(--muted);
  font-size: 10px;
}

.state-values {
  display: grid;
  gap: 8px;
  margin-top: 13px;
}

.state-row {
  display: grid;
  grid-template-columns: 65px minmax(0, 1fr) 24px;
  align-items: center;
  gap: 8px;
}

.state-label,
.state-number {
  color: var(--muted);
  font-size: 10px;
  text-transform: capitalize;
}

.state-number {
  color: var(--text);
  text-align: right;
}

.state-track {
  height: 5px;
  background: #292f27;
}

.state-fill {
  height: 100%;
  background: var(--green);
}

.state-row[data-state="suspicion"] .state-fill,
.state-row[data-state="irritation"] .state-fill {
  background: var(--amber);
}

.state-row[data-state="fear"] .state-fill {
  background: var(--red);
}

.decision-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 0;
}

.decision-grid dt,
.reason-block span {
  color: #8b9280;
  font-size: 9px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.decision-grid dd {
  margin: 2px 0 0;
  overflow-wrap: anywhere;
  color: #c5c9b4;
  font-size: 11px;
}

.code-value {
  color: var(--green-bright) !important;
}

.reason-block,
.fallback-notice {
  margin-top: 12px;
  padding: 9px;
  border-left: 2px solid var(--green);
  background: #0a0e0a;
}

.reason-block span {
  display: block;
}

.reason-block p,
.fallback-notice {
  margin-bottom: 0;
  color: #a5aa98;
  font-size: 10px;
  line-height: 1.5;
}

.fallback-notice {
  border-color: var(--red);
  color: #d39487;
}

.memory-list {
  display: grid;
  gap: 8px;
  margin: 13px 0 0;
  padding: 0;
  list-style: none;
}

.memory-list li {
  padding-left: 10px;
  border-left: 2px solid var(--amber);
  color: #aeb39f;
  font-size: 10px;
}

.memory-list li > span,
.memory-list li > small {
  display: block;
}

.memory-list li > small {
  margin-top: 2px;
  color: #676e5e;
  font-size: 9px;
  text-transform: uppercase;
}

.empty-memory {
  border-left-color: #343931 !important;
  color: #686f60 !important;
  font-style: italic;
}

.inspection-section {
  grid-column: 1 / -1;
}

details + details {
  border-top: 1px solid #2d322a;
}

summary {
  padding: 10px 0;
  color: #aeb39f;
  font-size: 10px;
  text-transform: uppercase;
}

pre {
  max-height: 250px;
  margin: 0 0 10px;
  padding: 10px;
  overflow: auto;
  background: #050805;
  color: #91a478;
  font: 10px/1.5 var(--terminal-font);
  white-space: pre-wrap;
  word-break: break-word;
}

@media (max-width: 560px) {
  .debug-scroll {
    grid-template-columns: 1fr;
  }

  .inspection-section {
    grid-column: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
