/* ==========================================================================
   Staff-Level Distributed Algorithms & Architecture - Premium Stylesheet
   ========================================================================== */

:root {
  --bg-primary: #070b14;
  --bg-secondary: #0d1527;
  --bg-card: rgba(15, 23, 42, 0.78);
  --bg-card-hover: rgba(23, 37, 66, 0.9);
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(99, 102, 241, 0.5);
  --border-accent: rgba(139, 92, 246, 0.3);

  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-accent: #818cf8;

  --color-primary: #6366f1;
  --color-primary-glow: rgba(99, 102, 241, 0.25);
  --color-success: #10b981;
  --color-success-bg: rgba(16, 185, 129, 0.12);
  --color-warning: #f59e0b;
  --color-warning-bg: rgba(245, 158, 11, 0.12);
  --color-danger: #ef4444;
  --color-danger-bg: rgba(239, 68, 68, 0.12);
  --color-purple: #8b5cf6;
  --color-cyan: #06b6d4;

  --font-heading: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --font-body: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 30px -10px rgba(0, 0, 0, 0.7);
  --shadow-glow: 0 0 35px -5px rgba(99, 102, 241, 0.2);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --transition-fast: 0.18s ease;
  --transition-normal: 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  --empty-title: #cbd5e1;
  --tlabel-why: #fbbf24;
  --tlabel-how: #60a5fa;
  --tlabel-break: #f87171;
  --sum-name: #ffffff;
  --sum-ds: #cbd5e1;
  --sum-edge: #fca5a5;
  --sum-tag: #a7f3d0;
}

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

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  position: relative;
  overflow-x: hidden;
  min-height: 100vh;
}

/* Background Ambient Glows */
body::before {
  content: '';
  position: fixed;
  top: -150px;
  left: 20%;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.12) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

body::after {
  content: '';
  position: fixed;
  bottom: -200px;
  right: 10%;
  width: 700px;
  height: 700px;
  background: radial-gradient(circle, rgba(16, 185, 129, 0.08) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

/* App Container */
.app-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem 1.5rem 6rem;
  position: relative;
  z-index: 1;
}

/* Header & Hero */
.hero-header {
  margin-bottom: 2.5rem;
  text-align: center;
}

.hero-pill-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 1rem;
  border-radius: 9999px;
  background: rgba(99, 102, 241, 0.12);
  border: 1px solid var(--border-focus);
  color: var(--text-accent);
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 1.25rem;
  letter-spacing: 0.02em;
}

.hero-title {
  font-family: var(--font-heading);
  font-size: clamp(2.2rem, 5vw, 3.5rem);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.03em;
  margin-bottom: 1rem;
  background: linear-gradient(135deg, #ffffff 30%, #94a3b8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-title .highlight {
  background: linear-gradient(135deg, #818cf8 0%, #c084fc 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-subtitle {
  font-size: 1.15rem;
  color: var(--text-secondary);
  max-width: 840px;
  margin: 0 auto 1.75rem;
}

/* Stats Metric Strip */
.stats-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  max-width: 980px;
  margin: 0 auto 2.5rem;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  backdrop-filter: blur(12px);
  text-align: center;
  transition: transform var(--transition-fast), border-color var(--transition-fast);
}

.stat-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-focus);
}

.stat-value {
  font-family: var(--font-heading);
  font-size: 1.6rem;
  font-weight: 700;
  color: #ffffff;
}

.stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 0.25rem;
}

/* Navigation & Controls */
.controls-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  margin-bottom: 2.5rem;
  backdrop-filter: blur(16px);
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.controls-top-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
}

.search-box-wrapper {
  flex: 1;
  min-width: 280px;
  position: relative;
}

.search-input {
  width: 100%;
  padding: 0.75rem 1rem 0.75rem 2.75rem;
  border-radius: var(--radius-md);
  background: rgba(13, 21, 39, 0.85);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.95rem;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.search-input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-glow);
}

.search-icon {
  position: absolute;
  left: 0.95rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

/* View Mode Switcher */
.view-tabs {
  display: flex;
  background: rgba(13, 21, 39, 0.9);
  padding: 0.3rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  gap: 0.25rem;
}

.view-tab-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 0.55rem 1.1rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  transition: all var(--transition-fast);
}

.view-tab-btn:hover {
  color: #ffffff;
}

.view-tab-btn.active {
  background: var(--color-primary);
  color: #ffffff;
  box-shadow: 0 2px 10px rgba(99, 102, 241, 0.4);
}

/* Filter Pills */
.filter-groups {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}

.filter-group-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  margin-right: 0.25rem;
}

.filter-pill {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  padding: 0.35rem 0.85rem;
  border-radius: 9999px;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.filter-pill:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.filter-pill.active {
  background: var(--color-primary-glow);
  border-color: var(--color-primary);
  color: #ffffff;
}

/* ==========================================================================
   Algorithms Cards Grid View
   ========================================================================== */

.algorithms-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2.5rem;
}

.algo-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 2rem;
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow-lg);
  transition: transform var(--transition-normal), border-color var(--transition-normal);
  position: relative;
  overflow: hidden;
}

.algo-card:hover {
  border-color: var(--border-accent);
}

.algo-card-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.algo-title-block {
  flex: 1;
  min-width: 300px;
}

.algo-priority-badge {
  display: inline-block;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  margin-bottom: 0.5rem;
}

.algo-priority-badge.p3 {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #f87171;
}

.algo-priority-badge.p2 {
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.4);
  color: #fbbf24;
}

.algo-priority-badge.p1 {
  background: rgba(59, 130, 246, 0.15);
  border: 1px solid rgba(59, 130, 246, 0.4);
  color: #60a5fa;
}

.algo-title {
  font-family: var(--font-heading);
  font-size: 1.6rem;
  font-weight: 700;
  color: #ffffff;
  line-height: 1.25;
  margin-bottom: 0.4rem;
}

.algo-tagline {
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.algo-meta-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
}

.category-tag {
  background: rgba(99, 102, 241, 0.1);
  color: #a5b4fc;
  border: 1px solid rgba(99, 102, 241, 0.3);
  padding: 0.25rem 0.65rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.system-tag {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  padding: 0.25rem 0.6rem;
  border-radius: 9999px;
  font-size: 0.72rem;
  font-family: var(--font-mono);
}

/* Two Column Layout inside Algo Card */
.algo-card-body {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 2rem;
  margin-top: 1.5rem;
}

@media (max-width: 1024px) {
  .algo-card-body {
    grid-template-columns: 1fr;
  }
}

/* Left Column: Mechanism & Data Structures */
.section-subheading {
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 700;
  color: #ffffff;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.mechanism-list {
  list-style: none;
  margin-bottom: 1.5rem;
}

.mechanism-list li {
  position: relative;
  padding-left: 1.4rem;
  margin-bottom: 0.65rem;
  color: var(--text-secondary);
  font-size: 0.92rem;
}

.mechanism-list li::before {
  content: "➔";
  position: absolute;
  left: 0;
  color: var(--color-primary);
  font-size: 0.85rem;
}

/* Data Structures Used list */
.ds-container {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-bottom: 1.5rem;
}

.ds-item {
  background: rgba(13, 21, 39, 0.6);
  border: 1px solid var(--border-subtle);
  border-left: 3px solid var(--color-primary);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.9rem;
}

.ds-name {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 600;
  color: #38bdf8;
  margin-bottom: 0.2rem;
}

.ds-role {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* Complexity Grid */
.complexity-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 0.6rem;
  margin-bottom: 1.5rem;
}

.complexity-box {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.75rem;
}

.complexity-key {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 0.25rem;
}

.complexity-val {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 600;
  color: #a7f3d0;
}

/* Right Column: Diagram & Alerts */
.algo-diagram-container {
  background: rgba(8, 12, 20, 0.85);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.25rem;
}

.algo-diagram-svg {
  width: 100%;
  max-width: 480px;
  height: auto;
  display: block;
}

/* Edge Case Alert Box */
.edge-cases-alert {
  background: var(--color-danger-bg);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  margin-bottom: 1.25rem;
}

.edge-cases-title {
  color: #fca5a5;
  font-family: var(--font-heading);
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.edge-cases-list {
  list-style: none;
}

.edge-cases-list li {
  font-size: 0.85rem;
  color: #fecaca;
  margin-bottom: 0.5rem;
  position: relative;
  padding-left: 1.1rem;
}

.edge-cases-list li::before {
  content: "⚠";
  position: absolute;
  left: 0;
  font-size: 0.75rem;
}

/* Staff Insights Box */
.staff-insights-box {
  background: rgba(139, 92, 246, 0.08);
  border: 1px solid rgba(139, 92, 246, 0.3);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
}

.staff-insights-title {
  color: #d8b4fe;
  font-family: var(--font-heading);
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.staff-insights-list {
  list-style: none;
}

.staff-insights-list li {
  font-size: 0.85rem;
  color: #e9d5ff;
  margin-bottom: 0.5rem;
  position: relative;
  padding-left: 1.1rem;
}

.staff-insights-list li::before {
  content: "★";
  position: absolute;
  left: 0;
  color: #c084fc;
}

/* ==========================================================================
   Interactive Simulators View
   ========================================================================== */

.simulators-view {
  display: none;
  grid-template-columns: 1fr;
  gap: 2.5rem;
}

.simulators-view.active {
  display: grid;
}

.simulator-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 2rem;
  backdrop-filter: blur(14px);
}

.simulator-header {
  margin-bottom: 1.5rem;
}

.simulator-title {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 0.4rem;
}

.simulator-desc {
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.simulator-stage {
  background: rgba(8, 12, 20, 0.95);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 360px;
  position: relative;
}

.simulator-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.5rem;
  justify-content: center;
}

.sim-btn {
  background: var(--color-primary);
  color: #ffffff;
  border: none;
  padding: 0.65rem 1.25rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
  transition: all var(--transition-fast);
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.sim-btn:hover {
  filter: brightness(1.15);
  transform: translateY(-1px);
}

.sim-btn.secondary {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
}

.sim-btn.secondary:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.14);
}

.sim-btn.danger {
  background: var(--color-danger);
}

/* ==========================================================================
   Executive Summary & Decision Matrix View
   ========================================================================== */

.summary-view {
  display: none;
}

.summary-view.active {
  display: block;
}

.summary-table-container {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  overflow-x: auto;
  margin-bottom: 3rem;
  backdrop-filter: blur(14px);
}

.summary-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.88rem;
}

.summary-table th {
  background: rgba(13, 21, 39, 0.95);
  color: #cbd5e1;
  font-family: var(--font-heading);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-subtle);
  position: sticky;
  top: 0;
  z-index: 10;
}

.summary-table td {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  color: var(--text-secondary);
  vertical-align: top;
}

.summary-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.summary-algo-name {
  font-weight: 600;
  color: #ffffff;
  display: block;
  font-family: var(--font-heading);
}

.code-cell {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: #93c5fd;
}

/* Decision Guide Section */
.decision-matrix-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 2.5rem;
  backdrop-filter: blur(14px);
  margin-bottom: 3rem;
}

.decision-matrix-title {
  font-family: var(--font-heading);
  font-size: 1.6rem;
  font-weight: 800;
  color: #ffffff;
  margin-bottom: 0.5rem;
}

.decision-matrix-subtitle {
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin-bottom: 2rem;
}

.decision-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
  gap: 1.5rem;
}

.decision-card {
  background: rgba(13, 21, 39, 0.7);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  transition: transform var(--transition-fast), border-color var(--transition-fast);
}

.decision-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-focus);
}

.decision-choice-title {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 700;
  color: #60a5fa;
  margin-bottom: 0.75rem;
}

.decision-bullet {
  font-size: 0.88rem;
  color: var(--text-secondary);
  margin-bottom: 0.6rem;
  position: relative;
  padding-left: 1.25rem;
}

.decision-bullet::before {
  content: "✔";
  position: absolute;
  left: 0;
  color: var(--color-success);
  font-size: 0.8rem;
}

.decision-bullet.alt::before {
  content: "✖";
  color: var(--color-danger);
}

/* ==========================================================================
   Friendly Teacher Mode (ELI5) View Styles
   ========================================================================== */

.teacher-view {
  display: none;
  grid-template-columns: 1fr;
  gap: 2.5rem;
}

.teacher-view.active {
  display: grid;
}

.teacher-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 2.25rem;
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow-lg);
  position: relative;
  overflow: hidden;
  transition: transform var(--transition-normal), border-color var(--transition-normal);
}

.teacher-card:hover {
  border-color: rgba(99, 102, 241, 0.4);
}

.teacher-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #6366f1, #a855f7, #ec4899);
}

.teacher-card-header {
  margin-bottom: 1.5rem;
}

.teacher-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  background: rgba(168, 85, 247, 0.12);
  border: 1px solid rgba(168, 85, 247, 0.35);
  color: #d8b4fe;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.6rem;
}

.teacher-card-title {
  font-family: var(--font-heading);
  font-size: 1.65rem;
  font-weight: 800;
  color: #ffffff;
  line-height: 1.25;
  margin-bottom: 0.35rem;
}

.teacher-card-subtitle {
  color: #93c5fd;
  font-size: 1.05rem;
  font-weight: 500;
}

/* Sections inside Teacher Card */
.teacher-section {
  margin-bottom: 1.5rem;
}

.teacher-section-label {
  font-family: var(--font-heading);
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.teacher-problem-box {
  background: rgba(15, 23, 42, 0.6);
  border-left: 3px solid #f59e0b;
  border-radius: var(--radius-sm);
  padding: 1rem 1.25rem;
  color: #cbd5e1;
  font-size: 0.95rem;
  line-height: 1.6;
}

.teacher-analogy-box {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.1) 0%, rgba(168, 85, 247, 0.08) 100%);
  border: 1px solid rgba(139, 92, 246, 0.3);
  border-radius: var(--radius-lg);
  padding: 1.35rem 1.5rem;
  margin-bottom: 1.5rem;
  position: relative;
}

.teacher-analogy-title {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 700;
  color: #e9d5ff;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.teacher-analogy-text {
  color: #f1f5f9;
  font-size: 0.98rem;
  line-height: 1.7;
}

/* Steps list */
.teacher-steps-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-bottom: 1.5rem;
}

.teacher-step-item {
  background: rgba(13, 21, 39, 0.7);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.85rem 1.1rem;
  color: #cbd5e1;
  font-size: 0.92rem;
  line-height: 1.5;
}

/* What Breaks Box */
.teacher-break-box {
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.25);
  border-left: 3px solid #ef4444;
  border-radius: var(--radius-sm);
  padding: 0.9rem 1.2rem;
  color: #fecaca;
  font-size: 0.92rem;
  line-height: 1.6;
  margin-bottom: 1.5rem;
}

/* Golden Takeaway */
.teacher-takeaway-box {
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  color: #a7f3d0;
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.5;
}

.teacher-takeaway-icon {
  font-size: 1.2rem;
  flex-shrink: 0;
  color: #34d399;
}

/* Footer */
.app-footer {
  text-align: center;
  padding-top: 3rem;
  border-top: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-size: 0.85rem;
}

.app-footer a {
  color: var(--text-accent);
  text-decoration: none;
}

.app-footer a:hover {
  text-decoration: underline;
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.fade-in {
  animation: fadeIn 0.35s ease forwards;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .app-container {
    padding: 1.25rem 1rem 4rem;
  }
  .algo-card {
    padding: 1.25rem;
  }
  .controls-top-row {
    flex-direction: column;
    align-items: stretch;
  }
  .view-tabs {
    width: 100%;
    justify-content: center;
  }
  .decision-grid {
    grid-template-columns: 1fr;
  }
}
/* ==========================================================================
   Theme Toggle Button (visible in both themes) + Warm Paper Theme
   Paper palette matches quiz.html: cream bg, charcoal text, terracotta accent.
   Diagram + simulator stages intentionally stay dark so embedded SVG colors
   and simulator JS-set colors keep working in both themes.
   ========================================================================== */
.theme-toggle-btn {
  background: transparent;
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  padding: 0.55rem 1.1rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}
.theme-toggle-btn:hover {
  color: var(--text-primary);
  border-color: var(--border-focus);
}
[data-theme="paper"] {
  --bg-primary: #f5efe2;
  --bg-secondary: #ece3cd;
  --bg-card: rgba(255, 253, 247, 0.94);
  --bg-card-hover: rgba(255, 251, 240, 0.98);
  --border-subtle: rgba(120, 90, 40, 0.22);
  --border-focus: rgba(194, 84, 43, 0.55);
  --border-accent: rgba(194, 84, 43, 0.35);
  --text-primary: #2e2a23;
  --text-secondary: #5b5344;
  --text-muted: #857861;
  --text-accent: #c2542b;
  --color-primary: #c2542b;
  --color-primary-glow: rgba(194, 84, 43, 0.14);
  --color-success: #5a7d2a;
  --color-success-bg: rgba(90, 125, 42, 0.12);
  --color-warning: #b45309;
  --color-warning-bg: rgba(180, 83, 9, 0.12);
  --color-danger: #b3261e;
  --color-danger-bg: rgba(179, 38, 30, 0.09);
  --color-purple: #7c3aed;
  --color-cyan: #0e7490;
  --shadow-sm: 0 2px 8px rgba(120, 90, 40, 0.12);
  --shadow-lg: 0 14px 34px -12px rgba(120, 90, 40, 0.25);
  --shadow-glow: 0 0 35px -5px rgba(194, 84, 43, 0.18);
  --empty-title: #2e2a23;
  --tlabel-why: #b45309;
  --tlabel-how: #0e7490;
  --tlabel-break: #b3261e;
  --sum-name: #7c2d12;
  --sum-ds: #4a4438;
  --sum-edge: #9a3412;
  --sum-tag: #3f6212;
}
[data-theme="paper"] body::before {
  background: radial-gradient(circle, rgba(194, 84, 43, 0.10) 0%, transparent 70%);
}
[data-theme="paper"] body::after {
  background: radial-gradient(circle, rgba(122, 132, 80, 0.12) 0%, transparent 70%);
}
[data-theme="paper"] .hero-pill-badge {
  background: #f6e2d1;
  color: #7c2d12;
}
[data-theme="paper"] .hero-title {
  background: linear-gradient(135deg, #2e2a23 30%, #857861 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
[data-theme="paper"] .hero-title .highlight {
  background: linear-gradient(135deg, #c2542b 0%, #7a8450 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
[data-theme="paper"] .stat-value,
[data-theme="paper"] .algo-title,
[data-theme="paper"] .section-subheading,
[data-theme="paper"] .simulator-title,
[data-theme="paper"] .teacher-card-title,
[data-theme="paper"] .decision-matrix-title {
  color: #2e2a23;
}
[data-theme="paper"] .view-tab-btn:hover,
[data-theme="paper"] .filter-pill:hover,
[data-theme="paper"] .sim-btn.secondary:hover {
  color: #2e2a23;
}
[data-theme="paper"] .view-tabs {
  background: #f3ecdc;
}
[data-theme="paper"] .view-tab-btn.active {
  box-shadow: 0 2px 10px rgba(194, 84, 43, 0.35);
}
[data-theme="paper"] .search-input {
  background: #faf6ec;
}
[data-theme="paper"] .filter-pill {
  background: #f3ecdc;
}
[data-theme="paper"] .filter-pill:hover {
  background: #ece1c8;
}
[data-theme="paper"] .filter-pill.active {
  background: #c2542b;
  border-color: #c2542b;
  color: #ffffff;
}
[data-theme="paper"] .algo-priority-badge.p3 {
  background: rgba(179, 38, 30, 0.10);
  border: 1px solid rgba(179, 38, 30, 0.4);
  color: #b3261e;
}
[data-theme="paper"] .algo-priority-badge.p2 {
  background: rgba(180, 83, 9, 0.12);
  border: 1px solid rgba(180, 83, 9, 0.4);
  color: #b45309;
}
[data-theme="paper"] .algo-priority-badge.p1 {
  background: rgba(14, 116, 144, 0.10);
  border: 1px solid rgba(14, 116, 144, 0.4);
  color: #0e7490;
}
[data-theme="paper"] .category-tag {
  background: rgba(194, 84, 43, 0.10);
  color: #9a3412;
  border: 1px solid rgba(194, 84, 43, 0.35);
}
[data-theme="paper"] .system-tag {
  background: #f3ecdc;
}
[data-theme="paper"] .ds-item,
[data-theme="paper"] .complexity-box {
  background: #faf6ec;
}
[data-theme="paper"] .ds-name {
  color: #0e7490;
}
[data-theme="paper"] .complexity-val {
  color: #3f6212;
}
[data-theme="paper"] .edge-cases-title {
  color: #b3261e;
}
[data-theme="paper"] .edge-cases-list li {
  color: #7c2d12;
}
[data-theme="paper"] .staff-insights-box {
  background: rgba(124, 58, 237, 0.07);
  border: 1px solid rgba(124, 58, 237, 0.3);
}
[data-theme="paper"] .staff-insights-title {
  color: #6d28d9;
}
[data-theme="paper"] .staff-insights-list li {
  color: #4c1d95;
}
[data-theme="paper"] .staff-insights-list li::before {
  color: #7c3aed;
}
[data-theme="paper"] .algo-diagram-container,
[data-theme="paper"] .simulator-stage {
  background: rgba(8, 12, 20, 0.95);
  border: 1px solid #334155;
}
[data-theme="paper"] .sim-btn.secondary {
  background: #f3ecdc;
}
[data-theme="paper"] .summary-table th {
  background: #f3ecdc;
  color: #4a4438;
}
[data-theme="paper"] .summary-table td {
  border-bottom: 1px solid rgba(120, 90, 40, 0.14);
}
[data-theme="paper"] .summary-table tr:hover td {
  background: rgba(194, 84, 43, 0.05);
}
[data-theme="paper"] .code-cell {
  color: #0e7490;
}
[data-theme="paper"] .decision-card {
  background: #faf6ec;
}
[data-theme="paper"] .decision-choice-title {
  color: #0e7490;
}
[data-theme="paper"] .teacher-card:hover {
  border-color: rgba(194, 84, 43, 0.4);
}
[data-theme="paper"] .teacher-card::before {
  background: linear-gradient(90deg, #c2542b, #7a8450, #b45309);
}
[data-theme="paper"] .teacher-badge {
  background: #f6e2d1;
  border: 1px solid #e3c19f;
  color: #7c2d12;
}
[data-theme="paper"] .teacher-card-subtitle {
  color: #0e7490;
}
[data-theme="paper"] .teacher-problem-box {
  background: #faf4e6;
  color: #4a4438;
}
[data-theme="paper"] .teacher-analogy-box {
  background: linear-gradient(135deg, rgba(194, 84, 43, 0.08) 0%, rgba(122, 132, 80, 0.08) 100%);
  border: 1px solid rgba(194, 84, 43, 0.3);
}
[data-theme="paper"] .teacher-analogy-title {
  color: #7c2d12;
}
[data-theme="paper"] .teacher-analogy-text {
  color: #2e2a23;
}
[data-theme="paper"] .teacher-step-item {
  background: #faf6ec;
  color: #4a4438;
}
[data-theme="paper"] .teacher-break-box {
  background: rgba(179, 38, 30, 0.07);
  border: 1px solid rgba(179, 38, 30, 0.25);
  color: #7c2d12;
}
[data-theme="paper"] .teacher-takeaway-box {
  background: rgba(90, 125, 42, 0.10);
  border: 1px solid rgba(90, 125, 42, 0.35);
  color: #3f6212;
}
[data-theme="paper"] .teacher-takeaway-icon {
  color: #5a7d2a;
}
