/* ==========================================================================
   CLARIORA LEVEL 4: THE DATACENTER CRUCIBLE
   Avionics-grade, high-density diagnostic flight simulator styling.
   Zero gamification noise. Pure operational mastery.
   ========================================================================== */

:root {
  --cr-void: #06080D;
  --cr-surface: #0C101A;
  --cr-panel: #121824;
  --cr-card: #161D2E;
  --cr-card-hover: #1D263B;
  --cr-card-active: #232E47;
  
  --cr-border: rgba(56, 189, 248, 0.18);
  --cr-border-subtle: rgba(255, 255, 255, 0.08);
  --cr-border-strong: rgba(56, 189, 248, 0.45);
  
  --cr-cyan: #38BDF8;
  --cr-green: #10B981;
  --cr-amber: #F59E0B;
  --cr-red: #EF4444;
  --cr-purple: #A855F7;
  
  --cr-text-main: #F1F5F9;
  --cr-text-muted: #94A3B8;
  --cr-text-dim: #64748B;
  
  --cr-font-mono: "JetBrains Mono", "SF Mono", "Consolas", "Courier New", monospace;
  --cr-shadow-panel: 0 4px 20px rgba(0, 0, 0, 0.65), 0 0 0 1px var(--cr-border);
}

/* Crucible Active Viewport Modifications */
body.crucible-active {
  background-color: var(--cr-void);
  background-image: 
    linear-gradient(rgba(56, 189, 248, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(56, 189, 248, 0.03) 1px, transparent 1px);
  background-size: 32px 32px;
  color: var(--cr-text-main);
}

body.crucible-active header {
  background: rgba(8, 12, 20, 0.92);
  border-bottom: 1px solid var(--cr-border);
  backdrop-filter: blur(12px);
}

/* Crucible Mode Status Indicator in Header */
.crucible-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.25rem 0.65rem;
  border-radius: 4px;
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid var(--cr-border-strong);
  color: var(--cr-cyan);
  font-family: var(--cr-font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.crucible-badge::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: var(--cr-cyan);
  box-shadow: 0 0 8px var(--cr-cyan);
  animation: cr-pulse 2s infinite ease-in-out;
}

@keyframes cr-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
}

/* PACING HORIZON BAR (Exam Toolbar) */
.pacing-horizon-container {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 220px;
  background: var(--cr-panel);
  border: 1px solid var(--cr-border);
  padding: 0.45rem 0.85rem;
  border-radius: 6px;
  font-family: var(--cr-font-mono);
}

.pacing-horizon-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.pacing-label {
  color: var(--cr-text-muted);
}

.pacing-reserve-val {
  font-weight: 700;
}

.pacing-reserve-val.nominal {
  color: var(--cr-green);
}

.pacing-reserve-val.lagging {
  color: var(--cr-amber);
}

.pacing-reserve-val.critical {
  color: var(--cr-red);
}

.pacing-track {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 3px;
  overflow: hidden;
  position: relative;
}

.pacing-fill {
  height: 100%;
  width: 50%;
  transition: width 0.3s ease, background-color 0.3s ease;
  border-radius: 3px;
}

.pacing-fill.nominal {
  background: linear-gradient(90deg, #059669, #10B981);
}

.pacing-fill.lagging {
  background: linear-gradient(90deg, #D97706, #F59E0B);
}

.pacing-fill.critical {
  background: linear-gradient(90deg, #DC2626, #EF4444);
}

/* DIAGNOSTIC COMMITMENT GATE (Question Choices) */
.crucible-option-wrapper {
  position: relative;
  display: flex;
  align-items: stretch;
  gap: 0.5rem;
}

.option-item.eliminated {
  opacity: 0.42;
  text-decoration: line-through;
  filter: grayscale(0.85);
  background: rgba(15, 20, 30, 0.4) !important;
  border-color: rgba(255, 255, 255, 0.05) !important;
}

.crucible-strike-btn {
  background: var(--cr-panel);
  border: 1px solid var(--cr-border);
  color: var(--cr-text-muted);
  border-radius: 6px;
  padding: 0 0.65rem;
  font-family: var(--cr-font-mono);
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  white-space: nowrap;
}

.crucible-strike-btn:hover {
  background: var(--cr-card-hover);
  color: var(--cr-cyan);
  border-color: var(--cr-cyan);
}

.crucible-strike-btn.struck {
  background: rgba(239, 68, 68, 0.15);
  border-color: var(--cr-red);
  color: #FCA5A5;
}

.flaw-tag {
  display: inline-block;
  font-size: 0.68rem;
  padding: 0.15rem 0.4rem;
  border-radius: 3px;
  background: rgba(239, 68, 68, 0.2);
  color: #F87171;
  font-family: var(--cr-font-mono);
  margin-left: 0.5rem;
  text-decoration: none !important;
}

/* RESULTS: INSTINCT & BEHAVIORAL AUDIT CARD */
.crucible-audit-panel {
  background: var(--cr-panel);
  border: 1px solid var(--cr-border);
  border-radius: 8px;
  padding: 1.5rem;
  margin: 1.5rem 0;
  box-shadow: var(--cr-shadow-panel);
}

.crucible-audit-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--cr-border-subtle);
  padding-bottom: 0.75rem;
  margin-bottom: 1.25rem;
}

.crucible-audit-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--cr-cyan);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.crucible-audit-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.crucible-audit-stat {
  background: var(--cr-card);
  border: 1px solid var(--cr-border-subtle);
  border-radius: 6px;
  padding: 0.9rem;
}

.crucible-audit-stat-label {
  font-size: 0.75rem;
  font-family: var(--cr-font-mono);
  color: var(--cr-text-muted);
  text-transform: uppercase;
  margin-bottom: 0.25rem;
}

.crucible-audit-stat-value {
  font-size: 1.45rem;
  font-weight: 800;
  font-family: var(--cr-font-mono);
  color: var(--cr-text-main);
}

.crucible-audit-stat-sub {
  font-size: 0.75rem;
  color: var(--cr-text-dim);
  margin-top: 0.2rem;
}

.crucible-psych-verdict {
  background: rgba(56, 189, 248, 0.08);
  border-left: 3px solid var(--cr-cyan);
  padding: 0.85rem 1.1rem;
  border-radius: 0 6px 6px 0;
  font-size: 0.92rem;
  line-height: 1.55;
  color: var(--cr-text-main);
}

.cr-text-red {
  color: var(--cr-red);
}

.cr-text-green {
  color: var(--cr-green);
}

.post-mortem-total-label {
  font-family: var(--cr-font-mono);
  font-size: 0.82rem;
  color: var(--cr-text-muted);
}

/* RESULTS: 4-QUADRANT ROOT-CAUSE INCIDENT POST-MORTEM */
.post-mortem-section {
  background: var(--cr-panel);
  border: 1px solid var(--cr-border);
  border-radius: 8px;
  padding: 1.5rem;
  margin: 1.5rem 0;
  box-shadow: var(--cr-shadow-panel);
}

.post-mortem-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
  border-bottom: 1px solid var(--cr-border-subtle);
  padding-bottom: 0.75rem;
}

.post-mortem-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--cr-text-main);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.post-mortem-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

@media (max-width: 768px) {
  .post-mortem-grid {
    grid-template-columns: 1fr;
  }
}

.post-mortem-quadrant {
  background: var(--cr-card);
  border: 1px solid var(--cr-border-subtle);
  border-radius: 6px;
  padding: 1.1rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}

.post-mortem-quadrant::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
}

.quadrant-knowledge::before { background: var(--cr-cyan); }
.quadrant-misread::before { background: var(--cr-amber); }
.quadrant-pacing::before { background: var(--cr-purple); }
.quadrant-doubt::before { background: var(--cr-red); }

.quadrant-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.65rem;
}

.quadrant-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--cr-text-main);
}

.quadrant-count {
  font-family: var(--cr-font-mono);
  font-size: 1.25rem;
  font-weight: 800;
}

.quadrant-knowledge .quadrant-count { color: var(--cr-cyan); }
.quadrant-misread .quadrant-count { color: var(--cr-amber); }
.quadrant-pacing .quadrant-count { color: var(--cr-purple); }
.quadrant-doubt .quadrant-count { color: var(--cr-red); }

.quadrant-desc {
  font-size: 0.82rem;
  color: var(--cr-text-muted);
  line-height: 1.45;
  margin-bottom: 1rem;
}

.quadrant-action-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--cr-border);
  color: var(--cr-cyan);
  font-family: var(--cr-font-mono);
  font-size: 0.78rem;
  padding: 0.45rem 0.85rem;
  border-radius: 4px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  transition: all 0.15s ease;
  text-decoration: none;
}

.quadrant-action-btn:hover {
  background: rgba(56, 189, 248, 0.15);
  border-color: var(--cr-cyan);
  color: #FFFFFF;
}

/* Crucible Mode Toggle Switch */
.crucible-switch-container {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.35rem 0.75rem;
  background: rgba(18, 24, 36, 0.8);
  border: 1px solid var(--cr-border);
  border-radius: 20px;
  cursor: pointer;
  user-select: none;
}

.crucible-switch-label {
  font-size: 0.78rem;
  font-family: var(--cr-font-mono);
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--cr-text-muted);
  text-transform: uppercase;
}

.crucible-switch-container.active .crucible-switch-label {
  color: var(--cr-cyan);
}

.crucible-switch-pill {
  width: 32px;
  height: 18px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 9px;
  position: relative;
  transition: background 0.2s ease;
}

.crucible-switch-container.active .crucible-switch-pill {
  background: var(--cr-cyan);
}

.crucible-switch-dot {
  width: 14px;
  height: 14px;
  background: #FFFFFF;
  border-radius: 50%;
  position: absolute;
  top: 2px;
  left: 2px;
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.crucible-switch-container.active .crucible-switch-dot {
  transform: translateX(14px);
}
