/* ============================================================
   COLD STANDARD CERTIFIED — LMS component CSS
   ------------------------------------------------------------
   Layered ON TOP of styles.css. Loaded after it. This file
   defines ONLY LMS component classes; it does NOT redefine the
   design tokens in :root (--navy, --ice, --radius, etc.) — it
   consumes them. Match the navy/ice aesthetic of certified.html
   exactly: Inter, generous whitespace, premium feel.

   Covers:
     1.  /learn top-nav shell (.lms-nav)
     2.  Page scaffold + container helpers
     3.  Course-player two-column layout (sidebar + content pane)
     4.  Lesson sidebar (module/lesson list, status dots)
     5.  Rendered-markdown lesson typography (.lms-lesson-body)
     6.  Video frame (16:9) + "Video coming soon" placeholder
     7.  Quiz / exam question cards + selected/correct/incorrect
     8.  Circular progress rings (.ring)
     9.  Module status pills (locked / active / passed)
     10. Certificate layout (print-friendly)
     11. AI-tutor chat panel
     12. Buttons, badges, toasts, utility, responsive
   ============================================================ */

/* A couple of LMS-scoped helper variables built FROM the existing
   tokens — these are not token redefinitions, just local aliases
   for repeated component values. */
:root {
  --lms-sidebar-w: 320px;
  --lms-nav-h: 64px;
  --lms-pane-max: 820px;
  --ok: #22c55e;
  --ok-bg: rgba(34, 197, 94, 0.12);
  --ok-border: rgba(34, 197, 94, 0.4);
  --bad: #ef4444;
  --bad-bg: rgba(239, 68, 68, 0.10);
  --bad-border: rgba(239, 68, 68, 0.4);
  --warn: #f59e0b;
  --warn-bg: rgba(245, 158, 11, 0.12);
  --lock: var(--gray-400);
}

/* Pages that use the LMS shell get a light app background so the
   white content panes read as cards. */
.lms-body {
  background: var(--gray-50);
  color: var(--gray-800);
  min-height: 100vh;
}

/* ============================================================
   1. /LEARN TOP-NAV SHELL
   ============================================================ */
.lms-nav {
  position: sticky;
  top: 0;
  z-index: 1000;
  height: var(--lms-nav-h);
  background: var(--navy);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
}
.lms-nav-inner {
  width: 100%;
  max-width: 1320px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 24px;
}
.lms-nav-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  color: var(--white);
  white-space: nowrap;
}
.lms-nav-logo img { height: 28px; width: auto; }
.lms-nav-logo .logo-mark { color: var(--ice); }

/* Center context (e.g. course title / breadcrumb) */
.lms-nav-context {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--gray-400);
  font-size: 0.85rem;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.lms-nav-context a { color: var(--gray-300); transition: var(--transition); }
.lms-nav-context a:hover { color: var(--ice); }
.lms-nav-context .sep { color: var(--gray-600); }

/* Right side: progress mini-ring + account menu */
.lms-nav-right {
  display: flex;
  align-items: center;
  gap: 18px;
}
.lms-nav-progress {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--gray-300);
  font-size: 0.8rem;
  font-weight: 600;
}
.lms-nav-progress .ring-mini { flex-shrink: 0; }

/* Account dropdown */
.lms-account {
  position: relative;
}
.lms-account-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 100px;
  padding: 6px 8px 6px 14px;
  color: var(--white);
  font-family: var(--font);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}
.lms-account-btn:hover { border-color: rgba(126, 200, 227, 0.4); }
.lms-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--ice);
  color: var(--navy);
  display: grid;
  place-items: center;
  font-size: 0.8rem;
  font-weight: 800;
  flex-shrink: 0;
}
.lms-account-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 10px);
  min-width: 220px;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 8px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: var(--transition);
}
.lms-account-menu.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.lms-account-menu .menu-head {
  padding: 10px 12px;
  border-bottom: 1px solid var(--gray-100);
  margin-bottom: 6px;
}
.lms-account-menu .menu-head strong { display: block; color: var(--navy); font-size: 0.9rem; }
.lms-account-menu .menu-head span { color: var(--gray-500); font-size: 0.78rem; }
.lms-account-menu a,
.lms-account-menu button {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  background: none;
  border: none;
  text-align: left;
  font-family: var(--font);
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--gray-700, #334155);
  cursor: pointer;
  transition: var(--transition);
}
.lms-account-menu a:hover,
.lms-account-menu button:hover { background: var(--gray-50); color: var(--navy); }

/* Mobile nav toggle for the sidebar (course player) */
.lms-nav-burger {
  display: none;
  flex-direction: column;
  gap: 4px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  padding: 9px 10px;
  cursor: pointer;
}
.lms-nav-burger span {
  width: 18px;
  height: 2px;
  background: var(--white);
  border-radius: 2px;
}

/* ============================================================
   2. PAGE SCAFFOLD
   ============================================================ */
.lms-shell {
  max-width: 1320px;
  margin: 0 auto;
  padding: 0 24px;
}
.lms-page {
  max-width: 1000px;
  margin: 0 auto;
  padding: 40px 24px 80px;
}
.lms-page-wide { max-width: 1200px; }

.lms-page-head {
  margin-bottom: 32px;
}
.lms-eyebrow {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ice);
  margin-bottom: 10px;
}
.lms-page-head h1 {
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  color: var(--navy);
  margin-bottom: 8px;
}
.lms-page-head .sub { color: var(--gray-500); font-size: 1.05rem; }

/* Generic card used across dashboard, quiz intro, etc. */
.lms-card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow);
}
.lms-card + .lms-card { margin-top: 20px; }
.lms-card-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 4px;
}
.lms-card-sub { color: var(--gray-500); font-size: 0.92rem; margin-bottom: 18px; }

/* ============================================================
   3. COURSE-PLAYER TWO-COLUMN LAYOUT
   ============================================================ */
.player {
  display: grid;
  grid-template-columns: var(--lms-sidebar-w) minmax(0, 1fr);
  align-items: start;
  max-width: 1320px;
  margin: 0 auto;
  min-height: calc(100vh - var(--lms-nav-h));
}

/* Left rail — sticky lesson navigation */
.player-sidebar {
  position: sticky;
  top: var(--lms-nav-h);
  align-self: start;
  height: calc(100vh - var(--lms-nav-h));
  overflow-y: auto;
  background: var(--white);
  border-right: 1px solid var(--gray-200);
  padding: 24px 16px 48px;
}
.player-sidebar::-webkit-scrollbar { width: 8px; }
.player-sidebar::-webkit-scrollbar-thumb {
  background: var(--gray-200);
  border-radius: 8px;
}

/* Right pane — the lesson content */
.player-main {
  min-width: 0;
  padding: 40px 48px 96px;
}
.player-content {
  max-width: var(--lms-pane-max);
  margin: 0 auto;
}

/* ============================================================
   4. LESSON SIDEBAR
   ============================================================ */
.sidebar-course {
  padding: 4px 8px 16px;
  border-bottom: 1px solid var(--gray-100);
  margin-bottom: 12px;
}
.sidebar-course .course-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 12px;
}
.sidebar-course .course-progress {
  display: flex;
  align-items: center;
  gap: 12px;
}
.sidebar-course .course-progress .meta {
  font-size: 0.78rem;
  color: var(--gray-500);
  font-weight: 600;
}

/* Module group header inside the sidebar */
.sidebar-module {
  margin-top: 8px;
}
.sidebar-module-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 8px;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gray-400);
}
.sidebar-module-head .mh-title { flex: 1; min-width: 0; color: var(--gray-500); }

/* Lesson list */
.sidebar-lessons {
  list-style: none;
  margin: 0 0 8px;
  padding: 0;
}
.sidebar-lesson {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 11px 12px;
  border-radius: 10px;
  color: var(--gray-600);
  font-size: 0.9rem;
  font-weight: 500;
  line-height: 1.4;
  cursor: pointer;
  transition: var(--transition);
  border: 1px solid transparent;
}
.sidebar-lesson:hover { background: var(--gray-50); color: var(--navy); }
.sidebar-lesson.active {
  background: var(--ice-glow);
  border-color: rgba(126, 200, 227, 0.35);
  color: var(--navy);
  font-weight: 600;
}
.sidebar-lesson.locked {
  color: var(--gray-400);
  cursor: not-allowed;
}
.sidebar-lesson.locked:hover { background: none; color: var(--gray-400); }

/* Lesson status dot */
.lesson-dot {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  margin-top: 1px;
  border-radius: 50%;
  border: 2px solid var(--gray-300);
  display: grid;
  place-items: center;
  font-size: 0.62rem;
  line-height: 1;
  color: transparent;
  transition: var(--transition);
}
.sidebar-lesson.active .lesson-dot { border-color: var(--ice); }
.sidebar-lesson.complete .lesson-dot {
  background: var(--ok);
  border-color: var(--ok);
  color: var(--white);
}
.sidebar-lesson.locked .lesson-dot { border-color: var(--gray-200); }
.lesson-dot.complete::after { content: "\2713"; color: var(--white); }
.sidebar-lesson .lesson-meta {
  display: block;
  font-size: 0.72rem;
  color: var(--gray-400);
  font-weight: 500;
  margin-top: 2px;
}

/* Quiz CTA pinned in the sidebar at the end of a module */
.sidebar-quiz-cta {
  margin: 12px 8px 4px;
}

/* ============================================================
   5. RENDERED-MARKDOWN LESSON TYPOGRAPHY
   ============================================================ */
.lms-lesson-head {
  margin-bottom: 28px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--gray-100);
}
.lms-lesson-head .crumb {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ice);
  margin-bottom: 10px;
}
.lms-lesson-head h1 {
  font-size: clamp(1.7rem, 3.6vw, 2.4rem);
  color: var(--navy);
  line-height: 1.15;
  margin-bottom: 12px;
}
.lms-lesson-head .lesson-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  color: var(--gray-500);
  font-size: 0.85rem;
  font-weight: 500;
}
.lms-lesson-head .lesson-facts span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* The rendered markdown body */
.lms-lesson-body {
  color: var(--gray-700, #334155);
  font-size: 1.05rem;
  line-height: 1.78;
}
.lms-lesson-body > *:first-child { margin-top: 0; }
.lms-lesson-body h1,
.lms-lesson-body h2,
.lms-lesson-body h3,
.lms-lesson-body h4 {
  color: var(--navy);
  line-height: 1.25;
  margin: 2em 0 0.6em;
  scroll-margin-top: calc(var(--lms-nav-h) + 16px);
}
.lms-lesson-body h2 {
  font-size: 1.6rem;
  padding-bottom: 0.3em;
  border-bottom: 1px solid var(--gray-100);
}
.lms-lesson-body h1 { font-size: 1.8rem; } /* the player already shows the title; body h1 is a safety net */
.lms-lesson-body h3 { font-size: 1.28rem; }
.lms-lesson-body h4 { font-size: 1.08rem; color: var(--navy-mid); }
.lms-lesson-body p { margin: 0 0 1.1em; }
.lms-lesson-body a {
  color: #0e7490;
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-color: rgba(126, 200, 227, 0.6);
}
.lms-lesson-body a:hover { color: var(--navy); }
.lms-lesson-body strong { color: var(--navy); font-weight: 700; }
.lms-lesson-body ul,
.lms-lesson-body ol { margin: 0 0 1.2em; padding-left: 1.5em; }
.lms-lesson-body li { margin: 0.4em 0; }
.lms-lesson-body ul li::marker { color: var(--ice); }
.lms-lesson-body ol li::marker { color: var(--ice); font-weight: 700; }

/* Inline + block code */
.lms-lesson-body code {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
  font-size: 0.88em;
  background: var(--gray-100);
  color: var(--navy);
  padding: 0.15em 0.4em;
  border-radius: 6px;
}
.lms-lesson-body pre {
  background: var(--navy);
  color: var(--ice-light);
  border-radius: var(--radius);
  padding: 18px 20px;
  overflow-x: auto;
  margin: 0 0 1.4em;
  font-size: 0.9rem;
  line-height: 1.6;
}
.lms-lesson-body pre code {
  background: none;
  color: inherit;
  padding: 0;
  font-size: inherit;
}

/* Blockquote / callout */
.lms-lesson-body blockquote {
  margin: 0 0 1.4em;
  padding: 16px 22px;
  background: var(--ice-glow);
  border-left: 4px solid var(--ice);
  border-radius: 0 var(--radius) var(--radius) 0;
  color: var(--navy-mid);
  font-size: 0.98rem;
}
.lms-lesson-body blockquote p:last-child { margin-bottom: 0; }

/* A dedicated SME / instructor callout class the markdown renderer
   can emit for "Instructor note (SME fill-in)" markers. */
.lms-callout {
  margin: 0 0 1.4em;
  padding: 18px 22px;
  border-radius: var(--radius);
  border: 1px solid var(--gray-200);
  background: var(--gray-50);
  font-size: 0.96rem;
  color: var(--gray-700, #334155);
}
.lms-callout .callout-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 8px;
}
.lms-callout.note { border-left: 4px solid var(--ice); }
.lms-callout.note .callout-label { color: #0e7490; }
.lms-callout.warn { border-left: 4px solid var(--warn); background: var(--warn-bg); }
.lms-callout.warn .callout-label { color: #b45309; }
.lms-callout.sme {
  border: 1px dashed rgba(126, 200, 227, 0.5);
  background: var(--ice-glow);
}
.lms-callout.sme .callout-label { color: #0e7490; }

/* Tables */
.lms-lesson-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 1.6em;
  font-size: 0.94rem;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  overflow: hidden;
}
.lms-lesson-body thead th {
  background: var(--navy);
  color: var(--white);
  text-align: left;
  font-weight: 600;
  padding: 12px 16px;
  font-size: 0.82rem;
  letter-spacing: 0.03em;
}
.lms-lesson-body tbody td {
  padding: 12px 16px;
  border-top: 1px solid var(--gray-100);
  color: var(--gray-700, #334155);
}
.lms-lesson-body tbody tr:nth-child(even) { background: var(--gray-50); }

/* lms-md.js wraps every table in .table-wrap: last-resort horizontal scroll
   so a wide table never pushes the page sideways on a phone. */
.lms-lesson-body .table-wrap {
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0 0 1.6em;
}
.lms-lesson-body .table-wrap > table { margin: 0; }
/* Long inline code / URLs wrap instead of overflowing the column. */
.lms-lesson-body code { overflow-wrap: anywhere; }
.lms-lesson-body p, .lms-lesson-body li, .lms-lesson-body td { overflow-wrap: break-word; }

@media (max-width: 600px) {
  .lms-lesson-body { font-size: 1rem; line-height: 1.7; }
  .lms-lesson-body h2 { font-size: 1.38rem; }
  .lms-lesson-body h3 { font-size: 1.16rem; }
  .lms-lesson-body blockquote { padding: 14px 16px; }
  .lms-lesson-body table { font-size: 0.88rem; }
  .lms-lesson-body thead th { padding: 10px 10px; }
  .lms-lesson-body tbody td { padding: 10px 10px; }

  /* .table-stack (3+ cols or long cells): one card per row, each cell
     labelled with its column header. First cell = card title. */
  .lms-lesson-body .table-stack { overflow: visible; }
  .lms-lesson-body .table-stack table,
  .lms-lesson-body .table-stack tbody,
  .lms-lesson-body .table-stack tr,
  .lms-lesson-body .table-stack td { display: block; width: 100%; }
  .lms-lesson-body .table-stack table { border: none; border-radius: 0; overflow: visible; font-size: 0.94rem; }
  .lms-lesson-body .table-stack thead {
    position: absolute; width: 1px; height: 1px; overflow: hidden;
    clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
  }
  .lms-lesson-body .table-stack tbody tr,
  .lms-lesson-body .table-stack tbody tr:nth-child(even) {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-left: 4px solid var(--ice);
    border-radius: var(--radius);
    padding: 10px 14px;
    margin: 0 0 12px;
  }
  .lms-lesson-body .table-stack tbody td {
    border: none;
    padding: 5px 0;
    text-align: left !important;
  }
  .lms-lesson-body .table-stack tbody td::before {
    content: attr(data-label);
    display: block;
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--gray-500);
    line-height: 1.3;
    margin-bottom: 1px;
  }
  .lms-lesson-body .table-stack tbody td:first-child {
    font-weight: 700;
    color: var(--navy);
    font-size: 1rem;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--gray-100);
    margin-bottom: 2px;
  }
  .lms-lesson-body .table-stack tbody td:first-child::before { color: #0e7490; }
  /* blank template cells (log forms) → a write-in line, not an empty gap */
  .lms-lesson-body .table-stack tbody td[data-empty]::after {
    content: '';
    display: block;
    height: 1.4em;
    border-bottom: 1px dashed var(--gray-300);
  }
}


/* .table-xwide (7+ cols, e.g. log templates): cards at EVERY width. */
.lms-lesson-body .table-xwide { overflow: visible; }
.lms-lesson-body .table-xwide table,
.lms-lesson-body .table-xwide tbody,
.lms-lesson-body .table-xwide tr,
.lms-lesson-body .table-xwide td { display: block; width: 100%; }
.lms-lesson-body .table-xwide table { border: none; border-radius: 0; overflow: visible; font-size: 0.94rem; }
.lms-lesson-body .table-xwide thead {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}
.lms-lesson-body .table-xwide tbody tr,
.lms-lesson-body .table-xwide tbody tr:nth-child(even) {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-left: 4px solid var(--ice);
  border-radius: var(--radius);
  padding: 10px 14px;
  margin: 0 0 12px;
}
.lms-lesson-body .table-xwide tbody td {
  border: none;
  padding: 5px 0;
  text-align: left !important;
}
.lms-lesson-body .table-xwide tbody td::before {
  content: attr(data-label);
  display: block;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--gray-500);
  line-height: 1.3;
  margin-bottom: 1px;
}
.lms-lesson-body .table-xwide tbody td:first-child {
  font-weight: 700;
  color: var(--navy);
  font-size: 1rem;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--gray-100);
  margin-bottom: 2px;
}
.lms-lesson-body .table-xwide tbody td:first-child::before { color: #0e7490; }
/* blank template cells (log forms) → a write-in line, not an empty gap */
.lms-lesson-body .table-xwide tbody td[data-empty]::after {
  content: '';
  display: block;
  height: 1.4em;
  border-bottom: 1px dashed var(--gray-300);
}
@media (min-width: 601px) {
  .lms-lesson-body .table-xwide tbody tr,
  .lms-lesson-body .table-xwide tbody tr:nth-child(even) {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    column-gap: 20px;
  }
  .lms-lesson-body .table-xwide tbody td:first-child { grid-column: 1 / -1; }
}

/* Images inside lessons */
.lms-lesson-body img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius);
  border: 1px solid var(--gray-200);
  margin: 0.5em 0 1.4em;
}
.lms-lesson-body hr {
  border: none;
  border-top: 1px solid var(--gray-200);
  margin: 2em 0;
}

/* Resources block under the lesson */
.lesson-resources {
  margin-top: 36px;
  padding-top: 24px;
  border-top: 1px solid var(--gray-100);
}
.lesson-resources h4 {
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gray-400);
  margin-bottom: 14px;
}
.lesson-resources .res-list {
  display: grid;
  gap: 10px;
}
.res-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  color: var(--navy);
  font-size: 0.92rem;
  font-weight: 500;
  transition: var(--transition);
}
.res-item:hover { border-color: var(--ice); background: var(--gray-50); }
.res-item .res-icon { font-size: 1.1rem; }
.res-item .res-type {
  margin-left: auto;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gray-400);
}

/* Prev / next + mark-complete footer of a lesson */
.lesson-footer {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 48px;
  padding-top: 28px;
  border-top: 1px solid var(--gray-100);
  flex-wrap: wrap;
}
.lesson-nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  border-radius: 8px;
  border: 1px solid var(--gray-200);
  background: var(--white);
  color: var(--navy);
  font-family: var(--font);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: var(--transition);
}
.lesson-nav-btn:hover:not(:disabled) { border-color: var(--ice); background: var(--gray-50); }
.lesson-nav-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.lesson-footer .spacer { flex: 1; }

/* ============================================================
   6. VIDEO FRAME (16:9) + "VIDEO COMING SOON" PLACEHOLDER
   ============================================================ */
.lms-video {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--navy);
  margin-bottom: 28px;
  box-shadow: var(--shadow-lg);
}
.lms-video iframe,
.lms-video video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

/* Branded placeholder when video_url is null */
.lms-video.placeholder {
  display: grid;
  place-items: center;
  text-align: center;
  background:
    radial-gradient(ellipse at 25% 20%, rgba(126, 200, 227, 0.22) 0%, transparent 55%),
    radial-gradient(ellipse at 80% 80%, rgba(126, 200, 227, 0.14) 0%, transparent 55%),
    linear-gradient(135deg, var(--navy) 0%, var(--navy-light) 60%, var(--navy-mid) 100%);
}
.lms-video.placeholder::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(rgba(126, 200, 227, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(126, 200, 227, 0.05) 1px, transparent 1px);
  background-size: 48px 48px;
  pointer-events: none;
}
.lms-video.placeholder .ph-inner {
  position: relative;
  z-index: 1;
  padding: 24px;
}
.lms-video.placeholder .ph-play {
  width: 72px;
  height: 72px;
  margin: 0 auto 18px;
  border-radius: 50%;
  background: var(--ice-glow);
  border: 1px solid rgba(126, 200, 227, 0.4);
  display: grid;
  place-items: center;
  color: var(--ice);
  font-size: 1.6rem;
}
.lms-video.placeholder .ph-title {
  color: var(--white);
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  margin-bottom: 6px;
}
.lms-video.placeholder .ph-sub {
  color: var(--gray-400);
  font-size: 0.88rem;
  max-width: 360px;
  margin: 0 auto;
}
.lms-video .video-badge {
  position: absolute;
  top: 14px;
  left: 14px;
  z-index: 2;
  padding: 5px 12px;
  border-radius: 100px;
  background: rgba(10, 22, 40, 0.7);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(126, 200, 227, 0.3);
  color: var(--ice);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* ============================================================
   7. QUIZ / EXAM QUESTION CARDS
   ============================================================ */
.quiz-shell {
  max-width: 760px;
  margin: 0 auto;
}

/* Progress / timer bar above the question */
.quiz-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.quiz-progress-track {
  flex: 1;
  min-width: 160px;
  height: 8px;
  background: var(--gray-200);
  border-radius: 100px;
  overflow: hidden;
}
.quiz-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--ice) 0%, var(--ice-light) 100%);
  border-radius: 100px;
  width: 0%;
  transition: width 0.4s var(--transition);
}
.quiz-counter {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--gray-500);
  white-space: nowrap;
}
.quiz-timer {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 100px;
  background: var(--navy);
  color: var(--white);
  font-size: 0.85rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
}
.quiz-timer.warning { background: var(--warn); }
.quiz-timer.danger { background: var(--bad); animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.65; } }

/* The question card itself */
.q-card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: var(--shadow);
}
.q-kind {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ice);
  margin-bottom: 12px;
}
.q-prompt {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--navy);
  line-height: 1.5;
  margin-bottom: 24px;
}
.q-prompt code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.9em;
  background: var(--gray-100);
  padding: 0.1em 0.35em;
  border-radius: 5px;
}
.q-hint-multi {
  font-size: 0.8rem;
  color: var(--gray-500);
  font-weight: 600;
  margin: -14px 0 18px;
}

/* Answer choices */
.q-choices {
  display: grid;
  gap: 12px;
}
.q-choice {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px 18px;
  border: 2px solid var(--gray-200);
  border-radius: var(--radius);
  background: var(--white);
  cursor: pointer;
  transition: var(--transition);
  font-size: 0.98rem;
  color: var(--gray-700, #334155);
  line-height: 1.45;
  text-align: left;
  width: 100%;
  font-family: var(--font);
}
.q-choice:hover { border-color: var(--ice); background: var(--gray-50); }
.q-choice:focus-visible {
  outline: none;
  border-color: var(--ice);
  box-shadow: 0 0 0 3px var(--ice-glow);
}

/* The letter / checkbox marker */
.q-marker {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: 2px solid var(--gray-300);
  display: grid;
  place-items: center;
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--gray-500);
  background: var(--white);
  transition: var(--transition);
}
.q-choice.multi .q-marker { border-radius: 6px; }

/* --- STATE: selected (chosen, not yet graded) --- */
.q-choice.selected {
  border-color: var(--ice);
  background: var(--ice-glow);
}
.q-choice.selected .q-marker {
  border-color: var(--ice);
  background: var(--ice);
  color: var(--navy);
}

/* --- STATE: correct (after grading / formative feedback) --- */
.q-choice.correct {
  border-color: var(--ok-border);
  background: var(--ok-bg);
  color: var(--navy);
}
.q-choice.correct .q-marker {
  border-color: var(--ok);
  background: var(--ok);
  color: var(--white);
}
.q-choice.correct .q-marker::after { content: "\2713"; }

/* --- STATE: incorrect (chosen but wrong) --- */
.q-choice.incorrect {
  border-color: var(--bad-border);
  background: var(--bad-bg);
  color: var(--navy);
}
.q-choice.incorrect .q-marker {
  border-color: var(--bad);
  background: var(--bad);
  color: var(--white);
}
.q-choice.incorrect .q-marker::after { content: "\2715"; }

/* --- STATE: missed (correct answer the student didn't pick) --- */
.q-choice.missed {
  border-color: var(--ok-border);
  border-style: dashed;
  background: transparent;
}
.q-choice.missed .q-marker { border-color: var(--ok); color: var(--ok); }

/* When graded, suppress hover and the letter text under a result icon */
.q-card.graded .q-choice { cursor: default; }
.q-card.graded .q-choice:hover { background: inherit; }
.q-choice.correct .q-marker,
.q-choice.incorrect .q-marker { font-size: 0; }
.q-choice.correct .q-marker::after,
.q-choice.incorrect .q-marker::after { font-size: 0.9rem; }

/* Explanation revealed after answering (formative quizzes only) */
.q-explanation {
  margin-top: 18px;
  padding: 16px 20px;
  border-radius: var(--radius);
  font-size: 0.92rem;
  line-height: 1.6;
  background: var(--gray-50);
  border-left: 4px solid var(--ice);
  color: var(--gray-700, #334155);
}
.q-explanation .ex-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 6px;
}
.q-explanation.is-correct { border-left-color: var(--ok); background: var(--ok-bg); }
.q-explanation.is-correct .ex-label { color: #15803d; }
.q-explanation.is-incorrect { border-left-color: var(--bad); background: var(--bad-bg); }
.q-explanation.is-incorrect .ex-label { color: #b91c1c; }

/* Quiz footer actions */
.quiz-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 24px;
  flex-wrap: wrap;
}
.quiz-actions .spacer { flex: 1; }

/* Quiz / exam intro + result panels */
.quiz-intro,
.quiz-result {
  text-align: center;
  max-width: 560px;
  margin: 0 auto;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: 48px 40px;
  box-shadow: var(--shadow);
}
.quiz-intro h2,
.quiz-result h2 { color: var(--navy); margin-bottom: 12px; }
.quiz-intro p, .quiz-result p { color: var(--gray-500); margin-bottom: 8px; }
.quiz-facts {
  display: flex;
  justify-content: center;
  gap: 32px;
  margin: 28px 0;
  flex-wrap: wrap;
}
.quiz-facts .qf { text-align: center; }
.quiz-facts .qf .n { font-size: 1.8rem; font-weight: 800; color: var(--navy); line-height: 1; }
.quiz-facts .qf .l {
  display: block;
  font-size: 0.75rem;
  color: var(--gray-400);
  font-weight: 600;
  margin-top: 6px;
  letter-spacing: 0.04em;
}

/* Big pass/fail score in result */
.score-hero {
  display: grid;
  place-items: center;
  margin: 8px auto 24px;
}
.score-hero .score-num {
  font-size: 3.4rem;
  font-weight: 800;
  line-height: 1;
}
.score-hero.pass .score-num { color: var(--ok); }
.score-hero.fail .score-num { color: var(--bad); }
.score-hero .score-verdict {
  margin-top: 8px;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.score-hero.pass .score-verdict { color: var(--ok); }
.score-hero.fail .score-verdict { color: var(--bad); }

/* Exam: one-question proctor note + flag indicator */
.proctor-note {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
  padding: 12px 16px;
  border-radius: var(--radius);
  background: var(--warn-bg);
  border: 1px solid rgba(245, 158, 11, 0.3);
  color: #92400e;
  font-size: 0.84rem;
  font-weight: 500;
}
.proctor-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ok);
  flex-shrink: 0;
  box-shadow: 0 0 0 3px var(--ok-bg);
}
.proctor-dot.flagged { background: var(--bad); box-shadow: 0 0 0 3px var(--bad-bg); }

/* ============================================================
   8. CIRCULAR PROGRESS RINGS
   ------------------------------------------------------------
   Usage (SVG):
     <div class="ring" style="--pct:62; --size:120px; --stroke:10px;">
       <svg viewBox="0 0 120 120">
         <circle class="ring-track" cx="60" cy="60" r="52"/>
         <circle class="ring-fill"  cx="60" cy="60" r="52"/>
       </svg>
       <span class="ring-label"><b>62%</b><i>complete</i></span>
     </div>
   The JS sets stroke-dasharray/offset on .ring-fill from --pct, OR
   you can rely on the CSS var math below for r=52 (circ ≈ 326.7).
   ============================================================ */
.ring {
  position: relative;
  width: var(--size, 120px);
  height: var(--size, 120px);
  display: inline-grid;
  place-items: center;
  flex-shrink: 0;
}
.ring svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}
.ring circle {
  fill: none;
  stroke-width: var(--stroke, 10px);
  stroke-linecap: round;
}
.ring .ring-track { stroke: var(--gray-200); }
.ring .ring-fill {
  stroke: var(--ice);
  /* circumference for r=52 ≈ 326.726; JS may override for other r */
  stroke-dasharray: 326.726;
  stroke-dashoffset: calc(326.726 - (326.726 * var(--pct, 0) / 100));
  transition: stroke-dashoffset 0.8s var(--transition);
}
.ring.complete .ring-fill { stroke: var(--ok); }
.ring-label {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  text-align: center;
  line-height: 1.1;
}
.ring-label b {
  display: block;
  font-size: calc(var(--size, 120px) * 0.24);
  font-weight: 800;
  color: var(--navy);
}
.ring-label i {
  display: block;
  font-style: normal;
  font-size: calc(var(--size, 120px) * 0.085);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--gray-400);
  margin-top: 2px;
}

/* Mini ring for the nav bar — fixed small size */
.ring-mini {
  --size: 30px;
  --stroke: 4px;
  width: 30px;
  height: 30px;
  position: relative;
  display: inline-grid;
  place-items: center;
}
.ring-mini svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-mini circle { fill: none; stroke-width: 4px; stroke-linecap: round; }
.ring-mini .ring-track { stroke: rgba(255,255,255,0.15); }
.ring-mini .ring-fill {
  stroke: var(--ice);
  stroke-dasharray: 100.53;  /* r=16 → circ ≈ 100.53 */
  stroke-dashoffset: calc(100.53 - (100.53 * var(--pct, 0) / 100));
  transition: stroke-dashoffset 0.8s var(--transition);
}

/* ============================================================
   9. MODULE STATUS PILLS (locked / active / passed) + cards
   ============================================================ */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 100px;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  line-height: 1;
}
.status-pill::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.status-pill.locked { background: var(--gray-100); color: var(--gray-400); }
.status-pill.active { background: var(--ice-glow); color: #0e7490; }
.status-pill.in-progress { background: var(--ice-glow); color: #0e7490; }
.status-pill.passed { background: var(--ok-bg); color: #15803d; }
.status-pill.passed::before { content: "\2713"; width: auto; height: auto; background: none; font-size: 0.7rem; }
.status-pill.failed { background: var(--bad-bg); color: #b91c1c; }

/* Module list on the dashboard */
.module-list { display: grid; gap: 14px; }
.module-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 18px;
  padding: 20px 22px;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  transition: var(--transition);
}
.module-row:hover:not(.locked) {
  border-color: var(--ice);
  box-shadow: 0 8px 30px rgba(126, 200, 227, 0.12);
  transform: translateY(-2px);
}
.module-row.locked { opacity: 0.65; }
.module-row.locked .module-row-title { color: var(--gray-500); }
.module-index {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--navy);
  color: var(--white);
  display: grid;
  place-items: center;
  font-size: 1rem;
  font-weight: 800;
  flex-shrink: 0;
}
.module-row.passed .module-index { background: var(--ok); }
.module-row.locked .module-index { background: var(--gray-300); }
.module-row-body { min-width: 0; }
.module-row-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 4px;
}
.module-row-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--gray-500);
  font-size: 0.82rem;
  flex-wrap: wrap;
}
.module-row-actions { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }

/* Thin per-module progress bar inside the row */
.module-mini-track {
  width: 120px;
  height: 6px;
  background: var(--gray-200);
  border-radius: 100px;
  overflow: hidden;
}
.module-mini-fill {
  height: 100%;
  background: var(--ice);
  border-radius: 100px;
  transition: width 0.5s var(--transition);
}
.module-row.passed .module-mini-fill { background: var(--ok); }

/* ============================================================
   10. CERTIFICATE LAYOUT (print-friendly)
   ============================================================ */
.cert-stage {
  display: grid;
  place-items: center;
  padding: 40px 16px;
  background: var(--gray-100);
  min-height: calc(100vh - var(--lms-nav-h));
}
.certificate {
  position: relative;
  width: 100%;
  max-width: 960px;
  aspect-ratio: 1.414 / 1;        /* landscape A4-ish */
  background:
    radial-gradient(ellipse at 12% 8%, rgba(126, 200, 227, 0.10) 0%, transparent 45%),
    radial-gradient(ellipse at 90% 95%, rgba(126, 200, 227, 0.08) 0%, transparent 45%),
    var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  overflow: hidden;
  color: var(--navy);
}
/* Inner navy/ice double border frame */
.certificate::before {
  content: "";
  position: absolute;
  inset: 22px;
  border: 2px solid var(--navy);
  border-radius: 8px;
  pointer-events: none;
}
.certificate::after {
  content: "";
  position: absolute;
  inset: 28px;
  border: 1px solid var(--ice);
  border-radius: 6px;
  pointer-events: none;
}
.cert-inner {
  position: relative;
  z-index: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: clamp(36px, 6vw, 72px);
}
.cert-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--navy);
  margin-bottom: clamp(16px, 3vw, 28px);
}
.cert-brand img { height: 34px; }
.cert-brand .logo-mark { color: var(--ice); }
.cert-kicker {
  font-size: clamp(0.72rem, 1.6vw, 0.85rem);
  font-weight: 700;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--gray-500);
  margin-bottom: 14px;
}
.cert-name {
  font-size: clamp(2rem, 6vw, 3.4rem);
  font-weight: 800;
  color: var(--navy);
  line-height: 1.05;
  margin-bottom: 14px;
}
.cert-statement {
  font-size: clamp(0.92rem, 2vw, 1.1rem);
  color: var(--gray-600);
  max-width: 620px;
  line-height: 1.6;
  margin-bottom: 6px;
}
.cert-tier {
  font-size: clamp(1.1rem, 3vw, 1.6rem);
  font-weight: 700;
  color: #0e7490;
  margin: 10px 0 clamp(20px, 4vw, 40px);
}
.cert-seal {
  position: absolute;
  right: clamp(36px, 7vw, 84px);
  bottom: clamp(70px, 13vw, 130px);
  width: clamp(72px, 12vw, 110px);
  height: clamp(72px, 12vw, 110px);
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 30%, var(--ice-light), var(--ice) 70%);
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--navy);
  box-shadow: 0 6px 20px rgba(126, 200, 227, 0.45);
  border: 3px solid var(--white);
}
.cert-seal b { font-size: 0.95rem; font-weight: 800; line-height: 1; }
.cert-seal span { font-size: 0.5rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; }

/* Footer row: signature, dates, cert code + QR */
.cert-footer {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: end;
  gap: 24px;
  width: 100%;
  max-width: 680px;
  margin-top: auto;
}
.cert-foot-block { text-align: center; }
.cert-foot-block .line {
  border-top: 1.5px solid var(--navy);
  padding-top: 8px;
  font-size: clamp(0.7rem, 1.6vw, 0.85rem);
  font-weight: 600;
  color: var(--navy);
}
.cert-foot-block .lbl {
  font-size: clamp(0.6rem, 1.3vw, 0.7rem);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gray-400);
  margin-top: 3px;
}
.cert-qr {
  width: clamp(64px, 11vw, 92px);
  height: clamp(64px, 11vw, 92px);
  border-radius: 8px;
  border: 1px solid var(--gray-200);
  background: var(--white);
  display: block;
  margin: 0 auto;
}
.cert-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: clamp(0.7rem, 1.5vw, 0.82rem);
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--navy);
  margin-top: 8px;
}

/* Action toolbar above the certificate (hidden when printing) */
.cert-toolbar {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

/* ---- PRINT: certificate fills the page, chrome hidden ---- */
@media print {
  .lms-nav,
  .cert-toolbar,
  .lms-tutor,
  .lesson-footer,
  .no-print { display: none !important; }
  body, .lms-body { background: var(--white) !important; }
  .cert-stage { padding: 0; min-height: auto; background: var(--white); }
  .certificate {
    box-shadow: none;
    max-width: 100%;
    width: 100%;
    border-radius: 0;
    page-break-inside: avoid;
  }
  @page { size: landscape; margin: 0; }
}

/* ============================================================
   11. AI-TUTOR CHAT PANEL
   ------------------------------------------------------------
   Two modes: inline (.lms-tutor.inline within the lesson pane)
   and docked (.lms-tutor.docked → fixed slide-in drawer).
   ============================================================ */
.lms-tutor {
  display: flex;
  flex-direction: column;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.lms-tutor.inline { margin-top: 36px; }

/* Docked drawer variant */
.lms-tutor.docked {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 1100;
  width: min(400px, calc(100vw - 40px));
  height: min(620px, calc(100vh - 100px));
  box-shadow: var(--shadow-xl);
  transform: translateY(8px) scale(0.98);
  opacity: 0;
  visibility: hidden;
  transition: var(--transition);
}
.lms-tutor.docked.open {
  transform: translateY(0) scale(1);
  opacity: 1;
  visibility: visible;
}

/* Floating launcher button */
.tutor-fab {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 1090;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 22px;
  border-radius: 100px;
  border: none;
  background: var(--ice);
  color: var(--navy);
  font-family: var(--font);
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  box-shadow: 0 8px 28px rgba(126, 200, 227, 0.45);
  transition: var(--transition);
}
.tutor-fab:hover { background: var(--ice-light); transform: translateY(-2px); }
.tutor-fab .fab-icon { font-size: 1.1rem; }

/* Tutor header */
.tutor-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  background: var(--navy);
  color: var(--white);
}
.tutor-head .tutor-ai {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--ice);
  color: var(--navy);
  display: grid;
  place-items: center;
  font-size: 1.05rem;
  flex-shrink: 0;
}
.tutor-head .t-title { font-size: 0.95rem; font-weight: 700; line-height: 1.2; }
.tutor-head .t-sub { font-size: 0.74rem; color: var(--ice-light); font-weight: 500; }
.tutor-head .t-status {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  color: var(--gray-300);
}
.tutor-head .t-status::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ok);
}
.tutor-close {
  background: rgba(255,255,255,0.1);
  border: none;
  color: var(--white);
  width: 30px;
  height: 30px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  transition: var(--transition);
}
.tutor-close:hover { background: rgba(255,255,255,0.2); }

/* Message scroll area */
.tutor-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: var(--gray-50);
}
.tutor-body::-webkit-scrollbar { width: 8px; }
.tutor-body::-webkit-scrollbar-thumb { background: var(--gray-200); border-radius: 8px; }

/* Grounding hint shown at top of an empty conversation */
.tutor-intro {
  text-align: center;
  padding: 24px 16px;
  color: var(--gray-500);
}
.tutor-intro .ti-icon {
  width: 52px; height: 52px;
  margin: 0 auto 14px;
  border-radius: 50%;
  background: var(--ice-glow);
  border: 1px solid rgba(126, 200, 227, 0.35);
  display: grid; place-items: center;
  color: var(--ice); font-size: 1.4rem;
}
.tutor-intro h4 { color: var(--navy); font-size: 1rem; margin-bottom: 6px; }
.tutor-intro p { font-size: 0.85rem; line-height: 1.55; max-width: 280px; margin: 0 auto; }

/* Suggested starter chips */
.tutor-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-top: 16px;
}
.tutor-chip {
  padding: 8px 14px;
  border-radius: 100px;
  border: 1px solid var(--gray-200);
  background: var(--white);
  color: var(--navy);
  font-family: var(--font);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}
.tutor-chip:hover { border-color: var(--ice); background: var(--ice-glow); }

/* Message bubbles */
.tutor-msg { display: flex; gap: 10px; max-width: 90%; }
.tutor-msg .bubble {
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 0.9rem;
  line-height: 1.55;
}
.tutor-msg.user { align-self: flex-end; flex-direction: row-reverse; }
.tutor-msg.user .bubble {
  background: var(--navy);
  color: var(--white);
  border-bottom-right-radius: 4px;
}
.tutor-msg.assistant .bubble {
  background: var(--white);
  color: var(--gray-800);
  border: 1px solid var(--gray-200);
  border-bottom-left-radius: 4px;
}
.tutor-msg .msg-avatar {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 0.75rem;
  font-weight: 800;
}
.tutor-msg.assistant .msg-avatar { background: var(--ice); color: var(--navy); }
.tutor-msg.user .msg-avatar { background: var(--gray-300); color: var(--navy); }

/* Rendered markdown inside assistant bubbles (compact) */
.tutor-msg .bubble p { margin: 0 0 0.6em; }
.tutor-msg .bubble p:last-child { margin: 0; }
.tutor-msg .bubble ul,
.tutor-msg .bubble ol { margin: 0.3em 0 0.6em; padding-left: 1.3em; }
.tutor-msg .bubble code {
  font-family: ui-monospace, Menlo, monospace;
  font-size: 0.85em;
  background: var(--gray-100);
  padding: 0.1em 0.35em;
  border-radius: 5px;
}
.tutor-msg.assistant .bubble strong { color: var(--navy); }

/* Typing indicator */
.tutor-typing { display: inline-flex; gap: 4px; padding: 4px 2px; }
.tutor-typing span {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--gray-400);
  animation: tutor-bounce 1.2s infinite ease-in-out;
}
.tutor-typing span:nth-child(2) { animation-delay: 0.15s; }
.tutor-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes tutor-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
  30% { transform: translateY(-5px); opacity: 1; }
}

/* Composer */
.tutor-composer {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 14px 16px;
  border-top: 1px solid var(--gray-200);
  background: var(--white);
}
.tutor-composer textarea {
  flex: 1;
  resize: none;
  max-height: 120px;
  border: 1px solid var(--gray-200);
  border-radius: 12px;
  padding: 11px 14px;
  font-family: var(--font);
  font-size: 0.9rem;
  line-height: 1.4;
  color: var(--gray-800);
  transition: var(--transition);
}
.tutor-composer textarea:focus {
  outline: none;
  border-color: var(--ice);
  box-shadow: 0 0 0 3px var(--ice-glow);
}
.tutor-send {
  flex-shrink: 0;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  border: none;
  background: var(--ice);
  color: var(--navy);
  font-size: 1.1rem;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: var(--transition);
}
.tutor-send:hover:not(:disabled) { background: var(--ice-light); }
.tutor-send:disabled { opacity: 0.45; cursor: not-allowed; }
.tutor-disclaimer {
  font-size: 0.7rem;
  color: var(--gray-400);
  text-align: center;
  padding: 0 16px 12px;
  background: var(--white);
}

/* ============================================================
   12. SHARED: buttons, badges, toasts, empty states, utility
   ============================================================ */
/* LMS-scoped pill button (reuses .btn from styles.css when possible) */
.btn-ice {
  background: var(--ice);
  color: var(--navy);
  border: 2px solid var(--ice);
}
.btn-ice:hover { background: var(--ice-light); border-color: var(--ice-light); transform: translateY(-1px); }
.btn-ghost {
  background: transparent;
  color: var(--navy);
  border: 2px solid var(--gray-200);
}
.btn-ghost:hover { border-color: var(--navy); }
.btn-sm { padding: 9px 18px; font-size: 0.85rem; }

/* Generic badge */
.lms-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 100px;
  background: var(--ice-glow);
  border: 1px solid rgba(126, 200, 227, 0.25);
  color: #0e7490;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

/* Empty / loading / error states */
.lms-empty {
  text-align: center;
  padding: 64px 24px;
  color: var(--gray-500);
}
.lms-empty .empty-icon {
  font-size: 2.4rem;
  margin-bottom: 14px;
  opacity: 0.5;
}
.lms-empty h3 { color: var(--navy); margin-bottom: 8px; }
.lms-empty p { max-width: 380px; margin: 0 auto 20px; }

/* Skeleton shimmer for loading panes */
.lms-skeleton {
  background: linear-gradient(90deg, var(--gray-100) 25%, var(--gray-200) 37%, var(--gray-100) 63%);
  background-size: 400% 100%;
  border-radius: 8px;
  animation: lms-shimmer 1.4s ease infinite;
}
@keyframes lms-shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

/* Toast (e.g. "Progress saved") */
.lms-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  z-index: 1200;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 22px;
  border-radius: 100px;
  background: var(--navy);
  color: var(--white);
  font-size: 0.88rem;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  visibility: hidden;
  transition: var(--transition);
}
.lms-toast.show { opacity: 1; visibility: visible; transform: translateX(-50%) translateY(0); }
.lms-toast.success::before { content: "\2713"; color: var(--ice); font-weight: 800; }

/* Sidebar mobile overlay backdrop */
.lms-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1040;
  background: rgba(10, 22, 40, 0.5);
  backdrop-filter: blur(2px);
  opacity: 0;
  visibility: hidden;
  transition: var(--transition);
}
.lms-backdrop.show { opacity: 1; visibility: visible; }

/* Visually-hidden but screen-reader available */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* Global focus-visible polish for keyboard nav across LMS */
.lms-body a:focus-visible,
.lms-body button:focus-visible,
.q-choice:focus-visible,
.sidebar-lesson:focus-visible {
  outline: 2px solid var(--ice);
  outline-offset: 2px;
}

/* ============================================================
   13. RESPONSIVE — course player collapses to mobile
   ============================================================ */
@media (max-width: 1024px) {
  .player-main { padding: 32px 28px 80px; }
}

@media (max-width: 860px) {
  /* Sidebar becomes an off-canvas drawer */
  .player { grid-template-columns: 1fr; }
  .player-sidebar {
    position: fixed;
    top: var(--lms-nav-h);
    left: 0;
    bottom: 0;
    width: min(320px, 86vw);
    height: auto;
    z-index: 1050;
    transform: translateX(-100%);
    transition: transform 0.3s var(--transition);
    box-shadow: var(--shadow-xl);
  }
  .player-sidebar.open { transform: translateX(0); }
  .player-main { padding: 28px 22px 80px; }
  .lms-nav-burger { display: flex; }

  /* Two-column dashboard areas stack */
  .module-row { grid-template-columns: auto 1fr; }
  .module-row-actions { grid-column: 1 / -1; justify-content: flex-end; }
}

@media (max-width: 600px) {
  .lms-nav-inner { padding: 0 16px; gap: 14px; }
  .lms-nav-context { display: none; }   /* breadcrumb hidden on phones */
  .lms-account-btn .acct-name { display: none; }
  .lms-page { padding: 28px 16px 64px; }
  .lms-card { padding: 22px; }

  .q-card { padding: 22px; }
  .q-prompt { font-size: 1.08rem; }

  .quiz-intro, .quiz-result { padding: 36px 24px; }
  .quiz-facts { gap: 22px; }

  .lms-tutor.docked {
    right: 0; left: 0; bottom: 0;
    width: 100%;
    height: 80vh;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  }
  .tutor-fab { right: 16px; bottom: 16px; padding: 12px 18px; }
  .tutor-msg { max-width: 95%; }

  /* Certificate: drop to portrait-ish, stack footer */
  .certificate { aspect-ratio: auto; min-height: 70vh; }
  .cert-footer { grid-template-columns: 1fr; gap: 18px; }
  .cert-seal { position: static; margin: 16px auto 0; }

  .cert-foot-block .line { border-top: none; padding-top: 0; }
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* ============================================================
   14. HERO VISUAL (no-video doctrine) — sim / diagram / photo
   ------------------------------------------------------------
   The per-lesson hero replaces the old "video-first" frame. A
   real <video> frame (.lms-video) renders ONLY when a lesson has
   a video_url; otherwise the hero carries the lesson.
   ============================================================ */
.lesson-hero {
  margin: 0 0 30px;
}
/* Diagram / photo heros are <figure> */
figure.lesson-hero {
  display: block;
}
figure.lesson-hero img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--gray-200);
  box-shadow: var(--shadow-lg);
}
figure.lesson-hero.hero-diagram img {
  /* diagrams read best on a clean light field, framed in navy/ice */
  background: var(--white);
  border-color: rgba(126, 200, 227, 0.35);
  padding: 8px;
}
figure.lesson-hero figcaption {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
  margin-top: 12px;
  font-size: 0.86rem;
  color: var(--gray-500);
}
figure.lesson-hero figcaption .fig-caption { font-weight: 600; color: var(--navy-mid); }

/* Sim hero: a navy-framed mount point the CSSims module fills in. */
.lesson-hero.hero-sim {
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}
.sim-frame {
  width: 100%;
  min-height: 360px;
  background:
    radial-gradient(ellipse at 12% 8%, rgba(126, 200, 227, 0.10) 0%, transparent 55%),
    var(--navy);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.sim-fallback {
  padding: 40px 24px;
  text-align: center;
  color: var(--gray-400);
  font-weight: 600;
}

/* ============================================================
   15. INLINE FIGURES (within the lesson body, caption + credit)
   ============================================================ */
.lesson-figures {
  display: grid;
  gap: 26px;
  margin: 28px 0;
}
.lesson-figure {
  margin: 0;
}
.lesson-figure img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: var(--radius);
  border: 1px solid var(--gray-200);
  background: var(--white);
}
.lesson-figure figcaption {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
  margin-top: 10px;
  font-size: 0.84rem;
  color: var(--gray-500);
  line-height: 1.5;
}
.lesson-figure figcaption .fig-caption { font-weight: 600; color: var(--navy-mid); }
.lesson-figure figcaption .fig-credit {
  font-size: 0.78rem;
  color: var(--gray-400);
  text-decoration: none;
}
.lesson-figure figcaption a.fig-credit:hover { color: var(--ice); text-decoration: underline; }
/* Inline figures authored in markdown (lms-md.js) sit next to their text. */
.lms-lesson-body figure.md-figure { margin: 1.6em 0 1.8em; }
.lms-lesson-body figure.md-figure img { margin: 0; max-width: 100%; }
.lms-lesson-body figure.md-figure figcaption { line-height: 1.5; }

/* ============================================================
   16. INLINE KNOWLEDGE CHECKS (gating — RIGOR §3.6)
   ============================================================ */
.lesson-checks-host { margin-top: 8px; }
.inline-checks {
  margin: 40px 0 8px;
  padding: 30px;
  border-radius: var(--radius-lg);
  background:
    radial-gradient(ellipse at 90% 0%, rgba(126, 200, 227, 0.10) 0%, transparent 55%),
    var(--gray-50);
  border: 1px solid var(--gray-200);
}
.inline-checks .ic-head { margin-bottom: 22px; }
.ic-eyebrow {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ice);
  background: var(--navy);
  padding: 5px 12px;
  border-radius: 100px;
  margin-bottom: 12px;
}
.inline-checks .ic-head h3 { font-size: 1.3rem; color: var(--navy); margin: 0 0 6px; }
.inline-checks .ic-head .ic-sub { font-size: 0.92rem; color: var(--gray-500); margin: 0; }

.ic-card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 22px 22px 20px;
  margin-top: 16px;
}
.ic-card[data-answered="true"] { border-color: var(--ok-border); }
.ic-prompt {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  font-size: 1.02rem;
  font-weight: 600;
  color: var(--navy);
  margin-bottom: 16px;
  line-height: 1.5;
}
.ic-num {
  flex: 0 0 auto;
  width: 26px; height: 26px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--navy);
  color: var(--ice);
  font-size: 0.82rem;
  font-weight: 800;
}
.ic-options { display: grid; gap: 10px; margin-bottom: 16px; }
.ic-option {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
  padding: 13px 16px;
  border-radius: 10px;
  border: 1px solid var(--gray-200);
  background: var(--white);
  color: var(--navy);
  font-family: var(--font);
  font-size: 0.94rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}
.ic-option:hover { border-color: var(--ice); background: var(--gray-50); }
.ic-option .ic-marker {
  flex: 0 0 auto;
  width: 18px; height: 18px;
  border-radius: 50%;
  border: 2px solid var(--gray-300);
  transition: var(--transition);
}
.ic-option.selected { border-color: var(--ice); background: var(--ice-glow, rgba(126,200,227,0.12)); }
.ic-option.selected .ic-marker { border-color: var(--ice); background: var(--ice); box-shadow: inset 0 0 0 3px var(--white); }
.ic-option.is-correct { border-color: var(--ok-border); background: var(--ok-bg); color: #15803d; }
.ic-option.is-correct .ic-marker { border-color: var(--ok); background: var(--ok); }
.ic-option.is-wrong { border-color: var(--bad-border, #fecaca); background: var(--bad-bg, #fef2f2); color: var(--bad, #b91c1c); }
.ic-option.is-wrong .ic-marker { border-color: var(--bad, #b91c1c); }
.ic-card[data-locked="true"] .ic-option { cursor: default; }
.ic-card[data-locked="true"] .ic-option:hover { background: var(--white); border-color: var(--gray-200); }
.ic-card[data-locked="true"] .ic-option.is-correct:hover { background: var(--ok-bg); border-color: var(--ok-border); }

.ic-submit { margin-top: 2px; }
.ic-feedback {
  margin-top: 14px;
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 0.9rem;
  line-height: 1.55;
}
.ic-feedback strong { display: block; margin-bottom: 4px; }
.ic-feedback p { margin: 0; color: var(--gray-600); }
.ic-feedback.pass { background: var(--ok-bg); }
.ic-feedback.pass strong { color: #15803d; }
.ic-feedback.fail { background: var(--bad-bg, #fef2f2); }
.ic-feedback.fail strong { color: var(--bad, #b91c1c); }

/* ============================================================
   17. RIGOR GATE — complete-button hint + end sentinel
   ============================================================ */
.lesson-footer-wrap { margin-top: 0; }
.lesson-end-sentinel { width: 100%; height: 1px; }
.gate-hint {
  margin: 14px 0 0;
  padding: 12px 16px;
  border-radius: 10px;
  background: var(--warn-bg, #fffbeb);
  border: 1px solid var(--warn-border, #fde68a);
  color: var(--warn-text, #92400e);
  font-size: 0.86rem;
  font-weight: 600;
  line-height: 1.5;
}
.btn-complete:disabled,
.btn-complete[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
  filter: grayscale(0.2);
}
.btn-complete:disabled:hover { transform: none; }

/* ============================================================
   18. RESPONSIVE additions for hero / sim / checks
   ============================================================ */
@media (max-width: 600px) {
  .sim-frame { min-height: 300px; }
  .inline-checks { padding: 22px 18px; }
  .ic-card { padding: 18px 16px; }
  .lesson-hero, figure.lesson-hero { margin-bottom: 22px; }
}

/* ============================================================
   LMS SHELL (cs-shell.js header + footer) — styles for the
   nav/footer injected on /learn* dashboard-style pages.
   `header.lms-shell` overrides the generic .lms-shell width helper.
   ============================================================ */
header.lms-shell {
  position: sticky; top: 0; z-index: 1000;
  max-width: none; margin: 0; padding: 0;
  background: var(--navy);
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.lms-shell-inner {
  max-width: 1320px; margin: 0 auto; padding: 0 24px;
  height: 60px; display: flex; align-items: center; gap: 18px;
}
.lms-shell-logo { display: flex; align-items: center; gap: 9px; text-decoration: none; flex: none; }
.lms-shell-logo-img { height: 30px; width: auto; display: block; }
.lms-shell-logo-text { color: #fff; font-weight: 800; letter-spacing: 1px; font-size: 14px; }
.lms-shell-logo-badge { color: var(--ice); font-weight: 600; font-size: 12px; }
.lms-shell-course { display: flex; flex-direction: column; line-height: 1.15; margin-right: auto; padding-left: 6px; border-left: 1px solid rgba(255,255,255,0.12); padding-left: 18px; margin-left: 4px; }
.lms-shell-course-eyebrow { color: var(--gray-400); font-size: 10px; text-transform: uppercase; letter-spacing: 1.5px; font-weight: 700; }
.lms-shell-course-title { color: #e2e8f0; font-size: 13px; font-weight: 600; }
.lms-shell-progress { display: flex; align-items: center; gap: 9px; flex: none; }
.lms-shell-progress-track { width: 120px; height: 6px; border-radius: 99px; background: rgba(255,255,255,0.14); overflow: hidden; }
.lms-shell-progress-fill { height: 100%; background: var(--ice); border-radius: 99px; transition: width var(--transition); }
.lms-shell-progress-label { color: var(--ice); font-size: 12px; font-weight: 700; }
.lms-shell-account { position: relative; flex: none; }
.lms-shell-account-trigger { display: flex; align-items: center; gap: 8px; background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.14); border-radius: 99px; padding: 5px 12px 5px 6px; color: #fff; cursor: pointer; font: inherit; font-size: 13px; }
.lms-shell-account-trigger:hover { background: rgba(255,255,255,0.12); }
.lms-shell-avatar { width: 26px; height: 26px; border-radius: 50%; background: var(--ice); color: var(--navy); display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 800; flex: none; }
.lms-shell-account-name { color: #e2e8f0; font-weight: 600; }
.lms-shell-caret { color: var(--gray-400); font-size: 10px; }
.lms-shell-signin, .lms-shell-account-anon a { display: inline-block; background: var(--ice); color: var(--navy); font-weight: 700; font-size: 13px; text-decoration: none; padding: 8px 16px; border-radius: 99px; }
.lms-shell-menu { position: absolute; right: 0; top: calc(100% + 8px); background: #fff; border: 1px solid var(--gray-200); border-radius: 12px; box-shadow: var(--shadow-lg); min-width: 210px; padding: 8px; z-index: 1001; }
.lms-shell-menu[hidden] { display: none; }
.lms-shell-menu-head { padding: 8px 10px; border-bottom: 1px solid var(--gray-100); margin-bottom: 4px; }
.lms-shell-menu-name { font-weight: 700; color: var(--navy); font-size: 14px; display: block; }
.lms-shell-menu-email { color: var(--gray-500); font-size: 12px; }
.lms-shell-menu-item, .lms-shell-menu-signout { display: block; width: 100%; text-align: left; padding: 9px 10px; border-radius: 8px; color: var(--navy-mid); text-decoration: none; font-size: 14px; cursor: pointer; background: none; border: none; font: inherit; }
.lms-shell-menu-item:hover, .lms-shell-menu-signout:hover { background: var(--gray-50); }
.lms-shell-menu-signout { color: #b91c1c; }

/* footer */
.lms-shell-footer { background: var(--navy); color: var(--gray-400); margin-top: 64px; }
.lms-shell-footer-inner { max-width: 1320px; margin: 0 auto; padding: 34px 24px 18px; display: flex; flex-wrap: wrap; align-items: center; gap: 16px; }
.lms-shell-footer-brand { display: flex; align-items: center; gap: 10px; }
.lms-shell-footer-logo { height: 26px; width: auto; display: block; }
.lms-shell-footer-tag { color: var(--gray-500); font-size: 13px; }
.lms-shell-footer-links { display: flex; flex-wrap: wrap; gap: 18px; margin-left: auto; }
.lms-shell-footer-links a { color: var(--gray-300); text-decoration: none; font-size: 13px; }
.lms-shell-footer-links a:hover { color: var(--ice); }
.lms-shell-footer-bottom { max-width: 1320px; margin: 0 auto; padding: 14px 24px 30px; color: var(--gray-600); font-size: 12px; border-top: 1px solid rgba(255,255,255,0.06); }

@media (max-width: 760px) {
  .lms-shell-course, .lms-shell-progress { display: none; }
  .lms-shell-logo { margin-right: auto; }
  .lms-shell-footer-links { margin-left: 0; }
}

/* Visual QA 2026-09-27 — keep figures proportionate on desktop.
   Diagrams are authored phone-first (portrait, 340–720 wide viewBox); at the
   full 820px pane they became 1,000–1,500px tall. Cap and center them.
   Tall photos are cropped to a sane height instead of filling the screen. */
figure.lesson-hero.hero-diagram img,
.lesson-figure img[src$=".svg"],
.lms-lesson-body figure.md-figure img[src$=".svg"] {
  max-width: min(100%, 600px);
  margin-left: auto;
  margin-right: auto;
}
figure.lesson-hero.hero-photo img,
.lesson-figure img:not([src$=".svg"]),
.lms-lesson-body figure.md-figure img:not([src$=".svg"]) {
  max-height: 520px;
  object-fit: cover;
}
.lms-lesson-body figure.md-figure figcaption,
figure.lesson-hero figcaption { max-width: 600px; margin-left: auto; margin-right: auto; }
@media (max-width: 600px) {
  /* short formula/code blocks wrap on phones instead of hiding text off-screen */
  .lms-lesson-body pre { white-space: pre-wrap; overflow-wrap: anywhere; padding: 14px 16px; }
}
@media (max-width: 600px) {
  /* VISUAL-STANDARD: diagrams are sized for a 343px render on a 375px phone
     (16px gutters). The 22px pane padding + 8px hero padding shrank them to
     ~315px, pushing 20px SVG text below the 11px floor. */
  .player-main { padding-left: 16px; padding-right: 16px; }
  figure.lesson-hero.hero-diagram img { padding: 0; }
}
