:root {
  --p-blue: #2563eb;
  --p-blue-soft: #eef4ff;
  --p-ink: #0f172a;
  --p-muted: #64748b;
  --p-faint: #94a3b8;
  --p-line: #e2e8f0;
  --p-bg: #f7f9fc;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--p-bg);
  color: var(--p-ink);
  font-family: "Inter", sans-serif;
  overflow-x: hidden;
}
button { font: inherit; }
button:focus-visible {
  outline: 3px solid rgba(37,99,235,.18);
  outline-offset: 3px;
}


/* TOPBAR */
.programme-topbar {
  position: fixed;
  z-index: 1000;
  top: 18px;
  left: 50%;
  width: min(1500px, calc(100% - 40px));
  height: 70px;
  transform: translateX(-50%);
  padding: 0 18px 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border: 1px solid rgba(226,232,240,.92);
  border-radius: 23px;
  background: rgba(255,255,255,.88);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  box-shadow: 0 12px 35px rgba(15,23,42,.065);
}

.programme-brand {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 9px;
  color: inherit;
  text-decoration: none;
}
.programme-brand-mark { width: 38px; height: 38px; display: grid; place-items: center; }
.programme-brand-mark img { max-width: 100%; max-height: 100%; display: block; }
.programme-brand-copy { display: flex; flex-direction: column; gap: 4px; }
.programme-brand-copy strong { font-size: 1rem; line-height: 1; font-weight: 800; }
.programme-brand-copy small { color: var(--p-muted); font-size: .72rem; line-height: 1; }

/* CENTER NAV */
.regional-sections {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  display: inline-flex;
  align-items: stretch;
  gap: 2px;
  padding: 3px;
  border: 1px solid #e1e8f1;
  border-radius: 15px;
  background: #edf2f8;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.8);
}
.regional-section {
  min-width: 118px;
  height: 38px;
  padding: 0 15px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: #687991;
  font-size: .72rem;
  font-weight: 800;
  cursor: pointer;
}
.regional-section svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.regional-section.active {
  color: var(--p-blue);
  background: #fff;
  box-shadow: 0 3px 10px rgba(15,23,42,.075);
}
.regional-section:disabled { opacity: .72; cursor: default; }

/* WORK CHOICE LIST */
.programme-topbar-right {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}
.oeuvre-picker { position: relative; width: 270px; }
.oeuvre-picker-trigger {
  width: 100%;
  height: 46px;
  padding: 0 14px 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid #e1e8f1;
  border-radius: 14px;
  background: #f7f9fc;
  color: #334155;
  font-size: 13px;
  font-weight: 750;
  cursor: pointer;
  transition: border-color .18s ease, background .18s ease, box-shadow .18s ease;
}
.oeuvre-picker-trigger:hover,
.oeuvre-picker.open .oeuvre-picker-trigger {
  border-color: #b8c9df;
  background: #fff;
  box-shadow: 0 6px 20px rgba(15,23,42,.07);
}
.oeuvre-picker-trigger svg {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  fill: none;
  stroke: #64748b;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform .18s ease;
}
.oeuvre-picker.open .oeuvre-picker-trigger svg { transform: rotate(180deg); }
.oeuvre-menu {
  position: absolute;
  z-index: 20;
  top: calc(100% + 7px);
  left: 0;
  width: 100%;
  padding: 5px;
  display: grid;
  gap: 2px;
  border: 1px solid #dce5f0;
  border-radius: 15px;
  background: rgba(255,255,255,.98);
  box-shadow: 0 18px 40px rgba(15,23,42,.13), 0 3px 8px rgba(15,23,42,.05);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-5px) scale(.985);
  transform-origin: top center;
  transition: opacity .15s ease, transform .15s ease, visibility .15s ease;
}
.oeuvre-picker.open .oeuvre-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}
.oeuvre-option {
  width: 100%;
  min-height: 40px;
  padding: 9px 11px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #334155;
  text-align: left;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.3;
  cursor: pointer;
}
.oeuvre-option:hover { background: #f1f5f9; }
.oeuvre-option.active {
  color: var(--p-blue);
  background: #eef4ff;
}

.programme-back {
  height: 46px;
  padding: 0 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 14px;
  background: #eef4ff;
  color: #2563eb;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: background .18s ease, transform .18s ease;
}
.programme-back:hover { background: #dbeafe; transform: translateY(-1px); }
.programme-back:active { transform: scale(.97); }

/* READER */
.reader-shell {
  width: min(1420px, calc(100% - 48px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 118px 0 55px 302px;
  display: block;
  box-sizing: border-box;
}
.reader-navigation {
  position: fixed;
  z-index: 900;
  top: 108px;
  left: 28px;
  width: 264px;
  height: calc(100vh - 124px);
  max-height: none;
  overflow: hidden;
  box-sizing: border-box;
  padding: 16px 12px;
  border: 1px solid var(--p-line);
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 12px 35px rgba(15,23,42,.045);
  overflow: hidden;
}
.reader-navigation .chapter-list {
  overflow: visible;
}
.reader-nav-heading { padding: 2px 8px 10px; }
.reader-nav-heading span {
  display: block;
  margin-bottom: 6px;
  color: var(--p-blue);
  font-size: .56rem;
  letter-spacing: .14em;
  font-weight: 900;
}
.reader-nav-heading strong { display: block; font-size: .8rem; line-height: 1.35; }
.reader-progress { height: 4px; margin: 0 8px; overflow: hidden; border-radius: 999px; background: #edf2f7; }
.reader-progress span { display: block; height: 100%; border-radius: inherit; background: var(--p-blue); }
.reader-progress-label { margin: 6px 8px 9px; color: var(--p-faint); font-size: .59rem; font-weight: 700; }
.chapter-list { display: grid; gap: 2px; }
.chapter {
  width: 100%;
  min-height: 36px;
  padding: 0 9px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #64748b;
  text-align: left;
  font-size: .67rem;
  font-weight: 750;
  cursor: pointer;
}
.chapter span { width: 23px; color: #a0aec0; font-size: .59rem; font-variant-numeric: tabular-nums; }
.chapter:hover { background: #f7f9fc; color: #334155; }
.chapter.active { color: var(--p-blue); background: #eef4ff; }
.chapter.active span { color: var(--p-blue); }

.reader-document {
  min-height: calc(100vh - 173px);
  margin-left: 0;
  border: 1px solid #e1e7ef;
  border-radius: 24px;
  background: #fff;
  box-shadow: 0 18px 50px rgba(15,23,42,.055);
}
.reader-document-inner {
  width: min(760px, calc(100% - 64px));
  margin: 0 auto;
  padding: 48px 0 100px;
}
.reader-document-topline {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  color: #94a3b8;
  font-size: .57rem;
  letter-spacing: .12em;
  font-weight: 850;
}
.reader-document-rule { height: 1px; margin: 14px 0 65px; background: #e8edf3; }
.chapter-heading span { color: var(--p-blue); font-size: .6rem; letter-spacing: .15em; font-weight: 900; }
.chapter-heading h1 {
  margin: 13px 0 0;
  color: #111827;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 500;
  line-height: 1.12;
  letter-spacing: -.035em;
}
.copyright-notice {
  margin-top: 52px;
  padding: 20px 22px;
  border: 1px solid #e1e8f1;
  border-radius: 16px;
  background: #f8faff;
}
.copyright-notice strong { color: #334155; font-size: .76rem; }
.copyright-notice p { margin: 7px 0 0; color: #64748b; font-size: .78rem; line-height: 1.7; }

/* DARK MODE */
html.dark body { background: #0b0f16; color: #f8fafc; }
html.dark .programme-topbar { border-color: rgba(51,65,85,.85); background: rgba(15,23,42,.88); box-shadow: 0 12px 35px rgba(0,0,0,.28); }
html.dark .programme-brand-copy small { color: #94a3b8; }
html.dark .regional-sections { border-color: #263449; background: #172033; }
html.dark .regional-section { color: #94a3b8; }
html.dark .regional-section.active { color: #60a5fa; background: #111827; }
html.dark .oeuvre-picker-trigger { border-color: #263449; background: #111827; color: #e2e8f0; }
html.dark .oeuvre-picker-trigger:hover, html.dark .oeuvre-picker.open .oeuvre-picker-trigger { border-color: #3b4b63; background: #172033; }
html.dark .oeuvre-menu { border-color: #263449; background: #111827; box-shadow: 0 18px 40px rgba(0,0,0,.35); }
html.dark .oeuvre-option { color: #cbd5e1; }
html.dark .oeuvre-option:hover { background: #172033; }
html.dark .oeuvre-option.active { color: #60a5fa; background: #172554; }
html.dark .programme-back { color: #60a5fa; background: #172554; }
html.dark .programme-back:hover { background: #1e3a8a; }
html.dark .reader-navigation, html.dark .reader-document { border-color: #263449; background: #111827; box-shadow: none; }
html.dark .reader-progress { background: #1e293b; }
html.dark .reader-nav-heading strong, html.dark .chapter-heading h1 { color: #f8fafc; }
html.dark .chapter { color: #94a3b8; }
html.dark .chapter:hover { background: #172033; color: #e2e8f0; }
html.dark .chapter.active { color: #60a5fa; background: #172554; }
html.dark .chapter.active span { color: #60a5fa; }
html.dark .reader-document-rule { background: #263449; }
html.dark .copyright-notice { border-color: #263449; background: #0f172a; }
html.dark .copyright-notice strong { color: #e2e8f0; }
html.dark .copyright-notice p { color: #94a3b8; }

@media (max-width: 1250px) {
  .regional-sections { position: static; transform: none; margin-left: auto; }
  .programme-topbar { justify-content: flex-start; }
  .programme-topbar-right { margin-left: 0; }
  .oeuvre-picker { width: 235px; }
}
@media (max-width: 980px) {
  .programme-brand-copy { display: none; }
  .reader-shell { width: min(100% - 28px, 900px); padding-left: 0; }
  .reader-navigation { position: static; width: 100%; height: auto; max-height: none; margin-bottom: 14px; }
  .oeuvre-picker { width: 210px; }
  .programme-back { padding: 0 17px; }
  .reader-document-inner { width: min(100% - 48px, 760px); }
}
@media (max-width: 760px) {
  .qcm-access-status { top:14px; left:14px; }

  .programme-topbar { top: 10px; width: calc(100% - 20px); height: 62px; padding: 0 10px 0 13px; border-radius: 18px; gap: 7px; }
  .programme-brand-mark { width: 34px; height: 34px; }
  .regional-sections { padding: 2px; border-radius: 12px; }
  .regional-section { min-width: 0; width: 42px; height: 36px; padding: 0; }
  .regional-section span { display: none; }
  .regional-section svg { width: 16px; height: 16px; }
  .programme-topbar-right { gap: 6px; }
  .oeuvre-picker { width: 45px; }
  .oeuvre-picker-trigger { height: 42px; padding: 0 11px; justify-content: center; }
  .oeuvre-picker-trigger span { display: none; }
  .oeuvre-picker-trigger svg { width: 15px; }
  .oeuvre-menu { width: min(290px, calc(100vw - 30px)); right: 0; left: auto; }
  .programme-back { width: 42px; height: 42px; padding: 0; font-size: 0; }
  .programme-back::before { content: "←"; font-size: 17px; }
  .reader-shell { width: calc(100% - 20px); padding-top: 91px; display: block; }
  .reader-navigation { position: static; width: 100%; height: auto; max-height: none; margin-bottom: 12px; padding: 12px; }
  .reader-nav-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 2px 6px 10px; }
  .reader-nav-heading span { margin: 0; }
  .reader-nav-heading strong { font-size: .7rem; }
  .chapter-list { display: flex; overflow-x: auto; padding-bottom: 2px; }
  .chapter { flex: 0 0 auto; width: auto; min-height: 36px; padding: 0 10px; }
  .chapter span { display: none; }
  .reader-document { min-height: auto; border-radius: 18px; }
  .reader-document-inner { width: calc(100% - 34px); padding: 30px 0 60px; }
  .reader-document-rule { margin-bottom: 40px; }
  .reader-document-topline span:last-child { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}

/* READER V3 — full-text reading surface */
.regional-section {
  min-width: 132px;
  height: 44px;
  border-radius: 12px;
  font-size: .78rem;
  font-weight: 800;
  letter-spacing: -.01em;
  transition: color .16s ease, background .16s ease, box-shadow .16s ease, transform .16s ease;
}
.regional-section:hover:not(.active) { color: #475569; background: rgba(255,255,255,.42); }
.regional-section:active { transform: scale(.98); }
.regional-section svg { width: 18px; height: 18px; stroke-width: 1.8; }

.reader-view { min-width: 0; }
.reader-view[hidden], .regional-empty-panel[hidden] { display: none !important; }
.reader-navigation[hidden] { display: none; }

.novel-content {
  margin-top: 54px;
  color: #293241;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 18px;
  line-height: 1.82;
  letter-spacing: -.006em;
}
.novel-content p {
  margin: 0 0 1.28em;
  text-align: left;
  text-wrap: pretty;
}
.novel-content p:last-child { margin-bottom: 0; }
.novel-dialogue { padding-left: 18px; }

.reader-next {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 64px;
  padding-top: 22px;
  border-top: 1px solid #e8edf3;
}
.reader-next button {
  min-height: 46px;
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid #dbe4ef;
  border-radius: 12px;
  background: #f8fafc;
  color: #334155;
  font-size: .75rem;
  font-weight: 800;
  cursor: pointer;
  transition: background .16s ease, border-color .16s ease, color .16s ease, transform .16s ease;
}
.reader-nav-icon {
  width: 17px;
  height: 17px;
  flex: 0 0 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.reader-next button:hover:not(:disabled) {
  border-color: #bfd0e5;
  background: #eef4ff;
  color: var(--p-blue);
  transform: translateY(-1px);
}
.reader-next button:disabled { opacity: .42; cursor: default; }

.regional-empty-panel {
  min-height: calc(100vh - 173px);
  border: 1px solid #e1e7ef;
  border-radius: 24px;
  background: #fff;
  display: grid;
  place-items: center;
  text-align: center;
  box-shadow: 0 18px 50px rgba(15,23,42,.055);
  padding: 40px;
}
.regional-empty-panel > div { max-width: 480px; }
.panel-icon {
  width: 46px;
  height: 46px;
  margin: 0 auto 18px;
  display: grid;
  place-items: center;
  border: 1px solid #dbe5f1;
  border-radius: 14px;
  background: #f7faff;
  color: var(--p-blue);
  font-size: 18px;
  font-weight: 800;
}
.panel-kicker {
  margin: 0 0 8px;
  color: var(--p-blue);
  font-size: .62rem;
  letter-spacing: .15em;
  font-weight: 900;
}
.regional-empty-panel h2 {
  margin: 0;
  color: #111827;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 2rem;
  font-weight: 500;
}
.regional-empty-panel p:last-child { margin: 12px 0 0; color: #64748b; line-height: 1.7; }
.reader-unavailable {
  margin-top: 54px;
  padding: 24px;
  border: 1px solid #e1e8f1;
  border-radius: 16px;
  background: #f8faff;
  display: grid;
  gap: 6px;
  font-family: Inter, sans-serif;
}
.reader-unavailable strong { color: #334155; font-size: .85rem; }
.reader-unavailable span { color: #64748b; font-size: .78rem; line-height: 1.6; }

html.dark .regional-section:hover:not(.active) { color: #e2e8f0; background: rgba(255,255,255,.05); }
html.dark .novel-content { color: #d7dee8; }
html.dark .reader-next { border-color: #263449; }
html.dark .reader-next button { border-color: #334155; background: #172033; color: #cbd5e1; }
html.dark .reader-next button:hover:not(:disabled) { border-color: #405777; background: #172554; color: #60a5fa; }
html.dark .regional-empty-panel { border-color: #263449; background: #111827; box-shadow: none; }
html.dark .panel-icon { border-color: #334155; background: #172033; }
html.dark .regional-empty-panel h2 { color: #f8fafc; }
html.dark .regional-empty-panel p:last-child { color: #94a3b8; }
html.dark .reader-unavailable { border-color: #263449; background: #0f172a; }
html.dark .reader-unavailable strong { color: #e2e8f0; }
html.dark .reader-unavailable span { color: #94a3b8; }

@media (max-width: 980px) {
  .regional-section { min-width: 108px; }
  .novel-content { font-size: 17px; }
}
@media (max-width: 760px) {
  .regional-section { width: 44px; height: 38px; }
  .novel-content { margin-top: 40px; font-size: 16.5px; line-height: 1.78; }
  .reader-next { flex-direction: column; align-items: stretch; }
  .reader-next button { width: 100%; }
  .regional-empty-panel { min-height: 60vh; border-radius: 18px; }
}

/* READER NAVIGATION — compact chapter list: all chapters visible without an internal scrollbar */
.reader-navigation .chapter-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  overflow: visible !important;
}
.reader-navigation .chapter {
  min-height: 34px;
  height: 34px;
  padding: 0 9px;
}
.reader-navigation {
  overflow: visible !important;
}

@media (min-width: 981px) {
  .reader-navigation {
    height: auto;
    min-height: 0;
    max-height: calc(100vh - 124px);
  }
}

@media (max-width: 980px) {
  .reader-navigation {
    position: static;
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
  }
  .reader-navigation .chapter-list {
    display: grid !important;
    grid-template-columns: 1fr !important;
    overflow: visible !important;
  }
  .reader-navigation .chapter {
    width: 100% !important;
    min-height: 34px !important;
    height: 34px !important;
    flex: none !important;
    padding: 0 9px !important;
  }
}

@media (max-width: 760px) {
  .reader-navigation {
    padding: 10px 10px 12px;
  }
  .reader-nav-heading {
    padding: 2px 6px 7px;
  }
  .reader-nav-heading span {
    margin-bottom: 4px;
  }
  .reader-progress-label {
    margin: 5px 8px 5px;
  }
  .reader-navigation .chapter {
    min-height: 32px !important;
    height: 32px !important;
    border-radius: 9px;
  }
}


/* REGIONAL V7 — multi-work reader */
.play-speaker {
  margin: 1.65em 0 .45em !important;
  color: #172033;
  font-family: Inter, sans-serif;
  font-size: .78rem;
  line-height: 1.35 !important;
  font-weight: 850;
  letter-spacing: .025em;
}
.reader-navigation.work-condamne .chapter-list {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  column-gap: 2px;
  row-gap: 0;
}
.reader-navigation.work-condamne .chapter {
  min-width: 0;
  padding-left: 6px;
  padding-right: 5px;
  gap: 5px;
  font-size: .58rem;
}
.reader-navigation.work-condamne .chapter span { width: 17px; font-size: .51rem; }
.reader-navigation.work-condamne .chapter b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
html.dark .play-speaker { color: #f1f5f9; }
@media (max-width: 760px) {
  .reader-navigation.work-condamne .chapter-list { grid-template-columns: repeat(3, minmax(0,1fr)) !important; }
  .reader-navigation.work-condamne .chapter { min-height: 30px !important; height: 30px !important; }
}


/* REGIONAL V9 — Antigone Prologue + 20 scenes / DJC one-line chapters */
.reader-navigation.work-antigone .chapter-list,
.reader-navigation.work-condamne .chapter-list {
  display: grid !important;
  grid-template-columns: 1fr !important;
  gap: 1px;
  max-height: calc(100vh - 255px);
  overflow-y: auto !important;
  overflow-x: hidden !important;
  padding-right: 3px;
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 transparent;
}
.reader-navigation.work-antigone .chapter,
.reader-navigation.work-condamne .chapter {
  width: 100%;
  min-width: 0;
  min-height: 34px;
  height: 34px;
  padding: 0 9px;
  gap: 10px;
  font-size: .67rem;
}
.reader-navigation.work-antigone .chapter span,
.reader-navigation.work-condamne .chapter span {
  width: 23px;
  font-size: .59rem;
  flex: 0 0 23px;
}
.reader-navigation.work-antigone .chapter b,
.reader-navigation.work-condamne .chapter b {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.reader-navigation.work-antigone .chapter-list::-webkit-scrollbar,
.reader-navigation.work-condamne .chapter-list::-webkit-scrollbar { width: 6px; }
.reader-navigation.work-antigone .chapter-list::-webkit-scrollbar-track,
.reader-navigation.work-condamne .chapter-list::-webkit-scrollbar-track { background: transparent; }
.reader-navigation.work-antigone .chapter-list::-webkit-scrollbar-thumb,
.reader-navigation.work-condamne .chapter-list::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 999px; }
html.dark .reader-navigation.work-antigone .chapter-list,
html.dark .reader-navigation.work-condamne .chapter-list { scrollbar-color: #475569 transparent; }
html.dark .reader-navigation.work-antigone .chapter-list::-webkit-scrollbar-thumb,
html.dark .reader-navigation.work-condamne .chapter-list::-webkit-scrollbar-thumb { background: #475569; }
@media (max-width: 980px) {
  .reader-navigation.work-antigone .chapter-list,
  .reader-navigation.work-condamne .chapter-list { max-height: 360px; }
}
@media (max-width: 760px) {
  .reader-navigation.work-antigone .chapter-list,
  .reader-navigation.work-condamne .chapter-list { max-height: 320px; }
  .reader-navigation.work-antigone .chapter,
  .reader-navigation.work-condamne .chapter { min-height: 34px !important; height: 34px !important; }
}

/* COMPRENDRE V1 — structured work guides */
.reader-shell.understanding-active { padding-left: 0; }
.understand-shell {
  width: 100%; min-height: calc(100vh - 173px); display: grid;
  grid-template-columns: 264px minmax(0, 1fr); gap: 18px; box-sizing: border-box;
}
.understand-shell[hidden] { display: none !important; }
.understand-navigation {
  position: sticky; top: 108px; align-self: start; height: calc(100vh - 124px); max-height: calc(100vh - 124px);
  overflow: hidden; padding: 16px 10px 12px; border: 1px solid var(--p-line); border-radius: 20px;
  background: #fff; box-shadow: 0 12px 35px rgba(15,23,42,.045);
}
.understand-nav-heading { padding: 2px 8px 13px; }
.understand-nav-heading span { display:block; margin-bottom:6px; color:var(--p-blue); font-size:.56rem; letter-spacing:.14em; font-weight:900; }
.understand-nav-heading strong { display:block; color:#172033; font-size:.8rem; line-height:1.35; }
.understand-nav-list { height:calc(100% - 62px); overflow-y:auto; overflow-x:hidden; padding-right:4px; scrollbar-width:thin; scrollbar-color:#cbd5e1 transparent; }
.understand-nav-list::-webkit-scrollbar { width:5px; }
.understand-nav-list::-webkit-scrollbar-thumb { background:#cbd5e1; border-radius:999px; }
.understand-nav-item { width:100%; min-height:38px; padding:7px 9px; display:flex; align-items:center; border:0; border-radius:10px; background:transparent; color:#64748b; text-align:left; font-size:.68rem; font-weight:750; line-height:1.3; cursor:pointer; }
.understand-nav-item:hover { background:#f7f9fc; color:#334155; }
.understand-nav-item.active { color:var(--p-blue); background:#eef4ff; }
.understand-document { min-width:0; min-height:calc(100vh - 173px); max-height:calc(100vh - 173px); overflow:hidden; border:1px solid #e1e7ef; border-radius:24px; background:#fff; box-shadow:0 18px 50px rgba(15,23,42,.055); }
.understand-content { height:100%; overflow-y:auto; padding:52px clamp(28px,5vw,76px) 70px; box-sizing:border-box; scrollbar-width:thin; scrollbar-color:#cbd5e1 transparent; }
.understand-content::-webkit-scrollbar { width:7px; }
.understand-content::-webkit-scrollbar-thumb { background:#cbd5e1; border-radius:999px; }
.understand-content-head { max-width:940px; margin:0 auto 42px; padding-bottom:25px; border-bottom:1px solid #e8edf3; }
.understand-content-head span { color:var(--p-blue); font-size:.6rem; letter-spacing:.15em; font-weight:900; }
.understand-content-head h1 { margin:11px 0 0; color:#111827; font-family:Georgia,"Times New Roman",serif; font-size:clamp(2rem,3.7vw,3rem); font-weight:500; line-height:1.12; letter-spacing:-.035em; }
.understand-content-body { max-width:940px; margin:0 auto; color:#475569; font-size:.94rem; line-height:1.78; }
.understand-content-body h3 { margin:0 0 12px; color:#172033; font-size:1rem; line-height:1.35; }
.understand-content-body p { margin:0 0 18px; }
.understand-content-body p:last-child { margin-bottom:0; }
.understand-content-body ul { margin:0 0 20px 18px; padding:0; }
.understand-content-body li { margin:7px 0; padding-left:3px; }
.understand-card-grid { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:10px; margin-bottom:22px; }
.fact-card,.single-fact,.fact-line { padding:16px 17px; border:1px solid #e2e8f0; border-radius:14px; background:#fbfcfe; }
.fact-card span,.single-fact span,.fact-line span { display:block; margin-bottom:7px; color:#94a3b8; font-size:.62rem; font-weight:850; letter-spacing:.08em; text-transform:uppercase; }
.fact-card strong,.single-fact strong,.fact-line strong { display:block; color:#172033; font-size:.82rem; line-height:1.45; }
.single-fact { max-width:460px; margin-bottom:20px; }
.fact-line { display:flex; align-items:center; justify-content:space-between; gap:20px; margin-bottom:10px; }
.fact-line span { margin:0; }
.fact-line strong { text-align:right; }
.understand-note,.understand-highlight { margin:20px 0; padding:17px 19px; border:1px solid #dce8fb; border-radius:15px; background:#f7faff; }
.understand-note strong,.understand-highlight strong { display:block; margin-bottom:6px; color:var(--p-blue); font-size:.72rem; letter-spacing:.08em; text-transform:uppercase; }
.understand-note p,.understand-highlight p { margin:0; color:#52647c; }
.split-info { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; }
.split-info>div,.tone-grid>div,.character-grid article { padding:18px; border:1px solid #e2e8f0; border-radius:15px; background:#fff; }
.tag-list { display:flex; flex-wrap:wrap; gap:8px; margin:10px 0 20px; }
.tag-list span { padding:8px 11px; border:1px solid #dfe7f1; border-radius:999px; background:#f8fafc; color:#53657c; font-size:.72rem; font-weight:700; }
.character-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:11px; }
.character-grid article h3 { margin-bottom:7px; color:#172033; font-size:.84rem; }
.character-grid article p { margin:0; font-size:.82rem; line-height:1.65; }
.schema-list { display:grid; gap:10px; }
.schema-list>div { display:grid; grid-template-columns:38px 150px minmax(0,1fr); align-items:start; gap:13px; padding:16px; border:1px solid #e2e8f0; border-radius:15px; background:#fbfcfe; }
.schema-list>div>b { width:30px; height:30px; display:grid; place-items:center; border-radius:9px; background:#eef4ff; color:var(--p-blue); font-size:.65rem; }
.schema-list>div>span { padding-top:5px; color:#172033; font-size:.78rem; font-weight:850; }
.schema-list>div>p { margin:3px 0 0; font-size:.82rem; line-height:1.65; }
.tone-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:11px; }
.tone-grid>div b { display:block; margin-bottom:7px; color:#172033; font-size:.82rem; }
.tone-grid>div p { margin:0; font-size:.81rem; line-height:1.65; }
.understand-source { max-width:940px; margin:42px auto 0; padding-top:17px; border-top:1px solid #e8edf3; color:#94a3b8; font-size:.65rem; }
.understand-source a { color:var(--p-blue); font-weight:750; text-decoration:none; }
.understand-source a:hover { text-decoration:underline; }
html.dark .understand-navigation,html.dark .understand-document { border-color:#263449; background:#111827; box-shadow:none; }
html.dark .understand-nav-heading strong,html.dark .understand-content-head h1,html.dark .understand-content-body h3,html.dark .fact-card strong,html.dark .single-fact strong,html.dark .fact-line strong,html.dark .character-grid article h3,html.dark .schema-list>div>span,html.dark .tone-grid>div b { color:#f8fafc; }
html.dark .understand-nav-item { color:#94a3b8; }
html.dark .understand-nav-item:hover { background:#172033; color:#e2e8f0; }
html.dark .understand-nav-item.active { color:#60a5fa; background:#172554; }
html.dark .understand-content-body { color:#cbd5e1; }
html.dark .understand-content-head,html.dark .understand-source { border-color:#263449; }
html.dark .fact-card,html.dark .single-fact,html.dark .fact-line,html.dark .split-info>div,html.dark .tone-grid>div,html.dark .character-grid article,html.dark .schema-list>div { border-color:#263449; background:#0f172a; }
html.dark .understand-note,html.dark .understand-highlight { border-color:#263449; background:#0f172a; }
html.dark .understand-note p,html.dark .understand-highlight p { color:#94a3b8; }
html.dark .tag-list span { border-color:#263449; background:#0f172a; color:#cbd5e1; }
html.dark .schema-list>div>b { background:#172554; color:#60a5fa; }
@media (max-width:980px) {
  .reader-shell.understanding-active { padding-left:0; }
  .understand-shell { grid-template-columns:1fr; gap:12px; }
  .understand-navigation { position:static; height:auto; max-height:none; padding:12px; }
  .understand-nav-heading { padding:2px 6px 9px; }
  .understand-nav-list { height:auto; max-height:118px; display:flex; gap:5px; overflow-x:auto; overflow-y:hidden; padding:0 0 3px; }
  .understand-nav-item { flex:0 0 auto; width:auto; min-height:34px; padding:7px 11px; white-space:nowrap; }
  .understand-document { min-height:620px; max-height:none; }
  .understand-content { min-height:620px; }
  .understand-card-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
}
@media (max-width:760px) {
  .understand-card-grid,.split-info,.character-grid,.tone-grid { grid-template-columns:1fr; }
  .understand-content { padding:34px 20px 55px; }
  .understand-content-head { margin-bottom:30px; }
  .understand-content-head h1 { font-size:2rem; }
  .schema-list>div { grid-template-columns:32px 1fr; gap:9px; }
  .schema-list>div>p { grid-column:2; }
  .fact-line { display:block; }
  .fact-line strong { margin-top:5px; text-align:left; }
}


/* COMPRENDRE V2 — full-page reading layout, no internal scrollbars */
.reader-shell.understanding-active { padding-left: 0; }
.understand-shell {
  align-items: start;
  min-height: 0;
  height: auto;
  overflow: visible;
}
.understand-navigation {
  position: sticky;
  top: 108px;
  height: auto;
  max-height: none;
  overflow: visible;
}
.understand-nav-list {
  height: auto;
  max-height: none;
  overflow: visible;
  padding-right: 0;
  scrollbar-width: none;
}
.understand-nav-list::-webkit-scrollbar { display: none; width: 0; height: 0; }
.understand-nav-item { min-height: 42px; font-size: .72rem; }
.understand-document {
  min-height: 0;
  max-height: none;
  height: auto;
  overflow: visible;
}
.understand-content {
  height: auto;
  min-height: 0;
  overflow: visible;
  padding: 62px clamp(34px,5vw,82px) 90px;
  scrollbar-width: none;
}
.understand-content::-webkit-scrollbar { display: none; width: 0; height: 0; }
.understand-content-body {
  font-size: 1.04rem;
  line-height: 1.92;
}
.understand-content-body h3 {
  margin-bottom: 15px;
  font-size: 1.18rem;
}
.understand-content-body p { margin-bottom: 24px; }
.understand-content-body li { margin: 10px 0; }
.understand-card-grid { gap: 13px; margin-bottom: 28px; }
.fact-card { padding: 19px 20px; min-height: 92px; }
.fact-card span,.single-fact span,.fact-line span { font-size: .68rem; }
.fact-card strong,.single-fact strong,.fact-line strong { font-size: .96rem; line-height: 1.55; }
.understand-note,.understand-highlight { margin: 28px 0; padding: 21px 23px; }
.understand-note p,.understand-highlight p { font-size: 1rem; line-height: 1.8; }
.character-grid { gap: 14px; }
.character-grid article { padding: 21px; }
.character-grid article h3 { font-size: .98rem; margin-bottom: 9px; }
.character-grid article p { font-size: .95rem; line-height: 1.78; }
.schema-list { gap: 13px; }
.schema-list>div { padding: 20px; grid-template-columns: 42px 175px minmax(0,1fr); gap: 15px; }
.schema-list>div>span { font-size: .9rem; }
.schema-list>div>p { font-size: .94rem; line-height: 1.78; }
.tone-grid { gap: 14px; }
.tone-grid>div { padding: 21px; }
.tone-grid>div b { font-size: .96rem; }
.tone-grid>div p { font-size: .92rem; line-height: 1.78; }
.tag-list { gap: 9px; margin: 14px 0 24px; }
.tag-list span { padding: 9px 13px; font-size: .8rem; }
.understand-source { display: none !important; }
@media (max-width: 980px) {
  .understand-navigation { position: static; height: auto; max-height: none; overflow: visible; }
  .understand-nav-list { display: flex; flex-wrap: wrap; gap: 5px; overflow: visible; padding: 0; }
  .understand-nav-item { width: auto; flex: 0 0 auto; }
  .understand-document { min-height: 0; max-height: none; overflow: visible; }
  .understand-content { min-height: 0; overflow: visible; }
}
@media (max-width: 760px) {
  .understand-content { padding: 42px 22px 65px; }
  .understand-content-body { font-size: 1rem; line-height: 1.85; }
  .understand-card-grid,.split-info,.character-grid,.tone-grid { grid-template-columns: 1fr; }
  .schema-list>div { grid-template-columns: 34px 1fr; }
  .schema-list>div>p { grid-column: 2; }
}


/* REGIONAL V13 — Comprendre navigation truly fixed to viewport */
@media (min-width: 981px) {
  .reader-shell.understanding-active {
    padding-left: 0 !important;
  }

  .understand-shell {
    display: block !important;
    width: 100% !important;
    min-height: 0 !important;
    height: auto !important;
    overflow: visible !important;
  }

  .understand-navigation {
    position: fixed !important;
    z-index: 850 !important;
    top: 108px !important;
    left: max(28px, calc((100vw - 1420px) / 2)) !important;
    width: 264px !important;
    height: calc(100vh - 124px) !important;
    max-height: calc(100vh - 124px) !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
  }

  .understand-nav-list {
    height: calc(100% - 62px) !important;
    max-height: none !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    padding-right: 4px !important;
    scrollbar-width: thin !important;
    scrollbar-color: #cbd5e1 transparent !important;
  }

  .understand-nav-list::-webkit-scrollbar {
    width: 5px;
  }

  .understand-nav-list::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 999px;
  }

  .understand-document {
    width: calc(100% - 282px) !important;
    margin-left: 282px !important;
    min-height: 0 !important;
    max-height: none !important;
    height: auto !important;
    overflow: visible !important;
  }

  .understand-content {
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    overflow: visible !important;
  }
}

@media (max-width: 980px) {
  .understand-navigation {
    position: sticky !important;
    top: 84px !important;
    z-index: 850 !important;
    height: auto !important;
    max-height: 330px !important;
    overflow: hidden !important;
  }

  .understand-nav-list {
    max-height: 235px !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    display: block !important;
    padding-right: 4px !important;
    scrollbar-width: thin !important;
    scrollbar-color: #cbd5e1 transparent !important;
  }

  .understand-nav-item {
    width: 100% !important;
  }

  .understand-document {
    min-height: 0 !important;
    max-height: none !important;
    height: auto !important;
    overflow: visible !important;
  }

  .understand-content {
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    overflow: visible !important;
  }
}

/* REGIONAL QCM — 500-question bank */
.qcm-shell {
  width: min(1200px, calc(100% - 48px));
  margin: 0 auto;
  padding: 132px 0 80px;
}
.qcm-hero { position:relative; }
.qcm-access-status {
  position:absolute;
  top:18px;
  left:20px;
  display:inline-flex;
  align-items:center;
  gap:9px;
  min-height:40px;
  padding:6px 12px 6px 7px;
  border:1px solid #dbe7fb;
  border-radius:13px;
  background:rgba(248,251,255,.96);
  color:#2563eb;
  box-shadow:0 8px 24px rgba(37,99,235,.07);
}
.qcm-access-status[hidden] { display:none !important; }
.qcm-access-status-icon {
  width:28px;
  height:28px;
  display:grid;
  place-items:center;
  flex:0 0 28px;
  border-radius:9px;
  background:#2563eb;
  color:#fff;
}
.qcm-access-status-icon svg { width:16px; height:16px; }
.qcm-access-status-copy { display:flex; flex-direction:column; gap:1px; line-height:1.15; }
.qcm-access-status-copy strong {
  color:#1d4ed8;
  font:800 11px/1.15 Inter,sans-serif;
  letter-spacing:.01em;
}
.qcm-access-status-copy small {
  color:#718096;
  font:600 10px/1.15 Inter,sans-serif;
}
.qcm-hero {
  background: #fff;
  border: 1px solid #e1e8f0;
  border-radius: 26px;
  padding: 42px clamp(24px, 5vw, 64px) 34px;
  box-shadow: 0 18px 45px rgba(15,23,42,.055);
}
.qcm-kicker { color:#2563eb; font-size:.72rem; font-weight:900; letter-spacing:.16em; margin-bottom:10px; }
.qcm-hero h1 { margin:0 0 12px; font-family:Georgia,'Times New Roman',serif; font-size:clamp(2rem,4vw,3.4rem); font-weight:500; color:#0f172a; }
.qcm-hero>p { max-width:780px; margin:0; color:#64748b; font-size:1rem; line-height:1.75; }
.qcm-stats { display:flex; flex-wrap:wrap; gap:10px; margin-top:26px; }
.qcm-stat { min-width:130px; padding:12px 14px; border:1px solid #e3eaf2; border-radius:14px; background:#f8fafc; }
.qcm-stat b { display:block; color:#0f172a; font-size:1.05rem; margin-bottom:3px; }
.qcm-stat span { color:#7b8ba1; font-size:.72rem; font-weight:700; }
.qcm-toolbar { margin:18px 0; display:flex; align-items:center; justify-content:space-between; gap:12px; flex-wrap:wrap; }
.qcm-filter-group { display:flex; gap:5px; padding:5px; background:#edf2f8; border-radius:14px; }
.qcm-filter,.qcm-source-filter { border:0; background:transparent; color:#64748b; border-radius:10px; padding:9px 13px; font:700 12px Inter,sans-serif; cursor:pointer; }
.qcm-filter.active,.qcm-source-filter.active { background:#fff; color:#2563eb; box-shadow:0 2px 8px rgba(15,23,42,.08); }
.qcm-random,.qcm-primary { border:0; border-radius:12px; padding:11px 16px; background:#2563eb; color:#fff; font:800 12px Inter,sans-serif; cursor:pointer; }
.qcm-secondary { border:1px solid #dbe4ee; border-radius:12px; padding:11px 16px; background:#fff; color:#475569; font:800 12px Inter,sans-serif; cursor:pointer; }
.qcm-secondary:disabled { opacity:.45; cursor:not-allowed; }
.qcm-progress-line { display:flex; align-items:center; gap:12px; color:#718096; font-size:.76rem; font-weight:800; margin:8px 2px 12px; }
.qcm-progress-line>div { flex:1; height:6px; background:#e9eef5; border-radius:999px; overflow:hidden; }
.qcm-progress-line>div>span { display:block; width:0; height:100%; background:#2563eb; border-radius:999px; transition:width .18s ease; }
.qcm-card { background:#fff; border:1px solid #e1e8f0; border-radius:24px; padding:clamp(24px,4vw,46px); box-shadow:0 18px 45px rgba(15,23,42,.05); }
.qcm-card-top { display:flex; align-items:center; justify-content:space-between; gap:12px; margin-bottom:24px; }
.qcm-badges { display:flex; gap:7px; flex-wrap:wrap; }
.qcm-badge { display:inline-flex; align-items:center; min-height:28px; padding:5px 9px; border-radius:999px; background:#eef4ff; color:#2563eb; font-size:.68rem; font-weight:900; }
.qcm-badge.level-medium { background:#f3f4f6; color:#475569; }
.qcm-badge.level-hard { background:#fff1f2; color:#be123c; }
.qcm-number { color:#94a3b8; font-size:.75rem; font-weight:800; }
.qcm-question { margin:0 0 26px; color:#0f172a; font-size:clamp(1.18rem,2vw,1.55rem); line-height:1.55; font-weight:800; }
.qcm-options { display:grid; gap:10px; }
.qcm-option { width:100%; text-align:left; border:1px solid #dfe7f0; background:#fff; border-radius:15px; padding:15px 17px; color:#334155; font:600 14px/1.55 Inter,sans-serif; cursor:pointer; transition:border-color .15s ease,background .15s ease,transform .15s ease; }
.qcm-option:hover { border-color:#9bbcf8; background:#f8fbff; transform:translateY(-1px); }
.qcm-option.correct { border-color:#86efac; background:#f0fdf4; color:#166534; }
.qcm-option.wrong { border-color:#fda4af; background:#fff1f2; color:#9f1239; }
.qcm-option:disabled { cursor:default; transform:none; }
.qcm-correction { margin-top:20px; padding:17px 19px; border:1px solid #bfdbfe; border-radius:15px; background:#f8fbff; }
.qcm-correction strong { display:block; color:#2563eb; margin-bottom:5px; font-size:.76rem; text-transform:uppercase; letter-spacing:.08em; }
.qcm-correction p { margin:0; color:#475569; font-size:.9rem; line-height:1.7; }
.qcm-actions { display:flex; justify-content:space-between; gap:10px; margin-top:14px; }
@media (max-width:760px) {
  .qcm-shell { width:calc(100% - 24px); padding-top:110px; }
  .qcm-toolbar { align-items:stretch; }
  .qcm-filter-group { overflow:auto; max-width:100%; }
  .qcm-random { width:100%; }
  .qcm-actions button { flex:1; }
}

/* QCM 1500 — structured layout, no filters */
.qcm-shell { padding-bottom: 80px; }
.qcm-hero {
  padding: clamp(30px, 5vw, 54px);
  border-radius: 28px;
  background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
  box-shadow: 0 16px 45px rgba(15,23,42,.045);
}
.qcm-hero h1 { max-width: 850px; }
.qcm-hero > p { max-width: 900px; font-size: 1.05rem; }
.qcm-stats { display:grid; grid-template-columns:repeat(5,minmax(0,1fr)); gap:12px; }
.qcm-stat { min-width:0; min-height:78px; display:flex; flex-direction:column; justify-content:center; padding:14px 16px; }
.qcm-stat b { font-size:1.08rem; }
.qcm-stat span { line-height:1.35; }
.qcm-toolbar {
  margin:22px 0 14px;
  padding:12px;
  border:1px solid #e1e8f0;
  border-radius:18px;
  background:#f8fafc;
}
.qcm-coverage { display:flex; align-items:stretch; gap:8px; flex-wrap:wrap; }
.qcm-coverage-item {
  min-width:150px;
  padding:10px 13px;
  border:1px solid #e1e8f0;
  border-radius:12px;
  background:#fff;
  display:flex;
  flex-direction:column;
  gap:3px;
}
.qcm-coverage-item b { color:#1e293b; font-size:.78rem; }
.qcm-coverage-item small { color:#8190a5; font-size:.68rem; font-weight:700; }
.qcm-random { min-height:48px; padding:0 18px; }
.qcm-progress-line { margin:14px 2px; }
.qcm-card {
  padding:clamp(26px,4vw,48px);
  border-radius:26px;
  box-shadow:0 18px 48px rgba(15,23,42,.055);
}
.qcm-card-top { margin-bottom:28px; padding-bottom:18px; border-bottom:1px solid #edf1f6; }
.qcm-badge { min-height:30px; padding:6px 10px; }
.qcm-question { max-width:1000px; font-size:clamp(1.3rem,2.1vw,1.7rem); line-height:1.5; margin-bottom:28px; }
.qcm-options { gap:12px; }
.qcm-option { padding:17px 18px; border-radius:14px; font-size:.95rem; line-height:1.6; }
.qcm-correction { margin-top:22px; padding:19px 20px; border-radius:16px; }
@media (max-width: 900px) {
  .qcm-stats { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .qcm-toolbar { align-items:stretch; }
  .qcm-coverage { flex:1; }
  .qcm-random { width:100%; }
}
@media (max-width: 560px) {
  .qcm-stats { grid-template-columns:1fr; }
  .qcm-coverage { display:grid; grid-template-columns:1fr; width:100%; }
  .qcm-coverage-item { min-width:0; }
}

/* QCM V15 — centered composition */
.qcm-hero {
  text-align: center;
  padding: clamp(34px, 5vw, 58px);
}
.qcm-kicker { margin-bottom: 12px; }
.qcm-hero h1 {
  margin-left: auto;
  margin-right: auto;
}
.qcm-hero > p {
  margin-left: auto;
  margin-right: auto;
}
.qcm-stats {
  width: min(100%, 980px);
  margin: 30px auto 0;
  grid-template-columns: repeat(5, minmax(0, 1fr));
}
.qcm-stat {
  text-align: center;
  align-items: center;
  min-height: 86px;
  padding: 15px 14px;
}
.qcm-toolbar {
  width: min(100%, 980px);
  margin: 22px auto 14px;
  justify-content: center;
  background: transparent;
  border: 0;
  padding: 0;
}
.qcm-coverage {
  justify-content: center;
}
.qcm-coverage-item {
  min-width: 190px;
  text-align: center;
  align-items: center;
  padding: 13px 18px;
  border-radius: 14px;
  box-shadow: 0 5px 18px rgba(15,23,42,.035);
}
.qcm-random {
  min-width: 190px;
}
.qcm-progress-line {
  width: min(100%, 980px);
  margin: 16px auto;
}
.qcm-card {
  width: min(100%, 980px);
  margin: 0 auto;
}
.qcm-actions {
  width: min(100%, 980px);
  margin: 14px auto 0;
}
@media (max-width: 900px) {
  .qcm-stats { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .qcm-toolbar { width: 100%; }
  .qcm-progress-line, .qcm-card, .qcm-actions { width: 100%; }
}
@media (max-width: 560px) {
  .qcm-stats { grid-template-columns: 1fr; }
  .qcm-coverage-item, .qcm-random { width: 100%; min-width: 0; }
}


/* QCM V16 — true viewport centering
   The shared reader shell reserves 302px for the fixed reading sidebar.
   QCM has no sidebar, so compensate for half of that reserved space. */
@media (min-width: 981px) {
  .qcm-shell {
    position: relative;
    left: calc(50vw - 600px - ((100vw - min(1420px, calc(100vw - 48px))) / 2 + 302px));
    margin-left: 0;
    margin-right: 0;
    box-sizing: border-box;
    width: min(1200px, calc(100vw - 48px));
    max-width: 1200px;
  }
}
@media (max-width: 980px) {
  .qcm-shell {
    position: static;
    left: auto;
    width: calc(100% - 28px);
    box-sizing: border-box;
  }
}


/* REGIONAL V14 — unified Lire / Comprendre sidebar system */
@media (min-width: 981px) {
  .reader-shell {
    padding-left: 282px;
  }

  .reader-navigation,
  .understand-navigation {
    width: 264px;
    box-sizing: border-box;
    padding: 16px 12px;
    border-radius: 20px;
  }

  .reader-nav-heading,
  .understand-nav-heading {
    padding: 2px 8px 10px;
  }

  .reader-nav-heading span,
  .understand-nav-heading span {
    margin-bottom: 6px;
    font-size: .56rem;
    letter-spacing: .14em;
    font-weight: 900;
  }

  .reader-nav-heading strong,
  .understand-nav-heading strong {
    font-size: .8rem;
    line-height: 1.35;
  }

  .understand-nav-list {
    height: calc(100% - 62px) !important;
    padding-right: 4px !important;
  }

  .understand-nav-item {
    min-height: 34px;
    height: 34px;
    padding: 0 9px;
    border-radius: 10px;
    font-size: .68rem;
    font-weight: 750;
    line-height: 1.3;
  }

  .understand-document {
    width: calc(100% - 282px) !important;
    margin-left: 282px !important;
  }
}

/* REGIONAL V15 — Lire / Comprendre cards use the exact same navigation shell */
@media (min-width: 981px) {
  .reader-navigation,
  .understand-navigation {
    top: 108px !important;
    width: 264px !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: calc(100vh - 124px) !important;
    padding: 16px 12px !important;
    border: 1px solid var(--p-line) !important;
    border-radius: 20px !important;
    background: #fff !important;
    box-shadow: 0 12px 35px rgba(15,23,42,.045) !important;
    box-sizing: border-box !important;
  }

  .reader-navigation {
    left: 28px !important;
    position: fixed !important;
  }

  .understand-navigation {
    left: 28px !important;
    position: fixed !important;
    overflow: hidden !important;
  }

  .reader-nav-heading,
  .understand-nav-heading {
    padding: 2px 8px 10px !important;
  }

  .reader-nav-heading span,
  .understand-nav-heading span {
    display: block;
    margin-bottom: 6px !important;
    color: var(--p-blue);
    font-size: .56rem !important;
    letter-spacing: .14em !important;
    font-weight: 900 !important;
  }

  .reader-nav-heading strong,
  .understand-nav-heading strong {
    display: block;
    font-size: .8rem !important;
    line-height: 1.35 !important;
  }

  .understand-nav-list {
    height: auto !important;
    max-height: calc(100vh - 220px) !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    padding-right: 0 !important;
  }

  .understand-nav-item {
    min-height: 34px !important;
    height: 34px !important;
    padding: 0 9px !important;
    border-radius: 10px !important;
    font-size: .68rem !important;
    font-weight: 750 !important;
    line-height: 1.3 !important;
  }
}

/* Human-built message — deliberately subtle and centered */
.human-built-message {
  width: 100%;
  margin: 0 auto;
  padding: 0 24px 28px;
  box-sizing: border-box;
  color: #94a3b8;
  font-size: .66rem;
  font-weight: 600;
  line-height: 1.5;
  text-align: center;
}

@media (max-width: 980px) {
  .human-built-message {
    width: 100%;
    padding: 0 12px 24px;
  }
}

@media (max-width: 760px) {
  .human-built-message {
    width: 100%;
    padding: 0 8px 20px;
    font-size: .62rem;
  }
}

html.dark .human-built-message {
  color: #64748b;
}
/* COMPRENDRE V18 — expanded left navigation + footer centered in remaining area.
   This applies only while the Comprendre view is active; QCM remains untouched. */
@media (min-width: 981px) {
  body.understanding-view-active .understand-navigation {
    left: 0 !important;
    width: 360px !important;
    height: calc(100vh - 108px) !important;
    max-height: calc(100vh - 108px) !important;
    top: 108px !important;
    border-left: 0 !important;
    border-radius: 0 20px 20px 0 !important;
    padding: 24px 20px !important;
  }

  body.understanding-view-active .understand-nav-list {
    height: calc(100% - 70px) !important;
    max-height: none !important;
  }

  body.understanding-view-active .understand-document {
    width: calc(100% - 380px) !important;
    margin-left: 380px !important;
  }

  body.understanding-view-active .human-built-message {
    width: calc(100% - 380px) !important;
    margin-left: 380px !important;
    margin-right: 0 !important;
    text-align: center !important;
  }
}

@media (max-width: 980px) {
  body.understanding-view-active .human-built-message {
    width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
  }
}



/* LAYOUT V19 — reader/understanding sidebars fill the same vertical space.
   The human-built message is centered only inside the remaining content area.
   QCM is intentionally excluded from these rules. */
@media (min-width: 981px) {
  body.reading-view-active .reader-navigation {
    height: calc(100vh - 124px) !important;
    min-height: calc(100vh - 124px) !important;
    max-height: calc(100vh - 124px) !important;
    box-sizing: border-box !important;
  }

  body.reading-view-active .human-built-message {
    width: calc(100% - 302px) !important;
    margin-left: 302px !important;
    margin-right: 0 !important;
    text-align: center !important;
  }

  body.understanding-view-active .human-built-message {
    width: calc(100% - 380px) !important;
    margin-left: 380px !important;
    margin-right: 0 !important;
    text-align: center !important;
  }

  body.understanding-view-active .understand-navigation {
    height: calc(100vh - 108px) !important;
    min-height: calc(100vh - 108px) !important;
    max-height: calc(100vh - 108px) !important;
  }
}

/* COMPRENDRE V20 — mirror the desktop Lire layout exactly.
   QCM is intentionally not affected. */
@media (min-width: 981px) {
  body.understanding-view-active .understand-navigation {
    position: fixed !important;
    z-index: 900 !important;
    top: 108px !important;
    left: 28px !important;
    width: 264px !important;
    height: calc(100vh - 124px) !important;
    min-height: calc(100vh - 124px) !important;
    max-height: calc(100vh - 124px) !important;
    box-sizing: border-box !important;
    padding: 16px 12px !important;
    border: 1px solid var(--p-line) !important;
    border-radius: 20px !important;
    background: #fff !important;
    overflow: hidden !important;
  }

  body.understanding-view-active .understand-nav-list {
    height: calc(100% - 62px) !important;
    max-height: none !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    padding-right: 4px !important;
    scrollbar-width: thin !important;
    scrollbar-color: #cbd5e1 transparent !important;
  }

  body.understanding-view-active .understand-document {
    width: calc(100% - 302px) !important;
    margin-left: 302px !important;
    min-width: 0 !important;
    min-height: calc(100vh - 173px) !important;
    box-sizing: border-box !important;
  }

  body.understanding-view-active .human-built-message {
    width: calc(100% - 302px) !important;
    margin-left: 302px !important;
    margin-right: 0 !important;
    box-sizing: border-box !important;
    text-align: center !important;
  }
}

@media (max-width: 980px) {
  body.understanding-view-active .understand-navigation {
    position: static !important;
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    border-radius: 20px !important;
  }

  body.understanding-view-active .understand-document,
  body.understanding-view-active .human-built-message {
    width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
  }
}

/* QCM ACCESS / XP — per-work unlock flow */
.qcm-access-card {
  width: min(980px, 100%);
  margin: 0 auto 18px;
  padding: 22px 24px;
  display: grid;
  grid-template-columns: auto minmax(0,1fr) auto;
  align-items: center;
  gap: 18px;
  border: 1px solid #dfe7f1;
  border-radius: 22px;
  background: rgba(255,255,255,.96);
  box-shadow: 0 14px 38px rgba(15,23,42,.045);
}
.qcm-access-card[hidden] { display:none !important; }
.qcm-access-icon {
  width: 46px; height:46px; display:grid; place-items:center;
  border-radius:14px; background:#eef4ff; color:#2563eb;
}
.qcm-access-icon svg { width:22px; height:22px; fill:none; stroke:currentColor; stroke-width:1.8; stroke-linecap:round; stroke-linejoin:round; }
.qcm-access-copy { min-width:0; }
.qcm-access-kicker,.qcm-payment-kicker { display:block; color:#2563eb; font-size:.58rem; font-weight:900; letter-spacing:.15em; }
.qcm-access-copy h2 { margin:5px 0 5px; color:#0f172a; font-size:1rem; }
.qcm-access-copy p { margin:0; color:#64748b; font-size:.78rem; line-height:1.55; }
.qcm-access-meta { display:flex; align-items:center; gap:16px; }
.qcm-access-meta > div { min-width:76px; text-align:right; }
.qcm-access-meta span { display:block; color:#94a3b8; font-size:.6rem; font-weight:700; }
.qcm-access-meta strong { display:block; margin-top:3px; color:#0f172a; font-size:.9rem; }
.qcm-unlock-button { min-height:44px; padding:0 17px; border:0; border-radius:12px; background:#2563eb; color:#fff; font-size:.73rem; font-weight:850; cursor:pointer; box-shadow:0 8px 20px rgba(37,99,235,.18); transition:transform .18s ease, box-shadow .18s ease, opacity .18s ease; }
.qcm-unlock-button:hover { transform:translateY(-1px); box-shadow:0 11px 25px rgba(37,99,235,.23); }
.qcm-unlock-button:disabled { opacity:.48; cursor:not-allowed; transform:none; box-shadow:none; }
.qcm-shell.qcm-is-locked > .qcm-hero,
.qcm-shell.qcm-is-locked > .qcm-toolbar,
.qcm-shell.qcm-is-locked > .qcm-progress-line,
.qcm-shell.qcm-is-locked > .qcm-card,
.qcm-shell.qcm-is-locked > .qcm-actions { display:none !important; }
.qcm-payment-overlay {
  position:fixed; inset:0; z-index:3000; display:grid; place-items:center; padding:24px;
  background:rgba(15,23,42,.38); backdrop-filter:blur(14px); -webkit-backdrop-filter:blur(14px);
  opacity:0; transition:opacity .22s ease;
}
.qcm-payment-overlay[hidden] { display:none !important; }
.qcm-payment-overlay.is-visible { opacity:1; }
.qcm-payment-modal {
  position:relative; width:min(520px,100%); padding:30px;
  border:1px solid rgba(226,232,240,.95); border-radius:24px;
  background:rgba(255,255,255,.98); box-shadow:0 32px 90px rgba(15,23,42,.20), 0 8px 28px rgba(15,23,42,.07);
  transform:translateY(12px) scale(.985); transition:transform .28s cubic-bezier(.2,.8,.2,1);
  font-family:Inter,sans-serif;
}
.qcm-payment-overlay.is-visible .qcm-payment-modal { transform:translateY(0) scale(1); }
.qcm-payment-close {
  position:absolute; top:18px; right:18px; width:36px; height:36px; display:grid; place-items:center;
  border:1px solid #e5eaf1; border-radius:11px; background:#f8fafc; color:#64748b; cursor:pointer;
  transition:background .16s ease,border-color .16s ease,color .16s ease,transform .16s ease;
}
.qcm-payment-close:hover { background:#eef4ff; border-color:#d8e5ff; color:#2563eb; transform:translateY(-1px); }
.qcm-payment-close svg { width:17px; height:17px; fill:none; stroke:currentColor; stroke-width:1.8; stroke-linecap:round; }
.qcm-payment-kicker { color:#2563eb; font-size:.64rem; font-weight:850; letter-spacing:.14em; }
.qcm-payment-heading { padding-right:42px; }
.qcm-payment-modal h2 {
  margin:0 0 8px; color:#0f172a; font-family:Inter,sans-serif; font-size:1.72rem; line-height:1.15;
  font-weight:800; letter-spacing:-.035em;
}
.qcm-payment-modal > .qcm-payment-heading p { margin:0; color:#64748b; font-size:.83rem; line-height:1.65; }
.qcm-payment-work {
  margin-top:24px; padding:16px 17px; border:1px solid #e2e8f0; border-radius:15px;
  background:#fbfcfe;
}
.qcm-payment-work-label { margin-bottom:6px; color:#94a3b8; font-size:.59rem; font-weight:800; letter-spacing:.1em; }
.qcm-payment-work strong { color:#172033; font-size:.92rem; font-weight:800; }
.qcm-payment-balance { margin-top:10px; border:1px solid #e2e8f0; border-radius:15px; overflow:hidden; }
.qcm-payment-balance > div {
  min-height:48px; padding:0 16px; display:flex; align-items:center; justify-content:space-between; gap:16px;
  border-bottom:1px solid #edf1f5;
}
.qcm-payment-balance > div:last-child { border-bottom:0; }
.qcm-payment-balance span { color:#7b8aa0; font-size:.72rem; font-weight:600; }
.qcm-payment-balance strong { color:#172033; font-size:.8rem; font-weight:800; }
.qcm-payment-cost strong { color:#2563eb; }

.qcm-payment-warning {
  display:flex; align-items:flex-start; gap:11px; margin-top:12px; padding:12px 13px;
  border:1px solid #e8edf4; border-radius:13px; background:#fafbfd;
}
.qcm-payment-warning-icon {
  flex:0 0 24px; width:24px; height:24px; display:grid; place-items:center;
  border:1px solid #d7e0eb; border-radius:50%; background:#f1f5f9; color:#64748b;
  font-size:.72rem; font-weight:900; line-height:1;
}
.qcm-payment-warning strong { display:block; color:#334155; font-size:.7rem; font-weight:850; }
.qcm-payment-warning span { display:block; margin-top:2px; color:#64748b; font-size:.68rem; line-height:1.5; }
.qcm-payment-success[hidden] { display:none !important; }

.qcm-payment-actions { display:grid; grid-template-columns:auto 1fr; gap:10px; margin-top:18px; }
.qcm-payment-actions .qcm-secondary,.qcm-payment-actions .qcm-primary { min-height:46px; border-radius:12px; font-family:Inter,sans-serif; font-size:.74rem; font-weight:800; }
.qcm-payment-actions .qcm-primary { box-shadow:0 8px 20px rgba(37,99,235,.16); transition:transform .16s ease,box-shadow .16s ease,opacity .16s ease; }
.qcm-payment-actions .qcm-primary:hover { transform:translateY(-1px); box-shadow:0 11px 26px rgba(37,99,235,.21); }
.qcm-payment-confirm.is-processing { pointer-events:none; opacity:.72; }
.qcm-payment-success {
  display:flex; align-items:center; gap:13px; margin-top:16px; padding:14px;
  border:1px solid #dbe7ff; border-radius:15px; background:#f7faff; animation:qcmSuccessIn .4s ease both;
}
.qcm-success-mark {
  flex:0 0 42px; width:42px; height:42px; display:grid; place-items:center; border-radius:50%;
  background:#2563eb; color:#fff; box-shadow:0 8px 18px rgba(37,99,235,.18); animation:qcmSuccessPop .5s cubic-bezier(.2,.9,.2,1.25) both;
}
.qcm-success-mark svg { width:21px; height:21px; fill:none; stroke:currentColor; stroke-width:2.2; stroke-linecap:round; stroke-linejoin:round; }
.qcm-payment-success strong { display:block; color:#172033; font-size:.82rem; font-weight:800; }
.qcm-payment-success span { display:block; margin-top:3px; color:#64748b; font-size:.7rem; line-height:1.45; }
@keyframes qcmSuccessPop { 0%{transform:scale(.55);opacity:0} 70%{transform:scale(1.08)} 100%{transform:scale(1);opacity:1} }
@keyframes qcmSuccessIn { from{opacity:0;transform:translateY(6px)} to{opacity:1;transform:none} }
.qcm-xp-reward { margin-top:14px; padding:12px 14px; border:1px solid #dbe7ff; border-radius:13px; background:#f7faff; color:#2563eb; font-size:.74rem; font-weight:800; animation:qcmSuccessIn .3s ease both; }

/* Reduce the empty gutter between the fixed sidebar and the main reading/understanding card. */
@media (min-width:981px) {
  .reader-shell { padding-left:294px !important; }
  .reader-document { margin-left:0 !important; }
  body.understanding-view-active .understand-document { width:calc(100% - 294px) !important; margin-left:294px !important; }
  body.reading-view-active .human-built-message { width:calc(100% - 294px) !important; margin-left:294px !important; }
  body.understanding-view-active .human-built-message { width:calc(100% - 294px) !important; margin-left:294px !important; }
}

html.dark .qcm-access-card, html.dark .qcm-payment-modal { background:#111827; border-color:#263449; }
html.dark .qcm-access-copy h2, html.dark .qcm-access-meta strong, html.dark .qcm-payment-modal h2, html.dark .qcm-payment-summary strong, html.dark .qcm-payment-success strong { color:#f8fafc; }
html.dark .qcm-access-copy p, html.dark .qcm-access-meta span, html.dark .qcm-payment-modal > p, html.dark .qcm-payment-summary span, html.dark .qcm-payment-success span { color:#94a3b8; }
html.dark .qcm-payment-summary { border-color:#263449; }
html.dark .qcm-payment-warning { border-color:#263449; background:#151f2f; }
html.dark .qcm-payment-warning-icon { border-color:#334155; background:#1e293b; color:#cbd5e1; }
html.dark .qcm-payment-warning strong { color:#e2e8f0; }
html.dark .qcm-payment-warning span { color:#94a3b8; }
html.dark .qcm-payment-summary div { border-color:#263449; }
html.dark .qcm-payment-close { background:#172033; color:#cbd5e1; }
@media (max-width:760px) {
  .qcm-access-card { grid-template-columns:auto 1fr; }
  .qcm-access-meta { grid-column:1 / -1; justify-content:space-between; }
  .qcm-access-meta > div { text-align:left; }
  .qcm-payment-modal { padding:26px 20px; border-radius:22px; }
  .qcm-payment-actions { flex-direction:column-reverse; }
  .qcm-payment-actions button { width:100%; }
}


/* FINAL REGIONAL LAYOUT — compact, aligned, and consistent across all three works.
   QCM remains functionally unchanged; only the requested presentation is adjusted. */
@media (min-width: 981px) {
  /* Lire + Comprendre: document/sidebar start on the exact same horizontal line. */
  .reader-shell {
    padding-top: 108px !important;
  }

  body.understanding-view-active .reader-shell {
    padding-top: 108px !important;
  }

  /* Reduce the large empty area above the QCM hero. */
  .qcm-shell {
    padding-top: 28px !important;
  }
}

/* The QCM card no longer shows Lire / difficulty / topic badges. */
.qcm-card-top {
  min-height: 0 !important;
  margin-bottom: 22px !important;
  padding-bottom: 14px !important;
}

/* LDJC — make the actantial labels true pills so long labels never overlap. */
.schema-list>div {
  grid-template-columns: max-content minmax(145px, 185px) minmax(0, 1fr) !important;
  align-items: start !important;
  gap: 14px !important;
}
.schema-list>div>b {
  width: auto !important;
  min-width: 30px;
  height: 30px;
  padding: 0 8px;
  box-sizing: border-box;
  white-space: nowrap;
  overflow: visible;
}
.schema-list>div>span {
  min-width: 0;
  overflow-wrap: anywhere;
}

@media (max-width: 760px) {
  .schema-list>div {
    grid-template-columns: max-content minmax(0, 1fr) !important;
  }
  .schema-list>div>p {
    grid-column: 2 !important;
  }
}


/* ============================================================
   BACTRUTH DARK MODE — FINAL SURFACE LAYER
   Keeps the existing layout/identity intact; only adapts surfaces,
   typography, controls, borders and reading content to the persisted
   BacTruth dark theme.
   ============================================================ */

html {
  color-scheme: light;
  transition: background-color .22s ease, color .22s ease;
}
html.dark {
  color-scheme: dark;
}
body,
.programme-topbar,
.regional-sections,
.regional-section,
.oeuvre-picker-trigger,
.oeuvre-menu,
.oeuvre-option,
.programme-back,
.reader-navigation,
.reader-document,
.reader-document-rule,
.chapter,
.reader-next,
.reader-next button,
.understand-navigation,
.understand-document,
.understand-content-head,
.understand-nav-item,
.fact-card,
.single-fact,
.fact-line,
.split-info > div,
.tone-grid > div,
.character-grid article,
.schema-list > div,
.tag-list span,
.qcm-hero,
.qcm-stat,
.qcm-toolbar,
.qcm-coverage-item,
.qcm-card,
.qcm-option,
.qcm-correction,
.qcm-secondary,
.qcm-progress-line > div,
.qcm-access-card,
.qcm-payment-modal,
.qcm-payment-close,
.qcm-payment-work,
.qcm-payment-balance,
.qcm-payment-warning,
.qcm-payment-success,
.human-built-message {
  transition:
    background-color .24s ease,
    color .24s ease,
    border-color .24s ease,
    box-shadow .24s ease;
}

html.dark body {
  background: #0b0f16;
  color: #e5e7eb;
}

/* Top navigation */
html.dark .programme-topbar {
  border-color: rgba(51,65,85,.9);
  background: rgba(15,23,42,.9);
  box-shadow: 0 12px 35px rgba(0,0,0,.32);
}
html.dark .programme-brand-copy strong { color: #f8fafc; }
html.dark .programme-brand-copy small { color: #94a3b8; }

html.dark .regional-sections {
  border-color: #263449;
  background: #172033;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.035);
}
html.dark .regional-section { color: #94a3b8; }
html.dark .regional-section:hover:not(.active) {
  color: #e2e8f0;
  background: rgba(255,255,255,.05);
}
html.dark .regional-section.active {
  color: #60a5fa;
  background: #111827;
  box-shadow: 0 3px 12px rgba(0,0,0,.2);
}

html.dark .oeuvre-picker-trigger {
  border-color: #263449;
  background: #111827;
  color: #e2e8f0;
}
html.dark .oeuvre-picker-trigger:hover,
html.dark .oeuvre-picker.open .oeuvre-picker-trigger {
  border-color: #3b4b63;
  background: #172033;
  box-shadow: 0 8px 24px rgba(0,0,0,.2);
}
html.dark .oeuvre-picker-trigger svg { stroke: #94a3b8; }
html.dark .oeuvre-menu {
  border-color: #263449;
  background: rgba(17,24,39,.98);
  box-shadow: 0 18px 40px rgba(0,0,0,.42);
}
html.dark .oeuvre-option { color: #cbd5e1; }
html.dark .oeuvre-option:hover { background: #172033; }
html.dark .oeuvre-option.active {
  color: #60a5fa;
  background: #172554;
}
html.dark .programme-back {
  background: #172554;
  color: #60a5fa;
}
html.dark .programme-back:hover { background: #1e3a8a; }

/* Reading */
html.dark .reader-navigation,
html.dark .reader-document {
  border-color: #263449;
  background: #111827;
  box-shadow: 0 16px 42px rgba(0,0,0,.16);
}
html.dark .reader-nav-heading strong { color: #f8fafc; }
html.dark .reader-progress { background: #1e293b; }
html.dark .reader-progress-label { color: #64748b; }
html.dark .chapter { color: #94a3b8; }
html.dark .chapter span { color: #64748b; }
html.dark .chapter:hover {
  background: #172033;
  color: #e2e8f0;
}
html.dark .chapter.active {
  color: #60a5fa;
  background: #172554;
}
html.dark .chapter.active span { color: #60a5fa; }

html.dark .reader-document-topline { color: #64748b; }
html.dark .reader-document-rule { background: #263449; }
html.dark .chapter-heading h1 { color: #f8fafc; }
html.dark .novel-content { color: #d7dee8; }
html.dark .reader-next { border-color: #263449; }
html.dark .reader-next button {
  border-color: #334155;
  background: #172033;
  color: #cbd5e1;
}
html.dark .reader-next button:hover:not(:disabled) {
  border-color: #405777;
  background: #172554;
  color: #60a5fa;
}
html.dark .copyright-notice {
  border-color: #263449;
  background: #0f172a;
}
html.dark .copyright-notice strong { color: #e2e8f0; }
html.dark .copyright-notice p { color: #94a3b8; }
html.dark .regional-empty-panel {
  border-color: #263449;
  background: #111827;
  box-shadow: none;
}
html.dark .regional-empty-panel h2 { color: #f8fafc; }
html.dark .regional-empty-panel p:last-child { color: #94a3b8; }
html.dark .reader-unavailable {
  border-color: #263449;
  background: #0f172a;
}
html.dark .reader-unavailable strong { color: #e2e8f0; }
html.dark .reader-unavailable span { color: #94a3b8; }

/* Scrollbars */
html.dark .understand-nav-list,
html.dark .understand-content,
html.dark .reader-navigation .chapter-list {
  scrollbar-color: #475569 transparent;
}
html.dark .understand-nav-list::-webkit-scrollbar-thumb,
html.dark .understand-content::-webkit-scrollbar-thumb,
html.dark .reader-navigation .chapter-list::-webkit-scrollbar-thumb {
  background: #475569;
}

/* Comprendre — includes later !important white-background declarations */
html.dark .understand-navigation,
html.dark .understand-document {
  border-color: #263449 !important;
  background: #111827 !important;
  box-shadow: 0 16px 42px rgba(0,0,0,.16) !important;
}
html.dark .understand-nav-heading strong,
html.dark .understand-content-head h1 {
  color: #f8fafc;
}
html.dark .understand-nav-item { color: #94a3b8; }
html.dark .understand-nav-item:hover {
  background: #172033;
  color: #e2e8f0;
}
html.dark .understand-nav-item.active {
  color: #60a5fa;
  background: #172554;
}
html.dark .understand-content-body { color: #cbd5e1; }
html.dark .understand-content-body h3 { color: #f8fafc; }
html.dark .understand-content-head,
html.dark .understand-source {
  border-color: #263449;
}
html.dark .fact-card,
html.dark .single-fact,
html.dark .fact-line,
html.dark .split-info > div,
html.dark .tone-grid > div,
html.dark .character-grid article,
html.dark .schema-list > div {
  border-color: #263449;
  background: #0f172a;
}
html.dark .fact-card strong,
html.dark .single-fact strong,
html.dark .fact-line strong,
html.dark .character-grid article h3,
html.dark .schema-list > div > span,
html.dark .tone-grid > div b {
  color: #f8fafc;
}
html.dark .understand-note,
html.dark .understand-highlight {
  border-color: #263449;
  background: #0f172a;
}
html.dark .understand-note p,
html.dark .understand-highlight p { color: #94a3b8; }
html.dark .tag-list span {
  border-color: #263449;
  background: #0f172a;
  color: #cbd5e1;
}
html.dark .schema-list > div > b {
  background: #172554;
  color: #60a5fa;
}
html.dark .understand-content-head h1 { color: #f8fafc; }

/* QCM */
html.dark .qcm-access-status {
  border-color: #263b5d;
  background: rgba(15,23,42,.96);
  color: #60a5fa;
  box-shadow: 0 8px 24px rgba(0,0,0,.2);
}
html.dark .qcm-access-status-copy strong { color: #93c5fd; }
html.dark .qcm-access-status-copy small { color: #94a3b8; }

html.dark .qcm-hero {
  border-color: #263449;
  background: linear-gradient(180deg, #111827 0%, #0f172a 100%);
  box-shadow: 0 18px 50px rgba(0,0,0,.18);
}
html.dark .qcm-hero h1,
html.dark .qcm-question { color: #f8fafc; }
html.dark .qcm-hero > p { color: #94a3b8; }
html.dark .qcm-stat {
  border-color: #263449;
  background: #0f172a;
}
html.dark .qcm-stat b { color: #f8fafc; }
html.dark .qcm-stat span { color: #94a3b8; }

html.dark .qcm-filter-group {
  background: #172033;
}
html.dark .qcm-filter,
html.dark .qcm-source-filter {
  color: #94a3b8;
}
html.dark .qcm-filter.active,
html.dark .qcm-source-filter.active {
  background: #111827;
  color: #60a5fa;
  box-shadow: 0 2px 8px rgba(0,0,0,.22);
}
html.dark .qcm-secondary {
  border-color: #334155;
  background: #172033;
  color: #cbd5e1;
}
html.dark .qcm-secondary:hover {
  border-color: #405777;
  background: #1e293b;
  color: #f8fafc;
}
html.dark .qcm-progress-line { color: #94a3b8; }
html.dark .qcm-progress-line > div { background: #1e293b; }

html.dark .qcm-toolbar {
  border-color: #263449;
  background: #0f172a;
}
html.dark .qcm-coverage-item {
  border-color: #263449;
  background: #111827;
  box-shadow: 0 5px 18px rgba(0,0,0,.12);
}
html.dark .qcm-coverage-item b { color: #e2e8f0; }
html.dark .qcm-coverage-item small { color: #94a3b8; }

html.dark .qcm-card {
  border-color: #263449;
  background: #111827;
  box-shadow: 0 18px 48px rgba(0,0,0,.18);
}
html.dark .qcm-card-top { border-color: #263449; }
html.dark .qcm-badge { background: #172554; color: #60a5fa; }
html.dark .qcm-badge.level-medium { background: #1e293b; color: #cbd5e1; }
html.dark .qcm-badge.level-hard { background: #3f1722; color: #fda4af; }
html.dark .qcm-number { color: #64748b; }
html.dark .qcm-option {
  border-color: #334155;
  background: #0f172a;
  color: #cbd5e1;
}
html.dark .qcm-option:hover {
  border-color: #4b6fa8;
  background: #172033;
}
html.dark .qcm-option.correct {
  border-color: #166534;
  background: #10271a;
  color: #86efac;
}
html.dark .qcm-option.wrong {
  border-color: #9f1239;
  background: #2a1019;
  color: #fda4af;
}
html.dark .qcm-correction {
  border-color: #1d4ed8;
  background: #0f1d33;
}
html.dark .qcm-correction strong { color: #60a5fa; }
html.dark .qcm-correction p { color: #cbd5e1; }

/* XP access / payment */
html.dark .qcm-access-card {
  background: #111827;
  border-color: #263449;
  box-shadow: 0 14px 38px rgba(0,0,0,.18);
}
html.dark .qcm-access-copy h2,
html.dark .qcm-access-meta strong,
html.dark .qcm-payment-modal h2,
html.dark .qcm-payment-work strong,
html.dark .qcm-payment-balance strong,
html.dark .qcm-payment-success strong {
  color: #f8fafc;
}
html.dark .qcm-access-copy p,
html.dark .qcm-access-meta span,
html.dark .qcm-payment-modal > .qcm-payment-heading p,
html.dark .qcm-payment-balance span,
html.dark .qcm-payment-success span {
  color: #94a3b8;
}
html.dark .qcm-access-icon {
  background: #172554;
  color: #60a5fa;
}
html.dark .qcm-payment-overlay {
  background: rgba(2,6,23,.64);
}
html.dark .qcm-payment-modal {
  border-color: #263449;
  background: rgba(17,24,39,.98);
  box-shadow: 0 32px 90px rgba(0,0,0,.48), 0 8px 28px rgba(0,0,0,.25);
}
html.dark .qcm-payment-close {
  border-color: #334155;
  background: #172033;
  color: #cbd5e1;
}
html.dark .qcm-payment-close:hover {
  background: #172554;
  border-color: #405777;
  color: #60a5fa;
}
html.dark .qcm-payment-work {
  border-color: #263449;
  background: #0f172a;
}
html.dark .qcm-payment-work-label { color: #64748b; }
html.dark .qcm-payment-balance { border-color: #263449; }
html.dark .qcm-payment-balance > div { border-color: #263449; }
html.dark .qcm-payment-cost strong { color: #60a5fa; }
html.dark .qcm-payment-warning {
  border-color: #263449;
  background: #151f2f;
}
html.dark .qcm-payment-warning-icon {
  border-color: #334155;
  background: #1e293b;
  color: #cbd5e1;
}
html.dark .qcm-payment-warning strong { color: #e2e8f0; }
html.dark .qcm-payment-warning span { color: #94a3b8; }
html.dark .qcm-payment-success {
  border-color: #1e3a5f;
  background: #0f1d33;
}
html.dark .qcm-xp-reward {
  border-color: #1e3a5f;
  background: #0f1d33;
  color: #60a5fa;
}

/* Footer */
html.dark .human-built-message { color: #64748b; }

/* Avoid a flash of white while the persisted theme is applied. */
@media (prefers-reduced-motion: reduce) {
  html,
  body,
  body * {
    transition-duration: .01ms !important;
  }
}

/* ============================================================
   DARK MODE — FINAL OVERRIDES
   Fix legacy !important light-card rules and use the light/dark
   BacTruth mark correctly on the dark header.
   ============================================================ */
html.dark .reader-navigation,
html.dark .understand-navigation {
  background: #111827 !important;
  border-color: #263449 !important;
  box-shadow: 0 16px 42px rgba(0,0,0,.16) !important;
}

html.dark .reader-nav-heading strong,
html.dark .understand-nav-heading strong {
  color: #f8fafc !important;
}

html.dark .reader-nav-heading span,
html.dark .understand-nav-heading span {
  color: #60a5fa !important;
}

html.dark .reader-progress {
  background: #1e293b !important;
}

html.dark .reader-progress-label {
  color: #94a3b8 !important;
}

html.dark .chapter {
  color: #94a3b8 !important;
}

html.dark .chapter span {
  color: #64748b !important;
}

html.dark .chapter:hover {
  background: #172033 !important;
  color: #e2e8f0 !important;
}

html.dark .chapter.active {
  background: #1b2d63 !important;
  color: #60a5fa !important;
}

html.dark .chapter.active span {
  color: #60a5fa !important;
}

/* BacTruth logo: the supplied mark is dark on light surfaces;
   invert it only when the page is in dark mode. */
html.dark .programme-brand-mark img {
  filter: brightness(0) invert(1) !important;
}

/* QCM help — beside Question aléatoire on the right. */
.qcm-toolbar-actions {
  display: flex;
  align-items: stretch;
  gap: 8px;
  flex: 0 0 auto;
}
.qcm-help-inline {
  width: 48px;
  height: 48px;
  min-height: 48px;
  flex: 0 0 48px;
  align-self: stretch;
  border-radius: 14px;
  box-shadow: 0 5px 18px rgba(15,23,42,.035);
  order: 0;
}
.qcm-toolbar-actions .qcm-random {
  height: 48px;
  min-height: 48px;
}@media (max-width: 760px) {
  .qcm-toolbar-actions {
    width: 100%;
  }
  .qcm-toolbar-actions .qcm-random {
    flex: 1;
  }
  .qcm-help-inline {
    width: 48px;
    height: 48px;
    min-height: 48px;
    flex-basis: 48px;
    border-radius: 12px;
  }}

/* ============================================================
   PAGE LOADING — ŒUVRES
   Same soft skeleton language used across BacTruth, adapted to
   the actual Œuvres structure (topbar, reader navigation, text).
   ============================================================ */
.oeuvre-page-loader {
  position: fixed;
  inset: 0;
  z-index: 5000;
  overflow: hidden;
  padding: 18px 24px 32px;
  background: #f7f9fc;
  opacity: 1;
  visibility: visible;
  transition: opacity .24s ease, visibility .24s ease;
}
.oeuvre-page-loader.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
body.oeuvre-is-loading { overflow: hidden; }

.oeuvre-skeleton {
  display: block;
  position: relative;
  overflow: hidden;
  background: #e8edf5;
  border-radius: 12px;
}
.oeuvre-skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,.48) 48%, transparent 100%);
  animation: oeuvreSkeletonShimmer 1.45s ease-in-out infinite;
}
@keyframes oeuvreSkeletonShimmer {
  100% { transform: translateX(100%); }
}

.oeuvre-loader-topbar {
  width: min(1500px, calc(100% - 40px));
  height: 70px;
  margin: 0 auto;
  padding: 0 18px 0 20px;
  display: flex;
  align-items: center;
  gap: 18px;
  border: 1px solid #e3e9f1;
  border-radius: 23px;
  background: rgba(255,255,255,.72);
}
.oeuvre-loader-brand { width: 130px; height: 38px; border-radius: 12px; }
.oeuvre-loader-sections {
  flex: 1;
  display: flex;
  justify-content: center;
  gap: 8px;
}
.oeuvre-loader-section { width: 100px; height: 42px; border-radius: 13px; }
.oeuvre-loader-actions { display: flex; align-items: center; gap: 8px; }
.oeuvre-loader-picker { width: 190px; height: 42px; border-radius: 13px; }
.oeuvre-loader-back { width: 72px; height: 42px; border-radius: 13px; }

.oeuvre-loader-main {
  width: min(1500px, calc(100% - 40px));
  min-height: calc(100vh - 120px);
  margin: 22px auto 0;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 22px;
}
.oeuvre-loader-sidebar {
  min-height: 640px;
  padding: 24px 20px;
  border: 1px solid #e3e9f1;
  border-radius: 22px;
  background: #fff;
}
.oeuvre-loader-kicker { width: 66px; height: 10px; margin-bottom: 12px; border-radius: 5px; }
.oeuvre-loader-title { width: 190px; height: 18px; margin-bottom: 25px; border-radius: 7px; }
.oeuvre-loader-progress { width: 100%; height: 7px; margin-bottom: 10px; border-radius: 99px; }
.oeuvre-loader-progress-label { width: 54px; height: 10px; margin-bottom: 28px; border-radius: 5px; }
.oeuvre-loader-chapter { width: 100%; height: 42px; margin-bottom: 10px; border-radius: 10px; }
.oeuvre-loader-chapter.short { width: 74%; }

.oeuvre-loader-document {
  min-height: 640px;
  padding: 54px 64px;
  border: 1px solid #e3e9f1;
  border-radius: 26px;
  background: #fff;
}
.oeuvre-loader-document-meta { width: 210px; height: 11px; margin-bottom: 20px; border-radius: 5px; }
.oeuvre-loader-rule { width: 100%; height: 1px; margin-bottom: 42px; border-radius: 0; }
.oeuvre-loader-heading { width: 130px; height: 11px; margin-bottom: 14px; border-radius: 5px; }
.oeuvre-loader-heading-line { width: 48%; height: 34px; margin-bottom: 44px; border-radius: 9px; }
.oeuvre-loader-text, .oeuvre-loader-paragraph { display: grid; gap: 13px; margin-bottom: 34px; }
.oeuvre-loader-text .oeuvre-skeleton { width: 100%; height: 15px; border-radius: 7px; }
.oeuvre-loader-text .oeuvre-skeleton.medium { width: 82%; }
.oeuvre-loader-text .oeuvre-skeleton.short { width: 58%; }
.oeuvre-loader-paragraph .oeuvre-skeleton { width: 100%; height: 15px; border-radius: 7px; }
.oeuvre-loader-paragraph .oeuvre-skeleton.medium { width: 88%; }

html.dark .oeuvre-page-loader { background: #0f172a; }
html.dark .oeuvre-loader-topbar,
html.dark .oeuvre-loader-sidebar,
html.dark .oeuvre-loader-document { border-color: #263449; background: #111827; }
html.dark .oeuvre-skeleton { background: #1e293b; }
html.dark .oeuvre-skeleton::after { background: linear-gradient(90deg, transparent 0%, rgba(148,163,184,.08) 48%, transparent 100%); }

@media (max-width: 900px) {
  .oeuvre-page-loader { padding: 12px; }
  .oeuvre-loader-topbar { width: 100%; }
  .oeuvre-loader-sections { justify-content: flex-start; }
  .oeuvre-loader-section:nth-child(3) { display: none; }
  .oeuvre-loader-picker { width: 130px; }
  .oeuvre-loader-main { width: 100%; grid-template-columns: 1fr; }
  .oeuvre-loader-sidebar { display: none; }
  .oeuvre-loader-document { min-height: 600px; padding: 38px 28px; }
}
@media (prefers-reduced-motion: reduce) {
  .oeuvre-skeleton::after { animation: none; }
  .oeuvre-page-loader { transition: none; }
}


/* =========================================================
   BAC TRUTH — UNIVERSAL PAGE SCROLLBAR
   Matches the Quran page exactly.
   ========================================================= */
html,
body {
  scrollbar-width: thin;
  scrollbar-color: #b8bec8 transparent;
}

html::-webkit-scrollbar,
body::-webkit-scrollbar {
  width: 5px;
}

html::-webkit-scrollbar-track,
body::-webkit-scrollbar-track {
  background: transparent;
}

html::-webkit-scrollbar-thumb,
body::-webkit-scrollbar-thumb {
  background: #b8bec8;
  border-radius: 999px;
}

html::-webkit-scrollbar-thumb:hover,
body::-webkit-scrollbar-thumb:hover {
  background: #aab1bc;
}
