/* ============================================================
   PREMIUM WATER PVT. LTD. — Python Workshop
   Brand Identity: TrackMy Tech BIS v1.0
   Colors, fonts, and spacing strictly follow the BIS.
   ============================================================ */

/* ── TrackMy Tech Design Tokens (BIS-exact) ────────────────── */
:root {
  /* Primary colours — BIS §03 */
  --color-black:       #000000;
  --color-sky-blue:    #1E9BFF;
  --color-white:       #FFFFFF;

  /* Supporting colours — BIS §03 */
  --color-soft-white:  #F8FAFC;
  --color-light-grey:  #E5E7EB;
  --color-dark-grey:   #111827;
  --color-muted-grey:  #6B7280;

  /* Derived sky-blue tints (BIS allows for UI depth) */
  --sky-50:   #EFF8FF;
  --sky-100:  #DBEEFF;
  --sky-600:  #0A82E0;   /* hover state — slightly darker */

  /* Semantic colour aliases */
  --bg:          var(--color-soft-white);
  --bg-card:     var(--color-white);
  --bg-card-2:   #F3F4F6;
  --bg-card-3:   var(--sky-50);
  --bg-code:     #F6F8FA;

  --border:      var(--color-light-grey);
  --border-2:    #F3F4F6;
  --border-code: #D1D9E6;

  --brand:       var(--color-sky-blue);
  --brand-dim:   var(--sky-600);
  --brand-text:  var(--sky-600);
  --brand-50:    var(--sky-50);
  --brand-100:   var(--sky-100);

  --text:   var(--color-dark-grey);
  --text-2: var(--color-muted-grey);
  --text-3: #9CA3AF;

  /* Status colours (system feedback only — not brand) */
  --green:      #16A34A;
  --green-bg:   #F0FDF4;
  --green-text: #15803D;

  --red:      #DC2626;
  --red-bg:   #FEF2F2;
  --red-text: #B91C1C;

  --amber:      #D97706;
  --amber-bg:   #FFFBEB;
  --amber-text: #92400E;

  --cyan:      #0891B2;
  --cyan-bg:   #ECFEFF;
  --cyan-text: #0E7490;

  --orange:      #EA580C;
  --orange-bg:   #FFF7ED;
  --orange-text: #9A3412;

  --purple-bg:   #F5F3FF;
  --purple-text: #6D28D9;

  --gold:      #CA8A04;
  --gold-bg:   #FEFCE8;
  --gold-text: #78350F;

  /* Typography — BIS §04 */
  --font-heading: 'Manrope', sans-serif;
  --font-body:    'Inter', sans-serif;
  --font-mono:    'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;

  /* Spacing — BIS 8pt grid */
  --space-1: 8px;
  --space-2: 16px;
  --space-3: 24px;
  --space-4: 32px;
  --space-6: 48px;
  --space-8: 64px;

  /* Border radii — clean, structured */
  --r-sm: 4px;
  --r-md: 8px;
  --r-lg: 12px;
  --r-xl: 16px;

  /* Shadows — light, purposeful */
  --shadow:    0 1px 2px rgba(17, 24, 39, 0.06), 0 2px 8px rgba(17, 24, 39, 0.04);
  --shadow-md: 0 2px 6px rgba(17, 24, 39, 0.07), 0 8px 24px rgba(17, 24, 39, 0.05);
  --shadow-lg: 0 4px 16px rgba(17, 24, 39, 0.09), 0 12px 40px rgba(17, 24, 39, 0.06);

  /* Transitions */
  --t:      0.18s ease;
  --t-slow: 0.32s ease;
}

/* ── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* Subtle grid texture — sky-blue tint at 3% */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(30, 155, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(30, 155, 255, 0.03) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
  z-index: 0;
}

#app { position: relative; z-index: 1; min-height: 100vh; }

/* ── Phosphor icon alignment ────────────────────────────────── */
i[class*="ph"] {
  font-style: normal;
  display: inline-flex;
  align-items: center;
  vertical-align: -0.13em;
  line-height: 1;
  font-size: 1.1em;
}

/* ── BIS §04: Manrope — headings, section headers, key callouts ─ */
h1, h2, h3, h4, h5, h6,
.chapter-title,
.chapter-subtitle,
.opening-logo,
.opening-corp,
.complete-title,
.complete-badge,
.complete-punchline,
.intro-label,
.success-title,
.question-label,
.concept-label,
.block-stat-label,
.block-system-label,
.output-label,
.progress-label,
.stdin-label,
.hint-label,
.hud-workshop-label,
.chapter-concept-badge,
.complete-stat-label,
.editor-lang,
.runtime-status-badge {
  font-family: var(--font-heading) !important;
}

/* ── BIS §04: Inter — body text, content, form labels, tables ── */
body,
.block-narrative,
.question-text,
.concept-text,
.block-system-text,
.intro-challenge-message,
.success-message,
.success-footer,
.hud-stat-label,
.hud-stat-value,
.stat-item-label,
.input-field-label,
.hint-text,
.validation-fail,
.complete-story p,
.complete-quote,
.complete-footnote,
.btn,
.opening-partner-label,
.opening-tagline,
.intro-line,
.stdout-hint,
.output-placeholder {
  font-family: var(--font-body) !important;
}

/* ── BIS §04: JetBrains Mono — code, output, financial data ─── */
.code-textarea,
.output-body,
.hud-stat-value,
.stat-item-value,
.concept-example code,
.kbd-hint,
.progress-counter,
.complete-stat-value {
  font-family: var(--font-mono) !important;
}

/* ══════════════════════════════════════════════════════════════
   PERSISTENT HUD — with TrackMy Tech logo
   ══════════════════════════════════════════════════════════════ */
.hud {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--color-white);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 3px rgba(17, 24, 39, 0.06);
}

.hud-inner {
  max-width: 1300px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  height: 56px;
  padding: 0 24px;
  gap: 0;
}

/* TrackMy Tech logo */
.hud-logo {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  padding-right: 20px;
  border-right: 1px solid var(--border);
  height: 100%;
}

.hud-logo img {
  height: 28px;
  width: auto;
  display: block;
  object-fit: contain;
}

/* Workshop label — separates logo from financials */
.hud-workshop-label {
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--text-3);
  padding: 0 16px;
  border-right: 1px solid var(--border);
  flex-shrink: 0;
  white-space: nowrap;
  text-transform: uppercase;
}

.hud-stats {
  display: flex;
  align-items: center;
  flex: 1;
  overflow-x: auto;
  scrollbar-width: none;
}
.hud-stats::-webkit-scrollbar { display: none; }

.hud-stat {
  display: flex;
  flex-direction: column;
  padding: 0 18px;
  border-right: 1px solid var(--border);
  min-width: 100px;
  flex-shrink: 0;
}

.hud-stat-label {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-3);
}

.hud-stat-value {
  font-size: 14px;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--text);
  transition: color var(--t);
}

.hud-stat-value.green  { color: var(--green-text); }
.hud-stat-value.red    { color: var(--red-text); }
.hud-stat-value.amber  { color: var(--amber-text); }

.hud-status-wrap {
  margin-left: auto;
  padding-left: 18px;
  display: flex;
  align-items: center;
  gap: 7px;
  flex-shrink: 0;
}

.hud-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--amber);
  flex-shrink: 0;
}
.hud-status-dot.good    { background: var(--green); animation: pulse-green 2s infinite; }
.hud-status-dot.great   { background: var(--gold);  animation: pulse-gold  2s infinite; }
.hud-status-dot.warning { background: var(--amber); animation: pulse-amber 2s infinite; }
.hud-status-dot.danger  { background: var(--red);   animation: pulse-red   2s infinite; }

.hud-status-text {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-2);
}
.hud-status-text.good    { color: var(--green-text); }
.hud-status-text.great   { color: var(--gold-text); }
.hud-status-text.danger  { color: var(--red-text); }
.hud-status-text.warning { color: var(--amber-text); }

/* ══════════════════════════════════════════════════════════════
   PROGRESS BAR
   ══════════════════════════════════════════════════════════════ */
.chapter-progress {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 11px 24px;
}

.chapter-progress-inner {
  max-width: 1300px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 14px;
}

.progress-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-3);
  flex-shrink: 0;
}

.progress-dots {
  display: flex;
  align-items: center;
  gap: 5px;
  flex: 1;
}

.progress-dot {
  height: 4px;
  width: 28px;
  border-radius: 99px;
  background: var(--border);
  transition: background var(--t), width var(--t);
  flex-shrink: 0;
}
.progress-dot.completed { background: var(--brand); cursor: pointer; opacity: 0.55; }
.progress-dot.completed:hover { opacity: 1; }
.progress-dot.current   { background: var(--brand); width: 44px; }
.progress-dot.locked    { background: var(--border-2); cursor: default; }

.progress-counter {
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-3);
  flex-shrink: 0;
}

/* ══════════════════════════════════════════════════════════════
   OPENING SCREEN
   ══════════════════════════════════════════════════════════════ */
.screen-opening {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  text-align: center;
  position: relative;
  background: var(--color-white);
  overflow: hidden;
}

/* Radial blue wash behind the content */
.screen-opening::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 700px 500px at 50% 42%, rgba(30,155,255,0.08) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

/* Full-bleed background SVG */
.opening-bg-svg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.opening-glow { display: none; }

/* Content wrapper — sits above the doodle layer */
.opening-content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
}

/* ── Session badge — very first element ────────────────────── */
.opening-session-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--brand);
  color: #fff;
  font-family: var(--font-heading);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  border-radius: 99px;
  padding: 6px 18px;
  margin-bottom: 20px;
  opacity: 0;
  animation: fadeUp 0.6s 0.1s ease forwards;
}

/* ── Workshop title — the educational purpose ───────────────── */
.opening-workshop-title {
  font-family: var(--font-heading);
  font-size: clamp(28px, 4.5vw, 52px);
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: 1.1;
  color: var(--color-dark-grey);
  text-align: center;
  margin-bottom: 10px;
  opacity: 0;
  animation: fadeUp 0.7s 0.25s ease forwards;
}

/* ── One-liner case study intro ─────────────────────────────── */
.opening-case-intro {
  font-family: var(--font-body);
  font-size: 16px;
  color: var(--text-2);
  margin-bottom: 28px;
  opacity: 0;
  animation: fadeUp 0.6s 0.45s ease forwards;
}

/* ── Company block — story hook, secondary to workshop title ── */
.opening-company-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 20px;
  padding: 16px 32px;
  background: var(--sky-50);
  border: 1px solid var(--sky-100);
  border-radius: var(--r-xl);
  opacity: 0;
  animation: fadeUp 0.7s 0.6s ease forwards;
}

/* Three stat chips below the button */
.opening-stats-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 28px;
  opacity: 0;
  animation: fadeUp 0.7s 1.4s ease forwards;
}

.opening-stat-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--sky-50);
  border: 1px solid var(--sky-100);
  border-radius: 99px;
  padding: 6px 14px;
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 600;
  color: var(--brand-text);
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.opening-logo {
  font-family: var(--font-heading);
  font-size: clamp(28px, 4vw, 46px);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.05;
  color: var(--color-black);
  /* animation handled by parent .opening-company-block */
}

/* opening-corp sits inside .opening-company-block — remove its own anim */
.opening-corp {
  animation: none !important;
  opacity: 1 !important;
}
.opening-tagline {
  animation: none !important;
  opacity: 1 !important;
  margin-top: 6px;
}

/* The "A" in TrackMy inside the logo is sky blue — mirror that here */
.opening-logo span {
  display: block;
  color: var(--color-black);
}

.opening-corp {
  font-family: var(--font-body);
  font-size: clamp(12px, 2vw, 18px);
  font-weight: 600;
  letter-spacing: 0.3em;
  color: var(--text-2);
  text-transform: uppercase;
  margin-top: 8px;
  opacity: 0;
  animation: fadeUp 0.7s 0.4s ease forwards;
  position: relative;
  z-index: 1;
}

.opening-tagline {
  margin-top: 20px;
  font-size: 15px;
  color: var(--text-3);
  font-style: italic;
  opacity: 0;
  animation: fadeUp 0.7s 0.65s ease forwards;
  position: relative;
  z-index: 1;
}
.opening-tagline::before,
.opening-tagline::after { content: '"'; color: var(--brand); }

/* TrackMy Tech partnership line below tagline */
.opening-partner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 16px;
  opacity: 0;
  animation: fadeUp 0.7s 0.78s ease forwards;
}

.opening-partner-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-3);
}

.opening-partner img {
  height: 22px;
  width: auto;
  opacity: 0.85;
}

.opening-divider {
  width: 40px;
  height: 2px;
  background: var(--brand);
  border-radius: 99px;
  margin: 18px auto 0;
  opacity: 0;
  animation: fadeIn 0.6s 0.92s ease forwards;
}

.btn-start {
  margin-top: 24px;
  opacity: 0;
  animation: fadeUp 0.7s 1.0s ease forwards;
}

/* ── Intro Narrative ─────────────────────────────────────────── */
.screen-intro {
  min-height: 100vh;
  background: var(--color-white);
  position: relative;
  overflow: hidden;
}

/* ── Two-panel full-viewport layout ──────────────────────────── */
.briefing-layout {
  display: grid;
  grid-template-columns: 360px 1fr;
  min-height: 100vh;
}

/* LEFT: dark navy panel */
.briefing-left {
  background: #0F1827;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 36px;
  position: relative;
  overflow: hidden;
}

/* Subtle diagonal lines on dark panel */
.briefing-left::before {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    -45deg,
    transparent,
    transparent 20px,
    rgba(30,155,255,0.03) 20px,
    rgba(30,155,255,0.03) 21px
  );
  pointer-events: none;
}

.briefing-left-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  position: relative;
  z-index: 1;
  animation: fadeUp 0.6s 0.2s ease both;
}

.briefing-company-name {
  font-family: var(--font-heading);
  font-size: 20px;
  font-weight: 800;
  color: #ffffff;
  text-align: center;
  line-height: 1.25;
  letter-spacing: -0.02em;
  border-bottom: 1px solid rgba(255,255,255,0.15);
  padding-bottom: 20px;
  width: 100%;
}

.briefing-py-wrap {
  filter: drop-shadow(0 4px 24px rgba(30,155,255,0.25));
}

.briefing-balance-card {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: var(--r-lg);
  padding: 18px 24px;
  text-align: center;
  width: 100%;
  backdrop-filter: blur(8px);
}

.briefing-balance-label {
  font-family: var(--font-heading);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.5);
  margin-bottom: 6px;
}

.briefing-balance-amount {
  font-family: var(--font-mono);
  font-size: 32px;
  font-weight: 700;
  color: #34d399;
  letter-spacing: -0.02em;
}

.briefing-balance-note {
  font-family: var(--font-body);
  font-size: 11px;
  color: rgba(255,255,255,0.35);
  margin-top: 6px;
}

/* RIGHT: white narrative panel */
.briefing-right {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 64px 72px;
  background: var(--color-white);
  gap: 20px;
  animation: fadeUp 0.6s 0.35s ease both;
}

.briefing-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-heading);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--brand);
  margin-bottom: 4px;
}

.briefing-headline {
  font-family: var(--font-heading);
  font-size: clamp(48px, 6vw, 76px);
  font-weight: 800;
  letter-spacing: -0.04em;
  color: var(--color-black);
  line-height: 1.0;
  margin: 0;
}

.briefing-body {
  font-family: var(--font-body);
  font-size: 18px;
  color: var(--text-2);
  line-height: 1.65;
  max-width: 520px;
}

/* Alert cards */
.briefing-alert {
  display: flex;
  align-items: center;
  gap: 12px;
  border-radius: var(--r-md);
  padding: 14px 18px;
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 600;
  max-width: 520px;
}
.briefing-alert i { font-size: 20px !important; flex-shrink: 0; }

.briefing-amber {
  background: #FFFBEB;
  border: 1px solid rgba(217,119,6,0.25);
  color: #92400E;
}

.briefing-red {
  background: #FEF2F2;
  border: 1px solid rgba(220,38,38,0.25);
  color: #991B1B;
  font-size: 17px;
  padding: 16px 20px;
}

/* Bank balance row */
.briefing-bank-row {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--sky-50);
  border: 1.5px solid var(--sky-100);
  border-radius: var(--r-lg);
  padding: 16px 22px;
  max-width: 380px;
}

.briefing-bank-icon {
  width: 44px;
  height: 44px;
  background: var(--brand);
  border-radius: var(--r-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 22px !important;
  flex-shrink: 0;
}

.briefing-bank-label {
  font-family: var(--font-heading);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-3);
}

.briefing-bank-num {
  font-family: var(--font-mono);
  font-size: 26px;
  font-weight: 700;
  color: var(--green-text);
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.briefing-footer {
  font-family: var(--font-body);
  font-size: 15px;
  color: var(--text-3);
  font-style: italic;
  max-width: 420px;
}

.briefing-cta { margin-top: 4px; }

/* Responsive */
@media (max-width: 860px) {
  .briefing-layout { grid-template-columns: 1fr; }
  .briefing-left   { padding: 36px 24px; min-height: auto; }
  .briefing-left-inner { flex-direction: row; gap: 20px; flex-wrap: wrap; justify-content: center; }
  .briefing-py-wrap svg { width: 100px !important; height: 145px !important; }
  .briefing-right  { padding: 40px 28px; }
  .briefing-headline { font-size: clamp(36px, 7vw, 52px); }
}

.intro-label {
  font-family: var(--font-heading);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--brand);
  margin-bottom: 28px;
}

.intro-lines {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 40px;
}

.intro-line {
  font-size: clamp(15px, 2.2vw, 18px);
  line-height: 1.6;
  color: var(--text);
  white-space: pre-line;
  opacity: 0;
  animation: fadeUp 0.55s ease forwards;
}
.intro-line:nth-child(1) { animation-delay: 0.1s; }
.intro-line:nth-child(2) { animation-delay: 0.3s; }
.intro-line:nth-child(3) { animation-delay: 0.5s; color: var(--text-2); }
.intro-line:nth-child(4) { animation-delay: 0.7s; color: var(--red-text); font-weight: 600; }
.intro-line:nth-child(5) { animation-delay: 0.9s; font-size: 22px; font-weight: 700; font-family: var(--font-heading); color: var(--color-black); }
.intro-line:nth-child(6) { animation-delay: 1.1s; color: var(--text-2); }

.intro-btn-wrap {
  opacity: 0;
  animation: fadeUp 0.55s 1.5s ease forwards;
}

/* ══════════════════════════════════════════════════════════════
   CHAPTER LAYOUT
   ══════════════════════════════════════════════════════════════ */
/* ══════════════════════════════════════════════════════════════
   CHAPTER PAGE — two-panel layout (sidebar + main)
   ══════════════════════════════════════════════════════════════ */

.chapter-page {
  display: grid;
  grid-template-columns: 270px 1fr;
  min-height: calc(100vh - 94px); /* viewport minus HUD (56) + progress (38) */
  align-items: stretch;
}

/* ── Sidebar: dark navy, sticky ───────────────────────────── */
.chapter-sidebar {
  background: #0F1827;
  position: sticky;
  top: 94px;
  height: calc(100vh - 94px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-right: 1px solid rgba(255,255,255,0.06);
  /* accent colour from chapter via CSS variable */
  border-top: 3px solid var(--accent, #1E9BFF);
}

/* Diagonal stripes on sidebar background */
.chapter-sidebar::after {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    -45deg,
    transparent,
    transparent 20px,
    rgba(255,255,255,0.015) 20px,
    rgba(255,255,255,0.015) 21px
  );
  pointer-events: none;
}

/* Big decorative chapter number */
.sidebar-num-bg {
  position: absolute;
  bottom: -16px;
  right: -10px;
  font-family: var(--font-heading);
  font-size: 140px;
  font-weight: 900;
  color: rgba(255,255,255,0.04);
  line-height: 1;
  pointer-events: none;
  user-select: none;
  letter-spacing: -0.05em;
}

.sidebar-inner {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 28px 22px;
  height: 100%;
}

.sidebar-kicker {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-heading);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent, #1E9BFF);
}

.sidebar-title {
  font-family: var(--font-heading);
  font-size: clamp(20px, 2.2vw, 28px);
  font-weight: 800;
  letter-spacing: -0.025em;
  color: #ffffff;
  line-height: 1.15;
  margin: 0;
}

.sidebar-concept-wrap {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--r-md);
  padding: 10px 14px;
}

.sidebar-concept-label {
  font-family: var(--font-heading);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.4);
  margin-bottom: 4px;
}

.sidebar-concept-text {
  font-family: var(--font-body);
  font-size: 13px;
  color: rgba(255,255,255,0.8);
  font-weight: 500;
}

.sidebar-py-wrap {
  display: flex;
  justify-content: center;
  flex: 1;
  align-items: center;
  filter: drop-shadow(0 4px 16px rgba(30,155,255,0.2));
}

/* Progress dots at bottom */
.sidebar-dots {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  margin-top: auto;
}

.sidebar-dot {
  width: 20px;
  height: 4px;
  border-radius: 99px;
  background: rgba(255,255,255,0.15);
  transition: background var(--t);
}
.sidebar-dot.done   { background: var(--accent, #1E9BFF); opacity: 0.55; }
.sidebar-dot.active { background: var(--accent, #1E9BFF); width: 32px; }

.sidebar-counter {
  font-family: var(--font-mono);
  font-size: 12px;
  color: rgba(255,255,255,0.35);
  text-align: right;
  padding-top: 6px;
}

/* ── Chapter main: scrollable right area ─────────────────── */
.chapter-main {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 94px);
  background: var(--color-soft-white);
}

/* Story + editor side by side inside main */
.chapter-body {
  display: grid;
  grid-template-columns: 1fr 1.35fr;
  gap: 0;
  flex: 1;
  align-items: start;
}

.chapter-body.body-intro {
  grid-template-columns: 1fr;
}

/* Story panel gets padding */
.story-panel {
  padding: 32px 24px 32px 32px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  border-right: 1px solid var(--border);
  min-height: 100%;
}

/* Editor panel gets its own padding */
.editor-panel {
  padding: 32px 32px 32px 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: sticky;
  top: 94px;
}

/* Chapter nav sits below the body */
.chapter-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 32px;
  border-top: 1px solid var(--border);
  background: var(--color-white);
}

/* ── Old classes still used in rendering ─────────────────── */
.chapter-concept-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--sky-50);
  border: 1px solid var(--sky-100);
  border-radius: var(--r-sm);
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 600;
  color: var(--brand-text);
}

/* Responsive */
@media (max-width: 1024px) {
  .chapter-page { grid-template-columns: 220px 1fr; }
  .sidebar-title { font-size: 20px; }
}
@media (max-width: 800px) {
  .chapter-page   { grid-template-columns: 1fr; }
  .chapter-sidebar { position: static; height: auto; min-height: 0; border-top: 3px solid var(--accent, #1E9BFF); }
  .sidebar-num-bg  { font-size: 80px; }
  .chapter-body    { grid-template-columns: 1fr; }
  .story-panel     { padding: 24px 20px; border-right: none; border-bottom: 1px solid var(--border); }
  .editor-panel    { padding: 24px 20px; position: static; }
  .chapter-nav     { padding: 16px 20px; }
}

/* ══════════════════════════════════════════════════════════════
   STORY PANEL
   ══════════════════════════════════════════════════════════════ */
.story-panel { display: flex; flex-direction: column; gap: 12px; }

.block-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 20px 22px;
  box-shadow: var(--shadow);
}

.block-narrative {
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.85;
  color: var(--text);
  white-space: pre-line;
}

/* Stat block */
.block-stat-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 12px;
}

.stat-items { display: flex; flex-direction: column; gap: 5px; }

.stat-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 11px;
  background: var(--bg-card-2);
  border-radius: var(--r-sm);
  border: 1px solid var(--border-2);
}

.stat-item-label { font-size: 13px; color: var(--text-2); }

.stat-item-value {
  font-size: 13px;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--text);
}
.stat-item-value.green    { color: var(--green-text); }
.stat-item-value.red      { color: var(--red-text); }
.stat-item-value.red-bold { color: var(--red-text); font-size: 14px; }
.stat-item-value.amber    { color: var(--amber-text); }
.stat-item-value.neutral  { color: var(--text-2); }

/* Concept badge block */
.block-concept {
  background: var(--sky-50);
  border-color: var(--sky-100);
}

.concept-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--brand-text);
  margin-bottom: 7px;
  display: flex;
  align-items: center;
  gap: 5px;
}

.concept-text {
  font-size: 14px;
  color: var(--text-2);
  line-height: 1.65;
  margin-bottom: 10px;
}

.concept-example {
  background: var(--bg-code);
  border: 1px solid var(--border-code);
  border-radius: var(--r-sm);
  padding: 11px 14px;
  margin: 0;
  overflow-x: auto;
}
.concept-example code {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--brand-text);
  white-space: pre;
  line-height: 1.6;
}

/* System message block */
.block-system {
  background: var(--sky-50);
  border-color: var(--sky-100);
}
.block-system-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--brand);
  margin-bottom: 7px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.block-system-text {
  font-size: 13px;
  color: var(--text-2);
  white-space: pre-line;
  line-height: 1.7;
}

/* Question block */
.question-block {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--brand);
  border-radius: var(--r-md);
  padding: 18px 20px;
  box-shadow: var(--shadow);
}
.question-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--brand);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 5px;
}
.question-text {
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: 500;
  color: var(--color-dark-grey);
  line-height: 1.65;
}

/* Intro challenge */
.intro-challenge {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 28px;
  text-align: center;
  box-shadow: var(--shadow);
}
.intro-challenge-message {
  font-size: 15px;
  color: var(--text-2);
  white-space: pre-line;
  line-height: 1.8;
  margin-bottom: 24px;
}

/* Success block */
.success-block {
  border-radius: var(--r-lg);
  padding: 20px 22px;
  animation: successIn 0.4s cubic-bezier(0.22, 1, 0.36, 1);
  border: 1px solid;
}
.success-block.green  { background: var(--green-bg);  border-color: rgba(22,163,74,0.25);  color: var(--green-text); }
.success-block.danger { background: var(--red-bg);    border-color: rgba(220,38,38,0.3);   color: var(--red-text); }
.success-block.amber  { background: var(--amber-bg);  border-color: rgba(217,119,6,0.25);  color: var(--amber-text); }
.success-block.purple { background: var(--purple-bg); border-color: rgba(109,40,217,0.2);  color: var(--purple-text); }
.success-block.cyan   { background: var(--cyan-bg);   border-color: rgba(8,145,178,0.25);  color: var(--cyan-text); }
.success-block.orange { background: var(--orange-bg); border-color: rgba(234,88,12,0.25);  color: var(--orange-text); }
.success-block.gold   { background: var(--gold-bg);   border-color: rgba(202,138,4,0.3);   color: var(--gold-text); }

.success-header {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 10px;
}

.success-check-icon { font-size: 20px !important; flex-shrink: 0; }

.success-title {
  font-family: var(--font-heading);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.success-message {
  font-size: 15px;
  line-height: 1.78;
  margin-bottom: 12px;
  white-space: pre-line;
}

.success-footer {
  font-size: 12px;
  font-style: italic;
  opacity: 0.55;
  border-top: 1px solid currentColor;
  padding-top: 9px;
}

/* ══════════════════════════════════════════════════════════════
   EDITOR PANEL
   ══════════════════════════════════════════════════════════════ */
.editor-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: sticky;
  top: 80px;
}

.editor-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

.editor-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 14px;
  background: var(--bg-code);
  border-bottom: 1px solid var(--border-code);
  gap: 10px;
}

.editor-dots { display: flex; gap: 5px; flex-shrink: 0; }
.editor-dot  { width: 11px; height: 11px; border-radius: 50%; }
.editor-dot.red   { background: #FF5F57; }
.editor-dot.amber { background: #FEBC2E; }
.editor-dot.green { background: #28C840; }

.editor-filename {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-3);
  flex: 1;
  text-align: center;
}

.editor-lang {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--brand-text);
  background: var(--sky-50);
  border: 1px solid var(--sky-100);
  border-radius: 4px;
  padding: 2px 8px;
  text-transform: uppercase;
  flex-shrink: 0;
}

.editor-body { position: relative; }

.editor-gutter {
  position: absolute;
  top: 0; left: 0; bottom: 0;
  width: 40px;
  background: var(--bg-code);
  border-right: 1px solid var(--border-code);
  pointer-events: none;
  display: flex;
  flex-direction: column;
  padding: 14px 0;
  overflow: hidden;
}

.editor-line-num {
  font-family: var(--font-mono);
  font-size: 11px;
  color: #9AACBF;
  text-align: right;
  padding-right: 8px;
  line-height: 1.65;
  height: 1.65em;
  flex-shrink: 0;
  user-select: none;
}

.code-textarea {
  display: block;
  width: 100%;
  min-height: 300px;
  padding: 14px 14px 14px 52px;
  background: #FFFFFF;
  border: none;
  outline: none;
  resize: vertical;
  font-family: var(--font-mono);
  font-size: 15px;
  line-height: 1.65;
  color: #1F2328;
  caret-color: var(--brand);
  white-space: pre;
  overflow-x: auto;
  tab-size: 4;
}
.code-textarea::placeholder { color: var(--text-3); }
.code-textarea:focus { background: #FAFCFF; }

.editor-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 9px 14px;
  background: var(--bg-code);
  border-top: 1px solid var(--border-code);
}

.editor-spacer { flex: 1; }

.kbd-hint {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-3);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 8px;
  flex-shrink: 0;
}

/* ── Output ───────────────────────────────────────────────────── */
.output-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: border-color var(--t);
}
.output-card.has-output { border-color: rgba(22,163,74,0.3); }
.output-card.has-error  { border-color: rgba(220,38,38,0.3); }

.output-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  background: var(--bg-code);
  border-bottom: 1px solid var(--border-code);
}

.output-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-3);
}

.output-status {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.output-status.idle    { color: var(--text-3); }
.output-status.running { color: var(--amber-text); }
.output-status.success { color: var(--green-text); }
.output-status.error   { color: var(--red-text); }
.output-status.wrong   { color: var(--amber-text); }

.output-body {
  padding: 14px 16px;
  font-family: var(--font-mono);
  font-size: 15px;
  line-height: 1.65;
  min-height: 96px;
  white-space: pre-wrap;
  word-break: break-word;
  color: #1F2328;
}

.output-placeholder { color: var(--text-3); font-style: italic; font-size: 13px; }
.output-content { color: #1F2328; }
.output-content.success { color: var(--green-text); }
.output-content.error {
  color: var(--red-text);
  border-left: 3px solid var(--red);
  padding-left: 10px;
  font-size: 14px;
  line-height: 1.72;
}

.output-running {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--amber-text);
  font-size: 13px;
}

/* ── Hint ─────────────────────────────────────────────────────── */
.hint-card {
  background: var(--amber-bg);
  border: 1px solid rgba(217,119,6,0.25);
  border-radius: var(--r-md);
  padding: 14px 16px;
  animation: fadeIn 0.22s ease;
}
.hint-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 7px;
}
.hint-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--amber-text);
  display: flex;
  align-items: center;
  gap: 5px;
}
.hint-text {
  font-size: 13px;
  color: var(--amber-text);
  line-height: 1.65;
  white-space: pre-line;
}
.hint-close {
  background: none;
  border: none;
  color: var(--amber-text);
  cursor: pointer;
  line-height: 1;
  padding: 0 2px;
  opacity: 0.65;
  transition: opacity var(--t);
  display: flex;
  align-items: center;
  font-size: 16px;
}
.hint-close:hover { opacity: 1; }

/* ── Validation fail ──────────────────────────────────────────── */
.validation-fail {
  margin-top: 10px;
  padding: 10px 12px;
  background: var(--amber-bg);
  border: 1px solid rgba(217,119,6,0.2);
  border-radius: var(--r-sm);
  font-size: 13px;
  color: var(--amber-text);
  white-space: pre-wrap;
  line-height: 1.55;
}

/* ── Stdin panel ──────────────────────────────────────────────── */
.stdin-panel {
  background: var(--bg-card);
  border: 1px solid var(--sky-100);
  border-radius: var(--r-lg);
  padding: 14px 18px;
  box-shadow: var(--shadow);
}
.stdin-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}
.stdin-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--brand-text);
  display: flex;
  align-items: center;
  gap: 5px;
}
.stdin-hint { font-size: 11px; color: var(--text-3); font-style: italic; }

.input-field-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 7px;
}
.input-field-row:last-child { margin-bottom: 0; }
.input-field-label {
  font-size: 13px;
  color: var(--text-2);
  min-width: 150px;
  flex-shrink: 0;
  font-weight: 500;
}
.input-field-input {
  flex: 1;
  background: var(--bg-code);
  border: 1px solid var(--border-code);
  border-radius: var(--r-sm);
  padding: 7px 12px;
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--text);
  outline: none;
  transition: border-color var(--t);
  min-width: 0;
}
.input-field-input:focus { border-color: var(--brand); }

/* ── Runtime status badge ─────────────────────────────────────── */
.runtime-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 4px;
  background: var(--bg-card-2);
  border: 1px solid var(--border);
  color: var(--text-3);
  flex-shrink: 0;
  white-space: nowrap;
  transition: all var(--t);
}
.runtime-status-badge::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
  opacity: 0.6;
}
.runtime-status-badge.loading { color: var(--amber-text); background: var(--amber-bg); border-color: rgba(217,119,6,0.2); }
.runtime-status-badge.loading::before { animation: pulse-amber 1s infinite; }
.runtime-status-badge.ready   { color: var(--green-text); background: var(--green-bg); border-color: rgba(22,163,74,0.2); }
.runtime-status-badge.error   { color: var(--red-text);   background: var(--red-bg);   border-color: rgba(220,38,38,0.2); }

/* ══════════════════════════════════════════════════════════════
   CHAPTER NAVIGATION
   ══════════════════════════════════════════════════════════════ */
/* (grid-column removed — nav now lives in .chapter-main flex column) */
.chapter-nav-old {
  display: none; /* kept for reference */
}
.chapter-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

/* ══════════════════════════════════════════════════════════════
   BUTTONS
   ══════════════════════════════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  border: none;
  border-radius: var(--r-md);
  cursor: pointer;
  transition: all var(--t);
  white-space: nowrap;
  user-select: none;
  text-decoration: none;
}
.btn:active:not(:disabled) { transform: scale(0.97); }

/* Primary — sky blue on white */
.btn-primary {
  background: var(--brand);
  color: #fff;
  padding: 10px 20px;
  box-shadow: 0 1px 3px rgba(30,155,255,0.3);
}
.btn-primary:hover:not(:disabled) {
  background: var(--brand-dim);
  box-shadow: 0 3px 10px rgba(30,155,255,0.35);
}

.btn-lg  { font-size: 14px; padding: 12px 24px; border-radius: var(--r-lg); }
.btn-xl  {
  font-family: var(--font-heading);
  font-size: 15px;
  font-weight: 700;
  padding: 15px 40px;
  letter-spacing: 0.04em;
  border-radius: var(--r-xl);
  text-transform: uppercase;
}

/* Secondary */
.btn-secondary {
  background: var(--bg-card);
  color: var(--text-2);
  border: 1px solid var(--border);
  padding: 10px 18px;
  box-shadow: var(--shadow);
}
.btn-secondary:hover:not(:disabled) {
  background: var(--bg-card-2);
  color: var(--text);
}

/* Run code — primary action */
.btn-run {
  background: var(--brand);
  color: #fff;
  padding: 10px 20px;
  font-size: 14px;
  min-width: 140px;
  border-radius: var(--r-md);
  box-shadow: 0 1px 3px rgba(30,155,255,0.2);
}
.btn-run:hover:not(:disabled) {
  background: var(--brand-dim);
  box-shadow: 0 3px 10px rgba(30,155,255,0.3);
}
.btn-run:disabled {
  background: var(--bg-card-2);
  color: var(--text-3);
  cursor: not-allowed;
  box-shadow: none;
}
.btn-run.running {
  background: var(--amber-bg);
  color: var(--amber-text);
  border: 1px solid rgba(217,119,6,0.25);
  cursor: wait;
  box-shadow: none;
}

/* Reset */
.btn-reset {
  background: var(--bg-card);
  color: var(--text-3);
  border: 1px solid var(--border);
  padding: 9px 14px;
  font-size: 13px;
  border-radius: var(--r-md);
}
.btn-reset:hover { background: var(--bg-card-2); color: var(--text-2); }

/* Hint */
.btn-hint {
  background: var(--amber-bg);
  color: var(--amber-text);
  border: 1px solid rgba(217,119,6,0.2);
  padding: 9px 14px;
  border-radius: var(--r-md);
}
.btn-hint:hover { background: rgba(217,119,6,0.12); }

/* Continue */
.btn-continue {
  font-size: 14px;
  padding: 12px 26px;
  background: var(--bg-card-2);
  color: var(--text-3);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  cursor: not-allowed;
}
.btn-continue.enabled {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(30,155,255,0.3);
  animation: pulse-brand 2.5s infinite;
}
.btn-continue.enabled:hover {
  background: var(--brand-dim);
  box-shadow: 0 4px 14px rgba(30,155,255,0.35);
}

/* ══════════════════════════════════════════════════════════════
   SPINNER
   ══════════════════════════════════════════════════════════════ */
.spinner {
  display: inline-block;
  width: 13px;
  height: 13px;
  border: 2px solid rgba(0, 0, 0, 0.1);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.65s linear infinite;
  flex-shrink: 0;
}

/* ══════════════════════════════════════════════════════════════
   EMERGENCY STATE
   ══════════════════════════════════════════════════════════════ */
@keyframes emergency-pulse {
  0%, 100% { border-bottom-color: var(--border); }
  50%       { border-bottom-color: rgba(220,38,38,0.45); }
}
.emergency-active .hud { animation: emergency-pulse 1.5s infinite; }

/* ══════════════════════════════════════════════════════════════
   HUD FLASH ANIMATIONS
   ══════════════════════════════════════════════════════════════ */
@keyframes hudFlashGreen {
  0%   { background: rgba(22,163,74,0.14); border-radius: 4px; }
  100% { background: transparent; }
}
@keyframes hudFlashRed {
  0%   { background: rgba(220,38,38,0.14); border-radius: 4px; }
  100% { background: transparent; }
}
.hud-stat-value.flash-green { animation: hudFlashGreen 0.8s ease; }
.hud-stat-value.flash-red   { animation: hudFlashRed 0.8s ease; }

/* ══════════════════════════════════════════════════════════════
   SESSION COMPLETE
   ══════════════════════════════════════════════════════════════ */
.screen-complete {
  min-height: calc(100vh - 56px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 64px 24px;
  text-align: center;
  background: var(--color-white);
  position: relative;
  overflow: hidden;
}
.screen-complete::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 700px 500px at 50% 40%, rgba(30,155,255,0.07) 0%, transparent 65%);
  pointer-events: none;
}
.screen-complete > * { position: relative; z-index: 1; }

.complete-glow { display: none; }

.complete-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--brand-text);
  border: 1px solid var(--sky-100);
  background: var(--sky-50);
  border-radius: 99px;
  padding: 5px 16px;
  margin-bottom: 28px;
  animation: fadeUp 0.5s 0.1s ease both;
}

.complete-title {
  font-family: var(--font-heading);
  font-size: clamp(44px, 8vw, 80px);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.0;
  color: var(--color-black);
  margin-bottom: 12px;
  animation: fadeUp 0.55s 0.25s ease both;
}

.complete-subtitle {
  font-size: 16px;
  color: var(--text-3);
  font-style: italic;
  margin-bottom: 48px;
  animation: fadeUp 0.5s 0.4s ease both;
}

.complete-story {
  max-width: 520px;
  margin: 0 auto 40px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  animation: fadeUp 0.5s 0.5s ease both;
}
.complete-story p { font-size: 18px; color: var(--text-2); line-height: 1.55; }
.complete-punchline { font-size: 22px !important; font-weight: 700; font-family: var(--font-heading); color: var(--color-black) !important; }

.complete-quote {
  max-width: 480px;
  margin: 0 auto 40px;
  font-size: 15px;
  color: var(--text-3);
  font-style: italic;
  line-height: 1.9;
  white-space: pre-line;
  border-top: 1px solid var(--border);
  padding-top: 32px;
  animation: fadeUp 0.5s 0.65s ease both;
}

.complete-stats {
  display: flex;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  overflow: hidden;
  margin-bottom: 36px;
  box-shadow: var(--shadow-md);
  animation: fadeUp 0.5s 0.75s ease both;
}
.complete-stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px 28px;
  border-right: 1px solid var(--border);
  text-align: center;
}
.complete-stat:last-child { border-right: none; }
.complete-stat-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-3);
}
.complete-stat-value {
  font-size: 17px;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--text);
}
.complete-stat-value.green { color: var(--green-text); }

.complete-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 24px;
  animation: fadeUp 0.5s 0.85s ease both;
}
.complete-footnote {
  font-size: 11px;
  color: var(--text-3);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  animation: fadeUp 0.5s 0.95s ease both;
}

/* TrackMy Tech logo on completion screen */
.complete-logo {
  margin-bottom: 20px;
  animation: fadeUp 0.5s 0.0s ease both;
}
.complete-logo img { height: 26px; width: auto; opacity: 0.7; }

/* ══════════════════════════════════════════════════════════════
   ANIMATIONS
   ══════════════════════════════════════════════════════════════ */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
@keyframes successIn {
  from { opacity: 0; transform: scale(0.97) translateY(7px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
@keyframes pulse-brand {
  0%, 100% { box-shadow: 0 2px 8px rgba(30,155,255,0.3), 0 0 0 0 rgba(30,155,255,0.3); }
  50%       { box-shadow: 0 2px 8px rgba(30,155,255,0.3), 0 0 0 5px rgba(30,155,255,0); }
}
@keyframes pulse-green {
  0%, 100% { box-shadow: 0 0 0 0 rgba(22,163,74,0.45); }
  50%       { box-shadow: 0 0 0 4px rgba(22,163,74,0); }
}
@keyframes pulse-gold {
  0%, 100% { box-shadow: 0 0 0 0 rgba(202,138,4,0.45); }
  50%       { box-shadow: 0 0 0 4px rgba(202,138,4,0); }
}
@keyframes pulse-amber {
  0%, 100% { box-shadow: 0 0 0 0 rgba(217,119,6,0.5); }
  50%       { box-shadow: 0 0 0 4px rgba(217,119,6,0); }
}
@keyframes pulse-red {
  0%, 100% { box-shadow: 0 0 0 0 rgba(220,38,38,0.5); }
  50%       { box-shadow: 0 0 0 4px rgba(220,38,38,0); }
}

/* ── Focus states ─────────────────────────────────────────────── */
.btn:focus-visible,
.input-field-input:focus-visible,
.code-textarea:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

/* ── Scrollbar ────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }

/* ── Selection ────────────────────────────────────────────────── */
::selection { background: rgba(30,155,255,0.18); color: var(--text); }

/* ── Responsive ───────────────────────────────────────────────── */
@media (max-width: 900px) {
  .editor-panel { position: static !important; }
  .complete-stats { flex-direction: column; }
  .complete-stat { border-right: none; border-bottom: 1px solid var(--border); }
  .complete-stat:last-child { border-bottom: none; }
}
@media (max-width: 600px) {
  .hud-logo img { height: 22px; }
  .hud-workshop-label { display: none; }
  .hud-stat { min-width: 80px; padding: 0 10px; }
  .chapter-title { font-size: clamp(22px, 6vw, 32px); }
  .block-narrative, .question-text { font-size: 15px; }
}

/* ══════════════════════════════════════════════════════════════
   DOODLE LAYER
   Rough.js concept sketches · roughViz charts · roughNotation
   ══════════════════════════════════════════════════════════════ */

/* Doodle host containers */
.doodle-host,
.chart-host {
  background: #FDFEFF;
  border: none;
  border-radius: var(--r-lg);
  overflow: hidden;
  position: relative;
}

/* Notebook-style card wrapping the SVG sketch */
.doodle-host {
  /* Faint horizontal rule lines — notebook paper effect */
  background-image: repeating-linear-gradient(
    to bottom,
    transparent,
    transparent 27px,
    rgba(30, 155, 255, 0.07) 27px,
    rgba(30, 155, 255, 0.07) 28px
  );
  background-color: #FDFEFF;
  border: 1.5px solid var(--border);
  padding: 4px 0 4px 0;
  box-shadow: var(--shadow);
}

/* Label strip above doodle */
.doodle-host::before {
  content: "concept sketch";
  display: block;
  font-family: 'Caveat', cursive;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-sky-blue);
  padding: 6px 14px 2px;
  border-bottom: 1px dashed rgba(30, 155, 255, 0.2);
  margin-bottom: 4px;
}

/* roughViz chart container */
.chart-host {
  border: 1.5px solid var(--border);
  background: #FFFFFF;
  box-shadow: var(--shadow);
  overflow: hidden;
  min-height: 100px;
}

.chart-host::before {
  content: "data chart";
  display: block;
  font-family: 'Caveat', cursive;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-sky-blue);
  padding: 8px 14px 4px;
  border-bottom: 1px dashed rgba(30, 155, 255, 0.2);
}

/* roughViz injects a div then SVG — ensure it fills the container */
.chart-host > div,
.chart-host svg {
  display: block;
  width: 100% !important;
  max-width: 100%;
}

/* Caveat used in SVG text nodes (declared here for preload awareness) */
.doodle-caveat-preload {
  font-family: 'Caveat', cursive;
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

/* roughNotation annotation colours override via CSS variable */
.rough-annotation svg {
  pointer-events: none;
}

/* ══════════════════════════════════════════════════════════════
   PY — STICK FIGURE CHARACTER
   ══════════════════════════════════════════════════════════════ */

/* Wrapper — fixed bottom-right */
#py-character {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 500;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  pointer-events: auto;
  user-select: none;
}

/* Landing mode: larger + reposition */
#py-character.py-landing {
  bottom: 48px;
  right: 72px;
}
#py-character.py-landing .py-figure {
  width: 160px;
  height: 234px;
}

/* The SVG container */
.py-figure {
  width: 110px;
  height: 160px;
  cursor: pointer;
  transition: transform 0.2s ease;
  flex-shrink: 0;
  position: relative;
}
.py-figure:hover { transform: scale(1.08); }
.py-figure:active { transform: scale(0.96); }
.py-figure svg { overflow: visible !important; }

/* Name label */
#py-label {
  font-family: 'Caveat', cursive;
  font-size: 13px;
  font-weight: 700;
  color: var(--color-muted-grey);
  margin-top: 2px;
  letter-spacing: 0.08em;
}

/* ── Speech bubble ────────────────────────────────────────────── */
.py-bubble {
  position: absolute;
  bottom: calc(100% + 8px);
  right: 0;
  background: #FFFFFF;
  border: 2px solid #111827;
  border-radius: 14px 14px 4px 14px;
  padding: 10px 14px;
  min-width: 160px;
  max-width: 240px;
  font-family: 'Caveat', cursive;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.45;
  color: #111827;
  text-align: left;
  box-shadow: 3px 3px 0 #111827;
  white-space: pre-wrap;
  word-break: break-word;
  pointer-events: none;
  z-index: 10;
}

/* Tail of bubble — pointing down-right toward the character */
.py-bubble::after {
  content: "";
  position: absolute;
  bottom: -12px;
  right: 18px;
  width: 0;
  height: 0;
  border-left: 8px solid transparent;
  border-right: 0px solid transparent;
  border-top: 12px solid #111827;
}
.py-bubble::before {
  content: "";
  position: absolute;
  bottom: -9px;
  right: 20px;
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 0px solid transparent;
  border-top: 10px solid #FFFFFF;
  z-index: 1;
}

.py-bubble-hidden {
  opacity: 0;
  transform: translateY(6px) scale(0.96);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.py-bubble-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
  transition: opacity 0.22s ease, transform 0.22s ease;
}

/* ── Pose animations ──────────────────────────────────────────── */

/* Idle: gentle sway */
@keyframes pyIdle {
  0%, 100% { transform: rotate(-1deg) translateY(0); }
  50%       { transform: rotate(1deg)  translateY(-3px); }
}
.py-anim-idle {
  animation: pyIdle 2.8s ease-in-out infinite;
  transform-origin: bottom center;
}

/* Bounce: happy */
@keyframes pyBounce {
  0%, 100% { transform: translateY(0) scale(1); }
  30%       { transform: translateY(-14px) scale(1.04); }
  60%       { transform: translateY(-5px) scale(1.02); }
}
.py-anim-bounce {
  animation: pyBounce 0.7s ease both;
  transform-origin: bottom center;
}

/* Celebrate: repeated jumping */
@keyframes pyCelebrate {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  20%       { transform: translateY(-18px) rotate(-4deg); }
  40%       { transform: translateY(0) rotate(0deg); }
  60%       { transform: translateY(-12px) rotate(3deg); }
  80%       { transform: translateY(0) rotate(0deg); }
}
.py-anim-celebrate {
  animation: pyCelebrate 0.9s ease-in-out 4;
  transform-origin: bottom center;
}

/* Shake: shocked */
@keyframes pyShake {
  0%, 100% { transform: translateX(0); }
  20%       { transform: translateX(-6px); }
  40%       { transform: translateX(6px); }
  60%       { transform: translateX(-4px); }
  80%       { transform: translateX(4px); }
}
.py-anim-shake {
  animation: pyShake 0.5s ease 2;
}

/* Droop: sad */
@keyframes pyDroop {
  0%   { transform: translateY(0); }
  100% { transform: translateY(4px); }
}
.py-anim-droop {
  animation: pyDroop 0.4s ease forwards;
  transform-origin: bottom center;
}

/* Run: quick lean */
@keyframes pyRun {
  0%   { transform: translateX(0) rotate(0); }
  30%  { transform: translateX(-8px) rotate(-8deg); }
  100% { transform: translateX(0) rotate(0); }
}
.py-anim-run {
  animation: pyRun 0.5s ease;
  transform-origin: bottom center;
}

/* ── Responsive ───────────────────────────────────────────────── */
@media (max-width: 600px) {
  .py-figure { width: 80px; height: 116px; }
  .py-bubble { font-size: 14px; min-width: 130px; max-width: 190px; }
  #py-character.py-landing { bottom: 16px; right: 16px; }
  #py-character.py-landing .py-figure { width: 110px; height: 160px; }
}

/* ══════════════════════════════════════════════════════════════
   THEORY SCREEN — animated concept slides
   ══════════════════════════════════════════════════════════════ */

.theory-page {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: calc(100vh - 56px);
}

/* ── Left sidebar ─────────────────────────────────────────── */
.theory-sidebar {
  background: #0F1827;
  position: sticky;
  top: 56px;
  height: calc(100vh - 56px);
  overflow: hidden;
  border-top: 3px solid var(--accent, #1E9BFF);
  display: flex;
  flex-direction: column;
}

.theory-sidebar::after {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(-45deg,transparent,transparent 20px,
    rgba(255,255,255,0.015) 20px,rgba(255,255,255,0.015) 21px);
  pointer-events: none;
}

.theory-sidebar-num-bg {
  position: absolute;
  bottom: -10px;
  right: -8px;
  font-family: var(--font-heading);
  font-size: 130px;
  font-weight: 900;
  color: rgba(255,255,255,0.04);
  line-height: 1;
  pointer-events: none;
  user-select: none;
  letter-spacing: -0.05em;
}

.theory-sidebar-inner {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 24px 20px;
  height: 100%;
}

.theory-kicker {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-heading);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent, #1E9BFF);
}

.theory-sidebar-title {
  font-family: var(--font-heading);
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.025em;
  color: #ffffff;
  line-height: 1.2;
  margin: 0;
}

.theory-concept-box {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  padding: 10px 12px;
}
.theory-concept-label {
  font-family: var(--font-heading);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.4);
  margin-bottom: 3px;
}
.theory-concept-name {
  font-family: var(--font-body);
  font-size: 12px;
  color: rgba(255,255,255,0.8);
  font-weight: 500;
}

.theory-step-dots {
  display: flex;
  gap: 6px;
  margin-top: 4px;
}
.theory-step-dot {
  width: 20px;
  height: 4px;
  border-radius: 99px;
  background: rgba(255,255,255,0.15);
  transition: background var(--t), width var(--t);
}
.theory-step-dot.active  { background: var(--accent, #1E9BFF); width: 32px; }
.theory-step-dot.done    { background: var(--accent, #1E9BFF); opacity: 0.5; }

.theory-step-counter {
  font-family: var(--font-mono);
  font-size: 11px;
  color: rgba(255,255,255,0.3);
}

.theory-sidebar-py {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  filter: drop-shadow(0 4px 16px rgba(30,155,255,0.2));
}

.theory-skip-btn {
  background: none;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 6px;
  color: rgba(255,255,255,0.4);
  font-family: var(--font-body);
  font-size: 11px;
  padding: 8px 12px;
  cursor: pointer;
  text-align: center;
  transition: all 0.15s;
  margin-top: auto;
}
.theory-skip-btn:hover {
  background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.7);
  border-color: rgba(255,255,255,0.2);
}

/* ── Right main content ───────────────────────────────────── */
.theory-main {
  background: var(--color-white);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 64px;
  min-height: calc(100vh - 56px);
}

.theory-slide {
  max-width: 680px;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 24px;
  opacity: 0;
  transform: translateX(30px);
}

.theory-slide.slide-animate-in {
  animation: theorySlideIn 0.45s cubic-bezier(0.22,1,0.36,1) forwards;
}

@keyframes theorySlideIn {
  from { opacity: 0; transform: translateX(30px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* Rough.js visual area */
.theory-visual {
  background: var(--color-soft-white);
  border: 1px solid var(--color-light-grey);
  border-radius: 12px;
  min-height: 200px;
  overflow: hidden;
  padding: 8px;
}

/* Text content */
.theory-content { display: flex; flex-direction: column; gap: 12px; }

.theory-sub {
  font-family: var(--font-heading);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent, #1E9BFF);
  min-height: 18px;
}

.theory-headline {
  font-family: var(--font-heading);
  font-size: clamp(26px, 4vw, 40px);
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--color-black);
  line-height: 1.15;
  margin: 0;
}

.theory-body {
  font-family: var(--font-body);
  font-size: 16px;
  color: var(--color-muted-grey);
  line-height: 1.75;
  white-space: pre-line;
  max-width: 560px;
}

/* Code block */
.theory-code-block {
  background: #0F1827;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}

.theory-code-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: #161e2d;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.theory-code-dots { display: flex; gap: 5px; }

.theory-code-file {
  font-family: var(--font-mono);
  font-size: 11px;
  color: rgba(255,255,255,0.3);
}

.theory-code {
  font-family: var(--font-mono);
  font-size: 16px;
  line-height: 1.7;
  color: #e2e8f0;
  padding: 18px 20px;
  margin: 0;
  white-space: pre;
  min-height: 48px;
}

/* Cursor blink while typing */
.theory-code::after {
  content: "█";
  animation: blink 1s step-end infinite;
  color: var(--accent, #1E9BFF);
  font-size: 14px;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0; }
}

/* Output block */
.theory-output-block {
  display: flex;
  align-items: stretch;
  border: 1px solid var(--color-light-grey);
  border-radius: 8px;
  overflow: hidden;
}
.theory-output-label {
  font-family: var(--font-heading);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--color-muted-grey);
  background: var(--color-soft-white);
  border-right: 1px solid var(--color-light-grey);
  padding: 10px 14px;
  display: flex;
  align-items: center;
  flex-shrink: 0;
  min-width: 80px;
}
.theory-output-text {
  font-family: var(--font-mono);
  font-size: 15px;
  color: #15803D;
  padding: 10px 16px;
  margin: 0;
  white-space: pre;
  line-height: 1.6;
  font-weight: 600;
}

/* Navigation */
.theory-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 8px;
  border-top: 1px solid var(--color-light-grey);
}

.theory-next-btn {
  font-size: 15px !important;
  padding: 13px 30px !important;
  border-radius: 10px !important;
}

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 900px) {
  .theory-page { grid-template-columns: 1fr; }
  .theory-sidebar { position: static; height: auto; }
  .theory-main { padding: 32px 24px; }
  .theory-headline { font-size: clamp(22px, 6vw, 32px); }
}

/* ══════════════════════════════════════════════════════════════
   STDIN INLINE BAR — compact, inside the editor card
   ══════════════════════════════════════════════════════════════ */
.stdin-inline-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 14px;
  background: #fffbeb;
  border-top: 1px solid rgba(217,119,6,0.15);
  border-bottom: 1px solid rgba(217,119,6,0.15);
  flex-wrap: wrap;
}

.stdin-inline-label {
  font-family: var(--font-heading) !important;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #92400e;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}

.stdin-inline-fields {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  flex: 1;
}

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

.stdin-field-label {
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 500;
  color: #92400e;
  white-space: nowrap;
}

.stdin-field-input {
  background: #ffffff;
  border: 1px solid rgba(217,119,6,0.3);
  border-radius: 4px;
  padding: 4px 10px;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  color: #111827;
  width: 80px;
  outline: none;
  transition: border-color 0.15s;
}
.stdin-field-input:focus {
  border-color: #d97706;
  box-shadow: 0 0 0 2px rgba(217,119,6,0.12);
}

/* ══════════════════════════════════════════════════════════════
   SESSION COMPLETE — two-panel, single viewport
   ══════════════════════════════════════════════════════════════ */

.complete-page {
  display: grid;
  grid-template-columns: 420px 1fr;
  height: calc(100vh - 56px); /* exact viewport minus HUD */
  overflow: hidden;           /* prevent any scrolling */
}

/* ── Left: dark celebration panel ─────────────────────────── */
.complete-left {
  background: #0F1827;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-top: 3px solid #fbbf24;
}

.complete-left::after {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(-45deg,transparent,transparent 20px,
    rgba(255,255,255,0.015) 20px,rgba(255,255,255,0.015) 21px);
  pointer-events: none;
}

.complete-left-bg-num {
  position: absolute;
  bottom: -10px;
  right: -10px;
  font-family: var(--font-heading);
  font-size: 200px;
  font-weight: 900;
  color: rgba(255,255,255,0.03);
  line-height: 1;
  pointer-events: none;
  user-select: none;
}

.complete-left-inner {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 40px 36px;
  text-align: center;
  animation: fadeUp 0.5s 0.1s ease both;
}

.complete-session-badge {
  font-family: var(--font-heading);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: #fbbf24;
  border: 1px solid rgba(251,191,36,0.3);
  background: rgba(251,191,36,0.1);
  border-radius: 99px;
  padding: 4px 14px;
}

.complete-left-title {
  font-family: var(--font-heading);
  font-size: clamp(36px, 4.5vw, 56px);
  font-weight: 900;
  letter-spacing: -0.04em;
  color: #ffffff;
  line-height: 1.05;
  margin: 0;
}

.complete-left-sub {
  font-family: var(--font-body);
  font-size: 14px;
  color: rgba(255,255,255,0.4);
  font-style: italic;
}

.complete-py-wrap {
  filter: drop-shadow(0 4px 24px rgba(251,191,36,0.2));
}

.complete-tmt-logo {
  height: 20px;
  width: auto;
  filter: invert(1);
  opacity: 0.4;
  margin-top: 8px;
}

/* ── Right: white results panel ───────────────────────────── */
.complete-right {
  background: var(--color-white);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 48px 64px;
  gap: 28px;
  animation: fadeUp 0.5s 0.25s ease both;
  overflow: hidden;
}

.complete-story-lines {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.complete-story-lines p {
  font-family: var(--font-body);
  font-size: 17px;
  color: var(--color-muted-grey);
  line-height: 1.5;
}

.complete-story-lines strong {
  color: var(--color-dark-grey);
  font-weight: 700;
}

.complete-punchline-inline {
  font-family: var(--font-heading) !important;
  font-size: 22px !important;
  font-weight: 800 !important;
  color: var(--green-text) !important;
  margin-top: 4px;
}

.complete-stats-row {
  display: flex;
  gap: 12px;
}

.complete-stat-card {
  flex: 1;
  background: var(--color-soft-white);
  border: 1px solid var(--color-light-grey);
  border-radius: 10px;
  padding: 14px 18px;
  text-align: center;
}

.complete-stat-card-label {
  font-family: var(--font-heading);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--color-muted-grey);
  margin-bottom: 6px;
}

.complete-stat-card-value {
  font-family: var(--font-mono);
  font-size: 20px;
  font-weight: 700;
  color: var(--color-dark-grey);
}
.complete-stat-card-value.green { color: var(--green-text); }

.complete-right-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.complete-right-footnote {
  font-family: var(--font-body);
  font-size: 12px;
  color: var(--color-muted-grey);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* Responsive */
@media (max-width: 900px) {
  .complete-page { grid-template-columns: 1fr; height: auto; overflow: auto; }
  .complete-left  { min-height: 300px; }
  .complete-right { padding: 36px 28px; }
}

/* ── Chapter 0 diagram host ─────────────────────────────────── */
.ch0-diagram-host {
  background: #FDFEFF;
  border: 1.5px solid var(--color-light-grey);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  /* Notebook line texture */
  background-image: repeating-linear-gradient(
    to bottom, transparent, transparent 27px,
    rgba(30, 155, 255, 0.06) 27px, rgba(30, 155, 255, 0.06) 28px
  );
}
.ch0-diagram-host::before {
  content: "company overview";
  display: block;
  font-family: 'Caveat', cursive;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-sky-blue);
  padding: 7px 14px 2px;
  border-bottom: 1px dashed rgba(30, 155, 255, 0.18);
}

/* ── Chapter 0 panel — header with button top-right ────────── */
.ch0-panel {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0 !important;
  /* Fill the chapter-main column height exactly */
  height: 100%;
  min-height: calc(100vh - 94px - 16px);
}

.ch0-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-bottom: 1px solid var(--color-light-grey);
  background: var(--color-white);
  flex-shrink: 0;
}

.ch0-header-label {
  font-family: var(--font-heading);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--color-sky-blue);
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Diagram fills all remaining space */
.ch0-diagram-host {
  flex: 1;
  min-height: 0;
  overflow: hidden;  /* no scrollbar — SVG scales to fit */
}
/* When ch0-panel is used, the story border-right creates a visual separator */
.ch0-panel.story-panel {
  border-right: 1px solid var(--color-light-grey);
}

/* ══════════════════════════════════════════════════════════════
   SESSION 2 OUTPUT DASHBOARD
   ══════════════════════════════════════════════════════════════ */

.dash-page {
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: calc(100vh - 56px);
}

/* ── Left panel ────────────────────────────────────────────── */
.dash-left {
  background: #0F1827;
  position: sticky;
  top: 56px;
  height: calc(100vh - 56px);
  overflow: hidden;
  border-top: 3px solid var(--accent, #1E9BFF);
  display: flex;
  flex-direction: column;
}

.dash-left::after {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(-45deg,transparent,transparent 20px,
    rgba(255,255,255,0.015) 20px,rgba(255,255,255,0.015) 21px);
  pointer-events: none;
}

.dash-left-bg-num {
  position: absolute;
  bottom: -10px; right: -8px;
  font-family: var(--font-heading);
  font-size: 130px; font-weight: 900;
  color: rgba(255,255,255,0.04);
  line-height: 1; pointer-events: none; user-select: none;
}

.dash-left-inner {
  position: relative; z-index: 1;
  display: flex; flex-direction: column; gap: 14px;
  padding: 24px 20px; height: 100%;
}

.dash-badge {
  display: inline-flex; align-items: center; gap: 7px;
  font-family: var(--font-heading);
  font-size: 11px; font-weight: 700;
  letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--accent, #1E9BFF);
  background: rgba(30,155,255,0.12);
  border: 1px solid rgba(30,155,255,0.25);
  border-radius: 99px; padding: 4px 12px;
}
.dash-badge i { font-size: 14px !important; color: #34d399; }

.dash-chapter-title {
  font-family: var(--font-heading);
  font-size: clamp(16px,2vw,22px); font-weight: 800;
  color: #ffffff; letter-spacing: -0.02em; margin: 0;
}

.dash-chapter-concept {
  font-family: var(--font-body);
  font-size: 12px; color: rgba(255,255,255,0.45);
  line-height: 1.5; margin: 0;
}

/* KPI grid — extracted key metrics */
.dash-kpi-grid {
  display: flex; flex-direction: column; gap: 8px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px; padding: 12px 14px;
}

.dash-kpi { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }

.dash-kpi-label {
  font-family: var(--font-body);
  font-size: 11px; color: rgba(255,255,255,0.45);
  flex: 1; min-width: 0; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
}

.dash-kpi-value {
  font-family: var(--font-mono);
  font-size: 13px; font-weight: 700;
  flex-shrink: 0;
}

.dash-py {
  display: flex; justify-content: center; align-items: center;
  flex: 1;
  filter: drop-shadow(0 4px 16px rgba(30,155,255,0.2));
}

/* ── Right panel ───────────────────────────────────────────── */
.dash-right {
  display: flex; flex-direction: column; gap: 20px;
  padding: 28px 36px 48px;
  background: var(--color-soft-white);
  overflow-y: auto;
}

.dash-right-header {
  display: flex; align-items: center;
  justify-content: space-between; gap: 16px;
  flex-shrink: 0;
}

.dash-right-tag {
  font-family: var(--font-heading);
  font-size: 11px; font-weight: 700;
  letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--accent, #1E9BFF);
  display: flex; align-items: center; gap: 6px;
}

/* Output terminal block */
.dash-output-block {
  background: #0F1827;
  border-radius: 12px; overflow: hidden;
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
  flex-shrink: 0;
}

.dash-output-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px;
  background: #161e2d;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.dash-output-label {
  font-family: var(--font-heading);
  font-size: 11px; font-weight: 700;
  letter-spacing: 0.14em; text-transform: uppercase;
  color: rgba(255,255,255,0.5);
  display: flex; align-items: center; gap: 6px;
}

.dash-output-status {
  font-family: var(--font-heading);
  font-size: 11px; font-weight: 700;
  letter-spacing: 0.1em;
  color: #34d399;
  display: flex; align-items: center; gap: 5px;
}

.dash-output-text {
  font-family: var(--font-mono);
  font-size: 15px; line-height: 1.7;
  color: #e2e8f0;
  padding: 18px 20px;
  margin: 0; white-space: pre-wrap; word-break: break-word;
}

/* Chart host */
.dash-chart-host {
  background: var(--color-white);
  border: 1px solid var(--color-light-grey);
  border-radius: 12px;
  overflow: hidden;
  min-height: 280px;
}
.dash-chart-host > div, .dash-chart-host svg {
  display: block; width: 100% !important; max-width: 100%;
}

/* Responsive */
@media (max-width: 900px) {
  .dash-page { grid-template-columns: 1fr; }
  .dash-left  { position: static; height: auto; }
  .dash-right { padding: 24px 20px; }
}
