:root,
[data-theme="light"] {
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-subtle: #f8fafc;
  --surface-hover: #f1f5f9;
  --border: #e5e7eb;
  --border-strong: #d1d5db;
  --text: #0f172a;
  --text-muted: #475569;
  --text-faint: #64748b;

  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-soft: #eff6ff;
  --primary-border: #bfdbfe;

  --emerald: #059669;
  --emerald-soft: #ecfdf5;
  --emerald-border: #a7f3d0;

  --amber: #b45309;
  --amber-soft: #fffbeb;
  --amber-border: #fde68a;

  --rose: #dc2626;
  --rose-soft: #fef2f2;
  --rose-border: #fecaca;

  --violet: #6d28d9;
  --violet-soft: #f5f3ff;
  --violet-border: #ddd6fe;

  --code-bg: #0f172a;
  --code-text: #e2e8f0;
  --code-muted: #94a3b8;
  --code-green: #4ade80;

  --shadow-lg: 0 14px 36px rgba(15, 23, 42, 0.14);

  --radius-sm: 6px;
  --radius-md: 8px;
  --font-sans: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", "SFMono-Regular", ui-monospace, Menlo, Monaco, Consolas, monospace;
}

[data-theme="dark"] {
  --bg: #0b1120;
  --surface: #0b1120;
  --surface-subtle: #111827;
  --surface-hover: #1e293b;
  --border: #1e293b;
  --border-strong: #334155;
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --text-faint: #64748b;

  --primary: #3b82f6;
  --primary-hover: #60a5fa;
  --primary-soft: rgba(59, 130, 246, 0.12);
  --primary-border: rgba(59, 130, 246, 0.35);

  --emerald: #10b981;
  --emerald-soft: rgba(16, 185, 129, 0.12);
  --emerald-border: rgba(16, 185, 129, 0.32);

  --amber: #f59e0b;
  --amber-soft: rgba(245, 158, 11, 0.12);
  --amber-border: rgba(245, 158, 11, 0.32);

  --rose: #ef4444;
  --rose-soft: rgba(239, 68, 68, 0.12);
  --rose-border: rgba(239, 68, 68, 0.32);

  --violet: #a78bfa;
  --violet-soft: rgba(167, 139, 250, 0.12);
  --violet-border: rgba(167, 139, 250, 0.32);

  --code-bg: #020617;
  --code-text: #e2e8f0;
  --code-muted: #64748b;
  --code-green: #4ade80;

  --shadow-lg: 0 18px 42px rgba(0, 0, 0, 0.65);
}

*, *::before, *::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

button, input, textarea, select {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

/* App Shell */
.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.topbar-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  min-height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 24px;
  min-width: 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  flex-shrink: 0;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: var(--primary);
  color: #ffffff;
}

.brand strong {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.nav-tabs {
  display: flex;
  align-items: center;
  gap: 2px;
  overflow-x: auto;
}

.nav-tab {
  position: relative;
  background: transparent;
  border: none;
  padding: 16px 11px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
}

.nav-tab:hover {
  color: var(--text);
}

.nav-tab.is-active {
  color: var(--text);
}

.nav-tab.is-active::after {
  content: "";
  position: absolute;
  left: 11px;
  right: 11px;
  bottom: 0;
  height: 2px;
  background: var(--primary);
  border-radius: 2px 2px 0 0;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  font-size: 13px;
  color: var(--text-muted);
}

.topbar-stat {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
}

.stat-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--emerald);
}

.topbar-sep {
  color: var(--border-strong);
}

.text-btn {
  background: transparent;
  border: none;
  padding: 4px 7px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
}

.text-btn:hover {
  background: var(--surface-hover);
  color: var(--text);
}

/* Main Workspace */
.main-view {
  flex: 1;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 36px 24px 72px;
}

.narrow {
  max-width: 760px;
  margin: 0 auto;
}

/* Typography & Section Rhythm */
.page-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.page-title {
  margin: 0;
  font-size: 26px;
  font-weight: 750;
  letter-spacing: -0.025em;
  line-height: 1.2;
}

.page-sub {
  margin: 6px 0 0;
  color: var(--text-muted);
  font-size: 14.5px;
}

.section-label {
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-faint);
  margin: 0 0 12px;
}

.section-block {
  padding-top: 28px;
  margin-top: 28px;
  border-top: 1px solid var(--border);
}

/* Quiet Inline Metric Strip (replaces 4 KPI cards) */
.metric-strip {
  display: flex;
  align-items: center;
  gap: 28px;
  flex-wrap: wrap;
  padding: 14px 0 22px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 26px;
}

.metric-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.metric-label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-faint);
}

.metric-value {
  font-size: 18px;
  font-weight: 750;
  letter-spacing: -0.02em;
  color: var(--text);
}

.metric-value span {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-faint);
}

.metric-xp {
  min-width: 150px;
}

.progress-bar {
  width: 100%;
  height: 5px;
  border-radius: 999px;
  background: var(--border);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--primary);
  transition: width 0.25s ease;
}

.progress-fill.emerald { background: var(--emerald); }

/* Flat Hairline Task Queue (Math Academy style — NO nested cards!) */
.queue-list {
  display: flex;
  flex-direction: column;
}

.queue-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 15px 14px;
  margin: 0 -14px;
  border-bottom: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition: background 0.12s ease;
}

.queue-row:hover {
  background: var(--surface-subtle);
}

.queue-row.is-next {
  background: var(--primary-soft);
  border-bottom-color: transparent;
  margin-bottom: 4px;
}

.queue-row.is-due {
  background: var(--amber-soft);
  border-bottom-color: transparent;
  margin-bottom: 4px;
}

.queue-main {
  min-width: 0;
}

.queue-head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.queue-title {
  font-size: 15px;
  font-weight: 650;
  color: var(--text);
}

.queue-desc {
  margin-top: 3px;
  font-size: 13.5px;
  color: var(--text-muted);
}

.queue-meta {
  margin-top: 4px;
  font-size: 12px;
  color: var(--text-faint);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease;
  white-space: nowrap;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--primary);
  color: #ffffff;
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-hover);
}

.btn-emerald {
  background: var(--emerald);
  color: #ffffff;
}

.btn-emerald:hover:not(:disabled) {
  filter: brightness(0.94);
}

.btn-secondary {
  background: var(--bg);
  border-color: var(--border-strong);
  color: var(--text);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--surface-subtle);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  padding: 6px 9px;
}

.btn-ghost:hover:not(:disabled) {
  background: var(--surface-hover);
  color: var(--text);
}

.btn-sm {
  padding: 6px 11px;
  font-size: 13px;
}

/* Quiet Inline Tags (minimal pills) */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.tag-mastered { color: var(--emerald); }
.tag-due { color: var(--amber); }
.tag-frontier { color: var(--primary); }
.tag-locked { color: var(--text-faint); }
.tag-violet { color: var(--violet); }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 650;
  border: 1px solid transparent;
}

.badge-mastered { background: var(--emerald-soft); color: var(--emerald); }
.badge-due { background: var(--amber-soft); color: var(--amber); }
.badge-frontier { background: var(--primary-soft); color: var(--primary); }
.badge-locked { background: var(--surface-subtle); color: var(--text-faint); }
.badge-violet { background: var(--violet-soft); color: var(--violet); }

/* Quiet Tier Progress Rows & FIRe List */
.tier-summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 28px;
}

.fire-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.fire-row {
  padding-left: 12px;
  border-left: 2px solid var(--emerald);
  font-size: 13px;
  color: var(--text-muted);
}

.fire-row strong {
  color: var(--text);
}

/* Editorial Callout (left border only — no heavy box) */
.note-line {
  padding: 10px 14px;
  border-left: 3px solid var(--primary);
  background: var(--surface-subtle);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 14px;
}

.note-line.amber {
  border-left-color: var(--amber);
  background: var(--amber-soft);
}

.note-line.emerald {
  border-left-color: var(--emerald);
  background: var(--emerald-soft);
}

.note-line.rose {
  border-left-color: var(--rose);
  background: var(--rose-soft);
}

.note-label {
  display: block;
  font-size: 11px;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: 3px;
  color: var(--text-faint);
}

/* Skill Graph (Flat, Crisp, Frameless) */
.graph-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 18px;
}

.graph-legend {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  font-size: 12.5px;
  color: var(--text-muted);
}

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

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.graph-filters {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.filter-chip {
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}

.filter-chip:hover {
  background: var(--surface-subtle);
  color: var(--text);
}

.filter-chip.is-active {
  background: var(--primary-soft);
  color: var(--primary);
}

.graph-stage-wrap {
  overflow-x: auto;
  position: relative;
}

.graph-stage {
  position: relative;
  min-width: 1080px;
  padding: 12px 4px 28px;
}

.graph-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}

.graph-edge {
  fill: none;
  stroke: var(--border-strong);
  stroke-width: 1.5;
  opacity: 0.6;
  transition: stroke 0.16s ease, stroke-width 0.16s ease, opacity 0.16s ease;
}

.graph-edge.is-dim { opacity: 0.1; }
.graph-edge.is-upstream { stroke: var(--primary); stroke-width: 2.4; opacity: 1; }
.graph-edge.is-downstream { stroke: var(--emerald); stroke-width: 2.4; opacity: 1; }

.graph-tiers {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 44px;
}

.tier-row {
  display: grid;
  grid-template-columns: 136px 1fr;
  gap: 14px;
  align-items: center;
}

.tier-tag {
  font-size: 10.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-faint);
}

.tier-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  margin-top: 2px;
}

.tier-nodes {
  display: flex;
  justify-content: space-around;
  gap: 12px;
}

.skill-node {
  position: relative;
  flex: 1;
  max-width: 178px;
  min-width: 148px;
  text-align: left;
  padding: 10px 11px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg);
  cursor: pointer;
  transition: border-color 0.14s ease, background 0.14s ease, opacity 0.14s ease;
}

.skill-node:hover {
  border-color: var(--text-faint);
}

.skill-node.status-mastered {
  border-color: var(--emerald-border);
  background: var(--emerald-soft);
}

.skill-node.status-due {
  border-color: var(--amber);
  background: var(--amber-soft);
}

.skill-node.status-frontier {
  border-color: var(--primary);
}

.skill-node.status-locked {
  opacity: 0.6;
  background: var(--surface-subtle);
}

.skill-node.is-dim { opacity: 0.2; }
.skill-node.is-upstream { border-color: var(--primary); opacity: 1; }
.skill-node.is-downstream { border-color: var(--emerald); opacity: 1; }

.skill-node-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 4px;
}

.skill-node-track {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-faint);
}

.skill-node-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.skill-node-title {
  font-size: 12.5px;
  font-weight: 650;
  line-height: 1.28;
  color: var(--text);
  margin-bottom: 6px;
}

.skill-node-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  font-size: 11px;
  color: var(--text-faint);
}

.mini-bar {
  flex: 1;
  height: 3px;
  border-radius: 999px;
  background: var(--border);
  overflow: hidden;
}

.mini-bar-fill {
  height: 100%;
  border-radius: 999px;
}

/* Drawer */
.drawer {
  position: fixed;
  inset: 0;
  z-index: 80;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.16s ease;
}

.drawer.is-open {
  pointer-events: auto;
  opacity: 1;
}

.drawer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.35);
}

.drawer-panel {
  position: absolute;
  top: 0;
  right: 0;
  width: min(460px, 94vw);
  height: 100%;
  background: var(--bg);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.18s ease;
}

.drawer.is-open .drawer-panel {
  transform: translateX(0);
}

.drawer-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 20px 22px 14px;
  border-bottom: 1px solid var(--border);
}

.drawer-eyebrow {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-faint);
  margin-bottom: 4px;
}

.drawer-header h2 {
  margin: 0;
  font-size: 19px;
  line-height: 1.25;
}

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 18px 22px 32px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* Lesson Studio (Frameless Editorial Reading Layout) */
.lesson-layout {
  display: grid;
  grid-template-columns: 230px minmax(0, 740px);
  gap: 44px;
  align-items: start;
  justify-content: center;
}

.lesson-sidebar {
  position: sticky;
  top: 76px;
  border-right: 1px solid var(--border);
  padding-right: 16px;
}

.skill-picker-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: calc(100vh - 130px);
  overflow-y: auto;
}

.skill-pick-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  text-align: left;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-muted);
}

.skill-pick-btn:hover {
  background: var(--surface-subtle);
  color: var(--text);
}

.skill-pick-btn.is-active {
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 650;
}

.kp-stepper {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 12px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  margin: 16px 0 24px;
  flex-wrap: wrap;
}

.kp-step {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
}

.kp-step:hover { background: var(--surface-subtle); color: var(--text); }
.kp-step.is-current { background: var(--primary-soft); color: var(--primary); }
.kp-step.is-done { color: var(--emerald); }

.kp-section {
  display: flex;
  flex-direction: column;
  gap: 22px;
}

/* Code & Trace */
.code-block {
  margin: 0;
  padding: 15px 17px;
  border-radius: var(--radius-md);
  background: var(--code-bg);
  color: var(--code-text);
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.58;
  overflow-x: auto;
}

code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--surface-subtle);
}

pre code {
  padding: 0;
  background: transparent;
  font-size: inherit;
}

.trace-table-wrap { overflow-x: auto; }

.trace-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
  font-family: var(--font-mono);
}

.trace-table th, .trace-table td {
  padding: 7px 10px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

.trace-table th {
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 11.5px;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Active Check (Separated cleanly by a hairline, NOT a nested glowing box) */
.quiz-section {
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

.quiz-prompt {
  font-size: 15.5px;
  font-weight: 600;
  margin-bottom: 14px;
  color: var(--text);
}

.choice-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.choice-btn {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  width: 100%;
  text-align: left;
  padding: 11px 13px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg);
  cursor: pointer;
  transition: border-color 0.12s ease, background 0.12s ease;
}

.choice-btn:hover:not(:disabled) {
  border-color: var(--primary);
  background: var(--surface-subtle);
}

.choice-btn.is-selected {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.choice-btn.is-correct {
  border-color: var(--emerald);
  background: var(--emerald-soft);
}

.choice-btn.is-wrong {
  border-color: var(--rose);
  background: var(--rose-soft);
}

.choice-letter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 5px;
  background: var(--surface-subtle);
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 1px;
}

.code-input {
  width: 100%;
  padding: 11px 13px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-strong);
  background: var(--code-bg);
  color: var(--code-text);
  font-family: var(--font-mono);
  font-size: 13.5px;
}

.code-input:focus {
  outline: none;
  border-color: var(--primary);
}

.feedback-panel {
  margin-top: 14px;
  padding: 12px 14px;
  border-left: 3px solid var(--border-strong);
  background: var(--surface-subtle);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 13.5px;
}

.feedback-panel.is-correct {
  border-left-color: var(--emerald);
  background: var(--emerald-soft);
}

.feedback-panel.is-wrong {
  border-left-color: var(--rose);
  background: var(--rose-soft);
}

.feedback-title {
  font-weight: 750;
  margin-bottom: 3px;
}

/* Segmented Mode Selector (replaces 3 giant mode cards) */
.segmented {
  display: inline-flex;
  padding: 3px;
  border-radius: var(--radius-md);
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  gap: 2px;
  margin-bottom: 22px;
}

.seg-btn {
  padding: 7px 14px;
  border-radius: 6px;
  border: none;
  background: transparent;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
}

.seg-btn.is-active {
  background: var(--bg);
  color: var(--text);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

.session-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 22px;
  flex-wrap: wrap;
}

.timer-readout {
  font-family: var(--font-mono);
  font-size: 17px;
  font-weight: 800;
  color: var(--primary);
}

.timer-readout.is-low { color: var(--rose); }

/* Tables */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table th, .data-table td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

.data-table th {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-faint);
  font-weight: 700;
}

.principles-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px 32px;
}

.principles-list h3 {
  margin: 0 0 4px;
  font-size: 14.5px;
  font-weight: 700;
}

.principles-list p {
  margin: 0;
  font-size: 13.5px;
  color: var(--text-muted);
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* Toast Stack */
.toast-stack {
  position: fixed;
  bottom: 18px;
  right: 18px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 340px;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  background: var(--code-bg);
  color: #f8fafc;
  box-shadow: var(--shadow-lg);
  font-size: 13px;
}

.toast-title {
  font-weight: 700;
  color: var(--code-green);
  margin-bottom: 2px;
}

@media (max-width: 960px) {
  .lesson-layout {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  .lesson-sidebar {
    position: static;
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding-right: 0;
    padding-bottom: 14px;
  }
  .skill-picker-list { max-height: 180px; }
  .tier-summary-grid, .principles-list { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  .topbar-inner {
    padding: 8px 14px;
    flex-wrap: wrap;
    gap: 6px;
  }
  .topbar-left {
    width: 100%;
    justify-content: space-between;
    gap: 10px;
  }
  .nav-tab { padding: 8px 8px; font-size: 13px; }
  .topbar-right { width: 100%; justify-content: flex-end; }
  .main-view { padding: 22px 14px 56px; }
  .queue-row { flex-direction: column; align-items: flex-start; gap: 10px; }
}
