:root {
  --crt-green: #33ff66;
  --crt-dim: #1a8f3c;
  --crt-amber: #ffb000;
  --crt-cyan: #00e5ff;
  --bg: #020406;
  --panel: rgba(0, 12, 8, 0.88);
  --border: #1a8f3c;
  --font: "Courier New", Courier, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  font-family: var(--font);
  color: var(--crt-green);
}

#game-canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: crosshair;
}

.hidden { display: none !important; }

/* Looking into a laser: FOV fills with bloom + red wash (not a thin world-space line) */
#laser-glare {
  position: fixed;
  inset: 0;
  z-index: 18;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.04s linear;
  background:
    radial-gradient(
      ellipse at 50% 45%,
      rgba(255, 255, 255, 0.85) 0%,
      rgba(255, 80, 80, 0.75) 22%,
      rgba(220, 0, 0, 0.7) 55%,
      rgba(80, 0, 0, 0.55) 100%
    );
  mix-blend-mode: normal;
}
#laser-glare.on {
  /* opacity set inline 0–1 from boss.laserGlare */
}

/* CRT scanline overlay */
/* Full-viewport cockpit frame — transparent center, drawn HUD on top */
#cockpit-overlay {
  pointer-events: none;
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: fill;
  z-index: 14;
  opacity: 0.92;
  image-rendering: auto;
}

#scanlines {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 50;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0,
    transparent 2px,
    rgba(0, 0, 0, 0.12) 2px,
    rgba(0, 0, 0, 0.12) 4px
  );
  mix-blend-mode: multiply;
}

#ui-layer {
  position: fixed;
  inset: 0;
  z-index: 20;
  pointer-events: none;
}

#ui-layer .screen {
  pointer-events: auto;
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at center, rgba(0, 30, 20, 0.92), rgba(0, 0, 0, 0.95));
  padding: 2rem;
  text-align: center;
}

/* Title grows with pilot panel + dual boards — allow scroll */
#screen-title {
  justify-content: flex-start;
  overflow-y: auto;
  padding-top: 1.5rem;
  padding-bottom: 2rem;
}

/* Pre-mission cutscene — full black, letterboxed video */
#screen-cut {
  background: #000;
  padding: 0;
  z-index: 25;
  cursor: pointer;
}

#cut-video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
  pointer-events: none;
}

#cut-chrome {
  position: absolute;
  bottom: 1.25rem;
  left: 0;
  right: 0;
  text-align: center;
  pointer-events: none;
}

#cut-hint {
  margin: 0;
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  color: rgba(51, 255, 102, 0.75);
  text-shadow: 0 0 8px rgba(0, 0, 0, 0.9);
}

.screen h1 {
  font-size: clamp(1.8rem, 5vw, 3.2rem);
  letter-spacing: 0.15em;
  margin: 0 0 0.5rem;
  text-shadow: 0 0 12px var(--crt-green);
  color: var(--crt-green);
}

.screen h2 {
  font-size: 1rem;
  font-weight: normal;
  color: var(--crt-cyan);
  letter-spacing: 0.2em;
  margin: 0 0 1.5rem;
}

.screen .ver {
  color: var(--crt-dim);
  font-size: 0.75rem;
  margin-bottom: 2rem;
}

.btn {
  pointer-events: auto;
  font-family: var(--font);
  background: transparent;
  color: var(--crt-green);
  border: 1px solid var(--crt-green);
  padding: 0.7rem 1.6rem;
  margin: 0.4rem;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  box-shadow: 0 0 8px rgba(51, 255, 102, 0.25);
  transition: background 0.15s, color 0.15s;
}

.btn:hover, .btn:focus {
  background: var(--crt-green);
  color: #000;
  outline: none;
}

.btn-amber {
  border-color: var(--crt-amber);
  color: var(--crt-amber);
  box-shadow: 0 0 8px rgba(255, 176, 0, 0.25);
}
.btn-amber:hover {
  background: var(--crt-amber);
  color: #000;
}

.btn-danger {
  border-color: #ff3344;
  color: #ff6677;
  box-shadow: 0 0 12px rgba(255, 50, 60, 0.35);
  margin-top: 0.5rem;
}
.btn-danger:hover {
  background: #ff3344;
  color: #000;
}

/* —— Gate (pre-title warning) —— */
.gate-panel {
  max-width: 28rem;
  border: 1px solid #662222;
  background: rgba(12, 4, 4, 0.92);
  padding: 2rem 1.75rem;
  box-shadow: 0 0 40px rgba(255, 40, 40, 0.15), inset 0 0 40px rgba(0, 0, 0, 0.5);
}

.gate-badge {
  display: inline-block;
  border: 1px solid #ff3344;
  color: #ff6677;
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  padding: 0.35rem 0.75rem;
  margin-bottom: 1.25rem;
  animation: gate-pulse 1.6s ease-in-out infinite;
}

@keyframes gate-pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 6px rgba(255, 50, 60, 0.3); }
  50% { opacity: 0.75; box-shadow: 0 0 14px rgba(255, 50, 60, 0.55); }
}

.gate-line {
  margin: 0.2rem 0;
  font-size: 0.85rem;
  color: #aa6666;
  letter-spacing: 0.06em;
}

.gate-line-strong {
  color: #ff8899;
  font-size: 0.95rem;
  letter-spacing: 0.08em;
}

.gate-divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, #662222, transparent);
  margin: 1.25rem 0;
}

.gate-body {
  font-size: 0.8rem;
  line-height: 1.55;
  color: #886666;
  margin: 0 0 1.25rem;
}

.gate-risk {
  color: #ff3344;
  font-size: 1.05rem;
  letter-spacing: 0.25em;
  margin: 0 0 1.5rem;
  text-shadow: 0 0 10px rgba(255, 40, 40, 0.5);
}

.gate-hint {
  margin: 1rem 0 0;
  font-size: 0.65rem;
  color: #553333;
  letter-spacing: 0.08em;
}

.title-blurb {
  max-width: 28rem;
  font-size: 0.85rem;
  color: #1a8f3c;
  margin-bottom: 1.5rem;
}

.pilot-panel {
  width: min(20rem, 92vw);
  margin: 0 auto 0.75rem;
  text-align: center;
}

.pilot-mode-row {
  display: flex;
  gap: 0.4rem;
  justify-content: center;
  margin-bottom: 0.75rem;
}

.pilot-mode-btn {
  font-family: var(--font);
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  padding: 0.4rem 0.65rem;
  color: var(--crt-dim);
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid rgba(26, 143, 60, 0.4);
  cursor: pointer;
}

.pilot-mode-btn.active {
  color: var(--crt-green);
  border-color: var(--crt-green);
  box-shadow: 0 0 10px rgba(51, 255, 102, 0.25);
}

.pilot-mode-btn:hover {
  border-color: var(--crt-amber);
  color: var(--crt-amber);
}

.pilot-label {
  display: block;
  font-size: 0.7rem;
  letter-spacing: 0.16em;
  color: var(--crt-amber);
  margin-bottom: 0.35rem;
}

.pilot-input {
  font-family: var(--font);
  font-size: 1.1rem;
  letter-spacing: 0.2em;
  text-align: center;
  text-transform: uppercase;
  color: var(--crt-green);
  background: rgba(0, 0, 0, 0.65);
  border: 1px solid var(--crt-dim);
  padding: 0.55rem 0.75rem;
  width: min(14rem, 80vw);
  margin-bottom: 0.65rem;
  outline: none;
  box-shadow: 0 0 10px rgba(51, 255, 102, 0.15);
}

.pilot-input.pilot-pin {
  letter-spacing: 0.35em;
  text-transform: none;
}

.pilot-input:focus {
  border-color: var(--crt-green);
  box-shadow: 0 0 14px rgba(51, 255, 102, 0.35);
}

.pilot-auth-msg {
  min-height: 1.2em;
  margin: 0.15rem 0 0.35rem;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  color: var(--crt-amber);
}

.pilot-auth-msg.is-error {
  color: #ff6680;
}

.pilot-auth-msg.is-ok {
  color: var(--crt-green);
}

.pilot-hint {
  margin: 0 0 0.5rem;
  font-size: 0.62rem;
  line-height: 1.4;
  color: #3a5a44;
  letter-spacing: 0.04em;
  max-width: 22rem;
  margin-left: auto;
  margin-right: auto;
}

.hiscore-box {
  margin-top: 1.25rem;
  max-width: 22rem;
  width: 100%;
  text-align: left;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  color: var(--crt-dim);
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(26, 143, 60, 0.45);
  padding: 0.65rem 0.85rem;
  min-height: 3rem;
}

.hiscore-box-wide {
  max-width: min(28rem, 94vw);
}

.hiscore-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin: 0 0 0.4rem;
}

.hiscore-head h3 {
  margin: 0;
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  color: var(--crt-amber);
  font-weight: normal;
}

.hiscore-box h3 {
  margin: 0 0 0.4rem;
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  color: var(--crt-amber);
  font-weight: normal;
}

.hiscore-info-btn {
  flex-shrink: 0;
  width: 1.35rem;
  height: 1.35rem;
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--crt-amber);
  background: rgba(0, 0, 0, 0.55);
  color: var(--crt-amber);
  font-family: var(--font);
  font-size: 0.75rem;
  font-weight: bold;
  font-style: italic;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 0 8px rgba(255, 176, 0, 0.25);
}

.hiscore-info-btn:hover,
.hiscore-info-btn:focus {
  color: var(--crt-green);
  border-color: var(--crt-green);
  box-shadow: 0 0 10px rgba(51, 255, 102, 0.35);
  outline: none;
}

/* Scoring help — Sky Fab Statistics & Records “document” */
.score-help-overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 1.25rem 1rem 2rem;
  overflow-y: auto;
  background:
    radial-gradient(ellipse at center, rgba(0, 40, 28, 0.35), rgba(0, 0, 0, 0.82));
  pointer-events: auto;
}

.score-help-overlay.hidden {
  display: none !important;
}

.score-help-panel {
  position: relative;
  width: min(28rem, 94vw);
  max-height: min(85vh, 40rem);
  overflow-y: auto;
  overflow-x: hidden;
  text-align: left;
  outline: none;
  /* Paper / form stock with faint ruling */
  color: #1a2e24;
  border: 2px solid #1a5c3a;
  box-shadow:
    0 0 0 1px rgba(0, 229, 255, 0.25),
    0 12px 40px rgba(0, 0, 0, 0.55),
    inset 0 0 0 1px rgba(255, 255, 255, 0.4);
  padding: 0;
  background-color: #e8f0e4;
  background-image:
    linear-gradient(180deg, rgba(255, 252, 240, 0.92) 0%, rgba(232, 240, 228, 0.5) 100%),
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 14px,
      rgba(26, 92, 58, 0.045) 14px,
      rgba(26, 92, 58, 0.045) 15px
    );
}

.score-help-doc-head {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  padding: 1rem 2.4rem 0.75rem 1rem;
  background: linear-gradient(90deg, #0a2818 0%, #143d28 55%, #0d3020 100%);
  color: #b8e0c8;
  border-bottom: 3px double #33ff66;
}

.score-help-seal {
  flex-shrink: 0;
  width: 2.6rem;
  height: 2.6rem;
  border-radius: 50%;
  border: 2px solid #ffb000;
  color: #ffb000;
  font-size: 0.72rem;
  font-weight: bold;
  letter-spacing: 0.06em;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 10px rgba(255, 176, 0, 0.35);
  background: radial-gradient(circle at 35% 30%, #1a4a30, #06140c);
}

.score-help-doc-meta {
  min-width: 0;
  flex: 1;
}

.score-help-org {
  margin: 0;
  font-size: 0.58rem;
  letter-spacing: 0.2em;
  color: #7ab88a;
  text-transform: uppercase;
}

.score-help-dept {
  margin: 0.15rem 0 0.35rem;
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  color: #00e5ff;
  text-transform: uppercase;
}

.score-help-panel h3,
#score-help-title {
  margin: 0;
  font-size: 0.95rem;
  letter-spacing: 0.14em;
  color: #ffb000;
  font-weight: normal;
  text-shadow: 0 0 8px rgba(255, 176, 0, 0.25);
}

.score-help-doc-id {
  margin: 0.35rem 0 0;
  font-size: 0.58rem;
  letter-spacing: 0.08em;
  color: #5a8a6a;
  font-family: ui-monospace, Consolas, monospace;
}

.score-help-rule {
  height: 0;
  border: none;
  border-top: 1px dashed #1a5c3a;
  margin: 0;
  opacity: 0.5;
}

.score-help-close {
  position: absolute;
  top: 0.55rem;
  right: 0.55rem;
  z-index: 2;
  width: 1.6rem;
  height: 1.6rem;
  padding: 0;
  border: 1px solid #5a8a6a;
  background: rgba(0, 0, 0, 0.35);
  color: #33ff66;
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  font-family: var(--font);
}

.score-help-close:hover {
  border-color: #ffb000;
  color: #ffb000;
}

.score-help-body {
  font-size: 0.72rem;
  line-height: 1.5;
  letter-spacing: 0.03em;
  padding: 0.85rem 1rem 0.25rem;
  color: #1a3328;
}

.score-help-lede {
  margin: 0 0 0.75rem;
  padding: 0.55rem 0.65rem;
  border-left: 3px solid #1a8f3c;
  background: rgba(26, 143, 60, 0.08);
  color: #243d30;
  font-size: 0.7rem;
}

.score-help-section {
  margin: 0 0 0.85rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid rgba(26, 92, 58, 0.2);
}

.score-help-section:last-of-type {
  border-bottom: none;
}

.score-help-body h4 {
  margin: 0 0 0.35rem;
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  color: #0d4a28;
  font-weight: normal;
  text-transform: uppercase;
}

.score-help-body .sh-sec {
  color: #c07800;
  margin-right: 0.35rem;
  font-family: ui-monospace, Consolas, monospace;
  font-size: 0.62rem;
}

.score-help-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 0.35rem;
  font-variant-numeric: tabular-nums;
  background: rgba(255, 255, 255, 0.35);
  border: 1px solid rgba(26, 92, 58, 0.25);
}

.score-help-body th,
.score-help-body td {
  padding: 0.22rem 0.35rem;
  border-bottom: 1px solid rgba(26, 92, 58, 0.12);
  text-align: left;
}

.score-help-body th {
  color: #3a5a44;
  font-weight: normal;
  font-size: 0.58rem;
  letter-spacing: 0.1em;
  background: rgba(26, 92, 58, 0.1);
  text-transform: uppercase;
}

.score-help-body td.sh-code {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 0.65rem;
  color: #0a5c8a;
  letter-spacing: 0.06em;
  width: 2.6rem;
}

.score-help-body td:last-child,
.score-help-body th:last-child {
  text-align: right;
  color: #0d5c30;
  font-weight: 600;
  font-family: ui-monospace, Consolas, monospace;
}

.score-help-body .score-help-note {
  color: #4a6a55;
  font-size: 0.64rem;
  margin: 0.35rem 0 0;
  line-height: 1.45;
}

.score-help-policy {
  margin: 0;
  padding-left: 1.1rem;
  color: #243d30;
}

.score-help-policy li {
  margin: 0.3rem 0;
}

.score-help-doc-foot {
  padding: 0.5rem 1rem 1rem;
  text-align: center;
  background: linear-gradient(180deg, transparent, rgba(26, 92, 58, 0.08));
  border-top: 1px dashed rgba(26, 92, 58, 0.35);
}

.score-help-stamp {
  margin: 0 0 0.65rem;
  font-size: 0.58rem;
  letter-spacing: 0.18em;
  color: #5a8a6a;
  text-transform: uppercase;
}

.score-help-ok {
  display: inline-block;
  margin: 0 auto;
  min-width: 10rem;
}

.hiscore-box h4 {
  margin: 0.65rem 0 0.3rem;
  font-size: 0.65rem;
  letter-spacing: 0.12em;
  color: #7ab88a;
  font-weight: normal;
}

/* Rank numbers are in the row text — never use browser list markers (avoids "1. 1.") */
.hiscore-box ol,
.hiscore-box ol.hiscore-list,
.rank-board.hiscore-list {
  margin: 0;
  padding-left: 0;
  list-style: none;
}

.hiscore-box li {
  margin: 0.15rem 0;
  color: var(--crt-green);
  white-space: pre;
  font-variant-numeric: tabular-nums;
}

.hiscore-box li.is-you {
  color: var(--crt-amber);
}

.hiscore-box .hs-sub {
  font-size: 0.58rem;
  letter-spacing: 0.06em;
  color: #3a5a44;
  font-weight: normal;
}

.hiscore-box .hs-mis {
  color: #7ab88a;
}

.hiscore-box .empty {
  color: #3a5a44;
  font-style: italic;
}

.hiscore-mission-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0.35rem 0 0.25rem;
}

.hiscore-mission-row label {
  font-size: 0.62rem;
  letter-spacing: 0.1em;
  color: var(--crt-dim);
}

.hiscore-mission-row select {
  font-family: var(--font);
  font-size: 0.7rem;
  color: var(--crt-green);
  background: rgba(0, 0, 0, 0.7);
  border: 1px solid var(--crt-dim);
  padding: 0.2rem 0.4rem;
}

.rank-strip {
  white-space: pre-wrap;
  text-align: left;
  font-size: 0.78rem;
  line-height: 1.5;
  letter-spacing: 0.06em;
  color: var(--crt-green);
  background: rgba(0, 20, 10, 0.45);
  border: 1px solid rgba(51, 255, 102, 0.35);
  padding: 0.65rem 0.85rem;
  margin: 0.5rem 0 0.65rem;
}

.rank-strip.is-offline {
  color: var(--crt-amber);
  border-color: rgba(255, 176, 0, 0.35);
}

.rank-board {
  margin-top: 0.45rem;
  font-size: 0.7rem;
  color: var(--crt-dim);
  list-style: none;
  padding-left: 0;
}

.rank-board li {
  white-space: pre;
  font-variant-numeric: tabular-nums;
  color: var(--crt-green);
}

.rank-board li.is-you {
  color: var(--crt-amber);
}

.debrief-score {
  white-space: pre-wrap;
  text-align: left;
  font-size: 0.8rem;
  line-height: 1.55;
  color: var(--crt-amber);
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 176, 0, 0.35);
  padding: 0.75rem 1rem;
  margin: 0.75rem 0 0.5rem;
}

/* —— Hangar bay doors —— */
#hangar-doors {
  position: fixed;
  inset: 0;
  z-index: 40;
  pointer-events: none;
  overflow: hidden;
}

#hangar-doors.hidden {
  display: none !important;
}

.hangar-door {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 52%;
  background:
    linear-gradient(90deg, rgba(0,0,0,0.35) 0%, transparent 8%, transparent 92%, rgba(0,0,0,0.35) 100%),
    linear-gradient(180deg, #1a222c 0%, #0d1218 40%, #151c26 100%);
  border: 2px solid #2a3544;
  box-shadow: inset 0 0 60px rgba(0, 0, 0, 0.7);
  transition: transform 1.35s cubic-bezier(0.45, 0.05, 0.2, 1);
}

.hangar-door-left {
  left: 0;
  border-right: 3px solid #ffb000;
  transform: translateX(0);
}

.hangar-door-right {
  right: 0;
  border-left: 3px solid #ffb000;
  transform: translateX(0);
}

#hangar-doors.opening .hangar-door-left {
  transform: translateX(-102%);
}

#hangar-doors.opening .hangar-door-right {
  transform: translateX(102%);
}

.door-ribs {
  position: absolute;
  inset: 8% 12%;
  background: repeating-linear-gradient(
    90deg,
    transparent 0,
    transparent 18px,
    rgba(0, 229, 255, 0.06) 18px,
    rgba(0, 229, 255, 0.06) 20px
  );
  border: 1px solid rgba(0, 229, 255, 0.12);
}

.door-warning-stripe {
  position: absolute;
  left: 0;
  right: 0;
  top: 42%;
  height: 16%;
  background: repeating-linear-gradient(
    -45deg,
    #ffb000,
    #ffb000 14px,
    #111 14px,
    #111 28px
  );
  opacity: 0.85;
  box-shadow: 0 0 20px rgba(255, 176, 0, 0.25);
}

.hangar-seam {
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 4px;
  margin-left: -2px;
  background: linear-gradient(180deg, #ffb000, #00e5ff, #ffb000);
  box-shadow: 0 0 16px rgba(255, 176, 0, 0.6);
  opacity: 0.9;
  transition: opacity 0.4s ease;
  z-index: 2;
}

#hangar-doors.opening .hangar-seam {
  opacity: 0;
}

#screen-intro {
  justify-content: flex-start;
  overflow-y: auto;
  padding-top: 10vh;
}

#intro-text {
  max-width: 42rem;
  text-align: left;
  line-height: 1.55;
  font-size: 0.95rem;
  color: var(--crt-green);
}

.crawl-line {
  margin: 0.15rem 0;
}

#intro-text .crawl-line:first-child {
  font-size: 1.4rem;
  letter-spacing: 0.2em;
  text-align: center;
  margin-bottom: 0.25rem;
}

#brief-panel,
.brief-infographic {
  max-width: min(52rem, 94vw);
  text-align: left;
  border: 1px solid var(--border);
  background: var(--panel);
  padding: 1.25rem 1.5rem 1.5rem;
  box-shadow: 0 0 24px rgba(0, 229, 255, 0.12);
  max-height: 90vh;
  overflow-y: auto;
}

#brief-title {
  color: var(--crt-cyan);
  letter-spacing: 0.15em;
  margin: 0 0 0.35rem;
  text-align: center;
}

.brief-sub {
  text-align: center;
  color: #1a8f3c;
  font-size: 0.8rem;
  margin: 0 0 1rem;
}

.target-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.65rem;
  margin-bottom: 1rem;
}

.target-card {
  border: 1px solid #1a4a30;
  background: rgba(0, 20, 12, 0.85);
  padding: 0.55rem 0.5rem 0.65rem;
  text-align: center;
  border-radius: 2px;
}



.target-card.kill { border-color: #663344; }
.target-card.objective { border-color: #aa3344; box-shadow: 0 0 10px rgba(255, 50, 60, 0.15); }
.target-card.extract { border-color: #886620; }
.target-card.pickup { border-color: #2a6680; }
.target-card.friend { border-color: #2a5530; }

.target-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 0.4rem;
  border-radius: 4px;
  position: relative;
  image-rendering: pixelated;
  background-color: #0a1018;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

/* First frame of a horizontal multi-view strip */
.target-icon-frame {
  width: 64px;
  height: 64px;
  border: 1px solid #1a3a28;
  background-color: #0a1018;
}

.target-icon-single {
  width: 64px;
  height: 64px;
}

.target-icon-single .sprite-single-img {
  width: 56px;
  height: 56px;
  object-fit: contain;
}

.sprite-caption {
  font-size: 0.55rem;
  color: #2a6a48;
  letter-spacing: 0.04em;
  margin: -0.15rem 0 0.35rem;
}

.sprite-missing {
  background: #331111 !important;
}
.sprite-missing::after {
  content: 'IMG?';
  color: #ff6677;
  font-size: 0.65rem;
}

/* CSS “icons” — infographic stand-ins until art packs arrive */
.icon-drone {
  background: radial-gradient(circle at 50% 45%, #00e5ff 0%, #00e5ff 28%, transparent 30%),
    linear-gradient(135deg, transparent 40%, #00e5ff 40%, #00e5ff 60%, transparent 60%),
    #0a1820;
  box-shadow: 0 0 12px rgba(0, 229, 255, 0.45);
}
.icon-turret {
  background:
    linear-gradient(#ffb000, #ffb000) center 18% / 18% 22% no-repeat,
    linear-gradient(#4a5a6a, #4a5a6a) center 55% / 55% 40% no-repeat,
    #121820;
  box-shadow: 0 0 10px rgba(255, 176, 0, 0.35);
}
.icon-nest {
  background:
    radial-gradient(circle at 50% 40%, #ff4466 0%, #ff2244 40%, #3a1020 42%, #3a1020 100%);
  box-shadow: 0 0 14px rgba(255, 40, 60, 0.5);
}
.icon-bay {
  background:
    linear-gradient(#ff2244, #ff2244) center / 48% 48% no-repeat,
    linear-gradient(#5a2030, #5a2030) center / 78% 78% no-repeat,
    #1a0a10;
  box-shadow: 0 0 14px rgba(255, 30, 50, 0.55);
}
.icon-drill {
  /* Upright industrial drill: base, mast, spinning crown, bit down */
  background:
    /* crown disc */
    radial-gradient(circle at 50% 28%, #ffb000 0 18%, transparent 19%),
    /* mast */
    linear-gradient(#ff4466, #ff4466) 50% 55% / 18% 42% no-repeat,
    /* base foot */
    linear-gradient(#5a2030, #5a2030) 50% 88% / 70% 16% no-repeat,
    /* bit tip */
    linear-gradient(#00e5ff, #00e5ff) 50% 72% / 10% 14% no-repeat,
    #1a0a10;
  box-shadow: 0 0 14px rgba(255, 80, 40, 0.55);
}
.icon-extract {
  /* Closed hangar doors: two panels + amber seam + hazard band */
  background:
    /* hazard stripe band */
    repeating-linear-gradient(
      -45deg,
      #ffb000 0 5px,
      #1a1408 5px 10px
    ),
    /* left door */
    linear-gradient(90deg, #1a222c 0%, #121820 100%),
    /* right door */
    linear-gradient(90deg, #121820 0%, #1a222c 100%),
    /* frame */
    #0a0e14;
  background-size:
    100% 22%,
    46% 100%,
    46% 100%,
    100% 100%;
  background-position:
    center,
    left center,
    right center,
    center;
  background-repeat: no-repeat;
  box-shadow:
    inset 0 0 0 2px #2a3544,
    0 0 10px rgba(255, 176, 0, 0.35);
  position: relative;
}
.icon-extract::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 8%;
  bottom: 8%;
  width: 3px;
  margin-left: -1.5px;
  background: linear-gradient(#ffb000, #00e5ff, #ffb000);
  box-shadow: 0 0 6px rgba(255, 176, 0, 0.7);
}
.icon-shield {
  background: radial-gradient(circle, #ffb000 0%, #ffb000 35%, #1a1408 38%);
  box-shadow: 0 0 10px rgba(255, 176, 0, 0.4);
  clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%);
}
.icon-emp {
  background: radial-gradient(circle, #00e5ff 0%, #00e5ff 35%, #081418 38%);
  box-shadow: 0 0 10px rgba(0, 229, 255, 0.4);
  clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%);
}

.target-card h3 {
  margin: 0 0 0.2rem;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  color: var(--crt-green);
  font-weight: normal;
}

.target-card p {
  margin: 0;
  font-size: 0.62rem;
  line-height: 1.35;
  color: #2a8f55;
}

.target-card .tag {
  display: inline-block;
  margin-top: 0.35rem;
  font-size: 0.55rem;
  letter-spacing: 0.1em;
  padding: 0.15rem 0.35rem;
  border: 1px solid currentColor;
}

.tag-kill { color: #ff8899; }
.tag-obj { color: #ff4466; }
.tag-go { color: #ffb000; }
.tag-item { color: #00e5ff; }

.brief-objectives,
.debrief-body {
  /* Each child is a real <p> block — never preformatted / never comma-joined arrays */
  white-space: normal;
  text-align: left;
  overflow-wrap: break-word;
  word-wrap: break-word;
}

.brief-objectives {
  border-top: 1px solid #1a4a30;
  padding-top: 0.75rem;
  margin-bottom: 0.75rem;
  font-size: 0.78rem;
  line-height: 1.5;
  color: var(--crt-green);
}

.debrief-body {
  font-size: 0.85rem;
  line-height: 1.5;
  color: #33ff66;
  margin: 1rem 0 1.5rem;
}

/* Force block layout so paragraphs never run into one line */
.brief-objectives > p,
.debrief-body > p {
  display: block !important;
  max-width: 100%;
}

.brief-objectives .brief-heading,
.debrief-body .brief-heading {
  margin: 1em 0 0.4em;
  padding-bottom: 0.15em;
  border-bottom: 1px solid rgba(0, 229, 255, 0.25);
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--crt-cyan, #00e5ff);
  font-size: 0.95em;
}

.brief-objectives .brief-heading:first-child,
.debrief-body .brief-heading:first-child {
  margin-top: 0;
}

.brief-objectives .brief-para,
.debrief-body .brief-para {
  margin: 0 0 0.75em;
}

.brief-objectives .brief-item,
.debrief-body .brief-item {
  margin: 0.15em 0 0.15em 0.6em;
  padding-left: 0.35em;
  border-left: 2px solid rgba(51, 255, 102, 0.35);
}

.brief-objectives .brief-callout,
.debrief-body .brief-callout {
  margin: 0.65em 0;
  padding: 0.45em 0.55em;
  border-left: 3px solid #ffb000;
  background: rgba(255, 176, 0, 0.08);
  color: #ffe0a0;
}

.brief-objectives > p:last-child,
.debrief-body > p:last-child {
  margin-bottom: 0;
}

.brief-controls {
  border-top: 1px solid #1a4a30;
  padding-top: 0.65rem;
  margin-bottom: 1rem;
  font-size: 0.7rem;
  color: #1a8f3c;
  line-height: 1.4;
}

#brief-panel .btn {
  display: block;
  margin: 0 auto;
}

/* ---- Campaign end-roll (epilogue + credits) ---- */
#screen-endroll {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: #000;
  overflow: hidden;
  display: flex;
  align-items: stretch;
  justify-content: center;
}

#matrix-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

#endroll-mask {
  position: relative;
  z-index: 1;
  width: min(42rem, 92vw);
  height: 100%;
  overflow: hidden;
  mask-image: linear-gradient(
    to bottom,
    transparent 0%,
    #000 12%,
    #000 88%,
    transparent 100%
  );
  -webkit-mask-image: linear-gradient(
    to bottom,
    transparent 0%,
    #000 12%,
    #000 88%,
    transparent 100%
  );
  pointer-events: none;
}

#endroll-scroll {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  will-change: transform;
}

#endroll-content {
  padding: 100vh 1.25rem 40vh;
  text-align: center;
  color: #33ff66;
  text-shadow: 0 0 12px rgba(0, 255, 100, 0.35);
  font-family: var(--font);
  line-height: 1.55;
}

#endroll-content .endroll-line {
  margin: 0.35em 0;
  font-size: clamp(0.85rem, 2.2vw, 1.15rem);
  letter-spacing: 0.04em;
}

#endroll-content .endroll-line.empty {
  height: 0.85em;
}

#endroll-content .endroll-heading {
  margin: 2.2em 0 0.75em;
  font-size: clamp(1rem, 2.6vw, 1.35rem);
  letter-spacing: 0.22em;
  color: #00e5ff;
  text-shadow: 0 0 14px rgba(0, 229, 255, 0.4);
}

#endroll-content .endroll-heading:first-child {
  margin-top: 0;
}

#endroll-hint {
  position: absolute;
  z-index: 2;
  bottom: 1.25rem;
  left: 50%;
  transform: translateX(-50%);
  margin: 0;
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  color: rgba(51, 255, 102, 0.55);
  pointer-events: none;
}

/* HUD */
#hud {
  position: fixed;
  inset: 0;
  z-index: 15;
  pointer-events: none;
  font-family: var(--font);
  color: var(--crt-green);
  text-shadow: 0 0 6px rgba(51, 255, 102, 0.5);
}

/* Readable over cockpit art — ~65% opaque grey plate */
.hud-panel {
  background: rgba(48, 52, 58, 0.65);
  padding: 0.35rem 0.65rem;
  border: 1px solid rgba(80, 90, 100, 0.45);
  border-radius: 2px;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.35);
}

#hud-top {
  position: absolute;
  top: 12px;
  left: 16px;
  right: 16px;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
}

#hud-top > div {
  background: rgba(48, 52, 58, 0.65);
  padding: 0.4rem 0.65rem 0.5rem;
  border: 1px solid rgba(80, 90, 100, 0.45);
  border-radius: 2px;
  min-width: 160px;
}

.bar-wrap {
  width: 180px;
  margin-top: 4px;
}

.bar-label { font-size: 0.65rem; opacity: 0.85; }

.bar {
  height: 8px;
  border: 1px solid var(--crt-dim);
  background: rgba(0, 0, 0, 0.5);
  margin-top: 2px;
}

.bar > i {
  display: block;
  height: 100%;
  width: 100%;
  background: var(--crt-green);
  box-shadow: 0 0 6px var(--crt-green);
}

#hud-shield-bar > i {
  background: var(--crt-cyan);
  box-shadow: 0 0 6px var(--crt-cyan);
}

#hud-scorebar {
  position: absolute;
  top: 56px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem 1.1rem;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  color: var(--crt-green);
  z-index: 2;
}

#hud-scorebar #hud-score {
  color: var(--crt-amber);
  min-width: 7rem;
}

#hud-scorebar #hud-lives {
  color: var(--crt-cyan);
}

#hud-score-popup {
  position: absolute;
  top: 92px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.85rem;
  letter-spacing: 0.12em;
  color: var(--crt-amber);
  text-shadow: 0 0 8px rgba(255, 176, 0, 0.7);
  background: rgba(48, 52, 58, 0.55);
  padding: 0.2rem 0.55rem;
  pointer-events: none;
  z-index: 2;
}

/* Boss HP — center top, under score strip */
#hud-boss {
  position: absolute;
  top: 100px;
  left: 50%;
  transform: translateX(-50%);
  width: min(420px, 70vw);
  background: rgba(48, 52, 58, 0.72);
  border: 1px solid rgba(255, 0, 170, 0.55);
  border-radius: 2px;
  padding: 0.35rem 0.65rem 0.45rem;
  box-shadow: 0 0 14px rgba(255, 0, 170, 0.25);
  pointer-events: none;
  z-index: 3;
  text-align: center;
}

#hud-boss-label {
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  color: #ff66cc;
  text-shadow: 0 0 8px rgba(255, 0, 170, 0.6);
  margin-bottom: 0.2rem;
}

#hud-boss-bar {
  height: 10px;
  border-color: rgba(255, 0, 170, 0.45);
}

#hud-boss-bar > i {
  background: linear-gradient(90deg, #ff2244, #ff00aa);
  box-shadow: 0 0 8px rgba(255, 0, 170, 0.75);
  transition: width 0.12s linear;
}

#hud-boss-pct {
  font-size: 0.62rem;
  letter-spacing: 0.1em;
  color: rgba(255, 180, 220, 0.9);
  margin-top: 0.2rem;
}

#hud-boss.critical #hud-boss-bar > i {
  background: linear-gradient(90deg, #ff4466, #ff8800);
  animation: boss-bar-pulse 0.55s ease-in-out infinite alternate;
}

@keyframes boss-bar-pulse {
  from { filter: brightness(1); }
  to { filter: brightness(1.35); }
}

/* Latched hostiles — ship voice, not enemy codenames */
#hud-breach {
  position: absolute;
  top: 148px;
  left: 50%;
  transform: translateX(-50%);
  min-width: 280px;
  text-align: center;
  padding: 0.45rem 0.9rem 0.55rem;
  background: rgba(40, 8, 12, 0.82);
  border: 2px solid #ff2244;
  border-radius: 2px;
  box-shadow: 0 0 18px rgba(255, 34, 68, 0.45);
  pointer-events: none;
  z-index: 4;
}

#hud-breach.flash {
  animation: breach-flash 0.45s ease-in-out infinite alternate;
}

#hud-breach-title {
  font-size: 0.85rem;
  letter-spacing: 0.18em;
  color: #ff4466;
  text-shadow: 0 0 10px rgba(255, 34, 68, 0.85);
  font-weight: bold;
}

#hud-breach-hint {
  margin-top: 0.25rem;
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  color: #ffb000;
}

@keyframes breach-flash {
  from {
    opacity: 0.75;
    border-color: #ff2244;
  }
  to {
    opacity: 1;
    border-color: #ff8899;
    box-shadow: 0 0 28px rgba(255, 34, 68, 0.7);
  }
}

#hud-emp {
  position: absolute;
  bottom: 78px;
  left: 50%;
  transform: translateX(-50%);
  min-width: 220px;
  z-index: 6;
  border: 1px solid rgba(0, 229, 255, 0.45);
  background: rgba(0, 20, 28, 0.72);
  padding: 0.35rem 0.55rem 0.45rem;
}
#hud-emp-row {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  font-family: 'Courier New', monospace;
  font-size: 0.85rem;
  letter-spacing: 0.06em;
  color: #7fe9ff;
  margin-bottom: 0.25rem;
}
#hud-emp-label {
  font-weight: bold;
  color: #00e5ff;
}
#hud-emp-count {
  color: #e8fbff;
  font-weight: bold;
  font-size: 1rem;
}
#hud-emp-status {
  margin-left: auto;
  color: #a8f0ff;
}
#hud-emp .bar {
  height: 10px;
  background: rgba(0, 40, 50, 0.9);
  border: 1px solid rgba(0, 229, 255, 0.35);
}
#hud-emp-fill {
  display: block;
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #007a8a, #00e5ff);
  box-shadow: 0 0 8px rgba(0, 229, 255, 0.55);
  transition: width 0.08s linear;
}
#hud-emp.ready {
  border-color: rgba(0, 255, 200, 0.75);
  box-shadow: 0 0 12px rgba(0, 229, 255, 0.25);
}
#hud-emp.ready #hud-emp-status {
  color: #33ffaa;
  font-weight: bold;
}
#hud-emp.empty {
  border-color: rgba(255, 80, 80, 0.45);
  opacity: 0.85;
}
#hud-emp.empty #hud-emp-status {
  color: #ff6688;
}
#hud-emp.recharging #hud-emp-status {
  color: #ffcc66;
}
#hud-emp.breach-hot {
  border-color: #ff2244;
  animation: emp-breach-pulse 0.55s ease-in-out infinite alternate;
}
@keyframes emp-breach-pulse {
  from { box-shadow: 0 0 6px rgba(255, 34, 68, 0.3); }
  to { box-shadow: 0 0 16px rgba(255, 34, 68, 0.65); }
}

#hud-objective {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  max-width: 55vw;
  text-align: center;
  font-size: 0.8rem;
  color: var(--crt-amber);
}

#hud-weapon {
  position: absolute;
  bottom: 48px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.75rem;
  letter-spacing: 0.06em;
}

#hud-hint {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.65rem;
  color: var(--crt-dim);
  white-space: nowrap;
}

#hud-assist {
  position: absolute;
  /* Above pilot face (face sits bottom-right) */
  bottom: 200px;
  right: 14px;
  font-size: 0.7rem;
  color: var(--crt-cyan);
}

/* Soft death flash — short reboot notice */
#hud-death {
  position: absolute;
  top: 42%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 20;
  padding: 0.85rem 1.4rem;
  font-size: 1.05rem;
  letter-spacing: 0.18em;
  color: #ff4466;
  text-shadow: 0 0 12px rgba(255, 40, 60, 0.85);
  background: rgba(20, 8, 10, 0.82);
  border: 2px solid rgba(255, 60, 80, 0.75);
  box-shadow: 0 0 24px rgba(255, 30, 50, 0.35);
  animation: deathPulse 0.35s ease-in-out infinite alternate;
}

@keyframes deathPulse {
  from { opacity: 0.88; }
  to { opacity: 1; filter: brightness(1.15); }
}

/* Doom-style automap */
#hud-minimap-wrap {
  position: absolute;
  left: 14px;
  bottom: 14px;
  width: 168px;
  pointer-events: none;
}

#hud-minimap {
  display: block;
  width: 168px;
  height: 168px;
  background: rgba(2, 4, 6, 0.88);
  border: 1px solid rgba(51, 255, 102, 0.45);
  box-shadow:
    0 0 12px rgba(0, 229, 255, 0.15),
    inset 0 0 20px rgba(0, 0, 0, 0.6);
  image-rendering: pixelated;
}

#hud-minimap-legend {
  margin-top: 4px;
  font-size: 0.55rem;
  letter-spacing: 0.04em;
  color: var(--crt-dim);
  text-align: center;
  opacity: 0.85;
  background: rgba(48, 52, 58, 0.65);
  padding: 0.2rem 0.25rem;
  border-radius: 2px;
}

/* Doom-style pilot face (bottom-right, opposite minimap) */
#hud-face-wrap {
  position: absolute;
  right: 14px;
  bottom: 48px;
  width: 128px;
  pointer-events: none;
  text-align: center;
}

#hud-face {
  width: 128px;
  height: 128px;
  margin: 0 auto;
  background-color: rgba(12, 16, 20, 0.75);
  background-image: none; /* set when sprite loads */
  background-repeat: no-repeat;
  background-size: 640px 128px; /* 5 × 128 frames horizontal */
  background-position: 0 0;
  border: 1px solid rgba(51, 255, 102, 0.45);
  box-shadow:
    0 0 12px rgba(0, 229, 255, 0.12),
    inset 0 0 16px rgba(0, 0, 0, 0.55);
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

#hud-face.missing {
  /* CSS fallback portrait when pilot_face.png not present yet */
  background-image: none;
  background-color: rgba(20, 28, 24, 0.85);
  position: relative;
}

#hud-face.hurt {
  filter: brightness(1.35) saturate(1.4);
}

#hud-face-label {
  margin-top: 4px;
  font-size: 0.6rem;
  letter-spacing: 0.12em;
  color: var(--crt-green);
  background: rgba(48, 52, 58, 0.65);
  padding: 0.2rem 0.25rem;
  border-radius: 2px;
  border: 1px solid rgba(80, 90, 100, 0.4);
}

#crosshair {
  position: fixed;
  left: 50%;
  top: 50%;
  width: 18px;
  height: 18px;
  margin: -9px 0 0 -9px;
  z-index: 16;
  pointer-events: none;
  border: 1px solid rgba(51, 255, 102, 0.7);
  border-radius: 50%;
  box-shadow: 0 0 4px rgba(51, 255, 102, 0.4);
}

#crosshair::before, #crosshair::after {
  content: '';
  position: absolute;
  background: rgba(51, 255, 102, 0.85);
}
#crosshair::before {
  left: 50%; top: 2px; bottom: 2px; width: 1px; margin-left: -0.5px;
}
#crosshair::after {
  top: 50%; left: 2px; right: 2px; height: 1px; margin-top: -0.5px;
}
