/* ============================================
   Lumira Academy — code.css
   Paper 2: Programming (Topics 7 & 8)
   Completely separate from topic.css (Paper 1)
============================================ */

/* ---- SHARED CODE ELEMENTS ---- */

/* Dark code blocks */
.code-block-dark {
  background: #0F172A;
  color: #CBD5E1;
  font-family: 'DM Mono', monospace;
  font-size: 12px;
  line-height: 1.8;
  padding: 14px 16px;
  border-radius: 10px;
  margin: 0;
  white-space: pre;
  overflow-x: auto;
}

/* Pseudocode syntax colours */
.cb-declare { color: #818CF8; font-weight: 600; }  /* DECLARE — indigo */
.cb-kw      { color: #38BDF8; font-weight: 600; }  /* INPUT OUTPUT FOR WHILE IF — sky */
.cb-arrow   { color: #FB923C; font-weight: 600; }  /* ← — orange */
.cb-string  { color: #86EFAC; }                    /* "strings" — green */
.cb-comment { color: #475569; font-style: italic; } /* // comments — slate */
.cb-type    { color: #FCD34D; }                    /* INTEGER STRING etc — amber */
.cb-num     { color: #F472B6; }                    /* numbers — pink */

/* Exam question wrapper */
.exam-q-wrap {
  background: #fff;
  border: 1.5px solid #E2E8F0;
  border-left: 4px solid #F59E0B;
  border-radius: 0 12px 12px 0;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 24px;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.06);
}
.exam-q-badge {
  font-size: 11px;
  font-weight: 700;
  color: #92400E;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  background: rgba(245, 158, 11, 0.12);
  padding: 4px 10px;
  border-radius: 6px;
  width: fit-content;
}
.exam-q-text {
  font-size: 14px;
  color: #1E293B;
  font-weight: 500;
  line-height: 1.65;
}
.exam-q-textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid #E2E8F0;
  border-radius: 8px;
  font-size: 13px;
  font-family: 'DM Sans', sans-serif;
  color: #1E293B;
  outline: none;
  resize: vertical;
  box-sizing: border-box;
  line-height: 1.6;
}
.exam-q-textarea:focus { border-color: #F59E0B; }
.exam-q-feedback {
  display: flex;
  flex-direction: column;
  gap: 12px;
  animation: fadeSlideIn 0.3s ease;
}
.exam-q-model {
  background: #F0FDF4;
  border: 0.5px solid #BBF7D0;
  border-radius: 10px;
  padding: 14px 16px;
}
.exam-q-model-label {
  font-size: 11px;
  font-weight: 700;
  color: #15803D;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: 6px;
}
.exam-q-model-text {
  font-size: 13px;
  color: #1E293B;
  line-height: 1.7;
}
.exam-q-mark-scheme {
  background: #F8FAFC;
  border: 0.5px solid #E2E8F0;
  border-radius: 10px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.exam-q-ms-label {
  font-size: 11px;
  font-weight: 600;
  color: #64748B;
  margin-bottom: 4px;
}
.exam-q-ms-point {
  font-size: 13px;
  color: #1E293B;
  line-height: 1.6;
}

/* ============================================
   LESSON 1 — WHY PROGRAMS NEED VARIABLES
============================================ */

/* The need comparison */
.var-need-demo {
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.var-need-problem {
  background: #fff;
  border: 0.5px solid #E2E8F0;
  border-radius: 14px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.var-need-title {
  font-size: 15px;
  font-weight: 600;
  color: #1E293B;
}
.var-need-question {
  font-size: 13px;
  color: #6366F1;
  font-weight: 500;
}
.var-need-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.var-need-option {
  border-radius: 10px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.var-need-bad  { background: rgba(239,68,68,0.05);  border: 0.5px solid rgba(239,68,68,0.2); }
.var-need-good { background: rgba(34,197,94,0.04);  border: 0.5px solid rgba(34,197,94,0.2); }
.var-need-opt-label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.var-need-bad  .var-need-opt-label { color: #B91C1C; }
.var-need-good .var-need-opt-label { color: #15803D; }

/* Jar visualisation */
.var-jars-wrap {
  background: #F8FAFC;
  border: 0.5px solid #E2E8F0;
  border-radius: 14px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.var-jars-label {
  font-size: 12px;
  font-weight: 600;
  color: #64748B;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}
.var-jars-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
}
.var-jar {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  transition: transform 0.3s;
}
.var-jar-lid {
  width: 52px;
  height: 10px;
  background: #94A3B8;
  border-radius: 4px 4px 0 0;
  transition: background 0.3s;
}
.var-jar-body {
  width: 72px;
  height: 80px;
  border: 3px solid #CBD5E1;
  border-top: none;
  border-radius: 0 0 12px 12px;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.4s;
}
.var-jar-value {
  font-size: 24px;
  font-weight: 700;
  font-family: 'DM Mono', monospace;
  color: #CBD5E1;
  transition: all 0.3s;
}
.var-jar-label-tag {
  margin-top: 6px;
  background: #1E293B;
  color: #E2E8F0;
  font-size: 11px;
  font-weight: 700;
  font-family: 'DM Mono', monospace;
  padding: 3px 10px;
  border-radius: 20px;
}
.var-jar-type {
  font-size: 9px;
  color: #94A3B8;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 2px;
}
.var-jar-op {
  font-size: 24px;
  font-weight: 700;
  color: #CBD5E1;
  margin-bottom: 28px;
}
/* Filled state */
.jar-filled .var-jar-lid   { background: #6366F1; }
.jar-filled .var-jar-body  { border-color: #6366F1; background: #EEF2FF; }
.jar-filled .var-jar-value { color: #4F46E5; }
.var-jar-result.jar-filled .var-jar-lid  { background: #22C55E; }
.var-jar-result.jar-filled .var-jar-body { border-color: #22C55E; background: #F0FDF4; }
.var-jar-result.jar-filled .var-jar-value { color: #15803D; }
.jar-result-glow { animation: jarGlow 0.6s ease; }
@keyframes jarGlow {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.1); }
  100% { transform: scale(1); }
}
.jar-val-filling { animation: jarFill 0.3s ease; }
@keyframes jarFill {
  0%   { opacity: 0; transform: translateY(-8px); }
  100% { opacity: 1; transform: translateY(0); }
}

.var-jars-controls {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.var-jar-input-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}
.var-jar-input-label {
  font-size: 12px;
  font-weight: 600;
  color: #475569;
  font-family: 'DM Mono', monospace;
}
.var-jar-input {
  width: 80px;
  padding: 7px 10px;
  border: 1.5px solid #E2E8F0;
  border-radius: 8px;
  font-size: 14px;
  font-family: 'DM Mono', monospace;
  text-align: center;
  outline: none;
}
.var-jar-input:focus { border-color: #6366F1; }

/* Pseudocode trace output */
.var-jar-pseudo {
  background: #0F172A;
  border-radius: 10px;
  padding: 12px 16px;
  min-height: 40px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.jar-pseudo-line {
  font-family: 'DM Mono', monospace;
  font-size: 12px;
  color: #475569;
  padding: 2px 6px;
  border-radius: 4px;
  transition: all 0.2s;
}
.jar-pseudo-active { color: #CBD5E1; }
.jar-pseudo-result { color: #86EFAC; font-weight: 600; }
.jar-pseudo-comment { color: #334155; font-size: 11px; }

/* Three properties */
.var-properties-wrap {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
}
.var-property-card {
  background: #fff;
  border: 0.5px solid #E2E8F0;
  border-radius: 12px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: center;
}
.var-prop-icon { font-size: 28px; }
.var-prop-title {
  font-size: 13px;
  font-weight: 700;
  color: #1E293B;
}
.var-prop-desc {
  font-size: 12px;
  color: #64748B;
  line-height: 1.6;
}

/* Responsive */
@media (max-width: 680px) {
  .var-need-options     { grid-template-columns: 1fr; }
  .var-properties-wrap  { grid-template-columns: 1fr; }
  .var-jars-row         { gap: 8px; }
}

/* ============================================
   LESSON 2 — DATA TYPES
============================================ */

.inline-code {
  font-family: 'DM Mono', monospace;
  background: #F1F5F9;
  color: #6366F1;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 12px;
}

/* Type selector cards */
.dtype-cards-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  margin-bottom: 4px;
}
.dtype-card-t {
  border: 1.5px solid #E2E8F0;
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.2s;
  background: #fff;
}
.dtype-card-t:hover { transform: translateY(-3px); box-shadow: 0 6px 16px rgba(0,0,0,0.08); }
.dtype-card-active  { border-color: #6366F1; box-shadow: 0 0 0 3px rgba(99,102,241,0.2); }
.dtype-card-color   { height: 6px; }
.dtype-card-name    { font-size: 13px; font-weight: 700; color: #1E293B; padding: 10px 10px 2px; font-family: 'DM Mono', monospace; }
.dtype-card-hint    { font-size: 11px; color: #94A3B8; padding: 0 10px 10px; }

/* Type detail panel */
.dtype-detail-panel {
  background: #F8FAFC;
  border: 0.5px solid #E2E8F0;
  border-radius: 12px;
  padding: 16px;
  min-height: 80px;
  animation: fadeSlideIn 0.2s ease;
}
.dtype-detail-placeholder { font-size: 13px; color: #94A3B8; text-align: center; padding: 20px 0; }
.dtype-detail-inner { display: flex; flex-direction: column; gap: 12px; }
.dtype-detail-header { display: flex; align-items: center; gap: 12px; }
.dtype-detail-badge {
  font-size: 12px; font-weight: 700; color: #fff;
  padding: 4px 12px; border-radius: 8px; font-family: 'DM Mono', monospace;
  text-transform: uppercase; letter-spacing: 0.05em; flex-shrink: 0;
}
.dtype-detail-holds { font-size: 14px; font-weight: 600; color: #1E293B; }
.dtype-detail-grid  { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.dtype-detail-cell  { background: #fff; border: 0.5px solid #E2E8F0; border-radius: 8px; padding: 10px 12px; }
.dtype-detail-cell-label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em; color: #94A3B8; margin-bottom: 4px; }
.dtype-detail-cell-val   { font-size: 12px; color: #1E293B; line-height: 1.55; }
.dtype-detail-cell-val code { font-family: 'DM Mono', monospace; font-size: 11px; color: #6366F1; }

/* Wrong-type rejection demo */
.dtype-reject-wrap {
  background: #fff;
  border: 0.5px solid #E2E8F0;
  border-radius: 12px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.dtype-reject-desc { font-size: 13px; color: #475569; line-height: 1.65; }
.dtype-reject-jar-row { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; }
.dtype-reject-jar { display: flex; flex-direction: column; align-items: center; gap: 0; }
.dtype-reject-jar-lid {
  width: 52px; height: 10px;
  border-radius: 4px 4px 0 0;
  transition: background 0.3s;
}
.dtype-reject-jar-body {
  width: 72px; height: 80px;
  border: 3px solid #22C55E;
  border-top: none;
  border-radius: 0 0 12px 12px;
  background: #F0FDF4;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.3s;
}
.dtype-reject-jar-val {
  font-size: 22px; font-weight: 700;
  font-family: 'DM Mono', monospace;
  color: #15803D;
  transition: all 0.2s;
}
.dtype-reject-jar-tag {
  margin-top: 6px;
  background: #1E293B; color: #E2E8F0;
  font-size: 11px; font-weight: 700;
  font-family: 'DM Mono', monospace;
  padding: 3px 10px; border-radius: 20px;
}
.dtype-reject-jar-type { font-size: 9px; color: #94A3B8; text-transform: uppercase; letter-spacing: 0.06em; margin-top: 2px; }
.reject-jar-accepted { border-color: #22C55E !important; background: #F0FDF4 !important; }
.reject-jar-rejected {
  border-color: #EF4444 !important;
  background: rgba(239,68,68,0.06) !important;
  animation: jarShake 0.4s ease;
}
@keyframes jarShake {
  0%,100% { transform: translateX(0); }
  25%      { transform: translateX(-6px); }
  75%      { transform: translateX(6px); }
}
.dtype-reject-controls { display: flex; flex-direction: column; gap: 8px; flex: 1; }
.dtype-reject-input {
  padding: 9px 14px; border: 1.5px solid #E2E8F0; border-radius: 8px;
  font-size: 13px; font-family: 'DM Mono', monospace; outline: none; width: 100%; box-sizing: border-box;
}
.dtype-reject-input:focus { border-color: #6366F1; }
.dtype-reject-result { font-size: 13px; padding: 8px 12px; border-radius: 8px; line-height: 1.5; min-height: 36px; }
.dtype-reject-accepted { background: rgba(34,197,94,0.08); color: #15803D; border: 0.5px solid rgba(34,197,94,0.3); }
.dtype-reject-rejected { background: rgba(239,68,68,0.06); color: #B91C1C; border: 0.5px solid rgba(239,68,68,0.2); }

/* DECLARE syntax breakdown */
.dtype-syntax-wrap {
  background: #fff;
  border: 0.5px solid #E2E8F0;
  border-radius: 14px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.dtype-syntax-breakdown {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 14px 16px;
  background: #F8FAFC;
  border-radius: 10px;
}
.dtype-syn-part {
  font-family: 'DM Mono', monospace;
  font-size: 15px;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: 8px;
}
.dtype-syn-keyword { background: rgba(129,140,248,0.15); color: #6366F1; }
.dtype-syn-name    { background: rgba(34,197,94,0.12);   color: #15803D; }
.dtype-syn-type    { background: rgba(245,158,11,0.12);  color: #92400E; }
.dtype-syn-colon   { font-size: 22px; font-weight: 700; color: #CBD5E1; }
.dtype-syn-arrow   { font-size: 16px; color: #CBD5E1; }
.dtype-syntax-labels {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.dtype-syn-label {
  font-size: 11px;
  color: #64748B;
  background: #F8FAFC;
  border: 0.5px solid #E2E8F0;
  padding: 4px 10px;
  border-radius: 6px;
  flex: 1;
  min-width: 120px;
  text-align: center;
}

/* Common mistakes */
.mistakes-wrap {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.mistake-card {
  background: #fff;
  border: 0.5px solid #E2E8F0;
  border-radius: 12px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.mistake-wrong,.mistake-right {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.mistake-badge {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 2px 8px;
  border-radius: 4px;
  width: fit-content;
}
.mistake-badge-wrong { background: rgba(239,68,68,0.1);  color: #B91C1C; }
.mistake-badge-right { background: rgba(34,197,94,0.1);  color: #15803D; }
.mistake-code {
  font-family: 'DM Mono', monospace;
  font-size: 12px;
  background: #0F172A;
  color: #CBD5E1;
  padding: 8px 12px;
  border-radius: 6px;
  margin: 0;
}
.mistake-highlight { color: #FCA5A5; text-decoration: underline wavy #EF4444; }
.mistake-reason {
  font-size: 12px;
  color: #475569;
  line-height: 1.55;
  border-top: 0.5px solid #F1F5F9;
  padding-top: 6px;
}

/* Guided type selection */
.guided-type-wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.guided-type-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: #fff;
  border: 0.5px solid #E2E8F0;
  border-radius: 10px;
  flex-wrap: wrap;
  transition: border-color 0.3s;
}
.guided-row-done { border-color: #22C55E; background: rgba(34,197,94,0.02); }
.guided-type-scenario { font-size: 13px; color: #1E293B; flex: 1; min-width: 200px; line-height: 1.5; }
.guided-type-select {
  padding: 7px 12px;
  border: 1.5px solid #E2E8F0;
  border-radius: 8px;
  font-size: 13px;
  font-family: 'DM Mono', monospace;
  outline: none;
  cursor: pointer;
  background: #fff;
}
.guided-type-select:focus { border-color: #6366F1; }
.guided-type-result { font-size: 12px; font-weight: 600; min-width: 100px; }
.guided-type-correct { color: #15803D; }
.guided-type-wrong   { color: #B91C1C; }

/* Independent writing */
.ind-write-wrap { background: #fff; border: 0.5px solid #E2E8F0; border-radius: 12px; padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.ind-write-desc { font-size: 13px; color: #475569; line-height: 1.65; }
.ind-write-rows { display: flex; flex-direction: column; gap: 10px; }
.ind-write-row  { display: flex; flex-direction: column; gap: 6px; }
.ind-write-scenario { font-size: 13px; color: #1E293B; font-weight: 500; }
.ind-write-feedback { font-size: 12px; min-height: 18px; }
.ind-write-correct { color: #15803D; }
.ind-write-wrong   { color: #B91C1C; }

/* Responsive */
@media (max-width: 680px) {
  .dtype-cards-row    { grid-template-columns: repeat(3, 1fr); }
  .dtype-detail-grid  { grid-template-columns: 1fr; }
  .mistakes-wrap      { grid-template-columns: 1fr; }
  .dtype-syntax-breakdown { flex-direction: column; align-items: flex-start; }
}
/* ============================================
   LESSONS 3-9 — SUBTOPIC 8.1 CSS
============================================ */

/* ---- LESSON 3 — NAMING RULES ---- */
.naming-rules-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.naming-rule-card { border-radius: 12px; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.naming-rule-must    { background: rgba(34,197,94,0.05);  border: 0.5px solid rgba(34,197,94,0.3); }
.naming-rule-mustnot { background: rgba(239,68,68,0.04);  border: 0.5px solid rgba(239,68,68,0.2); }
.naming-rule-title { font-size: 13px; font-weight: 700; }
.naming-rule-must    .naming-rule-title { color: #15803D; }
.naming-rule-mustnot .naming-rule-title { color: #B91C1C; }
.naming-rule-items { display: flex; flex-direction: column; gap: 7px; }
.naming-rule-item { font-size: 13px; color: #475569; line-height: 1.5; padding-left: 8px; border-left: 2px solid #E2E8F0; }

.naming-sort-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.naming-sort-card { background: #fff; border: 1.5px solid #E2E8F0; border-radius: 10px; padding: 12px; display: flex; flex-direction: column; gap: 8px; transition: border-color 0.3s; }
.nscard-correct { border-color: #22C55E; }
.nscard-wrong   { border-color: #EF4444; }
.naming-sort-name { font-family: 'DM Mono', monospace; font-size: 13px; color: #1E293B; font-weight: 600; display: block; }
.naming-sort-btns { display: flex; gap: 6px; }
.naming-sort-btn { flex: 1; padding: 6px 8px; border-radius: 6px; font-size: 11px; font-weight: 600; cursor: pointer; font-family: 'DM Sans', sans-serif; border: 1.5px solid; transition: all 0.15s; }
.naming-btn-valid   { background: rgba(34,197,94,0.08); color: #15803D; border-color: rgba(34,197,94,0.3); }
.naming-btn-valid:hover:not(:disabled)   { background: #22C55E; color: #fff; }
.naming-btn-invalid { background: rgba(239,68,68,0.06); color: #B91C1C; border-color: rgba(239,68,68,0.2); }
.naming-btn-invalid:hover:not(:disabled) { background: #EF4444; color: #fff; }
.naming-sort-btn:disabled { opacity: 0.5; cursor: default; }
.naming-sort-result { font-size: 11px; padding: 6px 8px; border-radius: 6px; line-height: 1.45; }
.nsresult-correct { background: rgba(34,197,94,0.08); color: #15803D; }
.nsresult-wrong   { background: rgba(239,68,68,0.06); color: #B91C1C; }

.naming-quality-wrap { background: #F8FAFC; border: 0.5px solid #E2E8F0; border-radius: 12px; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.naming-quality-desc { font-size: 13px; color: #475569; }
.naming-quality-pairs { display: flex; flex-direction: column; gap: 8px; }
.naming-quality-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.naming-quality-bad,.naming-quality-good { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 180px; padding: 8px 12px; border-radius: 8px; }
.naming-quality-bad  { background: rgba(239,68,68,0.05); border: 0.5px solid rgba(239,68,68,0.2); }
.naming-quality-good { background: rgba(34,197,94,0.05); border: 0.5px solid rgba(34,197,94,0.2); }
.naming-quality-bad  code { color: #B91C1C; }
.naming-quality-good code { color: #15803D; }
.naming-quality-bad  span,.naming-quality-good span { font-size: 11px; color: #64748B; }
.naming-quality-vs { font-size: 11px; font-weight: 700; color: #94A3B8; flex-shrink: 0; }

/* ---- LESSON 4 — ASSIGNMENT ---- */
.assign-demo-wrap { background: #fff; border: 0.5px solid #E2E8F0; border-radius: 14px; padding: 20px; display: grid; grid-template-columns: 120px 1fr 1fr; gap: 20px; align-items: start; }
.assign-box-col { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.assign-box-label { font-size: 12px; font-weight: 600; color: #64748B; text-transform: uppercase; letter-spacing: 0.07em; }
.assign-box { width: 90px; height: 90px; border: 3px solid #6366F1; border-radius: 14px; background: #EEF2FF; display: flex; align-items: center; justify-content: center; font-size: 32px; font-weight: 700; font-family: 'DM Mono', monospace; color: #4F46E5; transition: all 0.3s; }
.assign-box-type { font-size: 10px; color: #94A3B8; text-transform: uppercase; letter-spacing: 0.06em; }
.assign-box-changing { animation: boxChange 0.4s ease; }
@keyframes boxChange { 0%{opacity:1;transform:scale(1)} 30%{opacity:0;transform:scale(0.8)} 70%{opacity:0;transform:scale(0.8)} 100%{opacity:1;transform:scale(1)} }
.assign-steps-col { display: flex; flex-direction: column; gap: 6px; }
.assign-step { font-family: 'DM Mono', monospace; font-size: 13px; color: #94A3B8; padding: 8px 12px; border-radius: 8px; border: 1.5px solid #F1F5F9; transition: all 0.25s; }
.assign-step-active { border-color: #6366F1; background: #EEF2FF; color: #4F46E5; font-weight: 600; }
.assign-step-done   { border-color: rgba(34,197,94,0.3); background: rgba(34,197,94,0.04); color: #15803D; }
.assign-explain-col { font-size: 13px; color: #475569; line-height: 1.7; background: #F8FAFC; border-radius: 10px; padding: 14px; border: 0.5px solid #E2E8F0; }

/* ---- LESSON 5 — OPERATORS ---- */
.ops-compare-table { border-radius: 12px; overflow: hidden; border: 0.5px solid #E2E8F0; }
.ops-compare-header { display: grid; grid-template-columns: 2fr 1fr 2fr 2fr 1fr; gap: 0; background: #F1F5F9; font-size: 11px; font-weight: 700; color: #64748B; text-transform: uppercase; letter-spacing: 0.06em; padding: 10px 14px; }
.ops-compare-row { display: grid; grid-template-columns: 2fr 1fr 2fr 2fr 1fr; gap: 0; padding: 10px 14px; border-top: 0.5px solid #F1F5F9; font-size: 13px; color: #475569; }
.ops-compare-highlight { background: rgba(99,102,241,0.04); }
.ops-compare-row div:nth-child(1) { color: #1E293B; font-weight: 500; }
.ops-compare-row div:nth-child(5) { font-family: 'DM Mono', monospace; font-weight: 700; color: #6366F1; }
.ops-maths-sym { font-size: 16px; }

.divmod-explainer { background: #fff; border: 0.5px solid #E2E8F0; border-radius: 14px; padding: 20px; display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.divmod-visual { display: flex; flex-direction: column; gap: 14px; }
.divmod-sum { font-size: 22px; font-weight: 700; font-family: 'DM Mono', monospace; color: #1E293B; text-align: center; }
.divmod-breakdown { display: flex; align-items: center; gap: 12px; justify-content: center; }
.divmod-part { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px 20px; border-radius: 12px; }
.divmod-div { background: rgba(99,102,241,0.06); border: 1.5px solid rgba(99,102,241,0.2); }
.divmod-mod { background: rgba(245,158,11,0.06); border: 1.5px solid rgba(245,158,11,0.2); }
.divmod-part-val { font-size: 36px; font-weight: 700; font-family: 'DM Mono', monospace; }
.divmod-div .divmod-part-val { color: #6366F1; }
.divmod-mod .divmod-part-val { color: #D97706; }
.divmod-part-label { font-size: 11px; font-weight: 600; color: #64748B; text-align: center; }
.divmod-part-code code { font-family: 'DM Mono', monospace; font-size: 11px; color: #94A3B8; }
.divmod-remainder-visual { display: flex; flex-direction: column; gap: 4px; justify-content: center; }
.divmod-rem-dot { width: 8px; height: 8px; background: #F59E0B; border-radius: 50%; }
.divmod-try { display: flex; flex-direction: column; gap: 10px; justify-content: center; }
.divmod-try-row { display: flex; align-items: center; gap: 10px; }
.divmod-try-note { font-size: 13px; color: #475569; line-height: 1.6; }

/* ---- LESSON 6 — INPUT ---- */
.io-phase-card { background: #fff; border: 0.5px solid #E2E8F0; border-radius: 14px; padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.io-phase-syntax { background: #0F172A; border-radius: 10px; padding: 14px 18px; display: flex; flex-direction: column; gap: 6px; }
.io-syntax-line { font-family: 'DM Mono', monospace; font-size: 16px; }
.io-syn-varname { color: #86EFAC; }
.io-syntax-meaning { font-size: 12px; color: #475569; }
.input-flow-demo { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.input-flow-keyboard { display: flex; flex-direction: column; gap: 8px; min-width: 200px; }
.input-flow-label { font-size: 11px; font-weight: 600; color: #94A3B8; text-transform: uppercase; letter-spacing: 0.07em; }
.input-flow-arrow { font-size: 32px; color: #CBD5E1; transition: all 0.3s; flex-shrink: 0; }
.input-flow-var { display: flex; flex-direction: column; align-items: center; }
.io-pseudo-trace { font-size: 12px; color: #6366F1; font-family: 'DM Mono', monospace; background: rgba(99,102,241,0.06); padding: 8px 12px; border-radius: 6px; }
.multi-input-demo { display: flex; flex-direction: column; gap: 10px; background: #F8FAFC; border: 0.5px solid #E2E8F0; border-radius: 12px; padding: 16px; }
.multi-input-note { font-size: 13px; color: #475569; line-height: 1.65; }

/* ---- LESSON 7 — OUTPUT ---- */
.output-three-forms { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.output-form-card { background: #fff; border: 0.5px solid #E2E8F0; border-radius: 12px; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.output-form-type { font-size: 11px; font-weight: 700; color: #6366F1; text-transform: uppercase; letter-spacing: 0.06em; }
.output-form-run { align-self: flex-start; }
.output-form-screen { background: #0F172A; color: #86EFAC; font-family: 'DM Mono', monospace; font-size: 14px; font-weight: 600; padding: 10px 14px; border-radius: 8px; min-height: 40px; display: flex; align-items: center; }
.output-screen-active { animation: fadeSlideIn 0.3s ease; }

.concat-explainer { background: #F8FAFC; border: 0.5px solid #E2E8F0; border-radius: 14px; padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.concat-breakdown { display: flex; flex-direction: row; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap; padding: 16px; background: #0F172A; border-radius: 10px; }
.concat-part { background: #fff; border: 1.5px solid #E2E8F0; border-radius: 8px; padding: 8px 14px; font-family: 'DM Mono', monospace; font-size: 13px; }
.concat-str { border-color: rgba(99,102,241,0.3); }
.concat-var { border-color: rgba(34,197,94,0.3); color: #15803D; }
.concat-join { font-size: 20px; font-weight: 700; color: #F59E0B; }
.concat-result-arrow { font-size: 20px; color: #CBD5E1; }
.concat-result { background: #0F172A; color: #86EFAC; font-family: 'DM Mono', monospace; font-size: 14px; font-weight: 600; padding: 12px 20px; border-radius: 10px; text-align: center; transition: all 0.2s; }
.concat-try { display: flex; align-items: center; gap: 10px; justify-content: center; flex-wrap: wrap; }
.concat-try-label { font-size: 13px; color: #475569; }

/* ---- LESSON 8 — BLUEPRINT ---- */
.blueprint-full-wrap { display: flex; flex-direction: column; gap: 0; border-radius: 14px; overflow: hidden; border: 0.5px solid #E2E8F0; }
.blueprint-part { display: flex; gap: 16px; padding: 16px 18px; border-bottom: 0.5px solid #E2E8F0; }
.bp-part-declare { background: rgba(129,140,248,0.06); }
.bp-part-input   { background: rgba(56,189,248,0.05); }
.bp-part-process { background: rgba(245,158,11,0.05); }
.bp-part-output  { background: rgba(34,197,94,0.04); border-bottom: none; }
.bp-part-num { width: 32px; height: 32px; border-radius: 50%; background: #1E293B; color: #E2E8F0; font-size: 14px; font-weight: 700; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.bp-part-content { display: flex; flex-direction: column; gap: 6px; flex: 1; }
.bp-part-title { font-size: 14px; font-weight: 600; color: #1E293B; }
.bp-part-desc  { font-size: 13px; color: #475569; line-height: 1.6; }
.bp-code-small { font-size: 11px !important; padding: 8px 12px !important; }
.blueprint-connector { text-align: center; font-size: 18px; color: #CBD5E1; background: #fff; padding: 4px 0; border-left: 0.5px solid #E2E8F0; border-right: 0.5px solid #E2E8F0; }

.seq-broken-wrap { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.seq-broken-example { display: flex; flex-direction: column; gap: 8px; }
.seq-broken-label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; }
.seq-broken-result { font-size: 13px; color: #475569; line-height: 1.55; padding: 8px 12px; background: #F8FAFC; border-radius: 6px; }

.full-program-exercise { background: #fff; border: 0.5px solid #E2E8F0; border-radius: 14px; padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.full-prog-task { font-size: 13px; color: #475569; line-height: 1.7; background: #F8FAFC; border-left: 3px solid #6366F1; padding: 10px 14px; border-radius: 0 8px 8px 0; }
.full-prog-lines { display: flex; flex-direction: column; gap: 6px; }

/* ---- LESSON 9 — CHECKPOINT ---- */
.checkpoint-challenge { background: #fff; border: 0.5px solid #E2E8F0; border-radius: 12px; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.checkpoint-task { font-size: 13px; color: #1E293B; line-height: 1.7; }

/* Responsive */
@media (max-width: 680px) {
  .naming-sort-grid    { grid-template-columns: 1fr 1fr; }
  .naming-rules-grid   { grid-template-columns: 1fr; }
  .assign-demo-wrap    { grid-template-columns: 1fr; }
  .output-three-forms  { grid-template-columns: 1fr; }
  .ops-compare-header,.ops-compare-row { grid-template-columns: 2fr 1fr 1fr 1fr 1fr; font-size: 11px; }
  .divmod-explainer    { grid-template-columns: 1fr; }
  .seq-broken-wrap     { grid-template-columns: 1fr; }
}

/* ---- SYMBOL PALETTE ---- */
.sym-palette {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  padding: 8px 10px;
  background: #0F172A;
  border-radius: 8px 8px 0 0;
  border-bottom: 1px solid #1E293B;
}
.sym-btn {
  background: #1E293B;
  color: #C7D2FE;
  border: 1px solid #334155;
  border-radius: 5px;
  padding: 4px 10px;
  font-family: 'DM Mono', monospace;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
  user-select: none;
}
.sym-btn:hover { background: #6366F1; border-color: #6366F1; color: #fff; }
.sym-palette-label { font-size: 10px; color: #475569; display: flex; align-items: center; margin-right: 4px; text-transform: uppercase; letter-spacing: 0.07em; }

/* ---- CODE WRITE EXERCISE (replaces old pwe-input style) ---- */
.code-write-wrap {
  background: #0F172A;
  border-radius: 12px;
  overflow: hidden;
  border: 1.5px solid #1E293B;
  transition: border-color 0.2s;
}
.code-write-wrap:focus-within { border-color: #6366F1; }
.code-write-lines { padding: 10px 14px; display: flex; flex-direction: column; gap: 4px; }
.code-write-line { display: flex; align-items: center; gap: 10px; }
.code-write-num { font-size: 11px; color: #334155; font-family: 'DM Mono', monospace; min-width: 20px; text-align: right; flex-shrink: 0; }
.code-write-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font-family: 'DM Mono', monospace;
  font-size: 13px;
  color: #E2E8F0;
  padding: 5px 8px;
  border-radius: 4px;
  transition: background 0.15s;
  caret-color: #6366F1;
}
.code-write-input::placeholder { color: #334155; }
.code-write-input:focus { background: rgba(99,102,241,0.08); }
.code-write-input.cw-correct { color: #86EFAC; }
.code-write-input.cw-wrong   { color: #FCA5A5; animation: codeShake 0.3s ease; }
@keyframes codeShake { 0%,100%{transform:translateX(0)} 25%{transform:translateX(-4px)} 75%{transform:translateX(4px)} }
.code-write-feedback-line { font-size: 11px; color: #475569; padding: 2px 8px; border-radius: 4px; min-height: 18px; font-family: 'DM Mono', monospace; }
.cwf-correct { color: #86EFAC; }
.cwf-wrong   { color: #FCA5A5; }

/* ---- CONCAT VISUAL FIX (horizontal) ---- */

.concat-result-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}
.concat-equals { font-size: 18px; font-weight: 700; color: #475569; }

/* ---- INPUT FLOW REDESIGN ---- */
.input-flow-demo {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 16px;
  background: #F8FAFC;
  border: 0.5px solid #E2E8F0;
  border-radius: 12px;
  flex-wrap: wrap;
}
.input-flow-keyboard {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.io-user-input {
  padding: 10px 14px;
  border: 1.5px solid #6366F1;
  border-radius: 10px;
  font-size: 14px;
  font-family: 'DM Mono', monospace;
  outline: none;
  background: #fff;
  min-width: 180px;
}
.io-user-input:focus { box-shadow: 0 0 0 3px rgba(99,102,241,0.15); }

/* ---- CHECKPOINT GATE ---- */
.cp-gate-note {
  font-size: 12px;
  color: #6366F1;
  background: rgba(99,102,241,0.06);
  border: 0.5px solid rgba(99,102,241,0.2);
  border-radius: 8px;
  padding: 8px 12px;
  margin-top: 6px;
}
.cp-score-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 6px;
}
.cp-score-badge {
  font-size: 12px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 6px;
  font-family: 'DM Mono', monospace;
}
.cp-score-good { background: rgba(34,197,94,0.1); color: #15803D; }
.cp-score-ok   { background: rgba(245,158,11,0.1); color: #92400E; }
.cp-score-low  { background: rgba(239,68,68,0.08); color: #B91C1C; }

/* INPUT good/bad practice */
.io-good-bad-wrap { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.io-practice-card { border-radius: 10px; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.io-practice-bad  { background: rgba(239,68,68,0.04); border: 0.5px solid rgba(239,68,68,0.2); }
.io-practice-good { background: rgba(34,197,94,0.04); border: 0.5px solid rgba(34,197,94,0.2); }
.io-practice-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; }
.io-practice-bad  .io-practice-label { color: #B91C1C; }
.io-practice-good .io-practice-label { color: #15803D; }

/* ind-write scenarios list */
.ind-write-scenarios-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 4px; }
.ind-write-scenario-item { font-size: 13px; color: #475569; padding: 6px 0; border-bottom: 0.5px solid #F1F5F9; }
.ind-write-scenario-item:last-child { border-bottom: none; }

@media (max-width: 680px) {
  .io-good-bad-wrap { grid-template-columns: 1fr; }
}

/* ---- EXTRACTED INLINE STYLES ---- */
.is-1 { width:0% }
.is-2 { margin-top:10px }
.is-3 { background:#22C55E }
.is-4 { background:#F59E0B }
.is-5 { background:#6366F1 }
.is-6 { background:#EF4444 }
.is-7 { background:#EC4899 }
.is-8 { margin-top:24px }
.is-9 { margin-top:12px }
.is-10 { margin-top:20px }
.is-11 { margin-top:14px }
.is-12 { width:70px }
.is-13 { margin-bottom:10px }
.is-14 { margin-top:8px }
.is-15 { width:80px }
.is-16 { color:#15803D }
.is-17 { display:none }
.is-18 { color:#64748B }

/* ---- TOTAL JAR RESULT PROMINENCE ---- */
.var-jar-result .var-jar-body {
  border-width: 3px;
  border-color: #6366F1;
  background: #EEF2FF;
}
.var-jar-result .var-jar-value {
  color: #6366F1 !important;
  font-size: 26px !important;
}
.var-jar-result:not(.jar-filled) .var-jar-value { color: #A5B4FC !important; font-size: 20px !important; }
/* Restore green when filled — must come after and use higher specificity */
.var-jar-result.jar-filled .var-jar-value { color: #15803D !important; }
.jar-result-glow .var-jar-body { box-shadow: 0 0 20px rgba(99,102,241,0.4); }

/* Checkpoint exam-q-textarea with palette attached */
.cp-textarea-wrap { display: flex; flex-direction: column; }
.cp-textarea-wrap .sym-palette { border-radius: 8px 8px 0 0; margin-bottom: 0; }
.cp-textarea-wrap .exam-q-textarea { border-top: none; border-radius: 0 0 8px 8px; }

/* cp-score-detail */
.cp-score-detail { font-size: 12px; color: #64748B; }
/* ---- NEXT BUTTON STATES ---- */
/* Disabled = not yet ready */
.btn-lesson-next:disabled,
.btn-lesson-next[disabled] {
  background: #E2E8F0 !important;
  border-color: #CBD5E1 !important;
  color: #94A3B8 !important;
  cursor: not-allowed !important;
  opacity: 1 !important;
}
/* Enabled = ready to proceed — turn green */
.btn-lesson-next:not(:disabled) {
  background: #16A34A !important;
  border-color: #16A34A !important;
  color: #fff !important;
  cursor: pointer !important;
}
.btn-lesson-next:not(:disabled):hover {
  background: #15803D !important;
  border-color: #15803D !important;
}
/* btn-complete (L8/L9) disabled state */
.btn-complete:disabled,
.btn-complete[disabled] {
  background: #E2E8F0 !important;
  border-color: #CBD5E1 !important;
  color: #94A3B8 !important;
  cursor: not-allowed !important;
  opacity: 1 !important;
}

/* ---- EXAM NUDGE FEEDBACK ---- */
.exam-q-nudge {
  margin-bottom: 12px;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 14px;
  line-height: 1.6;
}
.exam-q-nudge.nudge-hint {
  background: #FFF7ED;
  border: 1px solid #FED7AA;
  color: #9A3412;
}
.exam-q-nudge.nudge-hint::before {
  content: "Hint: ";
  font-weight: 700;
}
.exam-q-nudge.nudge-ok {
  background: #F0FDF4;
  border: 1px solid #BBF7D0;
  color: #15803D;
}
.exam-q-nudge.nudge-ok::before {
  content: "Good attempt — ";
  font-weight: 700;
}

/* ════════════════════════════════════════════
   SUBTOPIC 8.2 — SELECTION
   ════════════════════════════════════════════ */

/* ---- CONDITION EVALUATOR (L10) ---- */
.cond-eval-wrap {
  background: #1E293B;
  border-radius: 12px;
  padding: 24px;
  margin: 16px 0;
}
.cond-eval-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.cond-eval-varname {
  font-family: 'DM Mono', monospace;
  font-size: 17px;
  color: #A5B4FC;
  font-weight: 600;
}
.cond-eval-input {
  background: #0F172A;
  border: 1px solid #334155;
  color: #F8FAFC;
  border-radius: 8px;
  padding: 8px 12px;
  font-family: 'DM Mono', monospace;
  font-size: 16px;
  width: 80px;
  text-align: center;
}
.cond-eval-op-select {
  background: #0F172A;
  border: 1px solid #334155;
  color: #F59E0B;
  border-radius: 8px;
  padding: 8px 10px;
  font-family: 'DM Mono', monospace;
  font-size: 16px;
  cursor: pointer;
}
.cond-eval-eq {
  font-size: 14px;
  color: #64748B;
}
.cond-result-badge {
  font-family: 'DM Mono', monospace;
  font-size: 20px;
  font-weight: 700;
  padding: 8px 18px;
  border-radius: 8px;
  min-width: 90px;
  text-align: center;
  transition: all 0.25s;
}
.cond-result-true  { background: #14532D; color: #4ADE80; border: 1px solid #166534; }
.cond-result-false { background: #450A0A; color: #FCA5A5; border: 1px solid #7F1D1D; }
.cond-slider-row {
  display: flex;
  align-items: center;
  gap: 12px;
}
.cond-slider-label {
  font-family: 'DM Mono', monospace;
  font-size: 14px;
  color: #94A3B8;
  white-space: nowrap;
  min-width: 100px;
}
.cond-slider {
  -webkit-appearance: none;
  appearance: none;
  flex: 1;
  height: 6px;
  background: #334155;
  border-radius: 3px;
  outline: none;
  cursor: pointer;
}
.cond-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #6366F1;
  cursor: pointer;
}
.cond-slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #6366F1;
  cursor: pointer;
  border: none;
}

/* ---- OPERATOR TABLE (L10) ---- */
.op-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 12px 0;
}
.op-cell {
  background: #1E293B;
  border: 1px solid #334155;
  border-radius: 8px;
  padding: 12px;
  text-align: center;
}
.op-cell-sym  { font-family: 'DM Mono', monospace; font-size: 20px; color: #F59E0B; display: block; }
.op-cell-name { font-size: 12px; color: #94A3B8; display: block; margin-top: 4px; }
.op-cell-eg   { font-family: 'DM Mono', monospace; font-size: 11px; color: #475569; display: block; margin-top: 4px; }

/* ---- LOGICAL EVALUATOR (L10) ---- */
.logic-eval-wrap {
  background: #1E293B;
  border-radius: 12px;
  padding: 20px;
  margin: 16px 0;
}
.logic-cond-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.logic-cond-label {
  font-size: 13px;
  color: #64748B;
  min-width: 70px;
}
.logic-op-select {
  background: #0F172A;
  border: 1px solid #6366F1;
  color: #A5B4FC;
  border-radius: 8px;
  padding: 8px 14px;
  font-family: 'DM Mono', monospace;
  font-size: 15px;
  cursor: pointer;
  margin: 8px 0;
}
.logic-combined-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #334155;
  flex-wrap: wrap;
}
.logic-combined-label {
  font-size: 13px;
  color: #94A3B8;
}

/* ---- FORK DIAGRAM (L11, L12) ---- */
.fork-diagram {
  margin: 20px 0;
  text-align: center;
}
.fork-cond-display {
  display: inline-block;
  background: #312E81;
  border: 2px solid #6366F1;
  border-radius: 8px;
  padding: 10px 20px;
  font-family: 'DM Mono', monospace;
  font-size: 15px;
  color: #C7D2FE;
  margin-bottom: 4px;
}
.fork-divider {
  width: 2px;
  height: 16px;
  background: #475569;
  margin: 0 auto;
}
.fork-branches {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 0;
}
.fork-branch {
  flex: 1;
  max-width: 220px;
  border-radius: 10px;
  padding: 14px;
  transition: all 0.3s;
  border: 2px solid transparent;
  text-align: center;
}
.fork-branch-yes { background: #1A3A1A; border-color: #166534; }
.fork-branch-no  { background: #1E293B; border-color: #334155; }
.fork-branch-label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 8px;
  display: block;
}
.fork-branch-yes .fork-branch-label { color: #4ADE80; }
.fork-branch-no  .fork-branch-label { color: #64748B; }
.fork-branch-content {
  font-family: 'DM Mono', monospace;
  font-size: 13px;
  color: #CBD5E1;
}
.fork-branch-no .fork-branch-content { color: #475569; font-style: italic; }
.fork-branch.fork-dim { opacity: 0.25; }
.fork-branch.fork-lit { opacity: 1; }
.fork-branch-yes.fork-lit { box-shadow: 0 0 14px rgba(34,197,94,0.25); }
.fork-branch-no.fork-lit  { box-shadow: 0 0 14px rgba(251,191,36,0.2); border-color: #B45309; background: #2D1B00; }
.fork-branch-no.fork-lit .fork-branch-label { color: #FBB024; }
.fork-branch-no.fork-lit .fork-branch-content { color: #FDE68A; font-style: normal; }
.fork-slider-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.fork-val-display {
  font-family: 'DM Mono', monospace;
  font-size: 22px;
  font-weight: 700;
  color: #A5B4FC;
  min-width: 40px;
  text-align: center;
}
.fork-threshold-note {
  font-size: 13px;
  color: #64748B;
}

/* ---- CASE ROUTER (L14) ---- */
.case-router {
  background: #1E293B;
  border-radius: 12px;
  padding: 20px 24px;
  margin: 16px 0;
}
.case-router-control {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.case-router-label {
  font-size: 14px;
  color: #94A3B8;
}
.case-router-input {
  background: #0F172A;
  border: 1px solid #6366F1;
  color: #A5B4FC;
  border-radius: 8px;
  padding: 8px 14px;
  font-family: 'DM Mono', monospace;
  font-size: 18px;
  width: 70px;
  text-align: center;
}
.case-line {
  font-family: 'DM Mono', monospace;
  font-size: 14px;
  padding: 5px 8px;
  border-radius: 4px;
  transition: all 0.2s;
  color: #94A3B8;
  margin-bottom: 2px;
  border-left: 3px solid transparent;
}
.case-line.case-keyword  { color: #A5B4FC; }
.case-line.case-matched  { background: #1A2E1A; border-left-color: #22C55E; color: #4ADE80; }
.case-line.case-unmatched { opacity: 0.3; }

/* ---- NESTED IF VISUAL (L13) ---- */
.nested-vis {
  background: #0F172A;
  border-radius: 12px;
  padding: 20px;
  margin: 16px 0;
  font-family: 'DM Mono', monospace;
  font-size: 14px;
  color: #E2E8F0;
}
.nv-line {
  padding: 4px 0;
  line-height: 1.6;
  transition: all 0.2s;
}
.nv-kw-if    { color: #A5B4FC; }
.nv-kw-then  { color: #94A3B8; }
.nv-kw-else  { color: #94A3B8; }
.nv-kw-endif { color: #6366F1; }
.nv-kw-out   { color: #22C55E; }
.nv-cond     { color: #F59E0B; }
.nv-str      { color: #F9A8D4; }
.nv-active   { background: rgba(99,102,241,0.12); border-radius: 4px; }
.nv-dim      { opacity: 0.35; }
.nv-bracket  { display: inline-block; width: 3px; border-radius: 2px; margin-right: 6px; vertical-align: middle; }
.nv-br-outer { background: #6366F1; }
.nv-br-inner { background: #F59E0B; }
.nested-controls {
  display: flex;
  gap: 24px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.nested-ctrl {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-width: 160px;
}
.nested-ctrl-label {
  font-size: 13px;
  color: #94A3B8;
}
.nested-val-display {
  font-family: 'DM Mono', monospace;
  font-size: 18px;
  color: #A5B4FC;
  font-weight: 700;
}

/* ---- DEBUG EXERCISE (L12, L13, L16) ---- */
.debug-program-wrap {
  margin: 16px 0;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid #334155;
}
.debug-program-header {
  background: #1E293B;
  padding: 10px 16px;
  font-size: 13px;
  color: #94A3B8;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.debug-program-body {
  background: #0F172A;
  padding: 16px 20px;
}
.debug-line {
  font-family: 'DM Mono', monospace;
  font-size: 14px;
  color: #E2E8F0;
  padding: 3px 0;
  line-height: 1.6;
}
.debug-line.broken {
  background: rgba(239,68,68,0.12);
  border-left: 3px solid #EF4444;
  padding-left: 8px;
  color: #FCA5A5;
}
.debug-answer-row {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  align-items: flex-start;
  flex-wrap: wrap;
}
.debug-answer-input {
  flex: 1;
  min-width: 200px;
  background: #0F172A;
  border: 1px solid #334155;
  color: #F8FAFC;
  border-radius: 8px;
  padding: 8px 12px;
  font-family: 'DM Mono', monospace;
  font-size: 14px;
}
.debug-feedback {
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 14px;
  margin-top: 8px;
  display: none;
  font-family: 'DM Mono', monospace;
}
.debug-ok   { background: #14532D; color: #4ADE80; border: 1px solid #166634; display: block; }
.debug-fail { background: #450A0A; color: #FCA5A5; border: 1px solid #7F1D1D; display: block; }
.debug-set-label {
  font-size: 13px;
  color: #64748B;
  margin-bottom: 6px;
  font-weight: 600;
}
.debug-set {
  margin-bottom: 24px;
  padding-bottom: 24px;
  border-bottom: 1px solid #1E293B;
}
.debug-set:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }

/* ---- L15 DESIGN PHASE ---- */
.design-phase-wrap {
  background: #1E293B;
  border-radius: 12px;
  padding: 20px 24px;
  margin: 16px 0;
}
.design-phase-q {
  font-size: 14px;
  color: #94A3B8;
  margin-bottom: 8px;
}
.design-phase-input {
  width: 100%;
  background: #0F172A;
  border: 1px solid #334155;
  color: #F8FAFC;
  border-radius: 8px;
  padding: 10px 14px;
  font-family: 'DM Mono', monospace;
  font-size: 14px;
  margin-bottom: 16px;
  box-sizing: border-box;
}
.design-phase-row { margin-bottom: 16px; }

/* ---- SKELETON CODE (L15) ---- */
.skeleton-wrap {
  background: #0F172A;
  border-radius: 12px;
  padding: 20px;
  margin: 16px 0;
  font-family: 'DM Mono', monospace;
}
.skeleton-line {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.skeleton-fixed {
  color: #A5B4FC;
  font-size: 14px;
}
.skeleton-blank {
  background: #1E293B;
  border: 1px solid #6366F1;
  border-radius: 4px;
  color: #F8FAFC;
  font-family: 'DM Mono', monospace;
  font-size: 14px;
  padding: 4px 8px;
  width: 100px;
  text-align: center;
}
.skeleton-blank.wide { width: 160px; }

/* ════════════════════════════════════════════
   SUBTOPIC 8.3 — ITERATION
   ════════════════════════════════════════════ */

/* ---- FOR LOOP STAIRCASE (L17) ---- */
.loop-stair-wrap {
  background: #1E293B;
  border-radius: 12px;
  padding: 24px;
  margin: 16px 0;
}
.loop-stair-controls {
  display: flex;
  gap: 20px;
  align-items: center;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.loop-stepper {
  display: flex;
  align-items: center;
  gap: 8px;
}
.loop-stepper-label {
  font-size: 13px;
  color: #94A3B8;
  font-family: 'DM Mono', monospace;
}
.loop-stepper-btn {
  background: #0F172A;
  border: 1px solid #6366F1;
  color: #A5B4FC;
  width: 30px;
  height: 30px;
  border-radius: 6px;
  font-size: 18px;
  cursor: pointer;
  line-height: 1;
}
.loop-stepper-val {
  font-family: 'DM Mono', monospace;
  font-size: 18px;
  color: #F8FAFC;
  min-width: 28px;
  text-align: center;
}
.loop-stair-track {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.loop-stair-row {
  display: flex;
  align-items: center;
  gap: 14px;
}
.loop-stair-slot {
  width: 48px;
  height: 38px;
  border-radius: 8px;
  background: #0F172A;
  border: 1px solid #334155;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'DM Mono', monospace;
  font-size: 16px;
  color: #64748B;
  transition: all 0.3s;
  flex-shrink: 0;
}
.loop-stair-slot.slot-active {
  background: #312E81;
  border-color: #6366F1;
  color: #C7D2FE;
  box-shadow: 0 0 14px rgba(99,102,241,0.4);
  transform: scale(1.08);
}
.loop-stair-slot.slot-done {
  background: #14532D;
  border-color: #166534;
  color: #4ADE80;
}
.loop-stair-output {
  font-family: 'DM Mono', monospace;
  font-size: 15px;
  color: #475569;
  transition: all 0.3s;
}
.loop-stair-output.out-shown { color: #22C55E; }
.loop-counter-live {
  display: inline-block;
  background: #0F172A;
  border: 1px solid #6366F1;
  border-radius: 8px;
  padding: 6px 16px;
  font-family: 'DM Mono', monospace;
  font-size: 16px;
  color: #A5B4FC;
  margin-left: auto;
}

/* ---- WHILE GATE (L18) ---- */
.gate-wrap {
  background: #1E293B;
  border-radius: 12px;
  padding: 24px;
  margin: 16px 0;
}
.gate-diagram {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
}
.gate-flow-box {
  background: #0F172A;
  border: 1px solid #334155;
  border-radius: 8px;
  padding: 10px 18px;
  font-family: 'DM Mono', monospace;
  font-size: 14px;
  color: #CBD5E1;
  text-align: center;
}
.gate-arrow {
  width: 2px;
  height: 18px;
  background: #475569;
}
.gate-condition {
  background: #312E81;
  border: 2px solid #6366F1;
  border-radius: 10px;
  padding: 12px 24px;
  font-family: 'DM Mono', monospace;
  font-size: 15px;
  color: #C7D2FE;
  transition: all 0.3s;
}
.gate-condition.gate-open {
  background: #14532D;
  border-color: #22C55E;
  color: #4ADE80;
  box-shadow: 0 0 16px rgba(34,197,94,0.3);
}
.gate-condition.gate-shut {
  background: #450A0A;
  border-color: #7F1D1D;
  color: #FCA5A5;
}
.gate-body {
  background: #1A2E1A;
  border: 1px solid #166534;
  border-radius: 8px;
  padding: 10px 18px;
  font-family: 'DM Mono', monospace;
  font-size: 14px;
  color: #86EFAC;
  text-align: center;
  transition: all 0.3s;
}
.gate-body.body-dim { opacity: 0.25; }
.gate-exit {
  background: #0F172A;
  border: 1px dashed #64748B;
  border-radius: 8px;
  padding: 8px 18px;
  font-family: 'DM Mono', monospace;
  font-size: 13px;
  color: #94A3B8;
  text-align: center;
}
.gate-controls {
  display: flex;
  gap: 16px;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.gate-live-val {
  font-family: 'DM Mono', monospace;
  font-size: 18px;
  font-weight: 700;
  color: #A5B4FC;
  min-width: 40px;
  text-align: center;
}
.gate-warning {
  background: #450A0A;
  border: 1px solid #7F1D1D;
  border-radius: 8px;
  padding: 12px 16px;
  color: #FCA5A5;
  font-size: 14px;
  margin-top: 14px;
  display: none;
}
.gate-warning.show { display: block; }
.infinite-toggle-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid #334155;
}

/* ---- REPEAT UNTIL (L19) — reuses gate styles, bottom-gate variant ---- */
.repeat-loopback {
  font-size: 12px;
  color: #F59E0B;
  font-family: 'DM Mono', monospace;
  font-style: italic;
  margin-top: 6px;
}

/* ---- LOOP CHOOSER (L19 interlude) ---- */
.chooser-wrap { margin: 16px 0; }
.chooser-card {
  background: #1E293B;
  border: 1px solid #334155;
  border-radius: 12px;
  padding: 18px 20px;
  margin-bottom: 14px;
}
.chooser-problem {
  font-size: 15px;
  color: #E2E8F0;
  margin-bottom: 14px;
}
.chooser-options {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.chooser-btn {
  background: #0F172A;
  border: 1px solid #475569;
  color: #CBD5E1;
  border-radius: 8px;
  padding: 8px 18px;
  font-family: 'DM Mono', monospace;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
}
.chooser-btn:hover { border-color: #6366F1; }
.chooser-btn.chosen-right {
  background: #14532D;
  border-color: #22C55E;
  color: #4ADE80;
}
.chooser-btn.chosen-wrong {
  background: #450A0A;
  border-color: #7F1D1D;
  color: #FCA5A5;
}
.chooser-explain {
  margin-top: 14px;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 14px;
  background: #0F172A;
  border-left: 3px solid #6366F1;
  color: #CBD5E1;
  display: none;
}
.chooser-explain.show { display: block; }

/* ---- ACCUMULATOR TILES (L20, L21) ---- */
.accum-wrap {
  background: #1E293B;
  border-radius: 12px;
  padding: 24px;
  margin: 16px 0;
}
.accum-boxes {
  display: flex;
  gap: 16px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}
.accum-box {
  background: #0F172A;
  border: 2px solid #6366F1;
  border-radius: 10px;
  padding: 14px 22px;
  text-align: center;
  min-width: 90px;
}
.accum-box-label {
  font-size: 12px;
  color: #94A3B8;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 6px;
}
.accum-box-val {
  font-family: 'DM Mono', monospace;
  font-size: 26px;
  font-weight: 700;
  color: #A5B4FC;
  transition: all 0.3s;
}
.accum-box-val.val-bumped {
  color: #4ADE80;
  transform: scale(1.15);
}
.accum-tiles {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.accum-tile {
  width: 52px;
  height: 52px;
  border-radius: 8px;
  background: #0F172A;
  border: 1px solid #334155;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'DM Mono', monospace;
  font-size: 18px;
  color: #CBD5E1;
  transition: all 0.3s;
}
.accum-tile.tile-current {
  background: #312E81;
  border-color: #6366F1;
  color: #fff;
  box-shadow: 0 0 14px rgba(99,102,241,0.4);
  transform: translateY(-4px);
}
.accum-tile.tile-done { opacity: 0.4; }
.accum-tile.tile-beat {
  background: #14532D;
  border-color: #22C55E;
  color: #4ADE80;
}
.accum-controls {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

/* ---- NESTED LOOP GRID (L22) ---- */
.nest-grid-wrap {
  background: #1E293B;
  border-radius: 12px;
  padding: 24px;
  margin: 16px 0;
}
.nest-counters {
  display: flex;
  gap: 16px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.nest-counter {
  background: #0F172A;
  border-radius: 8px;
  padding: 10px 18px;
  font-family: 'DM Mono', monospace;
  font-size: 15px;
}
.nest-counter-outer { border: 1px solid #6366F1; color: #A5B4FC; }
.nest-counter-inner { border: 1px solid #F59E0B; color: #FBBF24; }
.nest-counter-total { border: 1px solid #22C55E; color: #4ADE80; }
.nest-grid {
  display: grid;
  gap: 6px;
  margin-bottom: 18px;
}
.nest-cell {
  aspect-ratio: 1;
  border-radius: 6px;
  background: #0F172A;
  border: 1px solid #334155;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'DM Mono', monospace;
  font-size: 12px;
  color: #475569;
  transition: all 0.2s;
  min-height: 36px;
}
.nest-cell.cell-current {
  background: #312E81;
  border-color: #6366F1;
  color: #fff;
  box-shadow: 0 0 10px rgba(99,102,241,0.5);
}
.nest-cell.cell-done {
  background: #14532D;
  border-color: #166534;
  color: #4ADE80;
}
.nest-row-marker {
  font-family: 'DM Mono', monospace;
  font-size: 12px;
  color: #6366F1;
}

/* ---- TRACE TABLE (L23) ---- */
.trace-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin: 16px 0;
}
@media (max-width: 760px) {
  .trace-layout { grid-template-columns: 1fr; }
}
.trace-code {
  background: #0F172A;
  border-radius: 12px;
  padding: 18px;
  font-family: 'DM Mono', monospace;
  font-size: 13px;
}
.trace-code-line {
  padding: 3px 8px;
  border-radius: 4px;
  color: #CBD5E1;
  transition: all 0.2s;
  line-height: 1.6;
}
.trace-code-line.line-executing {
  background: rgba(99,102,241,0.2);
  border-left: 3px solid #6366F1;
}
.trace-table-wrap {
  background: #1E293B;
  border-radius: 12px;
  padding: 18px;
  overflow-x: auto;
}
.trace-table {
  border-collapse: collapse;
  width: 100%;
  font-family: 'DM Mono', monospace;
  font-size: 13px;
}
.trace-table th {
  background: #0F172A;
  color: #A5B4FC;
  padding: 8px 12px;
  border: 1px solid #334155;
  font-weight: 600;
}
.trace-table td {
  padding: 8px 12px;
  border: 1px solid #334155;
  text-align: center;
  color: #E2E8F0;
}
.trace-table td.cell-filled { background: #14532D; color: #4ADE80; }
.trace-table input {
  background: #0F172A;
  border: 1px solid #6366F1;
  color: #F8FAFC;
  border-radius: 4px;
  padding: 4px 6px;
  width: 56px;
  text-align: center;
  font-family: 'DM Mono', monospace;
  font-size: 13px;
}
.trace-table input.cell-correct { border-color: #22C55E; background: #14532D; color: #4ADE80; }
.trace-table input.cell-wrong { border-color: #EF4444; background: #450A0A; color: #FCA5A5; }
.trace-cell-note {
  font-size: 12px;
  color: #FCA5A5;
  margin-top: 2px;
}
.trace-controls {
  display: flex;
  gap: 12px;
  margin: 14px 0;
  flex-wrap: wrap;
}
.trace-callout {
  background: #0F172A;
  border-left: 3px solid #F59E0B;
  border-radius: 8px;
  padding: 14px 18px;
  margin: 16px 0;
  color: #E2E8F0;
  font-size: 15px;
}
.trace-callout strong { color: #FBBF24; }

/* ---- LOOP-TYPE DEBUG (L24, scenario 5) ---- */
.looptype-options {
  display: flex;
  gap: 10px;
  margin-top: 12px;
  flex-wrap: wrap;
}
.looptype-btn {
  background: #0F172A;
  border: 1px solid #475569;
  color: #CBD5E1;
  border-radius: 8px;
  padding: 8px 18px;
  font-family: 'DM Mono', monospace;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
}
.looptype-btn:hover { border-color: #6366F1; }
.looptype-btn.lt-right { background: #14532D; border-color: #22C55E; color: #4ADE80; }
.looptype-btn.lt-wrong { background: #450A0A; border-color: #7F1D1D; color: #FCA5A5; }

/* ---- SHARED: visible instruction text on light page ---- */
.write-instruction {
  font-family: 'DM Mono', monospace;
  font-size: 14px;
  color: #334155;
  line-height: 1.8;
  margin-bottom: 12px;
}

/* ════════════════════════════════════════════
   8.3 REDESIGN — L17–L19 components
   ════════════════════════════════════════════ */

/* Reusable structure / skeleton block */
.struct-block { background: #fff; border: 1.5px solid #E2E8F0; border-left: 4px solid #6366F1; border-radius: 0 12px 12px 0; padding: 18px 20px; margin: 14px 0; box-shadow: 0 2px 10px rgba(15,23,42,0.05); }
.struct-head { font-size: 13px; font-weight: 600; color: #334155; margin-bottom: 12px; text-transform: uppercase; letter-spacing: 0.5px; }
.struct-slot { background: rgba(245,158,11,0.18); color: #FBBF24; border-radius: 4px; padding: 1px 6px; }
.struct-anno { margin-top: 14px; display: flex; flex-direction: column; gap: 8px; }
.struct-anno-row { font-size: 14px; color: #334155; line-height: 1.5; }
.struct-anno-key { display: inline-block; min-width: 110px; font-family: 'DM Mono', monospace; font-size: 13px; color: #6366F1; font-weight: 600; }

/* When-to-use callout */
.when-callout { background: #F8FAFC; border: 1px solid #E2E8F0; border-left: 4px solid #6366F1; border-radius: 0 10px 10px 0; padding: 14px 18px; margin: 16px 0; font-size: 15px; color: #334155; line-height: 1.6; }
.when-tag { display: inline-block; background: #6366F1; color: #fff; font-size: 12px; font-weight: 700; padding: 2px 10px; border-radius: 20px; margin-right: 8px; }

/* L17 rep counter */
.rep-wrap { background: #1E293B; border-radius: 12px; padding: 24px; margin: 16px 0; }
.rep-controls { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; flex-wrap: wrap; }
.rep-plan { font-size: 14px; color: #CBD5E1; }
.rep-plan strong { color: #FBBF24; }
.rep-track { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.rep-dot { width: 40px; height: 40px; border-radius: 50%; background: #0F172A; border: 1px solid #334155; display: flex; align-items: center; justify-content: center; font-family: 'DM Mono', monospace; font-size: 14px; color: #64748B; transition: all 0.25s; }
.rep-dot.done { background: #14532D; border-color: #22C55E; color: #4ADE80; transform: scale(1.06); }
.rep-status { font-family: 'DM Mono', monospace; font-size: 16px; color: #A5B4FC; }
.rep-consequence { margin-top: 14px; font-size: 14px; border-radius: 8px; padding: 0; color: #CBD5E1; }
.rep-consequence.ok { background: #14532D; border: 1px solid #166534; color: #86EFAC; padding: 12px 16px; }
.rep-consequence.warn { background: #450A0A; border: 1px solid #7F1D1D; color: #FCA5A5; padding: 12px 16px; }

/* L18 lives */
.lives-wrap { background: #1E293B; border-radius: 12px; padding: 24px; margin: 16px 0; }
.lives-controls { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.lives-row { display: flex; gap: 10px; margin-bottom: 16px; }
.heart { font-size: 30px; color: #EF4444; transition: all 0.25s; }
.heart.lost { color: #334155; }
.lives-stage { font-family: 'DM Mono', monospace; font-size: 16px; color: #4ADE80; padding: 10px 16px; background: #0F172A; border-radius: 8px; display: inline-block; }
.lives-stage.over { color: #FCA5A5; }

/* L19 pin attempts */
.pin-attempts { display: flex; flex-direction: column; gap: 6px; margin-top: 16px; }
.pin-attempt { font-family: 'DM Mono', monospace; font-size: 13px; padding: 6px 12px; border-radius: 6px; }
.pin-attempt.wrong { background: #450A0A; border: 1px solid #7F1D1D; color: #FCA5A5; }
.pin-attempt.right { background: #14532D; border: 1px solid #166534; color: #4ADE80; }

/* L19 three-way comparison */
.loopcmp-table-wrap { overflow-x: auto; margin: 16px 0; }
.loopcmp-table { width: 100%; border-collapse: collapse; font-size: 14px; background: #fff; border-radius: 10px; overflow: hidden; box-shadow: 0 2px 10px rgba(15,23,42,0.05); }
.loopcmp-table th { background: #0F172A; color: #A5B4FC; padding: 10px 12px; text-align: left; font-weight: 600; }
.loopcmp-table th:first-child { background: #0F172A; }
.loopcmp-table td { padding: 10px 12px; border-top: 1px solid #E2E8F0; color: #334155; }
.loopcmp-table td.loopcmp-rowhead { font-weight: 600; color: #475569; background: #F8FAFC; }
.loopcmp-cols { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 16px 0; }
@media (max-width: 760px) { .loopcmp-cols { grid-template-columns: 1fr; } }
.loopcmp-col { background: #1E293B; border: 1.5px solid #334155; border-radius: 10px; padding: 14px; }
.loopcmp-col.fit { border-color: #22C55E; box-shadow: 0 0 14px rgba(34,197,94,0.18); }
.loopcmp-col.nofit { border-color: #7F1D1D; opacity: 0.85; }
.loopcmp-col-head { font-family: 'DM Mono', monospace; font-size: 13px; color: #E2E8F0; font-weight: 600; margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }
.loopcmp-badge { font-size: 10px; padding: 2px 8px; border-radius: 20px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; }
.loopcmp-badge.bad { background: #450A0A; color: #FCA5A5; }
.loopcmp-badge.ok2 { background: #422006; color: #FBBF24; }
.loopcmp-badge.good { background: #14532D; color: #4ADE80; }
.loopcmp-code { background: #0F172A; border-radius: 8px; padding: 12px; font-family: 'DM Mono', monospace; font-size: 12.5px; color: #CBD5E1; line-height: 1.6; margin: 0 0 10px 0; white-space: pre; overflow-x: auto; }
.loopcmp-why { font-size: 13px; color: #94A3B8; line-height: 1.5; }

/* ════════════════════════════════════════════
   LESSON 22 — NESTED LOOPS (cinema seat grid)
════════════════════════════════════════════ */
.seat-wrap {
  background: #1E293B;
  border-radius: 12px;
  padding: 24px;
  margin: 16px 0;
}
.seat-main {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 22px;
  align-items: start;
}
@media (max-width: 760px) {
  .seat-main { grid-template-columns: 1fr; }
}
.seatgrid {
  display: grid;
  gap: 7px;
  margin-bottom: 16px;
}
.seat {
  aspect-ratio: 1;
  border-radius: 7px;
  background: #0F172A;
  border: 1px solid #334155;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'DM Mono', monospace;
  font-size: 14px;
  font-weight: 600;
  color: #475569;
  transition: background 0.2s, border-color 0.2s, color 0.2s, transform 0.2s;
  min-height: 38px;
}
.seat.done {
  background: #14532D;
  border-color: #166534;
  color: #4ADE80;
}
.seat.current {
  background: #312E81;
  border-color: #6366F1;
  color: #fff;
  transform: scale(1.06);
  box-shadow: 0 0 12px rgba(99,102,241,0.55);
}
.seat-sizes {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}
.seat-info-side {
  display: flex;
  flex-direction: column;
}
.nest-outer-tok { color: #A5B4FC; font-weight: 700; }
.nest-inner-tok { color: #FBBF24; font-weight: 700; }
.nest-counter-inner {
  transition: background 0.2s, box-shadow 0.2s, transform 0.2s;
}
.nest-counter-inner.reset-flash {
  animation: seatResetFlash 0.6s ease;
}
@keyframes seatResetFlash {
  0%   { background: #F59E0B; color: #0F172A; transform: scale(1.08); box-shadow: 0 0 16px rgba(245,158,11,0.7); }
  100% { background: #0F172A; color: #FBBF24; transform: scale(1); box-shadow: none; }
}
.seat-narrate {
  margin-top: 18px;
  background: #0F172A;
  border: 1px solid #334155;
  border-left: 4px solid #F59E0B;
  border-radius: 0 10px 10px 0;
  padding: 12px 16px;
  font-size: 14px;
  color: #E2E8F0;
  line-height: 1.6;
  min-height: 20px;
}
.seat-narrate strong { color: #FBBF24; }
.seat-controls {
  display: flex;
  gap: 10px;
  margin-top: 16px;
  flex-wrap: wrap;
}
@media (prefers-reduced-motion: reduce) {
  .nest-counter-inner.reset-flash { animation: none; background: #F59E0B; color: #0F172A; }
  .seat { transition: none; }
}

/* ═══════════════════════════════════════════════════════════════
   TOPIC 7 — ALGORITHM DESIGN (Paper 2) · Subtopic 7.1 (revamped)
   Contrast rule: DARK machine surfaces (.sim) use light text;
   LIGHT learning/assessment surfaces use dark ink. Shared arc
   classes live in topic.css (frozen) and are referenced only.
   ═══════════════════════════════════════════════════════════════ */

.nc-lead { color:#334155; font-size:15px; margin:2px 0 16px; line-height:1.55; }
.nc-lead2 { color:#334155; font-size:14px; margin:0 0 8px; line-height:1.55; }
.nc-hint { color:#64748B; font-size:13px; margin:10px 0 0; font-style:italic; }
.warn { color:#F59E0B; }

/* inputs — always dark ink on light field (contrast fix) */
.nc-input { width:100%; border:1.5px solid #CBD5E1; border-radius:10px; padding:10px 12px; font-family:'DM Sans',sans-serif; font-size:14px; color:#0F172A; background:#fff; resize:vertical; }
.nc-input::placeholder { color:#94A3B8; }
.nc-input.mono { font-family:'DM Mono',monospace; }
.nc-input:focus { outline:none; border-color:#6366F1; box-shadow:0 0 0 3px rgba(99,102,241,.15); }

.ind-grid { display:grid; grid-template-columns:repeat(2,1fr); gap:12px; margin:8px 0; }
.ind-cell label { display:block; font-weight:700; color:#4338CA; margin-bottom:4px; font-size:13px; }

.tryit-feedback { min-height:20px; font-size:14px; margin:8px 0; font-weight:500; }
.tryit-good { color:#15803D; }
.tryit-bad { color:#DC2626; }
.tryit-hint { color:#64748B; }
.res-h3 { margin:22px 0 8px; color:#0F172A; font-size:16px; }
.nudge-ok { color:#15803D; }
.nudge-hint { color:#B45309; }

/* ============ MEET THE CYCLE / IPO-S PRIMER ============ */
.cycle { display:flex; align-items:stretch; gap:0; flex-wrap:wrap; margin:6px 0 4px; }
.cyc-node { flex:1; min-width:150px; background:#fff; border:1px solid #E2E8F0; border-radius:14px; padding:16px; cursor:pointer; transition:.15s; }
.cyc-node:hover { border-color:#6366F1; transform:translateY(-2px); box-shadow:0 8px 20px -12px rgba(99,102,241,.5); }
.cyc-node.open { border-color:#6366F1; background:#F5F6FF; }
.cyc-head { display:flex; align-items:center; gap:10px; margin-bottom:6px; }
.cyc-num { background:#6366F1; color:#fff; width:26px; height:26px; border-radius:50%; display:inline-flex; align-items:center; justify-content:center; font-weight:700; font-size:14px; flex-shrink:0; }
.cyc-name { font-weight:800; font-size:16px; color:#0F172A; }
.cyc-icon { font-size:20px; margin-left:auto; }
.cyc-def { font-size:13px; color:#334155; }
.cyc-more { font-size:13px; color:#475569; margin-top:8px; padding-top:8px; border-top:1px dashed #E2E8F0; display:none; }
.cyc-node.open .cyc-more { display:block; }
.cyc-more b, .cyc-more strong { color:#4338CA; }
.cyc-arrow { display:flex; align-items:center; justify-content:center; color:#94A3B8; font-size:20px; padding:0 6px; }
.cyc-loop { margin-top:12px; background:#EEF2FF; border:1px solid #C7D2FE; border-radius:12px; padding:12px 14px; font-size:13px; color:#3730A3; display:flex; align-items:center; gap:10px; }
.cyc-loop .lp { font-size:20px; }

/* ============ DARK SIMULATOR SHELL ============ */
.sim { background:#0F172A; border-radius:20px; padding:22px; color:#E2E8F0; box-shadow:0 20px 50px -20px rgba(15,23,42,.5); margin:6px 0 18px; }
.sim-top { display:flex; justify-content:space-between; align-items:center; margin-bottom:16px; gap:10px; }
.sim-title { font-weight:700; color:#fff; font-size:16px; }
.sim-badge { font-family:'DM Mono',monospace; font-size:12px; color:#F59E0B; border:1px solid rgba(245,158,11,.4); border-radius:20px; padding:4px 12px; white-space:nowrap; }
.sim-body { display:grid; grid-template-columns:1fr 300px; gap:22px; }
.sim-actions { display:flex; gap:10px; margin-top:18px; }
.sim-feed { min-height:22px; font-size:13px; margin:12px 0 0; color:#CBD5E1; }
.sim-fb-good { color:#86EFAC; }
.sim-fb-bad { color:#FCA5A5; }
.sim-fb-hint { color:#94A3B8; }
.btn-launch { flex:1; background:#F59E0B; color:#3b2600; border:none; font-weight:800; font-size:15px; border-radius:12px; padding:14px; cursor:pointer; letter-spacing:.02em; transition:.15s; }
.btn-launch:hover { filter:brightness(1.06); }
.btn-launch:disabled { opacity:.4; cursor:not-allowed; }
.btn-ghost { background:transparent; border:1px solid #334155; color:#94A3B8; border-radius:12px; padding:14px 18px; cursor:pointer; font-weight:600; }

/* pipeline (L1) */
.pipeline-label,.tray-label { font-size:13px; color:#94A3B8; margin-bottom:8px; }
.tray-label { margin-top:16px; }
.pipeline { display:flex; flex-direction:column; gap:10px; }
.pslot { border:2px dashed #334155; border-radius:12px; min-height:56px; display:flex; align-items:center; gap:10px; padding:0 12px; cursor:pointer; transition:.15s; background:#182234; }
.pslot:hover { border-color:#6366F1; }
.pslot-idx { font-family:'DM Mono',monospace; color:#475569; font-size:13px; }
.pslot-txt { font-weight:600; color:#CBD5E1; }
.pslot .stage-mini { font-size:11px; color:#94A3B8; font-weight:400; }
.pslot.filled { border-style:solid; border-color:#6366F1; background:rgba(99,102,241,.14); }
.pslot.empty-skip { border-color:#F59E0B; border-style:solid; background:rgba(245,158,11,.08); }
.pslot.empty-skip .pslot-txt { color:#F59E0B; }
.tray { display:flex; flex-wrap:wrap; gap:8px; }
.stage { border:2px solid #818CF8; background:rgba(129,140,248,.12); color:#C7D2FE; border-radius:10px; padding:9px 13px; cursor:pointer; transition:.12s; font-weight:600; font-size:14px; }
.stage:hover { transform:translateY(-2px); }
.stage.sel { outline:3px solid #F59E0B; color:#fff; }
.stage.used { opacity:.3; pointer-events:none; }
.skip-note { font-size:12px; color:#94A3B8; margin-top:10px; min-height:16px; }
.skip-note b { color:#C7D2FE; }
.skip-toggle { color:#F59E0B; cursor:pointer; text-decoration:underline; font-weight:600; }

/* phone mock (L1) */
.phone { background:#000; border-radius:34px; padding:12px; width:270px; margin:0 auto; box-shadow:0 0 0 2px #334155, inset 0 0 0 2px #1E293B; }
.phone-notch { width:110px; height:20px; background:#000; border-radius:0 0 14px 14px; margin:-12px auto 0; }
.screen { background:#0B1220; border-radius:24px; height:420px; overflow:hidden; position:relative; display:flex; flex-direction:column; }
.screen-status { display:flex; justify-content:space-between; padding:8px 16px; font-size:11px; color:#94A3B8; font-family:'DM Mono',monospace; }
.app { flex:1; display:flex; flex-direction:column; align-items:center; justify-content:center; text-align:center; padding:18px; gap:12px; transition:.3s; position:relative; }
.app-icon { font-size:44px; }
.app-name { font-weight:800; font-size:19px; color:#fff; }
.app-line { color:#94A3B8; font-size:13px; }
.app-btn { background:#6366F1; color:#fff; border:none; border-radius:10px; padding:10px 18px; font-weight:700; font-size:13px; }
.app.state-ok { background:radial-gradient(circle at 50% 30%,rgba(34,197,94,.18),transparent 70%); }
.app.state-wrong { background:radial-gradient(circle at 50% 30%,rgba(245,158,11,.16),transparent 70%); }
.app.state-crash { background:#2b0a0a; }
.app.state-blank { background:#0B1220; }
.app.state-scramble { background:#160f2e; }
.scramble-ui { position:relative; width:100%; height:200px; }
.scramble-box { position:absolute; background:rgba(99,102,241,.5); border:1px solid #818CF8; border-radius:8px; color:#fff; font-size:11px; display:flex; align-items:center; justify-content:center; font-family:'DM Mono',monospace; }
.scr-name { position:absolute; bottom:16px; left:0; right:0; }
.crash-screen { color:#fecaca; font-family:'DM Mono',monospace; font-size:12px; text-align:left; width:100%; }
.crash-title { color:#fff; font-weight:800; font-size:16px; margin-bottom:8px; text-align:center; }
.feed { margin-top:14px; min-height:26px; }
.review { opacity:0; transform:translateY(8px); animation:rev .4s forwards; font-size:13px; padding:8px 12px; border-radius:10px; margin-bottom:6px; background:#182234; color:#CBD5E1; }
@keyframes rev { to { opacity:1; transform:none; } }
.review .stars { font-weight:700; margin-right:8px; }
.review.good .stars { color:#22C55E; }
.review.bad .stars { color:#EF4444; }
.verdict { margin-top:14px; padding:14px; border-radius:12px; font-size:14px; line-height:1.5; display:none; }
.verdict.show { display:block; }
.verdict.win { background:rgba(34,197,94,.14); border:1px solid rgba(34,197,94,.4); color:#bbf7d0; }
.verdict.fail { background:rgba(239,68,68,.12); border:1px solid rgba(239,68,68,.4); color:#fecaca; }
.verdict .caught { color:#F59E0B; font-weight:700; }
.reveal { background:#fff; border:1px solid #E2E8F0; border-left:4px solid #6366F1; border-radius:12px; padding:16px; margin:0 0 18px; display:none; }
.reveal.show { display:block; }
.reveal h4 { margin:0 0 6px; color:#4338CA; }

/* ============ PICK BOARD (tap-to-sort) ============ */
.pickboard { background:#fff; border:1px solid #E2E8F0; border-radius:16px; padding:18px; margin:6px 0 18px; }
.pb-score { display:flex; justify-content:space-between; align-items:center; margin-bottom:12px; color:#334155; }
.pb-score b { font-size:20px; color:#0F172A; }
.pb-card { border:1px solid #E2E8F0; border-radius:12px; padding:14px; margin-bottom:12px; background:#F8FAFC; }
.pb-quote { font-size:15px; color:#0F172A; margin-bottom:10px; font-weight:600; }
.pb-picks { display:flex; gap:8px; flex-wrap:wrap; }
.pb-pick { border:1.5px solid #CBD5E1; background:#fff; color:#334155; border-radius:8px; padding:8px 14px; cursor:pointer; font-weight:600; font-size:13px; transition:.12s; }
.pb-pick:hover { border-color:#6366F1; }
.pb-correct { background:#22C55E; border-color:#22C55E; color:#fff; }
.pb-wrong { background:#EF4444; border-color:#EF4444; color:#fff; animation:cs-shake .35s; }
@keyframes cs-shake { 0%,100%{transform:translateX(0)} 25%{transform:translateX(-4px)} 75%{transform:translateX(4px)} }
.pb-why { font-size:13px; color:#64748B; margin-top:10px; display:none; }
.pb-why.show { display:block; }
.pb-done { display:none; color:#15803D; font-weight:700; margin-top:6px; }

/* ============ IPOS WIRING (L2, inside .sim) ============ */
.ipos-tray { display:flex; flex-wrap:wrap; gap:8px; margin-bottom:14px; }
.ipos-chip { border:2px solid #818CF8; background:rgba(129,140,248,.12); color:#C7D2FE; border-radius:20px; padding:8px 14px; font-size:13px; cursor:pointer; transition:transform .1s; }
.ipos-chip:hover { transform:translateY(-2px); }
.ipos-chip-sel { outline:3px solid #F59E0B; color:#fff; }
.ipos-chip-done { border-color:#22C55E; background:rgba(34,197,94,.14); color:#86EFAC; cursor:default; }
.ipos-bins { display:grid; grid-template-columns:repeat(4,1fr); gap:10px; }
.ipos-bin { border:2px dashed #334155; border-radius:12px; min-height:130px; background:#182234; cursor:pointer; transition:border-color .15s; }
.ipos-bin:hover { border-color:#6366F1; }
.ipos-bin-reject { border-color:#EF4444; background:#2b0a0a; animation:cs-shake .4s; }
.ipos-bin-head { text-align:center; font-weight:700; color:#fff; padding:8px; border-bottom:1px solid #334155; font-size:13px; }
.ipos-bin-body { display:flex; flex-direction:column; gap:6px; padding:8px; }
.flow-run { display:none; margin-top:14px; }
.flow-run.show { display:block; }
.flow-step { display:flex; gap:10px; align-items:center; padding:8px 12px; border-radius:10px; background:#182234; margin-bottom:6px; opacity:0; animation:rev .4s forwards; }
.flow-tag { font-weight:700; color:#C7D2FE; min-width:90px; }
.flow-txt { color:#94A3B8; font-size:13px; }
.flow-ok { margin-top:8px; padding:12px; border-radius:10px; background:rgba(34,197,94,.14); border:1px solid rgba(34,197,94,.4); color:#bbf7d0; font-size:13px; line-height:1.5; opacity:0; animation:rev .4s forwards; }

/* ============ STRUCTURE DIAGRAM BUILDER (L2) ============ */
.sdb-wrap { margin:6px 0 18px; }
.sdb-tree { border:1px solid #E2E8F0; border-radius:12px; padding:18px; background:#F8FAFC; text-align:center; }
.sdb-root { display:inline-block; border:2px solid #0F172A; border-radius:8px; padding:10px 22px; font-weight:700; background:#fff; color:#0F172A; }
.sdb-connectors { display:grid; grid-template-columns:repeat(3,1fr); height:26px; }
.sdb-conn { border-left:2px solid #CBD5E1; width:0; margin:0 auto; height:100%; }
.sdb-conn-ok { border-color:#22C55E; }
.sdb-conn-bad { border-color:#EF4444; }
.sdb-level { display:grid; grid-template-columns:repeat(3,1fr); gap:12px; }
.sdb-slot { border:2px dashed #CBD5E1; border-radius:8px; padding:14px 8px; background:#fff; cursor:pointer; color:#94A3B8; font-size:13px; transition:border-color .15s; }
.sdb-slot:hover { border-color:#6366F1; }
.sdb-slot-done { border-style:solid; border-color:#22C55E; background:#F0FDF4; color:#0F172A; font-weight:600; }
.sdb-slot-bad { border-color:#EF4444; background:#FEF2F2; animation:cs-shake .4s; }
.sdb-tray { display:flex; flex-wrap:wrap; gap:8px; margin:14px 0; }
.sdb-box { border:2px solid #6366F1; background:#EEF2FF; color:#3730A3; border-radius:8px; padding:9px 14px; font-size:13px; cursor:pointer; }
.sdb-box-sel { outline:3px solid #F59E0B; }
.sdb-box-done { opacity:.4; pointer-events:none; border-color:#22C55E; background:#F0FDF4; }

/* bridge panel (L2) */
.io-bridge { border:1px solid #E2E8F0; border-radius:12px; padding:14px; background:#F8FAFC; }
.io-bridge-tree { font-weight:600; color:#334155; margin-bottom:8px; }
.io-bridge-note { font-size:13px; color:#64748B; margin-top:8px; line-height:1.5; }

/* ============ FLOWCHART STEPPER (L3, inside .sim) ============ */
.fs-body { display:grid; grid-template-columns:1.2fr 1fr; gap:22px; }
.fs-diagram { text-align:center; }
.fs-node { display:inline-block; padding:10px 16px; margin:0 auto; border:2px solid #334155; background:#182234; color:#E2E8F0; font-family:'DM Mono',monospace; font-size:13px; }
.fs-term { border-radius:22px; }
.fs-io { transform:skewX(-12deg); }
.fs-io > * { display:inline-block; transform:skewX(12deg); }
.fs-process { border-radius:4px; }
#fsn-decision { border-radius:6px; background:rgba(245,158,11,.14); border-color:#F59E0B; color:#FCD34D; }
.fs-node-active { border-color:#6366F1; box-shadow:0 0 0 3px rgba(99,102,241,.35); background:rgba(99,102,241,.2); color:#fff; }
.fs-arrow { color:#475569; font-size:18px; margin:2px 0; }
.fs-loopback { color:#475569; font-size:12px; font-style:italic; margin:4px 0; }
.fs-branch-row { display:flex; gap:10px; justify-content:center; margin:8px 0; }
.fs-branch { border:2px solid #6366F1; background:rgba(99,102,241,.14); color:#C7D2FE; border-radius:8px; padding:8px 14px; cursor:pointer; font-weight:600; font-size:13px; }
.fs-branch-bounce { border-color:#EF4444; background:#2b0a0a; animation:cs-shake .4s; }
.fs-panel { border:1px solid #334155; border-radius:12px; padding:16px; background:#182234; }
.fs-panel-title { font-weight:700; color:#fff; margin-bottom:10px; }
.fs-panel-row { display:flex; justify-content:space-between; font-family:'DM Mono',monospace; font-size:14px; padding:6px 0; border-bottom:1px solid #334155; color:#E2E8F0; }
.fs-step-controls { display:flex; gap:8px; margin:12px 0; }
.fs-message { min-height:40px; font-size:13px; line-height:1.5; }
.fs-msg-ok { color:#86EFAC; }
.fs-msg-bad { color:#FCA5A5; }
.fs-msg-hint { color:#94A3B8; }
.fs-legend { border:1px solid #E2E8F0; border-radius:12px; padding:14px; background:#F8FAFC; margin-bottom:18px; }
.fs-legend-title { font-weight:700; margin-bottom:8px; color:#0F172A; }
.fs-legend-item { font-size:14px; color:#475569; margin:6px 0; }
.fs-chip { display:inline-block; padding:2px 8px; border-radius:6px; font-size:12px; font-weight:600; margin-right:8px; border:1px solid #CBD5E1; background:#fff; color:#334155; }
.fs-chip.fs-term { border-radius:14px; }

/* ============ FLOWCHART BUILDER (L3) ============ */
.fb-wrap { margin:6px 0 18px; }
.fb-palette { display:flex; flex-wrap:wrap; gap:10px; margin-bottom:14px; }
.fb-tile { border:2px solid #6366F1; background:#EEF2FF; color:#3730A3; border-radius:8px; padding:10px 16px; font-weight:600; cursor:pointer; }
.fb-tile.fb-term { border-color:#0EA5E9; background:#E0F2FE; color:#075985; }
.fb-tile.fb-io { border-color:#8B5CF6; background:#F3E8FF; color:#5B21B6; }
.fb-tile.fb-process { border-color:#22C55E; background:#F0FDF4; color:#15803D; }
.fb-tile.fb-decision { border-color:#F59E0B; background:#FFFBEB; color:#B45309; }
.fb-tile-sel { outline:3px solid #F59E0B; }
.fb-skeleton { border:1px solid #E2E8F0; border-radius:12px; padding:16px; background:#F8FAFC; text-align:center; }
.fb-slot { display:block; max-width:340px; margin:0 auto; border:2px dashed #CBD5E1; border-radius:8px; padding:12px; background:#fff; color:#94A3B8; font-size:13px; cursor:pointer; transition:border-color .15s; }
.fb-slot:hover { border-color:#6366F1; }
.fb-slot-filled { border-style:solid; color:#0F172A; font-weight:600; }
.fb-fill-term { border-color:#0EA5E9; background:#E0F2FE; }
.fb-fill-io { border-color:#8B5CF6; background:#F3E8FF; }
.fb-fill-process { border-color:#22C55E; background:#F0FDF4; }
.fb-fill-decision { border-color:#F59E0B; background:#FFFBEB; }
.fb-slot-bad { border-color:#EF4444; background:#FEF2F2; animation:cs-shake .4s; }
.fb-arrow { color:#94A3B8; font-size:18px; margin:4px 0; }
.fb-branch-labels { display:flex; gap:10px; justify-content:center; margin:8px 0; }
.fb-branch-btn { border:2px dashed #F59E0B; background:#FFFBEB; color:#B45309; border-radius:8px; padding:6px 12px; font-size:12px; cursor:pointer; }
.fb-branch-set { border-style:solid; border-color:#22C55E; background:#F0FDF4; color:#15803D; }

/* ============ DEBUG PICKERS ============ */
.diary { display:grid; grid-template-columns:repeat(4,1fr); gap:10px; margin:8px 0; }
.diary-col { border:1px solid #E2E8F0; border-radius:10px; overflow:hidden; }
.diary-head { background:#F1F5F9; font-weight:700; text-align:center; padding:8px; color:#0F172A; }
.diary-entry { padding:10px; font-size:13px; border-top:1px solid #F1F5F9; cursor:pointer; color:#334155; }
.diary-entry:hover { background:#F8FAFC; }
.debugrow, .debugcol { display:flex; gap:8px; margin:8px 0; }
.debugrow { flex-wrap:wrap; }
.debugcol { flex-direction:column; }
.debug-node { border:1px solid #E2E8F0; border-radius:8px; padding:10px 14px; font-family:'DM Mono',monospace; font-size:13px; cursor:pointer; background:#fff; color:#334155; }
.debug-node:hover { background:#F8FAFC; }
.debug-hit { border-color:#22C55E !important; background:#F0FDF4 !important; color:#15803D !important; }
.debug-miss { border-color:#EF4444 !important; background:#FEF2F2 !important; }

/* ============ TRANSLATION TABLE (L4) ============ */
.tt-wrap { display:grid; grid-template-columns:1fr 1fr; gap:16px; margin:6px 0 12px; }
.tt-flow, .tt-code { border:1px solid #E2E8F0; border-radius:12px; padding:14px; background:#F8FAFC; }
.tt-flow-title { font-weight:700; margin-bottom:10px; color:#0F172A; }
.tt-node, .tt-line { font-family:'DM Mono',monospace; font-size:13px; padding:8px 10px; border-radius:6px; margin:6px 0; border:1px solid #E2E8F0; background:#fff; color:#0F172A; }
.tt-diamond { background:#FFFBEB; border-color:#F59E0B; }
.tt-c1 { border-left:4px solid #94A3B8; }
.tt-c2 { border-left:4px solid #6366F1; }
.tt-c3 { border-left:4px solid #F59E0B; }
.tt-c4 { border-left:4px solid #22C55E; }
.tt-c5 { border-left:4px solid #EC4899; }
.tt-c6 { border-left:4px solid #0EA5E9; }
.tt-blank { font-family:'DM Mono',monospace; border:2px solid #6366F1; border-radius:6px; padding:4px 6px; background:#EEF2FF; color:#0F172A; }
.tt-meter-wrap { margin:8px 0 4px; }
.tt-meter-label { font-size:13px; color:#64748B; margin-bottom:4px; }
.tt-meter { height:12px; border-radius:8px; background:#E2E8F0; overflow:hidden; }
.tt-meter-fill { height:100%; width:0%; background:linear-gradient(90deg,#6366F1,#22C55E); transition:width .3s; }
.tt-reverse-row { display:grid; grid-template-columns:1fr 1fr; gap:12px; margin:8px 0; }
.tt-rev-opt { text-align:left; border:2px solid #CBD5E1; border-radius:10px; padding:14px; background:#fff; cursor:pointer; }
.tt-rev-opt:hover { border-color:#6366F1; }
.tt-rev-sel { border-color:#22C55E; background:#F0FDF4; }
.tt-rev-bad { border-color:#EF4444; background:#FEF2F2; }
.tt-rev-title { font-weight:700; color:#0F172A; }
.tt-rev-mini { font-family:'DM Mono',monospace; font-size:12px; color:#64748B; margin-top:4px; }
.tt-equiv-card { border:1px solid #E2E8F0; border-radius:12px; overflow:hidden; margin:8px 0 18px; }
.tt-equiv-row { display:grid; grid-template-columns:1fr auto 1fr; align-items:center; gap:12px; padding:12px 14px; border-bottom:1px solid #F1F5F9; }
.tt-equiv-row:last-child { border-bottom:none; }
.tt-equiv-shape { font-weight:600; color:#334155; }
.tt-equiv-arrow { color:#94A3B8; font-size:18px; text-align:center; }
.tt-equiv-code { font-family:'DM Mono',monospace; color:#4338CA; }

/* ============ RESPONSIVE ============ */
@media (max-width: 820px) {
  .sim-body, .fs-body { grid-template-columns:1fr; }
  .ipos-bins { grid-template-columns:1fr 1fr; }
}
@media (max-width: 680px) {
  .cyc-arrow { transform:rotate(90deg); width:100%; padding:6px 0; }
  .cyc-node { min-width:100%; }
  .ind-grid, .tt-wrap, .tt-reverse-row, .tt-equiv-row { grid-template-columns:1fr; }
  .diary { grid-template-columns:1fr 1fr; }
  .phone { width:100%; max-width:270px; }
}
/* ═══════════════════ END TOPIC 7.1 ═══════════════════ */

/* 7.1 lesson 4 tabbed translator */
.tt-tabs{display:flex;gap:8px;margin:6px 0 14px;flex-wrap:wrap;}
.tt-tab{font-family:'DM Mono',monospace;font-size:14px;font-weight:500;padding:8px 16px;border:1px solid #CBD5E1;border-radius:9px;background:#fff;color:#475569;cursor:pointer;transition:all .15s;}
.tt-tab:hover{border-color:#6366F1;color:#6366F1;}
.tt-tab.active{background:#6366F1;border-color:#6366F1;color:#fff;}
.tt-pane{display:none;}
.tt-pane.active{display:block;}

/* ===== 7.2 Standard Algorithms widgets ===== */
.sa-wrap{background:#F8FAFC;border:1px solid #E2E8F0;border-radius:14px;padding:18px;margin:6px 0 10px;}
.sa-cells{display:flex;flex-wrap:wrap;gap:8px;margin-bottom:14px;}
.sa-cell{flex:0 0 auto;min-width:56px;background:#fff;border:2px solid #E2E8F0;border-radius:10px;text-align:center;overflow:hidden;transition:all .15s;}
.sa-cell-idx{font-size:11px;color:#94A3B8;background:#F1F5F9;padding:3px 6px;border-bottom:1px solid #E2E8F0;}
.sa-cell-val{font-family:'DM Mono',monospace;font-size:18px;color:#0F172A;padding:10px 14px;}
.sa-cell.sa-active{border-color:#6366F1;box-shadow:0 0 0 3px rgba(99,102,241,.2);transform:translateY(-2px);}
.sa-cell.sa-cmp{border-color:#F59E0B;box-shadow:0 0 0 3px rgba(245,158,11,.2);}
.sa-cell.sa-found{border-color:#22C55E;box-shadow:0 0 0 3px rgba(34,197,94,.25);}
.sa-cell.sa-found .sa-cell-val{color:#15803D;font-weight:600;}
.sa-boxes{display:flex;flex-wrap:wrap;gap:10px;margin:6px 0 12px;}
.sa-box{flex:1 1 90px;background:#0F172A;border-radius:10px;padding:10px;text-align:center;}
.sa-box-label{font-family:'DM Mono',monospace;font-size:11px;color:#818CF8;margin-bottom:5px;}
.sa-box-val{font-family:'DM Mono',monospace;font-size:20px;font-weight:500;color:#F8FAFC;}
.sa-box-max{background:#14532D;} .sa-box-max .sa-box-label{color:#86EFAC;}
.sa-box-min{background:#7C2D12;} .sa-box-min .sa-box-label{color:#FDBA74;}
.sa-controls{display:flex;flex-wrap:wrap;gap:8px;align-items:center;}
.sa-ctrl-label{font-size:14px;color:#475569;font-weight:500;}
.sa-select{font-family:'DM Mono',monospace;font-size:14px;padding:6px 10px;border:1px solid #CBD5E1;border-radius:8px;background:#fff;color:#0F172A;}
.sa-status{margin-top:12px;font-size:14px;padding:10px 12px;border-radius:9px;background:#fff;border:1px dashed #CBD5E1;color:#334155;line-height:1.5;}
.sa-status-good{border-style:solid;border-color:#22C55E;background:#F0FDF4;color:#15803D;}
.sa-status-bad{border-style:solid;border-color:#EF4444;background:#FEF2F2;color:#B91C1C;}
.sa-bars{display:flex;align-items:flex-end;gap:10px;height:170px;padding:10px 4px;margin-bottom:14px;}
.sa-bar{flex:1 1 0;background:linear-gradient(180deg,#818CF8,#6366F1);border-radius:8px 8px 0 0;display:flex;align-items:flex-start;justify-content:center;transition:height .2s,background .15s;}
.sa-bar-cmp{background:linear-gradient(180deg,#FCD34D,#F59E0B);}
.sa-bar-v{font-family:'DM Mono',monospace;font-size:13px;color:#fff;margin-top:6px;font-weight:600;}
.sa-blank{max-width:340px;display:block;margin-bottom:6px;}

/* 7.2 L9 swap builder */
.sa-swapshell{background:#0F172A;border-radius:12px;padding:14px 16px;font-family:'DM Mono',monospace;font-size:15px;color:#E2E8F0;margin:6px 0 12px;}
.sa-code-fixed{color:#93C5FD;padding:3px 0;}
.sa-slot{background:#1E293B;border:1px dashed #475569;border-radius:7px;min-height:20px;margin:5px 0 5px 24px;padding:6px 10px;color:#F8FAFC;transition:all .2s;}
.sa-slot-filled{border-style:solid;border-color:#22C55E;background:#14532D;}
.sa-chips{display:flex;flex-wrap:wrap;gap:10px;margin:4px 0 10px;}
.sa-chip{font-family:'DM Mono',monospace;font-size:14px;padding:9px 14px;border:1px solid #6366F1;border-radius:9px;background:#EEF2FF;color:#4338CA;cursor:pointer;transition:all .15s;}
.sa-chip:hover:not(:disabled){background:#6366F1;color:#fff;}
.sa-chip-used{opacity:.45;text-decoration:line-through;cursor:default;border-color:#CBD5E1;background:#F1F5F9;color:#94A3B8;}
.sa-chip-wrong{background:#FEE2E2;border-color:#EF4444;color:#B91C1C;}

/* ===== 7.3 Bulletproof widgets ===== */
.cd-row{display:flex;flex-wrap:wrap;gap:8px;margin-bottom:14px;}
.cd-cell{width:46px;height:56px;font-family:'DM Mono',monospace;font-size:22px;font-weight:600;border:2px solid #CBD5E1;border-radius:10px;background:#fff;color:#0F172A;cursor:pointer;transition:all .15s;}
.cd-cell:hover{border-color:#6366F1;transform:translateY(-2px);}
.cd-check{background:#EEF2FF;border-color:#6366F1;color:#4338CA;}
.tp-grid{display:flex;flex-direction:column;gap:10px;margin-bottom:12px;}
.tp-row{display:flex;align-items:center;gap:12px;flex-wrap:wrap;}
.tp-label{font-family:'DM Mono',monospace;font-size:13px;font-weight:600;color:#4338CA;min-width:88px;}
.tp-row .nc-input{flex:1 1 180px;max-width:320px;}

/* ===== 7.4 Prove It: trace tables ===== */
.cb-ln{color:#64748B;user-select:none;}
.tt-tablewrap{overflow-x:auto;margin:6px 0 10px;}
.tt-table{border-collapse:collapse;width:100%;max-width:580px;font-family:'DM Mono',monospace;font-size:14px;}
.tt-table th{background:#0F172A;color:#F8FAFC;padding:8px 10px;text-align:center;font-weight:500;border:1px solid #1E293B;}
.tt-table td{border:1px solid #E2E8F0;padding:0;text-align:center;background:#fff;}
.tt-step{font-family:'DM Sans',sans-serif;font-size:12px;color:#64748B;padding:6px 10px !important;white-space:nowrap;background:#F8FAFC;}
.tt-cell-in{width:100%;box-sizing:border-box;border:none;background:transparent;text-align:center;font-family:'DM Mono',monospace;font-size:14px;padding:9px 4px;color:#0F172A;}
.tt-cell-in:focus{outline:2px solid #6366F1;outline-offset:-2px;}
.tt-cell-ok{background:#F0FDF4;color:#15803D;font-weight:600;}
.tt-cell-bad{background:#FEF2F2;color:#B91C1C;}

/* ============================================================
   Lumira Academy — Pseudocode Runner widget  (add-only)
   ============================================================ */
.nc-runner {
  border: 1px solid #E2E8F0;
  border-radius: 14px;
  background: #FFFFFF;
  padding: 16px;
  margin: 18px 0;
  box-shadow: 0 1px 3px rgba(15, 23, 42, .05);
}
.nc-runner.ncr-solved { border-color: #86EFAC; box-shadow: 0 0 0 3px rgba(134, 239, 172, .28); }
.ncr-task {
  font-family: 'DM Sans', sans-serif;
  font-size: 14px; line-height: 1.55; color: #334155;
  background: #F8FAFC; border-left: 3px solid #6366F1;
  padding: 10px 14px; border-radius: 0 8px 8px 0; margin-bottom: 12px;
}
.ncr-task strong { color: #0F172A; }
.ncr-palette { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; align-items: center; }
.ncr-palette-label { font-family: 'DM Sans', sans-serif; font-size: 12px; color: #94A3B8; margin-right: 2px; }
.ncr-sym {
  font-family: 'DM Mono', monospace; font-size: 12px;
  background: #EEF2FF; color: #4338CA; border: 1px solid #C7D2FE;
  border-radius: 6px; padding: 3px 8px; cursor: pointer; transition: .12s;
}
.ncr-sym:hover { background: #6366F1; color: #fff; border-color: #6366F1; }
.ncr-code {
  width: 100%; box-sizing: border-box; min-height: 150px; resize: vertical;
  font-family: 'DM Mono', monospace; font-size: 13.5px; line-height: 1.6;
  color: #E2E8F0; background: #0F172A; border: 1px solid #1E293B;
  border-radius: 10px; padding: 14px; tab-size: 2; caret-color: #F59E0B;
}
.ncr-code:focus { outline: none; border-color: #6366F1; box-shadow: 0 0 0 3px rgba(99, 102, 241, .25); }
.ncr-controls { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.ncr-btn {
  font-family: 'DM Sans', sans-serif; font-size: 13.5px; font-weight: 600;
  border: 1px solid #CBD5E1; background: #fff; color: #334155;
  border-radius: 9px; padding: 9px 15px; cursor: pointer; transition: .12s;
}
.ncr-btn:hover { border-color: #6366F1; color: #4338CA; }
.ncr-btn-run { background: #6366F1; border-color: #6366F1; color: #fff; }
.ncr-btn-run:hover { background: #4F46E5; color: #fff; }
.ncr-btn-watch { background: #F59E0B; border-color: #F59E0B; color: #0F172A; }
.ncr-btn-watch:hover { background: #D97706; color: #fff; }
.ncr-btn-ghost { background: transparent; border-style: dashed; margin-top: 10px; }

/* console */
.ncr-console { display: none; margin-top: 14px; border-radius: 10px; padding: 0; }
.ncr-console.show { display: block; padding: 12px 14px; }
.ncr-console.ok { background: #F0FDF4; border: 1px solid #BBF7D0; }
.ncr-console.err { background: #FEF2F2; border: 1px solid #FECACA; }
.ncr-out-label, .ncr-w-vars-label, .ncr-w-out-label {
  font-family: 'DM Sans', sans-serif; font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .06em; color: #94A3B8; margin-bottom: 6px;
}
.ncr-outline { font-family: 'DM Mono', monospace; font-size: 13.5px; color: #166534; padding: 1px 0; }
.ncr-dim { color: #94A3B8; }
.ncr-err { font-family: 'DM Sans', sans-serif; font-size: 13.5px; color: #991B1B; line-height: 1.5; }
.ncr-err-tag { display: inline-block; background: #DC2626; color: #fff; font-size: 11px; font-weight: 700; border-radius: 5px; padding: 1px 7px; margin-right: 8px; }
.ncr-pass { font-family: 'DM Sans', sans-serif; font-size: 14.5px; font-weight: 600; color: #166534; display: flex; align-items: center; gap: 8px; }
.ncr-pass-icon { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; background: #22C55E; color: #fff; border-radius: 50%; font-size: 13px; }
.ncr-fail { font-family: 'DM Sans', sans-serif; font-size: 14px; font-weight: 600; color: #991B1B; display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.ncr-fail-icon { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; background: #EF4444; color: #fff; border-radius: 50%; font-size: 15px; }
.ncr-fail-row { display: flex; gap: 10px; align-items: baseline; font-family: 'DM Sans', sans-serif; font-size: 13px; padding: 3px 0; }
.ncr-fail-row > span { width: 92px; color: #64748B; flex-shrink: 0; }
.ncr-fail-row code { font-family: 'DM Mono', monospace; background: #fff; border: 1px solid #FECACA; border-radius: 5px; padding: 2px 7px; color: #0F172A; }
.ncr-got code { border-color: #FCA5A5; }

/* model answer */
.ncr-model { margin-top: 14px; background: #0F172A; border-radius: 10px; padding: 14px; }
.ncr-model.hidden { display: none; }
.ncr-model-label { font-family: 'DM Sans', sans-serif; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: #F59E0B; margin-bottom: 8px; }
.ncr-model-code { font-family: 'DM Mono', monospace; font-size: 13px; line-height: 1.6; color: #E2E8F0; white-space: pre-wrap; margin: 0; }
.ncr-model-note { font-family: 'DM Sans', sans-serif; font-size: 12.5px; color: #94A3B8; margin-top: 10px; line-height: 1.5; }

/* watch it run */
.ncr-watch { margin-top: 14px; }
.ncr-watch.hidden { display: none; }
.ncr-w-grid { display: grid; grid-template-columns: 1.5fr 1fr; gap: 12px; }
.ncr-w-code { background: #0F172A; border-radius: 10px; padding: 10px 6px; overflow: auto; }
.ncr-w-line { display: flex; font-family: 'DM Mono', monospace; font-size: 13px; line-height: 1.7; border-radius: 5px; padding: 0 6px; }
.ncr-w-line.active { background: rgba(245, 158, 11, .18); box-shadow: inset 3px 0 0 #F59E0B; }
.ncr-w-ln { color: #475569; width: 22px; text-align: right; margin-right: 12px; flex-shrink: 0; -webkit-user-select: none; user-select: none; }
.ncr-w-src { color: #CBD5E1; white-space: pre; }
.ncr-w-line.active .ncr-w-src { color: #FFFFFF; }
.ncr-w-side { display: flex; flex-direction: column; }
.ncr-w-vars { background: #F8FAFC; border: 1px solid #E2E8F0; border-radius: 10px; padding: 8px; margin-bottom: 12px; min-height: 40px; }
.ncr-w-var { display: flex; justify-content: space-between; align-items: center; font-family: 'DM Mono', monospace; font-size: 13px; padding: 4px 8px; border-radius: 6px; transition: background .2s; }
.ncr-w-var.changed { background: #FEF3C7; }
.ncr-w-vname { color: #6366F1; font-weight: 600; }
.ncr-w-vval { color: #0F172A; }
.ncr-w-var.changed .ncr-w-vval { color: #B45309; font-weight: 600; }
.ncr-w-out { background: #F8FAFC; border: 1px solid #E2E8F0; border-radius: 10px; padding: 8px 10px; font-family: 'DM Mono', monospace; font-size: 13px; color: #166534; min-height: 30px; }
.ncr-w-ctrl { display: flex; align-items: center; gap: 8px; margin-top: 12px; }
.ncr-btn-play { background: #6366F1; border-color: #6366F1; color: #fff; }
.ncr-btn-play:hover { background: #4F46E5; color: #fff; }
.ncr-w-pos { font-family: 'DM Sans', sans-serif; font-size: 12.5px; color: #64748B; margin-left: auto; }

@media (max-width: 640px) { .ncr-w-grid { grid-template-columns: 1fr; } }

/* recognise-the-concept matcher */
.ncr-recog { margin: 18px 0; }
.ncr-recog-q { background: #FFFBEB; border: 1px solid #FDE68A; border-radius: 10px; padding: 12px 14px; margin-bottom: 10px; font-family: 'DM Sans', sans-serif; font-size: 14px; color: #334155; line-height: 1.55; }
.ncr-recog-q .ncr-recog-tag { display: inline-block; background: #F59E0B; color: #0F172A; font-size: 11px; font-weight: 700; border-radius: 5px; padding: 1px 7px; margin-right: 8px; }
.ncr-recog-opts { display: flex; flex-wrap: wrap; gap: 8px; }
.ncr-recog-btn { font-family: 'DM Sans', sans-serif; font-size: 13.5px; font-weight: 600; border: 1px solid #CBD5E1; background: #fff; color: #334155; border-radius: 9px; padding: 9px 15px; cursor: pointer; transition: .12s; }
.ncr-recog-btn:hover { border-color: #6366F1; }
.ncr-recog-btn.right { background: #DCFCE7; border-color: #22C55E; color: #166534; }
.ncr-recog-btn.wrong { background: #FEE2E2; border-color: #EF4444; color: #991B1B; }
.ncr-recog-fb { margin-top: 10px; font-family: 'DM Sans', sans-serif; font-size: 13.5px; line-height: 1.55; padding: 10px 12px; border-radius: 8px; display: none; }
.ncr-recog-fb.show { display: block; }
.ncr-recog-fb.ok { background: #F0FDF4; border: 1px solid #BBF7D0; color: #166534; }
.ncr-recog-fb.no { background: #FEF2F2; border: 1px solid #FECACA; color: #991B1B; }

/* array visual (lesson 25) */
.arr-visual { display: flex; gap: 6px; flex-wrap: wrap; margin: 16px 0; }
.arr-cell { display: flex; flex-direction: column; align-items: center; }
.arr-box { width: 54px; height: 54px; border: 2px solid #6366F1; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-family: 'DM Mono', monospace; font-size: 18px; color: #0F172A; background: #EEF2FF; transition: .2s; }
.arr-box.filled { background: #6366F1; color: #fff; }
.arr-box.hot { transform: translateY(-4px); box-shadow: 0 6px 14px rgba(99, 102, 241, .35); border-color: #F59E0B; }
.arr-idx { font-family: 'DM Mono', monospace; font-size: 12px; color: #94A3B8; margin-top: 4px; }

/* ---- Watch it build: live output stage (add-only) ---- */
.ncr-b-grid { grid-template-columns: 1.3fr 1fr; }
.ncr-b-side { display: flex; flex-direction: column; }
.ncr-stage {
  background: #0F172A; border: 1px solid #1E293B; border-radius: 10px;
  padding: 16px; margin: 0; min-height: 150px;
  font-family: 'DM Mono', monospace; font-size: 18px; line-height: 1.35;
  color: #F59E0B; white-space: pre; overflow: auto; letter-spacing: 1px;
  display: flex; flex-direction: column; justify-content: center;
}
.ncr-b-meta { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; gap: 10px; }
.ncr-b-label { font-family: 'DM Sans', sans-serif; font-size: 12.5px; color: #4338CA; font-weight: 600; }
.ncr-b-count { font-family: 'DM Sans', sans-serif; font-size: 12.5px; color: #64748B; margin-left: auto; }
.ncr-btn-build { background: #F59E0B; border-color: #F59E0B; color: #0F172A; }
.ncr-btn-build:hover { background: #D97706; color: #fff; }
@media (max-width: 640px) { .ncr-b-grid { grid-template-columns: 1fr; } }

/* ---- Watch it build: file panel (add-only) ---- */
.ncr-stage-sm { font-size: 13.5px; min-height: 40px; padding: 10px 12px; letter-spacing: 0; display: block; }
.ncr-file { background: #F8FAFC; border: 1px solid #E2E8F0; border-radius: 10px; overflow: hidden; margin-bottom: 10px; }
.ncr-file-name { display: flex; align-items: center; gap: 6px; font-family: 'DM Sans', sans-serif; font-size: 12.5px; font-weight: 700; color: #334155; background: #EEF2FF; padding: 7px 12px; border-bottom: 1px solid #E2E8F0; }
.ncr-file-mode { margin-left: auto; font-weight: 600; font-size: 11px; color: #6366F1; text-transform: uppercase; letter-spacing: .05em; }
.ncr-file-body { padding: 6px; }
.ncr-file-line { font-family: 'DM Mono', monospace; font-size: 13px; color: #0F172A; padding: 4px 10px; border-radius: 6px; border-left: 3px solid transparent; }
.ncr-file-line.done { color: #64748B; border-left-color: #CBD5E1; }
.ncr-file-line.cur { background: #FEF3C7; border-left-color: #F59E0B; color: #B45309; font-weight: 600; }

/* ---- Worksheet practice bank (add-only) ---- */
#ws-root { max-width: 820px; margin: 0 auto; padding: 8px 0 40px; }
.ws-intro { margin-bottom: 18px; }
.ws-set-title { font-family: 'DM Sans', sans-serif; font-size: 24px; color: #0F172A; margin: 4px 0 6px; }
.ws-set-desc { font-family: 'DM Sans', sans-serif; font-size: 14.5px; line-height: 1.55; color: #64748B; margin: 0 0 8px; }
.ws-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 8px; }
.ws-card { display: flex; gap: 14px; align-items: flex-start; text-align: left; background: #fff; border: 1px solid #E2E8F0; border-radius: 14px; padding: 16px; cursor: pointer; transition: .14s; font-family: 'DM Sans', sans-serif; }
.ws-card:hover { border-color: #6366F1; box-shadow: 0 6px 18px rgba(99, 102, 241, .12); transform: translateY(-2px); }
.ws-card-icon { font-size: 26px; line-height: 1; flex-shrink: 0; }
.ws-card-title { font-size: 16px; font-weight: 700; color: #0F172A; margin-bottom: 4px; }
.ws-card-desc { font-size: 13px; color: #64748B; line-height: 1.5; }
.ws-card-count { font-size: 12px; font-weight: 600; color: #6366F1; margin-top: 8px; }
.ws-back { font-family: 'DM Sans', sans-serif; font-size: 13.5px; font-weight: 600; color: #6366F1; background: none; border: none; cursor: pointer; padding: 4px 0; margin-bottom: 10px; }
.ws-back:hover { text-decoration: underline; }
.ws-q { border-top: 1px solid #E2E8F0; padding: 22px 0 6px; }
.ws-q-num { font-family: 'DM Sans', sans-serif; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: #94A3B8; margin-bottom: 6px; }
.ws-q-prompt { font-family: 'DM Sans', sans-serif; font-size: 15px; line-height: 1.6; color: #334155; margin-bottom: 12px; }
.ws-code { background: #0F172A; color: #E2E8F0; font-family: 'DM Mono', monospace; font-size: 13.5px; line-height: 1.6; border-radius: 10px; padding: 14px; white-space: pre; overflow: auto; margin: 0 0 12px; }
.ws-predict-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.ws-predict-in { flex: 1; min-width: 180px; font-family: 'DM Mono', monospace; font-size: 14px; padding: 9px 12px; border: 1px solid #CBD5E1; border-radius: 9px; color: #0F172A; }
.ws-predict-in:focus { outline: none; border-color: #6366F1; box-shadow: 0 0 0 3px rgba(99, 102, 241, .25); }
@media (max-width: 640px) { .ws-cards { grid-template-columns: 1fr; } }

/* ============================================================
   Lumira Academy — SQL runner + database tables (Topic 9)
   ============================================================ */
.nc-sqlr { border: 1px solid #E2E8F0; border-radius: 14px; background: #fff; padding: 16px; margin: 18px 0; box-shadow: 0 1px 3px rgba(15,23,42,.05); }
.nc-sqlr.ncr-solved { border-color: #86EFAC; box-shadow: 0 0 0 3px rgba(134,239,172,.28); }
.sqlr-tablewrap { overflow-x: auto; margin-bottom: 12px; }
table.sqlr-table { border-collapse: collapse; width: 100%; font-family: 'DM Mono', monospace; font-size: 13px; }
table.sqlr-table th, table.sqlr-table td { border: 1px solid #E2E8F0; padding: 7px 12px; text-align: left; white-space: nowrap; }
table.sqlr-table th { background: #0F172A; color: #F8FAFC; font-family: 'DM Sans', sans-serif; font-weight: 600; font-size: 12.5px; position: relative; }
table.sqlr-table th.sqlr-pk { background: #4338CA; }
.sqlr-type { display: block; font-family: 'DM Mono', monospace; font-weight: 400; font-size: 10px; color: #A5B4FC; margin-top: 2px; text-transform: none; }
table.sqlr-table td { color: #0F172A; background: #fff; }
table.sqlr-table tbody tr:nth-child(even) td { background: #F8FAFC; }
.sqlr-row-kept td, .sqlr-row-current-kept td { background: #F0FDF4 !important; }
.sqlr-row-dropped td, .sqlr-row-current-dropped td { background: #FEF2F2 !important; color: #94A3B8 !important; text-decoration: line-through; }
.sqlr-row-current-kept td { box-shadow: inset 0 0 0 2px #22C55E; }
.sqlr-row-current-dropped td { box-shadow: inset 0 0 0 2px #EF4444; }
.result-table-wrap { overflow-x: auto; }

.sqlr-code { width: 100%; box-sizing: border-box; min-height: 70px; resize: vertical; font-family: 'DM Mono', monospace; font-size: 14px; line-height: 1.55; color: #E2E8F0; background: #0F172A; border: 1px solid #1E293B; border-radius: 10px; padding: 12px 14px; caret-color: #F59E0B; }
.sqlr-code:focus { outline: none; border-color: #6366F1; box-shadow: 0 0 0 3px rgba(99,102,241,.25); }
.sqlr-palette { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; align-items: center; }
.sqlr-palette-label { font-family: 'DM Sans', sans-serif; font-size: 12px; color: #94A3B8; }
.sqlr-kw { font-family: 'DM Mono', monospace; font-size: 12px; background: #EEF2FF; color: #4338CA; border: 1px solid #C7D2FE; border-radius: 6px; padding: 3px 8px; cursor: pointer; transition: .12s; }
.sqlr-kw:hover { background: #6366F1; color: #fff; border-color: #6366F1; }

.sqlr-result { display: none; margin-top: 14px; }
.sqlr-result.show { display: block; padding: 12px 14px; border-radius: 10px; }
.sqlr-result.ok { background: #F0FDF4; border: 1px solid #BBF7D0; }
.sqlr-result.err { background: #FEF2F2; border: 1px solid #FECACA; }
.sqlr-res-label { font-family: 'DM Sans', sans-serif; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: #64748B; margin-bottom: 6px; }
.sqlr-result-table { margin-top: 4px; }
.sqlr-result-table th { background: #166534; }
.sqlr-watch { margin-top: 14px; }
.sqlr-watch.hidden { display: none; }

/* clickable anatomy table (lesson 1) */
.anat-hint { font-family: 'DM Sans', sans-serif; font-size: 14px; color: #4338CA; background: #EEF2FF; border: 1px solid #C7D2FE; border-radius: 8px; padding: 10px 14px; margin-top: 10px; min-height: 20px; }
table.anat-table th, table.anat-table td { cursor: pointer; transition: background .12s; }
table.anat-table td:hover, table.anat-table th:hover { background: #EEF2FF !important; }
.anat-col-hi td, .anat-col-hi th { background: #FEF3C7 !important; }
.anat-row-hi td { background: #DBEAFE !important; }

/* ---- design-a-table checker (9.2, add-only) ---- */
.n9d { border: 1px solid #E2E8F0; border-radius: 14px; background: #fff; padding: 16px; margin: 18px 0; box-shadow: 0 1px 3px rgba(15,23,42,.05); }
.n9d.ncr-solved { border-color: #86EFAC; box-shadow: 0 0 0 3px rgba(134,239,172,.28); }
.n9d-table td.n9d-ex { font-family: 'DM Mono', monospace; color: #64748B; font-size: 12.5px; }
.n9d-sel { font-family: 'DM Sans', sans-serif; font-size: 13px; padding: 5px 8px; border: 1px solid #CBD5E1; border-radius: 7px; background: #fff; color: #0F172A; }
.n9d-sel:focus { outline: none; border-color: #6366F1; box-shadow: 0 0 0 3px rgba(99,102,241,.2); }
.n9d-sel.n9d-ok { border-color: #22C55E; background: #F0FDF4; }
.n9d-sel.n9d-no { border-color: #EF4444; background: #FEF2F2; }
.n9d-keycell { text-align: center; }
.n9d-keycell input { width: 16px; height: 16px; accent-color: #4338CA; cursor: pointer; }

/* ===== Topic 9 worksheet: reference table shown above a practice set ===== */
.ws-set-table {
  margin: 4px 0 22px;
  overflow-x: auto;
}
.ws-set-table .sqlr-table { margin: 0; }

/* ===== Topic 10: logic gate simulator + truth tables ===== */
.gate-sim {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  flex-wrap: wrap;
  background: #0F172A;
  border: 1px solid #1E293B;
  border-radius: 14px;
  padding: 22px 18px;
  margin: 6px 0 4px;
}
.gate-switches { display: flex; flex-direction: column; gap: 12px; }
.gate-switch {
  display: flex; align-items: center; gap: 10px;
  background: #1E293B; border: 2px solid #334155; color: #E2E8F0;
  border-radius: 10px; padding: 10px 14px; cursor: pointer;
  font-family: 'DM Mono', monospace; transition: all .15s; min-width: 74px;
}
.gate-switch:hover { border-color: #6366F1; }
.gate-switch.on { border-color: #22C55E; background: #14351F; }
.gate-switch-name { font-size: 15px; font-weight: 600; }
.gate-switch-val {
  margin-left: auto; font-size: 16px; font-weight: 700;
  width: 26px; height: 26px; display: flex; align-items: center; justify-content: center;
  background: #0F172A; border-radius: 6px; color: #94A3B8;
}
.gate-switch.on .gate-switch-val { color: #22C55E; }
.gate-diagram { position: relative; display: flex; flex-direction: column; align-items: center; }
.gate-svg { width: 208px; height: 118px; }
.gate-name-tag {
  font-family: 'DM Mono', monospace; font-size: 12px; letter-spacing: .08em;
  color: #94A3B8; margin-top: -6px;
}
.gate-out-label { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.gate-out-name { font-family: 'DM Mono', monospace; font-size: 12px; color: #94A3B8; letter-spacing: .05em; }
.gate-out-val {
  font-size: 22px; font-weight: 700; color: #94A3B8;
  width: 44px; height: 44px; display: flex; align-items: center; justify-content: center;
  background: #1E293B; border: 2px solid #334155; border-radius: 10px;
}
.gate-out-val.on { color: #22C55E; border-color: #22C55E; background: #14351F; }

/* ---- truth tables ---- */
.tt-table { border-collapse: collapse; font-family: 'DM Mono', monospace; margin: 8px 0; width: auto; }
.tt-table th, .tt-table td {
  border: 1px solid #E2E8F0; padding: 8px 16px; text-align: center; font-size: 14px; color: #1E293B;
}
.tt-table thead th { background: #0F172A; color: #fff; font-weight: 600; border-color: #0F172A; }
.tt-table .tt-outcol { background: #EEF2FF; font-weight: 600; }
.tt-table thead .tt-outcol { background: #4F46E5; color: #fff; }
.tt-table .tt-row-cur td { background: #DCFCE7; }
.tt-table .tt-row-cur .tt-outcol { background: #BBF7D0; }
.tt-fillable td.tt-fill { padding: 5px 10px; }
.tt-cell-btns { display: inline-flex; gap: 4px; }
.tt-bit {
  width: 30px; height: 30px; border: 1.5px solid #CBD5E1; background: #fff; color: #64748B;
  border-radius: 6px; cursor: pointer; font-family: 'DM Mono', monospace; font-size: 14px; font-weight: 600; transition: all .12s;
}
.tt-bit:hover { border-color: #6366F1; }
.tt-bit.sel { background: #4F46E5; border-color: #4F46E5; color: #fff; }
.tt-fill.tt-ok { box-shadow: inset 0 0 0 2px #22C55E; }
.tt-fill.tt-no { box-shadow: inset 0 0 0 2px #EF4444; }

/* ===== Topic 10 truth-table working columns ===== */
.tt-scroll { overflow-x: auto; margin: 8px 0; }
.tt-scroll .tt-table { margin: 0; }
.tt-table .tt-stepcol { background: #F1F5F9; }
.tt-table thead .tt-stepcol { background: #64748B; color: #fff; font-weight: 600; }

/* ===== Topic 10 live circuit diagram ===== */
.circ-wrap {
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  background: #0F172A; border: 1px solid #1E293B; border-radius: 14px;
  padding: 20px 18px; margin: 6px 0 4px;
}
.circ-switches { display: flex; flex-direction: column; gap: 12px; }
.circ-canvas { flex: 1; min-width: 260px; overflow-x: auto; }
.circ-svg { width: 100%; height: auto; max-width: 640px; display: block; }
.circ-glabel { fill: #94A3B8; font-family: 'DM Mono', monospace; font-size: 11px; text-anchor: middle; }
.circ-ilabel { fill: #E2E8F0; font-family: 'DM Mono', monospace; font-size: 13px; font-weight: 600; }

/* ===== Topic 10 expression input ===== */
.expr-row { margin: 10px 0 6px; }
.expr-input {
  width: 100%; max-width: 440px; box-sizing: border-box;
  font-family: 'DM Mono', monospace; font-size: 15px; padding: 11px 13px;
  border: 1.5px solid #CBD5E1; border-radius: 8px; background: #fff; color: #1E293B;
}
.expr-input:focus { outline: none; border-color: #6366F1; box-shadow: 0 0 0 3px rgba(99,102,241,.15); }
.scenario-card { background: #EEF2FF; border: 1px solid #C7D2FE; border-radius: 12px; padding: 16px 18px; margin: 10px 0; }
.scenario-title { font-family: 'DM Mono', monospace; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: #4F46E5; margin-bottom: 6px; }
.scenario-body { font-size: 15px; line-height: 1.6; color: #1E293B; margin: 0; }

/* ---- Lumira brand emblem ---- */
.brandmark{width:30px;height:32px;display:block;flex-shrink:0;}
.brandmark.small{width:24px;height:26px;}

/* CS runner inspection: desktop code/input pairing and indexed memory views. */
.nc-runner .ncr-editor-grid { display:grid;grid-template-columns:minmax(0,1fr);gap:14px;align-items:start; }
.nc-runner .ncr-input-panel[hidden] { display:none; }
.nc-runner .ncr-input-panel { border:1px solid #E2E8F0;border-radius:10px;background:#F8FAFC;padding:12px;min-width:0; }
.nc-runner .ncr-input-panel label { font-size:13px;font-weight:700;color:#334155; }
.nc-runner .ncr-input-panel p,.nc-runner .ncr-input-panel small { display:block;font-size:12px;line-height:1.5;color:#64748B;margin:7px 0; }
.nc-runner .ncr-input-panel textarea { width:100%;box-sizing:border-box;resize:vertical;border:1px solid #CBD5E1;border-radius:7px;padding:8px;font:13px/1.6 'DM Mono',monospace;background:white;color:#0F172A; }
.nc-runner .ncr-input-panel .ncr-btn { font-size:12px;padding:7px 9px;margin-top:7px; }
.nc-runner .ncr-trace-guide { color:#475569;font-size:13px;line-height:1.6;margin:0 0 12px; }
.nc-runner .ncr-w-grid { align-items:start; }
@media (min-width:641px) {
  .nc-runner .ncr-editor-grid.has-inputs { grid-template-columns:minmax(0,1fr) 225px; }
  .nc-runner .ncr-w-grid { grid-template-columns:minmax(0,1fr) minmax(300px,1fr); }
}
.nc-runner .ncr-w-code { max-height:430px;overflow:auto;position:relative; }
.nc-runner .ncr-w-side { min-width:0;max-height:520px;overflow:auto; }
.nc-runner .ncr-w-pos { overflow-wrap:anywhere; }
.nc-runner .ncr-array { margin:12px 0;border:1px solid #CBD5E1;border-radius:9px;overflow:hidden;background:white; }
.nc-runner .ncr-array h4 { margin:0;padding:9px 10px;background:#F1F5F9;font-size:13px;color:#334155; }
.nc-runner .ncr-array h4 small { font-weight:400;color:#64748B; }
.nc-runner .ncr-array-scroll { overflow:auto; }
.nc-runner .ncr-array table { border-collapse:collapse;font:12px/1.5 'DM Mono',monospace;width:100%;color:#0F172A; }
.nc-runner .ncr-array caption { text-align:left;padding:6px 10px;font:12px/1.5 'DM Sans',sans-serif;color:#64748B; }
.nc-runner .ncr-array th,.nc-runner .ncr-array td { border:1px solid #E2E8F0;text-align:center;padding:7px;min-width:34px;white-space:pre; }
.nc-runner .ncr-array th { background:#F8FAFC;color:#475569; }
.nc-runner .ncr-array .cell-changed { background:#DCFCE7;color:#166534;font-weight:700; }
.nc-runner .ncr-array .cell-read { background:#EDE9FE;color:#5B21B6;box-shadow:inset 0 0 0 2px #A78BFA; }
.nc-runner .ncr-array-window { display:flex;gap:10px;padding:8px;flex-wrap:wrap;font-size:12px;color:#475569; }
.nc-runner .ncr-array-window input { width:65px;padding:5px;border:1px solid #CBD5E1;border-radius:5px; }
.nc-runner .ncr-input-panel textarea:focus-visible,.nc-runner .ncr-array-window input:focus-visible { outline:2px solid #6366F1;outline-offset:2px; }
