/* ============================================================
   PROMPT ENGINEERING LAB — Design System
   ============================================================ */

/* === TOKENS === */
:root {
  --bg: #F7F6F3;
  --surface: #FFFFFF;
  --surface-soft: #F1F0EB;
  --surface-2: #F1F0EB;          /* alias of --surface-soft for legacy references */
  --surface-raised: #FFFFFF;

  --primary: #4361EE;
  --primary-dark: #3050D4;
  --primary-light: #EEF1FD;
  --primary-glow: rgba(67,97,238,0.18);

  --accent: #F77F00;
  --accent-dark: #D96E00;
  --accent-light: #FFF4E6;

  --teal: #0F9B8E;
  --teal-light: #E8F8F7;

  --success: #059669;
  --success-light: #ECFDF5;

  --danger: #DC2626;
  --danger-light: #FEF2F2;

  --text: #111827;
  --text-2: #374151;
  --muted: #6B7180;         /* 4.52:1 on --bg, 4.88:1 on white — WCAG AA ✓ */
  --muted-light: #9CA3AF;   /* decorative only — never use for text */
  --accent-accessible: #B45309; /* 4.66:1 on --bg — use for accent TEXT */

  --border: #E5E7EB;
  --border-strong: #D1D5DB;

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow: 0 4px 16px rgba(0,0,0,0.07), 0 1px 4px rgba(0,0,0,0.04);
  --shadow-md: 0 8px 32px rgba(0,0,0,0.09), 0 2px 8px rgba(0,0,0,0.04);
  --shadow-lg: 0 20px 60px rgba(0,0,0,0.11), 0 6px 20px rgba(0,0,0,0.06);
  --shadow-primary: 0 8px 28px rgba(67,97,238,0.28);

  --radius-xs: 6px;
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 9999px;

  --font: 'Inter', 'Segoe UI Variable', 'Segoe UI', system-ui, sans-serif;
}

/* === SKIP LINK (accessibility — #17) === */
.skip-link {
  position: absolute;
  top: -100%;
  left: 1rem;
  z-index: 9999;
  padding: 0.6rem 1.2rem;
  background: var(--primary);
  color: white;
  font-weight: 700;
  font-size: 0.92rem;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  text-decoration: none;
  transition: top 0.1s;
}
.skip-link:focus {
  top: 0;
  color: white;
}

/* === RESET === */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }
img { max-width: 100%; }
p { margin: 0 0 0.75rem; }
p:last-child { margin-bottom: 0; }
h1, h2, h3, h4, h5 {
  font-family: var(--font);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.025em;
  margin: 0 0 0.6rem;
  color: var(--text);
}
h1 { font-size: clamp(2rem, 4.5vw, 3.2rem); }
h2 { font-size: clamp(1.4rem, 2.5vw, 2rem); }
h3 { font-size: 1.15rem; font-weight: 700; letter-spacing: -0.015em; }
h4 { font-size: 0.97rem; font-weight: 700; }
small, .small { font-size: 0.87rem; }

/* === LAYOUT === */
.shell {
  width: min(1160px, calc(100% - 2rem));
  margin: 0 auto;
}

/* === NAV === */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(247,246,243,0.92);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid rgba(0,0,0,0.07);
}
.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 0;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 800;
  font-size: 1.05rem;
  color: var(--text);
  letter-spacing: -0.02em;
  text-decoration: none;
}
.brand:hover { color: var(--primary); }
.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-size: 1.1rem;
  background: linear-gradient(135deg, var(--primary), #7B9FFF);
  color: white;
  box-shadow: 0 4px 12px rgba(67,97,238,0.3);
  flex-shrink: 0;
}
.nav {
  display: flex;
  align-items: center;
  gap: 0.2rem;
}
.nav a {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 0.85rem;
  border-radius: var(--radius-full);
  color: var(--muted);
  font-size: 0.93rem;
  font-weight: 600;
  transition: all 0.15s ease;
}
.nav a:hover {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}
.nav a.active {
  background: var(--primary-light);
  color: var(--primary-dark);
}
.nav-icon { font-size: 1rem; line-height: 1; }
.nav-more { position: relative; }
.nav-more > summary {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .5rem .85rem;
  border-radius: var(--radius-full);
  color: var(--muted);
  font-size: .93rem;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}
.nav-more > summary::-webkit-details-marker { display: none; }
.nav-more > summary:hover,
.nav-more.active > summary,
.nav-more[open] > summary { background: var(--primary-light); color: var(--primary-dark); }
.nav-more-menu {
  position: absolute;
  top: calc(100% + .35rem);
  right: 0;
  z-index: 180;
  display: grid;
  min-width: 190px;
  padding: .4rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
}
.nav-more-menu a { padding: .6rem .7rem; border-radius: var(--radius-sm); white-space: nowrap; }
.nav-more-menu a:hover { background: var(--primary-light); }

/* === HERO === */
.hero { padding: 2rem 0 1rem; }
.hero-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 1.25rem;
  align-items: start;
}
.hero-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 2rem;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}
.hero-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(67,97,238,0.03) 0%, rgba(247,127,0,0.03) 100%);
  pointer-events: none;
}
.hero-card > * { position: relative; }

/* Homepage hero banner */
.hero-banner {
  background: linear-gradient(135deg, #1e2d78 0%, #4361EE 50%, #6B85F5 100%);
  border-radius: var(--radius-xl);
  padding: 3rem 2.5rem;
  color: white;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-primary);
  grid-column: 1 / -1;
}
.hero-banner::before {
  content: '';
  position: absolute;
  top: -60px; right: -60px;
  width: 320px; height: 320px;
  background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}
.hero-banner::after {
  content: '';
  position: absolute;
  bottom: -80px; left: 30%;
  width: 280px; height: 280px;
  background: radial-gradient(circle, rgba(247,127,0,0.22) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}
.hero-banner > * { position: relative; }
.hero-banner h1 { color: white; margin-bottom: 0.75rem; }
.hero-banner p { color: rgba(255,255,255,0.82); font-size: 1.08rem; max-width: 60ch; }
.hero-banner .eyebrow { background: rgba(255,255,255,0.18); color: rgba(255,255,255,0.95); }
.hero-banner .button { background: white; color: var(--primary); box-shadow: 0 4px 16px rgba(0,0,0,0.18); }
.hero-banner .button:hover { background: rgba(255,255,255,0.92); color: var(--primary-dark); }
.hero-banner .button-ghost { background: rgba(255,255,255,0.14); color: white; border-color: rgba(255,255,255,0.28); }
.hero-banner .button-ghost:hover { background: rgba(255,255,255,0.22); color: white; }
.hero-banner .pill { background: rgba(255,255,255,0.18); color: rgba(255,255,255,0.92); }

/* Hero stat strip inside banner */
.hero-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(255,255,255,0.18);
}
.hero-stat .value {
  font-size: 1.75rem;
  font-weight: 800;
  color: white;
  letter-spacing: -0.04em;
  line-height: 1;
}
.hero-stat .label { font-size: 0.85rem; color: rgba(255,255,255,0.7); margin-top: 0.2rem; }

/* === EYEBROW === */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.75rem;
  border-radius: var(--radius-full);
  background: var(--teal-light);
  color: var(--teal);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 0.75rem;
  display: inline-flex;
}

/* === PANELS & CARDS === */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
.card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-strong);
}
.card.is-done {
  border-color: rgba(5,150,105,0.3);
  background: linear-gradient(180deg, white 0%, rgba(5,150,105,0.025) 100%);
}
.card h3 { margin-bottom: 0; }
.card p { margin: 0; color: var(--muted); }

/* Module num badge on cards */
.card-module-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--primary-light);
  color: var(--primary);
  font-size: 0.82rem;
  font-weight: 800;
  flex-shrink: 0;
}
.card-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

/* Persona cards */
.persona-card { border-top: 3px solid var(--primary); }
.persona-card:nth-child(2) { border-top-color: var(--accent); }
.persona-card:nth-child(3) { border-top-color: var(--teal); }

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.4rem;
  box-shadow: var(--shadow-sm);
}
.stat-card .value {
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: -0.04em;
  line-height: 1;
  margin-bottom: 0.25rem;
}
.stat-card .label { color: var(--muted); font-size: 0.9rem; font-weight: 500; }

.admin-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
}

/* Quote / highlight cards */
.quote-card {
  padding: 1rem 1.25rem;
  border-left: 4px solid var(--accent);
  background: linear-gradient(135deg, rgba(247,127,0,0.04) 0%, rgba(247,127,0,0.01) 100%);
  border-radius: 0 var(--radius) var(--radius) 0;
}
.quote-card strong { color: var(--text-2); }
.quote-card--scored { border-left-color: var(--primary); }

/* Lesson note variants */
.lesson-note {
  border-left: 4px solid var(--primary);
  background: linear-gradient(135deg, rgba(67,97,238,0.04) 0%, transparent 100%);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 1rem 1.25rem;
}
.lesson-note-accent { border-left-color: var(--accent); background: linear-gradient(135deg, rgba(247,127,0,0.04) 0%, transparent 100%); }
.lesson-path { border-left-color: var(--teal); background: linear-gradient(135deg, rgba(15,155,142,0.05) 0%, transparent 100%); }
.lesson-hero-card {
  background: linear-gradient(135deg, rgba(255,255,255,0.98) 0%, rgba(238,241,253,0.5) 100%);
  border-color: rgba(67,97,238,0.15);
}

/* Feedback box */
.feedback-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
}
.feedback-box h2 { font-size: 1.1rem; margin-bottom: 0.25rem; }

/* === BUTTONS === */
.button, button.button,
.button-secondary,
.button-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  border: none;
  cursor: pointer;
  font-family: var(--font);
  font-weight: 700;
  font-size: 0.92rem;
  border-radius: var(--radius-full);
  padding: 0.62rem 1.2rem;
  transition: all 0.15s ease;
  text-decoration: none;
  white-space: nowrap;
  line-height: 1.4;
}
.button, button.button {
  background: linear-gradient(135deg, var(--primary) 0%, #6B85F5 100%);
  color: white;
  box-shadow: 0 4px 14px rgba(67,97,238,0.28);
}
.button:hover, button.button:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 22px rgba(67,97,238,0.36);
  color: white;
}
.button:active { transform: translateY(0); }

.button-secondary {
  background: var(--teal-light);
  color: var(--teal);
  border: 1px solid rgba(15,155,142,0.22);
}
.button-secondary:hover {
  background: rgba(15,155,142,0.16);
  transform: translateY(-1px);
  color: var(--teal);
}

.button-ghost {
  background: var(--surface);
  color: var(--text-2);
  border: 1px solid var(--border);
}
.button-ghost:hover {
  background: var(--surface-soft);
  border-color: var(--border-strong);
  transform: translateY(-1px);
  color: var(--text);
}

.button-danger {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--danger-light);
  color: var(--danger);
  border: 1px solid rgba(220,38,38,0.2);
  cursor: pointer;
  font-family: var(--font);
  font-weight: 700;
  font-size: 0.92rem;
  border-radius: var(--radius-full);
  padding: 0.62rem 1.2rem;
  transition: all 0.15s ease;
}
.button-danger:hover { background: rgba(220,38,38,0.12); transform: translateY(-1px); }

.btn-sm { padding: 0.42rem 0.88rem; font-size: 0.84rem; }
.btn-loading { opacity: 0.65; pointer-events: none; }

/* === FOCUS-VISIBLE RINGS (accessibility — #14) ===
   Use :focus-visible so mouse users are never shown rings,
   but keyboard / AT users always get a clear indicator. */
:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 3px;
}
/* Remove default :focus for elements we style above */
:focus:not(:focus-visible) {
  outline: none;
}
/* Buttons — pill-shaped ring to follow border-radius */
.button:focus-visible,
button.button:focus-visible,
.button-secondary:focus-visible,
.button-ghost:focus-visible,
.button-danger:focus-visible,
.button-primary:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 3px;
  box-shadow: 0 0 0 6px var(--primary-glow);
}
/* Playground action tiles */
.pg-action:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 2px;
  border-color: var(--primary);
  box-shadow: 0 0 0 5px var(--primary-glow);
}
/* Playground large action buttons */
.pg-action-btn:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 2px;
}
/* Quiz options (label elements) */
.quiz-option:focus-within {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
}
/* Nav links & brand */
.topbar a:focus-visible,
.footer a:focus-visible,
.nav-user-trigger:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 3px;
  border-radius: 4px;
}
/* Form inputs already have :focus styles; add visible ring */
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 0;
}

/* === PILLS & BADGES === */
.pill, .badge, .tag {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  border-radius: var(--radius-full);
  padding: 0.28rem 0.68rem;
  font-size: 0.81rem;
  font-weight: 700;
  background: var(--surface-soft);
  color: var(--muted);
  border: 1px solid transparent;
}
.pill.is-done, .badge.is-done { background: var(--success-light); color: var(--success); border-color: rgba(5,150,105,0.2); }
.pill.primary { background: var(--primary-light); color: var(--primary); }
.pill.accent { background: var(--accent-light); color: var(--accent-dark); }
.pill.teal { background: var(--teal-light); color: var(--teal); }
.progress-pill { background: var(--surface-soft); color: var(--muted); }
.progress-pill.is-done { background: var(--success-light); color: var(--success); }

/* === MODE SWITCH === */
.mode-switch {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1rem 0 0.5rem;
}
.mode-pill {
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  transition: all 0.15s ease;
  font-weight: 600;
  font-size: 0.87rem;
}
.mode-pill.active {
  background: var(--primary-light);
  color: var(--primary);
  border-color: rgba(67,97,238,0.25);
}
.mode-pill:hover:not(.active) { background: var(--surface-soft); color: var(--text-2); }

/* === GRIDS === */
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.stat-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.85rem; }
.split { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.hero-side { display: grid; gap: 1rem; }
.hero-side .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }

/* === SECTIONS === */
.section { padding: 1rem 0 2rem; }
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1rem;
  margin-bottom: 1.25rem;
}
.section-header > div:first-child { flex: 1; }
.section-header h2 { margin-bottom: 0; }

/* === FORMS === */
.form-group { display: grid; gap: 0.5rem; }
label { font-weight: 700; font-size: 0.93rem; color: var(--text-2); }
input, select, textarea {
  width: 100%;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  font-family: var(--font);
  font-size: 0.95rem;
  background: var(--surface);
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
  line-height: 1.5;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(67,97,238,0.12);
}
textarea { min-height: 160px; resize: vertical; line-height: 1.65; }
select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236B7280' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  padding-right: 2.5rem;
}
.textarea-wrap { position: relative; }
.char-count {
  position: absolute;
  bottom: 0.6rem;
  right: 0.85rem;
  font-size: 0.78rem;
  color: var(--muted); /* was --muted-light (2.54:1 fails); --muted = 4.88:1 ✓ */
  pointer-events: none;
  font-family: var(--font);
}
.char-count.warn { color: var(--accent-dark); } /* accent-dark has better contrast than raw accent */

/* === PLAYGROUND === */
/* Legacy grid kept for any other pages referencing it */
.playground-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 1.25rem;
  align-items: start;
}
.playground-input-panel { position: sticky; top: 76px; }

/* ════════════════════════════════════════════════════════════
   NEW Playground — full-height split layout
   ════════════════════════════════════════════════════════════ */

/* Status bar */
.pg-statusbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: .55rem 1.25rem;
  position: sticky;
  top: 64px;
  z-index: 90;
}
.pg-statusbar-inner {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  flex-wrap: wrap;
}

/* Split layout */
.pg-split {
  display: grid;
  grid-template-columns: minmax(340px, 1.05fr) minmax(340px, 1fr);
  gap: 0;
  height: calc(100vh - 110px);  /* viewport minus topbar+statusbar */
  overflow: hidden;
}

/* Left panel */
.pg-left {
  border-right: 1px solid var(--border);
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
}

/* Right panel */
.pg-right {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Override panel style inside split */
.pg-left .pg-panel {
  flex: 1;
  gap: .65rem;
}

/* ── Run button (primary CTA) ── */
.pg-run-btn {
  width: 100%;
  padding: .75rem 1rem;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  letter-spacing: .01em;
  transition: background .15s, transform .1s, box-shadow .15s;
  box-shadow: 0 2px 8px rgba(67,97,238,.25);
}
.pg-run-btn:hover {
  background: var(--primary-dark);
  box-shadow: 0 4px 16px rgba(67,97,238,.35);
}
.pg-run-btn:active { transform: scale(.98); }
.pg-run-btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.pg-run-btn.running {
  background: var(--primary-dark);
  cursor: wait;
}
.pg-run-btn.running #run-btn-icon { animation: spin .8s linear infinite; display:inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .pg-run-btn.running #run-btn-icon { animation: none; } }

/* ── Coach row (secondary actions) ── */
.pg-coach-row {
  display: flex;
  gap: .35rem;
  align-items: center;
  flex-wrap: wrap;
}
.pg-coach-label {
  font-size: .75rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  white-space: nowrap;
  margin-right: .1rem;
}
.pg-coach-btn {
  padding: .32rem .65rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-size: .8rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .12s, border-color .12s;
  white-space: nowrap;
}
.pg-coach-btn:hover {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
}
.pg-coach-btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* ── Starter chips (inside disclosure) ── */
.pg-starters-grid {
  display: flex;
  flex-direction: column;
  gap: .4rem;
  margin-top: .5rem;
}
.pg-starter-chip {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: .15rem;
  padding: .55rem .75rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  cursor: pointer;
  text-align: left;
  transition: border-color .12s, background .12s;
  font-size: .84rem;
  width: 100%;
}
.pg-starter-chip strong { font-size: .85rem; color: var(--primary); }
.pg-starter-chip span { color: var(--muted); font-size: .78rem; line-height: 1.45; }
.pg-starter-chip:hover { border-color: var(--primary); background: var(--primary-light); }

/* ── Tabs ── */
.pg-tabs {
  display: flex;
  border-bottom: 2px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
}
.pg-tab {
  flex: 1;
  padding: .7rem .5rem;
  border: none;
  background: none;
  font-size: .85rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color .15s, border-color .15s;
}
.pg-tab:hover { color: var(--text); }
.pg-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}
.pg-tab:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }

/* Tab panels */
.pg-tab-panel {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: .85rem;
}

/* ── Response idle state ── */
.pg-response-idle {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem 1.5rem;
  color: var(--muted);
  gap: .75rem;
}
.pg-response-idle-icon {
  font-size: 2.8rem;
  line-height: 1;
  opacity: .25;
}
.pg-response-idle p { margin: 0; font-size: .95rem; }

/* ── Response output ── */
.pg-response-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  margin-bottom: .5rem;
}
.pg-response-output {
  font-size: .95rem;
  line-height: 1.7;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
  padding: 1rem 1.1rem;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  min-height: 80px;
}
/* Markdown-ish formatting for AI response */
.pg-response-output p { margin: 0 0 .6em; }
.pg-response-output strong { color: var(--text); }
.pg-response-output code {
  font-family: ui-monospace, monospace;
  font-size: .88em;
  background: var(--surface-soft);
  padding: .1em .35em;
  border-radius: 4px;
}

/* Thinking animation */
.pg-response-thinking {
  display: flex;
  gap: .3rem;
  padding: .5rem 0;
  justify-content: center;
}
.pg-thinking-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--primary);
  animation: pgDotBounce 1.2s ease-in-out infinite;
}
.pg-thinking-dot:nth-child(2) { animation-delay: .2s; }
.pg-thinking-dot:nth-child(3) { animation-delay: .4s; }
@keyframes pgDotBounce {
  0%, 80%, 100% { transform: scale(0.7); opacity: .4; }
  40% { transform: scale(1); opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .pg-thinking-dot { animation: none; opacity: .6; }
}

/* ── Prompt header row ── */
.pg-prompt-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: .3rem;
}
.pg-prompt-header .pg-label { margin: 0; }

/* Shake animation when run is clicked with empty prompt */
@keyframes pgShake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}
.pg-shake { animation: pgShake .4s ease; }
@media (prefers-reduced-motion: reduce) { .pg-shake { animation: none; } }

/* Taller textarea in split layout */
.pg-left .pg-textarea-wrap textarea {
  min-height: 160px;
  resize: vertical;
}

/* ════════════════════════════════════════════════════════════
   SRS — Spaced Repetition UI
   ════════════════════════════════════════════════════════════ */
.srs-stat-pill {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: .15rem;
  padding: .5rem .85rem;
  background: var(--surface-soft);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  min-width: 70px;
}
.srs-stat-pill strong {
  font-size: 1.4rem;
  color: var(--primary);
  letter-spacing: -0.02em;
  line-height: 1;
}
.srs-stat-pill span {
  font-size: .7rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .04em;
}

.srs-box-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: .6rem;
  align-items: end;
  height: 110px;
}
.srs-box-bar {
  position: relative;
  background: var(--surface-soft);
  border-radius: var(--radius-sm);
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  overflow: hidden;
  border: 1px solid var(--border);
}
.srs-box-fill {
  background: linear-gradient(180deg, var(--primary), var(--teal));
  border-radius: 0 0 4px 4px;
  min-height: 2px;
  transition: height .4s ease;
}
.srs-box-label {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  font-size: .68rem;
  font-weight: 600;
  color: var(--text);
  padding: .25rem;
  pointer-events: none;
}
.srs-box-label small { color: var(--muted); font-weight: 500; }
.srs-box-label strong { font-size: 1.05rem; color: var(--primary); margin-top: .15rem; }

/* ════════════════════════════════════════════════════════════
   Challenge cards — rubric-scored challenges
   ════════════════════════════════════════════════════════════ */
.challenge-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.challenge-card {
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 1.1rem 1.25rem;
  transition: border-color .15s;
}
.challenge-card:hover { border-color: var(--primary); }

.challenge-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  margin-bottom: .35rem;
}

/* Difficulty pills */
.ch-difficulty-easy   { background: var(--success-light); color: #065F46; }
.ch-difficulty-medium { background: #FFFBEB; color: #92400E; }
.ch-difficulty-hard   { background: var(--danger-light);  color: #991B1B; }

/* Expandable body */
.ch-body {
  margin-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: .85rem;
}

/* Task block */
.ch-task {
  background: var(--primary-light);
  border-left: 3px solid var(--primary);
  border-radius: var(--radius-sm);
  padding: .75rem 1rem;
  font-size: .93rem;
  color: var(--text);
}
.ch-task-label {
  display: block;
  font-size: .72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--primary);
  margin-bottom: .35rem;
}
.ch-task p { margin: 0; line-height: 1.55; }

/* Rubric */
.ch-rubric { display: flex; flex-direction: column; gap: .4rem; }
.ch-rubric-label {
  font-size: .8rem;
  font-weight: 800;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-bottom: .1rem;
}
.ch-rubric-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: .35rem;
}
.ch-rubric-item {
  display: flex;
  align-items: flex-start;
  gap: .5rem;
  padding: .42rem .75rem;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .88rem;
  transition: background .15s, border-color .15s;
}
.ch-rubric-dot {
  font-size: .95rem;
  flex-shrink: 0;
  margin-top: .05rem;
  line-height: 1;
  width: 1.1rem;
  text-align: center;
}
.ch-rubric-text { flex: 1; line-height: 1.45; }
.ch-rubric-feedback {
  display: block;
  font-size: .75rem;
  color: var(--muted);
  margin-top: .25rem;
  font-style: italic;
}

/* Pass/fail states */
.ch-rubric-pass {
  background: var(--success-light);
  border-color: var(--success);
  color: #065F46;
}
.ch-rubric-pass .ch-rubric-dot { color: var(--success); font-weight: 800; }
.ch-rubric-fail {
  background: var(--danger-light);
  border-color: var(--danger);
  color: #991B1B;
}
.ch-rubric-fail .ch-rubric-dot { color: var(--danger); font-weight: 800; }

/* Challenge textarea */
.ch-textarea {
  width: 100%;
  min-height: 110px;
  font-size: .93rem;
  padding: .65rem .8rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
  resize: vertical;
  transition: border-color .15s;
  box-sizing: border-box;
}
.ch-textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

/* Result box */
.ch-result {
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  gap: .6rem;
}
.ch-result-header {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  flex-wrap: wrap;
}
.ch-result-score {
  font-size: 2rem;
  font-weight: 900;
  letter-spacing: -0.04em;
  line-height: 1;
}
.ch-result-score.score-great { color: var(--success); }
.ch-result-score.score-ok    { color: var(--accent);  }
.ch-result-score.score-low   { color: var(--danger);  }
.ch-result-bar-wrap { flex: 1; min-width: 140px; }
.ch-result-bar {
  height: 8px;
  background: var(--surface-soft);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-bottom: .4rem;
}
.ch-result-fill {
  height: 100%;
  border-radius: inherit;
  transition: width .5s cubic-bezier(.25,.46,.45,.94);
}
.ch-result-fill.fill-great { background: linear-gradient(90deg, var(--success), #34D399); }
.ch-result-fill.fill-ok    { background: linear-gradient(90deg, var(--accent), #FBBF24); }
.ch-result-fill.fill-low   { background: linear-gradient(90deg, var(--danger), #F87171); }
.ch-result-verdict {
  font-size: .88rem;
  color: var(--muted);
  line-height: 1.45;
}
.ch-result-next {
  display: flex;
  align-items: flex-start;
  gap: .4rem;
  padding: .55rem .8rem;
  background: var(--primary-light);
  border-radius: var(--radius-sm);
  font-size: .88rem;
  color: var(--text);
}
.ch-result-next strong { color: var(--primary); flex-shrink: 0; }

/* ════════════════════════════════════════════════════════════
   Compare panel — bad vs good prompts side-by-side
   ════════════════════════════════════════════════════════════ */
.examples-welcome {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1rem;
  padding: 1.15rem 1.25rem;
  border: 1.5px solid color-mix(in srgb, var(--teal) 35%, var(--border));
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, var(--teal-light) 0%, var(--surface) 100%);
}
.examples-welcome__icon {
  display: grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  flex: 0 0 2.5rem;
  border-radius: 50%;
  background: var(--surface);
  font-size: 1.35rem;
}
.examples-welcome h3 { margin: .15rem 0 .3rem; }
.examples-welcome p { margin: 0 0 .65rem; color: var(--text-2); }
.examples-welcome__items {
  display: flex;
  flex-wrap: wrap;
  gap: .45rem;
}
.examples-welcome__items span {
  padding: .4rem .65rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  background: var(--surface);
  color: var(--text-2);
  font-size: .88rem;
}
.examples-welcome__items strong { color: var(--teal); }

.examples-optional { margin-top: 1rem; padding: 0; overflow: hidden; }
.examples-optional__summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
  cursor: pointer;
  list-style: none;
  font-size: 1rem;
}
.examples-optional__summary::-webkit-details-marker { display: none; }
.examples-optional__summary small {
  display: block;
  margin-top: .2rem;
  color: var(--muted);
  font-size: .86rem;
  font-weight: 400;
}
.examples-optional__arrow { color: var(--primary); font-size: 1.3rem; }
.examples-optional[open] .examples-optional__arrow { transform: rotate(45deg); }
.examples-optional__body { padding: 0 1.25rem 1.25rem; }

.compare-panel {
  border-left: 4px solid var(--primary);
}
.compare-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
.compare-col {
  display: flex;
  flex-direction: column;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: .85rem 1rem 1rem;
  background: var(--surface);
}
.compare-col-bad   { border-top: 4px solid var(--danger); }
.compare-col-good  { border-top: 4px solid var(--success); }
.compare-col-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  margin-bottom: .55rem;
}
.compare-tag {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  padding: .2rem .55rem;
  border-radius: var(--radius-full);
  font-size: .75rem;
  font-weight: 800;
  letter-spacing: .02em;
}
.compare-tag.bad  { background: var(--danger-light);  color: #991B1B; }
.compare-tag.good { background: var(--success-light); color: #065F46; }

.compare-prompt {
  font-family: ui-monospace, monospace;
  font-size: .82rem;
  background: var(--surface-soft);
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: .55rem .75rem;
  margin: 0 0 .65rem;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.45;
  max-height: 110px;
  overflow-y: auto;
}
.compare-response-label {
  font-size: .72rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: .3rem;
}
.compare-response {
  font-size: .9rem;
  line-height: 1.6;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
  padding: .6rem .8rem;
  background: var(--bg);
  border-radius: var(--radius-sm);
  min-height: 80px;
  max-height: 320px;
  overflow-y: auto;
}

#compare-run-btn.running { cursor: wait; opacity: .7; }
#compare-run-icon { display: inline-block; margin-right: .25rem; }

.compare-takeaway {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin-top: 1rem;
  padding: .65rem 1rem;
  background: var(--primary-light);
  border-left: 3px solid var(--primary);
  border-radius: var(--radius-sm);
  font-size: .92rem;
  color: var(--text);
}
.compare-takeaway strong { color: var(--primary); }

@media (max-width: 760px) {
  .compare-grid { grid-template-columns: 1fr; }
}

/* SRS box badge on a quiz question */
.srs-box-badge {
  display: inline-block;
  font-size: .72rem;
  font-weight: 600;
  color: var(--primary);
  background: var(--primary-light);
  padding: .15rem .55rem;
  border-radius: var(--radius-full);
  margin-bottom: .55rem;
}

/* ── Responsive ── */
@media (max-width: 860px) {
  .pg-split {
    grid-template-columns: 1fr;
    height: auto;
    overflow: visible;
  }
  .pg-left {
    border-right: none;
    border-bottom: 1px solid var(--border);
    overflow: visible;
    max-height: none;
  }
  .pg-right {
    height: auto;
    min-height: 0;
  }
  .pg-statusbar { top: 56px; }
}

/* === FEEDBACK LISTS === */
.feedback-list {
  margin: 0.75rem 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.45rem;
}
.feedback-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.72rem 1rem;
  border-radius: var(--radius);
  background: var(--surface-soft);
  font-size: 0.92rem;
}
.feedback-list li.positive { background: var(--success-light); color: #065F46; border-left: 3px solid var(--success); }
.feedback-list li.negative { background: var(--danger-light); color: #991B1B; border-left: 3px solid var(--danger); }
.feedback-list li span { font-weight: 700; }

/* === PROGRESS BARS === */
.bar {
  height: 8px;
  background: var(--surface-soft);
  border-radius: var(--radius-full);
  overflow: hidden;
}
.bar > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary) 0%, var(--teal) 100%);
  transition: width 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}
.progress-bars { display: grid; gap: 1rem; }
.lesson-progress-track { width: 100%; height: 6px; border-radius: var(--radius-full); background: rgba(0,0,0,0.07); overflow: hidden; }
.lesson-progress-bar { height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--primary) 0%, #7B9FFF 100%); transition: width 0.4s ease; width: 14%; }

/* === SECTION TABS === */
.section-tab {
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  font-weight: 600;
  font-size: 0.88rem;
  transition: all 0.15s ease;
}
.section-tab.active { background: var(--primary-light); border-color: rgba(67,97,238,0.25); color: var(--primary); }
.section-tab:hover:not(.active) { background: var(--surface-soft); color: var(--text-2); }
.learning-group { animation: fadeRise 280ms ease; }
.learning-group.is-hidden { display: none; }

.course-goal-card {
  margin-top: 1rem;
  padding: .9rem 1rem;
  max-width: 46rem;
  border: 1.5px solid color-mix(in srgb, var(--primary) 28%, var(--border));
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--primary-light) 52%, var(--surface));
}
.course-goal-card__head,
.course-goal-card__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  flex-wrap: wrap;
}
.course-goal-card__head strong { display: block; }
.course-goal-card__count { color: var(--primary); font-size: 1.1rem; }
.course-goal-card__bar {
  height: .55rem;
  margin: .7rem 0;
  overflow: hidden;
  border-radius: 999px;
  background: color-mix(in srgb, var(--primary) 12%, var(--surface));
}
.course-goal-card__bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary), var(--teal));
  transition: width .3s ease;
}
.course-goal-card__foot { color: var(--text-2); font-size: .84rem; }
@media (max-width: 560px) {
  .course-goal-card__foot .button { width: 100%; text-align: center; }
}
.path-list {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.75rem;
  margin: 1rem 0;
}
.path-list article {
  padding: 0.9rem 1rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.path-list article:hover { border-color: var(--primary); box-shadow: 0 4px 12px rgba(67,97,238,0.1); }
.path-list p { margin: 0.35rem 0 0; color: var(--muted); font-size: 0.87rem; }

/* === LESSON VIEWER === */
.lesson-viewer-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
  margin-bottom: 1rem;
}
.lesson-viewer-intro {
  max-width: 48rem;
  margin: .35rem 0 0;
  font-size: 1.05rem;
  line-height: 1.65;
}
.lesson-progress-shell {
  min-width: 260px;
  max-width: 400px;
  display: grid;
  gap: 0.65rem;
  padding: 1rem 1.1rem;
  border-radius: var(--radius-lg);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
.lesson-progress-meta { display: flex; align-items: baseline; justify-content: space-between; gap: 0.75rem; }
.lesson-tabs {
  display: flex;
  gap: .6rem;
  flex-wrap: wrap;
  padding: .35rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface-soft);
}
.lesson-tab {
  border: 1.5px solid transparent;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  font-weight: 600;
  font-size: 1rem;
  white-space: nowrap;
  min-height: 3.15rem;
  padding: .65rem 1rem;
  border-radius: var(--radius);
  transition: all 0.15s ease;
  flex: 1 1 9rem;
}
.lesson-tab:hover { background: var(--surface); color: var(--text); border-color: var(--border); }
.lesson-tab.active { background: var(--accent-light); border-color: rgba(247,127,0,0.28); color: var(--accent-dark); font-weight: 700; }
.lesson-tab.is-done { background: var(--success-light); color: var(--success); border-color: rgba(5,150,105,0.2); }
.lesson-tab--secondary { flex: 0 1 auto; color: var(--text-2); font-size: .9rem; }
.lesson-step-hint {
  margin: .85rem 0 0;
  padding: .75rem 1rem;
  border-left: 4px solid var(--accent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: var(--accent-light);
  color: var(--text-2);
  font-size: 1rem;
}
.lesson-step-action {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 1rem;
  padding: 1rem 1.1rem;
  border: 1.5px solid color-mix(in srgb, var(--primary) 24%, var(--border));
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--primary-light) 45%, var(--surface));
}
.lesson-step-action div { display: grid; gap: .15rem; }
.lesson-step-action span { color: var(--text-2); font-size: .86rem; }
.lesson-step-action--inside { margin-top: 1.1rem; }
.practice-handoff { max-width: 48rem; margin-inline: auto; }
.practice-recipe { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 0; }
.practice-recipe li { display: flex; align-items: center; gap: .65rem; }
.practice-recipe li > span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 800;
}
.lesson-optional-review { margin-bottom: 1rem; }
.lesson-optional-review > summary {
  display: flex;
  justify-content: space-between;
  gap: .75rem;
  cursor: pointer;
  color: var(--text-2);
}
.lesson-optional-review > summary span { font-size: .82rem; }
.lesson-optional-review[open] > summary { margin-bottom: 1rem; }
@media (max-width: 600px) {
  .lesson-step-action .button { width: 100%; text-align: center; }
  .practice-recipe { grid-template-columns: 1fr; }
  .lesson-optional-review > summary { flex-direction: column; }
}
.lesson-view-panels { margin-top: 1rem; }
.lesson-view-pane {
  display: block;
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
  transform: translateY(8px);
  transition: max-height 320ms ease, opacity 220ms ease, transform 220ms ease;
}
.lesson-view-pane.active {
  max-height: 7200px;
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
  animation: fadeRise 280ms ease;
}
.lesson-meta, .mini-meta { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; }
.lesson-steps {
  margin: 0;
  padding-left: 1.2rem;
  display: grid;
  gap: 0.6rem;
}
.lesson-steps li {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
}
.lesson-steps-tight { gap: 0.35rem; }
.lesson-steps-tight li { background: var(--surface-soft); border: none; padding: 0.6rem 0.9rem; }
.lesson-nav {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

/* === QUIZ === */
.mini-quiz { display: grid; gap: 0.85rem; }
.quiz-question { margin: 0; font-weight: 700; font-size: 1.02rem; }
.quiz-options { display: grid; gap: 0.5rem; }
.quiz-option {
  width: 100%;
  padding: 0.8rem 1rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  font-family: var(--font);
  font-size: 0.92rem;
  transition: all 0.15s ease;
  line-height: 1.4;
}
.quiz-option:hover { border-color: var(--primary); background: var(--primary-light); }
.quiz-option.is-selected { border-color: var(--primary); background: var(--primary-light); }
.quiz-option.is-correct { border-color: var(--success); background: var(--success-light); }
.quiz-option.is-wrong { border-color: var(--danger); background: var(--danger-light); }
.quiz-feedback { margin: 0; padding: 0.75rem 1rem; border-radius: var(--radius); background: var(--surface-soft); font-size: 0.92rem; }
.quiz-feedback.positive { background: var(--success-light); color: #065F46; }
.quiz-feedback.negative { background: var(--danger-light); color: #991B1B; }

/* === NOTICES === */
.notice, .success, .danger {
  padding: 0.85rem 1.1rem;
  border-radius: var(--radius);
  font-size: 0.92rem;
  font-weight: 500;
  line-height: 1.5;
}
.notice { background: var(--accent-light); color: #92400E; border: 1px solid rgba(247,127,0,0.22); }
.success { background: var(--success-light); color: #065F46; border: 1px solid rgba(5,150,105,0.22); }
.danger { background: var(--danger-light); color: #991B1B; border: 1px solid rgba(220,38,38,0.2); }

/* === STACK / FLOW === */
.stack { display: grid; gap: 0.85rem; }
.flow-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 0.5rem; }
.flow-list li { display: flex; justify-content: space-between; gap: 1rem; padding: 0.75rem 0; border-bottom: 1px solid var(--border); font-size: 0.92rem; }
.flow-list li:last-child { border-bottom: 0; }
.flow-list span { color: var(--muted); white-space: nowrap; }
.hero-actions, .action-row, .chip-row, .template-row { display: flex; flex-wrap: wrap; gap: 0.65rem; align-items: center; }

/* === ADMIN === */
.admin-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
pre.code { margin: 0; padding: 1.1rem 1.25rem; border-radius: var(--radius); background: #12182B; color: #C9D1D9; overflow: auto; font-size: 0.87rem; line-height: 1.6; }

/* === TIMELINE === */
.timeline { display: grid; gap: 0.85rem; }

/* === BADGE GRID (progress page) === */
.badge-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.85rem;
}
.badge-item {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 1rem 1.1rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.badge-item.earned {
  border-color: rgba(5,150,105,0.35);
  background: linear-gradient(135deg, white, rgba(5,150,105,0.04));
  box-shadow: 0 4px 12px rgba(5,150,105,0.1);
}
.badge-icon { font-size: 1.75rem; line-height: 1; flex-shrink: 0; }
.badge-info strong { display: block; font-size: 0.95rem; font-weight: 700; }
.badge-info span { font-size: 0.83rem; color: var(--muted); }
.badge-item.earned .badge-info strong { color: var(--success); }

/* === TOAST === */
.toast-container { position: fixed; bottom: 1.5rem; right: 1.5rem; z-index: 9999; display: grid; gap: 0.5rem; pointer-events: none; }
.toast { background: #1e2432; color: white; padding: 0.75rem 1.1rem; border-radius: var(--radius); font-size: 0.88rem; font-weight: 600; box-shadow: var(--shadow-lg); pointer-events: auto; animation: toastIn 0.25s ease; max-width: 320px; }
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
.toast.fade-out { animation: toastOut 0.3s ease forwards; }

/* === LOADING === */
.loading-spinner { display: inline-block; width: 16px; height: 16px; border: 2px solid rgba(67,97,238,0.2); border-top-color: var(--primary); border-radius: 50%; animation: spin 0.65s linear infinite; vertical-align: middle; }

/* === MISC === */
.muted { color: var(--muted); }
small, .small { color: var(--muted); }

/* === ANIMATIONS === */
@keyframes fadeRise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px) scale(0.96); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes toastOut { from { opacity: 1; transform: translateY(0); } to { opacity: 0; transform: translateY(8px); } }
@keyframes spin { to { transform: rotate(360deg); } }

/* === RESPONSIVE === */
@media (max-width: 960px) {
  .hero-grid, .playground-grid, .split, .grid-3, .admin-grid, .path-list, .stat-grid { grid-template-columns: 1fr; }
  .topbar-inner { flex-wrap: wrap; }
  .lesson-viewer-header { flex-direction: column; }
  .lesson-progress-shell { min-width: 0; max-width: none; width: 100%; }
  .badge-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 640px) {
  .shell { width: calc(100% - 1.25rem); }
  .hero-banner { padding: 2rem 1.5rem; }
  .hero-card { padding: 1.5rem; }
  .panel { padding: 1.1rem; }
  .card { padding: 1rem; }
  .hero-actions { flex-direction: column; }
  .button, .button-secondary, .button-ghost { width: 100%; justify-content: center; }
  .mode-switch { display: grid; grid-template-columns: repeat(3, 1fr); }
  .mode-pill { justify-content: center; }
  .lesson-progress-shell .hero-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .lesson-progress-shell .button, .lesson-progress-shell .button-ghost { width: auto; }
  .nav { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
  .nav a { white-space: nowrap; }
  .playground-input-panel { position: static; }
  .badge-grid { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: repeat(3, 1fr); }
  .section-header { flex-direction: column; align-items: flex-start; }
  .hero-stats { gap: 1.25rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* ============================================================
   AUDIENCE-SPECIFIC CONTENT
   ============================================================ */

.domain-pill {
  background: linear-gradient(90deg, var(--primary) 0%, var(--teal) 100%);
  color: #fff !important;
  border: none;
  font-weight: 700;
  letter-spacing: .01em;
}

.button-secondary.is-selected {
  background: var(--success) !important;
  color: #fff !important;
  border-color: var(--success) !important;
  pointer-events: none;
  font-weight: 700;
}

/* ============================================================
   EU COOKIE CONSENT BANNER
   ============================================================ */

.cookie-banner {
  position: fixed;
  bottom: 1rem;
  left: 1rem;
  right: 1rem;
  max-width: 720px;
  margin: 0 auto;
  background: #fff;
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  padding: 1rem 1.25rem;
}

.cookie-banner-inner {
  display: flex;
  gap: 1rem;
  align-items: center;
  flex-wrap: wrap;
}

.cookie-banner-content {
  flex: 1;
  min-width: 240px;
}

.cookie-banner-content strong {
  font-size: .95rem;
  display: block;
  margin-bottom: .35rem;
}

.cookie-banner-content p {
  margin: 0;
  font-size: .85rem;
  color: var(--text-2);
  line-height: 1.5;
}

.cookie-banner-content a {
  color: var(--primary);
  font-weight: 600;
}

.cookie-banner-content code {
  background: var(--surface-soft);
  padding: 1px 4px;
  border-radius: 3px;
  font-size: .8rem;
}

.cookie-banner-actions {
  flex-shrink: 0;
}

@media (max-width: 480px) {
  .cookie-banner {
    bottom: 0;
    left: 0;
    right: 0;
    border-radius: 0;
    border-bottom: none;
  }
  .cookie-banner-inner {
    flex-direction: column;
    align-items: stretch;
  }
  .cookie-banner-actions .button-primary {
    width: 100%;
  }
}

.persona-card:has(.is-selected) {
  border: 2px solid var(--success);
  box-shadow: 0 0 0 4px var(--success-light);
}

.advanced-callout {
  background: linear-gradient(135deg, var(--primary-light) 0%, var(--teal-light) 100%);
  border-left: 4px solid var(--primary);
  padding: 1rem 1.25rem;
  border-radius: var(--radius);
}

.advanced-eyebrow {
  color: var(--primary) !important;
  font-weight: 700;
}

.advanced-list {
  margin: .25rem 0 0;
  padding-left: 1.2rem;
  font-size: .92rem;
  line-height: 1.6;
}

.advanced-list li {
  margin-bottom: .35rem;
  color: var(--text-2);
}

.advanced-list li::marker {
  color: var(--primary);
}

/* ============================================================
   PLAYGROUND — CLEAN LAYOUT (rebuilt)
   ============================================================ */

.pg-panel {
  display: flex;
  flex-direction: column;
  gap: .85rem;
  padding: 1.25rem;
}

.pg-toolbar {
  display: flex;
  gap: .5rem;
  align-items: center;
}

.pg-module-select {
  flex: 1;
  min-width: 0;
  padding: .55rem .8rem;
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: .9rem;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}

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

.pg-reset-btn {
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  cursor: pointer;
  font-size: 1.1rem;
  color: var(--muted);
  transition: color .12s, border-color .12s, transform .15s;
}

.pg-reset-btn:hover {
  color: var(--danger);
  border-color: var(--danger);
  transform: rotate(-90deg);
}

.pg-label {
  display: block;
  font-size: .9rem;
  font-weight: 700;
  color: var(--text);
  margin: .25rem 0 .35rem;
}

.pg-textarea-wrap {
  margin-bottom: .25rem;
}

.pg-textarea-wrap textarea {
  min-height: 130px;
  font-size: .95rem;
  line-height: 1.55;
}

.char-count {
  position: absolute;
  bottom: .4rem;
  right: .55rem;
  font-size: .72rem;
  color: var(--muted); /* --muted-light = 2.54:1 (fails); --muted = 4.88:1 on white ✓ */
  font-weight: 600;
  background: rgba(255,255,255,.85);
  padding: 1px 5px;
  border-radius: 4px;
  pointer-events: none;
}

.char-count.warn {
  color: var(--accent-dark); /* accent-dark on white = 4.52:1 ✓ */
}

/* Action grid — 4 equal AI actions */
.pg-action-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: .5rem;
}

.pg-action {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .25rem;
  padding: .8rem .5rem;
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
  transition: all .15s;
  font-family: inherit;
}

.pg-action:hover {
  border-color: var(--primary);
  background: var(--primary-light);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.pg-action:active {
  transform: translateY(0);
}

.pg-action.btn-loading {
  opacity: .65;
  pointer-events: none;
}

.pg-action-icon {
  font-size: 1.3rem;
  line-height: 1;
}

.pg-action-label {
  font-size: .82rem;
  font-weight: 700;
  color: var(--text);
}

@media (max-width: 480px) {
  .pg-action-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Disclosure for optional response field */
.pg-disclosure {
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  padding: .55rem .75rem;
  font-size: .85rem;
}

.pg-disclosure summary {
  cursor: pointer;
  color: var(--muted);
  font-weight: 600;
  user-select: none;
  list-style: none;
}

.pg-disclosure summary::-webkit-details-marker { display: none; }
.pg-disclosure[open] summary { color: var(--primary); }

.pg-response-input {
  width: 100%;
  min-height: 75px;
  font-size: .88rem;
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: .55rem .75rem;
  font-family: inherit;
  resize: vertical;
  box-sizing: border-box;
}

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

/* ============================================================
   PLAYGROUND — 3-STEP LAYOUT (legacy, kept for compatibility)
   ============================================================ */

/* Step rows */
.pg-step {
  display: flex;
  gap: .85rem;
  align-items: flex-start;
}

.pg-step-num {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: .78rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: .15rem;
}

.pg-step-body {
  flex: 1;
  min-width: 0;
}

.pg-step-label {
  display: block;
  font-size: .85rem;
  font-weight: 700;
  color: var(--text-2);
  margin-bottom: .4rem;
}

/* Action buttons grid */
.pg-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .5rem;
}

.pg-action-btn {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .6rem .75rem;
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
  text-align: left;
  transition: border-color .15s, background .15s, box-shadow .15s;
  width: 100%;
  font-family: inherit;
}

.pg-action-btn:hover {
  border-color: var(--primary);
  background: var(--primary-light);
  box-shadow: var(--shadow-sm);
}

.pg-action-btn:active {
  transform: scale(.98);
}

.pg-action-btn.btn-loading {
  opacity: .7;
  pointer-events: none;
}

.pg-action-icon {
  font-size: 1.25rem;
  flex-shrink: 0;
}

.pg-action-text {
  display: flex;
  flex-direction: column;
  gap: .05rem;
  min-width: 0;
}

.pg-action-text strong {
  font-size: .88rem;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
}

.pg-action-text small {
  font-size: .75rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* First button (Check prompt) spans full width */
.pg-actions .pg-action-btn:first-child {
  grid-column: 1 / -1;
  border-color: var(--primary);
  background: var(--primary-light);
}

.pg-actions .pg-action-btn:first-child:hover {
  background: var(--primary);
  color: #fff;
}

.pg-actions .pg-action-btn:first-child:hover .pg-action-text strong,
.pg-actions .pg-action-btn:first-child:hover .pg-action-text small {
  color: #fff;
}

@media (max-width: 480px) {
  .pg-actions {
    grid-template-columns: 1fr;
  }
  .pg-actions .pg-action-btn:first-child {
    grid-column: 1;
  }
}

/* ============================================================
   AUTH PAGES
   ============================================================ */

.auth-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 160px);
  padding: 2rem 1rem;
}

.auth-card {
  width: 100%;
  max-width: 400px;
  padding: 2.5rem 2rem;
  text-align: center;
}

.auth-logo {
  display: flex;
  justify-content: center;
  margin-bottom: 1rem;
}

.auth-title {
  font-size: 1.5rem;
  font-weight: 800;
  margin: 0 0 .35rem;
}

.auth-sub {
  color: var(--muted);
  font-size: .9rem;
  margin: 0 0 1.5rem;
}

.auth-form {
  text-align: left;
}

.auth-switch {
  margin: 1rem 0 0;
  font-size: .88rem;
  color: var(--muted);
}

.auth-switch a {
  color: var(--primary);
  font-weight: 600;
}

.form-label {
  display: block;
  font-size: .85rem;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: .35rem;
}

.form-input {
  display: block;
  width: 100%;
  padding: .65rem .85rem;
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-size: .95rem;
  font-family: inherit;
  background: var(--surface);
  color: var(--text);
  box-sizing: border-box;
  transition: border-color .15s, box-shadow .15s;
}

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

select.form-input {
  cursor: pointer;
}

/* ============================================================
   NOTICE VARIANTS
   ============================================================ */

.notice-error {
  background: var(--danger-light);
  border-color: var(--danger);
  color: var(--danger);
}

.notice-success {
  background: var(--success-light);
  border-color: var(--success);
  color: var(--success);
}

/* ============================================================
   NAV — USER MENU & HAMBURGER
   ============================================================ */

.nav-auth {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin-left: .75rem;
}

.nav-user-wrap {
  position: relative;
}

.nav-user-name {
  display: flex;
  align-items: center;
  gap: .4rem;
  font-size: .87rem;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  padding: .4rem .7rem;
  border-radius: var(--radius-full);
  border: 1.5px solid var(--border-strong);
  background: var(--surface);
  transition: background .15s;
  white-space: nowrap;
}

.nav-user-name:hover {
  background: var(--primary-light);
}

.nav-user-wrap {
  position: relative;
  /* Padding-bottom creates a hover-bridge so the mouse can travel
     from the trigger to the menu without leaving the hover zone. */
  padding-bottom: .35rem;
  margin-bottom: -.35rem;
}

.nav-user-menu {
  display: none !important;
  position: absolute;
  right: 0;
  top: 100%;             /* attach directly to the trigger — no visual gap */
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  min-width: 220px;
  z-index: 200;
  overflow: hidden;
  padding: .35rem 0;
  margin: 0;
  font-size: 0;
}

/* Invisible bridge that catches the mouse mid-travel between trigger and menu */
.nav-user-menu::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: -8px;
  height: 8px;
  background: transparent;
}

.nav-user-wrap:hover .nav-user-menu,
.nav-user-wrap:focus-within .nav-user-menu,
.nav-user-wrap.open .nav-user-menu {
  display: block !important;
}

.nav-user-menu a {
  display: flex !important;
  align-items: center;
  gap: .6rem;
  padding: .55rem .9rem !important;
  margin: 0 !important;
  font-size: .88rem !important;
  font-weight: 500;
  line-height: 1.25 !important;
  color: var(--text);
  text-decoration: none;
  border: 0;
  border-radius: 0;
  transition: background .12s;
  white-space: nowrap;
  background: transparent;
}

.nav-user-menu a:hover {
  background: var(--primary-light);
  text-decoration: none;
}

.nav-user-menu a + a {
  border-top: 1px solid var(--border) !important;
}

.nav-user-menu a > span:first-child {
  display: inline-flex;
  width: 18px;
  justify-content: center;
  font-size: .95rem;
  flex-shrink: 0;
}

.nav-user-menu a.signout {
  color: var(--danger) !important;
}

.nav-user-menu a.signout:hover {
  background: var(--danger-light);
}

.nav-user-menu details,
.nav-drawer details {
  margin: .25rem 0;
}

.nav-user-menu summary,
.nav-drawer summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  list-style: none;
  cursor: pointer;
  padding: .6rem .9rem;
  color: var(--muted);
  font-size: .82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.nav-user-menu summary::-webkit-details-marker,
.nav-drawer summary::-webkit-details-marker {
  display: none;
}

.nav-user-menu details[open] summary,
.nav-drawer details[open] summary {
  color: var(--text);
}

.nav-user-menu .nav-secondary-links,
.nav-drawer .nav-secondary-links {
  display: grid;
}

.nav-user-menu .nav-secondary-links a,
.nav-drawer .nav-secondary-links a {
  font-size: .85rem;
  opacity: .95;
}

/* Hamburger (mobile) */
.nav-hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: .4rem;
  margin-left: .5rem;
}

.nav-hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform .2s, opacity .2s;
}

.nav-hamburger[aria-expanded="true"] span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.nav-hamburger[aria-expanded="true"] span:nth-child(2) {
  opacity: 0;
}
.nav-hamburger[aria-expanded="true"] span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* Mobile nav drawer */
.nav-drawer {
  display: none;
  position: fixed;
  top: 56px;
  left: 0;
  right: 0;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  z-index: 150;
  padding: .75rem 0;
}

.nav-drawer.open {
  display: block;
}

.nav-drawer a {
  display: block;
  padding: .75rem 1.5rem;
  font-size: .95rem;
  font-weight: 500;
  color: var(--text);
  text-decoration: none;
  transition: background .12s;
}

.nav-drawer a:hover {
  background: var(--primary-light);
}

/* ============================================================
   WORKSHOP BANNER
   ============================================================ */

.workshop-banner {
  background: linear-gradient(90deg, #1a1a2e 0%, #4361EE 100%);
  color: #fff;
  padding: .65rem 1.5rem;
  display: flex;
  align-items: center;
  gap: .75rem;
  font-size: .88rem;
  position: sticky;
  top: 0;
  z-index: 99;
}

.workshop-banner-icon {
  font-size: 1rem;
  flex-shrink: 0;
}

.workshop-banner-text {
  flex: 1;
  min-width: 0;
}

/* ============================================================
   INSTRUCTOR DASHBOARD
   ============================================================ */

.dashboard-wrap {
  max-width: 960px;
  margin: 0 auto;
  padding: 2rem 0 4rem;
}

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

.dashboard-title {
  font-size: 1.75rem;
  font-weight: 800;
  margin: 0 0 .25rem;
}

.dashboard-sub {
  color: var(--muted);
  font-size: .9rem;
  margin: 0;
}

.dashboard-ws-card {
  padding: 1.5rem;
}

.dashboard-ws-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.dashboard-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .88rem;
}

.dashboard-table th {
  text-align: left;
  padding: .5rem .75rem;
  color: var(--muted);
  font-size: .78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  border-bottom: 1.5px solid var(--border);
}

.dashboard-table td {
  padding: .6rem .75rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

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

.dash-bar-wrap {
  display: inline-block;
  width: 60px;
  height: 6px;
  background: var(--border);
  border-radius: 99px;
  vertical-align: middle;
  margin-right: .4rem;
  overflow: hidden;
}

.dash-bar {
  height: 100%;
  background: var(--primary);
  border-radius: 99px;
  min-width: 2px;
  transition: width .4s ease;
}

/* Pill variants for dashboard */
.pill.success {
  background: var(--success-light);
  color: var(--success);
}

.pill.muted {
  background: var(--surface-soft);
  color: var(--muted);
}

/* ============================================================
   CERTIFICATE (screen view)
   ============================================================ */

.certificate {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem 4rem;
}

.cert-border {
  border: 6px double var(--text);
  border-radius: var(--radius-lg);
  padding: 3rem 3.5rem;
  max-width: 680px;
  width: 100%;
  text-align: center;
  background: var(--surface);
  position: relative;
  box-shadow: var(--shadow-lg);
}

.cert-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .5rem;
  margin-bottom: 1.5rem;
}

.cert-issuer {
  font-size: .8rem;
  color: var(--muted);
  letter-spacing: .1em;
  text-transform: uppercase;
  margin: 0;
}

.cert-headline {
  font-size: 1.8rem;
  font-weight: 800;
  margin: 0 0 .4rem;
  color: var(--text);
}

.cert-presented {
  color: var(--muted);
  font-size: .9rem;
  margin: 0 0 .2rem;
}

.cert-name {
  font-size: 1.9rem;
  font-weight: 800;
  color: var(--primary);
  margin: 0 0 1rem;
}

.cert-body {
  font-size: .95rem;
  line-height: 1.7;
  color: var(--text-2);
  margin: 0 0 1.5rem;
}

.cert-stats {
  display: flex;
  justify-content: center;
  gap: 2.5rem;
  padding: 1.25rem 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.5rem;
}

.cert-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .15rem;
}

.cert-stat-val {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--primary);
}

.cert-stat-label {
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--muted);
}

.cert-footer {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
}

.cert-sig-line {
  text-align: center;
}

.cert-sig {
  color: var(--muted-light);
  font-size: .9rem;
}

.cert-sig-label {
  font-size: .8rem;
  color: var(--muted);
  margin-top: .2rem;
}

.cert-date {
  font-size: .85rem;
  color: var(--muted);
}

.cert-seal {
  position: absolute;
  top: 1.25rem;
  right: 1.5rem;
  font-size: 2rem;
}

/* ============================================================
   EXPORT / PROGRESS REPORT (screen view)
   ============================================================ */

.export-page {
  max-width: 720px;
  margin: 0 auto;
  padding: 2rem 1rem 4rem;
}

.export-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  border-bottom: 2px solid var(--text);
  padding-bottom: 1rem;
  margin-bottom: 1.5rem;
}

.export-stats {
  display: flex;
  gap: 2rem;
  background: var(--primary-light);
  padding: 1rem 1.25rem;
  border-radius: var(--radius);
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.export-stat {
  display: flex;
  flex-direction: column;
  gap: .1rem;
}

.export-stat strong {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--primary);
}

.export-stat span {
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--muted);
}

.export-list {
  list-style: none;
  padding: 0;
  margin: 0 0 1rem;
}

.export-list li {
  padding: .4rem 0;
  border-bottom: 1px solid var(--border);
  font-size: .92rem;
}

.export-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .88rem;
}

.export-table th {
  background: var(--text);
  color: #fff;
  padding: .45rem .7rem;
  text-align: left;
  font-size: .8rem;
}

.export-table td {
  padding: .4rem .7rem;
  border-bottom: 1px solid var(--border);
}

.export-table tr:nth-child(even) td {
  background: var(--surface-soft);
}

.export-footer {
  margin-top: 2rem;
  padding-top: .75rem;
  border-top: 1px solid var(--border);
  font-size: .8rem;
  color: var(--muted-light);
  text-align: center;
}

/* ============================================================
   MOBILE LAYOUT — 480px and below
   ============================================================ */

@media (max-width: 480px) {
  /* Nav */
  .nav { display: none; }
  .nav-auth .nav-signin { display: none; }
  .nav-auth .nav-user-wrap { display: none; }
  .nav-hamburger { display: flex; }

  /* Topbar tighter */
  .topbar { padding: 0 1rem; }
  .shell { padding: 0 1rem; }

  /* Auth card full-width */
  .auth-card { padding: 1.75rem 1.25rem; }

  /* Workshop join code input */
  #code { font-size: 1rem; }

  /* Dashboard */
  .dashboard-header { flex-direction: column; }
  .dashboard-ws-header { flex-direction: column; }
  .dashboard-table { font-size: .8rem; }
  .dash-bar-wrap { width: 40px; }

  /* Certificate */
  .cert-border { padding: 1.75rem 1.25rem; }
  .cert-headline { font-size: 1.3rem; }
  .cert-name { font-size: 1.4rem; }
  .cert-stats { gap: 1.25rem; }
  .cert-stat-val { font-size: 1.2rem; }
  .cert-footer { flex-direction: column; gap: .75rem; align-items: center; }

  /* Export */
  .export-stats { gap: 1rem; }
  .export-stat strong { font-size: 1.1rem; }

  /* Hero */
  .hero-banner { padding: 2rem 1.25rem 1.5rem; }
  .hero-banner h1 { font-size: 1.6rem; }
  .hero-stats { flex-wrap: wrap; gap: .75rem; }
  .hero-stat { min-width: calc(50% - .75rem); }

  /* Lesson nav */
  .lesson-nav-buttons { flex-direction: column; }
  .lesson-nav-buttons a, .lesson-nav-buttons button { width: 100%; }

  /* Progress badges */
  .badge-grid { grid-template-columns: repeat(2, 1fr); }

  /* Touch targets */
  .button, .button-primary, .button-ghost, .button-secondary {
    min-height: 44px;
    font-size: .95rem;
  }

  .nav-label { display: none; }
}


/* ============================================================
   GAMIFICATION — XP bar, levels, badges, toasts, confetti
   ============================================================ */

/* === XP bar in nav === */
.xp-bar-wrap {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 110px;
}
.xp-level-row {
  display: flex;
  align-items: center;
  gap: .35rem;
  font-size: .78rem;
  font-weight: 700;
  color: var(--text-2);
  white-space: nowrap;
}
.xp-level-emoji { font-size: .9rem; line-height: 1; }
.xp-streak {
  margin-left: auto;
  font-size: .72rem;
  color: var(--accent-accessible); /* 4.66:1 on nav bg — WCAG AA ✓ */
  font-weight: 700;
}
.xp-track {
  height: 5px;
  background: var(--border);
  border-radius: var(--radius-full);
  overflow: hidden;
}
.xp-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary) 0%, #a78bfa 100%);
  border-radius: var(--radius-full);
  transition: width .6s cubic-bezier(.4,0,.2,1);
}

/* === XP Toast === */
.xp-toast {
  position: fixed;
  bottom: 5.5rem;
  right: 1.5rem;
  z-index: 9000;
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .55rem 1rem;
  background: linear-gradient(135deg, var(--primary) 0%, #6B85F5 100%);
  color: white;
  font-weight: 700;
  font-size: .9rem;
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-md);
  pointer-events: none;
  transform: translateY(0) scale(1);
  opacity: 1;
  transition: opacity .4s, transform .4s;
}
.xp-toast.fade-out {
  opacity: 0;
  transform: translateY(-12px) scale(.95);
}
.xp-toast-icon { font-size: 1.1rem; }

/* === Badge popup === */
.badge-popup {
  position: fixed;
  bottom: 7.5rem;
  right: 1.5rem;
  z-index: 9001;
  display: flex;
  flex-direction: column;
  gap: .25rem;
  padding: .75rem 1.1rem;
  background: var(--surface);
  border: 2px solid var(--accent);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  pointer-events: none;
  animation: badgeSlide .35s ease;
}
@keyframes badgeSlide {
  from { opacity: 0; transform: translateY(16px) scale(.9); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.badge-popup-title {
  font-size: .72rem;
  font-weight: 700;
  color: var(--accent-accessible); /* 4.66:1 on surface — WCAG AA ✓ */
  text-transform: uppercase;
  letter-spacing: .05em;
}
.badge-popup-name {
  font-size: 1rem;
  font-weight: 800;
  color: var(--text);
}
.badge-popup-icon { font-size: 1.6rem; line-height: 1; }

/* === Level-up modal === */
.levelup-modal {
  position: fixed;
  inset: 0;
  z-index: 9500;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,.55);
  backdrop-filter: blur(6px);
  animation: fadeIn .25s ease;
}
.levelup-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 2.5rem 2rem;
  text-align: center;
  max-width: 340px;
  width: 90%;
  box-shadow: var(--shadow-lg);
  animation: popIn .35s cubic-bezier(.34,1.56,.64,1);
}
@keyframes popIn {
  from { opacity: 0; transform: scale(.7); }
  to   { opacity: 1; transform: scale(1); }
}
.levelup-emoji { font-size: 3.5rem; line-height: 1; margin-bottom: .5rem; }
.levelup-title { font-size: 1.6rem; font-weight: 800; color: var(--primary); }
.levelup-subtitle { color: var(--muted); font-size: .92rem; margin-top: .25rem; }
.levelup-close {
  margin-top: 1.5rem;
  cursor: pointer;
}

/* === Confetti burst === */
.confetti-container {
  position: fixed;
  inset: 0;
  z-index: 9400;
  pointer-events: none;
  overflow: hidden;
}
.confetti-piece {
  position: absolute;
  top: -10px;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  opacity: 0;
  animation: confettiFall 1.8s ease-in forwards;
}
@keyframes confettiFall {
  0%   { opacity: 1; transform: translateY(0) rotate(0deg); }
  100% { opacity: 0; transform: translateY(100vh) rotate(720deg); }
}

/* === Quiz answer feedback rings === */
.quiz-option.flash-correct {
  animation: pulseGreen .4s ease;
}
.quiz-option.flash-wrong {
  animation: pulseRed .4s ease;
}
@keyframes pulseGreen {
  0%   { box-shadow: 0 0 0 0 rgba(5,150,105,.5); }
  70%  { box-shadow: 0 0 0 10px rgba(5,150,105,0); }
  100% { box-shadow: none; }
}
@keyframes pulseRed {
  0%   { box-shadow: 0 0 0 0 rgba(220,38,38,.4); }
  70%  { box-shadow: 0 0 0 10px rgba(220,38,38,0); }
  100% { box-shadow: none; }
}

/* === AI Explain panel === */
.explain-panel {
  margin-top: 1rem;
  padding: 1.1rem 1.3rem;
  background: var(--primary-light);
  border: 1.5px solid rgba(67,97,238,.2);
  border-radius: var(--radius);
  animation: slideDown .3s ease;
}
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.explain-panel h4 {
  font-size: .85rem;
  font-weight: 700;
  color: var(--primary-dark); /* --primary on primary-light bg = 4.46:1 (fails); --primary-dark = 6.12:1 ✓ */
  margin: 0 0 .5rem;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.explain-analogy {
  font-style: italic;
  color: var(--text-2);
  font-size: .9rem;
  margin-top: .5rem;
  padding-left: .75rem;
  border-left: 3px solid var(--primary);
}
.follow-up-panel {
  margin-top: 1rem;
  padding: .9rem 1rem;
  background: var(--surface);
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-sm);
}
.follow-up-panel h5 {
  font-size: .82rem;
  font-weight: 700;
  margin: 0 0 .5rem;
  color: var(--text-2);
}

/* === Bonus challenge panel === */
.bonus-panel {
  margin-top: 1.25rem;
  padding: 1.2rem 1.3rem;
  background: linear-gradient(135deg, #fff9f0 0%, #fffbe8 100%);
  border: 2px solid var(--accent);
  border-radius: var(--radius);
  animation: slideDown .3s ease;
}
.bonus-panel h4 {
  font-size: .85rem;
  font-weight: 800;
  color: var(--accent-dark);
  margin: 0 0 .65rem;
  display: flex;
  align-items: center;
  gap: .4rem;
}
.bonus-xp-badge {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  padding: .15rem .55rem;
  background: var(--accent);
  color: var(--text); /* dark text on orange — WCAG AA ✓ */
  font-size: .72rem;
  font-weight: 700;
  border-radius: var(--radius-full);
  margin-left: auto;
}

/* === Live prompt meter === */
.prompt-meter {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .45rem .75rem;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .82rem;
  transition: all .2s;
}
.prompt-meter-bar {
  flex: 1;
  height: 6px;
  background: var(--border);
  border-radius: var(--radius-full);
  overflow: hidden;
}
.prompt-meter-fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width .5s ease, background .3s;
}
.prompt-meter-fill.danger  { background: var(--danger); }
.prompt-meter-fill.warning { background: var(--accent); }
.prompt-meter-fill.success { background: var(--success); }
.prompt-meter-label {
  font-weight: 700;
  white-space: nowrap;
}
.prompt-meter-label.danger  { color: var(--danger); }
.prompt-meter-label.warning { color: var(--accent-dark); }
.prompt-meter-label.success { color: var(--success); }

/* === Badge grid (profile / progress page) === */
.badge-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: .75rem;
}
.badge-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .35rem;
  padding: .85rem .6rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  text-align: center;
  transition: all .15s;
  position: relative;
}
.badge-card.earned {
  border-color: var(--accent);
  background: linear-gradient(135deg, #fffbe8 0%, #fff9f0 100%);
  box-shadow: var(--shadow-sm);
}
.badge-card.locked {
  opacity: .45;
  filter: grayscale(80%);
}
.badge-card-icon { font-size: 2rem; line-height: 1; }
.badge-card-name { font-size: .78rem; font-weight: 700; color: var(--text); }
.badge-card-desc { font-size: .72rem; color: var(--muted); }
.badge-earned-tag {
  position: absolute;
  top: .35rem;
  right: .35rem;
  font-size: .6rem;
  font-weight: 700;
  padding: .1rem .35rem;
  background: var(--accent);
  color: var(--text); /* dark text on orange — WCAG AA ✓ */
  border-radius: var(--radius-full);
  text-transform: uppercase;
}

/* Responsive tweaks */
@media (max-width: 480px) {
  .xp-bar-wrap { min-width: 80px; }
  .badge-grid { grid-template-columns: repeat(2, 1fr); }
  .bonus-panel, .explain-panel { padding: .85rem .9rem; }
}

/* ============================================================
   REDUCED MOTION — respect user OS preference (WCAG 2.3.3)
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  .xp-toast,
  .xp-toast.fade-out  { transition: none !important; }
  .badge-popup        { animation: none !important; }
  .levelup-modal      { animation: none !important; }
  .levelup-card       { animation: none !important; }
  .explain-panel,
  .bonus-panel        { animation: none !important; }
  .confetti-piece     { animation: none !important; display: none; }
  .xp-fill            { transition: none !important; }
  .prompt-meter-fill  { transition: none !important; }
}

/* ============================================================
   DOCS / WIKI
   ============================================================ */

/* Layout */
.docs-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 0;
  min-height: calc(100vh - 64px);
  align-items: flex-start;
}

/* Sidebar */
.docs-sidebar {
  position: sticky;
  top: 64px;
  height: calc(100vh - 64px);
  overflow-y: auto;
  border-right: 1px solid var(--border);
  padding: 1.5rem 0;
  background: var(--surface);
  scrollbar-width: thin;
}
.docs-sidebar-inner { padding: 0 1rem; }
.docs-home-link {
  display: block;
  font-size: .82rem;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
  margin-bottom: 1.25rem;
  padding: .35rem .5rem;
  border-radius: var(--radius-sm);
}
.docs-home-link:hover { background: var(--surface-soft); color: var(--text); }
.docs-category { margin-bottom: 1.25rem; }
.docs-category-label {
  font-size: .72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  padding: 0 .5rem;
  margin-bottom: .35rem;
}
.docs-nav-link {
  display: flex;
  align-items: center;
  gap: .4rem;
  padding: .38rem .5rem;
  border-radius: var(--radius-sm);
  font-size: .85rem;
  color: var(--text-2);
  text-decoration: none;
  transition: background .12s;
  line-height: 1.35;
}
.docs-nav-link:hover { background: var(--surface-soft); color: var(--text); }
.docs-nav-link.active {
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 700;
}

/* Main content */
.docs-main {
  padding: 2.5rem 3rem 4rem;
  max-width: 780px;
}

/* Article header */
.docs-header { margin-bottom: 2rem; }
.docs-title {
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  line-height: 1.2;
  margin: .4rem 0 .6rem;
}
.docs-summary {
  font-size: 1.05rem;
  color: var(--muted);
  line-height: 1.6;
  margin: 0;
}

/* Wiki content typography */
.wiki-content { line-height: 1.75; font-size: .97rem; }
.wiki-content h2 {
  font-size: 1.25rem;
  margin: 2rem 0 .6rem;
  padding-bottom: .4rem;
  border-bottom: 1.5px solid var(--border);
  color: var(--text);
}
.wiki-content h3 { font-size: 1rem; margin: 1.2rem 0 .4rem; color: var(--text); }
.wiki-lead {
  font-size: 1.08rem;
  color: var(--text);
  line-height: 1.65;
  margin-bottom: 1.5rem;
  font-weight: 500;
}
.wiki-list { padding-left: 1.4rem; margin: .6rem 0 1rem; }
.wiki-list li { margin-bottom: .35rem; }

/* Wiki callouts */
.wiki-callout {
  padding: .9rem 1.1rem;
  border-radius: var(--radius-sm);
  border-left: 4px solid;
  margin: 1.25rem 0;
  font-size: .9rem;
  line-height: 1.55;
}
.wiki-callout-blue   { background: var(--primary-light); border-color: var(--primary); }
.wiki-callout-green  { background: var(--success-light); border-color: var(--success); }
.wiki-callout-yellow { background: var(--accent-light);  border-color: var(--accent-dark); }

/* Wiki tables */
.wiki-table {
  width: 100%;
  border-collapse: collapse;
  margin: .75rem 0 1.25rem;
  font-size: .88rem;
}
.wiki-table th {
  background: var(--surface-soft);
  padding: .55rem .85rem;
  text-align: left;
  font-weight: 700;
  border-bottom: 2px solid var(--border);
}
.wiki-table td {
  padding: .55rem .85rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.wiki-table tr:last-child td { border-bottom: none; }
.wiki-table tr:hover td { background: var(--surface-soft); }

/* Wiki steps */
.wiki-steps { padding-left: 1.4rem; margin: .6rem 0 1rem; counter-reset: none; }
.wiki-steps li { margin-bottom: .6rem; line-height: 1.55; }

/* Before/after comparison */
.wiki-before-after {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .75rem;
  margin: 1rem 0 1.5rem;
}
.wiki-before, .wiki-after {
  padding: .85rem 1rem;
  border-radius: var(--radius-sm);
  font-size: .9rem;
}
.wiki-before { background: rgba(220,38,38,.06); border: 1.5px solid rgba(220,38,38,.25); }
.wiki-after  { background: rgba(5,150,105,.06); border: 1.5px solid rgba(5,150,105,.25); }
.wiki-label  { font-size: .72rem; font-weight: 800; text-transform: uppercase;
               letter-spacing: .04em; margin-bottom: .4rem; }
.wiki-before .wiki-label { color: var(--danger); }
.wiki-after  .wiki-label { color: var(--success); }
.wiki-before p, .wiki-after p { margin: 0; line-height: 1.5; }

/* Wiki card grids (within articles) */
.wiki-cards-3 {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: .75rem;
  margin: .75rem 0 1.25rem;
}
.wiki-card {
  padding: 1rem 1rem .85rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
.wiki-card-icon { font-size: 1.75rem; line-height: 1; margin-bottom: .5rem; }
.wiki-card h3 { font-size: .9rem; margin: 0 0 .3rem; }
.wiki-card p  { font-size: .83rem; color: var(--muted); margin: 0; line-height: 1.45; }
.wiki-card a  { color: inherit; }

/* Code blocks */
.wiki-code {
  display: block;
  background: #1e1b4b;
  color: #c4b5fd;
  padding: 1rem 1.1rem;
  border-radius: var(--radius-sm);
  font-size: .83rem;
  line-height: 1.6;
  overflow-x: auto;
  margin: .75rem 0 1.25rem;
  white-space: pre;
}

/* Prev / Next */
.docs-prev-next {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1.5px solid var(--border);
}
.docs-prev-link, .docs-next-link {
  display: flex;
  flex-direction: column;
  gap: .2rem;
  padding: .85rem 1rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text);
  font-weight: 600;
  font-size: .9rem;
  transition: border-color .15s, background .15s;
}
.docs-prev-link:hover, .docs-next-link:hover {
  border-color: var(--primary);
  background: var(--primary-light);
}
.docs-next-link { text-align: right; }

/* Mobile sidebar toggle */
.docs-sidebar-toggle {
  display: none;
  position: fixed;
  bottom: 1.25rem;
  left: 1.25rem;
  z-index: 800;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: var(--radius-full);
  padding: .6rem 1.1rem;
  font-size: .85rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: var(--shadow-md);
}

@media (max-width: 860px) {
  .docs-layout { grid-template-columns: 1fr; }
  .docs-sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: 280px;
    z-index: 900;
    transform: translateX(-100%);
    transition: transform .25s ease;
    height: 100vh;
  }
  .docs-sidebar.open { transform: translateX(0); }
  .docs-sidebar-toggle { display: block; }
  .docs-main { padding: 1.5rem 1.25rem 3rem; max-width: 100%; }
  .wiki-before-after { grid-template-columns: 1fr; }
  .docs-prev-next { grid-template-columns: 1fr; }
  .docs-next-link { text-align: left; }
}

/* ════════════════════════════════════════════════════════════
   Playground writing interface — Builder & variable slots
   ════════════════════════════════════════════════════════════ */

/* ── Builder grid ─────────────────────────────────────────── */
.builder-hint {
  font-size: .82rem;
  color: var(--muted);
  margin-bottom: .75rem;
  padding: .45rem .75rem;
  background: var(--primary-light);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--primary);
}

.builder-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .55rem .75rem;
  margin-bottom: .6rem;
}

.builder-field { display: flex; flex-direction: column; gap: .2rem; }
.builder-field-full { grid-column: 1 / -1; }

.builder-label {
  font-size: .78rem;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: .3rem;
}

.builder-opt {
  font-size: .68rem;
  font-weight: 500;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .04em;
}

.builder-req {
  font-size: .68rem;
  font-weight: 700;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: .04em;
}

.builder-input {
  font-size: .88rem;
  padding: .42rem .65rem;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: var(--bg);
  color: var(--text);
  transition: border-color .15s;
}
.builder-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(67,97,238,.12);
}

.builder-preview-label {
  font-size: .73rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: .25rem;
}

/* ── Variable slots ───────────────────────────────────────── */
.var-slots-label {
  font-size: .8rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: .5rem;
  display: flex;
  align-items: center;
  gap: .35rem;
}

.var-slots-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: .5rem .75rem;
}

/* ── Mode toggle button ───────────────────────────────────── */
.pg-mode-toggle {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: .32rem .72rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-size: .82rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
  white-space: nowrap;
}
.pg-mode-toggle:hover {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
}
.pg-mode-toggle--active,
.pg-mode-toggle[aria-pressed="true"] {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}
.pg-mode-toggle:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* ── Icon button (copy, etc.) ─────────────────────────────── */
.pg-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  transition: background .15s, border-color .15s;
  flex-shrink: 0;
}
.pg-icon-btn:hover {
  background: var(--primary-light);
  border-color: var(--primary);
}
.pg-icon-btn:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* ── Keyboard shortcut hint bar ───────────────────────────── */
.pg-shortcuts-hint {
  font-size: .74rem;
  color: var(--muted);
  margin-top: .45rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .25rem .5rem;
}
.pg-shortcuts-hint kbd {
  display: inline-block;
  padding: .1rem .4rem;
  font-size: .7rem;
  font-family: ui-monospace, monospace;
  background: var(--surface);
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 4px;
  color: var(--text);
  line-height: 1.5;
  white-space: nowrap;
}

/* ── Draft restore pill tweaks ────────────────────────────── */
#draft-pill {
  animation: fadeSlideIn .25s ease;
}
@keyframes fadeSlideIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  #draft-pill { animation: none; }
}

/* ── Responsive builder ───────────────────────────────────── */
@media (max-width: 600px) {
  .builder-grid { grid-template-columns: 1fr; }
  .var-slots-grid { grid-template-columns: 1fr; }
  .pg-shortcuts-hint { display: none; }
}

/* ============================================================
   INTERACTIVE EXAMPLES GALLERY
   ============================================================ */

/* ── Panel wrapper ────────────────────────────────────────── */
.examples-gallery-panel {
  padding: 1.25rem;
}
.examples-library > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  cursor: pointer;
  color: var(--text-2);
}
.examples-library > summary span { font-size: .8rem; }
.examples-library[open] > summary { margin-bottom: 1rem; }
.examples-library__body { border-top: 1px solid var(--border); padding-top: 1rem; }
@media (max-width: 600px) {
  .examples-library > summary { align-items: flex-start; flex-direction: column; }
}
/* Learning order: understand Example 1, try another example, then practise
   changing a prompt yourself. The DOM stays accessible while the visual flow
   matches the learner's next question: "Can I see one more?" */
.lesson-view-pane[data-lesson-pane="examples"] .section {
  display: flex;
  flex-direction: column;
}
.lesson-view-pane[data-lesson-pane="examples"] .examples-gallery-panel { order: 3; }
.lesson-view-pane[data-lesson-pane="examples"] .examples-optional { order: 4; }
.lesson-view-pane[data-lesson-pane="examples"] .compare-panel { order: 2; }
.lesson-view-pane[data-lesson-pane="examples"] .examples-welcome { order: 1; }
.examples-gallery-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}
.examples-gallery-help {
  margin: .25rem 0 .35rem;
  color: var(--text-2);
  font-size: .95rem;
}
.examples-gallery-actions {
  display: flex;
  gap: .5rem;
  align-items: center;
  flex-shrink: 0;
}

/* ── Filter pills row ─────────────────────────────────────── */
.examples-filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  margin-bottom: 1rem;
}
.examples-filter {
  appearance: none;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text-2);
  font-size: .78rem;
  font-weight: 500;
  padding: .25rem .75rem;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
  line-height: 1.6;
}
.examples-filter:hover {
  border-color: var(--primary);
  color: var(--primary);
}
.examples-filter.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

/* ── Card grid ────────────────────────────────────────────── */
.examples-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: .75rem;
  align-items: start;
}
.examples-loading {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: .88rem;
  padding: .5rem 0;
}

/* ── Individual card ─────────────────────────────────────── */
.example-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color .18s, box-shadow .18s;
}
.example-card:hover,
.example-card.expanded {
  border-color: var(--primary);
  box-shadow: var(--shadow-sm);
}
.example-card.hidden {
  display: none;
}

/* ── Card header (clickable) ─────────────────────────────── */
.example-card-header {
  padding: .85rem 1rem;
  cursor: pointer;
  position: relative;
  user-select: none;
}
.example-card-header:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: -2px;
}
.example-card-meta {
  display: flex;
  align-items: center;
  gap: .4rem;
  margin-bottom: .35rem;
}
.example-cat-tag {
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--primary);
  background: var(--primary-light);
  padding: .1rem .5rem;
  border-radius: var(--radius-full);
}
.example-diff {
  font-size: .9rem;
  line-height: 1;
}
.example-card-title {
  margin: 0 0 .2rem;
  font-size: .95rem;
  font-weight: 700;
  color: var(--text);
  padding-right: 1.5rem; /* space for caret */
}
.example-card-point {
  font-size: .78rem;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.example-card-caret {
  position: absolute;
  right: 1rem;
  top: .85rem;
  font-size: .9rem;
  color: var(--muted);
  transition: transform .18s;
  pointer-events: none;
}
.example-card.expanded .example-card-caret {
  transform: none;
}

/* ── Inline expandable panel ─────────────────────────────── */
.example-inline-panel {
  max-height: 0;
  overflow: hidden;
  transition: max-height .28s ease, opacity .2s ease;
  opacity: 0;
  border-top: 0 solid transparent;
}
.example-inline-panel.open {
  max-height: 800px;
  opacity: 1;
  border-top: 1.5px solid var(--border);
}
.example-panel-inner {
  padding: .85rem 1rem 1rem;
  display: flex;
  flex-direction: column;
  gap: .65rem;
}
.ex-label {
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--muted);
}

/* ── Prompt editor in panel ──────────────────────────────── */
.example-prompt-wrap {
  display: flex;
  flex-direction: column;
  gap: .4rem;
}
.example-prompt-editor {
  width: 100%;
  box-sizing: border-box;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .55rem .75rem;
  font-size: .85rem;
  font-family: ui-monospace, "Cascadia Code", "Fira Code", monospace;
  color: var(--text);
  background: var(--bg);
  resize: vertical;
  min-height: 80px;
  transition: border-color .15s;
  line-height: 1.6;
}
.example-prompt-editor:focus {
  outline: none;
  border-color: var(--primary);
  background: var(--surface);
}
.example-prompt-actions {
  display: flex;
  gap: .45rem;
  flex-wrap: wrap;
  align-items: center;
}

/* ── Response area ────────────────────────────────────────── */
.example-response-area {
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  min-height: 48px;
  overflow: hidden;
}
.ex-response-idle {
  display: flex;
  align-items: center;
  gap: .65rem;
  flex-wrap: wrap;
  padding: .6rem .75rem;
  font-size: .85rem;
}
.ex-response-block {
  padding: .6rem .75rem;
}
.ex-response-header {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin-bottom: .4rem;
}
.ex-response-badge {
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  padding: .1rem .5rem;
  border-radius: var(--radius-full);
}
.ex-response-badge.stock {
  background: var(--surface-soft);
  color: var(--muted);
}
.ex-response-badge.live {
  background: var(--primary-light);
  color: var(--primary);
}
.ex-response-content {
  font-size: .85rem;
  line-height: 1.7;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
}
.ex-code-block {
  display: block;
  background: var(--surface-soft);
  border-radius: var(--radius-xs);
  padding: .4rem .65rem;
  font-size: .8rem;
  font-family: ui-monospace, monospace;
  margin: .35rem 0;
  overflow-x: auto;
}

/* ── Insight bar ─────────────────────────────────────────── */
.example-insight-bar {
  display: flex;
  align-items: flex-start;
  gap: .5rem;
  padding: .5rem .7rem;
  background: var(--primary-light);
  border-radius: var(--radius-xs);
  font-size: .8rem;
  color: var(--primary);
  line-height: 1.5;
}
.ex-insight-icon { flex-shrink: 0; }
.ex-insight-text { font-weight: 500; }

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 700px) {
  .examples-gallery {
    grid-template-columns: 1fr;
  }
  .examples-gallery-header {
    flex-direction: column;
    gap: .5rem;
  }
}


/* ============================================================
   LESSON TABS — Practice / Challenge / Quiz / Sources
   ============================================================ */

/* ── Practice: template filler ────────────────────────────── */
.lt-tmpl-block {
  margin-top: 1rem;
  padding: .85rem 1rem 1rem;
  background: var(--surface-soft);
  border-radius: var(--radius);
  border: 1.5px solid var(--border);
}
.lt-tmpl-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: .5rem;
  flex-wrap: wrap;
  margin-bottom: .65rem;
}
.lt-tmpl-fields {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: .5rem;
  margin-bottom: .75rem;
}
.lt-tmpl-field { display: flex; flex-direction: column; gap: .2rem; }
.lt-tmpl-field label {
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
}
.lt-tmpl-field input {
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .4rem .55rem;
  font-size: .85rem;
  background: var(--surface);
  color: var(--text);
  transition: border-color .15s;
}
.lt-tmpl-field input:focus {
  outline: none;
  border-color: var(--primary);
}
.lt-tmpl-preview-wrap {
  margin-bottom: .65rem;
}
.lt-tmpl-preview-label {
  display: block;
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--muted);
  margin-bottom: .25rem;
}
.lt-tmpl-preview {
  margin: 0;
  padding: .6rem .75rem;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .82rem;
  font-family: ui-monospace, monospace;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.55;
  color: var(--text);
}
.lt-tmpl-actions {
  display: flex;
  gap: .45rem;
  flex-wrap: wrap;
  align-items: center;
}
.lt-tmpl-response {
  margin-top: .75rem;
  font-size: .85rem;
  line-height: 1.6;
  color: var(--text);
  min-height: 0;
}
.lt-tmpl-response:empty { display: none; }
.lt-response-content { padding: .55rem .75rem; background: var(--surface); border-radius: var(--radius-sm); border: 1.5px solid var(--border); }

/* ── Practice: quick-try block ────────────────────────────── */
.lt-quick-block {
  margin-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: .55rem;
}
.lt-quick-textarea {
  width: 100%;
  box-sizing: border-box;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .55rem .75rem;
  font-size: .87rem;
  font-family: ui-monospace, "Cascadia Code", monospace;
  background: var(--surface);
  color: var(--text);
  resize: vertical;
  min-height: 90px;
  transition: border-color .15s;
  line-height: 1.55;
}
.lt-quick-textarea:focus {
  outline: none;
  border-color: var(--primary);
}
.lt-quick-tip {
  font-size: .8rem;
  padding: .4rem .65rem;
  background: var(--accent-light);
  color: var(--accent-accessible);
  border-radius: var(--radius-xs);
  line-height: 1.5;
}

/* ── Challenge: self-rated exercise cards ─────────────────── */
.lt-exercise-list {
  display: flex;
  flex-direction: column;
  gap: .65rem;
  margin-top: .65rem;
}
.lt-exercise {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: .8rem 1rem;
  display: flex;
  flex-direction: column;
  gap: .55rem;
  transition: border-color .18s;
}
.lt-exercise:hover {
  border-color: var(--primary);
}
.lt-exercise-q {
  display: flex;
  align-items: flex-start;
  gap: .55rem;
  font-size: .92rem;
  line-height: 1.5;
}
.lt-exercise-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 800;
  font-size: .8rem;
  flex-shrink: 0;
}
.lt-exercise-reveal {
  align-self: flex-start;
}
.lt-exercise-sample {
  padding: .55rem .75rem;
  background: var(--surface-soft);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--success);
  font-size: .87rem;
  line-height: 1.55;
}
.lt-exercise-rate {
  display: flex;
  align-items: center;
  gap: .4rem;
  flex-wrap: wrap;
  padding-top: .35rem;
  border-top: 1px dashed var(--border);
}
.lt-rate-pass:not(:disabled):hover { border-color: var(--success); color: var(--success); }
.lt-rate-more:not(:disabled):hover { border-color: var(--accent); color: var(--accent-dark); }
.lt-exercise-status {
  display: inline-flex;
  align-items: center;
  font-size: .78rem;
  color: var(--success);
  font-weight: 600;
  margin-left: auto;
}

/* ── Quiz: progress meter & summary ───────────────────────── */
.lt-quiz-progress {
  margin: .85rem 0 1.1rem;
}
.lt-quiz-track {
  height: 8px;
  background: var(--surface-soft);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-bottom: .35rem;
}
.lt-quiz-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--teal));
  border-radius: var(--radius-full);
  transition: width .3s ease;
}
.lt-quiz-text {
  font-weight: 600;
}
.lt-quiz-summary {
  margin-top: 1rem;
  padding: 1rem 1.1rem;
  background: linear-gradient(135deg, var(--primary-light), var(--teal-light));
  border-radius: var(--radius);
  border: 1.5px solid rgba(67,97,238,0.2);
  animation: fadeSlideIn .3s ease;
}
.lt-quiz-summary-inner {
  display: flex;
  align-items: center;
  gap: 1rem;
}
.lt-quiz-summary-score {
  flex-shrink: 0;
  text-align: center;
  padding: .45rem .8rem;
  background: var(--surface);
  border-radius: var(--radius);
  border: 2px solid var(--primary);
}
.lt-quiz-final-score {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--primary);
  line-height: 1.1;
}
.lt-quiz-summary-text strong {
  display: block;
  font-size: 1rem;
  color: var(--text);
}
.lt-quiz-final-verdict {
  font-size: .87rem;
  color: var(--text-2);
  line-height: 1.5;
}

/* ── Sources: topic chips ─────────────────────────────────── */
.lt-topic-chips {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  margin-top: .5rem;
}
.lt-topic-chip {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .4rem .75rem;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-full);
  font-size: .82rem;
  font-weight: 500;
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
  transition: border-color .15s, background .15s, color .15s, transform .1s;
}
.lt-topic-chip:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-light);
  transform: translateY(-1px);
}
.lt-topic-chip-icon { font-size: .9rem; line-height: 1; }

/* ── Sources: search + cards ──────────────────────────────── */
.lt-source-search {
  appearance: none;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-full);
  padding: .35rem .9rem;
  font-size: .82rem;
  background: var(--surface);
  color: var(--text);
  transition: border-color .15s, box-shadow .15s;
  min-width: 200px;
}
.lt-source-search:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}
.lt-source-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: .6rem;
  margin-top: .85rem;
}
.lt-source-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: .7rem .85rem;
  display: flex;
  flex-direction: column;
  gap: .35rem;
  transition: border-color .15s, box-shadow .15s;
}
.lt-source-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-sm);
}
.lt-source-card-head {
  display: flex;
  align-items: center;
  gap: .4rem;
}
.lt-source-icon { font-size: .95rem; line-height: 1; }
.lt-source-label {
  font-size: .9rem;
  color: var(--text);
  line-height: 1.35;
}
.lt-source-url {
  font-size: .72rem;
  font-family: ui-monospace, monospace;
  word-break: break-all;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.lt-source-actions {
  display: flex;
  gap: .35rem;
  margin-top: .25rem;
  flex-wrap: wrap;
}

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 700px) {
  .lt-tmpl-fields { grid-template-columns: 1fr; }
  .lt-source-grid { grid-template-columns: 1fr; }
  .lt-quiz-summary-inner { flex-direction: column; align-items: flex-start; }
}

/* ============================================================
   DASHBOARD — Share links + email invites
   ============================================================ */
.dash-flash {
  padding: .65rem 1rem;
  border-radius: var(--radius);
  margin: .85rem 0 1rem;
  font-size: .88rem;
  border: 1.5px solid transparent;
}
.dash-flash.success { background: var(--success-light); color: var(--success); border-color: rgba(5,150,105,.2); }
.dash-flash.error   { background: var(--danger-light);  color: var(--danger);  border-color: rgba(220,38,38,.2); }
.dash-flash.info    { background: var(--primary-light); color: var(--primary); border-color: rgba(67,97,238,.2); }

.dash-share-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .85rem;
  margin-top: 1rem;
  padding: .85rem 1rem;
  background: var(--surface-soft);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
.dash-share-block { display: flex; flex-direction: column; gap: .35rem; }
.dash-share-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  flex-wrap: wrap;
}
.dash-share-head .eyebrow { margin: 0; }
.dash-share-row {
  display: flex;
  gap: .4rem;
  align-items: center;
  flex-wrap: wrap;
}
.dash-invite-link {
  flex: 1;
  min-width: 200px;
  padding: .35rem .6rem;
  font-size: .78rem;
  font-family: ui-monospace, monospace;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
}
.dash-invite-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: .4rem;
}
.dash-invite-email   { padding: .35rem .55rem; font-size: .82rem; }
.dash-invite-expires { padding: .35rem .55rem; font-size: .82rem; }

.dash-invite-list {
  margin-top: .85rem;
  padding: .55rem .8rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.dash-invite-list summary {
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.dash-invite-list summary::-webkit-details-marker { display: none; }
.dash-invite-list summary::before {
  content: "▶";
  display: inline-block;
  font-size: .65rem;
  margin-right: .4rem;
  transition: transform .15s;
}
.dash-invite-list[open] summary::before { transform: rotate(90deg); }

@media (max-width: 700px) {
  .dash-share-grid { grid-template-columns: 1fr; }
  .dash-invite-form { grid-template-columns: 1fr; }
}

/* ============================================================
   COMMUNITY: chat / forum / activity
   ============================================================ */

.ws-toolbar {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem;
  padding-bottom: .8rem; border-bottom: 1px solid var(--border);
}
.ws-tabs { display:flex; gap:.4rem; flex-wrap:wrap; }
.ws-tabs .pill { padding: .35rem .8rem; font-weight: 500; }
.ws-tabs .pill.active { background: var(--primary); color:#fff; border-color: var(--primary); }

/* ── Chat ── */
.chat-stream {
  height: 460px;
  overflow-y: auto;
  padding: .85rem;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  display: flex; flex-direction: column; gap: .5rem;
  scroll-behavior: smooth;
}
.chat-msg {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .55rem .75rem;
  max-width: 78%;
  align-self: flex-start;
  position: relative;
}
.chat-msg.is-mine        { background: var(--primary-light); border-color: rgba(67,97,238,.25); align-self: flex-end; }
.chat-msg.is-instructor  { border-left: 3px solid var(--primary); }
.chat-msg.is-pinned      { background: var(--accent-light); border-color: rgba(247,127,0,.35); }
.chat-msg.is-deleted     { opacity: .65; }
.chat-msg-head {
  display: flex; align-items: center; gap: .4rem; flex-wrap: wrap;
  font-size: .76rem; color: var(--muted); margin-bottom: .15rem;
}
.chat-msg-head time { font-variant-numeric: tabular-nums; }
.chat-role-tag {
  font-size: .65rem; font-weight: 700; text-transform: uppercase;
  background: var(--primary); color: #fff; padding: .05rem .35rem; border-radius: 3px;
}
.chat-msg-actions {
  margin-left: auto; display: none; gap: .2rem;
}
.chat-msg:hover .chat-msg-actions { display: inline-flex; }
.chat-msg-actions button {
  background: transparent; border: 1px solid var(--border); border-radius: 4px;
  font-size: .8rem; padding: 0 .35rem; cursor: pointer; line-height: 1.4;
}
.chat-msg-actions button:hover { border-color: var(--primary); }
.chat-msg-body {
  font-size: .9rem; line-height: 1.55; color: var(--text); word-break: break-word; white-space: pre-wrap;
}
.chat-error {
  align-self: center;
  font-size: .82rem; color: var(--danger);
  background: var(--danger-light); padding: .35rem .65rem; border-radius: 4px;
}
.chat-compose {
  margin-top: .65rem;
  display: flex; gap: .5rem;
}
.chat-compose textarea {
  flex: 1; resize: vertical; min-height: 44px; max-height: 160px;
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  padding: .5rem .65rem; font: inherit; font-size: .9rem;
  background: var(--surface); color: var(--text);
}
.chat-compose textarea:focus { outline: none; border-color: var(--primary); }

/* ── Forum ── */
.forum-new { margin: .85rem 0 1.1rem; }
.forum-new[open] summary { margin-bottom: .65rem; }
.forum-new-form {
  display: flex; flex-direction: column; gap: .5rem;
  padding: .75rem; background: var(--surface-soft); border-radius: var(--radius);
}
.forum-new-form input, .forum-new-form textarea, .forum-new-form select {
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  padding: .45rem .65rem; font: inherit; font-size: .87rem;
  background: var(--surface); color: var(--text);
}
.forum-new-form input:focus, .forum-new-form textarea:focus, .forum-new-form select:focus {
  outline: none; border-color: var(--primary);
}
.forum-list { display: flex; flex-direction: column; gap: .4rem; }
.forum-thread-row {
  display: flex; flex-direction: column; gap: .25rem;
  padding: .8rem 1rem;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  text-decoration: none; color: var(--text);
  transition: border-color .15s;
}
.forum-thread-row:hover { border-color: var(--primary); }
.forum-thread-main { display:flex; align-items:center; gap:.5rem; flex-wrap:wrap; }
.forum-thread-meta { display:flex; gap:.35rem; flex-wrap:wrap; font-size:.78rem; }
.forum-tag {
  font-size: .7rem; font-weight: 700; padding: .1rem .45rem;
  background: var(--primary-light); color: var(--primary); border-radius: var(--radius-full);
}
.forum-locked { font-size: .85rem; }

.thread-head { padding-bottom: .65rem; border-bottom: 1px solid var(--border); margin-bottom: .85rem; }
.thread-posts { display: flex; flex-direction: column; gap: .65rem; }
.thread-post {
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: var(--radius); padding: .85rem 1rem;
}
.thread-post.is-instructor { border-left: 3px solid var(--primary); }
.thread-post-head {
  display: flex; align-items: center; gap: .45rem; flex-wrap: wrap;
  font-size: .82rem; margin-bottom: .35rem; padding-bottom: .35rem;
  border-bottom: 1px dashed var(--border);
}
.thread-post-head time { font-size: .72rem; }
.thread-post-body { font-size: .92rem; line-height: 1.6; white-space: pre-wrap; word-break: break-word; }
.thread-reply textarea {
  width: 100%; box-sizing: border-box; min-height: 90px;
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  padding: .55rem .75rem; font: inherit; font-size: .9rem;
  background: var(--surface); resize: vertical;
}
.thread-reply textarea:focus { outline: none; border-color: var(--primary); }
.thread-reply { margin-top: 1rem; }

/* ── Activity / Prompt Battle ── */
.activity-card {
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: var(--radius); padding: 1rem 1.1rem; margin-top: .75rem;
}
.activity-card.is-closed { background: var(--surface-soft); }
.activity-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: .5rem; flex-wrap: wrap; margin-bottom: .5rem;
}
.activity-prompt {
  background: var(--primary-light); color: var(--primary);
  border-left: 3px solid var(--primary); border-radius: var(--radius-xs);
  padding: .55rem .8rem; margin: .5rem 0 .65rem;
  font-weight: 500; line-height: 1.5;
}
.activity-card form { display: flex; flex-direction: column; gap: .4rem; }
.activity-card form textarea {
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  padding: .5rem .7rem; font: inherit; font-size: .88rem;
  background: var(--surface); resize: vertical;
}
.activity-card form textarea:focus { outline: none; border-color: var(--primary); }
.activity-toggle { margin-top: .6rem; }
.activity-responses { margin-top: .65rem; display: flex; flex-direction: column; gap: .4rem; }
.response-card {
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); padding: .55rem .75rem;
}
.response-head {
  display: flex; gap: .5rem; align-items: center;
  font-size: .78rem; margin-bottom: .25rem;
}
.response-body { font-size: .87rem; line-height: 1.55; white-space: pre-wrap; }

/* Responsive */
@media (max-width: 600px) {
  .chat-stream { height: 56vh; }
  .chat-msg { max-width: 92%; }
  .ws-toolbar { flex-direction: column; }
}

/* ============================================================
   CHALLENGES PAGE — toolbar, filter, progress
   ============================================================ */
.ch-toolbar {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 1.25rem; flex-wrap: wrap;
}
.ch-progress {
  display: flex; align-items: center; gap: 1.5rem; flex-wrap: wrap;
  flex: 1; min-width: 280px;
}
.ch-progress-stat {
  display: flex; flex-direction: column; align-items: flex-start; gap: .1rem;
}
.ch-progress-stat strong {
  font-size: 1.4rem; font-weight: 800; color: var(--primary); line-height: 1;
}
.ch-progress-stat span {
  font-size: .72rem; text-transform: uppercase; letter-spacing: .05em;
}
.ch-progress-bar {
  flex: 1; min-width: 140px; height: 8px; background: var(--surface-soft);
  border-radius: var(--radius-full); overflow: hidden;
}
.ch-progress-fill {
  height: 100%; background: linear-gradient(90deg, var(--primary), var(--teal));
  border-radius: var(--radius-full); transition: width .3s ease;
}
.ch-howto { flex-shrink: 0; }
.ch-howto summary {
  cursor: pointer; font-size: .85rem; color: var(--muted);
  padding: .4rem .8rem; border: 1.5px solid var(--border); border-radius: var(--radius-full);
  list-style: none;
}
.ch-howto summary::-webkit-details-marker { display: none; }
.ch-howto summary:hover { border-color: var(--primary); color: var(--primary); }
.ch-howto[open] summary { background: var(--primary-light); color: var(--primary); border-color: var(--primary); }

.ch-filter-row {
  display: flex; flex-wrap: wrap; gap: .4rem;
}
.ch-filter {
  appearance: none; cursor: pointer;
  border: 1.5px solid var(--border); background: var(--surface);
  color: var(--text-2); font-size: .82rem; font-weight: 500;
  padding: .35rem .85rem; border-radius: var(--radius-full);
  transition: background .15s, border-color .15s, color .15s;
}
.ch-filter:hover { border-color: var(--primary); color: var(--primary); }
.ch-filter.active {
  background: var(--primary); border-color: var(--primary); color: #fff;
}

/* Card meta-row — small refinement so difficulty / time / mastered align */
.ch-meta-row { display:flex; align-items:center; gap:.5rem; flex-wrap:wrap; }
.ch-time { font-size:.74rem; opacity:.85; }
.ch-status { background: var(--success-light); color:#065F46; }

/* Card title sizing — slightly more readable */
.challenge-title { margin:.5rem 0 .2rem; font-size:1.05rem; line-height:1.35; }
.challenge-desc  { margin:0; font-size:.88rem; line-height:1.5; }

/* Action row inside the expanded card */
.ch-action-row {
  display:flex; gap:.5rem; align-items:center; flex-wrap:wrap;
  margin-top:.6rem;
}

/* Responsive */
@media (max-width: 640px) {
  .ch-toolbar { flex-direction: column; }
  .ch-progress { width: 100%; }
  .ch-howto { width: 100%; }
}

/* ============================================================
   PLAYGROUND — image attachment (multimodal)
   ============================================================ */
.pg-image-row {
  display: flex; align-items: center; gap: .5rem;
  margin: .5rem 0 .65rem; flex-wrap: wrap;
}
.pg-image-btn { white-space: nowrap; }
.pg-image-preview {
  display: flex; align-items: center; gap: .5rem;
  padding: .35rem .55rem;
  background: var(--surface-soft);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  max-width: 100%;
}
.pg-image-preview img {
  width: 36px; height: 36px;
  object-fit: cover;
  border-radius: 4px;
  flex-shrink: 0;
}
.pg-image-meta {
  font-size: .78rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 220px;
}
.pg-image-remove {
  appearance: none; cursor: pointer;
  background: transparent; border: none;
  font-size: 1.2rem; line-height: 1; color: var(--muted);
  padding: 0 .25rem;
}
.pg-image-remove:hover { color: var(--danger); }

/* ============================================================
   LAB FEATURES — variance, daily, tutor memory, socratic toggle
   ============================================================ */

/* ── Mode toggles row in playground ── */
.pg-mode-row {
  display: flex; align-items: center; gap: .65rem; flex-wrap: wrap;
  margin: .5rem 0 .65rem;
  padding: .4rem .6rem;
  background: var(--surface-soft);
  border-radius: var(--radius-sm);
}
.pg-toggle {
  display: inline-flex; align-items: center; gap: .35rem;
  font-size: .82rem; cursor: pointer;
  color: var(--text-2);
}
.pg-toggle input[type=checkbox] { accent-color: var(--primary); }

/* ── Variance grid in Coach tab ── */
.variance-box {
  background: var(--surface);
  border: 1.5px solid rgba(67, 97, 238, .25);
  border-radius: var(--radius);
  padding: .85rem 1rem;
  margin-bottom: 1rem;
}
.variance-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: .65rem;
  margin-top: .5rem;
}
.variance-card {
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .55rem .7rem;
  display: flex; flex-direction: column; gap: .35rem;
}
.variance-head {
  display: flex; justify-content: space-between; align-items: center;
  padding-bottom: .25rem;
  border-bottom: 1px dashed var(--border);
}
.variance-body {
  font-size: .82rem; line-height: 1.5;
  white-space: pre-wrap; word-break: break-word;
  max-height: 220px; overflow-y: auto;
}
.variance-loading {
  padding: 1rem; text-align: center; color: var(--muted); font-size: .9rem;
}

/* ── Tutor memory panel ── */
.tutor-memory-box {
  background: var(--surface-soft);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .55rem .85rem;
  margin-bottom: 1rem;
}
.tutor-memory-box[open] { background: var(--primary-light); border-color: rgba(67,97,238,.3); }
.tutor-memory-box summary {
  cursor: pointer; font-size: .85rem; font-weight: 600;
  list-style: none;
}
.tutor-memory-box summary::-webkit-details-marker { display: none; }
.tutor-memory-notes {
  margin: .5rem 0 0;
  padding: .55rem .7rem;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-xs);
  font-family: ui-monospace, monospace;
  font-size: .76rem;
  line-height: 1.5;
  max-height: 220px;
  overflow-y: auto;
  white-space: pre-wrap;
}

/* ── Daily challenge ── */
.daily-board { padding: 0; }
.daily-sentences { list-style: none; padding: 0; margin: 0; display: flex;
                   flex-direction: column; gap: .5rem; }
.daily-sentence { margin: 0; }
.daily-pick {
  width: 100%; text-align: left;
  display: flex; align-items: flex-start; gap: .65rem;
  padding: .7rem .9rem;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color .15s, background .15s, transform .1s;
  font: inherit; font-size: .92rem; color: var(--text);
  line-height: 1.5;
}
.daily-pick:hover:not([disabled]) {
  border-color: var(--primary); background: var(--primary-light);
  transform: translateY(-1px);
}
.daily-pick[disabled] { cursor: default; opacity: .85; }
.daily-letter {
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 800; font-size: .85rem;
}
.daily-text { flex: 1; }
.daily-mark {
  flex-shrink: 0;
  font-size: 1.2rem; line-height: 1; color: transparent;
  width: 1.5rem; text-align: center;
}
.daily-sentence.is-wrong .daily-pick {
  border-color: var(--danger); background: var(--danger-light);
}
.daily-sentence.is-wrong .daily-mark { color: var(--danger); }
.daily-sentence.is-right .daily-pick {
  border-color: var(--success); background: var(--success-light);
}
.daily-sentence.is-right .daily-mark { color: var(--success); }
.daily-sentence.is-miss .daily-pick {
  border-style: dashed;
  border-color: var(--accent); background: var(--accent-light);
}
.daily-sentence.is-miss .daily-mark { color: var(--accent); }

.daily-state {
  margin-top: 1rem; padding: .6rem .8rem;
  background: var(--surface-soft); border-radius: var(--radius-sm);
}
.daily-msg { margin: 0; font-size: .9rem; }
.daily-msg.success { color: var(--success); font-weight: 600; }
.daily-msg.danger  { color: var(--danger);  font-weight: 600; }

.daily-explanation {
  margin-top: .85rem;
  padding: .7rem .85rem;
  background: var(--accent-light); color: var(--accent-dark);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--accent);
}
.daily-explanation p { margin: .25rem 0 0; line-height: 1.55; }

.daily-share {
  margin-top: .85rem;
  display: flex; align-items: center; gap: .65rem; flex-wrap: wrap;
}
.daily-grid {
  font-size: 1.4rem; letter-spacing: .15em; line-height: 1;
}

/* ============================================================
   ACCESSIBILITY — Dyslexia-friendly mode
   Toggle class `.dyslexia` on <body>
   ============================================================ */

/* OpenDyslexic font via @font-face (hosted on cdnjs / bunny CDN) */
@font-face {
  font-family: 'OpenDyslexic';
  src: url('https://fonts.cdnfonts.com/s/14993/OpenDyslexic-Regular.woff') format('woff');
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'OpenDyslexic';
  src: url('https://fonts.cdnfonts.com/s/14993/OpenDyslexic-Bold.woff') format('woff');
  font-weight: 700; font-style: normal; font-display: swap;
}

body.dyslexia {
  --font: 'OpenDyslexic', 'Comic Sans MS', cursive, sans-serif;
  font-family: var(--font);
  font-size: 1.08em;        /* slightly larger base */
  line-height: 1.8;         /* generous leading */
  letter-spacing: 0.04em;
  word-spacing: 0.12em;
}
body.dyslexia h1, body.dyslexia h2, body.dyslexia h3,
body.dyslexia h4, body.dyslexia h5 {
  font-family: var(--font);
  letter-spacing: 0.02em;
  line-height: 1.4;
}
body.dyslexia p, body.dyslexia li, body.dyslexia td, body.dyslexia th {
  max-width: 70ch;          /* avoid ultra-wide lines */
  line-height: 1.85;
}
body.dyslexia .theory-body p {
  margin-bottom: 1.25em;
}

/* ── Reading ruler (horizontal highlight stripe) ── */
.reading-ruler {
  display: none;
  position: fixed;
  left: 0; right: 0;
  height: 2.8em;
  background: rgba(255, 240, 100, 0.35);
  border-top: 2px solid rgba(200, 180, 0, 0.35);
  border-bottom: 2px solid rgba(200, 180, 0, 0.35);
  pointer-events: none;
  z-index: 9990;
  transition: top 0.05s linear;
}
body.ruler-on .reading-ruler { display: block; }

/* accessibility toggle pill (floating in corner) */
.a11y-toolbar {
  position: fixed;
  bottom: 1.25rem;
  right: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: .45rem;
  z-index: 9980;
}
.a11y-menu-toggle {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  align-self: flex-end;
  padding: .45rem .75rem;
  background: var(--surface);
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-sm);
  font-size: .8rem;
  font-weight: 700;
  color: var(--text-2);
  cursor: pointer;
}
.a11y-menu-toggle:hover { background: var(--primary-light); color: var(--primary); }
.a11y-tools { display: grid; gap: .45rem; margin-top: .45rem; }
.a11y-tools[hidden] { display: none; }
.a11y-btn {
  display: flex;
  align-items: center;
  gap: .45rem;
  padding: .45rem .85rem;
  background: var(--surface);
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-sm);
  font-size: .8rem;
  font-weight: 600;
  color: var(--text-2);
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s;
}
.a11y-btn:hover { background: var(--primary-light); border-color: var(--primary); color: var(--primary); }
.a11y-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.a11y-btn-icon { font-size: 1rem; line-height: 1; }

/* ============================================================
   ACCESSIBILITY — Color-blind safe heatmap palette
   Applied via body.cb-safe or .heatmap-table.cb-safe
   Uses shapes + patterns in addition to color
   ============================================================ */

/* Default heatmap cell colors */
.hm-mastered  { background: #1a9850; color: #fff; }
.hm-quiz-only { background: #91cf60; color: #1a3e10; }
.hm-lesson    { background: #fee08b; color: #3d2e00; }
.hm-untouched { background: #f0f0f0; color: var(--muted); }

/* Color-blind safe overrides (Okabe-Ito palette — universally distinguishable) */
body.cb-safe .hm-mastered,
.heatmap-table.cb-safe .hm-mastered {
  background: #009E73;    /* bluish-green — visible to all color-vision types */
  color: #fff;
  position: relative;
}
body.cb-safe .hm-quiz-only,
.heatmap-table.cb-safe .hm-quiz-only {
  background: #56B4E9;    /* sky blue */
  color: #002b45;
  position: relative;
}
body.cb-safe .hm-lesson,
.heatmap-table.cb-safe .hm-lesson {
  background: #F0E442;    /* yellow — still works in protanopia/deuteranopia */
  color: #2a2400;
  position: relative;
}
body.cb-safe .hm-untouched,
.heatmap-table.cb-safe .hm-untouched {
  background: #f5f5f5;
  color: var(--muted);
}

/* Pattern overlays — CSS-only hatching via pseudo-elements */
body.cb-safe .hm-mastered::after,
.heatmap-table.cb-safe .hm-mastered::after {
  content: '✓';
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: .65rem; opacity: .55; pointer-events: none;
}
body.cb-safe .hm-quiz-only::after,
.heatmap-table.cb-safe .hm-quiz-only::after {
  content: '◆';
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: .5rem; opacity: .45; pointer-events: none;
}
body.cb-safe .hm-lesson::after,
.heatmap-table.cb-safe .hm-lesson::after {
  content: '▪';
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: .55rem; opacity: .4; pointer-events: none;
}

/* Ensure heatmap cells support pseudo-elements */
.heatmap-table td { position: relative; overflow: hidden; }

/* Color-blind toggle indicator in legend */
.hm-legend-cb-note {
  display: none;
  font-size: .78rem;
  color: var(--muted);
  margin-top: .35rem;
  font-style: italic;
}
body.cb-safe .hm-legend-cb-note { display: block; }

/* ── API token page ── */
.token-reveal {
  background: var(--surface-soft);
  border: 1.5px solid var(--success);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-bottom: 1.25rem;
}
.token-reveal code {
  display: block;
  font-family: 'Courier New', monospace;
  font-size: .95rem;
  word-break: break-all;
  color: var(--success);
  font-weight: 700;
  margin: .5rem 0;
}
.token-reveal .token-warning {
  font-size: .82rem;
  color: var(--accent-accessible);
  font-weight: 600;
}
.token-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.token-table th {
  text-align: left;
  padding: .5rem .75rem;
  border-bottom: 2px solid var(--border);
  font-weight: 600;
  color: var(--text-2);
}
.token-table td {
  padding: .55rem .75rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.token-table tr:last-child td { border-bottom: none; }
.token-table .revoked-row td { opacity: .45; }
.scope-badge {
  display: inline-flex;
  align-items: center;
  padding: .2rem .55rem;
  border-radius: var(--radius-full);
  font-size: .75rem;
  font-weight: 700;
  background: var(--primary-light);
  color: var(--primary-dark);
}
.scope-badge.write {
  background: var(--accent-light);
  color: var(--accent-dark);
}

/* (FORGED Strip CSS removed 2026-05-23 — the strip itself was flagged as
    the "confusing bar". Framework is still taught via module tab labels,
    home-page hero cards, and lesson content.) */

/* ── Lesson tab FORGED labels ────────────────────────────────────────────── */
.lesson-tab[data-lesson-tab="overview"]  { --tab-forged: "F"; }
.lesson-tab[data-lesson-tab="theory"]    { --tab-forged: "O"; }
.lesson-tab[data-lesson-tab="examples"]  { --tab-forged: "O"; }
.lesson-tab[data-lesson-tab="practice"]  { --tab-forged: "R"; }
.lesson-tab[data-lesson-tab="challenge"] { --tab-forged: "E"; }
.lesson-tab[data-lesson-tab="quiz"]      { --tab-forged: "D"; }
.lesson-tab[data-lesson-tab="sources"]   { --tab-forged: "G"; }

/* (FORGED Pane Banners removed 2026-05-22 — the topbar FORGED strip + the
    F/O/R/E/D/G prefixed lesson tabs already teach the framework. Removing
    the per-tab banners cut visual chrome from /modules/<slug> noticeably.) */

/* ── Home FORGED wayfinder grid ─────────────────────────────────────────── */
.forged-home-steps {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: .5rem;
  margin: 1.5rem 0 0;
}
.forged-home-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: .2rem;
  padding: .75rem .4rem;
  border-radius: var(--radius);
  border: 1.5px solid var(--border);
  background: var(--surface);
  text-decoration: none;
  color: var(--text-1);
  transition: border-color .15s, transform .15s, box-shadow .15s;
}
.forged-home-step:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,.08);
  border-color: var(--primary);
}
.fhs-letter {
  font-size: 1.5rem;
  font-weight: 900;
  line-height: 1;
}
.fhs-name  { font-size: .82rem; font-weight: 700; }
.fhs-desc  { font-size: .68rem; color: var(--text-2); line-height: 1.3; }
.fhs-dest  { font-size: .65rem; color: var(--primary); font-weight: 600; margin-top: .15rem; }

.forged-home-step:nth-child(1) .fhs-letter { color: #6366f1; }
.forged-home-step:nth-child(2) .fhs-letter { color: #3b82f6; }
.forged-home-step:nth-child(3) .fhs-letter { color: #22c55e; }
.forged-home-step:nth-child(4) .fhs-letter { color: #ca8a04; }
.forged-home-step:nth-child(5) .fhs-letter { color: #f97316; }
.forged-home-step:nth-child(6) .fhs-letter { color: #a855f7; }

@media (max-width: 640px) {
  .forged-home-steps { grid-template-columns: repeat(3, 1fr); }
}

/* ── Inline Experiment Sandbox ───────────────────────────────────────────── */
.sandbox-wrap        { margin-top: .5rem; }
.sandbox-actions     { display: flex; gap: .5rem; margin-top: .5rem; flex-wrap: wrap; }
.sandbox-tip         {
  margin-top: .65rem;
  padding: .55rem .8rem;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  font-size: .8rem;
  color: var(--text-2);
  line-height: 1.5;
}

/* (Module Interconnections grid removed 2026-05-22 — replaced by the
    `.module-nextsteps` numbered footer which routes through authored
    practice + evaluation.) */

/* ============================================================
   DARK MODE
   Two separate rule blocks — [data-theme="dark"] for explicit
   toggle, @media for system preference. Both set the same tokens.
   Applied to <html> before first paint (see base.html <head>
   script) so there is no flash of wrong theme (FOUT).
   ============================================================ */

/* Explicit dark mode (JS toggle or localStorage) */
[data-theme="dark"] {
  --bg:            #0f1117;
  --surface:       #1a1f2e;
  --surface-soft:  #151922;
  --surface-2:     #151922;          /* alias of --surface-soft for legacy references */
  --surface-raised:#1e2432;
  --text:          #f1f5f9;
  --text-1:        #f1f5f9;
  --text-2:        #cbd5e1;
  --muted:         #94a3b8;
  --muted-light:   #64748b;
  --border:        #2d3748;
  --border-strong: #3d4f68;
  --primary:       #7c9ff7;
  --primary-dark:  #6580f5;
  --primary-light: #1e2a4a;
  --primary-glow:  rgba(124,159,247,0.2);
  --accent:              #f97316;
  --accent-dark:         #ea6f0b;
  --accent-light:        #2a1800;
  --accent-accessible:   #fb923c;
  --teal:          #2dd4bf;
  --teal-light:    #0d2320;
  --success:       #34d399;
  --success-light: #0a2318;
  --danger:        #f87171;
  --danger-light:  #2a0d0d;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.4),  0 1px 2px rgba(0,0,0,.3);
  --shadow:    0 4px 16px rgba(0,0,0,.4), 0 1px 4px rgba(0,0,0,.3);
  --shadow-md: 0 8px 32px rgba(0,0,0,.45),0 2px 8px rgba(0,0,0,.3);
  --shadow-lg: 0 20px 60px rgba(0,0,0,.5),0 6px 20px rgba(0,0,0,.35);
  --shadow-primary: 0 8px 28px rgba(124,159,247,0.25);
  color-scheme: dark;
}

/* System dark preference (when user hasn't explicitly chosen light) */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:            #0f1117;
    --surface:       #1a1f2e;
    --surface-soft:  #151922;
    --surface-2:     #151922;          /* alias of --surface-soft for legacy references */
    --surface-raised:#1e2432;
    --text:          #f1f5f9;
    --text-1:        #f1f5f9;
    --text-2:        #cbd5e1;
    --muted:         #94a3b8;
    --muted-light:   #64748b;
    --border:        #2d3748;
    --border-strong: #3d4f68;
    --primary:       #7c9ff7;
    --primary-dark:  #6580f5;
    --primary-light: #1e2a4a;
    --primary-glow:  rgba(124,159,247,0.2);
    --accent:              #f97316;
    --accent-dark:         #ea6f0b;
    --accent-light:        #2a1800;
    --accent-accessible:   #fb923c;
    --teal:          #2dd4bf;
    --teal-light:    #0d2320;
    --success:       #34d399;
    --success-light: #0a2318;
    --danger:        #f87171;
    --danger-light:  #2a0d0d;
    --shadow-sm: 0 1px 3px rgba(0,0,0,.4),  0 1px 2px rgba(0,0,0,.3);
    --shadow:    0 4px 16px rgba(0,0,0,.4), 0 1px 4px rgba(0,0,0,.3);
    --shadow-md: 0 8px 32px rgba(0,0,0,.45),0 2px 8px rgba(0,0,0,.3);
    --shadow-lg: 0 20px 60px rgba(0,0,0,.5),0 6px 20px rgba(0,0,0,.35);
    --shadow-primary: 0 8px 28px rgba(124,159,247,0.25);
    color-scheme: dark;
  }
}

/* Component surface overrides for elements with hardcoded colours */
[data-theme="dark"] .hero-banner,
[data-theme="dark"] .hero-card { background: var(--surface); border-color: var(--border); }
[data-theme="dark"] .topbar    { background: rgba(15,17,23,.92); border-bottom-color: var(--border); }
[data-theme="dark"] .card      { background: var(--surface); border-color: var(--border); }
[data-theme="dark"] input,
[data-theme="dark"] textarea,
[data-theme="dark"] select     { background: var(--surface); color: var(--text); border-color: var(--border); }
[data-theme="dark"] .panel     { background: var(--surface); border-color: var(--border); }
[data-theme="dark"] .nav-user-menu { background: var(--surface-raised); border-color: var(--border); }
[data-theme="dark"] .nav-drawer    { background: var(--surface-raised); border-color: var(--border); }
[data-theme="dark"] code,
[data-theme="dark"] pre            { background: var(--surface-soft); color: var(--text-2); }
[data-theme="dark"] .footer        { background: var(--surface); border-top-color: var(--border); }

/* ── Theme toggle button ──────────────────────────────────── */
.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  background: var(--surface-soft);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-full);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  transition: background .15s, border-color .15s, transform .1s;
  flex-shrink: 0;
}
.theme-toggle:hover  { background: var(--primary-light); border-color: var(--primary); transform: scale(1.08); }
.theme-toggle:active { transform: scale(.95); }

/* ── Lesson search ────────────────────────────────────────── */
.lesson-search-wrap {
  position: relative;
  max-width: 360px;
}
.lesson-search-wrap svg {
  position: absolute;
  left: .75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
  width: 16px;
  height: 16px;
}
.lesson-search {
  width: 100%;
  padding: .55rem .9rem .55rem 2.2rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-full);
  background: var(--surface);
  color: var(--text);
  font-size: .9rem;
  font-family: var(--font);
  transition: border-color .15s, box-shadow .15s;
}
.lesson-search:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}
.lesson-search-empty {
  grid-column: 1/-1;
  text-align: center;
  color: var(--muted);
  padding: 2rem 0;
  font-size: .95rem;
}

/* ─────────────────────────────────────────────────────────────────
   Panel accent modifiers  (.panel--primary / --success / --teal)
   ───────────────────────────────────────────────────────────────── */
.panel--primary { border-left: 4px solid var(--primary); }
.panel--success { border-left: 4px solid var(--success); background: var(--success-light, color-mix(in srgb, var(--success) 8%, transparent)); }
.panel--teal    { border-left: 4px solid var(--teal); }
.panel--flush   { padding-top: 0; }          /* for <section class="section panel--flush"> */

/* ─────────────────────────────────────────────────────────────────
   Layout utilities
   ───────────────────────────────────────────────────────────────── */
.u-row          { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.u-row-start    { display: flex; align-items: flex-start; gap: 1rem; flex-wrap: wrap; }
.u-row-between  { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.u-row-between-start { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.u-row-tight    { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.u-row-wrap-lg  { display: flex; gap: 1.5rem; flex-wrap: wrap; }
.u-col-actions  { display: flex; flex-direction: column; gap: .5rem; min-width: 150px; }
.u-actions-row  { display: flex; gap: .75rem; flex-wrap: wrap; margin-top: 1.25rem; }
.u-grid-1fr-auto{ display: grid; grid-template-columns: 1fr auto; gap: 1rem; align-items: flex-start; }
.u-flex-1       { flex: 1; }
.u-text-center  { text-align: center; }
.u-nowrap       { white-space: nowrap; }

/* ─────────────────────────────────────────────────────────────────
   Spacing utilities  (mt = margin-top, mb = margin-bottom, pt = padding-top)
   ───────────────────────────────────────────────────────────────── */
.u-mt-0  { margin-top: 0; }
.u-mt-2xs{ margin-top: .2rem; }
.u-mt-xs { margin-top: .35rem; }
.u-mt-s  { margin-top: .5rem; }
.u-mt-1  { margin-top: 1rem; }
.u-mt-sm { margin-top: .75rem; }
.u-mb-0  { margin-bottom: 0; }
.u-mb-xs { margin-bottom: .2rem; }
.u-mb-s  { margin-bottom: .4rem; }
.u-mb-1  { margin-bottom: 1rem; }
.u-mb-sm { margin-bottom: .85rem; }
.u-m-0   { margin: 0; }
.u-pt-0  { padding-top: 0; }

/* ─────────────────────────────────────────────────────────────────
   Typography utilities
   ───────────────────────────────────────────────────────────────── */
/* uppercase section label — same visual rhythm as .eyebrow but inline-usable as a div */
.u-label-xs {
  font-size: .72rem;
  font-weight: 700;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: .06em;
}
/* large stat number */
.u-stat-num        { font-size: 1.25rem; font-weight: 800; letter-spacing: -.03em; color: var(--primary); }
.u-stat-num--teal  { color: var(--teal); }
.u-stat-num--accent{ color: var(--accent); }
.u-stat-num--success{ color: var(--success); }
/* small unit beside a stat value */
.u-stat-unit { font-size: .8rem; font-weight: 500; color: var(--text-2); }
/* extra-small muted text */
.u-text-xs   { font-size: .72rem; color: var(--text-2); }
.u-text-sm   { font-size: .88rem; color: var(--text-2); }
.u-text-sm-muted { font-size: .88rem; color: var(--muted); }
.u-text-muted-sm { color: var(--text-2); font-size: .9rem; }

/* ─────────────────────────────────────────────────────────────────
   Progress page components
   ───────────────────────────────────────────────────────────────── */
/* XP level summary card (level emoji + name + bar + streak) */
.xp-summary-card {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: 1rem 1.25rem;
  background: var(--primary-light);
  border: 1.5px solid rgba(67,97,238,.18);
  border-radius: var(--radius);
  margin-bottom: 1.25rem;
}
.xp-summary-card__emoji   { font-size: 2.8rem; line-height: 1; }
.xp-summary-card__body    { flex: 1; }
.xp-summary-card__name    { font-weight: 800; font-size: 1.1rem; color: var(--primary); }
.xp-summary-card__sub     { color: var(--muted); font-size: .88rem; }
.xp-summary-card__streak  { text-align: center; }
.xp-summary-card__streak-icon  { font-size: 1.6rem; }
.xp-summary-card__streak-label { font-size: .78rem; font-weight: 700; color: var(--accent); }

/* vertical divider between side-by-side stats */
.u-vdivider { width: 1px; background: var(--border); align-self: stretch; }

/* ═════════════════════════════════════════════════════════════════
   ADMIN CMS  (Phase A polish, 2026-05-22)
   ═════════════════════════════════════════════════════════════════ */

/* Sub-navigation strip shared by every /admin/* page */
.admin-subnav {
  display: flex;
  align-items: center;
  gap: .25rem;
  flex-wrap: wrap;
  padding: .6rem .9rem;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 1.5rem;
  font-size: .88rem;
}
.admin-subnav__brand {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  font-weight: 700;
  color: var(--text);
  margin-right: .75rem;
  padding-right: .75rem;
  border-right: 1px solid var(--border);
}
.admin-subnav__brand-icon { font-size: 1.05rem; }
.admin-subnav a.admin-subnav__link {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: .35rem .7rem;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  text-decoration: none;
  font-weight: 500;
  transition: background .12s, color .12s;
}
.admin-subnav a.admin-subnav__link:hover  { background: var(--surface); color: var(--text); }
.admin-subnav a.admin-subnav__link.active { background: var(--primary-light); color: var(--primary); font-weight: 700; }

/* Publish-status badges (used in lesson list + lesson editor) */
.publish-badge {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: .15rem .55rem;
  font-size: .72rem;
  font-weight: 700;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: .04em;
  vertical-align: middle;
}
.publish-badge--published { background: color-mix(in srgb, var(--success) 18%, transparent); color: var(--success); }
.publish-badge--draft     { background: color-mix(in srgb, var(--accent)  18%, transparent); color: var(--accent); }
.publish-badge::before    { content: "●"; font-size: .65rem; }

/* Toggle row used in lesson editor (Published / Draft) */
.publish-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .75rem 1rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-soft);
}
.publish-toggle__label   { font-weight: 700; font-size: .92rem; }
.publish-toggle__sub     { font-size: .8rem; color: var(--text-2); margin-top: .15rem; }
.publish-toggle__switch  {
  position: relative;
  width: 46px;
  height: 26px;
  background: var(--border);
  border-radius: 13px;
  cursor: pointer;
  transition: background .15s;
  flex-shrink: 0;
}
.publish-toggle__switch::after {
  content: "";
  position: absolute;
  top: 3px; left: 3px;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: white;
  transition: transform .18s ease;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.publish-toggle input[type="checkbox"]:checked + .publish-toggle__switch              { background: var(--success); }
.publish-toggle input[type="checkbox"]:checked + .publish-toggle__switch::after       { transform: translateX(20px); }
.publish-toggle input[type="checkbox"]                                                { position: absolute; opacity: 0; pointer-events: none; }
.publish-toggle input[type="checkbox"]:focus-visible + .publish-toggle__switch        { box-shadow: 0 0 0 3px var(--primary-glow, rgba(67,97,238,.3)); }

/* Save indicator (floats next to the Save button) */
.save-indicator {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  font-size: .8rem;
  font-weight: 600;
  padding: .25rem .6rem;
  border-radius: var(--radius-sm);
  transition: opacity .2s, background .2s, color .2s;
  opacity: 0;
  pointer-events: none;
}
.save-indicator.is-dirty {
  opacity: 1;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 14%, transparent);
}
.save-indicator.is-saved {
  opacity: 1;
  color: var(--success);
  background: color-mix(in srgb, var(--success) 14%, transparent);
}
.save-indicator::before { content: "●"; font-size: .55rem; line-height: 1; }
.save-indicator.is-saved::before { content: "✓"; font-size: .8rem; }

/* Admin table — cleaner row/header styles (used by lesson list etc.) */
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .88rem;
}
.admin-table thead th {
  text-align: left;
  padding: .5rem .75rem;
  font-weight: 700;
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-2);
  border-bottom: 2px solid var(--border);
}
.admin-table tbody td {
  padding: .55rem .75rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.admin-table tbody tr:hover { background: var(--surface-soft); }
.admin-table .admin-table__slug { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .8rem; color: var(--muted); }
.admin-table .admin-table__actions { text-align: right; white-space: nowrap; }
.admin-table .admin-table__actions > * + * { margin-left: .35rem; }

/* CMS-specific helpers */
.cms-tab-strip {
  border-bottom: 2px solid var(--border);
  margin-bottom: 2rem;
  display: flex;
  gap: 0;
  overflow-x: auto;
}
.cms-tab-strip .section-tab { white-space: nowrap; }
.cms-form-grid       { gap: .75rem; margin-top: 1rem; }
.cms-input-grid-2    { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.cms-input-grid--tight { gap: .5rem; margin-bottom: .5rem; }
.cms-filter-input    { max-width: 200px; padding: .35rem .7rem; font-size: .85rem; }
.cms-table-wrap      { overflow-x: auto; }
.cms-full-width      { width: 100%; margin-bottom: .5rem; }
.cms-pg-title        { font-weight: 700; margin-bottom: .4rem; }
.form-input.form-input--sm { font-size: .85rem; padding: .35rem .55rem; }
.hidden              { display: none !important; }

/* Lesson editor layout */
.cms-edit-grid       { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; align-items: flex-start; }
@media (max-width: 900px) { .cms-edit-grid { grid-template-columns: 1fr; } }
.cms-label-xs        { font-size: .8rem; }
.cms-q-card          { margin-bottom: .6rem; }
.cms-q-form          { gap: .6rem; padding: .75rem 0 .25rem; }
.cms-q-add           { margin-top: 1rem; border: 2px dashed var(--border); border-radius: var(--radius); }
.cms-option-input    { margin-bottom: .3rem; }
.cms-media-row {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .6rem .75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .85rem;
}
.cms-media-row__body  { flex: 1; min-width: 0; }
.cms-media-row__title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cms-media-row__meta  { color: var(--muted); font-size: .78rem; }

/* Rubric editor rows (used in experience create + edit forms) */
.cms-rubric-fieldset {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .85rem 1rem;
  background: var(--surface-soft);
  margin: 0;
}
.cms-rubric-row {
  display: grid;
  grid-template-columns: 1fr 80px 1fr auto;
  gap: .5rem;
  align-items: center;
  margin-bottom: .4rem;
}
@media (max-width: 720px) {
  .cms-rubric-row { grid-template-columns: 1fr; }
}

/* Learning-space "Workshop activities" cards */
.experience-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}
.experience-card {
  display: flex;
  flex-direction: column;
  gap: .5rem;
  padding: 1.1rem 1.25rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  transition: border-color .15s, transform .12s;
}
.experience-card:hover { border-color: var(--primary); transform: translateY(-1px); }
.experience-card__title { font-weight: 700; font-size: 1.02rem; }
.experience-card__summary { font-size: .88rem; color: var(--text-2); line-height: 1.5; flex: 1; }
.experience-card__meta { display: flex; gap: .35rem; flex-wrap: wrap; font-size: .75rem; color: var(--muted); }

/* ═════════════════════════════════════════════════════════════════
   INLINE MEDIA PLAYERS  (Phase Multimedia, 2026-05-22)
   Used by _media_player.html macro across lesson detail pages.
   ═════════════════════════════════════════════════════════════════ */

.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.25rem;
  margin-top: .75rem;
}

.media-item {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: .4rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .65rem;
  background: var(--surface);
}
.media-item__caption {
  font-size: .82rem;
  color: var(--text-2);
  line-height: 1.45;
  padding: 0 .15rem;
}
.media-item__caption-desc { color: var(--muted); }

/* Video file player */
.media-item__video {
  width: 100%;
  max-height: 420px;
  border-radius: var(--radius-sm);
  background: #000;
  display: block;
}

/* Embedded YouTube / Vimeo iframe (16:9) */
.media-item__iframe-wrap {
  position: relative;
  width: 100%;
  padding-top: 56.25%; /* 16:9 */
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: #000;
}
.media-item__iframe-wrap iframe {
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* Audio player */
.media-item__audio-wrap {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: .65rem .85rem;
  background: var(--surface-soft);
  border-radius: var(--radius-sm);
}
.media-item__audio-icon { font-size: 1.65rem; line-height: 1; flex-shrink: 0; }
.media-item__audio { flex: 1; min-width: 0; }

/* Image card */
.media-item__img-link { display: block; }
.media-item__img {
  width: 100%;
  height: auto;
  border-radius: var(--radius-sm);
  display: block;
}

/* PDF viewer */
.media-item__pdf-wrap {
  width: 100%;
  height: 500px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--surface-soft);
  border: 1px solid var(--border);
}
.media-item__pdf {
  width: 100%;
  height: 100%;
  border: 0;
}
@media (max-width: 720px) {
  .media-item__pdf-wrap { height: 360px; }
}

/* Generic file / link card */
.media-item__file-card {
  display: flex;
  align-items: center;
  gap: .85rem;
  padding: .65rem .85rem;
  background: var(--surface-soft);
  border-radius: var(--radius-sm);
}
.media-item__file-icon  { font-size: 1.55rem; line-height: 1; flex-shrink: 0; }
.media-item__file-body  { flex: 1; min-width: 0; }
.media-item__file-title { font-weight: 700; font-size: .92rem; }
.media-item__file-desc  { font-size: .8rem; color: var(--text-2); line-height: 1.45; margin-top: .15rem; }

/* ═════════════════════════════════════════════════════════════════
   THEORY CARD · READ-ALOUD BUTTON  (TTS, 2026-05-22)
   ═════════════════════════════════════════════════════════════════ */

.theory-card__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: .5rem;
}
.theory-card__tts {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 50%;
  cursor: pointer;
  font-size: .95rem;
  line-height: 1;
  padding: 0;
  transition: background .15s, border-color .15s, transform .12s;
}
.theory-card__tts:hover         { background: var(--surface-soft); border-color: var(--primary); }
.theory-card__tts:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.theory-card__tts.is-playing {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
  animation: ttsPulse 1.6s ease-in-out infinite;
}
@keyframes ttsPulse {
  0%, 100% { box-shadow: 0 0 0 0   rgba(67,97,238,.0); }
  50%      { box-shadow: 0 0 0 6px rgba(67,97,238,.2); }
}
@media (prefers-reduced-motion: reduce) {
  .theory-card__tts.is-playing { animation: none; }
}

/* ═════════════════════════════════════════════════════════════════
   INLINE PROMPT SANDBOX RESULT  (Interactivity I1, 2026-05-22)
   The "Run inline" result panel inside the Examples tab sandbox.
   ═════════════════════════════════════════════════════════════════ */
.sandbox-result {
  margin-top: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-soft);
  padding: .85rem 1rem;
}
.sandbox-result__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  margin-bottom: .5rem;
  flex-wrap: wrap;
}
.sandbox-result__actions { display: flex; align-items: center; gap: .5rem; }
.sandbox-result__status {
  font-size: .78rem;
  font-weight: 600;
  color: var(--text-2);
  display: inline-flex;
  align-items: center;
  gap: .3rem;
}
.sandbox-result__status::before {
  content: "●";
  font-size: .55rem;
  line-height: 1;
}
.sandbox-result__status.is-streaming { color: var(--primary); }
.sandbox-result__status.is-streaming::before { animation: sandboxBlink 1s ease-in-out infinite; }
.sandbox-result__status.is-done      { color: var(--success); }
.sandbox-result__status.is-done::before { content: "✓"; font-size: .8rem; }
.sandbox-result__status.is-error     { color: var(--danger, #d9534f); }
.sandbox-result__status.is-error::before { content: "⚠"; font-size: .8rem; }
@keyframes sandboxBlink {
  0%, 100% { opacity: 1; }
  50%      { opacity: .25; }
}
@media (prefers-reduced-motion: reduce) {
  .sandbox-result__status.is-streaming::before { animation: none; }
}
.sandbox-result__body {
  font-size: .92rem;
  line-height: 1.6;
  white-space: pre-wrap;
  word-wrap: break-word;
  background: var(--surface);
  padding: .75rem .9rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  min-height: 3rem;
  max-height: 420px;
  overflow-y: auto;
  font-family: var(--font);
}

/* ═════════════════════════════════════════════════════════════════
   EXPERIENCE — KIND PICKER  (admin editor, Phase I2, 2026-05-22)
   ═════════════════════════════════════════════════════════════════ */
.kind-picker {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: .75rem;
  margin-top: .5rem;
}
.kind-picker__option {
  display: flex;
  align-items: flex-start;
  gap: .65rem;
  padding: .85rem 1rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  background: var(--surface);
  transition: border-color .15s, background .15s;
}
.kind-picker__option:hover     { border-color: var(--primary); }
.kind-picker__option.is-active { border-color: var(--primary); background: var(--primary-light); }
.kind-picker__option input[type="radio"] { margin-top: .25rem; flex-shrink: 0; }
.kind-picker__option strong    { display: block; margin-bottom: .15rem; }

/* ═════════════════════════════════════════════════════════════════
   EXPERIENCE — BUILDER UI  (admin + learner, Phase I2)
   ═════════════════════════════════════════════════════════════════ */
.builder-step-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .75rem .9rem;
  background: var(--surface);
  margin-bottom: .65rem;
}
.builder-step-card__head {
  font-weight: 700;
  font-size: .9rem;
  margin-bottom: .5rem;
}

/* Learner-facing builder step */
.builder-step {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .85rem 1rem;
  background: var(--surface);
}
.builder-step__head {
  display: flex;
  align-items: center;
  gap: .45rem;
  margin-bottom: .55rem;
  flex-wrap: wrap;
}
.builder-step__icon { font-size: 1.15rem; line-height: 1; }
.builder-step__hint { color: var(--text-2); font-size: .82rem; }
.builder-step__input {
  width: 100%;
  margin-bottom: .5rem;
}
.builder-step__suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
}
.builder-step__suggestion {
  cursor: pointer;
  font-size: .75rem;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  transition: background .12s, border-color .12s;
}
.builder-step__suggestion:hover {
  background: var(--primary-light);
  border-color: var(--primary);
}

/* Live preview pane */
.builder-preview {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: .88rem;
  line-height: 1.6;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .9rem 1rem;
  margin: .5rem 0 0;
  min-height: 8rem;
  white-space: pre-wrap;
  color: var(--text);
}
.builder-preview.is-empty { color: var(--muted); font-style: italic; }

/* ═════════════════════════════════════════════════════════════════
   PROGRESS · RECOMMENDED NEXT STEP CARD  (G6, 2026-05-22)
   The actionable "what should I do next?" hero on /progress.
   ═════════════════════════════════════════════════════════════════ */
.next-step-card {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: 1.1rem 1.4rem;
  background: linear-gradient(135deg, var(--primary-light) 0%, color-mix(in srgb, var(--primary) 8%, var(--surface)) 100%);
  border: 1.5px solid var(--primary);
  border-radius: var(--radius);
  text-decoration: none;
  color: inherit;
  transition: transform .15s, box-shadow .15s, border-color .15s;
}
.next-step-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px color-mix(in srgb, var(--primary) 22%, transparent);
  border-color: var(--primary-dark, var(--primary));
}
.next-step-card__icon {
  font-size: 2.6rem;
  line-height: 1;
  flex-shrink: 0;
}
.next-step-card__body { flex: 1; min-width: 0; }
.next-step-card__eyebrow {
  font-size: .72rem;
  font-weight: 700;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-bottom: .25rem;
}
.next-step-card__title {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--text);
  margin-bottom: .15rem;
}
.next-step-card__summary {
  font-size: .92rem;
  color: var(--text-2);
  line-height: 1.5;
}
.next-step-card__cta {
  flex-shrink: 0;
  background: var(--primary);
  color: white;
  padding: .55rem 1rem;
  border-radius: var(--radius-full);
  font-weight: 700;
  font-size: .9rem;
  white-space: nowrap;
}
@media (max-width: 720px) {
  .next-step-card { flex-direction: column; text-align: center; align-items: flex-start; }
  .next-step-card__cta { align-self: stretch; text-align: center; }
}

/* ═════════════════════════════════════════════════════════════════
   PROGRESS · LEARNING PATH PICKER  (Locked-path, 2026-05-22)
   The only place users can change teen/teacher/young-pro mode.
   ═════════════════════════════════════════════════════════════════ */
.path-picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: .65rem;
}
.path-picker-card__option {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .85rem 1rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  text-decoration: none;
  color: inherit;
  transition: border-color .15s, background .15s, transform .12s;
}
.path-picker-card__option:hover { border-color: var(--primary); transform: translateY(-1px); }
.path-picker-card__option.is-active {
  border-color: var(--primary);
  background: var(--primary-light);
  cursor: default;
}
.path-picker-card__icon { font-size: 1.8rem; line-height: 1; flex-shrink: 0; }

/* Admin learner-flow policy form rows */
.settings-row {
  padding: .65rem 0;
  border-bottom: 1px solid var(--border);
}
.settings-row:last-of-type { border-bottom: none; }
.settings-row__main {
  display: flex;
  align-items: flex-start;
  gap: .65rem;
  cursor: pointer;
}
.settings-row__main input[type="checkbox"] {
  width: 18px; height: 18px;
  margin-top: .15rem;
  flex-shrink: 0;
}
.settings-row__main strong { display: block; margin-bottom: .15rem; font-size: .94rem; }

/* ═════════════════════════════════════════════════════════════════
   ADMIN · MODULE ORDER + FLOW DOTS  (2026-05-22)
   Order arrows in the lessons list + 5-part completeness display.
   ═════════════════════════════════════════════════════════════════ */
.module-order-cell {
  display: flex;
  align-items: center;
  gap: .5rem;
}
.module-order-cell__pos {
  font-weight: 800;
  font-size: 1rem;
  color: var(--text);
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--primary-light);
  color: var(--primary);
  border-radius: var(--radius-sm);
}
.module-order-cell__arrows {
  display: flex;
  flex-direction: column;
  gap: .15rem;
}
.module-order-cell__arrow {
  background: var(--surface-soft);
  border: 1px solid var(--border);
  color: var(--text-2);
  width: 22px;
  height: 18px;
  line-height: 1;
  font-size: .8rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  padding: 0;
  transition: background .12s, color .12s, border-color .12s;
}
.module-order-cell__arrow:hover:not(:disabled) {
  background: var(--primary-light);
  color: var(--primary);
  border-color: var(--primary);
}
.module-order-cell__arrow:disabled { opacity: .35; cursor: not-allowed; }

.flow-dots {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  flex-wrap: wrap;
}
.flow-dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 22px;
  padding: 0 .35rem;
  font-size: .68rem;
  font-weight: 700;
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--danger, #d9534f) 14%, transparent);
  color: var(--danger, #d9534f);
  border: 1px solid color-mix(in srgb, var(--danger, #d9534f) 28%, transparent);
}
.flow-dot--ok {
  background: color-mix(in srgb, var(--success) 14%, transparent);
  color: var(--success);
  border-color: color-mix(in srgb, var(--success) 40%, transparent);
}
.flow-ready {
  display: inline-flex;
  align-items: center;
  padding: .15rem .55rem;
  font-size: .72rem;
  font-weight: 700;
  border-radius: var(--radius-full);
  margin-left: .35rem;
}
.flow-ready--yes     { background: var(--success); color: white; }
.flow-ready--partial { background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--accent); }
.flow-ready--no      { background: color-mix(in srgb, var(--danger, #d9534f) 14%, transparent); color: var(--danger, #d9534f); }

/* ═════════════════════════════════════════════════════════════════
   ADMIN · MODULE FLOW STRIP  (Linear flow, 2026-05-22)
   Top-of-editor view showing Module → Practice → Evaluation status.
   ═════════════════════════════════════════════════════════════════ */
.module-flow-strip {
  display: flex;
  align-items: stretch;
  gap: .5rem;
  padding: .85rem 1rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  flex-wrap: wrap;
}
.module-flow-strip__step {
  flex: 1;
  min-width: 200px;
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: .55rem .75rem;
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: inherit;
  background: var(--surface-soft);
  border: 1px solid transparent;
  transition: border-color .15s, background .15s;
}
.module-flow-strip__step:hover { border-color: var(--primary); }
.module-flow-strip__step.is-authored {
  background: color-mix(in srgb, var(--success) 12%, transparent);
  border-color: color-mix(in srgb, var(--success) 40%, transparent);
}
.module-flow-strip__num {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--surface);
  color: var(--text-2);
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: .9rem;
  border: 1px solid var(--border);
}
.module-flow-strip__step.is-authored .module-flow-strip__num {
  background: var(--success);
  color: white;
  border-color: var(--success);
}
.module-flow-strip__label {
  font-weight: 700;
  font-size: .9rem;
  line-height: 1.2;
}
.module-flow-strip__status {
  font-size: .78rem;
  color: var(--text-2);
  margin-top: .15rem;
  line-height: 1.4;
}
.module-flow-strip__step.is-authored .module-flow-strip__status { color: var(--success); }
.module-flow-strip__arrow {
  align-self: center;
  font-size: 1.1rem;
  color: var(--muted);
  flex-shrink: 0;
}
@media (max-width: 720px) {
  .module-flow-strip__arrow { display: none; }
}

/* Publish-readiness banner under the flow strip */
.flow-ready-banner {
  margin-top: .75rem;
  padding: .85rem 1.1rem;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.flow-ready-banner strong { display: block; margin-bottom: .15rem; }
.flow-ready-banner code   { font-size: .82rem; }
.flow-ready-banner--ready {
  background: color-mix(in srgb, var(--success) 14%, transparent);
  border: 1.5px solid var(--success);
  color: var(--text);
}
.flow-ready-banner--live {
  background: var(--primary-light);
  border: 1.5px solid var(--primary);
  color: var(--text);
}
.flow-ready-banner--partial {
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  border: 1.5px solid color-mix(in srgb, var(--accent) 50%, transparent);
  color: var(--text);
  display: block;
}

/* Module cards on /learn — locked / in-progress / complete states. */
.module-card { position: relative; transition: opacity .15s, border-color .15s; }
.module-card--locked        { opacity: .55; filter: saturate(.6); }
.module-card--locked:hover  { opacity: .75; }
.module-card--done {
  border-color: color-mix(in srgb, var(--success) 35%, var(--border));
  background: color-mix(in srgb, var(--success) 4%, var(--surface));
}
.module-card__steps {
  display: inline-flex;
  gap: .35rem;
  margin-top: .65rem;
  padding: .25rem .55rem;
  background: var(--surface-soft);
  border-radius: var(--radius-full);
  width: fit-content;
}
.module-card__step {
  font-size: 1rem;
  opacity: .35;
  filter: grayscale(.6);
  transition: opacity .15s, filter .15s;
}
.module-card__step.is-done { opacity: 1; filter: none; }

/* Lesson completion strip in the hero — tells the learner where they
   are in the curriculum and whether this module counts yet. */
.lesson-status {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .3rem .7rem;
  border-radius: var(--radius-full);
  background: var(--surface-soft);
  border: 1px solid var(--border);
  font-size: .8rem;
  color: var(--text-2);
  margin: .6rem 0 1rem;
}
.lesson-status__pos { font-weight: 700; color: var(--text); }
.lesson-status__sep { opacity: .5; }
.lesson-status--done {
  background: color-mix(in srgb, var(--success) 12%, transparent);
  border-color: color-mix(in srgb, var(--success) 40%, transparent);
  color: var(--success);
}
.lesson-status--done .lesson-status__pos { color: var(--success); }
.lesson-status--done .lesson-status__state { font-weight: 700; }
.lesson-status__steps { display: inline-flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.lesson-step {
  display: inline-flex;
  align-items: center;
  gap: .2rem;
  padding: .1rem .4rem;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: .74rem;
  opacity: .55;
}
.lesson-step.is-done {
  opacity: 1;
  background: color-mix(in srgb, var(--success) 18%, transparent);
  border-color: color-mix(in srgb, var(--success) 50%, transparent);
  color: var(--success);
  font-weight: 600;
}

/* End-of-quiz completion banner — the natural place to "Mark complete". */
.lesson-complete-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
  border-radius: var(--radius);
  margin-top: 1rem;
  flex-wrap: wrap;
}
.lesson-complete-banner strong { display: block; margin-bottom: .15rem; }
.lesson-complete-banner--cta {
  background: color-mix(in srgb, var(--primary) 8%, transparent);
  border: 1.5px solid var(--primary);
}
.lesson-complete-banner--done {
  background: color-mix(in srgb, var(--success) 12%, transparent);
  border: 1.5px solid var(--success);
  color: var(--text);
}
.button-lg { padding: .65rem 1.25rem; font-size: 1rem; }

/* Hero "More ▾" overflow menu — keeps the hero clean by hiding secondary
   actions (worksheet PDF, mark complete, path change) behind one click */
.lesson-hero-more { position: relative; display: inline-block; }
.lesson-hero-more > summary {
  list-style: none;
  cursor: pointer;
  user-select: none;
}
.lesson-hero-more > summary::-webkit-details-marker { display: none; }
.lesson-hero-more[open] > summary { background: var(--surface-soft); }
.lesson-hero-more__menu {
  position: absolute;
  top: calc(100% + .35rem);
  right: 0;
  min-width: 240px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0,0,0,.08);
  padding: .35rem;
  display: flex;
  flex-direction: column;
  gap: .15rem;
  z-index: 50;
}
.lesson-hero-more__menu a,
.lesson-hero-more__menu button {
  display: block;
  width: 100%;
  text-align: left;
  padding: .5rem .75rem;
  border: none;
  background: transparent;
  color: var(--text);
  text-decoration: none;
  font-size: .88rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.lesson-hero-more__menu a:hover,
.lesson-hero-more__menu button:hover { background: var(--surface-soft); }

/* ═════════════════════════════════════════════════════════════════
   HOME · BASELINE INVITE BANNER  (Linear flow, 2026-05-22)
   First-visit nudge to take the pre-assessment.
   ═════════════════════════════════════════════════════════════════ */
.baseline-invite {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: 1.1rem 1.4rem;
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 14%, var(--surface)) 0%, var(--surface) 100%);
  border: 1.5px solid var(--accent);
  border-radius: var(--radius);
}
.baseline-invite__icon  { font-size: 2.4rem; line-height: 1; flex-shrink: 0; }
.baseline-invite__body  { flex: 1; min-width: 0; }
.baseline-invite__eyebrow {
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--accent);
  margin-bottom: .25rem;
}
.baseline-invite__title {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text);
  margin-bottom: .2rem;
}
.baseline-invite__sub {
  font-size: .88rem;
  color: var(--text-2);
  line-height: 1.5;
}
.baseline-invite__actions {
  display: flex;
  flex-direction: column;
  gap: .35rem;
  flex-shrink: 0;
  align-items: stretch;
}
@media (max-width: 720px) {
  .baseline-invite { flex-direction: column; align-items: flex-start; text-align: left; }
  .baseline-invite__actions { flex-direction: row; align-self: stretch; }
}

/* ═════════════════════════════════════════════════════════════════
   MODULE · NEXT STEPS FOOTER  (Linear flow, 2026-05-22)
   The numbered "do this next" panel at the bottom of every module page.
   ═════════════════════════════════════════════════════════════════ */
.module-nextsteps__head { margin-bottom: 1rem; }

.module-nextsteps__status {
  display: flex;
  flex-wrap: wrap;
  gap: .45rem;
  margin: 0 0 1rem;
}
.module-nextsteps__status span {
  padding: .35rem .6rem;
  border-radius: 999px;
  background: var(--surface-2, var(--surface));
  color: var(--text-2);
  font-size: .78rem;
  font-weight: 700;
}
.module-nextsteps__status span.is-done {
  background: color-mix(in srgb, var(--teal) 14%, transparent);
  color: var(--teal);
}

.module-nextsteps__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: .65rem;
}
.module-nextsteps__single {
  display: flex;
  align-items: center;
  gap: .75rem;
  flex-wrap: wrap;
  padding: .85rem 1rem;
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--primary-light) 48%, var(--surface));
}
.module-nextsteps__single > span {
  color: var(--text-2);
  font-size: .86rem;
}
.module-nextsteps__step {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: .95rem 1.1rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  text-decoration: none;
  color: inherit;
  transition: border-color .15s, transform .12s, box-shadow .15s;
}
.module-nextsteps__step:hover {
  transform: translateY(-1px);
  border-color: var(--primary);
  box-shadow: 0 4px 12px color-mix(in srgb, var(--primary) 12%, transparent);
}
.module-nextsteps__step[aria-disabled="true"] {
  opacity: .7;
  cursor: not-allowed;
}
.module-nextsteps__step[aria-disabled="true"]:hover {
  transform: none;
  border-color: var(--border);
  box-shadow: none;
}
.module-nextsteps__num {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}
.module-nextsteps__step--practice .module-nextsteps__num { background: color-mix(in srgb, var(--teal) 18%, transparent); color: var(--teal); }
.module-nextsteps__step--evaluate .module-nextsteps__num { background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--accent); }
.module-nextsteps__step--next     .module-nextsteps__num { background: var(--primary-light); color: var(--primary); }
.module-nextsteps__step--certificate .module-nextsteps__num { background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--accent); }

.module-nextsteps__title {
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: .1rem;
}
.module-nextsteps__sub {
  font-size: .85rem;
  color: var(--text-2);
  line-height: 1.45;
}
.module-nextsteps__arrow {
  margin-left: auto;
  font-size: 1.3rem;
  color: var(--muted);
  transition: transform .15s, color .15s;
}
.module-nextsteps__step:hover .module-nextsteps__arrow {
  transform: translateX(3px);
  color: var(--primary);
}
.module-nextsteps__back {
  margin-top: .85rem;
  font-size: .82rem;
}
.module-nextsteps__back a {
  color: var(--text-2);
  text-decoration: none;
}
.module-nextsteps__back a:hover { color: var(--primary); text-decoration: underline; }

/* ═════════════════════════════════════════════════════════════════
   PLAYGROUND · SCENARIO CARD  (Linear flow, 2026-05-22)
   Turns the playground from a blank textarea into a guided exercise.
   ═════════════════════════════════════════════════════════════════ */
.pg-scenario {
  margin: .5rem 0 1rem;
  padding: 1rem 1.25rem;
  background: linear-gradient(135deg, var(--primary-light) 0%, color-mix(in srgb, var(--primary) 5%, var(--surface)) 100%);
  border: 1.5px solid var(--primary);
  border-radius: var(--radius);
}
.pg-scenario__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  margin-bottom: .35rem;
}
.pg-scenario__title {
  font-size: 1.15rem;
  font-weight: 800;
  margin: 0 0 .4rem;
  color: var(--text);
}
.pg-scenario__task strong { color: var(--primary); }
.pg-scenario__task {
  max-width: 72ch;
  font-size: 1rem;
  line-height: 1.6;
}
.pg-scenario__task {
  font-size: .95rem;
  line-height: 1.55;
  color: var(--text);
  margin: 0 0 .65rem;
}

.pg-scenario__success {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .65rem .9rem;
  margin-bottom: .65rem;
}
.pg-scenario__success-label {
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-2);
  margin-bottom: .35rem;
}
.pg-scenario__success ul {
  margin: 0;
  padding-left: 1.2rem;
  font-size: .88rem;
  line-height: 1.6;
  color: var(--text);
}
.pg-scenario__success li { margin-bottom: .15rem; }

.pg-scenario__actions {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
}
.pg-scenario__free { white-space: nowrap; }

.pg-journey {
  margin-top: .9rem;
  padding-top: .8rem;
  border-top: 1px solid color-mix(in srgb, var(--primary) 20%, var(--border));
}
.pg-journey__heading {
  display: flex;
  justify-content: space-between;
  gap: .75rem;
  align-items: baseline;
  margin-bottom: .55rem;
}
.pg-journey__heading strong { color: var(--primary-dark); font-size: .88rem; }
.pg-journey__heading span { color: var(--muted); font-size: .78rem; }
.pg-journey__steps {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: .35rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.pg-journey__step {
  display: flex;
  align-items: center;
  gap: .35rem;
  min-width: 0;
  padding: .45rem .5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--muted);
}
.pg-journey__step.is-current { border-color: var(--primary); background: var(--primary-light); color: var(--primary-dark); }
.pg-journey__step.is-done { border-color: color-mix(in srgb, var(--success) 45%, var(--border)); background: color-mix(in srgb, var(--success) 10%, var(--surface)); color: var(--success); }
.pg-journey__number {
  display: grid;
  place-items: center;
  flex: 0 0 1.35rem;
  width: 1.35rem;
  height: 1.35rem;
  border-radius: 50%;
  background: var(--surface-soft);
  font-size: .72rem;
  font-weight: 800;
}
.pg-journey__copy { min-width: 0; }
.pg-journey__copy strong, .pg-journey__copy small { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pg-journey__copy strong { font-size: .74rem; }
.pg-journey__copy small { font-size: .64rem; opacity: .85; }
.pg-journey__hint { margin: .6rem 0 0; color: var(--text-2); font-size: .82rem; }
.pg-next-step {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  padding: .7rem .8rem;
  border: 1.5px solid var(--success);
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--success) 9%, var(--surface));
}
.pg-next-step[hidden] { display: none; }
.pg-next-step strong, .pg-next-step span { display: block; }
.pg-next-step strong { color: var(--success); font-size: .88rem; }
.pg-next-step span { margin-top: .15rem; color: var(--text-2); font-size: .78rem; }
.pg-response-next {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 1rem;
  padding: 1rem;
  border: 2px solid var(--success);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--success) 10%, var(--surface));
}
.pg-response-next[hidden] { display: none; }
.pg-response-next strong,
.pg-response-next span { display: block; }
.pg-response-next strong { color: var(--success); font-size: 1rem; }
.pg-response-next span { margin-top: .2rem; color: var(--text-2); font-size: .86rem; }

.pg-scenario--compact {
  padding: .9rem 1.15rem;
  margin-bottom: .75rem;
}
.pg-scenario--compact .pg-scenario__head { margin-bottom: .15rem; }
.pg-scenario--compact .pg-scenario__title { font-size: 1.1rem; margin-bottom: .25rem; }
.pg-scenario--compact .pg-scenario__task { margin-bottom: .5rem; font-size: .92rem; }
.pg-scenario--compact .pg-scenario__success { padding: .5rem .8rem; margin-bottom: .55rem; }
.pg-scenario--compact .pg-scenario__success-label { font-size: .68rem; margin-bottom: .2rem; }
.pg-scenario--compact .pg-scenario__success ul { display: flex; flex-wrap: wrap; gap: .15rem 1.1rem; padding-left: 1.1rem; font-size: .82rem; line-height: 1.45; }
.pg-scenario--compact .pg-scenario__success li { margin-bottom: 0; }
.pg-scenario + .pg-split .pg-textarea-wrap textarea { min-height: 100px; }

/* A simple visual rhythm for learners who need the next action made obvious. */
.pg-howto {
  display: flex;
  align-items: center;
  gap: .4rem;
  padding: .55rem .7rem;
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
  color: var(--muted);
  font-size: .82rem;
}
.pg-howto__label { color: var(--text-2); font-weight: 800; }
.pg-howto__step { display: inline-flex; align-items: center; gap: .3rem; white-space: nowrap; }
.pg-howto__step b {
  display: inline-grid;
  place-items: center;
  width: 1.35rem;
  height: 1.35rem;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-2);
  font-size: .75rem;
}
.pg-howto__step.is-current { color: var(--primary); font-weight: 700; }
.pg-howto__step.is-current b { background: var(--primary); border-color: var(--primary); color: white; }
.pg-howto__arrow { color: var(--border-strong); }
.pg-prompt-help { display: block; color: var(--muted); font-size: .82rem; line-height: 1.45; }

.pg-advanced-tools {
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  padding: .55rem .75rem;
}
.pg-advanced-tools summary { cursor: pointer; color: var(--text-2); font-weight: 700; list-style: none; }
.pg-advanced-tools summary::-webkit-details-marker { display: none; }
.pg-advanced-tools summary span { color: var(--muted); font-weight: 400; font-size: .82rem; }
.pg-advanced-tools[open] summary { color: var(--primary); }
.pg-advanced-tools__body { display: grid; gap: .65rem; padding-top: .65rem; }

@media (max-width: 720px) {
  .pg-scenario__head { flex-direction: column; align-items: flex-start; gap: .35rem; }
  .pg-howto { justify-content: space-between; }
  .pg-howto__arrow { display: none; }
  .pg-journey__steps { grid-template-columns: 1fr; gap: .3rem; }
  .pg-journey__step { padding: .4rem .55rem; }
  .pg-journey__copy strong, .pg-journey__copy small { white-space: normal; }
  .pg-next-step { align-items: flex-start; flex-direction: column; }
  .pg-next-step .button { width: 100%; }
  .pg-response-next { align-items: stretch; flex-direction: column; }
  .pg-response-next .button { width: 100%; text-align: center; }
}

/* ═════════════════════════════════════════════════════════════════
   LESSON EDITOR · REPEATING ROWS  (Phase B, 2026-05-22)
   Used by theory-card editor + examples editor in admin_lesson_edit.html.
   Drag handle on the left, fields in the middle, remove on the right.
   ═════════════════════════════════════════════════════════════════ */
.lesson-editor-row {
  display: grid;
  grid-template-columns: 28px 1fr 36px;
  gap: .5rem;
  align-items: flex-start;
  padding: .6rem .65rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  margin-bottom: .4rem;
  transition: border-color .12s, opacity .12s, transform .12s;
}
.lesson-editor-row:hover { border-color: var(--primary); }
.lesson-editor-row.is-dragging   { opacity: .35; }
.lesson-editor-row.is-drop-target {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent);
}
.lesson-editor-row__drag {
  cursor: grab;
  user-select: none;
  font-size: 1.15rem;
  color: var(--muted);
  line-height: 1;
  text-align: center;
  padding-top: .35rem;
}
.lesson-editor-row__drag:active { cursor: grabbing; }
.lesson-editor-row__body {
  display: flex;
  flex-direction: column;
  gap: .35rem;
  min-width: 0;
}
.lesson-editor-row__body input,
.lesson-editor-row__body textarea { width: 100%; }
.lesson-editor-row__remove {
  font-size: 1.2rem;
  line-height: 1;
  padding: .35rem .55rem;
  color: var(--text-2);
}
.lesson-editor-row__remove:hover { color: var(--danger, #d9534f); }
@media (max-width: 720px) {
  .lesson-editor-row { grid-template-columns: 24px 1fr 32px; }
}

/* Provider grid in admin dashboard (was inline <style> in admin.html) */
.provider-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: .5rem; }
.provider-card {
  display: flex; gap: .5rem;
  padding: .65rem .75rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.provider-card:hover { border-color: var(--primary); }
.provider-card.is-active { border-color: var(--primary); background: var(--primary-light); }
.provider-card.is-disabled { opacity: .55; }
.provider-card input[type=radio] { margin-top: .15rem; flex-shrink: 0; }
.provider-card-body { display: flex; flex-direction: column; gap: .25rem; }
.provider-status { display: flex; gap: .25rem; flex-wrap: wrap; }
