/* ========================================================================= */
/* MODULAR PROGRAMMING & STRUCTURE CHARTS STYLES                             */
/* Aligned with AQA GCSE Computer Science Paper 1 §3.1 & §3.2               */
/* Warm drafting paper revision palette & high contrast                      */
/* ========================================================================= */

/* Theory Concept Grid */
.modular-concept-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-bottom: 26px;
}

.modular-concept-card {
  background: var(--paper-card, #fdfcf9);
  border: 1px solid var(--paper-border, #ded7c6);
  border-radius: var(--radius-md, 3px);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.modular-concept-card:hover {
  border-color: var(--oxford-navy, #1e3a5f);
  transform: translateY(-1px);
}

.concept-card-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.concept-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm, 2px);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  background: var(--paper-recessed, #ede8db);
  border: 1px solid var(--paper-border, #ded7c6);
  flex-shrink: 0;
}

.concept-title {
  font-family: var(--font-serif, 'Newsreader', Georgia, serif);
  font-size: 15px;
  font-weight: 700;
  color: var(--ink-primary, #1e2229);
  margin: 0;
}

.concept-body {
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--ink-secondary, #585e6b);
  margin: 0;
}

/* Main Interactive Workspace Layout */
.modular-workbench-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  margin-bottom: 28px;
}

@media (min-width: 1080px) {
  .modular-workbench-grid {
    grid-template-columns: 1.15fr 1fr;
  }
}

/* Code Inspector Column */
.modular-code-card {
  background: var(--paper-card, #fdfcf9);
  border: 1px solid var(--paper-border, #ded7c6);
  border-radius: var(--radius-md, 3px);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.scenario-pill-bar {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.scenario-btn {
  padding: 5px 12px;
  border-radius: var(--radius-sm, 2px);
  border: 1px solid var(--paper-border-strong, #c2b8a3);
  background: var(--paper-card, #fdfcf9);
  color: var(--ink-secondary, #585e6b);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.scenario-btn:hover {
  background: var(--paper-recessed, #ede8db);
  color: var(--ink-primary, #1e2229);
  border-color: var(--oxford-navy, #1e3a5f);
}

.scenario-btn.active {
  background: var(--isaac-magenta, #c8006b);
  color: #ffffff;
  border-color: var(--isaac-magenta, #c8006b);
  font-weight: 700;
}

/* Monolithic Code Viewer with selectable blocks */
.monolith-viewer {
  background: #1e2229;
  border: 1px solid var(--paper-border, #ded7c6);
  border-radius: var(--radius-sm, 2px);
  padding: 14px 16px;
  font-family: var(--font-mono, 'JetBrains Mono', monospace);
  font-size: 12px;
  line-height: 1.65;
  color: #f1f5f9;
  max-height: 480px;
  overflow-y: auto;
  user-select: text;
}

.code-block-span {
  display: block;
  padding: 4px 8px;
  margin: 3px 0;
  border-radius: var(--radius-sm, 2px);
  border-left: 3px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
}

.code-block-span:hover {
  background: rgba(255, 255, 255, 0.08);
  border-left-color: #94a3b8;
}

.code-block-span.active-block {
  background: rgba(59, 130, 246, 0.25);
  border-left-color: #38bdf8;
  outline: 1px solid rgba(59, 130, 246, 0.5);
}

.code-block-span.block-extracted {
  border-left-color: #10b981;
  background: rgba(16, 185, 129, 0.2);
}

.code-block-span.block-main {
  border-left-color: #f59e0b;
  background: rgba(245, 158, 11, 0.18);
}

.block-tag {
  display: inline-block;
  font-size: 10px;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: var(--radius-sm, 2px);
  margin-right: 6px;
  text-transform: uppercase;
}

/* Right Column: Decision Workbench */
.modular-decision-card {
  background: var(--paper-card, #fdfcf9);
  border: 1px solid var(--paper-border, #ded7c6);
  border-radius: var(--radius-md, 3px);
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.decision-block-box {
  background: var(--paper-recessed, #ede8db);
  border: 1px solid var(--paper-border, #ded7c6);
  border-radius: var(--radius-sm, 2px);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.decision-buttons-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.btn-decision {
  padding: 12px 14px;
  border-radius: var(--radius-sm, 2px);
  font-size: 12px;
  font-weight: 700;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  cursor: pointer;
  transition: all 0.15s ease;
  border: 1.5px solid var(--paper-border-strong, #c2b8a3);
  background: var(--paper-card, #fdfcf9);
  color: var(--ink-primary, #1e2229);
  text-align: center;
}

.btn-decision:hover {
  transform: translateY(-1px);
}

.btn-decision-extract:hover,
.btn-decision-extract.chosen {
  background: var(--green-tint, #edf7f0);
  border-color: var(--forest-green, #1a6b3c);
  color: var(--forest-green, #1a6b3c);
}

.btn-decision-main:hover,
.btn-decision-main.chosen {
  background: var(--navy-tint, #edf3f9);
  border-color: var(--oxford-navy, #1e3a5f);
  color: var(--oxford-navy, #1e3a5f);
}

/* Feedback callout box */
.decision-feedback-callout {
  border-radius: var(--radius-sm, 2px);
  padding: 12px 14px;
  font-size: 12.5px;
  line-height: 1.55;
  display: flex;
  flex-direction: column;
  gap: 6px;
  animation: fadeIn 0.2s ease;
}

.callout-success {
  background: var(--green-tint, #edf7f0);
  border-left: 4px solid var(--forest-green, #1a6b3c);
  color: var(--ink-primary, #1e2229);
}

.callout-wrong {
  background: var(--red-tint, #fef2f2);
  border-left: 4px solid var(--cardinal-red, #a82020);
  color: var(--ink-primary, #1e2229);
}

/* Before / After Refactor View Toggle */
.refactor-tabs-group {
  display: inline-flex;
  border-radius: var(--radius-sm, 2px);
  background: var(--paper-recessed, #ede8db);
  padding: 2px;
  border: 1px solid var(--paper-border-strong, #c2b8a3);
}

.refactor-tab-btn {
  padding: 5px 12px;
  font-size: 11.5px;
  font-weight: 600;
  border: none;
  background: transparent;
  color: var(--ink-secondary, #585e6b);
  border-radius: var(--radius-sm, 2px);
  cursor: pointer;
  transition: all 0.15s ease;
}

.refactor-tab-btn.active {
  background: var(--oxford-navy, #1e3a5f);
  color: #ffffff;
  font-weight: 700;
}

/* Structure Chart Panel */
.structure-chart-panel {
  background: var(--paper-card, #fdfcf9);
  border: 1px solid var(--paper-border, #ded7c6);
  border-radius: var(--radius-md, 3px);
  padding: 20px 22px;
}

.aqa-chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  background: var(--paper-recessed, #ede8db);
  border: 1px solid var(--paper-border, #ded7c6);
  border-radius: var(--radius-sm, 2px);
  padding: 10px 14px;
  font-size: 11.5px;
  color: var(--ink-secondary, #585e6b);
  align-items: center;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.legend-symbol {
  font-family: var(--font-mono, 'JetBrains Mono', monospace);
  font-weight: 800;
  font-size: 12.5px;
}

.badge-mini {
  font-size: 9.5px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: var(--radius-sm, 2px);
  text-transform: uppercase;
}

.badge-func {
  background: var(--green-tint, #edf7f0);
  color: var(--forest-green, #1a6b3c);
  border: 1px solid rgba(26, 107, 60, 0.3);
}

.badge-proc {
  background: var(--navy-tint, #edf3f9);
  color: var(--oxford-navy, #1e3a5f);
  border: 1px solid rgba(30, 58, 95, 0.3);
}

/* Monolithic (Before) Diagram Card */
.monolith-diagram-card {
  background: var(--paper-recessed, #ede8db);
  border: 2px dashed rgba(168, 32, 32, 0.35);
  border-radius: var(--radius-sm, 2px);
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  text-align: center;
  animation: fadeIn 0.2s ease;
}

.monolith-big-box {
  background: var(--red-tint, #fef2f2);
  border: 2px solid var(--cardinal-red, #a82020);
  border-radius: var(--radius-sm, 2px);
  padding: 18px 24px;
  max-width: 620px;
  width: 100%;
}

.monolith-box-title {
  font-family: var(--font-serif, 'Newsreader', Georgia, serif);
  font-size: 17px;
  font-weight: 700;
  color: var(--cardinal-red, #a82020);
  margin-bottom: 6px;
}

.monolith-box-desc {
  font-size: 12.5px;
  color: var(--ink-secondary, #585e6b);
  line-height: 1.55;
}

.monolith-traps-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
  width: 100%;
  max-width: 620px;
  text-align: left;
}

.monolith-trap-item {
  background: var(--paper-card, #fdfcf9);
  border: 1px solid var(--paper-border, #ded7c6);
  border-left: 3px solid var(--cardinal-red, #a82020);
  border-radius: var(--radius-sm, 2px);
  padding: 8px 12px;
  font-size: 11.5px;
  color: var(--ink-secondary, #585e6b);
}

/* AQA Structure Chart Tree Layout */
.aqa-chart-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 0 20px 0;
  animation: fadeIn 0.2s ease;
  overflow-x: auto;
}

.aqa-root-box {
  background: var(--oxford-navy, #1e3a5f);
  border: 2px solid #152942;
  color: #ffffff;
  border-radius: var(--radius-sm, 2px);
  padding: 12px 28px;
  text-align: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 240px;
  z-index: 2;
}

.aqa-root-title {
  font-size: 14px;
  font-weight: 700;
  color: #ffffff;
  font-family: var(--font-mono, 'JetBrains Mono', monospace);
}

.aqa-root-role {
  font-size: 10.5px;
  color: #cbd5e1;
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.05em;
}

/* Connecting Trunk & Arms */
.aqa-trunk-line {
  width: 2px;
  height: 24px;
  background: var(--paper-border-strong, #c2b8a3);
}

.aqa-branches-row {
  display: flex;
  gap: 20px;
  justify-content: center;
  position: relative;
  padding-top: 20px;
  width: 100%;
  min-width: 680px;
}

.aqa-branches-row::before {
  content: '';
  position: absolute;
  top: 0;
  left: 10%;
  right: 10%;
  height: 2px;
  background: var(--paper-border-strong, #c2b8a3);
}

/* Individual Subroutine Branch */
.aqa-branch-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  max-width: 240px;
  position: relative;
}

.aqa-branch-col::before {
  content: '';
  position: absolute;
  top: -20px;
  width: 2px;
  height: 20px;
  background: var(--paper-border-strong, #c2b8a3);
}

/* Data Flow Arrows on Branch Line */
.aqa-data-flow-box {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 8px;
  background: var(--paper-card, #fdfcf9);
  border: 1px solid var(--paper-border, #ded7c6);
  border-radius: var(--radius-sm, 2px);
  padding: 4px 8px;
  font-size: 10.5px;
  font-family: var(--font-mono, 'JetBrains Mono', monospace);
}

.data-param-line {
  color: var(--oxford-navy, #1e3a5f);
  display: flex;
  align-items: center;
  gap: 5px;
  font-weight: 600;
}

.data-return-line {
  color: var(--forest-green, #1a6b3c);
  display: flex;
  align-items: center;
  gap: 5px;
  font-weight: 600;
}

/* Subroutine Box */
.aqa-module-box {
  background: var(--paper-card, #fdfcf9);
  border: 1.5px solid var(--paper-border, #ded7c6);
  border-radius: var(--radius-sm, 2px);
  padding: 12px 14px;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: all 0.15s ease;
}

.aqa-module-box.unlocked {
  border-color: var(--forest-green, #1a6b3c);
  background: var(--paper-card, #fdfcf9);
  box-shadow: 0 1px 4px rgba(26, 107, 60, 0.1);
}

.aqa-module-box.locked {
  opacity: 0.55;
  border-style: dashed;
}

.aqa-module-name {
  font-size: 12.5px;
  font-weight: 700;
  font-family: var(--font-mono, 'JetBrains Mono', monospace);
  color: var(--ink-primary, #1e2229);
  margin-top: 2px;
}

.aqa-module-desc {
  font-size: 11px;
  color: var(--ink-secondary, #585e6b);
  line-height: 1.4;
}

.aqa-repeat-badge {
  background: var(--amber-tint, #fef3c7);
  color: var(--amber-mid, #b45309);
  border: 1px solid rgba(180, 83, 9, 0.3);
  font-size: 9.5px;
  font-weight: 700;
  border-radius: var(--radius-sm, 2px);
  padding: 2px 6px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  width: fit-content;
}

/* Theory Quiz Card */
.modular-quiz-card {
  background: var(--paper-card, #fdfcf9);
  border: 1px solid var(--paper-border, #ded7c6);
  border-radius: var(--radius-md, 3px);
  padding: 20px 24px;
  margin-top: 16px;
}

.quiz-question-box {
  background: var(--paper-recessed, #ede8db);
  border: 1px solid var(--paper-border, #ded7c6);
  border-radius: var(--radius-sm, 2px);
  padding: 14px 18px;
  margin-bottom: 14px;
}

.quiz-option-btn {
  width: 100%;
  text-align: left;
  padding: 10px 14px;
  border-radius: var(--radius-sm, 2px);
  border: 1px solid var(--paper-border-strong, #c2b8a3);
  background: var(--paper-card, #fdfcf9);
  color: var(--ink-primary, #1e2229);
  font-size: 12.5px;
  cursor: pointer;
  margin-top: 8px;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  gap: 10px;
}

.quiz-option-btn:hover {
  border-color: var(--oxford-navy, #1e3a5f);
  color: var(--oxford-navy, #1e3a5f);
}

.quiz-option-btn.correct {
  background: var(--green-tint, #edf7f0) !important;
  border-color: var(--forest-green, #1a6b3c) !important;
  color: var(--forest-green, #1a6b3c) !important;
  font-weight: 700;
}

.quiz-option-btn.wrong {
  background: var(--red-tint, #fef2f2) !important;
  border-color: var(--cardinal-red, #a82020) !important;
  color: var(--cardinal-red, #a82020) !important;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-3px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ========================================================================= */
/* PROGRAM DEBUGGER & IN-PLACE SCRATCHPAD WORKBENCH (DATABASE SIM QUALITY)   */
/* ========================================================================= */

.errors-taxonomy-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.taxonomy-strip-card {
  background: var(--paper-card, #fdfcf9);
  border: 1px solid var(--paper-border, #ded7c6);
  border-radius: var(--radius-sm, 2px);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
}

.taxonomy-strip-card.card-syntax {
  border-left: 3.5px solid #ef4444;
}

.taxonomy-strip-card.card-logic {
  border-left: 3.5px solid #f59e0b;
}

.taxonomy-strip-card.card-runtime {
  border-left: 3.5px solid #8b5cf6;
}

.strip-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.strip-card-header strong {
  font-size: 13.5px;
  color: var(--ink-primary);
}

.strip-pill {
  font-size: 9.5px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 2px;
  letter-spacing: 0.03em;
}

.strip-pill.pill-syntax {
  background: #fef2f2;
  color: #dc2626;
  border: 1px solid #fecaca;
}

.strip-pill.pill-logic {
  background: #fffbeb;
  color: #b45309;
  border: 1px solid #fde68a;
}

.strip-pill.pill-runtime {
  background: #f5f3ff;
  color: #7c3aed;
  border: 1px solid #ddd6fe;
}

.taxonomy-strip-card p {
  font-size: 11.5px;
  color: var(--ink-secondary);
  line-height: 1.45;
  margin: 0;
}

.strip-code-preview {
  background: #0f1218;
  border-radius: 2px;
  padding: 6px 10px;
  font-family: var(--font-mono, monospace);
  font-size: 11px;
  color: #f1f5f9;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 4px;
}

.strip-code-preview code {
  color: #e2e8f0;
}

.strip-code-preview small {
  color: #94a3b8;
  font-size: 10px;
}

.text-err { color: #f87171; }
.text-warn { color: #fbbf24; }
.text-ok { color: #34d399; }

.strip-bullets-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-primary);
  margin-top: 6px;
}

.taxonomy-strip-card ul {
  margin: 3px 0 6px 16px;
  padding: 0;
  font-size: 11px;
  color: var(--ink-secondary);
  line-height: 1.45;
}

.taxonomy-strip-card ul li {
  margin-bottom: 2px;
}

.strip-code-preview.multiline {
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
}

.strip-code-preview.multiline pre {
  margin: 0;
  font-family: var(--font-mono, monospace);
  font-size: 11px;
  line-height: 1.4;
  white-space: pre;
  width: 100%;
}

/* Unified Mission Card */
.debugger-mission-card {
  background: var(--paper-card, #fdfcf9);
  border: 1px solid var(--paper-border, #ded7c6);
  border-radius: var(--radius-md, 3px);
  padding: 16px 20px;
  margin-bottom: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
}

.mission-info-col {
  max-width: 760px;
}

.mission-badge-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.mission-title {
  font-family: var(--font-serif);
  font-size: 18px;
  font-weight: 700;
  color: var(--ink-primary);
  margin: 0 0 4px 0;
}

.mission-prompt {
  font-size: 13px;
  color: var(--ink-secondary);
  line-height: 1.5;
  margin: 0 0 8px 0;
}

.mission-target-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--paper-recessed, #ede8db);
  border: 1px solid var(--paper-border, #ded7c6);
  border-radius: 2px;
  padding: 3px 8px;
  font-size: 11.5px;
}

.mission-target-badge .target-label {
  font-weight: 700;
  color: var(--ink-secondary);
}

.mission-target-badge code {
  color: #0284c7;
  font-family: var(--font-mono, monospace);
  font-weight: 700;
}

.mission-actions-col {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-end;
}

@media (max-width: 768px) {
  .mission-actions-col {
    align-items: stretch;
    width: 100%;
  }
}

/* IDE Workbench Grid */
.debugger-ide-workbench {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  margin-bottom: 28px;
}

@media (min-width: 1080px) {
  .debugger-ide-workbench {
    grid-template-columns: 1.25fr 1fr;
  }
}

/* Left: IDE Editor & Terminal Container */
.ide-editor-container {
  background: #141820;
  border: 1px solid #232a38;
  border-radius: var(--radius-md, 3px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.ide-tab-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #181f2a;
  border-bottom: 1px solid #232a38;
  padding: 0 12px;
  height: 38px;
}

.ide-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  height: 100%;
  font-family: var(--font-mono, monospace);
  font-size: 12px;
  font-weight: 700;
  color: #e2e8f0;
  border-bottom: 2px solid #38bdf8;
  background: #0f1218;
}

.ide-tab-info {
  font-size: 11px;
  color: #64748b;
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono, monospace);
}

.scratchpad-wrapper {
  display: flex;
  position: relative;
  background: #0f1218;
  min-height: 220px;
  font-family: var(--font-mono, monospace);
  font-size: 13px;
  line-height: 1.6;
}

.scratchpad-gutter {
  width: 40px;
  padding: 12px 6px;
  text-align: right;
  color: #475569;
  user-select: none;
  border-right: 1px solid #1e293b;
  font-size: 11.5px;
  line-height: 1.6;
  background: #0a0d13;
  box-sizing: border-box;
}

.scratchpad-gutter div {
  height: 20.8px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.scratchpad-textarea {
  flex: 1;
  padding: 12px 14px;
  background: transparent;
  color: #f1f5f9;
  border: none;
  outline: none;
  resize: vertical;
  font-family: var(--font-mono, monospace);
  font-size: 13px;
  line-height: 1.6;
  white-space: pre;
  tab-size: 4;
  -moz-tab-size: 4;
  box-sizing: border-box;
  min-height: 220px;
}

.scratchpad-textarea:focus {
  outline: none;
}

/* Terminal Console */
.ide-terminal-container {
  border-top: 1px solid #1e293b;
  background: #0a0c10;
  display: flex;
  flex-direction: column;
}

.ide-terminal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: #11151f;
  border-bottom: 1px solid #1e293b;
}

.terminal-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.terminal-dot.red { background: #ef4444; }
.terminal-dot.yellow { background: #f59e0b; }
.terminal-dot.green { background: #10b981; }

.terminal-status-pill {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 2px;
  letter-spacing: 0.04em;
}

.terminal-status-pill.ready {
  background: #1e293b;
  color: #94a3b8;
}

.terminal-status-pill.running {
  background: #0284c725;
  color: #38bdf8;
  border: 1px solid #0284c750;
}

.terminal-status-pill.error {
  background: #ef444425;
  color: #f87171;
  border: 1px solid #ef444450;
}

.terminal-status-pill.success {
  background: #10b98125;
  color: #34d399;
  border: 1px solid #10b98150;
}

.debugger-terminal-screen {
  padding: 12px 14px;
  min-height: 85px;
  max-height: 180px;
  overflow-y: auto;
  font-family: var(--font-mono, monospace);
  font-size: 12px;
  line-height: 1.55;
  color: #f8fafc;
}

/* Right: Inspector & Diagnostic Radar */
.ide-inspector-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.diagnostic-radar-card {
  background: var(--paper-card, #fdfcf9);
  border: 1px solid var(--paper-border, #ded7c6);
  border-radius: var(--radius-md, 3px);
  padding: 18px 20px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
}

.radar-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.radar-pill-warn {
  font-size: 10.5px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 2px;
  background: #fef3c7;
  color: #b45309;
  border: 1px solid #fde68a;
  text-transform: uppercase;
}

.radar-pill-success {
  font-size: 10.5px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 2px;
  background: #dcfce7;
  color: #15803d;
  border: 1px solid #bbf7d0;
  text-transform: uppercase;
}

.radar-pill-error {
  font-size: 10.5px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 2px;
  background: #fee2e2;
  color: #b91c1c;
  border: 1px solid #fecaca;
  text-transform: uppercase;
}

.radar-checklist {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.radar-check-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm, 2px);
  border: 1px solid var(--paper-border, #ded7c6);
  background: var(--paper-recessed, #ede8db);
  transition: all 0.2s ease;
}

.radar-check-item.status-pass {
  border-color: #86efac;
  background: #f0fdf4;
}

.radar-check-item.status-fail {
  border-color: #fca5a5;
  background: #fef2f2;
}

.radar-check-item.status-warn {
  border-color: #fde68a;
  background: #fffbeb;
}

.radar-item-icon {
  font-size: 15px;
  line-height: 1.2;
}

.radar-item-content {
  flex: 1;
}

.radar-item-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-primary);
  margin-bottom: 2px;
}

.radar-item-desc {
  font-size: 11.5px;
  color: var(--ink-secondary);
  line-height: 1.45;
}

.debug-hint-box {
  margin-top: 12px;
  padding: 10px 14px;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-left: 3.5px solid #d97706;
  border-radius: var(--radius-sm, 2px);
  font-size: 12px;
  color: #92400e;
  line-height: 1.5;
  animation: fadeIn 0.2s ease;
}

/* CGP-Style Explanation Box on Completion */
.debug-explanation-card {
  background: var(--paper-card, #fdfcf9);
  border: 1.5px solid #10b981;
  border-top: 4px solid #10b981;
  border-radius: var(--radius-md, 3px);
  padding: 18px 20px;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.08);
  animation: fadeIn 0.3s ease;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.explanation-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.explanation-header h4 {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 16.5px;
  font-weight: 700;
  color: #065f46;
}

.explanation-pill {
  font-size: 10px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 2px;
  background: #dcfce7;
  color: #15803d;
  border: 1px solid #86efac;
}

.explanation-section {
  background: var(--paper-recessed, #ede8db);
  border: 1px solid var(--paper-border, #ded7c6);
  border-radius: var(--radius-sm, 2px);
  padding: 10px 12px;
  font-size: 12px;
  line-height: 1.55;
  color: var(--ink-primary);
}

.explanation-section strong {
  display: block;
  font-size: 12px;
  margin-bottom: 3px;
}

.explanation-section.sec-syntax strong { color: #dc2626; }
.explanation-section.sec-logic strong { color: #b45309; }
.explanation-section.sec-takeaway strong { color: #0284c7; }

.python-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-mono, monospace);
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-sm, 2px);
  background: #3776ab18;
  color: #2b5b84;
  border: 1px solid #3776ab40;
}

html.dark .python-badge {
  background: #38bdf820;
  color: #7dd3fc;
  border-color: #38bdf840;
}

/* Dynamic marker on number line */
.nl-pin {
  position: absolute;
  top: -6px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  transform: translateX(-50%);
  border: 2px solid #ffffff;
  box-shadow: 0 1px 4px rgba(0,0,0,0.3);
  transition: left 0.2s ease;
  z-index: 5;
}

.nl-pin.normal { background: #10b981; }
.nl-pin.boundary { background: #f59e0b; }
.nl-pin.erroneous { background: #ef4444; }

.testplan-select {
  padding: 5px 8px;
  border: 1px solid var(--paper-border-strong, #c2b8a3);
  border-radius: var(--radius-sm, 2px);
  background: var(--paper-card, #fdfcf9);
  color: var(--ink-primary, #1e2229);
  font-size: 11.5px;
  width: 100%;
}

html.dark .testplan-select {
  background: var(--paper-recessed);
  color: var(--ink-primary);
  border-color: var(--paper-border-strong);
}

/* ========================================================================= */
/* TEST PLAN BUILDER & BOUNDARY TESTING STYLES                               */
/* ========================================================================= */

.testplan-workbench-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  margin-bottom: 28px;
}

@media (min-width: 1080px) {
  .testplan-workbench-grid {
    grid-template-columns: 1fr 1.35fr;
  }
}

.numberline-visual-box {
  background: var(--paper-recessed, #ede8db);
  border: 1px solid var(--paper-border, #ded7c6);
  border-radius: var(--radius-sm, 2px);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.numberline-track {
  position: relative;
  height: 28px;
  display: flex;
  border-radius: var(--radius-sm, 2px);
  overflow: visible;
  border: 1px solid var(--paper-border-strong, #c2b8a3);
  font-size: 11px;
  font-weight: 700;
  text-align: center;
  line-height: 26px;
}

.track-zone-invalid {
  background: rgba(239, 68, 68, 0.2);
  color: #991b1b;
  overflow: hidden;
}

html.dark .track-zone-invalid {
  color: #fca5a5;
}

.track-zone-valid {
  background: rgba(16, 185, 129, 0.25);
  color: #14532d;
  border-left: 2px solid #10b981;
  border-right: 2px solid #10b981;
  overflow: hidden;
}

html.dark .track-zone-valid {
  color: #86efac;
}

.numberline-ticks-row {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono, monospace);
  font-size: 11px;
  color: var(--ink-secondary, #585e6b);
  padding: 0 4px;
}

.testplan-table-wrapper {
  overflow-x: auto;
  border: 1px solid var(--paper-border, #ded7c6);
  border-radius: var(--radius-sm, 2px);
  background: var(--paper-card, #fdfcf9);
}

.testplan-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.testplan-table th {
  background: var(--paper-recessed, #ede8db);
  padding: 9px 12px;
  text-align: left;
  font-weight: 700;
  color: var(--ink-primary, #1e2229);
  border-bottom: 2px solid var(--paper-border, #ded7c6);
  border-right: 1px solid var(--paper-border, #ded7c6);
}

.testplan-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--paper-border, #ded7c6);
  border-right: 1px solid var(--paper-border, #ded7c6);
  color: var(--ink-primary, #1e2229);
  vertical-align: middle;
}

.testplan-table tr:last-child td {
  border-bottom: none;
}

.testplan-table td:last-child,
.testplan-table th:last-child {
  border-right: none;
}

.testplan-input {
  padding: 6px 8px;
  border: 1px solid var(--paper-border-strong, #c2b8a3);
  border-radius: var(--radius-sm, 2px);
  background: var(--paper-card, #fdfcf9);
  color: var(--ink-primary, #1e2229);
  font-family: var(--font-mono, monospace);
  font-size: 12px;
  width: 100%;
  max-width: 95px;
}

html.dark .testplan-input {
  background: var(--paper-recessed);
  color: var(--ink-primary);
  border-color: var(--paper-border-strong);
}

.test-chip {
  display: inline-block;
  padding: 2px 7px;
  font-size: 10.5px;
  font-weight: 700;
  border-radius: 2px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.test-chip.normal {
  background: rgba(16, 185, 129, 0.15);
  color: #15803d;
  border: 1px solid rgba(22, 163, 74, 0.3);
}

html.dark .test-chip.normal {
  color: #86efac;
}

.test-chip.boundary {
  background: rgba(245, 158, 11, 0.15);
  color: #b45309;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

html.dark .test-chip.boundary {
  color: #fde68a;
}

.test-chip.erroneous {
  background: rgba(239, 68, 68, 0.15);
  color: #b91c1c;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

html.dark .test-chip.erroneous {
  color: #fca5a5;
}

.defect-alert-banner {
  background: rgba(239, 68, 68, 0.12);
  border-left: 4px solid #ef4444;
  padding: 10px 14px;
  border-radius: var(--radius-sm, 2px);
  font-size: 12.5px;
  color: var(--ink-primary, #1e2229);
  line-height: 1.5;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Submodule 3: Test Plan IDE Card & Terminal */
.testplan-ide-card {
  background: #141820;
  border: 1px solid #232a38;
  border-radius: var(--radius-md, 3px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.testplan-matrix-panel {
  background: var(--paper-card, #fdfcf9);
  border: 1px solid var(--paper-border, #ded7c6);
  border-radius: var(--radius-md, 3px);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.testplan-code-viewer-wrap {
  background: #0f1218;
  padding: 12px 0;
  font-family: var(--font-mono, monospace);
  font-size: 12.5px;
  line-height: 1.6;
  min-height: 190px;
}

.testplan-code-lines {
  display: flex;
  flex-direction: column;
}

.testplan-line {
  display: flex;
  align-items: center;
  padding: 3px 14px;
  position: relative;
  transition: all 0.15s ease;
}

.testplan-line-num {
  width: 26px;
  color: #475569;
  user-select: none;
  font-size: 11px;
  text-align: right;
  margin-right: 14px;
}

.testplan-line-code {
  flex: 1;
  color: #e2e8f0;
  white-space: pre;
}

.testplan-line.active-exec {
  background: rgba(56, 189, 248, 0.25) !important;
  border-left: 3px solid #38bdf8;
}

.testplan-line.error-line {
  background: rgba(239, 68, 68, 0.18);
  border-left: 3px solid #ef4444;
}

.testplan-line.fixed-line {
  background: rgba(16, 185, 129, 0.2);
  border-left: 3px solid #10b981;
}

.testplan-line-tag {
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 2px;
  margin-left: 10px;
}

.testplan-line-tag.fixed {
  background: #10b98130;
  color: #34d399;
  border: 1px solid #10b98160;
}

.testplan-line-tag.bug {
  background: #ef444430;
  color: #f87171;
  border: 1px solid #ef444460;
}

.testplan-mini-terminal {
  border-top: 1px solid #1e293b;
  background: #0a0c10;
  display: flex;
  flex-direction: column;
}

.testplan-terminal-screen {
  padding: 10px 14px;
  min-height: 95px;
  max-height: 150px;
  overflow-y: auto;
  font-family: var(--font-mono, monospace);
  font-size: 11.5px;
  line-height: 1.55;
  color: #f8fafc;
}

/* Evaluating row animation in test matrix */
.testplan-table tr.active-eval-row {
  background: rgba(56, 189, 248, 0.15) !important;
  transition: background 0.2s ease;
}

/* ========================================================================= */
/* DECOMPOSITION & STRUCTURE CHART STYLES (MATCHING USER SCREENSHOTS)        */
/* ========================================================================= */

.block-magenta {
  background: #e11d48 !important;
  color: #ffffff !important;
  border-color: #be123c !important;
}

.block-amber {
  background: #f59e0b !important;
  color: #1c1917 !important;
  border-color: #d97706 !important;
  font-weight: 700;
}

.block-teal {
  background: #0d9488 !important;
  color: #ffffff !important;
  border-color: #0f766e !important;
  font-weight: 700;
}

/* Pool for unplaced blocks */
.decomp-pool-box {
  background: var(--paper-recessed, #ede8db);
  border: 1px solid var(--paper-border, #ded7c6);
  border-radius: var(--radius-sm, 2px);
  padding: 12px 16px;
  margin-bottom: 20px;
}

.decomp-blocks-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 8px;
}

.decomp-draggable-block {
  padding: 7px 14px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 700;
  border: 1.5px solid transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.decomp-draggable-block:hover {
  transform: translateY(-2px);
  box-shadow: 0 3px 6px rgba(0,0,0,0.15);
}

.block-drag-handle {
  opacity: 0.6;
  font-size: 14px;
}

/* Interactive Structure Chart Canvas */
.modular-task-block {
  max-width: 100%;
  overflow-x: hidden;
  box-sizing: border-box;
}

.decomp-chart-canvas {
  background: var(--paper-card, #fdfcf9);
  border: 1px solid var(--paper-border, #ded7c6);
  border-radius: var(--radius-md, 4px);
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 100%;
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  box-sizing: border-box;
  margin-bottom: 26px;
}

.chart-node-root {
  background: #e11d48;
  color: #ffffff;
  padding: 10px 24px;
  border-radius: 18px;
  font-weight: 800;
  font-size: 14.5px;
  letter-spacing: -0.01em;
  box-shadow: 0 2px 5px rgba(225, 29, 72, 0.25);
  z-index: 2;
}

.chart-tree-trunk {
  width: 3px;
  height: 24px;
  background: #1e2229;
}

html.dark .chart-tree-trunk {
  background: #cbd5e1;
}

.chart-level1-bar-wrap {
  position: relative;
  width: 100%;
  max-width: 980px;
  min-width: 820px;
  padding-top: 24px;
}

.chart-level1-crossbar {
  position: absolute;
  top: 0;
  left: 12.5%;
  right: 12.5%;
  height: 3px;
  background: #1e2229;
}

html.dark .chart-level1-crossbar {
  background: #cbd5e1;
}

.chart-level1-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  position: relative;
}

.chart-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
}

.chart-col-stem {
  position: absolute;
  top: -24px;
  width: 3px;
  height: 24px;
  background: #1e2229;
}

html.dark .chart-col-stem {
  background: #cbd5e1;
}

/* Slots for placed or empty blocks */
.chart-node-slot {
  width: 100%;
  min-height: 54px;
  border-radius: 3px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 8px 10px;
  font-size: 11.5px;
  position: relative;
  transition: all 0.15s ease;
  gap: 4px;
}

.chart-node-slot.empty {
  border: 2px dashed var(--paper-border-strong, #c2b8a3);
  background: var(--paper-recessed, #ede8db);
  color: var(--ink-faint, #94a3b8);
}

.chart-node-slot.filled {
  border: 1.5px solid transparent;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.slot-placeholder {
  font-style: italic;
  font-size: 11px;
}

.slot-text {
  font-weight: 700;
  line-height: 1.35;
}

.slot-remove-btn {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #ef4444;
  color: #ffffff;
  border: none;
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

/* Level 2 Subroutine Branch under slot 4 (Rightmost column) */
.chart-level2-sub-branch {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  margin-top: 10px;
  padding-top: 20px;
  position: relative;
}

.chart-level2-stem {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 3px;
  height: 20px;
  background: #1e2229;
}

html.dark .chart-level2-stem {
  background: #cbd5e1;
}

.chart-level2-crossbar {
  position: absolute;
  top: 20px;
  left: calc(-50% - 7px);
  width: calc(100% + 7px);
  height: 3px;
  background: #1e2229;
}

html.dark .chart-level2-crossbar {
  background: #cbd5e1;
}

.chart-level2-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  width: calc(200% + 14px);
  margin-left: calc(-100% - 14px);
  margin-top: 18px;
  position: relative;
}

.chart-level2-grid .chart-col-stem {
  top: -18px;
  height: 18px;
}

/* DATA FLOW INSPECTOR (Screenshot 2 styling) */
.dataflow-card {
  background: var(--paper-card, #fdfcf9);
  border: 1px solid var(--paper-border, #ded7c6);
  border-radius: var(--radius-md, 4px);
  padding: 20px 24px;
  margin-bottom: 26px;
}

.dataflow-header-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
}

.dataflow-diagram-canvas {
  background: var(--paper-recessed, #ede8db);
  border: 1px solid var(--paper-border, #ded7c6);
  border-radius: 4px;
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.dataflow-parent-node {
  background: #f59e0b;
  color: #1c1917;
  padding: 10px 28px;
  border-radius: 4px;
  font-weight: 700;
  font-size: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.dataflow-parent-node .node-sub {
  font-size: 11px;
  font-family: var(--font-mono);
  font-weight: 600;
  opacity: 0.85;
}

.dataflow-pipe-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  width: 100%;
  max-width: 460px;
}

.flow-trunk-line {
  width: 3px;
  height: 48px;
  background: #1e2229;
}

html.dark .flow-trunk-line {
  background: #cbd5e1;
}

.flow-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 700;
  font-family: var(--font-mono);
}

.flow-pill.param-down {
  background: #e0f2fe;
  color: #0369a1;
  border: 1px solid #7dd3fc;
}

html.dark .flow-pill.param-down {
  background: rgba(14, 165, 233, 0.2);
  color: #38bdf8;
  border-color: #0369a1;
}

.flow-pill.return-up {
  background: #dcfce7;
  color: #15803d;
  border: 1px solid #86efac;
}

html.dark .flow-pill.return-up {
  background: rgba(34, 197, 94, 0.2);
  color: #4ade80;
  border-color: #15803d;
}

.dataflow-stream-down,
.dataflow-stream-up {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.dataflow-stream-down {
  align-items: flex-end;
}

.dataflow-stream-up {
  align-items: flex-start;
}

.flow-dim {
  font-size: 11px;
  color: var(--ink-faint);
  font-style: italic;
}

.dataflow-target-node {
  background: #0d9488;
  color: #ffffff;
  padding: 12px 28px;
  border-radius: 4px;
  text-align: center;
  min-width: 260px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.15);
}

.dataflow-target-node .target-title {
  font-size: 14px;
  font-weight: 800;
  margin-bottom: 4px;
}

.dataflow-target-node .target-desc {
  font-size: 11.5px;
  opacity: 0.9;
  line-height: 1.4;
}

/* Decision Rhombus */
.dataflow-decision-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
}

.decision-rhombus {
  width: 180px;
  height: 52px;
  background: #0f766e;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11.5px;
  font-weight: 700;
  clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%);
  padding: 0 14px;
  text-align: center;
}

.decision-branches {
  display: flex;
  gap: 36px;
}

.branch-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.branch-label {
  font-size: 10.5px;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--ink-secondary);
}

.branch-box {
  background: #f59e0b;
  color: #1c1917;
  padding: 6px 14px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 700;
}

/* ========================================================================= */
/* ENHANCED TASK 1 PUZZLE STYLES                                             */
/* ========================================================================= */

/* Tap-to-read expandable box */
.tap-to-read-box summary {
  cursor: pointer;
  list-style: none;
  transition: opacity 0.15s ease;
}
.tap-to-read-box summary::-webkit-details-marker {
  display: none;
}
.tap-to-read-box summary:hover {
  opacity: 0.9;
}
.tap-to-read-box[open] summary .tap-hint {
  visibility: hidden;
  position: relative;
}
.tap-to-read-box[open] summary .tap-hint::before {
  content: "Collapse ▴";
  visibility: visible;
  position: absolute;
  right: 0;
  white-space: nowrap;
}

.decomp-candidate-chip {
  padding: 8px 14px;
  border-radius: var(--radius-sm, 3px);
  font-size: 12px;
  font-weight: 700;
  border: 1.5px solid #d97706;
  background: #fef3c7;
  color: #78350f;
  cursor: grab;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  transition: all 0.15s ease;
  user-select: none;
}

.decomp-candidate-chip:hover {
  border-color: #b45309;
  background: #fde68a;
  transform: translateY(-1px);
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.decomp-candidate-chip.selected {
  border-color: #b45309;
  background: #fcd34d;
  box-shadow: 0 0 0 2px rgba(217, 119, 6, 0.4);
  transform: translateY(-2px);
}

html.dark .decomp-candidate-chip {
  background: rgba(180, 83, 9, 0.25);
  border-color: #f59e0b;
  color: #fef3c7;
}

html.dark .decomp-candidate-chip:hover {
  background: rgba(180, 83, 9, 0.38);
}

html.dark .decomp-candidate-chip.selected {
  background: rgba(245, 158, 11, 0.45);
  box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.5);
}

.chart-node-slot.awaiting-drop {
  border-color: #f59e0b;
  background: rgba(245, 158, 11, 0.12);
  animation: pulseSlot 1.5s infinite;
}

@keyframes pulseSlot {
  0%, 100% { outline: 2px dashed rgba(245, 158, 11, 0.45); }
  50% { outline: 2px dashed rgba(245, 158, 11, 0.9); }
}

.block-neutral-placed {
  background: #fef3c7 !important;
  color: #78350f !important;
  border: 1.5px solid #f59e0b !important;
  font-weight: 700;
}

html.dark .block-neutral-placed {
  background: rgba(180, 83, 9, 0.3) !important;
  color: #fef3c7 !important;
  border-color: #f59e0b !important;
}

.block-invalid {
  background: rgba(239, 68, 68, 0.15) !important;
  color: #dc2626 !important;
  border: 1.5px solid #ef4444 !important;
}

html.dark .block-invalid {
  color: #fca5a5 !important;
}

.slot-status-icon {
  display: block;
  font-size: 9.5px;
  font-weight: 800;
  margin-top: 3px;
  text-transform: uppercase;
}

.slot-status-icon.correct {
  color: inherit;
  opacity: 0.95;
}

.slot-status-icon.error {
  color: #dc2626;
}

html.dark .slot-status-icon.error {
  color: #fca5a5;
}

/* ========================================================================= */
/* ENHANCED TASK 2 PARAMETER WIRING CHALLENGE STYLES                         */
/* ========================================================================= */

.wiring-context-card {
  background: var(--paper-recessed);
  border: 1px solid var(--paper-border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  margin-bottom: 16px;
}

.wiring-pool-box {
  background: var(--paper-recessed);
  border: 1px solid var(--paper-border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  margin-bottom: 18px;
}

.wiring-chips-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.wiring-var-chip {
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--paper-border-strong);
  background: var(--paper-card);
  color: var(--ink-primary);
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
}

.wiring-var-chip:hover {
  border-color: var(--oxford-navy);
}

.wiring-var-chip.selected {
  border-color: #6366f1;
  background: rgba(99, 102, 241, 0.15);
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.4);
}

html.dark .wiring-var-chip {
  background: var(--paper-card);
  border-color: var(--paper-border-strong);
  color: var(--ink-primary);
}

.wiring-buckets-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}

.wiring-bucket-card {
  background: var(--paper-card);
  border: 1.5px solid var(--paper-border);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.02);
  transition: border-color 0.15s ease;
}

.wiring-bucket-card:hover {
  border-color: var(--oxford-navy);
}

.bucket-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.bucket-title-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.bucket-arrow-icon {
  font-size: 14px;
  font-weight: 900;
}

.bucket-arrow-icon.down { color: #0284c7; }
.bucket-arrow-icon.up { color: #16a34a; }
.bucket-arrow-icon.internal { font-size: 11px; }

.bucket-title {
  font-size: 12.5px;
  color: var(--ink-primary);
}

.bucket-role-badge {
  font-size: 9.5px;
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--ink-secondary);
  background: var(--paper-recessed);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
}

.bucket-desc {
  font-size: 11px;
  color: var(--ink-secondary);
  line-height: 1.45;
  margin: 0;
}

.bucket-items-list {
  min-height: 56px;
  border: 1px dashed var(--paper-border-strong);
  border-radius: var(--radius-sm);
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: var(--paper-recessed);
}

.bucket-var-pill {
  background: var(--paper-card);
  border: 1px solid var(--paper-border);
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  font-size: 11.5px;
  font-family: var(--font-mono);
  font-weight: 600;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.btn-remove-wiring-var {
  background: transparent;
  border: none;
  color: var(--ink-faint);
  font-size: 14px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}

.btn-remove-wiring-var:hover {
  color: #ef4444;
}

.bucket-add-btn {
  padding: 5px 10px;
  font-size: 11px;
  font-weight: 700;
  border-radius: var(--radius-sm);
  border: 1px dashed var(--paper-border-strong);
  background: var(--paper-card);
  color: var(--ink-secondary);
  cursor: pointer;
  transition: all 0.12s ease;
}

.bucket-add-btn:hover {
  border-color: var(--oxford-navy);
  color: var(--ink-primary);
  background: var(--paper-recessed);
}

/* Live AQA Couple Visualisation */
.aqa-live-couple-card {
  background: var(--paper-recessed);
  border: 1px solid var(--paper-border);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  margin-top: 14px;
}

.aqa-visual-trunk-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.aqa-caller-node,
.aqa-callee-node {
  background: var(--oxford-navy);
  color: #ffffff;
  padding: 8px 22px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 700;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.aqa-callee-node {
  background: #0d9488;
}

.aqa-pipe-stem {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  position: relative;
  width: 100%;
  max-width: 420px;
}

.couple-stem-line {
  width: 2px;
  height: 44px;
  background: var(--paper-border-strong);
}

.couple-pill {
  padding: 3px 8px;
  border-radius: 2px;
  font-size: 11px;
  font-family: var(--font-mono);
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.couple-pill.param-pill {
  background: #e0f2fe;
  color: #0369a1;
  border: 1px solid #7dd3fc;
}

html.dark .couple-pill.param-pill {
  background: rgba(14, 165, 233, 0.2);
  color: #38bdf8;
  border-color: #0369a1;
}

.couple-pill.return-pill {
  background: #dcfce7;
  color: #15803d;
  border: 1px solid #86efac;
}

html.dark .couple-pill.return-pill {
  background: rgba(34, 197, 94, 0.2);
  color: #4ade80;
  border-color: #15803d;
}

/* ========================================================================= */
/* ENHANCED TASK 3 MONOLITH & AQA CHART STYLES                              */
/* ========================================================================= */

.monolith-header-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  margin-bottom: 8px;
}

.monolith-metrics-strip {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 14px;
}

.metric-pill {
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-family: var(--font-mono);
  border: 1px solid transparent;
}

.metric-pill.danger {
  background: rgba(239, 68, 68, 0.12);
  color: #ef4444;
  border-color: rgba(239, 68, 68, 0.3);
}

.metric-pill.warn {
  background: rgba(245, 158, 11, 0.12);
  color: #f59e0b;
  border-color: rgba(245, 158, 11, 0.3);
}

.status-unlocked-chip {
  font-size: 9.5px;
  font-weight: 800;
  color: #10b981;
  background: rgba(16, 185, 129, 0.15);
  padding: 1px 5px;
  border-radius: 2px;
}

.status-locked-chip {
  font-size: 9.5px;
  font-weight: 800;
  color: var(--ink-faint);
  background: var(--paper-recessed);
  padding: 1px 5px;
  border-radius: 2px;
}

.aqa-root-badge {
  font-size: 9px;
  letter-spacing: 0.08em;
  font-weight: 900;
  color: #7dd3fc;
}

.aqa-scope-footer {
  font-size: 10px;
  color: var(--ink-faint);
  margin-top: 4px;
  line-height: 1.4;
}

.aqa-benefits-ribbon {
  display: flex;
  justify-content: center;
  gap: 18px;
  flex-wrap: wrap;
  font-size: 11.5px;
  color: var(--ink-secondary);
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px dashed var(--paper-border-strong);
  width: 100%;
}

/* ========================================================================= */
/* ENHANCED TASK 2 WIRING MATRIX & CONTAINER FLATTENING                     */
/* ========================================================================= */

.wiring-matrix-box {
  background: var(--paper-card);
  border: 1px solid var(--paper-border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin-bottom: 16px;
}

.wiring-matrix-list {
  display: flex;
  flex-direction: column;
}

.wiring-matrix-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--paper-border);
  transition: background 0.15s ease;
}

.wiring-matrix-row:last-child {
  border-bottom: none;
}

.wiring-matrix-row:hover {
  background: var(--paper-recessed);
}

.wiring-matrix-row.assigned-param {
  border-left: 4px solid #0284c7;
}

.wiring-matrix-row.assigned-return {
  border-left: 4px solid #16a34a;
}

.wiring-matrix-row.assigned-local {
  border-left: 4px solid #b45309;
}

.wiring-matrix-row.assigned-irrelevant {
  border-left: 4px solid #64748b;
  opacity: 0.7;
}

.wiring-row-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
  min-width: 220px;
}

.wiring-var-name {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-primary);
}

.wiring-var-hint {
  font-size: 11.5px;
  color: var(--ink-secondary);
  line-height: 1.4;
}

.wiring-role-buttons {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.role-btn {
  padding: 6px 11px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid var(--paper-border-strong);
  background: var(--paper-card);
  color: var(--ink-secondary);
  transition: all 0.15s ease;
}

.role-btn:hover {
  color: var(--ink-primary);
  border-color: var(--oxford-navy);
}

.role-btn.btn-param.active {
  background: #0284c7;
  color: #ffffff;
  border-color: #0284c7;
}

.role-btn.btn-return.active {
  background: #16a34a;
  color: #ffffff;
  border-color: #16a34a;
}

.role-btn.btn-local.active {
  background: #b45309;
  color: #ffffff;
  border-color: #b45309;
}

.role-btn.btn-irrelevant.active {
  background: #64748b;
  color: #ffffff;
  border-color: #64748b;
}

/* Analogy Card styling */
.analogy-card {
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
}

.modular-task-block {
  margin-bottom: 34px;
}

/* Flattened and polished container rules (no box in a box in a box) */
.diag-step-card {
  background: transparent;
  border: none;
  padding: 0;
  gap: 12px;
}

.debugger-diag-panel {
  padding: 20px 22px;
}


