/* ULTRACHROMA DESIGN SYSTEM - FACILITY VIEWER */
/* Self-contained CSS with no external dependencies */

:root {
  /* ULTRACHROMA PALETTE - Core Diamond Color Language */
  --ultrachroma-teal: #2dd4bf;        /* Adequate throughput / calm control */
  --ultrachroma-teal-dark: #0f766e;   /* Deep teal for backgrounds */
  --ultrachroma-teal-light: #5eead4;  /* Light teal for accents */
  --ultrachroma-emerald: #10b981;     /* Exceeds quota, reward */
  --ultrachroma-emerald-dark: #047857; /* Deep emerald */
  --ultrachroma-emerald-light: #34d399; /* Light emerald */
  --ultrachroma-crimson: #dc2626;     /* Inefficiency detected, escalation */
  --ultrachroma-crimson-dark: #991b1b; /* Deep crimson */
  --ultrachroma-crimson-light: #f87171; /* Light crimson */
  --ultrachroma-violet: #7c3aed;      /* Executive command / Axion elite */
  --ultrachroma-violet-dark: #581c87;  /* Deep violet */
  --ultrachroma-violet-light: #a78bfa; /* Light violet */
  --ultrachroma-whiteout: #ffffff;    /* Reactor sacrifice, total disconnect */

  /* FACILITY ATMOSPHERE - Industrial/Corporate Horror */
  --facility-bg: #0a0a0f;              /* Deep void background */
  --facility-bg-panel: #111118;       /* Elevated panels */
  --facility-bg-elevated: #1a1a23;    /* Interactive elements */
  --facility-border: #2a2a35;         /* Subtle grid lines */
  --facility-text: #e5e7eb;           /* Primary text - clean, clinical */
  --facility-text-muted: #9ca3af;     /* Secondary text */
  --facility-text-dim: #6b7280;       /* Tertiary text */

  /* STATUS COLORS - Mapped to Ultrachroma */
  --status-adequate: var(--ultrachroma-teal);      /* Normal operations */
  --status-exceeds: var(--ultrachroma-emerald);    /* Optimal performance */
  --status-error: var(--ultrachroma-crimson);      /* System errors */
  --status-warning: var(--ultrachroma-crimson-light); /* Warnings */
  --status-success: var(--ultrachroma-emerald);    /* Success states */
  --status-elite: var(--ultrachroma-violet);       /* Executive/Axion */
  --status-critical: var(--ultrachroma-whiteout);  /* Critical alerts */

  /* TYPOGRAPHY - Clean, Technical */
  --font-primary: "JetBrains Mono", "Fira Code", "Source Code Pro", "SF Mono", "Monaco", "Inconsolata", "Roboto Mono", monospace;
  --font-secondary: "Inter", "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;

  /* SPACING & GEOMETRY - Grid-based, precise */
  --space-xs: 0.25rem;   /* 4px */
  --space-sm: 0.5rem;    /* 8px */
  --space-md: 1rem;      /* 16px */
  --space-lg: 1.5rem;    /* 24px */
  --space-xl: 2rem;      /* 32px */
  --space-2xl: 3rem;     /* 48px */

  /* BORDER RADIUS - Consistent, technical */
  --radius-sm: 0.25rem;  /* 4px - subtle */
  --radius-md: 0.5rem;   /* 8px - standard */
  --radius-lg: 0.75rem;  /* 12px - panels */
  --radius-xl: 1rem;     /* 16px - containers */

  /* SHADOWS - Subtle depth, industrial */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4);
  --shadow-glow-teal: 0 0 20px rgba(45, 212, 191, 0.15);
  --shadow-glow-emerald: 0 0 20px rgba(16, 185, 129, 0.15);
  --shadow-glow-crimson: 0 0 20px rgba(220, 38, 38, 0.15);
  --shadow-glow-violet: 0 0 20px rgba(124, 58, 237, 0.15);

  /* ANIMATIONS - Subtle, technical */
  --transition-fast: 0.1s ease;
  --transition-normal: 0.2s ease;
  --transition-slow: 0.3s ease;
}

/* BASE STYLES */
* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font-secondary);
  background: var(--facility-bg);
  color: var(--facility-text);
  min-height: 100vh;
  display: flex;
  line-height: 1.5;
  font-size: 16px;
  overflow-x: hidden;
}

a {
  color: var(--status-elite);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color var(--transition-normal);
}

a:hover {
  border-bottom-color: var(--status-elite);
}

/* CODE ELEMENTS - Technical monospace */
code, pre, .monospace {
  font-family: var(--font-primary);
  font-size: 0.9em;
  background: var(--facility-bg-panel);
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-sm);
  border: 1px solid var(--facility-border);
}

/* APP LAYOUT */
#app {
  display: flex;
  flex-direction: column;
  width: min(100%, 1400px);
  min-height: 100vh;
  margin: 0 auto;
}

/* FACILITY HEADER - Command Center Interface */
.app-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-lg);
  padding: var(--space-lg) var(--space-xl);
  width: 100vw;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
  background: linear-gradient(135deg,
    var(--facility-bg-panel) 0%,
    var(--facility-bg-elevated) 50%,
    var(--facility-bg-panel) 100%);
  border-bottom: 2px solid var(--facility-border);
  box-shadow: var(--shadow-sm);
  position: relative;
}

.app-header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(90deg,
    transparent 0%,
    var(--ultrachroma-teal-dark) 25%,
    transparent 50%,
    var(--ultrachroma-violet-dark) 75%,
    transparent 100%);
  opacity: 0.03;
  pointer-events: none;
}

.title-group h1 {
  margin: 0;
  font-size: 2rem;
  font-weight: 700;
  color: var(--facility-text);
  text-shadow: 0 0 10px var(--ultrachroma-teal);
  font-family: var(--font-secondary);
}

.title-group .subtitle {
  margin: var(--space-xs) 0 0;
  color: var(--facility-text-muted);
  font-size: 1rem;
  font-weight: 400;
  opacity: 0.8;
}

/* CONTROL PANEL */
.header-controls {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  flex-wrap: wrap;
}

/* FACILITY BUTTONS - Ultrachroma Command Interface */
button {
  border: 2px solid transparent;
  border-radius: var(--radius-md);
  padding: var(--space-sm) var(--space-lg);
  font-size: 0.95rem;
  font-weight: 600;
  font-family: var(--font-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
  background: var(--ultrachroma-teal-dark);
  color: var(--ultrachroma-teal-light);
  box-shadow: var(--shadow-sm);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  position: relative;
  overflow: hidden;
}

button::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
  transition: left var(--transition-slow);
}

button:hover:not(:disabled)::before {
  left: 100%;
}

button:hover:not(:disabled) {
  background: var(--ultrachroma-teal);
  color: var(--facility-bg);
  box-shadow: var(--shadow-glow-teal);
  transform: translateY(-1px);
}

button.secondary {
  background: transparent;
  border-color: var(--facility-border);
  color: var(--facility-text-muted);
}

button.secondary:hover:not(:disabled) {
  background: var(--facility-bg-elevated);
  border-color: var(--ultrachroma-violet);
  color: var(--ultrachroma-violet-light);
  box-shadow: var(--shadow-glow-violet);
}

button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  box-shadow: none;
}

button:active:not(:disabled) {
  transform: scale(0.98) translateY(0);
}

/* SYSTEM TOGGLES */
.toggle {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: 0.85rem;
  color: var(--facility-text-muted);
  font-weight: 500;
}

.toggle input[type="checkbox"] {
  appearance: none;
  width: 1.2rem;
  height: 1.2rem;
  border: 2px solid var(--facility-border);
  border-radius: var(--radius-sm);
  background: var(--facility-bg-panel);
  cursor: pointer;
  position: relative;
  transition: all var(--transition-normal);
}

.toggle input[type="checkbox"]:checked {
  background: var(--ultrachroma-emerald);
  border-color: var(--ultrachroma-emerald);
  box-shadow: var(--shadow-glow-emerald);
}

.toggle input[type="checkbox"]:checked::after {
  content: '✓';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: var(--facility-bg);
  font-size: 0.8rem;
  font-weight: bold;
}

.toggle input[type="checkbox"]:hover {
  border-color: var(--ultrachroma-teal);
}

/* STATUS BAR - System Diagnostics */
#statusBar {
  min-height: 2rem;
  padding: var(--space-sm) var(--space-md);
  background: var(--facility-bg-elevated);
  color: var(--facility-text-muted);
  border: 1px solid var(--facility-border);
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-family: var(--font-primary);
  font-weight: 500;
  position: relative;
  display: block;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

#statusBar::before {
  content: '';
  width: 3px;
  height: 100%;
  background: var(--ultrachroma-teal);
  position: absolute;
  left: 0;
  top: 0;
  border-radius: var(--radius-md) 0 0 var(--radius-md);
  opacity: 0.6;
}

#statusBar::after {
  content: '\200B';  /* zero-width space to maintain consistent height */
  display: inline;
}

#statusBar:empty::after {
  content: 'Ready';
}

#statusBar.success {
  color: var(--status-success);
  background: rgba(16, 185, 129, 0.15);
  border-color: rgba(16, 185, 129, 0.4);
}

#statusBar.success::before {
  background: var(--status-success);
  opacity: 1;
}

#statusBar.error {
  color: var(--status-error);
  background: rgba(220, 38, 38, 0.15);
  border-color: rgba(220, 38, 38, 0.4);
}

#statusBar.error::before {
  background: var(--status-error);
  opacity: 1;
}

#statusBar.warning {
  color: var(--status-warning);
  background: rgba(248, 113, 113, 0.15);
  border-color: rgba(248, 113, 113, 0.4);
}

#statusBar.warning::before {
  background: var(--status-warning);
  opacity: 1;
}

/* FACILITY VIEWER LAYOUT - Command Center */
main.viewer {
  flex: 1;
  display: flex;
  gap: var(--space-xl);
  padding: var(--space-2xl) var(--space-xl) var(--space-xl);
  overflow: hidden;
  background: var(--facility-bg);
}

/* SCENE PANEL - Main Display Terminal */
#scenePanel {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
  min-width: 0;
}

/* SCENE CONTENT - Primary Data Feed */
#sceneContent {
  background: var(--facility-bg-panel);
  border: 2px solid var(--facility-border);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  overflow: visible;
  max-height: none;
  box-shadow: var(--shadow-lg);
  position: relative;
}

#sceneContent::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg,
    rgba(45, 212, 191, 0.02) 0%,
    transparent 25%,
    transparent 75%,
    rgba(124, 58, 237, 0.02) 100%);
  pointer-events: none;
  border-radius: var(--radius-lg);
}

#sceneContent h2 {
  margin: 0 0 var(--space-lg) 0;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--facility-text);
  border-bottom: 2px solid var(--ultrachroma-teal);
  padding-bottom: var(--space-sm);
  font-family: var(--font-secondary);
}

/* TEXT CONTENT - Facility Data Streams */
.entry-text,
.scene-body,
.conditional-content {
  margin-bottom: var(--space-lg);
  line-height: 1.6;
  font-size: 1rem;
  color: var(--facility-text);
}

.paragraph {
  margin: 0 0 1rem;
}

.paragraph:last-child {
  margin-bottom: 0;
}

.entry-text {
  font-style: italic;
  color: var(--facility-text-muted);
  border-left: 3px solid var(--ultrachroma-teal);
  padding-left: var(--space-md);
  background: rgba(45, 212, 191, 0.05);
  padding: var(--space-md);
  border-radius: var(--radius-md);
}

/* SCENE BLOCKS - Structured Narrative */
.scene-block {
  margin-bottom: var(--space-lg);
}

.scene-block:last-child {
  margin-bottom: 0;
}

.scene-block-voice {
  padding: var(--space-md) var(--space-lg);
  border-left: 2px solid rgba(148, 163, 184, 0.4);
  background: rgba(148, 163, 184, 0.06);
  font-family: var(--font-secondary);
  font-size: 0.95rem;
  color: var(--facility-text);
  box-shadow: var(--shadow-sm);
}

.scene-block-label {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 0.65rem;
  color: var(--facility-text-muted);
  margin-bottom: var(--space-sm);
}

.scene-block-speaker {
  font-family: var(--font-secondary);
  font-weight: 600;
  color: var(--facility-text);
}

.scene-block-body .paragraph {
  margin-bottom: 0.8rem;
}

/* CONDITIONAL CONTENT - Dynamic Data Filters */
.conditional-content details {
  background: rgba(16, 185, 129, 0.08);
  border-left: 4px solid var(--ultrachroma-emerald);
  padding: var(--space-md) var(--space-lg);
  margin-bottom: var(--space-md);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.conditional-content details summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--ultrachroma-emerald);
  font-family: var(--font-secondary);
}

.conditional-content details summary:hover {
  color: var(--ultrachroma-emerald-light);
}

/* INLINE DIALOGUE - Scene Conversation Feed */
.scene-dialogue {
  margin-bottom: var(--space-lg);
  padding: var(--space-lg);
  border-radius: var(--radius-lg);
  border: 1px solid rgba(45, 212, 191, 0.35);
  background: linear-gradient(135deg,
    rgba(45, 212, 191, 0.08) 0%,
    rgba(17, 17, 24, 0.95) 60%,
    rgba(10, 10, 15, 0.98) 100%);
  box-shadow: var(--shadow-sm);
}

.scene-dialogue-channel {
  border-color: rgba(124, 58, 237, 0.35);
  background: linear-gradient(135deg,
    rgba(124, 58, 237, 0.08) 0%,
    rgba(17, 17, 24, 0.95) 60%,
    rgba(10, 10, 15, 0.98) 100%);
}

.scene-dialogue h3 {
  margin: 0 0 var(--space-md);
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--ultrachroma-teal-light);
  font-family: var(--font-primary);
}

.scene-dialogue-channel h3 {
  color: var(--ultrachroma-violet-light);
}

.channel-view #sceneContent > :not(#sceneChannelDialogue) {
  display: none !important;
}

.channel-view #sceneContent {
  max-height: none;
}

.channel-view #sceneChannelDialogue {
  margin-bottom: 0;
}

.channel-view #choicesSection h3 {
  display: none;
}

.channel-view #sceneChoicesSection {
  display: none;
}

.channel-view #dialogueChoicesSection {
  border-color: rgba(124, 58, 237, 0.35);
  background: rgba(124, 58, 237, 0.08);
}

.channel-view #dialogueChoicesSection h4 {
  color: var(--ultrachroma-violet-light);
}

.scene-dialogue-thread {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.scene-dialogue-line {
  display: flex;
  gap: var(--space-md);
  align-items: flex-start;
  padding: var(--space-md);
  border-radius: var(--radius-md);
  border: 1px solid var(--facility-border);
  background: var(--facility-bg-elevated);
  box-shadow: var(--shadow-sm);
  position: relative;
}

.scene-dialogue-line::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  border-radius: var(--radius-md) 0 0 var(--radius-md);
  background: var(--ultrachroma-teal);
}

.scene-dialogue-channel .scene-dialogue-line::before {
  background: var(--ultrachroma-violet);
}

.scene-dialogue-line.active {
  border-color: rgba(16, 185, 129, 0.6);
  box-shadow: var(--shadow-glow-emerald);
}

.scene-dialogue-line.active::before {
  background: var(--ultrachroma-emerald);
}

.scene-dialogue-line.interjection {
  border-color: rgba(124, 58, 237, 0.5);
  background: rgba(124, 58, 237, 0.08);
}

.scene-dialogue-line.interjection::before {
  background: var(--ultrachroma-violet);
}

.scene-dialogue-portrait {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  border: 1px solid var(--facility-border);
  background: var(--facility-bg-panel);
  color: var(--facility-text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-primary);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  flex: 0 0 auto;
}

.scene-dialogue-portrait.has-image {
  background-size: cover;
  background-position: center;
  color: transparent;
}

.scene-dialogue-content {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  flex: 1 1 auto;
  min-width: 0;
}

.scene-dialogue-name {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.35px;
  color: var(--facility-text-muted);
  font-family: var(--font-primary);
}

.scene-dialogue-name.has-channel {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.scene-dialogue-text {
  font-size: 1rem;
  color: var(--facility-text);
  line-height: 1.6;
}

.scene-dialogue-status {
  margin-top: var(--space-sm);
  font-size: 0.85rem;
  color: var(--facility-text-muted);
  font-family: var(--font-primary);
}

.scene-dialogue-actions {
  margin-top: var(--space-md);
  display: flex;
  justify-content: flex-end;
  gap: var(--space-sm);
  flex-wrap: wrap;
}

/* DEBUG CHECKS - Scene-level diagnostics */
.debug-checks {
  margin-bottom: var(--space-lg);
  padding: var(--space-lg);
  border-radius: var(--radius-md);
  border: 1px solid rgba(124, 58, 237, 0.35);
  background: rgba(124, 58, 237, 0.08);
  box-shadow: var(--shadow-sm);
}

.debug-checks h4 {
  margin: 0 0 var(--space-md);
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--ultrachroma-violet-light);
}

.debug-check-group {
  margin-bottom: var(--space-md);
}

.debug-check-group h5 {
  margin: 0 0 var(--space-sm);
  font-size: 0.85rem;
  color: var(--facility-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.debug-check-group ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.debug-check {
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-md);
  border: 1px solid var(--facility-border);
  background: var(--facility-bg-elevated);
  font-family: var(--font-primary);
  font-size: 0.85rem;
  color: var(--facility-text);
}

.debug-check.pass {
  border-color: rgba(16, 185, 129, 0.6);
  background: rgba(16, 185, 129, 0.12);
}

.debug-check.fail {
  border-color: rgba(220, 38, 38, 0.6);
  background: rgba(220, 38, 38, 0.12);
}

.debug-check.empty {
  border-style: dashed;
  color: var(--facility-text-muted);
}

.debug-check-title {
  font-weight: 600;
  margin-bottom: var(--space-xs);
}

.debug-check-reason {
  color: var(--facility-text-muted);
}

/* SCENE NOTES - Debug Metadata */
.scene-notes {
  border-top: 2px dashed var(--facility-border);
  padding-top: var(--space-lg);
  margin-top: var(--space-lg);
  line-height: 1.5;
  color: var(--facility-text-dim);
  font-size: 0.9rem;
  font-family: var(--font-primary);
}

.scene-notes ul {
  margin: var(--space-sm) 0 0;
  padding-left: var(--space-lg);
}

/* STASH INFO - Inventory Management */
.stash-info {
  border-top: 2px dashed var(--facility-border);
  padding-top: var(--space-lg);
  margin-top: var(--space-lg);
  color: var(--facility-text-muted);
  font-size: 0.9rem;
  background: rgba(220, 38, 38, 0.05);
  padding: var(--space-lg);
  border-radius: var(--radius-md);
  border: 1px solid rgba(220, 38, 38, 0.2);
}

.stash-info ul {
  margin: var(--space-sm) 0 0;
  padding-left: var(--space-lg);
}

.stash-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.stash-entry {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  background: var(--facility-bg-elevated);
  border: 1px solid var(--facility-border);
  border-radius: var(--radius-md);
  padding: var(--space-sm) var(--space-md);
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-normal);
}

.stash-entry:hover {
  background: var(--facility-bg-panel);
  border-color: var(--ultrachroma-emerald);
  box-shadow: var(--shadow-glow-emerald);
}

.stash-entry span {
  flex: 1 1 auto;
  min-width: 0;
  color: var(--facility-text);
  font-size: 0.9rem;
  font-weight: 500;
}

/* CHOICES SECTION - Command Options Terminal */
#choicesSection {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  margin-left: calc(-1 * var(--space-xl));
  margin-right: calc(-1 * var(--space-xl));
  padding-left: var(--space-md);
  padding-right: var(--space-md);
}

#choicesSection h3 {
  margin: 0 0 var(--space-md) 0;
  font-size: 1rem;
  font-weight: 700;
  color: var(--facility-text);
  border-bottom: 2px solid var(--ultrachroma-teal);
  padding-bottom: var(--space-xs);
  font-family: var(--font-secondary);
}

.dialogue-choices-section {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  margin-top: var(--space-md);
  padding-top: var(--space-md);
  border-top: 1px solid var(--facility-border);
}

.scene-choices-section {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.choice-gate-notice {
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-md);
  border: 1px solid rgba(220, 38, 38, 0.6);
  background: rgba(220, 38, 38, 0.15);
  color: var(--ultrachroma-crimson-light);
  font-size: 0.85rem;
  font-family: var(--font-primary);
}

/* CHOICE LIST - Available Commands */
.choices-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.choices-list .empty {
  text-align: center;
  color: var(--facility-text-muted);
  font-style: italic;
  padding: var(--space-xl);
  background: var(--facility-bg-elevated);
  border-radius: var(--radius-md);
  border: 1px dashed var(--facility-border);
}

/* CHOICE ITEMS - Command Interfaces */
.choice-item {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  background: var(--facility-bg-elevated);
  border: 2px solid var(--facility-border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  transition: all var(--transition-normal);
  box-shadow: var(--shadow-sm);
  position: relative;
}

.choice-item::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 4px;
  background: var(--ultrachroma-teal);
  border-radius: var(--radius-lg) 0 0 var(--radius-lg);
  transition: background-color var(--transition-normal);
}

.choice-item.disabled {
  opacity: 0.5;
  border-color: var(--ultrachroma-crimson-dark);
}

.choice-item.disabled::before {
  background: var(--ultrachroma-crimson);
}

.choice-item:hover:not(.disabled) {
  border-color: var(--ultrachroma-emerald);
  box-shadow: var(--shadow-glow-emerald);
  transform: translateY(-2px);
}

.choice-item:hover:not(.disabled)::before {
  background: var(--ultrachroma-emerald);
}

/* Dialogue choice items use icon indicator instead of left bar */
.dialogue-choice-item {
  flex-direction: row;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-sm) var(--space-md);
  border-left: none;
}

.dialogue-choice-item::before {
  content: 'I';
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  font-size: 0.85rem;
  font-weight: 700;
  font-family: var(--font-primary);
  background: var(--ultrachroma-emerald);
  color: var(--facility-bg);
  border-radius: 50%;
  flex-shrink: 0;
  position: static;
}

.dialogue-choice-item[data-channel="external"]::before {
  content: 'E';
  background: var(--ultrachroma-teal);
}

.dialogue-choice-item[data-channel="anomaly"]::before {
  content: '?';
  background: var(--ultrachroma-violet);
}

.dialogue-choice-item .choice-button {
  flex: 1;
  background: var(--facility-bg-elevated);
  border-color: var(--facility-border);
  color: var(--facility-text);
  text-align: left;
}

.dialogue-choice-item .choice-button:hover:not(:disabled) {
  background: var(--facility-bg-panel);
  border-color: var(--ultrachroma-emerald);
  color: var(--facility-text);
}

.dialogue-choice-item[data-channel="external"] .choice-button:hover:not(:disabled) {
  border-color: var(--ultrachroma-teal);
}

.dialogue-choice-item[data-channel="anomaly"] .choice-button:hover:not(:disabled) {
  border-color: var(--ultrachroma-violet);
}

.dialogue-choice-item .choice-meta {
  display: none;
}

/* CHOICE BUTTON - Execute Command */
.choice-button {
  align-self: flex-start;
  background: var(--ultrachroma-teal-dark);
  color: var(--ultrachroma-teal-light);
  border: 2px solid var(--ultrachroma-teal-dark);
  border-radius: var(--radius-md);
  padding: var(--space-sm) var(--space-lg);
  font-size: 0.9rem;
  font-weight: 600;
  font-family: var(--font-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.choice-button:hover:not(:disabled) {
  background: var(--ultrachroma-teal);
  color: var(--facility-bg);
  box-shadow: var(--shadow-glow-teal);
}

/* CHOICE METADATA - Requirements & Effects */
.choice-meta {
  font-size: 0.9rem;
  color: var(--facility-text-muted);
  line-height: 1.5;
  font-family: var(--font-primary);
}

.choice-meta span {
  display: inline-block;
  margin-right: var(--space-md);
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 500;
}

.choice-meta .requires {
  background: rgba(220, 38, 38, 0.2);
  color: var(--ultrachroma-crimson-light);
  border: 1px solid var(--ultrachroma-crimson);
}

.choice-meta .effects {
  background: rgba(16, 185, 129, 0.2);
  color: var(--ultrachroma-emerald-light);
  border: 1px solid var(--ultrachroma-emerald);
}

/* DIALOGUE OVERLAY - Comms and Passenger Threads */
.dialogue-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 10, 15, 0.78);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-xl);
  z-index: 50;
}

.dialogue-panel {
  width: min(900px, 100%);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  background: var(--facility-bg-panel);
  border: 2px solid var(--facility-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.dialogue-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-lg);
  padding: var(--space-lg) var(--space-xl);
  background: var(--facility-bg-elevated);
  border-bottom: 1px solid var(--facility-border);
}

.dialogue-title h3 {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--facility-text);
}

.dialogue-subtitle {
  margin: var(--space-xs) 0 0;
  font-size: 0.85rem;
  color: var(--facility-text-muted);
  font-family: var(--font-primary);
}

.dialogue-controls {
  display: flex;
  gap: var(--space-sm);
  flex-wrap: wrap;
}

.dialogue-menu,
.dialogue-thread {
  padding: var(--space-xl);
  overflow-y: auto;
}

/* DEBUG-ONLY SIDEBAR SECTIONS */
.debug-only {
  display: none;
}

.debug-only.is-visible {
  display: block;
}

/* INVENTORY OVERLAY */
.inventory-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 10, 15, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-xl);
  z-index: 45;
}

.inventory-panel {
  width: min(720px, 100%);
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  background: var(--facility-bg-panel);
  border: 2px solid var(--facility-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.inventory-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-lg);
  padding: var(--space-lg) var(--space-xl);
  background: var(--facility-bg-elevated);
  border-bottom: 1px solid var(--facility-border);
}

.inventory-title h3 {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--facility-text);
}

.inventory-subtitle {
  margin: var(--space-xs) 0 0;
  font-size: 0.85rem;
  color: var(--facility-text-muted);
  font-family: var(--font-primary);
}

.inventory-controls {
  display: flex;
  gap: var(--space-sm);
  flex-wrap: wrap;
}

.inventory-body {
  padding: var(--space-xl);
  overflow-y: auto;
}

/* STATE OVERLAY */
.state-overlay {
  position: fixed;
  inset: 0;
  background: rgba(8, 12, 18, 0.78);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-xl);
  z-index: 44;
}

.state-panel {
  width: min(640px, 100%);
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  background: var(--facility-bg-panel);
  border: 2px solid var(--facility-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.state-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-lg);
  padding: var(--space-lg) var(--space-xl);
  background: var(--facility-bg-elevated);
  border-bottom: 1px solid var(--facility-border);
}

.state-title h3 {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--facility-text);
}

.state-subtitle {
  margin: var(--space-xs) 0 0;
  font-size: 0.85rem;
  color: var(--facility-text-muted);
  font-family: var(--font-primary);
}

.state-controls {
  display: flex;
  gap: var(--space-sm);
  flex-wrap: wrap;
}

.state-body {
  padding: var(--space-xl);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.state-empty {
  margin: 0;
  color: var(--facility-text-muted);
  font-style: italic;
}

.state-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.state-entry {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  padding: var(--space-md);
  border-radius: var(--radius-md);
  border: 1px solid var(--facility-border);
  background: var(--facility-bg-elevated);
  box-shadow: var(--shadow-sm);
}

.state-info {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.state-name {
  font-weight: 700;
  font-size: 1rem;
  color: var(--facility-text);
}

.state-meta {
  font-size: 0.8rem;
  color: var(--facility-text-muted);
  font-family: var(--font-primary);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.state-action {
  border-radius: 999px;
  padding: var(--space-xs) var(--space-lg);
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--ultrachroma-teal-dark);
  color: var(--ultrachroma-teal-light);
  border: 1px solid var(--ultrachroma-teal-dark);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.state-action:disabled {
  opacity: 0.6;
  background: var(--facility-border);
  color: var(--facility-text-dim);
  border-color: var(--facility-border);
}

.dialogue-menu h4 {
  margin: 0 0 var(--space-md);
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--facility-text-muted);
}

.dialogue-menu-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.dialogue-menu-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: var(--space-md);
  align-items: center;
  padding: var(--space-md);
  border-radius: var(--radius-md);
  background: var(--facility-bg-elevated);
  border: 1px solid var(--facility-border);
  box-shadow: var(--shadow-sm);
  position: relative;
}

.dialogue-menu-item.locked {
  opacity: 0.6;
}

.dialogue-menu-item[data-mode="dialogue"] {
  border-left: 4px solid var(--ultrachroma-teal);
}

.dialogue-menu-item[data-mode="inner"] {
  border-left: 4px solid var(--ultrachroma-emerald);
}

.dialogue-menu-item[data-mode="anomaly"] {
  border-left: 4px solid var(--ultrachroma-violet);
}

.dialogue-menu-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1px solid var(--facility-border);
  background: var(--facility-bg-panel);
  color: var(--facility-text-muted);
  font-family: var(--font-primary);
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.dialogue-menu-avatar.has-image {
  background-size: cover;
  background-position: center;
  color: transparent;
}

.dialogue-menu-info {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.dialogue-menu-name {
  font-size: 1rem;
  font-weight: 700;
  color: var(--facility-text);
}

.dialogue-menu-meta {
  font-size: 0.85rem;
  color: var(--facility-text-muted);
  font-family: var(--font-primary);
}

.dialogue-menu-reason {
  font-size: 0.8rem;
  color: var(--ultrachroma-crimson-light);
}

.dialogue-menu-action {
  border-radius: 999px;
  padding: var(--space-xs) var(--space-md);
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--ultrachroma-teal-dark);
  color: var(--ultrachroma-teal-light);
  border: 1px solid var(--ultrachroma-teal-dark);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.dialogue-menu-action:disabled {
  opacity: 0.6;
  background: var(--facility-border);
  color: var(--facility-text-dim);
  border-color: var(--facility-border);
}

.dialogue-empty {
  margin: var(--space-md) 0 0;
  font-style: italic;
  color: var(--facility-text-muted);
}

.dialogue-thread {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
  border-left: 4px solid var(--ultrachroma-teal);
  background: rgba(45, 212, 191, 0.04);
}

.dialogue-thread.mode-inner {
  border-left-color: var(--ultrachroma-emerald);
  background: rgba(16, 185, 129, 0.06);
}

.dialogue-thread.mode-anomaly {
  border-left-color: var(--ultrachroma-violet);
  background: rgba(124, 58, 237, 0.08);
}

.dialogue-speaker {
  display: flex;
  gap: var(--space-md);
  align-items: center;
}

.dialogue-portrait {
  width: 64px;
  height: 64px;
  border-radius: 12px;
  border: 1px solid var(--facility-border);
  background: var(--facility-bg-elevated);
  color: var(--facility-text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-primary);
  font-weight: 700;
  font-size: 1.1rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.dialogue-portrait.has-image {
  background-size: cover;
  background-position: center;
  color: transparent;
}

.dialogue-speaker-meta {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.dialogue-speaker-name {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--facility-text);
}

.dialogue-speaker-kind,
.dialogue-speaker-rep {
  font-size: 0.85rem;
  color: var(--facility-text-muted);
  font-family: var(--font-primary);
}

.dialogue-speaker-channel {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.dialogue-text {
  font-size: 1rem;
  line-height: 1.6;
}

.dialogue-interjections {
  border-left: 3px solid var(--ultrachroma-violet);
  padding-left: var(--space-md);
  background: rgba(124, 58, 237, 0.08);
  border-radius: var(--radius-md);
}

.dialogue-interjections h4 {
  margin: 0 0 var(--space-sm);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--ultrachroma-violet-light);
}

.dialogue-interjection {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  padding: var(--space-sm) 0;
}

.dialogue-interjection-speaker {
  font-size: 0.8rem;
  color: var(--facility-text-muted);
  font-family: var(--font-primary);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.dialogue-interjection-speaker.has-channel {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.dialogue-interjection-text {
  font-size: 0.95rem;
  color: var(--facility-text);
}

.dialogue-choices {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.choice-button.has-channel,
.dialogue-choice-button.has-channel {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
}

.choice-label {
  display: inline-block;
}

/* Hide channel badge inside buttons - icon is shown on the choice item */
.choice-button .channel-badge,
.dialogue-choice-button .channel-badge {
  display: none;
}

.channel-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 6px;
  border-radius: 999px;
  font-size: 0.65rem;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  border: 1px solid transparent;
  font-family: var(--font-primary);
}

.channel-badge.compact {
  font-size: 0.6rem;
  padding: 2px 5px;
}

.channel-badge.is-internal {
  background: rgba(16, 185, 129, 0.16);
  color: var(--ultrachroma-emerald-light);
  border-color: rgba(16, 185, 129, 0.35);
}

.channel-badge.is-internal::before {
  content: 'I';
  font-weight: 700;
}

.channel-badge.is-external {
  background: rgba(45, 212, 191, 0.16);
  color: var(--ultrachroma-teal-light);
  border-color: rgba(45, 212, 191, 0.35);
}

.channel-badge.is-external::before {
  content: 'E';
  font-weight: 700;
}

.channel-badge.is-anomaly {
  background: rgba(124, 58, 237, 0.2);
  color: var(--ultrachroma-violet-light);
  border-color: rgba(124, 58, 237, 0.4);
}

.channel-badge.is-anomaly::before {
  content: '?';
  font-weight: 700;
}

.dialogue-choice-button {
  align-self: flex-start;
  background: var(--ultrachroma-emerald-dark);
  color: var(--ultrachroma-emerald-light);
  border: 1px solid var(--ultrachroma-emerald-dark);
  border-radius: var(--radius-md);
  padding: var(--space-sm) var(--space-lg);
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.dialogue-choice-button:hover:not(:disabled) {
  background: var(--ultrachroma-emerald);
  color: var(--facility-bg);
  box-shadow: var(--shadow-glow-emerald);
}

.dialogue-choice-description {
  font-size: 0.85rem;
  color: var(--facility-text-muted);
  font-family: var(--font-primary);
  margin-left: var(--space-md);
}

.dialogue-actions {
  display: flex;
  justify-content: flex-end;
}

/* SIDEBAR - System Status Terminal */
#sidebar {
  width: min(28rem, 35%);
  flex: 0 0 auto;
  align-self: flex-start;
  background: var(--facility-bg-panel);
  border: 2px solid var(--facility-border);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  display: flex;
  flex-direction: column;
  gap: var(--space-xl);
  box-shadow: var(--shadow-lg);
  position: relative;
}

#sidebar::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg,
    rgba(124, 58, 237, 0.02) 0%,
    transparent 50%,
    rgba(45, 212, 191, 0.02) 100%);
  pointer-events: none;
  border-radius: var(--radius-lg);
}

#sidebar h3 {
  margin: 0 0 var(--space-md) 0;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--facility-text);
  border-bottom: 2px solid var(--ultrachroma-violet);
  padding-bottom: var(--space-xs);
  font-family: var(--font-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.audio-section {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.audio-shell {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  padding: var(--space-sm);
  background: var(--facility-bg-elevated);
  border: 1px solid var(--facility-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.audio-player-stack {
  position: relative;
  width: 100%;
  height: 120px;
}

.audio-frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--facility-bg);
  opacity: 0;
  transition: opacity 0.25s ease;
}

.audio-frame.is-active {
  opacity: 1;
  z-index: 2;
}

.audio-frame.is-hidden {
  opacity: 0;
  pointer-events: none;
  z-index: 1;
}

.audio-status {
  font-size: 0.85rem;
  color: var(--facility-text-muted);
  font-family: var(--font-primary);
}

/* SESSION DETAILS - Current System State */
.session-details {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: var(--space-sm) var(--space-lg);
  font-size: 0.95rem;
  font-family: var(--font-primary);
  background: var(--facility-bg-elevated);
  padding: var(--space-md);
  border-radius: var(--radius-md);
  border: 1px solid var(--facility-border);
}

.session-details dt {
  font-weight: 600;
  color: var(--facility-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-size: 0.8rem;
}

.session-details dd {
  margin: 0;
  color: var(--facility-text);
  font-weight: 500;
}

/* SUMMARY LISTS - Flags & Items */
.summary-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
}

.summary-list li {
  background: var(--ultrachroma-teal-dark);
  color: var(--ultrachroma-teal-light);
  border-radius: 999px;
  padding: var(--space-xs) var(--space-md);
  font-size: 0.8rem;
  font-weight: 500;
  font-family: var(--font-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  box-shadow: var(--shadow-sm);
}

.summary-list li.empty {
  background: transparent;
  border: 2px dashed var(--facility-border);
  color: var(--facility-text-dim);
  font-style: italic;
  opacity: 0.6;
}

/* INVENTORY ENTRIES - Item Management */
.summary-list li.inventory-entry {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  border-radius: var(--radius-md);
  padding: var(--space-sm) var(--space-md);
  background: var(--facility-bg-elevated);
  border: 1px solid var(--facility-border);
  color: var(--facility-text);
  font-size: 0.85rem;
  font-weight: 500;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-normal);
}

.summary-list li.inventory-entry:hover {
  background: var(--facility-bg-panel);
  border-color: var(--ultrachroma-emerald);
  box-shadow: var(--shadow-glow-emerald);
}

.summary-list li.inventory-entry span {
  flex: 1 1 auto;
  min-width: 0;
  color: var(--facility-text);
}

/* ITEM ACTIONS - Drop/Retrieve Commands */
.item-action {
  border-radius: 999px;
  padding: var(--space-xs) var(--space-sm);
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--ultrachroma-violet-dark);
  color: var(--ultrachroma-violet-light);
  border: 1px solid var(--ultrachroma-violet-dark);
  cursor: pointer;
  transition: all var(--transition-fast);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.item-action:hover:not(:disabled) {
  background: var(--ultrachroma-violet);
  color: var(--facility-bg);
  box-shadow: var(--shadow-glow-violet);
  transform: scale(1.05);
}

.item-action:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  background: var(--facility-border);
  color: var(--facility-text-dim);
}

/* DEBUG SECTION - Technical Diagnostics */
#debugSection {
  display: none;
  background: var(--facility-bg-elevated);
  border: 2px solid var(--ultrachroma-crimson);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  box-shadow: var(--shadow-glow-crimson);
}

#debugSection.active {
  display: block;
}

#debugSection h3 {
  color: var(--ultrachroma-crimson-light);
  border-bottom-color: var(--ultrachroma-crimson);
}

#debugInfo {
  margin: 0;
  font-family: var(--font-primary);
  font-size: 0.85rem;
  white-space: pre-wrap;
  max-height: 16rem;
  overflow-y: auto;
  background: var(--facility-bg-panel);
  padding: var(--space-md);
  border-radius: var(--radius-md);
  border: 1px solid var(--facility-border);
  color: var(--facility-text);
  line-height: 1.4;
}

.counter-editor {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
}

.counter-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 80px auto;
  gap: var(--space-sm);
  align-items: center;
}

.counter-row label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--facility-text-muted);
}

.counter-row input {
  width: 100%;
  background: var(--facility-bg-panel);
  border: 1px solid var(--facility-border);
  color: var(--facility-text);
  border-radius: var(--radius-sm);
  padding: var(--space-xs) var(--space-sm);
  font-size: 0.85rem;
}

.counter-row button {
  border-radius: 999px;
  padding: var(--space-xs) var(--space-sm);
  font-size: 0.7rem;
  font-weight: 600;
  background: var(--ultrachroma-emerald);
  color: var(--facility-bg);
  border: 1px solid var(--ultrachroma-emerald);
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  transition: all var(--transition-fast);
}

.counter-row button:hover {
  background: var(--ultrachroma-emerald-light);
  box-shadow: var(--shadow-glow-emerald);
}

.hidden {
  display: none !important;
}

.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--facility-text-muted);
  background: var(--facility-bg-elevated);
  border-radius: var(--radius-lg);
  border: 2px dashed var(--facility-border);
}

.empty-state strong {
  display: block;
  font-size: 1.5rem;
  margin-bottom: var(--space-md);
  color: var(--facility-text);
  font-weight: 700;
}

/* ULTRACHROMA STATUS INDICATORS */
.status-adequate { color: var(--status-adequate); }
.status-exceeds { color: var(--status-exceeds); }
.status-error { color: var(--status-error); }
.status-warning { color: var(--status-warning); }
.status-elite { color: var(--status-elite); }
.status-critical { color: var(--status-critical); }

/* FACILITY SCANLINES - Subtle Animation */
@keyframes scanline {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

.facility-scanline::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--ultrachroma-teal), transparent);
  animation: scanline 3s linear infinite;
  pointer-events: none;
}

/* PULSE EFFECTS - For active elements */
@keyframes ultrachroma-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

.ultrachroma-pulse {
  animation: ultrachroma-pulse 2s ease-in-out infinite;
}

/* SCENE TRANSITIONS - Base fade helpers */
@keyframes scene-fade-out {
  from { opacity: 1; }
  to { opacity: 0; }
}

@keyframes scene-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

body.scene-fade-out #app {
  animation: scene-fade-out 0.5s ease-in forwards;
}

body.scene-fade-in #app {
  animation: scene-fade-in 0.5s ease-out;
}

/* GLITCH EFFECTS - For anomalous states */
@keyframes glitch {
  0%, 100% { transform: translate(0); }
  20% { transform: translate(-1px, 1px); }
  40% { transform: translate(-1px, -1px); }
  60% { transform: translate(1px, 1px); }
  80% { transform: translate(1px, -1px); }
}

.glitch-effect {
  animation: glitch 0.3s ease-in-out;
}

@media (max-width: 1100px) {
  main.viewer {
    flex-direction: column;
  }

  #choicesSection {
    max-height: none;
    overflow-y: visible;
  }

  #sidebar {
    width: 100%;
    max-height: none;
  }

  #sceneContent {
    max-height: none;
  }

  #choicesSection {
    max-height: none;
  }

  .dialogue-panel {
    max-height: 95vh;
  }

  .dialogue-menu-item {
    grid-template-columns: auto 1fr;
  }

  .dialogue-menu-action {
    grid-column: 1 / -1;
    justify-self: flex-start;
  }
}
