/* ============================================================
   PivotBoss Learning Course — shared stylesheet
   Redesign: modern, minimalist, sophisticated.
   Dark / light via CSS custom properties. Theme set by theme.js.
   ============================================================ */

/* ---------- Theme tokens ---------- */
:root {
  /* light (default) */
  --bg: #fafaf9;
  --bg-elev: #ffffff;
  --bg-elev-2: #f5f5f4;
  --bg-overlay: rgba(250, 250, 249, 0.88);
  --text: #1c1917;
  --text-dim: #6b6560;
  --text-faint: #a8a29e;
  --border: #e7e5e4;
  --border-strong: #d6d3d1;
  --accent: #c2410c;
  --accent-hover: #9a3412;
  --accent-soft: #fff7ed;
  --accent-text: #9a3412;
  --good: #15803d;
  --good-bg: #f0fdf4;
  --bad: #dc2626;
  --bad-bg: #fef2f2;
  --warn: #a16207;
  --warn-bg: #fefce8;
  --code-bg: #f5f5f4;
  --shadow-sm: 0 1px 2px rgba(28, 25, 23, 0.04);
  --shadow: 0 1px 3px rgba(28, 25, 23, 0.06), 0 4px 14px rgba(28, 25, 23, 0.04);
  --shadow-lg: 0 4px 8px rgba(28, 25, 23, 0.06), 0 12px 28px rgba(28, 25, 23, 0.06);
  --shadow-xl: 0 8px 16px rgba(28, 25, 23, 0.08), 0 20px 40px rgba(28, 25, 23, 0.08);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-xs: 6px;
  --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* dark (system preference) */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f0f0f;
    --bg-elev: #191919;
    --bg-elev-2: #222222;
    --bg-overlay: rgba(15, 15, 15, 0.90);
    --text: #fafaf7;
    --text-dim: #a8a29e;
    --text-faint: #78716c;
    --border: #2c2c2c;
    --border-strong: #3d3d3d;
    --accent: #fb923c;
    --accent-hover: #fdba74;
    --accent-soft: #2a1f14;
    --accent-text: #fdba74;
    --good: #4ade80;
    --good-bg: #14331f;
    --bad: #f87171;
    --bad-bg: #3a1f1f;
    --warn: #facc15;
    --warn-bg: #3a3014;
    --code-bg: #222222;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.5), 0 4px 14px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 4px 8px rgba(0, 0, 0, 0.5), 0 12px 28px rgba(0, 0, 0, 0.4);
    --shadow-xl: 0 8px 16px rgba(0, 0, 0, 0.5), 0 20px 40px rgba(0, 0, 0, 0.45);
  }
}

/* dark (explicit user choice) */
:root[data-theme="dark"] {
  --bg: #0f0f0f;
  --bg-elev: #191919;
  --bg-elev-2: #222222;
  --bg-overlay: rgba(15, 15, 15, 0.90);
  --text: #fafaf7;
  --text-dim: #a8a29e;
  --text-faint: #78716c;
  --border: #2c2c2c;
  --border-strong: #3d3d3d;
  --accent: #fb923c;
  --accent-hover: #fdba74;
  --accent-soft: #2a1f14;
  --accent-text: #fdba74;
  --good: #4ade80;
  --good-bg: #14331f;
  --bad: #f87171;
  --bad-bg: #3a1f1f;
  --warn: #facc15;
  --warn-bg: #3a3014;
  --code-bg: #222222;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.5), 0 4px 14px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 4px 8px rgba(0, 0, 0, 0.5), 0 12px 28px rgba(0, 0, 0, 0.4);
  --shadow-xl: 0 8px 16px rgba(0, 0, 0, 0.5), 0 20px 40px rgba(0, 0, 0, 0.45);
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 17px;
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
  transition: background-color var(--transition-slow), color var(--transition-slow);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Subtle page load animation */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.container {
  max-width: 820px;
  margin: 0 auto;
  padding: 0 24px 80px;
  animation: fadeIn 0.4s ease-out;
}

/* ---------- Header ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg-overlay);
  backdrop-filter: blur(12px) saturate(180%);
  -webkit-backdrop-filter: blur(12px) saturate(180%);
  border-bottom: 1px solid var(--border);
  transition: border-color var(--transition), background-color var(--transition);
}

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

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-dim);
  font-weight: 600;
}

.brand-mark {
  width: 28px; height: 28px;
  border-radius: var(--radius-xs);
  background: var(--accent);
  color: var(--bg);
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.03em;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-fast);
}
.brand-mark:hover { transform: scale(1.05); }

.crumb { color: var(--text-faint); font-weight: 500; }

.theme-toggle {
  border: 1px solid var(--border);
  background: var(--bg-elev);
  color: var(--text-dim);
  border-radius: var(--radius-sm);
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: all var(--transition-fast);
  box-shadow: var(--shadow-sm);
}
.theme-toggle:hover {
  border-color: var(--accent);
  color: var(--text);
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}
.theme-toggle:active { transform: translateY(0); }
.theme-toggle .icon { font-size: 14px; line-height: 1; }

/* ---------- Typography ---------- */
h1, h2, h3, h4 {
  line-height: 1.25;
  margin: 1.8em 0 0.5em;
  color: var(--text);
  font-weight: 700;
  letter-spacing: -0.01em;
}

h1 { font-size: 2em; margin-top: 0.5em; letter-spacing: -0.02em; }
h2 {
  font-size: 1.35em;
  padding-top: 0.6em;
  border-top: 1px solid var(--border);
  margin-top: 2.2em;
}
h3 { font-size: 1.1em; margin-top: 1.6em; }
h4 { font-size: 1em; margin-top: 1.4em; }

p { margin: 0.95em 0; }

strong { color: var(--text); font-weight: 600; }

a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--transition-fast);
}
a:hover { color: var(--accent-hover); text-decoration: underline; text-underline-offset: 2px; }

code {
  font-family: "SF Mono", ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: 0.86em;
  background: var(--code-bg);
  padding: 0.15em 0.4em;
  border-radius: var(--radius-xs);
  color: var(--text);
  border: 1px solid var(--border);
}

pre {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  overflow-x: auto;
  line-height: 1.55;
  font-size: 0.9em;
  box-shadow: var(--shadow-sm);
}
pre code { background: none; padding: 0; border: none; }

/* ---------- Lesson meta ---------- */
.lesson-meta {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 24px;
  margin: 24px 0 32px;
  box-shadow: var(--shadow);
}

.lesson-meta .lbl {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-faint);
  font-weight: 700;
}
.lesson-meta .val { font-size: 16px; color: var(--text); margin-top: 3px; font-weight: 500; }
.lesson-meta .meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 18px;
}

.eyebrow {
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 700;
  margin-bottom: 6px;
}

/* ---------- Callouts ---------- */
.callout {
  border-radius: var(--radius);
  padding: 16px 20px;
  margin: 20px 0;
  border: 1px solid var(--border);
  background: var(--bg-elev);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition-fast);
}
.callout:hover { box-shadow: var(--shadow); }

.callout .tag {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  display: block;
  margin-bottom: 6px;
}
.callout.key   { border-left: 4px solid var(--accent); }
.callout.key .tag { color: var(--accent-text); }
.callout.warn  { background: var(--warn-bg); border-color: transparent; }
.callout.warn .tag { color: var(--warn); }
.callout.good  { background: var(--good-bg); border-color: transparent; }
.callout.good .tag { color: var(--good); }
.callout.bad   { background: var(--bad-bg); border-color: transparent; }
.callout.bad .tag { color: var(--bad); }
.callout.learn { background: var(--accent-soft); border-color: transparent; }
.callout.learn .tag { color: var(--accent-text); }

/* ---------- Example blocks ---------- */
.example {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin: 20px 0;
  overflow: hidden;
  background: var(--bg-elev);
  box-shadow: var(--shadow);
  transition: box-shadow var(--transition);
}
.example:hover { box-shadow: var(--shadow-lg); }

.example-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  background: var(--bg-elev-2);
  border-bottom: 1px solid var(--border);
  font-weight: 700;
  font-size: 14px;
  color: var(--text);
}

.example-num {
  background: var(--accent);
  color: var(--bg);
  font-size: 12px;
  font-weight: 700;
  border-radius: var(--radius-xs);
  padding: 3px 9px;
}
.example-body { padding: 6px 20px 16px; }

/* ---------- Formula boxes ---------- */
.formula {
  background: var(--accent-soft);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: 18px 22px;
  margin: 18px 0;
  text-align: center;
  font-size: 1.12em;
  font-weight: 600;
  color: var(--text);
  box-shadow: var(--shadow-sm);
}
.formula small { display: block; font-weight: 400; color: var(--text-dim); font-size: 0.76em; margin-top: 6px; }

/* ---------- Tables ---------- */
.table-wrap {
  overflow-x: auto;
  margin: 18px 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
table { border-collapse: collapse; width: 100%; font-size: 0.95em; background: var(--bg-elev); }
th, td { padding: 11px 16px; text-align: left; border-bottom: 1px solid var(--border); }
th {
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-dim);
  background: var(--bg-elev-2);
  font-weight: 700;
}
tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--bg-elev-2); transition: background var(--transition-fast); }

/* ---------- Quiz ---------- */
.quiz {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 24px;
  margin: 24px 0;
  background: var(--bg-elev);
  box-shadow: var(--shadow);
}
.quiz-question { font-weight: 700; font-size: 1.05em; margin-bottom: 16px; line-height: 1.4; }
.quiz-options { display: grid; gap: 10px; }
.quiz-option {
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  cursor: pointer;
  transition: all var(--transition-fast);
  background: var(--bg);
  font-size: 0.96em;
  line-height: 1.5;
}
.quiz-option:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-sm);
  transform: translateX(2px);
}
.quiz-option.selected { border-color: var(--accent); background: var(--accent-soft); box-shadow: var(--shadow-sm); }
.quiz-option .key {
  width: 28px; height: 28px;
  flex-shrink: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  display: grid; place-items: center;
  font-size: 12px; font-weight: 700;
  color: var(--text-dim);
  transition: all var(--transition-fast);
}
.quiz-option.selected .key { background: var(--accent); color: var(--bg); border-color: var(--accent); }

.quiz-feedback { margin-top: 16px; font-size: 0.95em; min-height: 1.4em; font-weight: 500; }
.quiz-feedback.correct { color: var(--good); }
.quiz-feedback.wrong { color: var(--bad); }

.quiz-btn {
  margin-top: 16px;
  border: none;
  background: var(--accent);
  color: var(--bg);
  font-size: 15px;
  font-weight: 600;
  padding: 10px 22px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
  box-shadow: var(--shadow-sm);
}
.quiz-btn:hover {
  background: var(--accent-hover);
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}
.quiz-btn:active { transform: translateY(0); }
.quiz-btn:disabled { opacity: 0.4; cursor: default; transform: none; box-shadow: none; }
.quiz .retry { margin-left: 12px; }

/* ---------- Checkboxes (mastery / exercises) ---------- */
.check-item {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  margin: 12px 0;
  transition: opacity var(--transition-fast);
}
.check-item input[type="checkbox"] {
  width: 22px; height: 22px;
  accent-color: var(--accent);
  margin-top: 2px;
  flex-shrink: 0;
  cursor: pointer;
  transition: transform var(--transition-fast);
}
.check-item input[type="checkbox"]:checked + label {
  color: var(--text-faint);
  text-decoration: line-through;
  text-decoration-color: var(--border);
}
.check-item label { cursor: pointer; user-select: none; }

/* ---------- Steps (numbered flows) ---------- */
.steps { counter-reset: step; list-style: none; padding: 0; margin: 18px 0; }
.steps li {
  counter-increment: step;
  position: relative;
  padding-left: 50px;
  margin: 16px 0;
  min-height: 32px;
}
.steps li::before {
  content: counter(step);
  position: absolute;
  left: 0; top: 0;
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-text);
  border: 1px solid var(--accent);
  display: grid; place-items: center;
  font-size: 13px; font-weight: 700;
}

/* ---------- Key takeaway ---------- */
.takeaway {
  border: 1px solid var(--accent);
  background: var(--accent-soft);
  border-radius: var(--radius);
  padding: 22px 26px;
  margin: 32px 0;
  box-shadow: var(--shadow);
}
.takeaway h3 { margin-top: 0; color: var(--accent-text); }

/* ---------- Next / prev nav ---------- */
.lesson-nav {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 48px;
  border-top: 1px solid var(--border);
  padding-top: 28px;
}
.nav-card {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  background: var(--bg-elev);
  color: var(--text);
  text-decoration: none;
  transition: all var(--transition);
  box-shadow: var(--shadow-sm);
}
.nav-card:hover {
  border-color: var(--accent);
  text-decoration: none;
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}
.nav-card:active { transform: translateY(0); }
.nav-card .dir { font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-faint); font-weight: 700; }
.nav-card .t { font-weight: 600; margin-top: 4px; font-size: 0.98em; }
.nav-card.next { text-align: right; }

/* ---------- Footer ---------- */
.footer {
  margin-top: 56px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  color: var(--text-faint);
  font-size: 13px;
  text-align: center;
}

/* ---------- Module cards (index page) ---------- */
.module-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
  margin: 24px 0;
}
.module-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  background: var(--bg-elev);
  transition: all var(--transition);
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}
.module-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--accent);
  opacity: 0;
  transition: opacity var(--transition);
}
.module-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-lg);
  transform: translateY(-3px);
}
.module-card:hover::before { opacity: 1; }
.module-card .module-num {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 700;
  margin-bottom: 6px;
}
.module-card .module-title {
  font-weight: 700;
  font-size: 1.05em;
  margin-bottom: 8px;
  line-height: 1.3;
}
.module-card .module-count {
  font-size: 13px;
  color: var(--text-faint);
  font-weight: 500;
}
.module-card a { color: inherit; }
.module-card a:hover { text-decoration: none; color: inherit; }

/* ---------- Lesson list items ---------- */
.lesson-list { display: grid; gap: 8px; margin: 16px 0; }
.lesson-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-elev);
  transition: all var(--transition-fast);
  box-shadow: var(--shadow-sm);
}
.lesson-item:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow);
  transform: translateX(3px);
}
.lesson-item .num {
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
  min-width: 36px;
}
.lesson-item .title { font-weight: 500; font-size: 0.95em; }

/* ---------- Responsive ---------- */
@media (max-width: 640px) {
  body { font-size: 16px; line-height: 1.65; }
  h1 { font-size: 1.7em; }
  h2 { font-size: 1.25em; }
  .container { padding: 0 18px 60px; }
  .topbar-inner { padding: 10px 18px; }
  .lesson-meta .meta-grid { grid-template-columns: 1fr; gap: 12px; }
  .lesson-nav { flex-direction: column; }
  .nav-card.next { text-align: left; }
  .quiz-option { padding: 14px; min-height: 48px; }
  .quiz-option .key { width: 32px; height: 32px; font-size: 14px; }
  .brand { font-size: 11px; }
  .brand-mark { width: 24px; height: 24px; font-size: 11px; }
  .theme-toggle { padding: 8px 12px; min-height: 44px; }
  pre { padding: 14px 16px; font-size: 0.84em; }
  .example-body { padding: 6px 16px 14px; }
  .takeaway { padding: 18px 20px; }
  .callout { padding: 14px 16px; }
  .check-item { gap: 14px; margin: 14px 0; }
  .check-item input[type="checkbox"] { width: 24px; height: 24px; }
  .steps li { padding-left: 44px; }
  .steps li::before { width: 28px; height: 28px; font-size: 12px; }
  textarea { font-size: 16px; }
  .table-wrap { margin: 14px -18px; border-radius: 0; border-left: none; border-right: none; }
  th, td { padding: 10px 14px; font-size: 0.9em; }
  .module-grid { grid-template-columns: 1fr; gap: 12px; }
  .lesson-item { padding: 10px 12px; }
}

/* ---------- Print ---------- */
@media print {
  .topbar { position: static; backdrop-filter: none; }
  .theme-toggle, .lesson-nav, .footer { display: none; }
  body { background: #fff; color: #000; }
}

/* ============================================================
   Kanban + graphical demo system (added Sep 2026)
   ============================================================ */

/* ---------- TL;DR strip ---------- */
.tldr {
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  background: var(--bg-elev);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  margin: 20px 0;
  box-shadow: var(--shadow-sm);
}
.tldr .tag { margin-bottom: 6px; }
.tldr p { margin: 6px 0 0; }
.tldr p:first-of-type { margin-top: 8px; }

/* ---------- Workflow kanban strip ---------- */
.kb-label { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-faint); margin: 26px 0 10px; }
.kb-board {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin: 0 0 8px;
}
.kb-col {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  box-shadow: var(--shadow-sm);
  min-width: 0;
}
.kb-col .kb-stage { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--accent-text); margin-bottom: 4px; }
.kb-col .kb-what { font-size: 0.86em; line-height: 1.5; color: var(--text); }
.kb-col .kb-where { font-size: 0.78em; color: var(--text-faint); margin-top: 4px; }
.kb-col.done { border-left: 3px solid var(--good); }
.kb-col.now { border-left: 3px solid var(--accent); background: var(--accent-soft); }
.kb-col.next { border-left: 3px solid var(--border-strong); opacity: 0.92; }
@media (max-width: 640px) { .kb-board { grid-template-columns: 1fr 1fr; } }

/* ---------- Contrast table ---------- */
.contrast { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 16px 0; }
.contrast .c-col { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px; background: var(--bg-elev); }
.contrast .c-col.yes { border-top: 3px solid var(--good); }
.contrast .c-col.no { border-top: 3px solid var(--bad); }
.contrast .c-head { font-weight: 700; font-size: 0.9em; margin-bottom: 6px; }
.contrast .c-col.yes .c-head { color: var(--good); }
.contrast .c-col.no .c-head { color: var(--bad); }
.contrast ul { margin: 6px 0 0; padding-left: 18px; font-size: 0.92em; }
@media (max-width: 640px) { .contrast { grid-template-columns: 1fr; } }

/* ---------- Graphical demo box ---------- */
.demo {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elev);
  box-shadow: var(--shadow);
  margin: 22px 0;
  overflow: hidden;
}
.demo-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-elev-2);
}
.demo-title { font-weight: 700; font-size: 0.95em; }
.demo-title .live-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--good); margin-right: 8px; animation: pulse 2s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.35; } }
.demo-tag { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--accent-text); background: var(--accent-soft); border: 1px solid var(--border); padding: 3px 10px; border-radius: 999px; white-space: nowrap; }
.demo-body { padding: 16px 18px 8px; }
.demo-body svg { width: 100%; height: auto; display: block; }
.demo-body svg.demo-svg { animation: demoIn 0.28s ease; }
@keyframes demoIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.demo-readout { font-size: 0.9em; color: var(--text-dim); background: var(--bg-elev-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 14px; margin: 10px 0 4px; line-height: 1.6; }
.demo-readout strong { color: var(--text); }
.demo-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 12px 18px 16px; }
.demo-controls button {
  border: 1px solid var(--border-strong); background: var(--bg-elev); color: var(--text);
  border-radius: var(--radius-xs); padding: 8px 14px; font-size: 0.86em; font-weight: 600; cursor: pointer;
  transition: all var(--transition-fast);
}
.demo-controls button:hover { border-color: var(--accent); color: var(--accent-text); }
.demo-controls button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.demo-controls button.primary:hover { background: var(--accent-hover); }
.demo-controls input[type="range"] { flex: 1; min-width: 140px; accent-color: var(--accent); }
.demo-step-label { font-size: 0.84em; color: var(--text-dim); min-width: 100%; }
.demo-cap { font-size: 0.84em; color: var(--text-faint); padding: 0 18px 14px; line-height: 1.6; }

/* ---------- Lesson search (index) ---------- */
.search-wrap { margin: 18px 0 6px; }
.search-wrap input {
  width: 100%; padding: 12px 16px; font-size: 16px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--bg-elev); color: var(--text);
}
.search-wrap input:focus { outline: 2px solid var(--accent); border-color: var(--accent); }
.progress-bar { height: 8px; background: var(--bg-elev-2); border: 1px solid var(--border); border-radius: 999px; overflow: hidden; margin: 12px 0; }
.progress-fill { height: 100%; width: 0%; background: var(--accent); border-radius: 999px; transition: width 0.4s ease; }
.mark-done { margin-top: 10px; }
.mark-done button { border: 1px solid var(--border-strong); background: var(--bg-elev); color: var(--text); border-radius: var(--radius-xs); padding: 8px 16px; font-weight: 600; cursor: pointer; }
.mark-done button.done { background: var(--good-bg); border-color: var(--good); color: var(--good); }
