/* ═══════════════════════════════════════════════════════════════
   AIO Research Training — stylesheet
   Palette follows the AIO platform (slate neutrals, one orange accent).
   Fonts: Space Grotesk (headings), Inter Tight (body).
   Element families: every kind of visual element carries its own tint so readers can
   tell them apart at a glance — sky = reference tables, violet = interactive widgets,
   amber = notes, emerald = key takeaways, teal = quizzes (reserved), neutral = figures.
   ═══════════════════════════════════════════════════════════════ */

:root {
  --bg: #ffffff;
  --fg: #020617;
  --text: #1e293b;
  --text-2: #475569;
  --muted-fg: #64748b;
  --muted: #f1f5f9;
  --muted-2: #f8fafc;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --ring: #94a3b8;
  --primary: #0f172a;
  --primary-fg: #f8fafc;
  --accent: #f97316;
  --accent-strong: #ea580c;
  --accent-soft: #fff7ed;
  --accent-border: #fed7aa;
  --success: #16a34a;
  --success-soft: #f0fdf4;
  --success-border: #bbf7d0;
  --warn: #f59e0b;
  --warn-soft: #fffbeb;
  --warn-border: #fde68a;
  --destructive: #dc2626;

  /* Element families (see header) */
  --el-table-bg: #f0f9ff; --el-table-border: #bae6fd; --el-table-head: #e0f2fe; --el-table-fg: #075985;
  --el-int-bg: #f5f3ff;   --el-int-border: #ddd6fe;   --el-int-head: #ede9fe;   --el-int-fg: #5b21b6;
  --el-note-bg: #fffbeb;  --el-note-border: #fde68a;  --el-note-bar: #f59e0b;   --el-note-fg: #92400e;
  --el-take-bg: #ecfdf5;  --el-take-border: #a7f3d0;  --el-take-fg: #065f46;
  --el-quiz-bg: #f0fdfa;  --el-quiz-border: #99f6e4;  --el-quiz-fg: #115e59;

  --radius: 0.625rem;
  --radius-sm: 0.375rem;
  --radius-lg: 0.875rem;
  --shadow: 0 1px 3px 0 rgba(0, 0, 0, .08), 0 1px 2px -1px rgba(0, 0, 0, .06);
  --shadow-lg: 0 10px 28px rgba(15, 23, 42, .10);

  --font-head: 'Space Grotesk', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-body: 'Inter Tight', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'SF Mono', Menlo, Consolas, monospace;
  --measure: 72ch;
  --sidebar-w: 300px;

  /* Legacy aliases (still referenced from app.js inline styles) */
  --dark: var(--primary);
  --dark-lighter: #1e293b;
  --dark-muted: var(--muted-fg);
  --text-secondary: var(--text-2);
  --text-tertiary: var(--muted-fg);
  --bg-warm: var(--muted);
  --card-bg: var(--bg);
  --border-light: var(--border);
  --blue: var(--primary);
  --blue-mid: var(--ring);
  --cream: var(--muted); --lime: var(--muted); --lavender: var(--muted);
  --coral: var(--muted); --lilac: var(--muted); --green: var(--muted);
}

/* ── Base ── */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  display: flex;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4, h5 { font-family: var(--font-head); font-weight: 500; line-height: 1.2; color: var(--fg); letter-spacing: -0.01em; }
p, li, td, th, label, input, textarea, button, a { font-family: var(--font-body); }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
a { color: var(--primary); text-decoration: underline; text-decoration-color: var(--ring); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { text-decoration-color: var(--accent-strong); }
img { max-width: 100%; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }
::selection { background: var(--accent-soft); }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

/* ── Sidebar ── */
#sidebar {
  width: var(--sidebar-w); min-width: var(--sidebar-w);
  background: var(--muted-2); color: var(--text);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0; bottom: 0; z-index: 100;
  overflow-y: auto; transition: transform .25s ease;
}
#sidebar::-webkit-scrollbar { width: 4px; }
#sidebar::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 2px; }
#sidebar-header { padding: 20px 20px 16px; border-bottom: 1px solid var(--border); }
#sidebar-header a { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--fg); }
#sidebar-header a img { height: 30px; width: auto; }
#sidebar-header h1 { font-size: 16px; font-weight: 600; line-height: 1.2; }
#search-box {
  width: calc(100% - 40px); margin: 14px 20px 6px; padding: 8px 12px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg); color: var(--text); font-size: 14px; outline: none;
}
#search-box::placeholder { color: var(--muted-fg); }
#search-box:focus { border-color: var(--ring); }
.sidebar-chat-link {
  display: flex; align-items: center; gap: 10px; margin: 8px 20px 4px; padding: 10px 14px;
  background: var(--primary); color: var(--primary-fg) !important; text-decoration: none;
  border-radius: var(--radius-sm); font-size: 14px; font-weight: 500; transition: background .15s;
}
.sidebar-chat-link:hover { background: var(--dark-lighter); }
.sidebar-chat-link svg { flex-shrink: 0; }

.module-list { list-style: none; padding: 6px 0; flex: 1; }
.module-item { display: flex; flex-direction: column; border-left: 3px solid transparent; }
.module-item-header {
  width: 100%; text-align: left; display: flex; align-items: flex-start; gap: 12px;
  padding: 9px 20px 9px 17px; transition: background .15s;
}
.module-item-header:hover { background: var(--muted); }
.module-item.active { background: var(--bg); border-left-color: var(--accent); }
.module-item.active .module-item-header:hover { background: var(--bg); }
.module-num {
  width: 26px; height: 26px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 11.5px; font-weight: 600; background: var(--muted); color: var(--muted-fg);
  border: 1px solid var(--border);
}
.module-item.active .module-num { background: var(--primary); color: var(--primary-fg); border-color: var(--primary); }
.module-item.completed .module-num { background: var(--success-soft); color: var(--success); border-color: var(--success-border); }
.module-item-text { flex: 1; padding-top: 3px; min-width: 0; }
.module-item-title { font-size: 14.5px; font-weight: 500; line-height: 1.35; color: var(--text); }
.module-item.active .module-item-title { color: var(--fg); font-weight: 600; }
.module-item-sections { font-size: 12.5px; color: var(--muted-fg); margin-top: 2px; }
.module-item .track-badge {
  display: inline-block; margin-left: 6px; padding: 0 6px; border-radius: 99px;
  font-size: 10.5px; font-weight: 600; background: var(--accent-soft); color: var(--accent-strong); border: 1px solid var(--accent-border);
  vertical-align: middle;
}
.module-item.optional-track .module-item-title { color: var(--muted-fg); font-weight: 400; }
.sidebar-subs { list-style: none; margin: 2px 0 6px 38px; padding: 0; max-height: 0; overflow: hidden; transition: max-height .25s ease; }
.module-item.active .sidebar-subs { max-height: 900px; }
.sidebar-subs li { padding: 3px 0 3px 12px; border-left: 1px solid var(--border); }
.sidebar-subs li a { color: var(--muted-fg); font-size: 13.5px; text-decoration: none; display: block; line-height: 1.35; }
.sidebar-subs li a:hover { color: var(--fg); }
.sidebar-subs li.active-sec { border-left-color: var(--accent); }
.sidebar-subs li.active-sec a { color: var(--fg); font-weight: 500; }

.sidebar-resource {
  display: flex; align-items: center; gap: 8px; padding: 11px 20px;
  color: var(--text-2); font-size: 13px; font-weight: 500; text-decoration: none;
  border-top: 1px solid var(--border);
}
.sidebar-resource:hover { color: var(--fg); background: var(--muted); }
.sidebar-resource svg { flex-shrink: 0; }
#progress-bar { padding: 14px 20px 18px; border-top: 1px solid var(--border); }
#progress-bar .track { background: var(--border); border-radius: 3px; height: 4px; overflow: hidden; }
#progress-bar .fill { background: var(--accent); height: 100%; border-radius: 3px; transition: width .4s ease; }
#progress-text { font-size: 12.5px; color: var(--muted-fg); margin-top: 6px; }

/* ── Main / topbar ── */
#main { flex: 1; margin-left: var(--sidebar-w); min-width: 0; }
#topbar {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255, 255, 255, .92); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  padding: 12px 40px; display: flex; align-items: center; gap: 16px; min-height: 58px;
}
#menu-btn { display: none; font-size: 20px; line-height: 1; padding: 4px 6px; color: var(--text); }
#breadcrumb { font-size: 14px; color: var(--muted-fg); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#breadcrumb a { color: var(--muted-fg); text-decoration: none; }
#breadcrumb a:hover { color: var(--fg); }
#breadcrumb span { color: var(--fg); font-weight: 500; }
#mark-complete-btn {
  margin-left: auto; padding: 7px 14px; border-radius: var(--radius-sm);
  background: var(--primary); color: var(--primary-fg); font-size: 13px; font-weight: 500; white-space: nowrap;
  transition: background .15s;
}
#mark-complete-btn:hover { background: var(--dark-lighter); }
#mark-complete-btn.done { background: var(--success-soft); color: var(--success); border: 1px solid var(--success-border); }

/* Ask bar */
#ask-bar { position: relative; flex: 1; max-width: 460px; margin: 0 auto; }
#ask-input {
  width: 100%; border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 8px 60px 8px 12px; font-size: 14px; outline: none; background: var(--bg); color: var(--text);
}
#ask-input:focus { border-color: var(--ring); box-shadow: 0 0 0 3px rgba(148, 163, 184, .2); }
#ask-input::placeholder { color: var(--muted-fg); }
#ask-submit { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); padding: 4px 8px; color: var(--text-2); font-size: 16px; display: flex; align-items: center; border-radius: var(--radius-sm); }
#ask-submit:hover { color: var(--fg); background: var(--muted); }
#ask-status { position: absolute; right: 36px; top: 50%; transform: translateY(-50%); display: flex; align-items: center; }
#ask-status .dot { width: 6px; height: 6px; border-radius: 50%; display: inline-block; }
#ask-status .dot.loading { background: var(--warn); animation: pulse-dot 1.2s infinite; }
#ask-status .dot.ready { background: var(--success); }
#ask-status .dot.error { background: var(--destructive); }
@keyframes pulse-dot { 0%, 100% { opacity: 1; } 50% { opacity: .3; } }
#ask-results {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; display: none; flex-direction: column;
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg);
  max-height: 480px; overflow-y: auto; z-index: 200;
}
#ask-results.open { display: flex; }
#ask-results-inner { padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.ask-msg { padding: 12px 14px; border-radius: var(--radius-sm); font-size: 14px; line-height: 1.6; background: var(--bg); border: 1px solid var(--border); }
.ask-msg a { font-weight: 500; }
.ask-msg.user-q { background: var(--muted); border: none; font-weight: 500; font-size: 13px; padding: 8px 12px; align-self: flex-end; max-width: 80%; }
.ask-typing { display: flex; align-items: center; gap: 6px; padding: 8px 14px; color: var(--muted-fg); font-size: 13px; }
.ask-typing .dots, .chat-typing .dots { display: flex; gap: 4px; }
.ask-typing .dots span, .chat-typing .dots span { width: 6px; height: 6px; border-radius: 50%; background: var(--ring); animation: typing-bounce 1.4s infinite; }
.ask-typing .dots span:nth-child(2), .chat-typing .dots span:nth-child(2) { animation-delay: .2s; }
.ask-typing .dots span:nth-child(3), .chat-typing .dots span:nth-child(3) { animation-delay: .4s; }
@keyframes typing-bounce { 0%, 60%, 100% { transform: translateY(0); } 30% { transform: translateY(-5px); } }
.typing-text::after { content: '...'; display: inline-block; width: 0; overflow: hidden; vertical-align: bottom; animation: ellipsis-reveal 1.5s steps(3, end) infinite; }
@keyframes ellipsis-reveal { to { width: 1em; } }
.ask-close { position: absolute; top: 6px; right: 8px; color: var(--muted-fg); font-size: 18px; line-height: 1; padding: 4px 6px; border-radius: var(--radius-sm); }
.ask-close:hover { color: var(--fg); background: var(--muted); }
.ask-result-card { padding: 10px 12px; background: var(--muted-2); border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 13px; margin-bottom: 6px; }
.ask-result-card .arc-title { font-weight: 600; font-size: 13px; margin-bottom: 4px; }
.ask-sources { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--border); }
.ask-sources-label { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted-fg); margin-bottom: 4px; font-weight: 600; }
.ask-source-item { font-size: 13px; padding: 3px 0; display: flex; gap: 8px; align-items: baseline; }
.src-n { flex-shrink: 0; width: 18px; height: 18px; border-radius: 50%; background: var(--muted); border: 1px solid var(--border); font-size: 11px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; color: var(--text-2); }
.src-meta { color: var(--muted-fg); font-size: 12px; }
.src-ref { font-size: 11px; line-height: 0; margin-left: 1px; }
.src-ref a { text-decoration: none; color: var(--accent-strong); }
.ask-note { color: var(--text-2); font-size: 14px; margin-bottom: 8px; }

/* ── Chat page ── */
#content:has(#chat-view.active) { padding-bottom: 0; }
#chat-view { display: none; max-width: 820px; margin: 0 auto; height: calc(100vh - 106px); flex-direction: column; }
#chat-view.active { display: flex; }
.chat-header { padding: 24px 0 16px; border-bottom: 1px solid var(--border); }
.chat-header h2 { font-size: 22px; margin-bottom: 4px; }
.chat-header p { color: var(--muted-fg); font-size: 15px; }
.chat-messages { flex: 1; overflow-y: auto; padding: 20px 0; display: flex; flex-direction: column; gap: 14px; }
.chat-msg { max-width: 85%; padding: 12px 16px; border-radius: var(--radius); font-size: 15.5px; line-height: 1.6; word-wrap: break-word; }
.chat-msg p { margin: 0 0 8px; }
.chat-msg p:last-child { margin: 0; }
.chat-msg ul, .chat-msg ol { margin: 4px 0 8px 18px; }
.chat-msg.user { align-self: flex-end; background: var(--primary); color: var(--primary-fg); border-bottom-right-radius: 4px; }
.chat-msg.user a { color: inherit; }
.chat-msg.assistant { align-self: flex-start; background: var(--bg); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.chat-msg.assistant .chat-sources { margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--border); font-size: 13px; }
.chat-msg.error { align-self: center; color: var(--destructive); font-size: 13px; }
.chat-typing { align-self: flex-start; padding: 12px 18px; display: flex; align-items: center; gap: 8px; color: var(--muted-fg); font-size: 13px; }
.chat-input-area { padding: 14px 0; border-top: 1px solid var(--border); display: flex; gap: 10px; align-items: flex-end; }
.chat-input-area textarea {
  flex: 1; resize: none; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 11px 14px; font: inherit; font-size: 15px; line-height: 1.5; min-height: 46px; max-height: 140px; outline: none;
}
.chat-input-area textarea:focus { border-color: var(--ring); }
.chat-input-area button { width: 46px; height: 46px; border-radius: var(--radius); background: var(--primary); color: var(--primary-fg); font-size: 18px; flex-shrink: 0; }
.chat-input-area button:hover { background: var(--dark-lighter); }
.chat-input-area button:disabled { opacity: .4; cursor: default; }
.chat-suggestions { display: flex; flex-wrap: wrap; gap: 8px; padding: 8px 0; }
.chat-suggestions button { background: var(--muted-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 12px; font-size: 14px; color: var(--text); }
.chat-suggestions button:hover { border-color: var(--ring); background: var(--muted); }

/* ── Content column ── */
#content { max-width: 900px; margin: 0 auto; padding: 40px 40px 80px; }

/* ── Welcome ── */
.welcome-header { padding: 16px 0 28px; }
.welcome-header h2 { font-size: 34px; font-weight: 600; margin-bottom: 10px; line-height: 1.15; }
.welcome-header .subtitle { font-size: 17px; color: var(--text-2); max-width: var(--measure); line-height: 1.6; }
.welcome-overview-link { font-weight: 500; }

.stepper { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 8px 0 36px; position: relative; }
.step { text-align: center; padding: 8px 6px; position: relative; }
.step-icon {
  width: 52px; height: 52px; margin: 0 auto 10px; border-radius: 50%;
  background: var(--accent-soft); border: 1px solid var(--accent-border); color: var(--accent-strong);
  display: flex; align-items: center; justify-content: center;
}
.step-icon svg { width: 22px; height: 22px; }
.step + .step::before {
  content: ''; position: absolute; left: calc(-50% + 30px); right: calc(50% + 30px); top: 33px; height: 1px; background: var(--border);
}
.step-title { font-family: var(--font-head); font-size: 15px; font-weight: 600; color: var(--fg); margin-bottom: 3px; }
.step-desc { font-size: 13px; color: var(--muted-fg); line-height: 1.4; }

.welcome-section-title { font-size: 22px; font-weight: 600; margin: 8px 0 6px; }
.welcome-section-subtitle { font-size: 15.5px; color: var(--text-2); margin-bottom: 18px; line-height: 1.55; }
.welcome-block { margin-bottom: 40px; }

.module-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; margin-bottom: 40px; }
.module-card {
  width: 100%; text-align: left; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius);
  display: flex; flex-direction: column; transition: border-color .15s, box-shadow .15s;
}
.module-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow); }
.module-card-body { padding: 18px 22px 18px; flex: 1; }
.module-card .card-num { font-family: var(--font-head); font-size: 11.5px; font-weight: 600; color: var(--muted-fg); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }
.module-card .card-badge {
  width: 26px; height: 26px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600; background: var(--muted); color: var(--text); border: 1px solid var(--border); text-transform: none;
}
.module-card.completed .card-badge { background: var(--success-soft); color: var(--success); border-color: var(--success-border); }
.module-card h3 { font-size: 17px; font-weight: 600; margin-bottom: 8px; line-height: 1.3; }
.module-card .card-desc { font-size: 14.5px; color: var(--text-2); line-height: 1.55; }
.module-card .card-arrow { margin-left: auto; font-size: 16px; color: var(--muted-fg); transition: color .15s, transform .15s; text-transform: none; letter-spacing: 0; }
.module-card:hover .card-arrow { color: var(--accent-strong); transform: translateX(2px); }
.module-card .card-tier { font-size: 11.5px; font-weight: 600; color: var(--accent-strong); background: var(--accent-soft); border: 1px solid var(--accent-border); border-radius: 99px; padding: 1px 8px; }
.module-card .card-tier.recommended { color: var(--text-2); background: var(--muted); border-color: var(--border); }

/* ── Buttons ── */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 9px 16px; border-radius: var(--radius-sm); font-size: 14px; font-weight: 500; border: 1px solid transparent; transition: background .15s, border-color .15s, color .15s; }
.btn-primary { background: var(--primary); color: var(--primary-fg); }
.btn-primary:hover { background: var(--dark-lighter); }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--muted); color: var(--fg); }
.btn-outline { background: var(--bg); border-color: var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--border-strong); background: var(--muted-2); }
.btn-link { background: none; padding: 9px 4px; color: var(--text-2); text-decoration: underline; text-decoration-color: var(--ring); text-underline-offset: 3px; }
.btn-link:hover { color: var(--fg); text-decoration-color: var(--accent-strong); }

/* ── Pathway recommender ── */
.pathway-card { border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--bg); padding: 24px 26px; }
.pathway-card .welcome-section-title { margin-top: 0; }
.pathway-card .welcome-section-subtitle { margin-bottom: 14px; max-width: var(--measure); }
.pathway-card:not(.wizard):not(.result) { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 28px; }
.pathway-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.personas-label { font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted-fg); margin-bottom: 8px; }
.pathway-personas { display: flex; flex-direction: column; gap: 8px; }
.persona-btn { text-align: left; display: flex; flex-direction: column; gap: 2px; padding: 10px 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--muted-2); }
.persona-btn:hover { border-color: var(--border-strong); background: var(--bg); }
.persona-title { font-family: var(--font-head); font-size: 14px; font-weight: 600; }
.persona-blurb { font-size: 13px; color: var(--text-2); line-height: 1.4; }
.persona-use { margin-top: 4px; margin-bottom: 8px; }
.wizard-progress { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--accent-strong); margin-bottom: 8px; }
.wizard-question { font-size: 21px; font-weight: 600; margin-bottom: 16px; }
[data-focus]:focus { outline: none; }
.wizard-options { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.wizard-option { text-align: left; padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg); font-size: 15px; line-height: 1.4; }
.wizard-option:hover { border-color: var(--ring); background: var(--muted-2); }
.wizard-option.selected { border-color: var(--accent); background: var(--accent-soft); }
.wizard-nav { display: flex; gap: 8px; }
.pathway-result-header { display: flex; justify-content: space-between; gap: 20px; align-items: flex-start; flex-wrap: wrap; margin-bottom: 12px; }
.pathway-result-header .welcome-section-subtitle { margin-bottom: 0; }
.track-list { list-style: none; padding: 0; margin: 8px 0 0; display: flex; flex-direction: column; gap: 6px; }
.track-item { display: flex; gap: 14px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg); }
.track-item.tier-recommended { background: var(--muted-2); }
.track-order { width: 26px; height: 26px; border-radius: 50%; flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; background: var(--accent); color: #fff; }
.track-item.tier-recommended .track-order { background: var(--muted); color: var(--text-2); border: 1px solid var(--border); }
.track-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.track-title { font-family: var(--font-head); font-size: 15px; font-weight: 600; text-decoration: none; }
.track-title:hover { text-decoration: underline; }
.track-tier { font-size: 12px; color: var(--muted-fg); }
.track-why { font-size: 14px; color: var(--text-2); line-height: 1.45; }
.track-optional { font-size: 13.5px; color: var(--muted-fg); margin-top: 12px; }
.track-footnote { font-size: 13.5px; color: var(--muted-fg); margin-top: 10px; }
.track-footnote .btn-link { font-size: 13.5px; padding: 0; }
.map-pathway-note { font-size: 14px; color: var(--text-2); margin-bottom: 18px; }

/* ── Community & contribute ── */
.community-list { list-style: none; padding: 0; }
.community-list.standalone .community-item { border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 18px; margin-bottom: 10px; }
.community-item { padding: 10px 0; border-bottom: 1px solid var(--border); }
.community-item:last-child { border-bottom: none; }
.community-title { font-family: var(--font-head); font-size: 15.5px; font-weight: 600; }
.community-type { display: inline-block; margin-left: 6px; padding: 1px 8px; border-radius: 99px; font-size: 11px; font-weight: 600; background: var(--muted); border: 1px solid var(--border); color: var(--text-2); vertical-align: middle; }
.community-desc { font-size: 14.5px; color: var(--text-2); margin: 4px 0 4px; line-height: 1.5; max-width: var(--measure); }
.community-meta { font-size: 12.5px; color: var(--muted-fg); }
.contribute-form { max-width: 760px; }
.contribute-form label { display: block; font-size: 14px; font-weight: 500; margin-bottom: 4px; }
.contribute-form input[type="text"], .contribute-form input[type="email"], .contribute-form input[type="url"], .contribute-form input:not([type]), .contribute-form textarea, .contribute-form select {
  display: block; width: 100%; margin-top: 4px; padding: 9px 11px; border: 1px solid var(--border); border-radius: var(--radius-sm); font: inherit; font-size: 15px; background: var(--bg); color: var(--text);
}
.contribute-form input:focus, .contribute-form textarea:focus, .contribute-form select:focus { outline: none; border-color: var(--ring); box-shadow: 0 0 0 3px rgba(148,163,184,.2); }
.contribute-form input[type="file"] { display: block; margin-top: 6px; font-size: 13px; }
.form-row { margin-bottom: 16px; }
.form-row.two { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-hint { font-size: 13px; color: var(--muted-fg); margin: -8px 0 16px; }
.modules-field { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; }
.modules-field legend { font-size: 13px; font-weight: 500; padding: 0 4px; }
.check-grid { display: grid; gap: 4px; }
.contribute-form label.check { display: flex; gap: 8px; align-items: flex-start; font-weight: 400; font-size: 13.5px; line-height: 1.4; }
.contribute-form label.check input { margin-top: 3px; }
.contribute-form label.licence { margin: 12px 0 16px; font-size: 14px; }
.hp { position: absolute; left: -9999px; top: -9999px; }
.form-status { font-size: 14px; color: var(--text-2); }

/* ── Videos ── */
.video-block { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 20px; align-items: start; margin: 0 0 28px; padding-bottom: 24px; border-bottom: 1px solid var(--border); }
.video-frame { position: relative; aspect-ratio: 16 / 9; border-radius: var(--radius); overflow: hidden; background: var(--muted); border: 1px solid var(--border); }
.video-frame > iframe, .video-frame > .video-poster { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.video-poster { display: flex; align-items: center; justify-content: center; padding: 0; background: var(--muted); cursor: pointer; }
.video-poster img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.video-poster .play-icon { position: relative; width: 56px; height: 56px; border-radius: 50%; background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center; box-shadow: var(--shadow-lg); transition: transform .15s; }
.video-poster .play-icon svg { width: 30px; height: 30px; }
.video-poster:hover .play-icon { transform: scale(1.06); }
.video-poster.coming-soon { flex-direction: column; gap: 8px; cursor: default; background: var(--muted-2); border: 1px dashed var(--border-strong); }
.video-poster .play-icon.muted { background: var(--muted); color: var(--muted-fg); box-shadow: none; border: 1px solid var(--border); }
.coming-soon-label { font-size: 13px; font-weight: 500; color: var(--muted-fg); }
.video-meta .video-title { font-family: var(--font-head); font-size: 17px; font-weight: 600; margin-bottom: 4px; }
.video-meta .video-duration { font-size: 12.5px; color: var(--muted-fg); margin-bottom: 8px; }
.video-meta .video-desc { font-size: 15px; line-height: 1.55; color: var(--text-2); }
.video-strip-header { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.channel-link { display: inline-flex; align-items: center; gap: 6px; font-size: 13.5px; font-weight: 500; text-decoration: none; color: var(--text-2); }
.channel-link svg { width: 18px; height: 18px; color: var(--accent-strong); }
.channel-link:hover { color: var(--fg); text-decoration: underline; }
.video-strip { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.video-card { display: flex; flex-direction: column; gap: 8px; }
.video-card .video-poster .play-icon { width: 40px; height: 40px; }
.video-card .video-poster .play-icon svg { width: 22px; height: 22px; }
.video-card .video-title { font-family: var(--font-head); font-size: 14px; font-weight: 600; line-height: 1.3; }
.video-card-meta { font-size: 12.5px; color: var(--muted-fg); margin-top: 2px; }
.video-card-meta a { color: var(--text-2); }

/* ── Module map (Overview) ── */
.module-map { margin: 0 0 40px; }
.module-map > h3 { font-size: 21px; margin-bottom: 6px; }
.module-map .map-subtitle { font-size: 14.5px; color: var(--text-2); margin-bottom: 18px; line-height: 1.5; max-width: var(--measure); }
.map-canvas { position: relative; width: 100%; }
.map-grid { display: flex; flex-direction: column; }
.map-row { display: flex; align-items: stretch; }
.map-row-label { flex: 0 0 100%; font-family: var(--font-head); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted-fg); padding: 18px 0 8px; }
.map-row-label:first-child { padding-top: 0; }
.map-node {
  flex: 1; padding: 14px 16px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--bg);
  display: flex; flex-direction: column; min-height: 76px; position: relative; transition: border-color .15s, box-shadow .15s; cursor: pointer;
}
.map-node:hover { border-color: var(--border-strong); box-shadow: var(--shadow); }
.map-node.dimmed { opacity: .35; }
.map-node.highlighted { border-color: var(--accent); background: var(--accent-soft); }
.map-node .node-num { font-family: var(--font-head); font-size: 11px; font-weight: 500; color: var(--muted-fg); margin-bottom: 4px; }
.map-node .node-title { font-family: var(--font-head); font-size: 14px; font-weight: 600; line-height: 1.25; margin-bottom: 3px; }
.map-node .node-focus { font-size: 12px; color: var(--muted-fg); line-height: 1.35; }
.map-node .node-badge {
  position: absolute; top: 8px; right: 8px; width: 22px; height: 22px; border-radius: 50%;
  background: var(--accent); color: #fff; display: none; align-items: center; justify-content: center; font-size: 10.5px; font-weight: 700;
}
.map-node.highlighted .node-badge { display: flex; }
.map-connector { display: flex; align-items: center; justify-content: center; width: 28px; flex-shrink: 0; color: var(--border-strong); }
.map-connector.active-connector, .map-row-divider.active-connector { color: var(--accent-strong); }
.map-connector.dimmed, .map-row-divider.dimmed { opacity: .25; }
.map-row-divider { display: flex; align-items: center; justify-content: center; padding: 6px 0; color: var(--border-strong); }

/* ── Module view ── */
.module-header { margin-bottom: 28px; padding-bottom: 24px; border-bottom: 1px solid var(--border); }
.module-header .tag { display: inline-block; font-family: var(--font-head); font-size: 12px; font-weight: 600; color: var(--muted-fg); text-transform: uppercase; letter-spacing: .08em; margin-bottom: 10px; }
.module-header h2 { font-size: 30px; font-weight: 600; margin-bottom: 8px; line-height: 1.15; }
.module-header .abstract { font-size: 17px; color: var(--text-2); margin-top: 14px; line-height: 1.65; max-width: var(--measure); text-align: justify; hyphens: auto; }

.info-card { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px 24px; margin-bottom: 20px; }
.info-card h3 { font-size: 15px; font-weight: 600; margin-bottom: 10px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted-fg); }
.info-card ul { padding-left: 20px; }
.info-card li { font-size: 16px; margin-bottom: 6px; line-height: 1.55; max-width: var(--measure); text-align: justify; hyphens: auto; }
.info-card.objectives { border-left: 3px solid var(--primary); }
.info-card.takeaways { background: var(--el-take-bg); border-color: var(--el-take-border); border-left: 3px solid var(--el-take-fg); }
.info-card.takeaways h3 { color: var(--el-take-fg); }

.reading-list { list-style: none; padding: 0; }
.reading-item { padding: 12px 0; border-bottom: 1px solid var(--border); }
.reading-item:last-child { border-bottom: none; }
.reading-title { font-weight: 500; font-size: 15.5px; line-height: 1.45; }
.reading-meta { font-size: 14px; color: var(--muted-fg); margin-top: 3px; line-height: 1.45; }
.reading-abstract { font-size: 14.5px; color: var(--text-2); margin-top: 6px; line-height: 1.6; display: none; max-width: var(--measure); }
.reading-abstract.open { display: block; }
.reading-toggle { font-size: 12.5px; color: var(--text-2); padding: 0; margin-top: 4px; text-decoration: underline; text-decoration-color: var(--ring); text-underline-offset: 3px; }
.reading-toggle:hover { color: var(--fg); }
.reading-footer { margin-top: 12px; font-size: 13.5px; }

.section-nav { background: var(--muted-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 24px; margin-bottom: 32px; }
.section-nav h3 { font-size: 13px; font-weight: 600; margin-bottom: 10px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted-fg); }
.section-nav ol { padding-left: 20px; columns: 2; column-gap: 28px; }
.section-nav li { margin-bottom: 5px; break-inside: avoid; }
.section-nav a { font-size: 14.5px; line-height: 1.4; text-decoration: none; color: var(--text); }
.section-nav a:hover { color: var(--fg); text-decoration: underline; text-decoration-color: var(--accent-strong); }

/* Section content — the reading experience */
.section-block { margin-bottom: 40px; scroll-margin-top: 76px; }
.section-block h3 { font-size: 24px; font-weight: 600; margin-bottom: 14px; padding-bottom: 10px; border-bottom: 1px solid var(--border); }
.section-block h4 { font-size: 19px; font-weight: 600; margin: 26px 0 10px; }
.section-block h5 { font-size: 16.5px; font-weight: 600; margin: 20px 0 8px; color: var(--text-2); }
.section-content p { margin-bottom: 14px; font-size: 17px; line-height: 1.7; max-width: var(--measure); text-align: justify; hyphens: auto; }
.section-content ul, .section-content ol { padding-left: 24px; margin-bottom: 14px; max-width: var(--measure); }
.section-content li { margin-bottom: 6px; font-size: 17px; line-height: 1.6; text-align: justify; hyphens: auto; }
.section-content strong { font-weight: 600; color: var(--fg); }
.section-content code { background: var(--muted); padding: 2px 6px; border-radius: 4px; font-size: 14px; font-family: var(--font-mono); }
.section-content pre { margin: 16px 0; padding: 14px 16px; background: var(--muted-2); border: 1px solid var(--border); border-radius: var(--radius-sm); overflow-x: auto; font-size: 13.5px; line-height: 1.5; max-width: var(--measure); }
.section-content pre code { background: none; padding: 0; }
.section-content .note {
  margin: 20px 0; padding: 14px 18px; background: var(--el-note-bg); border: 1px solid var(--el-note-border); border-left: 3px solid var(--el-note-bar);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0; font-size: 15px; max-width: var(--measure);
}
.section-content .note > p:first-child > strong:first-child { color: var(--el-note-fg); }
.section-content .note p { margin: 0; font-size: 15px; line-height: 1.6; }
.section-content .note p + p { margin-top: 8px; }
figure.screenshot { margin: 24px 0; }
figure.screenshot img { display: block; width: 100%; height: auto; border: 1px solid var(--border); border-radius: var(--radius); }
figure.screenshot figcaption { margin-top: 8px; font-size: 13.5px; line-height: 1.5; color: var(--muted-fg); max-width: var(--measure); }
figure.screenshot .fig-caveat { display: block; margin-top: 2px; font-style: italic; }
.citation-link, .module-ref-link { text-decoration: underline; text-decoration-color: var(--ring); text-underline-offset: 3px; }
.citation-link:hover, .module-ref-link:hover { text-decoration-color: var(--accent-strong); }
.glossary-term { border-bottom: 1px dotted var(--ring); cursor: help; }
.glossary-term:hover { border-bottom-color: var(--accent-strong); }

/* Tables (sky family) */
.table-container { overflow-x: auto; margin: 20px 0; border: 1px solid var(--el-table-border); border-radius: var(--radius); }
.table-caption { font-family: var(--font-head); font-size: 14px; font-weight: 600; color: var(--fg); padding: 12px 16px 0; line-height: 1.4; }
.table-container > .table-caption { background: var(--el-table-bg); color: var(--el-table-fg); padding: 10px 16px; border-bottom: 1px solid var(--el-table-border); }
table { width: 100%; border-collapse: collapse; font-size: 14px; background: var(--bg); }
th { background: var(--el-table-head); color: var(--fg); padding: 10px 14px; text-align: left; font-weight: 600; font-size: 13px; border-bottom: 1px solid var(--el-table-border); }
td { padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: top; font-size: 14px; line-height: 1.5; }
tr:last-child td { border-bottom: none; }
dl { margin: 20px 0; }
dt { margin-top: 14px; font-family: var(--font-head); font-size: 15px; font-weight: 600; }
dd { margin: 4px 0 0; padding-left: 20px; font-size: 14.5px; line-height: 1.6; color: var(--text-2); text-align: justify; hyphens: auto; }

/* Prev / next */
.nav-buttons { display: flex; justify-content: space-between; margin-top: 48px; padding-top: 24px; border-top: 1px solid var(--border); }
.nav-btn { padding: 10px 18px; border: 1px solid var(--border); background: var(--bg); border-radius: var(--radius-sm); font-size: 14px; font-weight: 500; color: var(--text); }
.nav-btn:hover { border-color: var(--border-strong); background: var(--muted-2); }
.nav-btn.disabled { opacity: .35; pointer-events: none; }

/* ── Glossary popup ── */
#glossary-popup {
  position: fixed; z-index: 500; max-width: 380px; min-width: 240px; display: none;
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 14px 16px;
}
#glossary-popup.visible { display: block; }
#glossary-popup .gp-term { font-family: var(--font-head); font-size: 14px; font-weight: 600; margin-bottom: 6px; padding-right: 20px; }
#glossary-popup .gp-def { font-size: 14px; line-height: 1.55; }
#glossary-popup .gp-close { position: absolute; top: 6px; right: 8px; color: var(--muted-fg); font-size: 16px; line-height: 1; padding: 3px 6px; border-radius: var(--radius-sm); }
#glossary-popup .gp-close:hover { color: var(--fg); background: var(--muted); }

/* ── Footer ── */
#ardc-footer { margin-top: 56px; padding: 28px 0 0; border-top: 1px solid var(--border); text-align: center; color: var(--muted-fg); font-size: 13px; line-height: 1.6; }
#ardc-footer .ardc-logo { display: block; margin: 0 auto 14px; max-width: 280px; height: auto; }
#ardc-footer p { max-width: 640px; margin: 0 auto 10px; }
#ardc-footer .footer-links { display: flex; justify-content: center; gap: 18px; flex-wrap: wrap; }

/* ═══ Interactive widgets (table transforms) — violet family ═══ */
.widget { margin: 20px 0; padding: 14px 16px 16px; background: var(--el-int-bg); border: 1px solid var(--el-int-border); border-radius: var(--radius); }
.widget > .table-caption { color: var(--el-int-fg); padding: 0; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.widget > .table-caption::after { content: 'Interactive'; font-size: 10.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; padding: 2px 8px; border-radius: 99px; background: var(--el-int-head); color: var(--el-int-fg); }
.widget > .table-caption + * { margin-top: 0; }
.widget > :last-child { margin-bottom: 0; }
.widget th { background: var(--el-int-head); border-bottom-color: var(--el-int-border); }
.widget.widget-table { background: var(--el-table-bg); border-color: var(--el-table-border); }
.widget.widget-table > .table-caption { color: var(--el-table-fg); }
.widget.widget-table > .table-caption::after { content: 'Table'; background: var(--el-table-head); color: var(--el-table-fg); }
.widget.widget-table th { background: var(--el-table-head); border-bottom-color: var(--el-table-border); }
.ddp-carousel, .vseq, .tool-steps { background: var(--el-int-bg); border: 1px solid var(--el-int-border); border-radius: var(--radius); }
.vseq, .tool-steps { padding: 18px 16px; }

/* Quizzes and self-checks (teal family; reserved for future content) */
.quiz { margin: 20px 0; padding: 16px 18px; background: var(--el-quiz-bg); border: 1px solid var(--el-quiz-border); border-radius: var(--radius); }
.quiz .quiz-title { font-family: var(--font-head); font-size: 14px; font-weight: 600; color: var(--el-quiz-fg); margin-bottom: 8px; }
.quiz .quiz-option { display: block; width: 100%; text-align: left; padding: 10px 14px; margin-bottom: 6px; background: var(--bg); border: 1px solid var(--el-quiz-border); border-radius: var(--radius-sm); font-size: 15px; }
.quiz .quiz-option:hover { border-color: var(--el-quiz-fg); }
.quiz .quiz-option.correct { border-color: var(--success); background: var(--success-soft); }
.quiz .quiz-option.wrong { border-color: var(--destructive); }
.checklist-container { margin: 20px 0; }
.checklist-progress { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; padding: 12px 16px; background: var(--muted-2); border: 1px solid var(--border); border-radius: var(--radius); }
.checklist-progress .cp-bar { flex: 1; height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; }
.checklist-progress .cp-fill { height: 100%; background: var(--accent); border-radius: 3px; transition: width .3s ease; }
.checklist-progress .cp-text { font-size: 12.5px; font-weight: 500; color: var(--text-2); white-space: nowrap; }
.checklist-phase { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 8px; overflow: hidden; }
.checklist-phase.checked { border-color: var(--success-border); background: var(--success-soft); }
.checklist-phase-header { display: flex; align-items: center; gap: 12px; padding: 14px 18px; cursor: pointer; }
.checklist-check { width: 22px; height: 22px; border-radius: 6px; border: 2px solid var(--border-strong); display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: 12px; color: transparent; background: var(--bg); }
.checklist-phase.checked .checklist-check { background: var(--success); border-color: var(--success); color: #fff; }
.checklist-phase-num { font-family: var(--font-head); font-size: 11px; font-weight: 600; width: 24px; height: 24px; border-radius: 50%; background: var(--muted); display: flex; align-items: center; justify-content: center; flex-shrink: 0; color: var(--text-2); }
.checklist-phase-title { font-family: var(--font-head); font-size: 15px; font-weight: 600; flex: 1; }
.checklist-phase-detail { padding: 0 18px 14px 58px; font-size: 14.5px; line-height: 1.6; color: var(--text-2); display: none; }
.checklist-phase.open .checklist-phase-detail { display: block; }
.checklist-phase-header .chevron { font-size: 14px; color: var(--muted-fg); transition: transform .2s; margin-left: auto; }
.checklist-phase.open .checklist-phase-header .chevron { transform: rotate(90deg); }

.ddp-times-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.ddp-times-table th { text-align: left; padding: 10px 14px; font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-2); border-bottom: 1px solid var(--border); background: var(--muted); }
.ddp-times-table td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.ddp-times-table tr:last-child td { border-bottom: none; }
.ddp-times-table td:first-child { font-weight: 500; }
.ddp-times-table svg { flex-shrink: 0; color: var(--muted-fg); }

.platform-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; margin: 20px 0; }
.platform-card { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; position: relative; overflow: hidden; }
.platform-card .pc-name { font-family: var(--font-head); font-size: 16px; font-weight: 600; margin-bottom: 10px; }
.platform-card .pc-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.pc-badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 99px; font-size: 11.5px; font-weight: 500; background: var(--muted); color: var(--text-2); border: 1px solid var(--border); }
.platform-card .pc-detail { font-size: 14px; line-height: 1.6; color: var(--text-2); }
.platform-card .pc-detail strong { color: var(--fg); }

.metric-cards { margin: 20px 0; }
.metric-row { display: flex; align-items: center; gap: 14px; padding: 14px 18px; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 8px; }
.metric-label { font-size: 14px; font-weight: 500; min-width: 140px; }
.metric-bar-track { flex: 1; height: 8px; background: var(--muted); border-radius: 4px; overflow: hidden; }
.metric-bar-fill { height: 100%; border-radius: 4px; transition: width .6s ease; background: var(--accent); }
.metric-bar-fill.high { background: var(--success); }
.metric-bar-fill.medium { background: var(--accent); }
.metric-bar-fill.low { background: var(--ring); }
.metric-value { font-size: 13px; font-weight: 600; min-width: 70px; text-align: right; }
.metric-note { font-size: 11.5px; color: var(--muted-fg); margin-top: 2px; }

.accordion-cards { margin: 20px 0; }
.accordion-card { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 8px; overflow: hidden; }
.accordion-card.open { border-color: var(--border-strong); }
.accordion-header { display: flex; align-items: center; gap: 14px; padding: 14px 18px; cursor: pointer; }
.accordion-header:hover { background: var(--muted-2); }
.accordion-header .acc-icon { width: 40px; height: 40px; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; font-size: 18px; flex-shrink: 0; background: var(--muted) !important; }
.accordion-header .acc-title { font-family: var(--font-head); font-size: 15px; font-weight: 600; flex: 1; }
.accordion-header .acc-subtitle { font-size: 13px; font-weight: 400; color: var(--muted-fg); line-height: 1.4; }
.accordion-header .acc-chevron { font-size: 16px; color: var(--muted-fg); transition: transform .2s; }
.accordion-card.open .acc-chevron { transform: rotate(90deg); }
.accordion-body { display: none; padding: 0 18px 16px; }
.accordion-card.open .accordion-body { display: block; }
.accordion-body p, .accordion-body li { font-size: 14.5px; line-height: 1.65; color: var(--text-2); }


.tabbed-container { margin: 20px 0; }
.tab-buttons { display: flex; gap: 2px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.tab-btn { padding: 9px 16px; font-size: 13.5px; font-weight: 500; color: var(--muted-fg); border-bottom: 2px solid transparent; margin-bottom: -1px; font-family: var(--font-head); }
.tab-btn:hover { color: var(--fg); }
.tab-btn.active { color: var(--fg); border-bottom-color: var(--accent); }
.tab-panel { display: none; padding: 18px 0 0; }
.tab-panel.active { display: block; }

.stat-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; margin: 20px 0; }
.stat-card { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.stat-card .sc-study { font-family: var(--font-head); font-size: 13.5px; font-weight: 600; margin-bottom: 4px; }
.stat-card .sc-design { font-size: 11.5px; color: var(--muted-fg); margin-bottom: 8px; }
.stat-card .sc-rate { font-family: var(--font-head); font-size: 22px; font-weight: 600; }
.stat-card .sc-bar { height: 4px; background: var(--muted); border-radius: 2px; margin-top: 8px; overflow: hidden; }
.stat-card .sc-bar-fill { height: 100%; border-radius: 2px; background: var(--accent) !important; }

/* DDP categories carousel */
.ddp-carousel { position: relative; margin: 24px 0; padding: 18px 48px; }
.ddp-carousel-viewport { overflow: hidden; border-radius: var(--radius); }
.ddp-carousel-strip { display: flex; transition: transform .35s ease; }
.ddp-carousel-card { width: 100%; flex-shrink: 0; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 26px 28px 24px; }
.ddp-carousel-card .dcc-header { display: flex; align-items: center; margin-bottom: 14px; }
.ddp-carousel-card .dcc-icon { width: 46px; height: 46px; border-radius: var(--radius); display: flex; flex-shrink: 0; align-items: center; justify-content: center; margin-right: 14px; background: var(--muted) !important; }
.ddp-carousel-card .dcc-icon svg { width: 22px; height: 22px; stroke: var(--text); }
.ddp-carousel-card .dcc-title-group { display: flex; flex-direction: column; }
.ddp-carousel-card .dcc-num { font-family: var(--font-head); font-size: 11px; font-weight: 600; color: var(--muted-fg); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 2px; }
.ddp-carousel-card .dcc-title { font-family: var(--font-head); font-size: 19px; font-weight: 600; }
.ddp-carousel-card .dcc-text { font-size: 16.5px; line-height: 1.65; color: var(--text); }
.ddp-carousel-card .dcc-text p { margin: 0; }
.ddp-carousel-arrow, .xplat-arrow {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 2; width: 38px; height: 38px; border-radius: 50%;
  background: var(--bg); border: 1px solid var(--border); display: flex; align-items: center; justify-content: center;
  font-size: 20px; line-height: 1; color: var(--text); box-shadow: var(--shadow);
}
.ddp-carousel-arrow:hover, .xplat-arrow:hover { border-color: var(--border-strong); background: var(--muted-2); }
.ddp-carousel-arrow.ddp-prev { left: 6px; }
.ddp-carousel-arrow.ddp-next { right: 6px; }
.xplat-arrow.xp-prev { left: 0; }
.xplat-arrow.xp-next { right: 0; }
.ddp-carousel-dots { display: flex; justify-content: center; margin-top: 14px; }
.ddp-carousel-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--border); margin: 0 4px; padding: 0; transition: background .2s; }
.ddp-carousel-dot.active { background: var(--accent); }
.ddp-carousel-dot:hover { background: var(--ring); }

/* Vertical sequence (Format Instability) */
.vseq { margin: 24px 0; position: relative; }
.vseq-block { position: relative; padding-left: 40px; }
.vseq-block::before { content: ''; position: absolute; left: 15px; top: 36px; bottom: 0; width: 2px; background: var(--border); }
.vseq-block:last-child::before { display: none; }
.vseq-dot { position: absolute; left: 8px; top: 26px; width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--accent); background: var(--bg); z-index: 1; }
.vseq-card { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px 24px; margin-bottom: 14px; position: relative; overflow: hidden; }
.vseq-num { font-family: var(--font-head); font-size: 11px; font-weight: 600; color: var(--muted-fg); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 4px; }
.vseq-title { font-family: var(--font-head); font-size: 17px; font-weight: 600; margin-bottom: 8px; }
.vseq-text { font-size: 16.5px; line-height: 1.65; color: var(--text); }
.vseq-text p { margin: 0 0 8px; }
.vseq-text p:last-child { margin-bottom: 0; }
.vseq-hidden { display: none; }
.vseq-hidden.vseq-show { display: block; }
.vseq-toggle { display: inline-flex; align-items: center; gap: 6px; margin: 12px 0 0 40px; padding: 8px 16px; border-radius: var(--radius-sm); background: var(--bg); border: 1px solid var(--border); font-family: var(--font-head); font-size: 13.5px; font-weight: 500; color: var(--text-2); }
.vseq-toggle:hover { border-color: var(--border-strong); color: var(--fg); }
.vseq-toggle .vseq-chevron { transition: transform .25s; font-size: 15px; }
.vseq-toggle.open .vseq-chevron { transform: rotate(180deg); }

/* DDP tools: list + detail panel */
.tool-master-detail { display: flex; gap: 16px; margin: 20px 0; min-height: 260px; }
.tool-list { display: flex; flex-direction: column; gap: 6px; width: 290px; flex-shrink: 0; }
.tool-flip { perspective: 800px; cursor: pointer; height: 60px; transition: height .3s ease; }
.tool-flip.flipped { height: 264px; }
.tool-flip-inner { position: relative; width: 100%; height: 100%; transform-style: preserve-3d; transition: transform .4s; }
.tool-flip.flipped .tool-flip-inner { transform: rotateY(180deg); }
.tool-flip-front, .tool-flip-back { position: absolute; inset: 0; backface-visibility: hidden; border-radius: var(--radius); border: 1px solid var(--border); overflow: hidden; background: var(--bg); }
.tool-flip-front { display: flex; align-items: center; padding: 10px 14px; }
.tool-flip.active .tool-flip-front { border-color: var(--accent); background: var(--accent-soft); }
.tool-flip-front:hover { border-color: var(--border-strong); }
.tool-flip-front .ti-icon { width: 34px; height: 34px; border-radius: var(--radius-sm); display: flex; flex-shrink: 0; align-items: center; justify-content: center; margin-right: 12px; background: var(--muted) !important; }
.tool-flip-front .ti-icon svg { width: 17px; height: 17px; stroke: var(--text); }
.tool-flip-front .ti-name { font-family: var(--font-head); font-size: 14px; font-weight: 600; }
.tool-flip-front .ti-dev { font-size: 11.5px; color: var(--muted-fg); margin-top: 1px; }
.tool-flip-front .ti-hint { margin-left: auto; font-size: 10.5px; color: var(--muted-fg); letter-spacing: .02em; }
.tool-flip-back { transform: rotateY(180deg); padding: 12px 14px; overflow-y: auto; display: flex; flex-direction: column; }
.tool-flip-back .tf-title { font-family: var(--font-head); font-size: 13px; font-weight: 600; margin-bottom: 8px; padding-bottom: 5px; border-bottom: 1px solid var(--border); }
.tool-flip-back .tf-row { display: flex; justify-content: space-between; padding: 3px 0; font-size: 12.5px; border-bottom: 1px solid var(--muted); }
.tool-flip-back .tf-row:last-child { border-bottom: none; }
.tool-flip-back .tf-label { color: var(--muted-fg); }
.tool-flip-back .tf-val { font-weight: 500; text-align: right; }
.tool-flip-back .tf-val.yes { color: var(--success); }
.tool-flip-back .tf-val.no { color: var(--muted-fg); }
.tool-detail { flex: 1; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px 28px; }
.tool-detail-panel { display: none; }
.tool-detail-panel.active { display: block; }
.tool-detail-panel .td-title { font-family: var(--font-head); font-size: 18px; font-weight: 600; margin-bottom: 12px; padding-bottom: 10px; border-bottom: 1px solid var(--border); }
.tool-detail-panel .td-text { font-size: 15.5px; line-height: 1.65; color: var(--text); }
.tool-detail-panel .td-text p { margin: 0 0 10px; }
.tool-detail-panel .td-text p:last-child { margin-bottom: 0; }
.tool-detail-panel .td-empty { color: var(--muted-fg); font-style: italic; font-size: 14px; }

/* Numbered steps */
.tool-steps { display: flex; flex-direction: column; gap: 10px; }
.tool-step { display: flex; align-items: flex-start; gap: 16px; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 22px; }
.tool-step-num { width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-family: var(--font-head); font-size: 17px; font-weight: 700; color: var(--accent-strong); background: var(--accent-soft) !important; border: 1px solid var(--accent-border); }
.tool-step-body { flex: 1; min-width: 0; }
.tool-step-title { font-family: var(--font-head); font-size: 18px; font-weight: 600; margin-bottom: 6px; }
.tool-step-text { font-size: 16.5px; line-height: 1.65; color: var(--text); }
.tool-step-text p { margin: 0 0 8px; }
.tool-step-text p:last-child { margin-bottom: 0; }

/* Cross-platform flip cards */
.xplat-carousel { position: relative; margin: 24px 0; padding: 0 48px; }
.xplat-viewport { overflow: hidden; border-radius: var(--radius); }
.xplat-strip { display: flex; gap: 14px; transition: transform .35s ease; }
.xplat-flip { perspective: 800px; cursor: pointer; height: 270px; width: calc(33.333% - 10px); flex-shrink: 0; }
.xplat-flip-inner { position: relative; width: 100%; height: 100%; transform-style: preserve-3d; transition: transform .4s; }
.xplat-flip.flipped .xplat-flip-inner { transform: rotateY(180deg); }
.xplat-front, .xplat-back { position: absolute; inset: 0; backface-visibility: hidden; border-radius: var(--radius); border: 1px solid var(--border); overflow: hidden; background: var(--bg); }
.xplat-front { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px 18px; text-align: center; }
.xplat-front:hover { border-color: var(--border-strong); }
.xplat-front .xp-icon { width: 52px; height: 52px; border-radius: var(--radius); display: flex; align-items: center; justify-content: center; margin-bottom: 14px; background: var(--muted) !important; }
.xplat-front .xp-icon svg { width: 26px; height: 26px; stroke: var(--text); }
.xplat-front .xp-name { font-family: var(--font-head); font-size: 17px; font-weight: 600; margin-bottom: 16px; }
.xplat-front .xp-hint { display: flex; align-items: center; font-size: 11.5px; font-weight: 500; color: var(--muted-fg); margin-top: auto; }
.xplat-front .xp-hint svg { width: 14px; height: 14px; margin-right: 4px; }
.xplat-back { transform: rotateY(180deg); padding: 16px 14px; overflow-y: auto; }
.xplat-back .xb-title { font-family: var(--font-head); font-size: 14px; font-weight: 600; margin-bottom: 8px; padding-bottom: 6px; border-bottom: 1px solid var(--border); }
.xplat-back .xb-row { display: flex; justify-content: space-between; padding: 4px 0; font-size: 12.5px; border-bottom: 1px solid var(--muted); }
.xplat-back .xb-row:last-child { border-bottom: none; }
.xplat-back .xb-label { color: var(--muted-fg); flex-shrink: 0; margin-right: 6px; }
.xplat-back .xb-val { font-weight: 500; text-align: right; }

/* ── Responsive ── */
@media (max-width: 1100px) {
  :root { --sidebar-w: 260px; }
  #content { padding: 32px 28px 64px; }
}
@media (max-width: 768px) {
  :root { --sidebar-w: 300px; }
  #sidebar { transform: translateX(calc(-1 * var(--sidebar-w))); box-shadow: none; }
  #sidebar.open { transform: translateX(0); box-shadow: var(--shadow-lg); }
  #main { margin-left: 0; }
  #menu-btn { display: block; }
  #content { padding: 24px 18px 56px; }
  #topbar { padding: 10px 16px; flex-wrap: wrap; gap: 10px; }
  #ask-bar { max-width: 100%; order: 10; width: 100%; }
  #breadcrumb { flex: 1; }
  #mark-complete-btn { padding: 6px 10px; font-size: 12px; }
  .welcome-header h2 { font-size: 28px; }
  .stepper { grid-template-columns: repeat(2, 1fr); }
  .step + .step::before { display: none; }
  .module-grid { grid-template-columns: 1fr; }
  .video-block { grid-template-columns: 1fr; }
  .form-row.two { grid-template-columns: 1fr; }
  .pathway-card:not(.wizard):not(.result) { grid-template-columns: 1fr; }
  .wizard-options { grid-template-columns: 1fr; }
  .video-strip { grid-template-columns: repeat(2, 1fr); }
  .section-nav ol { columns: 1; }
  .section-content p, .section-content li { font-size: 16px; }
  .widget { padding: 12px; }
  .map-row { flex-direction: column; }
  .map-connector { width: auto; height: 24px; }
  .ddp-carousel { padding: 14px 12px; }
  .xplat-carousel { padding: 0; }
  .ddp-carousel-arrow, .xplat-arrow { display: none; }
  .ddp-carousel-card { padding: 20px 18px; }
  .vseq-block { padding-left: 32px; }
  .vseq-card { padding: 18px; }
  .tool-master-detail { flex-direction: column; }
  .tool-list { width: 100%; flex-direction: row; overflow-x: auto; }
  .tool-flip { min-width: 200px; }
  .xplat-flip { height: 250px; width: calc(50% - 7px); }
  #chat-view { height: calc(100vh - 110px); }
  .chat-msg { max-width: 92%; font-size: 15px; }
  #ask-results { max-height: 380px; }
}

/* ── Static copies: site configuration (see scripts/build_static.py) ── */
.welcome-notice {
  margin-top: 14px; max-width: var(--measure); font-size: 15px; line-height: 1.55; color: var(--el-note-fg, var(--text-2));
  background: var(--el-note-bg, var(--muted)); border: 1px solid var(--el-note-border, var(--border)); border-left: 3px solid var(--el-note-bar, var(--accent));
  border-radius: var(--radius-sm); padding: 10px 14px;
}
body.no-assistant #ask-bar, body.no-assistant .sidebar-chat-link, body.no-assistant #chat-view, body.no-assistant .assistant-only { display: none !important; }
/* Modules greyed out on this site */
.module-item.unavailable .module-item-title, .module-item.unavailable .module-item-sections { color: var(--muted-fg); font-weight: 400; }
.module-item.unavailable .module-num { background: var(--muted); color: var(--muted-fg); border-color: var(--border); }
.module-item.unavailable .module-item-header { opacity: .6; }
.module-card.unavailable { background: var(--muted-2, var(--muted)); border-style: dashed; }
.module-card.unavailable .module-card-body { opacity: .55; }
.module-card.unavailable:hover { box-shadow: none; border-color: var(--border); }
.module-card.unavailable .card-arrow { display: none; }
.module-card .card-tier.unavailable { color: var(--muted-fg); background: var(--bg); border-color: var(--border-strong); }
.map-node.unavailable { opacity: .45; border-style: dashed; }
.map-node.unavailable:hover { box-shadow: none; }
.track-item.unavailable .track-title { color: var(--muted-fg); }
.track-item.unavailable .track-order { opacity: .5; }
.info-card.unavailable-card { border-left: 3px solid var(--muted-fg); background: var(--muted-2, var(--muted)); }
.info-card.unavailable-card p { font-size: 16px; line-height: 1.6; max-width: var(--measure); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .45; cursor: not-allowed; pointer-events: none; }
.note.submissions-closed { background: var(--el-note-bg, var(--muted)); border: 1px solid var(--el-note-border, var(--border)); border-left: 3px solid var(--el-note-bar, var(--accent)); border-radius: var(--radius-sm); padding: 12px 16px; margin-bottom: 20px; max-width: var(--measure); }
.note.submissions-closed p { margin: 0; font-size: 15px; line-height: 1.6; }
.contribute-form:has(button[type="submit"]:disabled) { opacity: .75; }

/* ═══════════════════════════════════════════════════════════════
   Learning layer (app-learning.js): lessons, key ideas, activities, progress.
   Activity kinds reuse the element families: teal = checks and tests (quiz family),
   violet = practice (interactive), sky = explore (reference), amber = reflect (notes),
   orange = apply (the reader's own project), neutral = watch (video).
   ═══════════════════════════════════════════════════════════════ */
.i { width: 18px; height: 18px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; vertical-align: middle; }
.k-precheck, .k-check, .k-test { --k-bg: var(--el-quiz-bg); --k-border: var(--el-quiz-border); --k-fg: var(--el-quiz-fg); }
.k-practice { --k-bg: var(--el-int-bg); --k-border: var(--el-int-border); --k-fg: var(--el-int-fg); }
.k-explore { --k-bg: var(--el-table-bg); --k-border: var(--el-table-border); --k-fg: var(--el-table-fg); }
.k-reflect { --k-bg: var(--el-note-bg); --k-border: var(--el-note-border); --k-fg: var(--el-note-fg); }
.k-apply { --k-bg: var(--accent-soft); --k-border: var(--accent-border); --k-fg: #9a3412; }
.k-watch { --k-bg: var(--muted-2); --k-border: var(--border); --k-fg: var(--text-2); }

/* Module header: progress ring, time, reading mode */
.module-meta { display: flex; align-items: center; gap: 12px 18px; flex-wrap: wrap; margin-top: 18px; }
.module-ring { position: relative; width: 44px; height: 44px; flex-shrink: 0; }
.ring-track { fill: none; stroke: var(--border); stroke-width: 3.4; }
.ring-fill { fill: none; stroke: var(--accent); stroke-width: 3.4; stroke-linecap: round; transition: stroke-dasharray .5s ease; }
.module-ring.complete .ring-fill { stroke: var(--success); }
.module-ring-pct { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--font-head); font-size: 11.5px; font-weight: 600; color: var(--fg); }
.module-stats { display: flex; gap: 6px 16px; flex-wrap: wrap; font-size: 14px; color: var(--text-2); }
.module-stats span { display: inline-flex; align-items: center; gap: 6px; }
.module-stats .i { width: 16px; height: 16px; color: var(--muted-fg); }
.mode-toggle { margin-left: auto; display: inline-flex; padding: 3px; border: 1px solid var(--border); border-radius: 99px; background: var(--muted-2); }
.mode-toggle button { display: inline-flex; align-items: center; gap: 6px; padding: 6px 13px; border-radius: 99px; font-size: 13.5px; color: var(--text-2); }
.mode-toggle button .i { width: 15px; height: 15px; }
.mode-toggle button[aria-pressed="true"] { background: var(--bg); color: var(--fg); font-weight: 500; box-shadow: var(--shadow); }

/* Lesson map (replaces "In This Module" when a module has lessons) */
.lesson-map { background: var(--muted-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px 20px; margin-bottom: 36px; }
.lesson-map-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.lesson-map-head h3 { font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--muted-fg); }
.lesson-map-head span { font-size: 13px; color: var(--muted-fg); }
.lesson-list { list-style: none; display: grid; gap: 8px; }
.lesson-row { display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; gap: 14px; align-items: start; padding: 12px 14px; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.lesson-num { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--muted); color: var(--text-2); font-family: var(--font-head); font-size: 13px; font-weight: 600; }
.lesson-row[data-state="started"] .lesson-num { background: var(--accent-soft); color: #9a3412; box-shadow: inset 0 0 0 1.5px var(--accent); }
.lesson-row[data-state="done"] .lesson-num { background: var(--success-soft); color: var(--success); }
.lesson-main a { font-family: var(--font-head); font-size: 16px; font-weight: 600; color: var(--fg); text-decoration: none; }
.lesson-main a:hover { text-decoration: underline; text-decoration-color: var(--accent-strong); }
.lesson-goal { font-size: 14px; color: var(--text-2); margin-top: 3px; line-height: 1.45; }
.lesson-secs { font-size: 12.5px; color: var(--muted-fg); margin-top: 6px; line-height: 1.45; }
.lesson-side { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; font-size: 13px; color: var(--muted-fg); white-space: nowrap; }
.lesson-state .i { color: var(--success); width: 20px; height: 20px; }
.lesson-map-more { margin-top: 12px; font-size: 14px; }

/* Lesson band at the start of each lesson */
.lesson-head {
  position: relative; overflow: hidden; margin: 56px 0 24px; padding: 20px 24px 20px;
  background: var(--primary) url("assets/graphics/motif-arcs.svg") no-repeat right -40px center / auto 170%;
  border-radius: var(--radius-lg); color: var(--primary-fg);
}
.lesson-kicker { display: inline-flex; align-items: center; gap: 8px; font-family: var(--font-head); font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: #fdba74; }
.lesson-kicker .i { width: 16px; height: 16px; }
.lesson-head .lesson-title { font-family: var(--font-head); font-size: 23px; font-weight: 600; line-height: 1.25; margin: 6px 0 4px; color: #fff; max-width: 40ch; }
.lesson-head .lesson-goal { font-size: 15px; color: #cbd5e1; margin: 0; max-width: 60ch; }

/* Key idea at the top of a section; skim mode folds the section body under it */
.key-idea { margin: 0 0 16px; padding: 12px 16px 13px; background: var(--accent-soft); border-left: 3px solid var(--accent); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; max-width: var(--measure); }
.key-idea-label { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: #9a3412; }
.key-idea-label .i { width: 15px; height: 15px; }
.key-idea p { margin: 4px 0 0; font-size: 17px; line-height: 1.55; font-weight: 500; color: var(--fg); }
.section-more { display: none; align-items: center; gap: 6px; margin: 0 0 8px; padding: 6px 12px 6px 8px; border: 1px solid var(--border); border-radius: 99px; font-size: 13.5px; color: var(--text-2); background: var(--bg); }
.section-more:hover { border-color: var(--border-strong); color: var(--fg); }
.section-more .i { width: 16px; height: 16px; transition: transform .2s; }
.section-more[aria-expanded="true"] .i { transform: rotate(180deg); }
.skim .section-more { display: inline-flex; }
.skim .section-body { display: none; }
.skim .section-body.open { display: block; }
.skim .section-block { margin-bottom: 28px; }
.sec-end { height: 1px; }

/* Activity card */
.activity { margin: 28px 0; background: var(--bg); border: 1px solid var(--k-border, var(--border)); border-radius: var(--radius); overflow: hidden; scroll-margin-top: 80px; }
.activity-head { display: flex; align-items: center; gap: 8px 14px; flex-wrap: wrap; padding: 9px 16px; background: var(--k-bg, var(--muted-2)); border-bottom: 1px solid var(--k-border, var(--border)); }
.activity-kind { display: inline-flex; align-items: center; gap: 8px; font-family: var(--font-head); font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--k-fg, var(--text-2)); }
.activity-kind .i { width: 17px; height: 17px; }
.activity-meta { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; color: var(--muted-fg); }
.activity-meta .i { width: 14px; height: 14px; }
.activity-status { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 500; color: var(--success); }
.activity-status .i { width: 16px; height: 16px; }
.activity-title { font-family: var(--font-head); font-size: 18px; font-weight: 600; line-height: 1.3; color: var(--fg); padding: 14px 18px 0; }
.activity-body { padding: 12px 18px 18px; }
.activity-body.h5p-host { min-height: 64px; }
.activity-start { display: inline-flex; align-items: center; gap: 8px; padding: 10px 16px; border-radius: var(--radius-sm); background: var(--primary); color: var(--primary-fg); font-weight: 500; font-size: 14.5px; }
.activity-start:hover { background: var(--dark-lighter); }
.activity-start .i { width: 16px; height: 16px; }
.activity-loading, .activity-pending, .activity-error { font-size: 14px; color: var(--muted-fg); display: flex; align-items: center; gap: 8px; }
.activity-loading::before { content: ''; width: 14px; height: 14px; border: 2px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: aio-spin .8s linear infinite; }
@keyframes aio-spin { to { transform: rotate(360deg); } }
.activity-error { color: var(--destructive); }
.activity-notice { display: flex; gap: 10px; align-items: flex-start; margin: 12px 18px 0; padding: 10px 14px; background: var(--muted-2); border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 14.5px; line-height: 1.5; }
.activity-notice[hidden] { display: none; }
.activity-notice .i { color: var(--accent-strong); margin-top: 2px; }
.activity .h5p-iframe-wrapper, .activity iframe.h5p-iframe { width: 100%; border: 0; }
.activity.is-done { border-color: var(--k-border, var(--border)); }

/* Reflect */
.reflect-prompt { display: block; font-size: 16px; font-weight: 500; color: var(--fg); line-height: 1.5; max-width: var(--measure); }
.reflect-hint { font-size: 14px; color: var(--text-2); margin: 4px 0 0; max-width: var(--measure); }
.reflect-input { display: block; width: 100%; margin-top: 10px; padding: 10px 12px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); font: inherit; font-size: 15px; line-height: 1.55; resize: vertical; background: var(--bg); color: var(--text); }
.reflect-input:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
.reflect-foot { margin-top: 8px; font-size: 13px; color: var(--muted-fg); }

/* Checklist */
.checklist-intro { font-size: 15px; color: var(--text-2); margin-bottom: 10px; max-width: var(--measure); }
.checklist-group { border: 0; margin: 0 0 12px; }
.checklist-group legend { font-family: var(--font-head); font-size: 14px; font-weight: 600; color: var(--fg); margin-bottom: 6px; }
.checklist-item { display: flex; gap: 10px; align-items: flex-start; padding: 6px 0; font-size: 15.5px; line-height: 1.45; cursor: pointer; max-width: var(--measure); }
.checklist-item input { margin-top: 3px; width: 17px; height: 17px; accent-color: var(--success); flex-shrink: 0; }
.checklist-item input:checked + span { color: var(--muted-fg); text-decoration: line-through; text-decoration-color: var(--border-strong); }
.checklist-foot { margin-top: 8px; }
.checklist-foot .btn-ghost, .plan-actions .btn-primary, .completion-text .btn-primary { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: var(--radius-sm); font-size: 14px; font-weight: 500; }
.checklist-foot .btn-ghost { border: 1px solid var(--border); }

/* Completion card at the end of a module */
.completion-card { display: flex; gap: 20px; align-items: center; margin: 44px 0 0; padding: 20px 22px; background: var(--muted-2); border: 1px solid var(--border); border-radius: var(--radius-lg); }
.completion-card.complete { background: var(--success-soft); border-color: var(--success-border); }
.completion-badge { flex-shrink: 0; }
.badge-img { width: 92px; height: 92px; display: block; filter: grayscale(1); opacity: .4; }
.badge-img.earned { filter: none; opacity: 1; }
.completion-kicker { font-family: var(--font-head); font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted-fg); }
.completion-card.complete .completion-kicker { color: var(--success); }
.completion-text p { margin: 4px 0 10px; font-size: 15.5px; line-height: 1.5; color: var(--text); }
.completion-left { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; }
.completion-left a { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border: 1px solid var(--border); border-radius: 99px; background: var(--bg); font-size: 13.5px; text-decoration: none; color: var(--text); }
.completion-left a:hover { border-color: var(--border-strong); }
.completion-left .i { width: 15px; height: 15px; color: var(--muted-fg); }

/* Sidebar and module cards */
.sidebar-subs li.sidebar-lesson { border-left: none; padding: 9px 0 3px; font-size: 10.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted-fg); line-height: 1.3; }
.sidebar-subs li.read a { color: var(--text-2); }
.sidebar-subs li.read { border-left-color: var(--success-border); }
.module-num.in-progress { border: none; color: var(--fg); background: radial-gradient(closest-side, var(--muted-2) 78%, transparent 80% 100%), conic-gradient(var(--accent) calc(var(--p) * 1%), var(--border) 0); }
.module-item.active .module-num.in-progress { background: radial-gradient(closest-side, var(--primary) 78%, transparent 80% 100%), conic-gradient(var(--accent) calc(var(--p) * 1%), var(--border-strong) 0); color: var(--primary-fg); }
.card-progress { height: 3px; margin-top: 14px; background: var(--border); border-radius: 2px; overflow: hidden; }
.card-progress span { display: block; height: 100%; background: var(--accent); }
.module-card.completed .card-progress span { background: var(--success); }

/* My study plan */
.plan-actions { margin: -8px 0 28px; }
.plan-h { font-size: 15px; font-weight: 600; margin: 28px 0 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted-fg); }
.plan-list { list-style: none; display: grid; gap: 8px; }
.plan-row { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 10px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.plan-badge { width: 40px; height: 40px; filter: grayscale(1); opacity: .35; }
.plan-badge.earned { filter: none; opacity: 1; }
.plan-mod a { font-weight: 500; text-decoration: none; color: var(--fg); }
.plan-bar { height: 4px; margin-top: 8px; background: var(--border); border-radius: 2px; overflow: hidden; }
.plan-bar span { display: block; height: 100%; background: var(--accent); }
.plan-row.done .plan-bar span { background: var(--success); }
.plan-pct { font-size: 13.5px; color: var(--muted-fg); white-space: nowrap; }
.plan-note { padding: 12px 16px; border: 1px solid var(--el-note-border); background: var(--el-note-bg); border-radius: var(--radius-sm); margin-bottom: 10px; }
.plan-note-mod { font-size: 12px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--el-note-fg); }
.plan-note-q { font-weight: 500; color: var(--fg); margin-top: 2px; }
.plan-note p { margin: 6px 0 0; font-size: 15px; line-height: 1.55; }
.plan-empty { font-size: 14.5px; color: var(--muted-fg); }

@media (max-width: 768px) {
  .mode-toggle { margin-left: 0; }
  .lesson-row { grid-template-columns: 28px minmax(0, 1fr); }
  .lesson-side { grid-column: 2; flex-direction: row; align-items: center; }
  .lesson-head { padding: 18px 18px; background-size: auto 130%; }
  .lesson-head .lesson-title { font-size: 20px; }
  .activity-body { padding: 10px 12px 14px; }
  .activity-title { padding: 12px 12px 0; }
  .completion-card { flex-direction: column; align-items: flex-start; }
}

/* Diagrams and animations (learning layer) */
.module-emblem { width: 40px; height: 40px; display: block; margin-bottom: 12px; border-radius: 10px; }
.lx-figure { margin: 22px 0 26px; padding: 18px 18px 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg); }
.lx-figure figcaption { font-size: 14px; color: var(--muted-fg); margin-top: 8px; text-align: center; }
.lx-diagram { width: 100%; }
.lx-svg { display: block; width: 100%; height: auto; max-height: 640px; }
.lx-svg.stepped [data-step] { opacity: .12; transition: opacity .45s ease; }
.lx-svg.stepped [data-step].on { opacity: 1; }
.lx-svg .step.current circle:first-child { filter: drop-shadow(0 0 6px rgba(249, 115, 22, .45)); }
.anim-stage { margin-bottom: 12px; }
.anim-caption { display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; align-items: baseline; padding: 12px 14px; background: var(--muted-2); border: 1px solid var(--border); border-radius: var(--radius-sm); min-height: 72px; }
.anim-count { grid-row: span 2; font-family: var(--font-head); font-size: 12px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--accent-strong); white-space: nowrap; }
.anim-label { font-family: var(--font-head); font-size: 16px; color: var(--fg); }
.anim-text { margin: 0; font-size: 15px; line-height: 1.5; color: var(--text); }
.anim-controls { display: flex; gap: 8px; justify-content: center; margin-top: 12px; }
.anim-controls button { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 99px; font-size: 14px; border: 1px solid var(--border); }
.anim-controls .btn-primary { border-color: var(--primary); }
.i.flip { transform: scaleX(-1); }

/* Citation card (app-citations.js) */
.citation-link[data-cite] { cursor: pointer; text-decoration-style: dotted; }
.cite-pop { position: fixed; z-index: 400; width: min(440px, calc(100vw - 32px)); max-height: min(70vh, 520px); overflow: auto; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 14px 16px 16px; }
.cite-pop.sheet { left: 0; right: 0; bottom: 0; top: auto; width: auto; max-height: 75vh; border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
.cite-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.cite-head .i { color: var(--accent-strong); width: 16px; height: 16px; }
.cite-label { font-family: var(--font-head); font-size: 13px; font-weight: 600; color: var(--text-2); flex: 1; }
.cite-close { font-size: 20px; line-height: 1; color: var(--muted-fg); padding: 0 4px; }
.cite-title { font-family: var(--font-head); font-size: 16px; font-weight: 600; color: var(--fg); line-height: 1.35; }
.cite-meta { font-size: 13px; color: var(--muted-fg); margin-top: 2px; }
.cite-from { margin-top: 12px; font-size: 11.5px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--el-table-fg); }
.cite-passage { margin: 6px 0 0; padding: 10px 12px; background: var(--el-table-bg); border-left: 3px solid var(--el-table-border); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; font-size: 14.5px; line-height: 1.55; color: var(--text); }
.cite-note { font-size: 12.5px; color: var(--muted-fg); margin: 8px 0 0; line-height: 1.45; }
.cite-open { display: inline-flex; align-items: center; gap: 6px; margin-top: 12px; font-size: 14px; font-weight: 500; }
.cite-open .i { width: 14px; height: 14px; }

/* Account (app-account.js): optional sign-in, sync status, dialog */
.account-box { margin: 10px 20px 4px; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg); }
.account-box[hidden] { display: none; }
.account-signin { display: flex; align-items: center; gap: 8px; width: 100%; font-size: 14px; font-weight: 500; color: var(--fg); text-align: left; }
.account-signin .i { width: 17px; height: 17px; color: var(--accent-strong); }
.account-signin:hover span { text-decoration: underline; text-decoration-color: var(--accent-strong); }
.account-hint { margin: 4px 0 0 25px; font-size: 12px; color: var(--muted-fg); line-height: 1.4; }
.account-who { display: flex; align-items: center; gap: 10px; }
.account-avatar { width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0; display: grid; place-items: center; background: var(--primary); color: var(--primary-fg); font-family: var(--font-head); font-size: 12.5px; font-weight: 600; }
.account-id { min-width: 0; }
.account-id b { display: block; font-size: 13.5px; font-weight: 600; color: var(--fg); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-id small { display: block; font-size: 12px; color: var(--muted-fg); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-status { display: flex; align-items: center; gap: 6px; margin-top: 8px; font-size: 12px; color: var(--success); }
.account-status.warn { color: var(--el-note-fg); }
.account-status .i { width: 14px; height: 14px; }
.account-actions { display: flex; gap: 12px; margin-top: 6px; }
.account-link { font-size: 12.5px; color: var(--text-2); text-decoration: underline; text-decoration-color: var(--border-strong); }
.account-link:hover { color: var(--fg); }
.account-dialog-backdrop { position: fixed; inset: 0; z-index: 500; background: rgba(15, 23, 42, .45); display: grid; place-items: center; padding: 16px; }
.account-dialog { width: min(520px, 100%); background: var(--bg); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); padding: 22px 24px; }
.account-dialog h3 { font-size: 20px; font-weight: 600; margin-bottom: 10px; }
.account-dialog p { font-size: 14.5px; line-height: 1.6; color: var(--text); margin: 0 0 12px; }
.account-dialog-actions { display: flex; gap: 10px; flex-wrap: wrap; margin: 16px 0 10px; }
.account-dialog-actions .btn-primary, .account-dialog-actions .btn-ghost { display: inline-flex; align-items: center; gap: 8px; padding: 9px 16px; border-radius: var(--radius-sm); font-size: 14.5px; font-weight: 500; text-decoration: none; }
.account-dialog-actions .btn-ghost { border: 1px solid var(--border); }
.account-dialog .account-fine { font-size: 12.5px; color: var(--muted-fg); margin: 0; }
.account-toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 600; max-width: calc(100vw - 32px); padding: 10px 16px; border-radius: var(--radius-sm); background: var(--primary); color: var(--primary-fg); font-size: 14px; box-shadow: var(--shadow-lg); }
.plan-account { display: flex; gap: 16px; align-items: center; justify-content: space-between; flex-wrap: wrap; margin: 0 0 24px; padding: 14px 18px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--muted-2); }
.plan-account.signed-in { background: var(--success-soft); border-color: var(--success-border); }
.plan-account b { font-family: var(--font-head); font-size: 15px; color: var(--fg); }
.plan-account p { margin: 2px 0 0; font-size: 14px; color: var(--text-2); max-width: 60ch; }
.plan-account-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.plan-account .btn-primary, .plan-account .btn-ghost { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: var(--radius-sm); font-size: 14px; font-weight: 500; text-decoration: none; border: 1px solid var(--border); }
.plan-account .btn-ghost.danger { color: var(--destructive); }
