/* ============================================================
   CYBERNETIC MIND VIR.US // ASH-17
   STYLE.CSS — CONTAMINATED ARCHIVE TERMINAL (CANONICAL REWRITE)
   DEROBOTER AESTHETIC: WIRED / HEAVY / ENCLOSED / SURVEILLED
   ============================================================ */

:root {
  --bg:           #000000;
  --green:        #00e538;
  --green-dim:    #006b1a;
  --green-lo:     #002a0a;
  --green-faint:  #000f04;
  --text:         #848078;
  --text-bright:  #b8b4a8;
  --text-dim:     #3a3830;
  --amber:        #7a6428;
  --system:       #004d14;
  --system-live:  #00a030;
  --border:       #0a160a;
  --border-hi:    #1a3a1a;
  --panel:        #010301;
  --red-earned:   #6b1010;
  --glow:         rgba(0, 229, 56, 0.12);
  --glow-strong:  rgba(0, 229, 56, 0.24);
  --scan-opacity: 0.045;
}

/* ============================================================
   RESET & BASE
   ============================================================ */

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: 'Courier New', Courier, monospace;
  font-size: 13px;
  line-height: 1.65;
}

body {
  animation: crt-flicker 10s infinite;
}

/* Boot phase: horizontal line artifacts via box-shadow on ::before */
body.phase-boot::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1001;
  box-shadow:
    inset 0 23px 0 rgba(0, 229, 56, 0.015),
    inset 0 67px 0 rgba(0, 229, 56, 0.008),
    inset 0 134px 0 rgba(0, 229, 56, 0.012),
    inset 0 211px 0 rgba(0, 229, 56, 0.006),
    inset 0 289px 0 rgba(0, 229, 56, 0.018),
    inset 0 378px 0 rgba(0, 229, 56, 0.007);
}

@keyframes crt-flicker {
  0%   { opacity: 1.0; }
  12%  { opacity: 0.985; }
  28%  { opacity: 1.0; }
  51%  { opacity: 0.975; }
  67%  { opacity: 1.0; }
  83%  { opacity: 0.99; }
  100% { opacity: 1.0; }
}

/* ============================================================
   OVERLAYS
   ============================================================ */

.bg-img {
  position: fixed;
  inset: 0;
  background: url('bg.png') center center / cover no-repeat;
  opacity: 0.06;
  filter: grayscale(100%) contrast(1.1);
  pointer-events: none;
  z-index: 0;
}

.scanlines {
  position: fixed;
  inset: 0;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0px,
    transparent 2px,
    rgba(0, 0, 0, 0.22) 2px,
    rgba(0, 0, 0, 0.22) 4px
  );
  pointer-events: none;
  z-index: 999;
  opacity: var(--scan-opacity);
  transition: opacity 2.5s ease;
}

.vignette {
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse at center, transparent 48%, rgba(0, 0, 0, 0.82) 100%);
  pointer-events: none;
  z-index: 998;
}

/* ============================================================
   INFECTION LEVEL MUTATIONS
   ============================================================ */

/* inf-3: borders intensify, slight green brightening */
body.inf-3,
body.inf-4 {
  --border:     #0f2a0f;
  --border-hi:  #223a22;
  --green:      #05ec3e;
  --system:     #005518;
}

/* inf-5+: more pronounced */
body.inf-5,
body.inf-6 {
  --border:     #122d12;
  --border-hi:  #2a4a2a;
  --green:      #0af545;
  --system:     #005f1c;
  --system-live: #00b038;
}

/* inf-7+: critical — scanlines intensify, waveform overlay */
body.inf-7,
body.inf-8,
body.inf-9,
body.inf-10 {
  --border:     #162e16;
  --border-hi:  #305030;
  --green:      #12ff4f;
  --system:     #006e22;
  --system-live: #00c040;
}

body.inf-3 #archive-header,
body.inf-4 #archive-header {
  box-shadow: 0 1px 0 var(--border-hi), 0 2px 14px var(--glow);
}

body.inf-3 #archive-sidebar,
body.inf-4 #archive-sidebar {
  box-shadow: inset -2px 0 0 var(--border-hi), 2px 0 10px rgba(0, 229, 56, 0.06);
}

body.inf-5 #archive-header,
body.inf-6 #archive-header {
  box-shadow: 0 1px 0 var(--border-hi), 0 2px 22px var(--glow-strong);
  animation: headerGlitch 4s infinite;
}

body.inf-5 #archive-sidebar,
body.inf-6 #archive-sidebar {
  box-shadow: inset -2px 0 0 var(--border-hi), 4px 0 18px rgba(0, 229, 56, 0.1);
}

body.inf-7 .scanlines,
body.inf-8 .scanlines,
body.inf-9 .scanlines,
body.inf-10 .scanlines {
  opacity: 0.10;
}

body.inf-7 #archive-header,
body.inf-8 #archive-header,
body.inf-9 #archive-header,
body.inf-10 #archive-header {
  box-shadow: 0 1px 0 var(--border-hi), 0 2px 32px var(--glow-strong);
  animation: headerGlitch 2.5s infinite;
}

/* Waveform overlay at inf-7 — fixed behind content */
body.inf-7 #archive-body::after,
body.inf-8 #archive-body::after,
body.inf-9 #archive-body::after,
body.inf-10 #archive-body::after {
  content: '▓▒░░░░▒▒▓▒░░░░░░▒▒▒▒░░░░▒▓▒░░░▒▒▒░░░░░▓▒░▒▒░░░░\A▒▒░░▒▓▓▒░░░▒▒░░░░▒▒▒▒░░▒▒░░▒▒▒▒░░░░░▒▒░░▒▒▒░░▒\A░░▒▒▒░░░▒▒▒░░░░▒▒▒░░░▒▒▒░░░░▒▒▒░░░▒▒░░░▒▒░░░░▒▒';
  white-space: pre;
  font-family: 'Courier New', Courier, monospace;
  font-size: 11px;
  letter-spacing: -0.04em;
  color: var(--green-lo);
  position: fixed;
  top: 40px;
  right: 0;
  width: 320px;
  opacity: 0.07;
  pointer-events: none;
  z-index: 2;
  line-height: 1.5;
  padding: 8px;
}

/* Elevated pattern indicator in header */
body.inf-5 #archive-header::after,
body.inf-6 #archive-header::after,
body.inf-7 #archive-header::after,
body.inf-8 #archive-header::after,
body.inf-9 #archive-header::after,
body.inf-10 #archive-header::after {
  content: ':: PATTERN LOAD ELEVATED ::';
  position: absolute;
  bottom: -14px;
  left: 18px;
  font-size: 8px;
  letter-spacing: 0.2em;
  color: var(--green-lo);
  text-transform: uppercase;
  z-index: 51;
  pointer-events: none;
}

@keyframes headerGlitch {
  0%, 88%, 100%  { transform: none; filter: none; clip-path: none; }
  89%  { transform: translateX(1px) skewX(-0.3deg); filter: hue-rotate(4deg); }
  90%  { transform: translateX(-1px); clip-path: polygon(0 18%, 100% 18%, 100% 42%, 0 42%); filter: none; }
  91%  { transform: none; clip-path: none; filter: brightness(1.35); }
  92%  { filter: none; transform: translateX(0.5px); }
  93%  { transform: none; }
}

/* ============================================================
   SCREENS
   ============================================================ */

.screen {
  display: none;
  position: absolute;
  inset: 0;
  z-index: 10;
}

.screen.active {
  display: flex;
  flex-direction: column;
}

/* ============================================================
   BOOT SCREEN
   ============================================================ */

#screen-boot {
  background: var(--bg);
  justify-content: center;
  align-items: flex-start;
  padding: 18vh 10vw;
  flex-direction: column;
  gap: 0;
}

#boot-output {
  font-size: 13px;
  color: var(--green-dim);
  line-height: 1.75;
  letter-spacing: 0.04em;
  min-height: 300px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}

#boot-output .boot-line {
  display: block;
  white-space: pre;
}

#boot-output .boot-line.boot-title {
  color: var(--green);
  font-size: 17px;
  letter-spacing: 0.14em;
  margin-bottom: 8px;
  font-weight: bold;
}

#boot-output .boot-line.boot-warning {
  color: var(--amber);
}

#boot-output .boot-line.boot-blank {
  min-height: 1.75em;
  display: block;
}

#boot-prompt {
  margin-top: 22px;
  color: var(--green);
  font-size: 13px;
  letter-spacing: 0.06em;
  display: flex;
  align-items: center;
  gap: 0;
  cursor: text;
}

#boot-input-display {
  color: var(--green);
  letter-spacing: 0.06em;
}

/* ============================================================
   CURSOR & BLINK
   ============================================================ */

.cursor.blink {
  animation: blink-anim 1.1s step-start infinite;
  color: var(--green);
}

@keyframes blink-anim {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0; }
}

.hidden {
  display: none !important;
}

/* ============================================================
   CONSENT SCREEN
   Redesigned: classified document scanned aesthetic
   ============================================================ */

#screen-consent {
  background: var(--bg);
  justify-content: center;
  align-items: center;
  overflow-y: auto;
}

#consent-doc {
  max-width: 600px;
  width: 92%;
  margin: 36px auto;
  background: #0d0d0d;
  border: 1px solid var(--border-hi);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.02),
    inset 0 -1px 0 rgba(0,0,0,0.4),
    inset 4px 0 8px rgba(0,0,0,0.3),
    inset -4px 0 8px rgba(0,0,0,0.3),
    0 0 40px rgba(0, 0, 0, 0.9);
}

.consent-classification-bar {
  background: var(--red-earned);
  color: #c8a0a0;
  text-align: center;
  padding: 9px 16px;
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  border-bottom: 1px solid rgba(107, 16, 16, 0.4);
}

.consent-body {
  padding: 30px 38px 34px;
}

.consent-doc-id {
  color: var(--text-dim);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 10px;
}

.consent-title {
  color: var(--text-bright);
  font-size: 13px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: normal;
  text-align: center;
  margin-bottom: 22px;
  line-height: 1.6;
}

.consent-text {
  color: var(--text);
  font-size: 12px;
  line-height: 1.78;
  margin-bottom: 20px;
}

.consent-text p {
  margin-bottom: 12px;
}

.consent-text ol {
  padding-left: 22px;
  margin-bottom: 14px;
}

.consent-text ol li {
  margin-bottom: 7px;
}

.consent-note {
  color: var(--text-dim);
  font-size: 11px;
  font-style: italic;
  border-top: 1px solid var(--border);
  padding-top: 12px;
  margin-top: 4px;
}

.consent-signature {
  color: var(--text-dim);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-align: center;
  text-transform: uppercase;
  border-top: 1px solid var(--border);
  padding-top: 14px;
  margin-bottom: 22px;
}

.consent-buttons {
  display: flex;
  gap: 14px;
  justify-content: center;
  flex-wrap: wrap;
}

.deny-message {
  margin-top: 14px;
  color: var(--amber);
  font-size: 11px;
  text-align: center;
  letter-spacing: 0.06em;
  min-height: 20px;
}

/* ============================================================
   BUTTONS
   ============================================================ */

.btn-styled {
  background: transparent;
  border: 1px solid var(--border-hi);
  color: var(--green-dim);
  font-family: 'Courier New', Courier, monospace;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 8px 18px;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, box-shadow 0.15s;
  outline: none;
}

.btn-styled:hover {
  border-color: var(--green-dim);
  color: var(--green);
  box-shadow: 0 0 10px var(--glow);
}

.btn-styled:active {
  background: var(--green-faint);
}

.btn-deny-styled {
  color: var(--text-dim);
  border-color: var(--border);
}

.btn-deny-styled:hover {
  border-color: var(--amber);
  color: var(--amber);
  box-shadow: none;
}

.btn-tiny {
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-family: 'Courier New', Courier, monospace;
  font-size: 10px;
  letter-spacing: 0.08em;
  cursor: pointer;
  padding: 2px 6px;
  transition: color 0.15s;
  outline: none;
  text-decoration: underline;
  text-decoration-color: var(--border);
}

.btn-tiny:hover {
  color: var(--amber);
}

/* ============================================================
   ARCHIVE SCREEN — LAYOUT
   ============================================================ */

#screen-archive {
  display: none;
  flex-direction: column;
  background: var(--bg);
}

#screen-archive.active {
  display: grid;
  grid-template-rows: 40px 1fr 36px;
  grid-template-columns: 1fr;
  height: 100vh;
}

/* ============================================================
   ARCHIVE HEADER (40px)
   Surveillance console header — heavy, monitoring feel
   ============================================================ */

#archive-header {
  grid-row: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  border-bottom: 1px solid var(--border-hi);
  box-shadow: 0 1px 0 var(--border), 0 2px 8px rgba(0, 229, 56, 0.06);
  background: var(--panel);
  position: relative;
  z-index: 50;
  transition: box-shadow 0.7s ease;
}

#header-left {
  color: var(--green);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: bold;
}

#header-right {
  display: flex;
  align-items: center;
  gap: 16px;
  color: var(--text-dim);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

#header-right span::before {
  content: '|';
  margin-right: 16px;
  color: var(--border-hi);
}

/* ============================================================
   ARCHIVE BODY — WIRED EQUIPMENT RACK
   ============================================================ */

#archive-body {
  grid-row: 2;
  display: grid;
  grid-template-columns: 240px 1fr;
  overflow: hidden;
  border-bottom: 1px solid var(--border-hi);
  position: relative;
}

/* ============================================================
   SIDEBAR (240px) — cable-conduit panel
   ============================================================ */

#archive-sidebar {
  border-right: 2px solid var(--border-hi);
  box-shadow: 2px 0 12px rgba(0, 0, 0, 0.6), inset -1px 0 0 var(--border);
  background: var(--panel);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding-bottom: 24px;
  transition: box-shadow 0.7s ease;
}

.sidebar-label {
  padding: 12px 14px 9px;
  font-size: 9px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border-hi);
  position: sticky;
  top: 0;
  background: var(--panel);
  z-index: 5;
}

#node-list {
  list-style: none;
  padding: 6px 0;
}

#node-list .node-item {
  display: block;
  padding: 8px 14px 8px 16px;
  font-size: 10px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  line-height: 1.45;
  transition: background 0.1s, color 0.12s, border-color 0.12s;
  position: relative;
  border-left: 2px solid transparent;
}

#node-list .node-item.locked {
  color: var(--text-dim);
  cursor: not-allowed;
  opacity: 0.4;
}

#node-list .node-item.available {
  color: var(--green-dim);
  cursor: pointer;
}

#node-list .node-item.available:hover {
  background: var(--green-faint);
  color: var(--green);
  border-left-color: var(--green);
}

#node-list .node-item.active {
  color: var(--green);
  background: var(--green-faint);
  border-left-color: var(--green);
}

#node-list .node-item.visited {
  color: var(--text-dim);
  cursor: pointer;
  opacity: 0.85;
}

#node-list .node-item.visited:hover {
  color: var(--green-dim);
  background: var(--green-faint);
  border-left-color: var(--green-dim);
}

.node-item .node-visited-mark {
  color: var(--text-dim);
  font-size: 9px;
  display: inline;
  margin-left: 4px;
  letter-spacing: 0.04em;
}

.node-item .node-type-tag {
  color: var(--amber);
  font-size: 9px;
  display: block;
  margin-top: 2px;
  letter-spacing: 0.1em;
  opacity: 0.85;
}

/* ============================================================
   MAIN CONTENT AREA
   ============================================================ */

#archive-content {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg);
  /* Faint vertical line suggesting cable run */
  border-left: 1px solid var(--border-hi);
}

#content-area {
  flex: 1;
  overflow-y: auto;
  padding: 20px 30px 16px;
  scrollbar-width: thin;
  scrollbar-color: var(--green-lo) var(--bg);
}

#content-area::-webkit-scrollbar {
  width: 4px;
}

#content-area::-webkit-scrollbar-track {
  background: var(--bg);
}

#content-area::-webkit-scrollbar-thumb {
  background: var(--green-lo);
}

#choice-area {
  padding: 14px 30px 16px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  border-top: 1px solid var(--border-hi);
  min-height: 0;
  background: var(--bg);
}

#choice-area:empty {
  display: none;
}

/* ============================================================
   FOOTER (36px) — stat console + whisper
   ============================================================ */

#archive-footer {
  grid-row: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  border-top: 1px solid var(--border-hi);
  background: var(--panel);
  gap: 20px;
}

#stat-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: nowrap;
  overflow: hidden;
  flex: 1;
}

.stat-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 9px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  white-space: nowrap;
}

.stat-label {
  color: var(--text-dim);
}

.stat-track {
  display: flex;
  gap: 1px;
}

.stat-block {
  width: 7px;
  height: 9px;
  background: var(--green-lo);
}

.stat-block.filled {
  background: var(--green-dim);
}

.stat-block.filled.infection-bar {
  background: #2a6618;
}

.stat-block.filled.clarity-bar {
  background: #3a6858;
}

.stat-block.filled.resonance-bar {
  background: #483878;
}

.stat-block.filled.identity-bar {
  background: var(--amber);
}

/* Orpheon whisper — footer right */
#orpheon-whisper {
  font-size: 10px;
  color: var(--system);
  letter-spacing: 0.06em;
  font-style: italic;
  max-width: 40%;
  text-align: right;
  opacity: 0;
  transition: opacity 1.4s ease;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#orpheon-whisper.visible {
  opacity: 1;
}

/* ============================================================
   CONTENT SEGMENT TYPES
   ============================================================ */

/* Node header */
.node-header {
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border-hi);
}

/* Classification bar */
.node-classification {
  font-size: 9px;
  letter-spacing: 0.22em;
  color: var(--amber);
  text-transform: uppercase;
  margin-bottom: 6px;
  padding: 3px 6px;
  border: 1px solid var(--border-hi);
  display: inline-block;
}

/* ABOVE TOP SECRET classification — red-earned border */
.node-classification.class-ats {
  border-color: var(--red-earned);
  color: #a06060;
}

.node-title {
  color: var(--text-bright);
  font-size: 14px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  line-height: 1.4;
  margin-bottom: 8px;
  margin-top: 8px;
}

.node-meta-block {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 20px;
  margin-top: 6px;
}

.node-meta-line {
  font-size: 10px;
  color: var(--amber);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.85;
}

.node-body {
  margin-top: 10px;
}

/* .seg-text */
.seg-text {
  color: var(--text);
  margin-bottom: 13px;
  line-height: 1.8;
  font-size: 13px;
}

/* .seg-meta */
.seg-meta {
  color: var(--amber);
  font-size: 10px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  margin-bottom: 8px;
  opacity: 0.85;
}

/* .seg-sys — ORPHEON static voice */
.seg-sys,
.seg-system {
  color: var(--system);
  font-size: 12px;
  line-height: 1.68;
  margin: 14px 0;
  padding-left: 1.5rem;
  border-left: 2px solid var(--system);
  font-style: italic;
  opacity: 0.92;
  position: relative;
}

.seg-sys::before,
.seg-system::before {
  content: '// ';
  color: var(--green-lo);
  font-style: normal;
  position: absolute;
  left: 0.3rem;
}

/* .seg-sys.live — ORPHEON LLM voice, brighter, pulsing border */
.seg-sys.live,
.orpheon-live-inject {
  color: var(--system-live);
  border-left-color: var(--system-live);
  animation: sysLivePulse 3s ease-in-out infinite;
}

@keyframes sysLivePulse {
  0%, 100% { border-left-color: var(--system-live); }
  50%       { border-left-color: var(--green-dim); }
}

/* .seg-redacted */
.seg-redacted {
  display: inline-block;
  background: rgba(255, 255, 255, 0.02);
  color: var(--text-dim);
  font-size: 12px;
  padding: 3px 8px;
  margin: 8px 0;
  cursor: pointer;
  border: 1px solid var(--border-hi);
  transition: border-color 0.2s, color 0.2s;
  user-select: none;
  letter-spacing: 0.05em;
  line-height: 1.6;
  font-style: italic;
}

.seg-redacted:hover {
  border-color: var(--amber);
  color: var(--amber);
}

.seg-redacted.revealed {
  background: transparent;
  color: var(--text-bright);
  border-color: var(--border-hi);
  cursor: default;
  font-style: normal;
  padding: 8px 12px;
  display: block;
  margin: 12px 0;
  line-height: 1.8;
}

.seg-redacted.revealed:hover {
  border-color: var(--border-hi);
  color: var(--text-bright);
}

/* .seg-separator */
.seg-separator {
  border: none;
  border-top: 1px solid var(--border-hi);
  margin: 1.5rem 0;
}

/* .seg-wave / .seg-waveform */
.seg-wave,
.seg-waveform {
  font-family: 'Courier New', Courier, monospace;
  color: var(--green-lo);
  font-size: 12px;
  letter-spacing: -0.05em;
  white-space: pre;
  margin: 4px 0;
  line-height: 1.4;
}

/* ============================================================
   CHOICE BUTTONS
   ============================================================ */

.choice-btn {
  background: transparent;
  border: 1px solid var(--border-hi);
  color: var(--green-dim);
  font-family: 'Courier New', Courier, monospace;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 10px 16px;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s, color 0.15s, background 0.15s, box-shadow 0.15s;
  outline: none;
  display: flex;
  flex-direction: column;
  gap: 3px;
  line-height: 1.5;
  width: 100%;
}

.choice-btn:hover {
  border-color: var(--green-dim);
  color: var(--green);
  background: var(--green-faint);
  box-shadow: 0 0 8px var(--glow);
}

/* Harmonize choice — red-earned border (rare, earned) */
.choice-btn.choice-harmonize {
  border-color: var(--red-earned);
  color: #c08080;
}

.choice-btn.choice-harmonize:hover {
  border-color: #a02020;
  color: #e0a0a0;
  background: rgba(107, 16, 16, 0.08);
  box-shadow: 0 0 8px rgba(107, 16, 16, 0.2);
}

/* Archivist choice */
.choice-btn.choice-archivist {
  border-color: var(--system);
  color: var(--system-live);
}

.choice-btn.choice-archivist:hover {
  border-color: var(--system-live);
  color: var(--green);
  background: var(--green-faint);
}

.choice-btn.choice-locked {
  opacity: 0.3;
  cursor: not-allowed;
  pointer-events: none;
  border-style: dashed;
}

.choice-label {
  font-weight: bold;
  display: block;
  font-size: 11px;
}

.choice-desc {
  font-size: 10px;
  color: var(--text-dim);
  letter-spacing: 0.06em;
  display: block;
  font-style: italic;
  font-weight: normal;
  text-transform: none;
}

/* ============================================================
   ENDING SCREEN
   ============================================================ */

#screen-ending {
  background: var(--bg);
  justify-content: center;
  align-items: center;
  flex-direction: column;
  gap: 30px;
  overflow-y: auto;
  padding: 44px 20px;
}

#ending-content {
  max-width: 680px;
  width: 92%;
}

/* Ending class variations */
#ending-content.ending-purge {
  /* Cold — no glow, everything --text */
}

#ending-content.ending-preserve .ending-orpheon {
  color: var(--green-dim);
  border-left-color: var(--green-dim);
}

#ending-content.ending-broadcast {
  /* Green glow intensifies */
  text-shadow: 0 0 1px rgba(0, 229, 56, 0.1);
}

#ending-content.ending-broadcast .ending-orpheon {
  color: var(--system-live);
  border-left-color: var(--system-live);
}

#ending-content.ending-archivist {
  /* Everything in system color */
  color: var(--system);
}

#ending-content.ending-archivist .ending-body p {
  color: var(--system);
}

#ending-content.ending-archivist .ending-title {
  color: var(--system-live);
}

/* Harmonize: near-white — horror in the brightness */
#ending-content.ending-harmonize {
  animation: harmonizeFade 8s ease-out forwards;
}

#ending-content.ending-harmonize .ending-body p {
  color: var(--text-bright);
}

#ending-content.ending-harmonize .ending-orpheon {
  color: var(--text-bright);
  border-left-color: var(--text-dim);
  font-style: normal;
}

@keyframes harmonizeFade {
  0%   { filter: none; }
  100% { filter: brightness(1.6) saturate(0.2); }
}

/* When harmonize is active, suppress scanlines */
body:has(#ending-content.ending-harmonize) .scanlines {
  opacity: 0 !important;
}

.ending-classification-bar {
  background: var(--green-lo);
  color: var(--green-dim);
  text-align: center;
  padding: 7px 16px;
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  margin-bottom: 22px;
  border: 1px solid var(--border-hi);
}

.ending-title {
  color: var(--text-bright);
  font-size: 15px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 24px;
  text-align: center;
  line-height: 1.45;
}

.ending-body {
  color: var(--text);
  font-size: 13px;
  line-height: 1.82;
}

.ending-body p {
  margin-bottom: 16px;
}

.ending-orpheon {
  color: var(--green-dim);
  font-style: italic;
  font-size: 12px;
  border-left: 2px solid var(--system);
  padding-left: 14px;
  margin-top: 18px;
}

#btn-restart {
  margin-top: 10px;
}

/* ============================================================
   CONTACT INPUT
   ============================================================ */

.contact-input-wrap {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 4px 0;
}

.contact-prompt {
  color: var(--system-live);
  font-size: 11px;
  letter-spacing: 0.1em;
  font-style: italic;
  text-transform: uppercase;
}

.contact-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border-hi);
  padding: 6px 10px;
  background: var(--green-faint);
}

.contact-gt {
  color: var(--green);
  font-size: 13px;
}

.contact-input {
  background: transparent;
  border: none;
  outline: none;
  color: var(--green);
  font-family: 'Courier New', Courier, monospace;
  font-size: 13px;
  letter-spacing: 0.06em;
  flex: 1;
  caret-color: var(--green);
}

.contact-send {
  align-self: flex-start;
  cursor: pointer;
  transition: opacity 0.2s;
}

.contact-response {
  margin-top: 14px;
}

/* ============================================================
   UNLOCK NOTICE
   ============================================================ */

.unlock-notice {
  color: var(--system-live);
  font-size: 11px;
  font-style: italic;
  margin: 14px 0;
  padding: 8px 12px;
  border: 1px solid var(--green-lo);
  background: var(--green-faint);
  letter-spacing: 0.04em;
}

/* Contact node prompt link */
.contact-node-prompt {
  color: var(--system);
  font-size: 11px;
  font-style: italic;
  margin: 18px 0 6px;
  padding: 6px 10px;
  border: 1px solid var(--system);
  display: inline-block;
  cursor: pointer;
  letter-spacing: 0.06em;
  transition: color 0.15s, border-color 0.15s;
}

.contact-node-prompt:hover {
  color: var(--system-live);
  border-color: var(--system-live);
}

/* ============================================================
   SIDEBAR SCROLLBAR
   ============================================================ */

#archive-sidebar::-webkit-scrollbar {
  width: 3px;
}

#archive-sidebar::-webkit-scrollbar-track {
  background: var(--panel);
}

#archive-sidebar::-webkit-scrollbar-thumb {
  background: var(--border-hi);
}

/* ============================================================
   TYPEWRITER CURSOR
   ============================================================ */

.tw-cursor {
  display: inline-block;
  color: var(--green);
  animation: blink-anim 0.9s step-start infinite;
  margin-left: 1px;
}

/* ============================================================
   RESPONSIVE FLOOR
   ============================================================ */

@media (max-width: 700px) {
  #archive-body {
    grid-template-columns: 180px 1fr;
  }

  #node-list .node-item {
    font-size: 9px;
    padding: 6px 10px;
  }

  #content-area {
    padding: 14px 16px 12px;
  }

  #choice-area {
    padding: 12px 16px;
  }

  #orpheon-whisper {
    max-width: 55%;
  }
}

/* ============================================================
   TERMINAL MODE — NEW INTERFACE
   ============================================================ */

body.terminal-mode {
  overflow: hidden;
}

#terminal-wrap {
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 100%;
  position: relative;
  z-index: 1;
}

#terminal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 14px;
  background: #000a00;
  border-bottom: 1px solid var(--border-hi);
  font-size: 11px;
  color: var(--green-dim);
  letter-spacing: 0.05em;
  flex-shrink: 0;
  gap: 12px;
}

#term-path {
  color: var(--green);
  font-weight: bold;
  min-width: 180px;
}

#term-stats-bar {
  flex: 1;
  text-align: center;
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--green-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#term-session {
  font-size: 10px;
  white-space: nowrap;
}

.term-link {
  cursor: pointer;
  color: var(--green-dim);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.term-link:hover {
  color: var(--green);
}

#terminal-output {
  flex: 1;
  overflow-y: auto;
  padding: 10px 16px 4px;
  font-size: 13px;
  line-height: 1.55;
  scrollbar-width: thin;
  scrollbar-color: var(--green-dim) transparent;
}

#terminal-output::-webkit-scrollbar { width: 4px; }
#terminal-output::-webkit-scrollbar-thumb { background: var(--green-dim); }

.tline {
  margin: 0;
  padding: 0;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text-bright);
  font-family: 'Courier New', Courier, monospace;
  min-height: 1.55em;
}

.tline.t-echo {
  color: var(--text);
  margin-top: 6px;
}

.t-prompt-echo {
  color: var(--green-dim);
}

.tline.t-file {
  color: #7ec87e;
}

.tline.t-orpheon {
  color: var(--green);
  font-style: italic;
  border-left: 2px solid var(--green-dim);
  padding-left: 10px;
  margin-left: 2px;
}

.tline.t-orpheon-static {
  color: var(--green-dim);
  font-style: italic;
}

.t-orpheon-tag {
  color: var(--green);
  font-style: normal;
  font-weight: bold;
  letter-spacing: 0.05em;
}

.tline.t-err {
  color: var(--amber);
}

.tline.t-dim {
  color: var(--text-dim);
}

.tline.t-boot {
  color: var(--text);
}

.tline.t-head {
  color: var(--green);
  letter-spacing: 0.05em;
}

.tline.t-ls {
  color: #9ad49a;
}

.tline.t-find {
  color: #7eb87e;
}

.tline.t-grep {
  color: var(--text-bright);
}

#terminal-input-row {
  display: flex;
  align-items: center;
  padding: 7px 16px 9px;
  border-top: 1px solid var(--border-hi);
  background: #000300;
  flex-shrink: 0;
}

#term-prompt-label {
  color: var(--green);
  white-space: nowrap;
  font-size: 13px;
  font-family: 'Courier New', Courier, monospace;
  flex-shrink: 0;
}

#term-input {
  background: transparent;
  border: none;
  outline: none;
  color: #e0ffe0;
  font-family: 'Courier New', Courier, monospace;
  font-size: 13px;
  flex: 1;
  caret-color: var(--green);
  line-height: 1.55;
}

/* infection mutations on terminal elements */
body.inf-high #terminal-header,
body.inf-critical #terminal-header {
  box-shadow: 0 1px 8px var(--glow);
}

body.inf-critical .tline.t-orpheon {
  border-left-color: var(--green);
  text-shadow: 0 0 8px var(--green);
}

/* Stat bar gets brighter as infection rises */
body.inf-high #term-stats-bar,
body.inf-critical #term-stats-bar {
  color: var(--green-dim);
  text-shadow: 0 0 6px var(--glow);
}

/* ============================================================
   ENDING OVERLAY
   ============================================================ */

#ending-overlay {
  position: fixed;
  inset: 0;
  background: #000;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 60px 48px 40px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--green-dim) transparent;
}

#ending-overlay.hidden {
  display: none;
}

#ending-content {
  max-width: 680px;
  width: 100%;
}

.ending-class-bar {
  font-size: 10px;
  letter-spacing: 0.18em;
  color: var(--green-dim);
  border-top: 1px solid var(--border-hi);
  border-bottom: 1px solid var(--border-hi);
  padding: 5px 0;
  margin-bottom: 24px;
  text-transform: uppercase;
}

.ending-title {
  font-size: 20px;
  letter-spacing: 0.12em;
  color: var(--green);
  margin-bottom: 28px;
  text-transform: uppercase;
}

.ending-body {
  font-family: 'Courier New', Courier, monospace;
  font-size: 13px;
  line-height: 1.7;
}

.ending-line {
  color: var(--text-bright);
  margin: 0;
  padding: 1px 0;
  min-height: 1em;
}

.ending-line.orpheon-line {
  color: var(--green-dim);
  font-style: italic;
  border-left: 2px solid var(--green-dim);
  padding-left: 12px;
  margin-left: 2px;
}

.ending-restart-btn {
  margin-top: 40px;
  max-width: 680px;
  width: 100%;
  font-family: 'Courier New', Courier, monospace;
  font-size: 13px;
  color: var(--green-dim);
  cursor: pointer;
  letter-spacing: 0.1em;
  border: 1px solid var(--border-hi);
  padding: 10px 16px;
  text-align: center;
  transition: color 0.2s, border-color 0.2s;
}

.ending-restart-btn:hover {
  color: var(--green);
  border-color: var(--green-dim);
}

.ending-restart-btn.hidden {
  display: none;
}

@media (max-width: 600px) {
  #terminal-header {
    font-size: 9px;
    padding: 4px 8px;
  }
  #terminal-output {
    padding: 8px 10px 4px;
    font-size: 12px;
  }
  #terminal-input-row {
    padding: 6px 10px;
  }
  #term-input,
  #term-prompt-label {
    font-size: 12px;
  }
  #ending-overlay {
    padding: 30px 20px;
  }
}
