/* ==========================================================================
   BIA LEARN — DESIGN SYSTEM v2
   BioSimulAtions Lab (bialab.pt) • Prof. Sérgio F. Sousa • Universidade de Coimbra
   Clean academic layout · high legibility · consistent components
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. TOKENS
   -------------------------------------------------------------------------- */
:root {
  /* Surfaces */
  --bg: #f6f8fb;
  --bg-color: #f6f8fb;
  --surface: #ffffff;
  --surface-alt: #f1f5f9;
  --surface-sunken: #f8fafc;

  /* Text */
  --text-primary: #0f172a;
  --text-body: #1e293b;
  --text-secondary: #475569;
  --text-muted: #64748b;

  /* Brand (BIA Lab) */
  --accent-teal: #0369a1;
  --accent-blue: #0284c7;
  --accent-purple: #6d28d9;
  --accent-cyan: #0891b2;
  --accent-orange: #ea580c;
  --gradient-primary: linear-gradient(135deg, #0284c7 0%, #6d28d9 100%);
  --gradient-soft: linear-gradient(135deg, rgba(2,132,199,.06) 0%, rgba(109,40,217,.06) 100%);

  --teal-soft: #f0f9ff;
  --teal-border: #bae6fd;
  --purple-soft: #f5f3ff;
  --purple-border: #ddd6fe;

  /* Semantic */
  --red-main: #dc2626;
  --red-dark: #991b1b;
  --red-soft: #fef2f2;
  --red-border: #fecaca;
  --green-main: #15803d;
  --green-soft: #f0fdf4;
  --green-border: #bbf7d0;
  --amber-main: #b45309;
  --amber-soft: #fffbeb;
  --amber-border: #fde68a;

  /* Equations */
  --eq-bg: #f8fafc;
  --eq-border: #e2e8f0;

  /* Lines, shadows, radii */
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --shadow-xs: 0 1px 2px rgba(15,23,42,.05);
  --shadow-sm: 0 1px 3px rgba(15,23,42,.06), 0 1px 2px rgba(15,23,42,.04);
  --shadow-md: 0 6px 18px -4px rgba(15,23,42,.10), 0 2px 6px -2px rgba(15,23,42,.06);
  --shadow-lg: 0 18px 40px -12px rgba(15,23,42,.18);
  --radius-xs: 6px;
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 18px;

  /* Layout */
  --max-width: 1440px;
  --read-width: 1320px;
  --nav-h: 64px;
  --transition: all .2s ease;

  --font-sans: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-head: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-serif: 'Source Serif 4', 'Source Serif Pro', Charter, 'Iowan Old Style', Georgia, serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

  /* Aliases & Extended Semantic Tokens (ensuring 100% compatibility across all modules) */
  --text: var(--text-primary);
  --bg-secondary: var(--surface-alt);
  --bg-card: var(--surface);
  --bg-subtle: var(--surface-sunken);
  --card-bg: var(--surface);
  --border-color: var(--border);
  --border-subtle: var(--border);
  --radius: var(--radius-md);
  --shadow: var(--shadow-md);
  --accent-primary: var(--accent-blue);
  --accent-sky: #0284c7;
  --accent-violet: #7c3aed;
  --accent-emerald: #059669;
  --accent-blue-soft: #f0f9ff;
  --accent-teal-soft: #f0fdfa;
  --accent-purple-soft: #f5f3ff;
  --accent-gold: #d97706;
  --accent-gold-soft: #fffbeb;
  --accent-green: #15803d;
  --accent-green-soft: #f0fdf4;
  --accent-red: #dc2626;
  --accent-red-soft: #fef2f2;
}

html[data-theme="dark"] {
  --bg: #0b1120;
  --bg-color: #0b1120;
  --surface: #111a2e;
  --surface-alt: #18233b;
  --surface-sunken: #0e1628;

  --text-primary: #f1f5f9;
  --text-body: #e2e8f0;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;

  --accent-teal: #38bdf8;
  --accent-blue: #38bdf8;
  --accent-purple: #a78bfa;
  --accent-cyan: #22d3ee;
  --accent-orange: #fb923c;

  --teal-soft: rgba(56,189,248,.12);
  --teal-border: rgba(56,189,248,.32);
  --purple-soft: rgba(167,139,250,.12);
  --purple-border: rgba(167,139,250,.32);

  --red-main: #f87171;
  --red-dark: #fca5a5;
  --red-soft: rgba(248,113,113,.12);
  --red-border: rgba(248,113,113,.38);
  --green-main: #4ade80;
  --green-soft: rgba(74,222,128,.11);
  --green-border: rgba(74,222,128,.34);
  --amber-main: #fbbf24;
  --amber-soft: rgba(251,191,36,.11);
  --amber-border: rgba(251,191,36,.34);

  --eq-bg: #0e1628;
  --eq-border: #24314d;

  --border: #23304b;
  --border-strong: #334155;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.4);
  --shadow-md: 0 8px 22px -6px rgba(0,0,0,.5);
  --shadow-lg: 0 20px 44px -12px rgba(0,0,0,.6);

  /* Dark Mode Aliases & Extended Semantic Tokens */
  --text: var(--text-primary);
  --bg-secondary: var(--surface-alt);
  --bg-card: var(--surface);
  --bg-subtle: var(--surface-sunken);
  --card-bg: var(--surface);
  --border-color: var(--border);
  --border-subtle: var(--border);
  --accent-primary: var(--accent-blue);
  --accent-sky: #38bdf8;
  --accent-violet: #a78bfa;
  --accent-emerald: #34d399;
  --accent-blue-soft: rgba(56,189,248,.12);
  --accent-teal-soft: rgba(45,212,191,.12);
  --accent-purple-soft: rgba(167,139,250,.12);
  --accent-gold: #fbbf24;
  --accent-gold-soft: rgba(251,191,36,.12);
  --accent-green: #4ade80;
  --accent-green-soft: rgba(74,222,128,.12);
  --accent-red: #f87171;
  --accent-red-soft: rgba(248,113,113,.12);
}

/* --------------------------------------------------------------------------
   2. BASE
   -------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-h) + 64px);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 18px;
  line-height: 1.68;
  font-optical-sizing: auto;
  font-kerning: normal;
  font-variant-ligatures: common-ligatures;
  color: var(--text-body);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 {
  font-family: var(--font-head);
  color: var(--text-primary);
  letter-spacing: -0.02em;
  line-height: 1.28;
  text-wrap: balance;
}

p { margin: 0 0 .85rem; }
p:last-child { margin-bottom: 0; }

a { color: var(--accent-teal); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

strong { color: var(--text-primary); font-weight: 700; }
em { font-style: italic; }

img { max-width: 100%; }

::selection { background: rgba(2,132,199,.18); }

/* Language switching */
html[data-lang="pt"] .lang-en,
html:not([data-lang]) body:not(.lang-en-active) .lang-en,
body.lang-pt-active .lang-en { display: none !important; }
html[data-lang="en"] .lang-pt,
body.lang-en-active .lang-pt { display: none !important; }

/* Brand accents */
.bia-highlight { color: var(--accent-orange); font-weight: 800; }
.gradient-text {
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.gradient-text .katex { -webkit-text-fill-color: var(--accent-purple); }

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
}

main.container { padding-top: 2.25rem; padding-bottom: 3rem; }

/* --------------------------------------------------------------------------
   3. NAVBAR
   -------------------------------------------------------------------------- */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--nav-h);
  background: rgba(255,255,255,.86);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--border);
}
html[data-theme="dark"] .navbar { background: rgba(11,17,32,.85); }

.nav-container {
  max-width: var(--max-width);
  height: 100%;
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.nav-brand-group { display: flex; align-items: center; gap: .75rem; flex-shrink: 0; }

.brand {
  display: flex;
  align-items: center;
  gap: .6rem;
  color: var(--text-primary);
  text-decoration: none !important;
}
.brand-logo {
  width: 38px;
  height: 38px;
  border-radius: 999px;
  background: var(--teal-soft);
  border: 1px solid var(--teal-border);
  font-size: 1.2rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-title {
  font-family: var(--font-head);
  font-weight: 800;
  font-size: 1.05rem;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}
.brand-sub { font-size: .72rem; font-weight: 600; color: var(--text-muted); letter-spacing: .01em; }

.bialab-pill {
  font-size: .8rem;
  font-weight: 700;
  color: var(--accent-teal);
  background: var(--teal-soft);
  border: 1px solid var(--teal-border);
  padding: .2rem .6rem;
  border-radius: 999px;
  white-space: nowrap;
}
.bialab-pill:hover { text-decoration: none; background: var(--accent-blue); color: #fff; border-color: transparent; }

.nav-links {
  display: flex;
  align-items: center;
  gap: .1rem;
  margin-left: auto;
  overflow-x: auto;
  scrollbar-width: none;
}
.nav-links::-webkit-scrollbar { display: none; }
.nav-links a {
  font-size: .86rem;
  font-weight: 600;
  color: var(--text-secondary);
  padding: .42rem .7rem;
  border-radius: 8px;
  white-space: nowrap;
  transition: var(--transition);
}
.nav-links a:hover { background: var(--surface-alt); color: var(--text-primary); text-decoration: none; }
.nav-links a.active { color: var(--accent-teal); background: var(--teal-soft); }

.nav-controls { display: flex; align-items: center; gap: .5rem; flex-shrink: 0; }

.lang-Flag-switch {
  display: inline-flex;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px;
}
.lang-btn {
  border: 0;
  background: transparent;
  color: var(--text-secondary);
  font: 700 .74rem var(--font-sans);
  padding: .3rem .62rem;
  border-radius: 999px;
  cursor: pointer;
  transition: var(--transition);
}
.lang-btn:hover { color: var(--text-primary); }
.lang-btn.active { background: var(--surface); color: var(--accent-teal); box-shadow: var(--shadow-xs); }

.theme-toggle {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-primary);
  cursor: pointer;
  font-size: .95rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}
.theme-toggle:hover { border-color: var(--accent-blue); }

@media (max-width: 1440px) {
  .brand-sub { display: none; }
  .nav-links a { padding: .4rem .55rem; font-size: .84rem; }
}
@media (max-width: 1100px) {
  .nav-links a { padding: .38rem .45rem; font-size: .8rem; }
  .bialab-pill { display: none; }
}
@media (max-width: 860px) {
  .navbar { height: auto; }
  .nav-container { flex-wrap: wrap; padding-top: .6rem; padding-bottom: .4rem; gap: .5rem; }
  .nav-controls { margin-left: auto; }
  .nav-links { order: 3; width: 100%; margin-left: 0; padding-bottom: .2rem; }
}

/* --------------------------------------------------------------------------
   4. HERO VARIANTS
   -------------------------------------------------------------------------- */
/* 4a. Centered page hero (chapters 1–3, equations, scientists) */
.hero {
  position: relative;
  background:
    radial-gradient(900px 320px at 85% -10%, rgba(2,132,199,.10), transparent 60%),
    radial-gradient(700px 300px at 0% 110%, rgba(109,40,217,.08), transparent 60%),
    var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 3rem 1.5rem 2.6rem;
  text-align: center;
}
.hero-content { max-width: 1180px; margin: 0 auto; }
.hero .hero-content { display: flex; flex-direction: column; align-items: center; }
.hero h1 {
  font-size: clamp(2rem, 3.6vw, 2.9rem);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.025em;
  margin: .2rem 0 .9rem;
}
.hero .subtitle {
  max-width: 1020px;
  font-size: 1.06rem;
  line-height: 1.7;
  color: var(--text-secondary);
  margin: 0 0 1.6rem;
}
.hero .subtitle strong { color: var(--text-body); }
.hero-actions { display: flex; flex-wrap: wrap; gap: .65rem; justify-content: center; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--accent-teal);
  background: var(--teal-soft);
  border: 1px solid var(--teal-border);
  padding: .28rem .75rem;
  border-radius: 999px;
  margin-bottom: .75rem;
}

.chapter-nav-pill {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: .25rem .5rem;
  font-size: .82rem;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: .38rem 1rem;
  margin-bottom: 1.15rem;
  box-shadow: var(--shadow-xs);
}
.chapter-nav-pill a { color: var(--accent-teal); font-weight: 600; }
.chapter-nav-pill .current { color: var(--text-primary); font-weight: 700; }
.chapter-nav-pill .sep { color: var(--border-strong); }

/* 4b. Split hero (index, courses, tsb, chapter 0) */
.hero-split {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  gap: 2.5rem;
  align-items: center;
  padding: 2.25rem 0 2.75rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}
.hero-split .hero-content { max-width: none; margin: 0; }
.hero-split h1 {
  font-size: clamp(2rem, 3.8vw, 3.1rem);
  font-weight: 800;
  line-height: 1.12;
  letter-spacing: -0.03em;
  margin: .4rem 0 1rem;
}
.hero-split h1 > span[style] { display: block; margin-top: .55rem; line-height: 1.3; letter-spacing: -0.015em; }
.hero-lead {
  font-size: 1.07rem;
  line-height: 1.72;
  color: var(--text-secondary);
  max-width: 680px;
  margin: 0 0 1.6rem;
}
.hero-split .hero-actions { justify-content: flex-start; }

.hero-badge-row { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-bottom: .4rem; }
.hero-badge, .author-chip {
  display: inline-block;
  font-size: .78rem;
  font-weight: 700;
  padding: .3rem .8rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  box-shadow: var(--shadow-xs);
}
.author-chip { color: var(--accent-teal); }
.author-chip:hover { text-decoration: none; border-color: var(--accent-blue); }

.hero-visual-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
}
.hero-visual-card::before {
  content: '';
  position: absolute;
  inset: 0 0 auto 0;
  height: 4px;
  background: var(--gradient-primary);
}
.hero-visual-card p { color: var(--text-secondary); }

.hero-stat-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .75rem;
  margin: 1rem 0 .25rem;
}
.hero-stat {
  background: var(--surface-sunken);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .9rem 1rem;
  display: flex;
  flex-direction: column;
  gap: .1rem;
}
.stat-num {
  font-family: var(--font-head);
  font-size: 1.7rem;
  font-weight: 800;
  line-height: 1.1;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.stat-lbl { font-size: .78rem; font-weight: 600; color: var(--text-muted); line-height: 1.35; }

@media (max-width: 960px) {
  .hero-split { grid-template-columns: 1fr; gap: 1.75rem; }
}

/* Breadcrumb (chapter 0) */
.breadcrumb-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .4rem;
  font-size: .82rem;
  font-weight: 600;
  color: var(--text-muted);
}
.breadcrumb-bar a { color: var(--accent-teal); }
.breadcrumb-bar .sep { color: var(--border-strong); }
.breadcrumb-bar .current { color: var(--text-secondary); }

/* --------------------------------------------------------------------------
   5. BUTTONS
   -------------------------------------------------------------------------- */
.btn, .btn-primary, .btn-secondary, .btn-outline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .45rem;
  padding: .7rem 1.25rem;
  border-radius: 10px;
  font: 600 .9rem/1.2 var(--font-sans);
  border: 1px solid transparent;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none !important;
  white-space: normal;
  text-align: center;
}
.btn-primary {
  background: var(--gradient-primary);
  color: #fff !important;
  box-shadow: 0 6px 16px -4px rgba(2,132,199,.45);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 10px 22px -6px rgba(109,40,217,.5); }
.btn-primary strong { color: #fff; }
.btn-secondary {
  background: var(--surface);
  color: var(--text-primary) !important;
  border-color: var(--border);
  box-shadow: var(--shadow-xs);
}
.btn-secondary:hover { border-color: var(--accent-blue); color: var(--accent-teal) !important; transform: translateY(-1px); }
.btn-outline {
  background: transparent;
  color: var(--text-secondary) !important;
  border-color: var(--border-strong);
}
.btn-outline:hover { background: var(--teal-soft); border-color: var(--teal-border); color: var(--accent-teal) !important; }

/* Sticky module navigation (chapters 1–3) */
.Quick-nav {
  position: sticky;
  top: var(--nav-h);
  z-index: 50;
  display: flex !important;
  flex-wrap: nowrap !important;
  justify-content: flex-start !important;
  gap: .35rem !important;
  overflow-x: auto;
  scrollbar-width: none;
  margin: -2.25rem calc(50% - 50vw) 2.25rem !important;
  padding: .6rem max(1.5rem, calc(50vw - var(--max-width) / 2 + 1.5rem));
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
html[data-theme="dark"] .Quick-nav { background: rgba(11,17,32,.92); }
.Quick-nav::-webkit-scrollbar { display: none; }
.Quick-nav .btn {
  padding: .36rem .68rem !important;
  font-size: .8rem !important;
  border-radius: 8px;
  white-space: nowrap;
  flex-shrink: 0;
}
.Quick-nav .btn-outline { border-color: transparent; background: var(--surface-alt); }
.Quick-nav .btn-primary { margin-left: auto; }

/* --------------------------------------------------------------------------
   6. SECTIONS & MODULE HEADERS
   -------------------------------------------------------------------------- */
section { margin-bottom: 3.25rem; }

/* Reading column for theory modules */
.module-section,
main > section[id^="mod"] {
  max-width: var(--read-width);
  margin-left: auto;
  margin-right: auto;
  margin-bottom: 3.75rem;
}

.section-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .9rem 1rem;
  margin-bottom: 1.4rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}
.module-section > .section-header { justify-content: flex-start; flex-wrap: nowrap; }
.section-header h2 {
  font-size: clamp(1.35rem, 2.2vw, 1.7rem);
  font-weight: 800;
  margin: 0 0 .3rem;
}
.section-header p { margin: 0; font-size: .97rem; color: var(--text-secondary); }

.sec-num {
  flex-shrink: 0;
  width: 46px;
  height: 46px;
  border-radius: 12px;
  background: var(--gradient-primary);
  color: #fff;
  font-family: var(--font-head);
  font-weight: 800;
  font-size: 1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 14px -4px rgba(2,132,199,.45);
  margin-top: .1rem;
}

.section-title-group { display: flex; flex-direction: column; align-items: flex-start; gap: .4rem; }
.section-title-group h2 { margin: 0; }
.section-badge {
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--accent-teal);
}
.section-subtitle {
  font-size: .8rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--surface);
  border: 1px solid var(--border);
  padding: .3rem .8rem;
  border-radius: 999px;
  white-space: nowrap;
  align-self: center;
}
a.section-subtitle:hover { color: var(--accent-teal); border-color: var(--accent-blue); text-decoration: none; }

/* --------------------------------------------------------------------------
   7. GRIDS & CARDS
   -------------------------------------------------------------------------- */
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.25rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.25rem; }
.card-grid { display: grid; grid-template-columns: 1fr; gap: 1.25rem; }

/* Theory content card-grid single-column; grid-2 stays 2-column on wide screens */
.module-section .card-grid { grid-template-columns: 1fr; }

@media (max-width: 900px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.6rem 1.75rem;
  box-shadow: var(--shadow-sm);
  min-width: 0;
}
.card h3 {
  font-size: 1.14rem;
  font-weight: 700;
  margin: 0 0 .85rem;
  padding-bottom: .65rem;
  border-bottom: 1px dashed var(--border);
}
.card p, .card li { color: var(--text-body); font-size: 1rem; }
.card p { margin: 0 0 .9rem; }
.card ul, .card ol { margin: .4rem 0 .9rem; padding-left: 1.3rem; }
.card li { margin-bottom: .5rem; }
.card li::marker { color: var(--accent-blue); }
.card > *:last-child { margin-bottom: 0; }
.card p[style*="text-secondary"] {
  color: var(--text-secondary) !important;
  font-size: .95rem !important;
  background: var(--surface-sunken);
  border-left: 3px solid var(--border-strong);
  padding: .7rem .95rem;
  border-radius: 0 8px 8px 0;
}

/* Portal / course cards */
.portal-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.6rem 1.7rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 1rem;
  position: relative;
  overflow: hidden;
  transition: var(--transition);
  min-width: 0;
}
.portal-card::before {
  content: '';
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: var(--gradient-primary);
}
.portal-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: var(--teal-border); }
.portal-card.featured { border-color: var(--teal-border); }
.portal-card h3 { font-size: 1.2rem !important; line-height: 1.35; }
.portal-card p { color: var(--text-secondary) !important; font-size: .95rem !important; }

.portal-badge-row { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .45rem; align-items: center; }
.portal-tag {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  padding: .22rem .65rem;
  border-radius: 999px;
  background: var(--teal-soft);
  color: var(--accent-teal);
  border: 1px solid var(--teal-border);
  text-decoration: none !important;
}
.portal-tag.purple { background: var(--purple-soft); color: var(--accent-purple); border-color: var(--purple-border); }
.portal-tag.orange { background: var(--amber-soft); color: var(--accent-orange); border-color: var(--amber-border); }
.portal-tag.green  { background: var(--green-soft); color: var(--green-main); border-color: var(--green-border); }
a.portal-tag:hover { filter: brightness(.97); transform: translateY(-1px); }

/* --------------------------------------------------------------------------
   8. EQUATIONS
   -------------------------------------------------------------------------- */
.formula-box, .eq-box {
  background: var(--eq-bg);
  border: 1px solid var(--eq-border);
  border-left: 4px solid var(--accent-blue);
  border-radius: var(--radius-sm);
  padding: 1rem 1.25rem;
  margin: 1rem 0;
  text-align: center;
  min-width: 0;
}
.formula-label {
  display: block;
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: .2rem;
}
.eq-label {
  display: block;
  font-size: .85rem;
  color: var(--text-secondary);
  margin-top: .35rem;
  line-height: 1.5;
}
.katex { font-size: 1.02em; }
.katex-display {
  margin: .45rem 0 !important;
  padding: .25rem 0;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
}
.formula-box .katex-display > .katex,
.eq-box .katex-display > .katex { font-size: 1.16em; }
.katex-display > .katex { max-width: 100%; }

/* --------------------------------------------------------------------------
   9. KEY MESSAGE (RED) BOXES
   -------------------------------------------------------------------------- */
.key-message-box, .key-note-red {
  margin-top: 1.5rem;
  background: var(--red-soft);
  border: 1px solid var(--red-border);
  border-left: 5px solid var(--red-main);
  border-radius: var(--radius-md);
  padding: 1.2rem 1.5rem;
}
.key-message-title, .key-note-header {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-family: var(--font-head);
  font-size: .82rem;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--red-main);
  margin-bottom: .6rem;
}
.key-message-list { margin: 0; padding-left: 1.25rem; }
.key-message-list li, .key-note-red p, .key-note-red li {
  color: var(--text-body);
  font-size: .98rem;
  line-height: 1.68;
  margin-bottom: .45rem;
}
.key-message-list li:last-child { margin-bottom: 0; }
.key-message-list li::marker { color: var(--red-main); }
.key-message-list strong, .key-note-red strong { color: var(--red-dark); }

/* --------------------------------------------------------------------------
   10. TABLES
   -------------------------------------------------------------------------- */
.table-wrap { overflow-x: auto; border-radius: var(--radius-sm); border: 1px solid var(--border); margin: .75rem 0; }
.table-wrap table { border: 0 !important; margin: 0 !important; }
.card table, .si-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .93rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin: .75rem 0;
}
.card th, .si-table th {
  background: var(--surface-alt);
  color: var(--text-primary);
  font-weight: 700;
  font-size: .78rem;
  letter-spacing: .04em;
  text-transform: uppercase;
  text-align: left;
  padding: .7rem .9rem;
  border-bottom: 1px solid var(--border-strong);
}
.card td, .si-table td {
  padding: .65rem .9rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-body);
  vertical-align: top;
}
.card tbody tr:nth-child(even) td, .si-table tbody tr:nth-child(even) td { background: var(--surface-sunken); }
.card tbody tr:last-child td, .si-table tbody tr:last-child td { border-bottom: 0; }

/* --------------------------------------------------------------------------
   11. QUIZ
   -------------------------------------------------------------------------- */
#quiz-section { margin-top: 1rem; scroll-margin-top: calc(var(--nav-h) + 16px); }
#quiz-section .section-header { border-bottom: 0; padding-bottom: 0; margin-bottom: 1rem; }

.quiz-wrapper {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-md);
}

.quiz-scoreboard {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  padding-bottom: 1.1rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}
.score-left { display: flex; align-items: center; gap: 1rem; flex: 1; min-width: 260px; }
.score-pill {
  font-family: var(--font-head);
  font-weight: 800;
  font-size: .92rem;
  color: var(--accent-teal);
  background: var(--teal-soft);
  border: 1px solid var(--teal-border);
  padding: .4rem .9rem;
  border-radius: 999px;
  white-space: nowrap;
}
.progress-bar-wrap { flex: 1; height: 8px; background: var(--surface-alt); border-radius: 999px; overflow: hidden; }
.progress-bar-fill { height: 100%; background: var(--gradient-primary); border-radius: 999px; transition: width .4s ease; }

.quiz-actions-row { display: flex; flex-wrap: wrap; gap: .5rem; }
.btn-quiz-action {
  font: 600 .85rem var(--font-sans);
  padding: .55rem 1rem;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-primary);
  cursor: pointer;
  transition: var(--transition);
}
.btn-quiz-action:hover { border-color: var(--accent-blue); color: var(--accent-teal); }
.btn-quiz-action.primary { background: var(--gradient-primary); color: #fff; border-color: transparent; }
.btn-quiz-action.primary:hover { color: #fff; filter: brightness(1.05); }

.coach-banner {
  font-size: .92rem;
  font-weight: 500;
  color: var(--text-body);
  background: var(--gradient-soft);
  border: 1px solid var(--teal-border);
  border-radius: var(--radius-sm);
  padding: .7rem 1rem;
  margin-bottom: 1rem;
}
.coach-banner:empty { display: none; }

.q-stepper { display: flex; flex-wrap: wrap; gap: .35rem; margin-bottom: 1.1rem; }
.step-dot {
  min-width: 34px;
  height: 34px;
  padding: 0 .3rem;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  font: 700 .82rem var(--font-sans);
  cursor: pointer;
  transition: var(--transition);
}
.step-dot:hover { border-color: var(--accent-blue); color: var(--accent-teal); }
.step-dot.done-right { background: var(--green-soft); border-color: var(--green-border); color: var(--green-main); }
.step-dot.done-wrong { background: var(--red-soft); border-color: var(--red-border); color: var(--red-main); }
.step-dot.current { background: var(--gradient-primary); color: #fff; border-color: transparent; box-shadow: 0 4px 10px -2px rgba(2,132,199,.45); }

.q-item { border-radius: var(--radius-md); }

.q-horizontal-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr) minmax(0, 1fr);
  gap: 1.1rem;
  align-items: stretch;
}
@media (max-width: 1080px) { .q-horizontal-grid { grid-template-columns: 1fr; } }

.q-col-left, .q-col-center, .q-col-right {
  background: var(--surface-sunken);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.15rem 1.2rem;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.q-col-label {
  font-size: .7rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: .7rem;
}
.q-meta { display: flex; flex-wrap: wrap; gap: .35rem; margin-bottom: .85rem; }
.q-badge, .q-category, .variant-pill {
  font-size: .72rem;
  font-weight: 700;
  padding: .2rem .6rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
}
.q-badge { color: var(--accent-teal); border-color: var(--teal-border); background: var(--teal-soft); }
.q-category { color: var(--accent-purple); border-color: var(--purple-border); background: var(--purple-soft); }
.q-col-left .q-col-label { color: var(--accent-teal); }
.q-prompt {
  font-size: 1.14rem;
  line-height: 1.58;
  color: #0c4a6e;
  font-weight: 650;
  background: var(--teal-soft);
  border: 1px solid var(--teal-border);
  border-left: 4px solid var(--accent-blue);
  border-radius: 10px;
  padding: 1rem 1.15rem;
  box-shadow: var(--shadow-xs);
}
html[data-theme="dark"] .q-prompt {
  color: #e0f2fe;
}

.q-options { display: flex; flex-direction: column; gap: .55rem; }
.opt-button {
  display: flex;
  align-items: flex-start;
  gap: .7rem;
  width: 100%;
  text-align: left;
  padding: .75rem .85rem;
  border-radius: 10px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text-body);
  font: 500 .95rem/1.55 var(--font-sans);
  cursor: pointer;
  transition: var(--transition);
}
.opt-button:hover:not(:disabled) { border-color: var(--accent-blue); background: var(--teal-soft); transform: translateX(2px); }
.opt-button:disabled { cursor: default; opacity: .78; }
.opt-key {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  border-radius: 7px;
  background: var(--surface-alt);
  color: var(--text-secondary);
  font-weight: 800;
  font-size: .8rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: .05rem;
}
.opt-button.is-correct { border-color: var(--green-main); background: var(--green-soft); opacity: 1; }
.opt-button.is-correct .opt-key { background: var(--green-main); color: #fff; }
.opt-button.is-wrong { border-color: var(--red-main); background: var(--red-soft); opacity: 1; }
.opt-button.is-wrong .opt-key { background: var(--red-main); color: #fff; }

.q-feedback {
  flex: 1;
  border-radius: 10px;
  padding: 1rem 1.05rem;
  font-size: .95rem;
  line-height: 1.65;
  color: var(--text-body);
  border: 1px solid var(--border);
  background: var(--surface);
}
.q-feedback.fb-correct { background: var(--green-soft); border-color: var(--green-border); }
.q-feedback.fb-wrong   { background: var(--red-soft); border-color: var(--red-border); }
.q-feedback.fb-neutral { background: var(--teal-soft); border-color: var(--teal-border); }
.q-feedback.fb-waiting {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--text-muted);
  border-style: dashed;
  background: transparent;
}
.fb-title { font-family: var(--font-head); font-weight: 800; font-size: .98rem; margin-bottom: .45rem; color: var(--text-primary); }
.fb-correct .fb-title { color: var(--green-main); }
.fb-wrong .fb-title { color: var(--red-main); }

.try-variant-btn, .mod-jump-link {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  font: 600 .8rem var(--font-sans);
  padding: .38rem .75rem;
  border-radius: 8px;
  border: 1px solid var(--teal-border);
  background: var(--surface);
  color: var(--accent-teal) !important;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none !important;
}
.try-variant-btn:hover, .mod-jump-link:hover { background: var(--accent-blue); color: #fff !important; border-color: transparent; }

.q-nav-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 1.1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}
.q-step-counter { font-size: .85rem; font-weight: 600; color: var(--text-muted); }
.nav-step-btn {
  font: 700 .88rem var(--font-sans);
  padding: .62rem 1.15rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-primary);
  cursor: pointer;
  transition: var(--transition);
}
.nav-step-btn:hover:not(:disabled) { border-color: var(--accent-blue); color: var(--accent-teal); }
.nav-step-btn:disabled { opacity: .45; cursor: not-allowed; }
.nav-step-btn.next-ready { background: var(--gradient-primary); color: #fff; border-color: transparent; box-shadow: 0 6px 14px -4px rgba(2,132,199,.45); }
.nav-step-btn.next-ready:hover { color: #fff; transform: translateY(-1px); }

/* Diagnostic report */
.quiz-summary-card {
  background: var(--surface-sunken);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.5rem;
}
.quiz-summary-card h3 { margin-top: 0; }
.summary-big-score {
  font-family: var(--font-head);
  font-size: 2.4rem;
  font-weight: 800;
  text-align: center;
  margin: .5rem 0 1.25rem;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.diag-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: .75rem; margin: 1rem 0; }
.diag-topic-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--green-main);
  border-radius: 10px;
  padding: .8rem .9rem;
}
.diag-topic-card.warn { border-left-color: var(--amber-main); }
.diag-topic-card.bad  { border-left-color: var(--red-main); }
.diag-topic-top { display: flex; justify-content: space-between; gap: .5rem; font-size: .88rem; margin-bottom: .45rem; }
.diag-topic-name { font-weight: 700; color: var(--text-primary); }
.diag-topic-pct { font-weight: 700; color: var(--text-muted); white-space: nowrap; }
.diag-bar-track { height: 6px; background: var(--surface-alt); border-radius: 999px; overflow: hidden; }
.diag-bar-fill { height: 100%; background: var(--green-main); border-radius: 999px; }
.diag-topic-card.warn .diag-bar-fill { background: var(--amber-main); }
.diag-topic-card.bad .diag-bar-fill { background: var(--red-main); }
.diag-topic-status { font-size: .78rem; color: var(--text-muted); margin-top: .4rem; }
.study-plan-box {
  background: var(--amber-soft);
  border: 1px solid var(--amber-border);
  border-left: 5px solid var(--amber-main);
  border-radius: var(--radius-sm);
  padding: 1rem 1.2rem;
  margin: 1rem 0;
}
.study-plan-box.all-good { background: var(--green-soft); border-color: var(--green-border); border-left-color: var(--green-main); }
.study-plan-list { margin: .5rem 0 0; padding-left: 1.2rem; }
.study-plan-list li { margin-bottom: .55rem; }

/* --------------------------------------------------------------------------
   12. CHAPTER PAGER
   -------------------------------------------------------------------------- */
.chapter-pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .75rem;
  margin-top: 2.25rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

/* --------------------------------------------------------------------------
   13. EQUATION REPOSITORY
   -------------------------------------------------------------------------- */
.filter-bar {
  position: sticky;
  top: calc(var(--nav-h) + 8px);
  z-index: 40;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: .45rem;
  padding: .6rem;
  margin: 0 auto 2rem !important;
  max-width: var(--read-width);
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow-md);
}
html[data-theme="dark"] .filter-bar { background: rgba(17,26,46,.92); }
.filter-btn {
  font: 600 .84rem var(--font-sans);
  padding: .45rem .9rem;
  border-radius: 9px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
}
.filter-btn:hover { background: var(--surface-alt); color: var(--text-primary); }
.filter-btn.active { background: var(--gradient-primary); color: #fff; }

#equations-list { max-width: var(--read-width); margin: 0 auto; }

.eq-repo-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.6rem 1.75rem;
  box-shadow: var(--shadow-sm);
  min-width: 0;
}
.eq-repo-header { display: flex; flex-direction: column; align-items: flex-start; gap: .35rem; }
.eq-repo-header .badge { margin-bottom: 0; }
.eq-repo-header h3 { font-size: 1.2rem !important; margin: .2rem 0 0 !important; }
.eq-repo-card .formula-box > div { font-size: .88rem !important; color: var(--text-secondary) !important; line-height: 1.55; }

.eq-boxes-grid { display: grid; grid-template-columns: 1fr; gap: .75rem; }
.eq-when-box, .eq-trap-box, .eq-joke-box {
  border-radius: var(--radius-sm);
  padding: .9rem 1.1rem;
  font-size: .96rem;
  line-height: 1.65;
  color: var(--text-body);
  border: 1px solid;
  border-left-width: 4px;
}
.eq-when-box { background: var(--green-soft); border-color: var(--green-border); border-left-color: var(--green-main); }
.eq-trap-box { background: var(--red-soft); border-color: var(--red-border); border-left-color: var(--red-main); }
.eq-joke-box { background: var(--amber-soft); border-color: var(--amber-border); border-left-color: var(--accent-orange); font-style: italic; }
.eq-box-label {
  font-family: var(--font-head);
  font-size: .74rem;
  font-weight: 800;
  letter-spacing: .07em;
  text-transform: uppercase;
  font-style: normal;
  margin-bottom: .3rem;
}
.eq-when-box .eq-box-label { color: var(--green-main); }
.eq-trap-box .eq-box-label { color: var(--red-main); }
.eq-joke-box .eq-box-label { color: var(--accent-orange); }
.eq-when-box p, .eq-trap-box p, .eq-joke-box p { margin: 0; }

/* --------------------------------------------------------------------------
   14. SCIENTISTS (BIOGRAPHIES)
   -------------------------------------------------------------------------- */
.bio-card {
  max-width: var(--read-width);
  width: 100%;
  margin: 0 auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.9rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  scroll-margin-top: calc(var(--nav-h) + 20px);
}
.bio-card-top { display: flex; gap: 1.75rem; align-items: flex-start; }
.bio-portrait-wrap {
  flex-shrink: 0;
  width: 176px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .6rem;
}
.bio-portrait {
  width: 176px;
  height: 235px;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  object-position: center 15%;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  background: var(--surface-alt);
  filter: saturate(.92);
}
.bio-portrait.is-pair { height: 220px; }
.wiki-link-pill {
  font-size: .74rem;
  font-weight: 600;
  color: var(--text-secondary);
  border: 1px solid var(--border);
  padding: .25rem .65rem;
  border-radius: 999px;
  white-space: nowrap;
}
.wiki-link-pill:hover { color: var(--accent-teal); border-color: var(--accent-blue); text-decoration: none; }
.bio-main-info { flex: 1; min-width: 0; }
.bio-main-info h2 { font-size: 1.6rem !important; letter-spacing: -0.02em; }
.bio-main-info > p { font-size: 1rem; color: var(--text-body); }
.bio-main-info .badge { margin-bottom: 0; }

.bio-highlights-grid { display: grid; grid-template-columns: 1fr; gap: .9rem; }
.bio-highlight-thermo, .bio-highlight-world, .bio-funny-box {
  border-radius: var(--radius-sm);
  padding: 1rem 1.15rem;
  font-size: .96rem;
  line-height: 1.66;
  color: var(--text-body);
  border: 1px solid;
  border-left-width: 4px;
}
.bio-highlight-thermo { background: var(--teal-soft); border-color: var(--teal-border); border-left-color: var(--accent-blue); }
.bio-highlight-world  { background: var(--green-soft); border-color: var(--green-border); border-left-color: var(--green-main); }
.bio-funny-box        { background: var(--amber-soft); border-color: var(--amber-border); border-left-color: var(--accent-orange); }
.bio-box-title {
  font-family: var(--font-head);
  font-size: .76rem;
  font-weight: 800;
  letter-spacing: .07em;
  text-transform: uppercase;
  margin-bottom: .4rem;
}
.bio-highlight-thermo .bio-box-title { color: var(--accent-teal); }
.bio-highlight-world .bio-box-title  { color: var(--green-main); }
.bio-funny-box .bio-box-title        { color: var(--accent-orange); }
.bio-highlight-thermo p, .bio-highlight-world p, .bio-funny-box p { margin: 0; }

@media (max-width: 760px) {
  .bio-card { padding: 1.3rem; }
  .bio-card-top { flex-direction: column; align-items: center; text-align: left; }
  .bio-highlights-grid { grid-template-columns: 1fr; }
}

/* Scientist jump navigation */
main > nav:first-child:not(.Quick-nav) {
  max-width: var(--read-width);
  margin-left: auto !important;
  margin-right: auto !important;
}
main > nav:first-child:not(.Quick-nav) .btn { border-radius: 999px; }

/* --------------------------------------------------------------------------
   15. FOOTER
   -------------------------------------------------------------------------- */
.site-footer {
  margin-top: 4rem;
  background: var(--surface);
  border-top: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: .9rem;
}
.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2.75rem 1.5rem 2rem;
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 2.25rem;
}
.footer-inner:has(.footer-brand) { grid-template-columns: 1.6fr 1fr; align-items: start; }
.footer-brand-col .brand { margin-bottom: .85rem; }
.footer-brand-col .brand-title { font-size: .98rem; }
.footer-desc, .footer-brand p { color: var(--text-secondary); font-size: .9rem; line-height: 1.65; margin: 0; }
.footer-brand h3 { font-size: 1.05rem; margin: 0 0 .5rem; }
.footer-links-col h4 {
  font-size: .76rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-primary);
  margin: 0 0 .85rem;
}
.footer-links-col ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .5rem; }
.footer-links-col a, .footer-links a { color: var(--text-secondary); font-size: .9rem; }
.footer-links-col a:hover, .footer-links a:hover { color: var(--accent-teal); }
.footer-links { display: flex; flex-direction: column; gap: .5rem; align-items: flex-start; }
.footer-bottom {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 1.1rem 1.5rem 1.6rem;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .5rem 1.5rem;
  font-size: .8rem;
  color: var(--text-muted);
}
.footer-bottom strong { color: var(--text-secondary); }
@media (max-width: 860px) {
  .footer-inner, .footer-inner:has(.footer-brand) { grid-template-columns: 1fr; gap: 1.5rem; }
}

/* --------------------------------------------------------------------------
   16. UTILITIES & PRINT
   -------------------------------------------------------------------------- */
.current { font-weight: 700; }
.sep { color: var(--border-strong); }

@media (max-width: 640px) {
  body { font-size: 17px; }
  .container { padding: 0 1rem; }
  .card, .eq-repo-card { padding: 1.25rem; }
  .hero { padding: 2.2rem 1rem 2rem; }
  .q-nav-bar { flex-wrap: wrap; }
}

@media print {
  .navbar, .Quick-nav, .filter-bar, .site-footer, #quiz-section, .hero-actions { display: none !important; }
  body { background: #fff; font-size: 11pt; }
  .card, .eq-repo-card, .bio-card { box-shadow: none; break-inside: avoid; }
}


/* ==========================================================================
   17. READING TYPOGRAPHY — serif body, sans UI, justified text
   ========================================================================== */

/* Interface elements stay in Inter (sans) */
.navbar, .nav-links, .brand, .lang-btn, .theme-toggle, .bialab-pill,
.btn, .btn-primary, .btn-secondary, .btn-outline, .btn-quiz-action,
.nav-step-btn, .try-variant-btn, .mod-jump-link, .filter-btn, .step-dot,
.badge, .portal-tag, .hero-badge, .author-chip, .section-badge, .section-subtitle,
.chapter-nav-pill, .breadcrumb-bar, .Quick-nav, .filter-bar,
.formula-label, .eq-label, .eq-box-label, .bio-box-title, .key-message-title, .key-note-header,
.q-col-label, .q-badge, .q-category, .variant-pill, .q-step-counter, .score-pill, .coach-banner,
.fb-title, .opt-key, .diag-topic-top, .diag-topic-status, .summary-big-score,
.stat-num, .stat-lbl, .wiki-link-pill, .sec-num,
.card th, .si-table th,
.site-footer, .footer-bottom, .footer-links-col h4,
.bio-main-info > div[style] {
  font-family: var(--font-sans);
}

/* Long-form reading text: justified with hyphenation */
.card p, .card li,
.key-message-list li, .key-note-red p, .key-note-red li,
.hero-lead,
.portal-card p, .portal-card li,
.bio-main-info > p,
.bio-highlight-thermo p, .bio-highlight-world p, .bio-funny-box p,
.eq-when-box p, .eq-trap-box p, .eq-joke-box p,
.q-prompt, .q-feedback > div:not(.fb-title):not([style*="display:flex"]),
.opt-button > span:last-child,
.study-plan-box, .study-plan-list li,
.hero-visual-card p {
  text-align: justify;
  text-align-last: start;
  text-justify: inter-word;
  -webkit-hyphens: auto;
  hyphens: auto;
  hyphenate-limit-chars: 7 3 3;
  overflow-wrap: break-word;
}

/* Comfortable measure and rhythm */
.card p, .card li { font-size: 1rem; line-height: 1.68; }
.card p { margin: 0 0 1rem; }
.card li { margin-bottom: .55rem; padding-left: .15rem; }
.card ul, .card ol { padding-left: 1.4rem; }
.card { padding: 1.9rem 2.2rem; }
.card h3 { font-size: 1.12rem; letter-spacing: -0.01em; margin-bottom: 1rem; }
.card p[style*="text-secondary"] { font-size: .95rem !important; line-height: 1.62; }

.section-header h2 { font-size: clamp(1.4rem, 2.2vw, 1.72rem); letter-spacing: -0.025em; }
.section-header p { font-size: 1rem; font-style: italic; color: var(--text-secondary); }

.hero .subtitle { font-size: 1.12rem; line-height: 1.62; max-width: 1020px; }
.hero-lead { font-size: 1.12rem; line-height: 1.66; }
.hero h1, .hero-split h1 { letter-spacing: -0.035em; }

.key-message-list li, .key-note-red p { font-size: 1rem; line-height: 1.64; }

.bio-main-info > p { font-size: 1.02rem; line-height: 1.7; }
.bio-highlight-thermo, .bio-highlight-world, .bio-funny-box,
.eq-when-box, .eq-trap-box, .eq-joke-box { font-size: .98rem; line-height: 1.64; }
.bio-funny-box p, .eq-joke-box p { font-style: italic; }
.eq-joke-box { font-style: normal; }

.q-prompt { font-size: 1.14rem; line-height: 1.58; font-weight: 650; }
.opt-button { font-family: var(--font-serif); font-size: .98rem; line-height: 1.5; font-weight: 400; }
.q-feedback { font-size: .98rem; line-height: 1.6; }

.portal-card p, .portal-card li { font-size: .98rem !important; line-height: 1.62; }

/* Equations: KaTeX matches the serif body */
.formula-box .katex-display > .katex,
.eq-box .katex-display > .katex { font-size: 1.12em; }

/* Tables stay compact and left-aligned */
.card table, .si-table { font-size: .95rem; }
.card td, .si-table td { text-align: left; hyphens: manual; }

/* Lists of short items (e.g. unit definitions) read better left-aligned */
.card li:has(> strong:first-child:only-child) { text-align: left; }

@media (max-width: 640px) {
  .card { padding: 1.3rem 1.25rem; }
  /* Narrow screens: avoid large justification gaps */
  .opt-button > span:last-child, .q-feedback > div { text-align: left; }
  .bio-highlight-thermo p, .bio-highlight-world p, .bio-funny-box p { text-align: left; }
}

/* Prevent the hidden-language sibling from affecting justification */
p > .lang-pt, p > .lang-en, li > .lang-pt, li > .lang-en { white-space: normal; }

/* BIA Learn logo chip (hero) */
.brand-chip {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .3rem .85rem .3rem .3rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
  font-family: var(--font-sans);
}
.brand-chip .brand-logo { width: 26px; height: 26px; font-size: .9rem; }
.brand-chip .brand-title { font-size: .9rem; }
.footer-brand .brand { margin-bottom: .85rem; }

/* Inline formula glued to its punctuation — never split across lines */
.katex .glue-text { font-size: calc(1em / 1.02); letter-spacing: normal; }

/* Scientist biography links inside learning modules */
.scientist-link {
  color: var(--accent-teal);
  font-weight: 600;
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 3px;
  text-decoration-thickness: 1.5px;
  border-radius: 4px;
  transition: var(--transition);
}
.scientist-link:hover {
  color: var(--accent-blue);
  background: var(--teal-soft);
  text-decoration-style: solid;
}

@keyframes moduleFlashPulse {
  0%   { box-shadow: 0 0 0 0 rgba(2, 132, 199, 0.45); background-color: var(--teal-soft); }
  50%  { box-shadow: 0 0 0 8px rgba(2, 132, 199, 0.12); background-color: var(--teal-soft); }
  100% { box-shadow: 0 0 0 0 rgba(2, 132, 199, 0); background-color: transparent; }
}
.module-flash-highlight > .section-header {
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.75rem;
  margin-left: -0.75rem;
  margin-right: -0.75rem;
  animation: moduleFlashPulse 2.2s ease-out;
}

/* ==========================================================================
   18. CODE BLOCKS, RECIPES & INTERACTIVE LINUX TERMINAL SANDBOX
   ========================================================================== */
.code-block-wrap {
  position: relative;
  margin: 0.9rem 0 1.15rem;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid #1e293b;
  background: #0f172a;
  box-shadow: var(--shadow-sm);
}
.code-block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.48rem 0.95rem;
  background: #1e293b;
  color: #cbd5e1;
  font-family: var(--font-sans);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.code-copy-btn {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  color: #e2e8f0;
  border-radius: 6px;
  padding: 0.18rem 0.55rem;
  font-family: var(--font-sans);
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}
.code-copy-btn:hover {
  background: var(--accent-blue);
  border-color: var(--accent-blue);
  color: #fff;
}
.code-block {
  margin: 0;
  padding: 1rem 1.15rem;
  overflow-x: auto;
  font-family: 'JetBrains Mono', 'Fira Code', 'SFMono-Regular', Menlo, Monaco, Consolas, monospace;
  font-size: 0.86rem;
  line-height: 1.6;
  color: #e2e8f0;
  tab-size: 2;
  white-space: pre;
}
.code-block .comment, .code-block .tok-comment { color: #94a3b8; font-style: italic; }
.code-block .cmd,     .code-block .tok-cmd     { color: #38bdf8; font-weight: 600; }
.code-block .flag,    .code-block .tok-flag    { color: #fbbf24; }
.code-block .str,     .code-block .tok-str     { color: #86efac; }
.code-block .kw,      .code-block .tok-kw      { color: #c084fc; font-weight: 600; }

/* TMM Layout & Component Aliases */
#bg-canvas { display: none; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  min-height: var(--nav-h);
  background: rgba(255,255,255,.88);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--border);
  padding: 0.45rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
html[data-theme="dark"] .topbar { background: rgba(11,17,32,.88); }

.topbar .brand-icon {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  background: var(--teal-soft);
  border: 1px solid var(--teal-border);
  color: var(--accent-teal);
  font-size: 1.15rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.topbar .brand-text {
  font-family: var(--font-head);
  font-weight: 800;
  font-size: 1.08rem;
  color: var(--text-primary);
  display: inline;
}
.topbar .brand-text span { color: var(--accent-blue); }

.ctrl-btn {
  font: 700 .78rem var(--font-sans);
  padding: .38rem .75rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-primary);
  cursor: pointer;
  transition: var(--transition);
}
.ctrl-btn:hover { border-color: var(--accent-blue); color: var(--accent-teal); }

.page-wrap {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 1.75rem 1.5rem 3.5rem;
}

.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .45rem;
  font-family: var(--font-sans);
  font-size: .82rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 1.1rem;
}
.breadcrumb a { color: var(--accent-teal); }

.study-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.85rem 2rem;
  margin-bottom: 2rem;
  box-shadow: var(--shadow-sm);
}
.study-header {
  display: flex;
  align-items: center;
  gap: .85rem;
  padding-bottom: 1rem;
  margin-bottom: 1.25rem;
  border-bottom: 1px solid var(--border);
}
.study-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--teal-soft);
  border: 1px solid var(--teal-border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}
.study-header h2 {
  margin: 0;
  font-size: clamp(1.3rem, 2.1vw, 1.65rem);
  font-weight: 800;
}
.study-body h3 {
  font-size: 1.18rem;
  font-weight: 700;
  margin: 1.5rem 0 .7rem;
  color: var(--text-primary);
}
.study-body h3:first-child { margin-top: .25rem; }
.study-body ul, .study-body ol {
  margin: .5rem 0 1.1rem;
  padding-left: 1.35rem;
}
.study-body li { margin-bottom: .45rem; }
.study-body code, .portal-card code {
  font-family: 'JetBrains Mono', 'Fira Code', Menlo, Consolas, monospace;
  font-size: .84em;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  padding: .12rem .38rem;
  border-radius: 5px;
  color: var(--accent-teal);
}

.Concept-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.1rem;
  margin: 1.1rem 0;
}
.concept-card {
  background: var(--surface-sunken);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.25rem 1.35rem;
}
.concept-card h4 {
  margin: 0 0 .5rem;
  font-size: 1.02rem;
  font-weight: 700;
}
.concept-card p {
  font-size: .92rem;
  color: var(--text-secondary);
  margin: 0;
}

.course-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(330px, 1fr));
  gap: 1.35rem;
}
.course-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.6rem 1.7rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: .85rem;
  transition: var(--transition);
}
.course-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--teal-border); }
.course-badge {
  align-self: flex-start;
  font-family: var(--font-sans);
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  padding: .24rem .68rem;
  border-radius: 999px;
  background: var(--teal-soft);
  color: var(--accent-teal);
  border: 1px solid var(--teal-border);
}
.course-meta {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  font-family: var(--font-sans);
  font-size: .78rem;
  font-weight: 600;
  color: var(--text-muted);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .92rem;
  background: var(--surface);
}
.data-table th {
  background: var(--surface-alt);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: .78rem;
  letter-spacing: .04em;
  text-transform: uppercase;
  text-align: left;
  padding: .7rem .95rem;
  border-bottom: 1px solid var(--border-strong);
}
.data-table td {
  padding: .68rem .95rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-body);
  vertical-align: top;
}
.data-table tbody tr:nth-child(even) td { background: var(--surface-sunken); }

.equation-box {
  background: var(--eq-bg);
  border: 1px solid var(--eq-border);
  border-left: 4px solid var(--accent-blue);
  border-radius: var(--radius-sm);
  padding: 1rem 1.25rem;
  margin: 1rem 0;
  text-align: center;
  overflow-x: auto;
}
.equation-box .eq-label {
  font-family: var(--font-sans);
  font-size: .76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--accent-teal);
  margin-bottom: .4rem;
}

.callout {
  background: var(--teal-soft);
  border: 1px solid var(--teal-border);
  border-left: 4px solid var(--accent-blue);
  border-radius: var(--radius-md);
  padding: 1.15rem 1.35rem;
  margin: 1.15rem 0;
}
.callout-title {
  font-family: var(--font-sans);
  font-weight: 800;
  font-size: .92rem;
  color: var(--accent-teal);
  margin-bottom: .4rem;
}

.footer {
  border-top: 1px solid var(--border);
  padding: 1.75rem 1.5rem;
  text-align: center;
  font-family: var(--font-sans);
  font-size: .86rem;
  color: var(--text-muted);
  background: var(--surface);
}

/* ==========================================================================
   19. STEP-BY-STEP VISUAL TUTORIALS, GUI WINDOW MOCKUPS & 3D VIEWER
   ========================================================================== */
.tutorial-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin: 1.25rem 0 1.75rem;
  padding: 0.55rem;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}
.tutorial-tab-btn {
  flex: 1;
  min-width: 180px;
  padding: 0.75rem 1.1rem;
  border-radius: 10px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  font: 700 0.92rem var(--font-sans);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: var(--transition);
}
.tutorial-tab-btn:hover {
  color: var(--text-primary);
  background: var(--surface);
}
.tutorial-tab-btn.active {
  background: var(--surface);
  color: var(--accent-teal);
  border-color: var(--teal-border);
  box-shadow: var(--shadow-sm);
}

/* Numbered Step-by-Step Walkthrough Cards */
.step-walkthrough {
  display: flex;
  flex-direction: column;
  gap: 1.35rem;
  margin: 1.35rem 0 1.85rem;
}
.step-item {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: 1.5rem;
  align-items: start;
  background: var(--surface-sunken);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.4rem 1.5rem;
  position: relative;
}
@media (max-width: 960px) {
  .step-item { grid-template-columns: 1fr; }
}
.step-item-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.65rem;
}
.step-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.28rem 0.75rem;
  border-radius: 999px;
  background: var(--gradient-primary);
  color: #fff;
  font: 800 0.75rem var(--font-sans);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  flex-shrink: 0;
}
.step-item h4 {
  margin: 0;
  font-size: 1.08rem;
  font-weight: 800;
  color: var(--text-primary);
}
.step-item p {
  font-size: 0.94rem;
  color: var(--text-body);
  margin: 0 0 0.65rem;
}
.step-item ul, .step-item ol {
  font-size: 0.92rem;
  margin: 0.4rem 0 0.65rem;
  padding-left: 1.25rem;
}

/* Annotated Software GUI Mockup Windows */
.gui-window {
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow-md);
  font-family: var(--font-sans);
  color: #e2e8f0;
}
.gui-titlebar {
  background: #1e293b;
  padding: 0.5rem 0.9rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #334155;
  font-size: 0.78rem;
  font-weight: 700;
  color: #f8fafc;
}
.gui-titlebar-dots {
  display: flex;
  gap: 0.38rem;
}
.gui-titlebar-dots span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}
.gui-titlebar-dots span:nth-child(1) { background: #ef4444; }
.gui-titlebar-dots span:nth-child(2) { background: #f59e0b; }
.gui-titlebar-dots span:nth-child(3) { background: #10b981; }
.gui-menubar {
  background: #162032;
  padding: 0.35rem 0.85rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  border-bottom: 1px solid #26354d;
  font-size: 0.75rem;
  color: #cbd5e1;
}
.gui-menubar span.hl {
  background: #0284c7;
  color: #fff;
  padding: 0.1rem 0.45rem;
  border-radius: 4px;
  font-weight: 700;
}
.gui-body {
  padding: 0.95rem 1.05rem;
  font-size: 0.82rem;
  line-height: 1.5;
}
.gui-field {
  margin-bottom: 0.6rem;
}
.gui-field-label {
  display: block;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #94a3b8;
  margin-bottom: 0.2rem;
}
.gui-input-mock {
  background: #090d16;
  border: 1px solid #38bdf8;
  border-radius: 6px;
  padding: 0.38rem 0.65rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.78rem;
  color: #38bdf8;
}
.gui-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
}
.gui-select-mock {
  background: #1e293b;
  border: 1px solid #475569;
  border-radius: 6px;
  padding: 0.35rem 0.6rem;
  font-size: 0.78rem;
  color: #f8fafc;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.gui-btn-mock {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: #0284c7;
  color: #fff;
  border-radius: 6px;
  padding: 0.32rem 0.7rem;
  font-size: 0.76rem;
  font-weight: 700;
}
.gui-annotation {
  margin-top: 0.55rem;
  padding: 0.45rem 0.65rem;
  background: rgba(56, 189, 248, 0.12);
  border-left: 3px solid #38bdf8;
  border-radius: 4px;
  font-size: 0.76rem;
  color: #bae6fd;
}

/* Interactive 3D Viewer Stage */
.mol3d-wrapper {
  background: #090d16;
  border: 1px solid #334155;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: var(--shadow-md);
  margin: 1.25rem 0 1.75rem;
}
.mol3d-toolbar {
  background: #1e293b;
  padding: 0.65rem 1rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  border-bottom: 1px solid #334155;
}
.mol3d-btn-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.mol3d-btn {
  background: #0f172a;
  color: #cbd5e1;
  border: 1px solid #475569;
  border-radius: 7px;
  padding: 0.38rem 0.72rem;
  font: 600 0.76rem var(--font-sans);
  cursor: pointer;
  transition: var(--transition);
}
.mol3d-btn:hover, .mol3d-btn.active {
  background: #0284c7;
  color: #fff;
  border-color: #38bdf8;
}
.mol3d-canvas-box {
  position: relative;
  width: 100%;
  height: 440px;
  background: radial-gradient(circle at center, #131c31 0%, #090d16 100%);
}
.mol3d-caption {
  padding: 0.65rem 1.1rem;
  background: #0f172a;
  border-top: 1px solid #1e293b;
  color: #cbd5e1;
  font-family: var(--font-sans);
  font-size: 0.82rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* Keyboard / Mouse Shortcut Badges */
kbd {
  display: inline-block;
  padding: 0.15rem 0.45rem;
  font: 700 0.76rem 'JetBrains Mono', monospace;
  color: var(--text-primary);
  background: var(--surface-alt);
  border: 1px solid var(--border-strong);
  border-bottom-width: 2px;
  border-radius: 5px;
  vertical-align: middle;
}

.recipe-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent-purple);
  border-radius: var(--radius-md);
  padding: 1.5rem 1.75rem;
  box-shadow: var(--shadow-sm);
  margin-bottom: 1.25rem;
}
.recipe-card h4 {
  font-family: var(--font-sans);
  font-size: 1.05rem;
  font-weight: 700;
  margin: 0 0 0.55rem 0;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.recipe-tag {
  display: inline-block;
  font-family: var(--font-sans);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  background: var(--purple-soft);
  color: var(--accent-purple);
  border: 1px solid var(--purple-border);
}

/* Interactive Linux Terminal Trainer */
.terminal-window {
  background: #090d16;
  border: 1px solid #334155;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  font-family: 'JetBrains Mono', 'Fira Code', 'SFMono-Regular', Menlo, Monaco, Consolas, monospace;
}
.terminal-topbar {
  background: #1e293b;
  padding: 0.55rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #334155;
}
.terminal-dots {
  display: flex;
  gap: 0.45rem;
}
.terminal-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
}
.terminal-dot.red    { background: #ef4444; }
.terminal-dot.yellow { background: #f59e0b; }
.terminal-dot.green  { background: #10b981; }
.terminal-title {
  color: #cbd5e1;
  font-family: var(--font-sans);
  font-size: 0.76rem;
  font-weight: 600;
}
.terminal-body {
  padding: 0.95rem 1.15rem;
  min-height: 540px;
  max-height: 680px;
  overflow-y: auto;
  color: #e2e8f0;
  font-size: 0.75rem;
  line-height: 1.42;
}
.terminal-output-line {
  white-space: pre;
  overflow-x: auto;
  margin-bottom: 0.22rem;
}
.terminal-output-line.cmd-echo { color: #f8fafc; font-weight: 600; margin-top: 0.35rem; }
.terminal-output-line.sys-msg  { color: #38bdf8; }
.terminal-output-line.ok-msg   { color: #4ade80; font-weight: 600; }
.terminal-output-line.err-msg  { color: #f87171; }
.terminal-input-row {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.6rem 1.15rem;
  background: #0f172a;
  border-top: 1px solid #1e293b;
}
.terminal-prompt {
  color: #4ade80;
  font-weight: 700;
  white-space: nowrap;
  font-size: 0.76rem;
}
.terminal-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: #f8fafc;
  font-family: inherit;
  font-size: 0.78rem;
}
.mission-chip {
  font-family: var(--font-sans);
  font-size: 0.75rem;
  padding: 0.38rem 0.68rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  transition: var(--transition);
  text-align: left;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
}
.mission-chip:hover { border-color: var(--accent-blue); background: var(--teal-soft); }
.mission-chip.active { border-color: var(--accent-blue); background: var(--teal-soft); font-weight: 700; }
.mission-chip.done { border-color: var(--green-border); background: var(--green-soft); color: var(--green-main); }

/* ==========================================================================
   20. INTERACTIVE IN-BROWSER VI / VIM MODAL EDITOR
   ========================================================================== */
.vi-editor-screen {
  display: none;
  flex-direction: column;
  background: #090d16;
  color: #e2e8f0;
  font-family: 'JetBrains Mono', 'Fira Code', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  min-height: 604px;
  max-height: 724px;
  border-top: 1px solid #1e293b;
  outline: none;
  user-select: none;
}
.vi-editor-screen.active {
  display: flex;
}
.vi-hud-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.45rem;
  padding: 0.45rem 0.85rem;
  background: #111827;
  border-bottom: 1px solid #1f2937;
  font-family: var(--font-sans);
  font-size: 0.74rem;
}
.vi-mode-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.22rem 0.65rem;
  border-radius: 6px;
  font-weight: 800;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.vi-mode-pill.normal {
  background: rgba(56, 189, 248, 0.18);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.45);
}
.vi-mode-pill.insert {
  background: rgba(74, 222, 128, 0.2);
  color: #4ade80;
  border: 1px solid rgba(74, 222, 128, 0.5);
}
.vi-mode-pill.command {
  background: rgba(251, 191, 36, 0.2);
  color: #fbbf24;
  border: 1px solid rgba(251, 191, 36, 0.5);
}
.vi-helper-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 0.28rem;
  align-items: center;
}
.vi-btn {
  background: #1e293b;
  color: #cbd5e1;
  border: 1px solid #334155;
  border-radius: 5px;
  padding: 0.18rem 0.48rem;
  font-family: var(--font-mono);
  font-size: 0.69rem;
  cursor: pointer;
  transition: all 0.15s ease;
}
.vi-btn:hover {
  background: #334155;
  color: #fff;
  border-color: #38bdf8;
}
.vi-btn.save {
  background: rgba(16, 185, 129, 0.18);
  color: #6ee7b7;
  border-color: rgba(16, 185, 129, 0.45);
}
.vi-btn.quit {
  background: rgba(244, 63, 94, 0.16);
  color: #fda4af;
  border-color: rgba(244, 63, 94, 0.4);
}
.vi-viewport {
  flex: 1;
  overflow-y: auto;
  overflow-x: auto;
  padding: 0.55rem 0.85rem;
  font-size: 12px;
  line-height: 1.48;
  background: #090d16;
  cursor: text;
}
.vi-line {
  display: flex;
  white-space: pre;
  min-height: 1.48em;
}
.vi-line.active-line {
  background: rgba(30, 41, 59, 0.65);
}
.vi-lineno {
  color: #facc15;
  width: 3.2em;
  text-align: right;
  padding-right: 0.85em;
  user-select: none;
  opacity: 0.85;
  flex-shrink: 0;
}
.vi-tilde {
  color: #3b82f6;
  font-weight: 700;
  user-select: none;
}
.vi-cursor-normal {
  background: #38bdf8;
  color: #090d16;
  font-weight: 700;
}
.vi-cursor-insert {
  background: #4ade80;
  color: #090d16;
  font-weight: 700;
  box-shadow: -2px 0 0 #4ade80;
}
.vi-statusbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.35rem 0.85rem;
  background: #1e293b;
  border-top: 1px solid #334155;
  font-size: 0.76rem;
  color: #f8fafc;
}
.vi-cmdline-row {
  display: flex;
  align-items: center;
  padding: 0.32rem 0.85rem;
  background: #0f172a;
  border-top: 1px solid #1e293b;
  font-size: 0.78rem;
  min-height: 2rem;
}
.vi-cmd-prefix {
  color: #fbbf24;
  font-weight: 800;
  margin-right: 0.25rem;
}
.vi-cmd-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: #f8fafc;
  font-family: inherit;
  font-size: 0.78rem;
}

/* ============================================================================
   QUANTUM MECHANICS FOR COMPUTATIONAL CHEMISTRY — NATIVE EXTENSIONS
   3-Layer Depth Switcher, Predict-Observe-Explain Labs, DFT Atlas & Provenance
   ============================================================================ */

/* Sticky 3-Depth Control Bar */
.qm-depth-bar {
  position: sticky;
  top: 64px;
  z-index: 90;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem 1.15rem;
  margin: 1rem 0 1.75rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem;
}

.qm-depth-label {
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.qm-depth-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.qm-depth-btn {
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.42rem 0.85rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
}

.qm-depth-btn:hover,
.qm-depth-btn:focus-visible {
  border-color: var(--accent-blue);
  color: var(--text);
  outline: 2px solid transparent;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.25);
}

.qm-depth-btn.active {
  background: var(--accent-blue);
  color: #ffffff;
  border-color: var(--accent-blue);
}

.qm-depth-btn[data-depth="essential"].active {
  background: var(--accent-teal);
  border-color: var(--accent-teal);
}

.qm-depth-btn[data-depth="math"].active {
  background: var(--accent-blue);
  border-color: var(--accent-blue);
}

.qm-depth-btn[data-depth="comp"].active {
  background: var(--accent-purple);
  border-color: var(--accent-purple);
}

/* Depth Layer Containers */
.depth-layer {
  border-left: 4px solid var(--border);
  background: var(--surface);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 1rem 1.25rem;
  margin: 0.9rem 0;
  box-shadow: var(--shadow-sm);
}

.depth-layer.depth-essential {
  border-left-color: var(--accent-teal);
}

.depth-layer.depth-math {
  border-left-color: var(--accent-blue);
}

.depth-layer.depth-comp {
  border-left-color: var(--accent-purple);
}

.depth-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-family: var(--font-sans);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
  margin-bottom: 0.55rem;
}

.depth-essential .depth-badge {
  background: var(--accent-teal-soft);
  color: var(--accent-teal);
}

.depth-math .depth-badge {
  background: var(--accent-blue-soft);
  color: var(--accent-blue);
}

.depth-comp .depth-badge {
  background: var(--accent-purple-soft);
  color: var(--accent-purple);
}

/* Visibility filtering by active depth mode */
body[data-qm-depth="essential"] .depth-layer.depth-math,
body[data-qm-depth="essential"] .depth-layer.depth-comp {
  display: none !important;
}

body[data-qm-depth="math"] .depth-layer.depth-comp {
  display: none !important;
}

body[data-qm-depth="comp"] .depth-layer.depth-math {
  display: none !important;
}

/* Provenance & Content Review Badges (Section 23) */
.qm-status-ribbon {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin: 0.6rem 0 1.1rem;
  padding: 0.55rem 0.85rem;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 0.75rem;
}

.qm-review-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  font-weight: 600;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
}

.qm-review-pill.status-draft {
  background: var(--accent-gold-soft);
  color: var(--accent-gold);
  border-color: rgba(180, 83, 9, 0.35);
}

.qm-review-pill.status-tested,
.qm-review-pill.status-checked {
  background: var(--accent-green-soft);
  color: var(--accent-green);
  border-color: rgba(21, 128, 61, 0.35);
}

.qm-review-pill.status-mode-a {
  background: var(--accent-blue-soft);
  color: var(--accent-blue);
  border-color: rgba(29, 78, 216, 0.35);
}

.qm-review-pill.status-mode-b {
  background: var(--accent-purple-soft);
  color: var(--accent-purple);
  border-color: rgba(109, 40, 217, 0.35);
}

/* Interactive Laboratory Widget (Section 9) */
.qm-lab-widget {
  background: var(--surface);
  border: 2px solid var(--accent-teal);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin: 1.75rem 0;
  box-shadow: var(--shadow);
}

.qm-lab-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 1rem;
  margin-bottom: 1.1rem;
}

.qm-lab-title {
  font-family: var(--font-sans);
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--text);
  margin: 0.2rem 0;
}

.qm-lab-meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.15rem;
  font-family: var(--font-sans);
  font-size: 0.83rem;
}

.qm-lab-meta-box {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.85rem;
}

.qm-lab-meta-box strong {
  display: block;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--accent-teal);
  margin-bottom: 0.25rem;
}

.qm-predict-gate {
  background: var(--accent-gold-soft);
  border: 1px solid rgba(180, 83, 9, 0.35);
  border-radius: var(--radius-sm);
  padding: 0.9rem 1.1rem;
  margin-bottom: 1.2rem;
  font-family: var(--font-sans);
  font-size: 0.88rem;
}

.qm-predict-options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.6rem;
}

.qm-predict-btn {
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.4rem 0.8rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: var(--transition);
}

.qm-predict-btn:hover,
.qm-predict-btn:focus-visible {
  border-color: var(--accent-teal);
  outline: 2px solid transparent;
  box-shadow: 0 0 0 2px rgba(15, 118, 110, 0.25);
}

.qm-predict-btn.selected {
  background: var(--accent-teal);
  color: #ffffff;
  border-color: var(--accent-teal);
}

.qm-controls-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.85rem;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem;
  margin-bottom: 1.1rem;
  font-family: var(--font-sans);
}

.qm-control-group {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.qm-control-group label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text);
  display: flex;
  justify-content: space-between;
}

.qm-control-group input[type="range"],
.qm-control-group select,
.qm-control-group input[type="number"] {
  width: 100%;
  accent-color: var(--accent-teal);
  padding: 0.3rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 0.84rem;
}

.qm-canvas-wrap {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.85rem;
  margin-bottom: 1rem;
  overflow-x: auto;
}

.qm-svg-plot {
  width: 100%;
  height: auto;
  min-height: 270px;
  display: block;
}

.qm-readout-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(155px, 1fr));
  gap: 0.65rem;
  margin-bottom: 1rem;
  font-family: var(--font-sans);
}

.qm-readout-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.8rem;
}

.qm-readout-card .ro-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
}

.qm-readout-card .ro-val {
  font-size: 1rem;
  font-weight: 800;
  color: var(--accent-blue);
  margin-top: 0.15rem;
  font-family: var(--font-mono);
}

/* Numerical Formative Question Card (Section 19) */
.qm-num-question {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent-orange);
  border-radius: var(--radius-sm);
  padding: 1.15rem;
  margin: 1rem 0;
  font-family: var(--font-sans);
}

.qm-num-input-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
  margin-top: 0.75rem;
}

.qm-num-input-row input[type="number"] {
  padding: 0.45rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.9rem;
  width: 160px;
}

.qm-num-feedback {
  margin-top: 0.75rem;
  padding: 0.65rem 0.9rem;
  border-radius: var(--radius-sm);
  font-size: 0.86rem;
  display: none;
}

.qm-num-feedback.correct {
  display: block;
  background: var(--accent-green-soft);
  color: var(--accent-green);
  border: 1px solid rgba(21, 128, 61, 0.35);
}

.qm-num-feedback.incorrect {
  display: block;
  background: var(--accent-red-soft);
  color: var(--accent-red);
  border: 1px solid rgba(190, 18, 60, 0.35);
}

/* Progress Matrix Pills */
.qm-progress-matrix {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 0.75rem;
  margin: 1rem 0;
}

.qm-prog-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.85rem 1rem;
  font-family: var(--font-sans);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.55rem;
}

.qm-prog-dots {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  font-size: 0.7rem;
}

.qm-prog-dot {
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  background: var(--surface-alt);
  color: var(--text-muted);
  border: 1px solid var(--border);
  font-weight: 600;
}

.qm-prog-dot.done {
  background: var(--accent-green-soft);
  color: var(--accent-green);
  border-color: rgba(21, 128, 61, 0.4);
}

/* DFT Atlas & Method Maps (Sections 13–17) */
.qm-atlas-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.75rem;
  margin: 1.1rem 0;
}

.qm-stat-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.8rem 1rem;
  text-align: center;
  font-family: var(--font-sans);
}

.qm-stat-num {
  font-size: 1.55rem;
  font-weight: 800;
  color: var(--accent-teal);
  line-height: 1.15;
}

.qm-stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
  margin-top: 0.25rem;
}

.qm-ladder-rung {
  border: 1px solid var(--border);
  border-left: 5px solid var(--accent-teal);
  border-radius: var(--radius-sm);
  background: var(--surface);
  padding: 1rem 1.25rem;
  margin-bottom: 0.85rem;
}

.qm-func-pill-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.65rem;
}

.qm-func-pill {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.3rem 0.65rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
  transition: var(--transition);
}

.qm-func-pill:hover,
.qm-func-pill:focus-visible {
  border-color: var(--accent-blue);
  background: var(--accent-blue-soft);
}

.qm-func-pill.exemplar {
  border-color: var(--accent-teal);
  background: var(--accent-teal-soft);
  color: var(--accent-teal);
}

/* ============================================================================
   INTERACTIVE UNIVERSITY TEXTBOOK ARCHITECTURE (.book-layout, .book-toc, etc.)
   ============================================================================ */
.book-layout,
.book-layout.mb-layout {
  max-width: var(--read-width, 1320px) !important;
  width: 100%;
  margin: 0 auto;
  padding: 1.75rem 1.5rem 4.25rem;
  display: block !important;
  box-sizing: border-box;
}
.book-toc,
.book-sidebar {
  position: static !important;
  max-height: none !important;
  background: var(--surface, #ffffff);
  border: 1px solid var(--border, rgba(148, 163, 184, 0.28));
  border-radius: var(--radius-md, 14px);
  padding: 1.15rem 1.35rem;
  margin-bottom: 2rem !important;
  box-shadow: var(--shadow-sm, 0 4px 18px rgba(15, 23, 42, 0.04));
  overflow: visible !important;
}
.book-toc-title {
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent-teal, #0369a1);
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border, rgba(148, 163, 184, 0.22));
}
.book-toc-list,
.book-sidebar .book-toc-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)) !important;
  gap: 0.65rem 0.85rem;
}
.book-toc-list > li {
  background: var(--surface-sunken, #f8fafc);
  border: 1px solid var(--border, rgba(148, 163, 184, 0.22));
  border-radius: 10px;
  padding: 0.5rem 0.65rem;
  min-width: 0;
}
.book-toc-list a {
  display: block;
  padding: 0.24rem 0.35rem;
  border-radius: 6px;
  font-family: var(--font-sans);
  font-size: 0.81rem;
  line-height: 1.36;
  color: var(--text-primary, var(--text));
  text-decoration: none;
  transition: all 0.15s ease;
  font-weight: 700;
}
.book-toc-list a:hover {
  background: rgba(2, 132, 199, 0.09);
  color: var(--accent-teal, #0369a1);
}
.book-toc-list a .toc-num {
  font-weight: 800;
  color: var(--accent-blue, #0284c7);
  margin-right: 0.25rem;
}
.book-toc-sub {
  padding-left: 0.65rem !important;
  padding-top: 0.14rem !important;
  padding-bottom: 0.14rem !important;
  font-size: 0.74rem !important;
  font-weight: 500 !important;
  color: var(--text-secondary, var(--text-muted)) !important;
}
.book-main {
  min-width: 0;
  width: 100%;
}
.book-chapter-section {
  background: transparent;
  border: 0;
  border-radius: 0;
  padding: 0;
  margin-bottom: 3.6rem;
  box-shadow: none;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}
.book-chapter-section > .section-header {
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  flex-wrap: nowrap;
  gap: 1rem;
  margin-bottom: 1.4rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border, #e2e8f0);
}
.book-chapter-section > .section-header > div {
  flex: 1;
  min-width: 0;
}
.book-subcard {
  background: var(--surface, #ffffff);
  border: 1px solid var(--border, #e2e8f0);
  border-radius: var(--radius-md, 14px);
  padding: 1.65rem 1.85rem;
  margin-bottom: 1.35rem;
  box-shadow: var(--shadow-sm, 0 1px 3px rgba(15, 23, 42, 0.06));
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
  overflow-x: hidden;
}
@media (max-width: 640px) {
  .book-subcard {
    padding: 1.25rem 1.1rem;
  }
}
.book-subcard > .book-subhead:first-child,
.book-subcard > h3:first-child {
  margin-top: 0;
}
.chapter-bridge-intro {
  font-family: 'Source Serif 4', Georgia, serif;
  background: linear-gradient(135deg, rgba(2, 132, 199, 0.07), rgba(109, 40, 217, 0.05));
  border: 1px solid var(--teal-border, #bae6fd);
  border-left: 5px solid var(--accent-blue, #0284c7);
  border-radius: var(--radius-md, 14px);
  padding: 1.4rem 1.65rem;
  margin-bottom: 1.4rem;
  box-shadow: var(--shadow-xs);
}
.chapter-bridge-title {
  font-family: 'Inter', sans-serif;
  font-size: 0.84rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--accent-teal, #0369a1);
  margin-bottom: 0.6rem;
  display: flex;
  align-items: center;
  gap: 0.45rem;
}
.chapter-bridge-outro {
  font-family: 'Inter', sans-serif;
  background: linear-gradient(135deg, rgba(109, 40, 217, 0.07), rgba(2, 132, 199, 0.06));
  border: 1px solid var(--purple-border, #ddd6fe);
  border-left: 5px solid var(--accent-purple, #6d28d9);
  border-radius: var(--radius-md, 14px);
  padding: 1.25rem 1.5rem;
  margin-top: 1.35rem;
  font-size: 0.95rem;
  line-height: 1.72;
}
.chapter-bridge-outro-title {
  font-weight: 800;
  font-size: 0.84rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent-purple, #6d28d9);
  margin-bottom: 0.45rem;
  display: flex;
  align-items: center;
  gap: 0.45rem;
}
.real-world-box {
  font-family: 'Inter', sans-serif;
  background: linear-gradient(135deg, rgba(21, 128, 61, 0.08), rgba(13, 148, 136, 0.05));
  border: 1px solid var(--green-border, #bbf7d0);
  border-left: 4px solid var(--green-main, #15803d);
  border-radius: 12px;
  padding: 1.15rem 1.35rem;
  margin: 1.25rem 0;
  font-size: 0.94rem;
  line-height: 1.7;
}
.real-world-box .rw-title {
  font-weight: 800;
  color: var(--green-main, #15803d);
  margin-bottom: 0.4rem;
  display: block;
  font-size: 0.96rem;
}
.book-chapter-section p {
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 1.04rem;
  line-height: 1.82;
  margin-bottom: 1.1rem;
  color: var(--text-primary, var(--text));
}
.book-chapter-section ul, .book-chapter-section ol {
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 1.01rem;
  line-height: 1.78;
  margin-bottom: 1.15rem;
  padding-left: 1.45rem;
}
.book-chapter-section li {
  margin-bottom: 0.55rem;
}
.book-chapter-section .formula-box .katex-display > .katex,
.book-chapter-section .eq-box .katex-display > .katex,
.book-chapter-section .derivation-box .katex-display > .katex {
  font-size: 1.01em;
}
.book-subhead {
  font-family: 'Inter', sans-serif;
  font-size: 1.18rem;
  font-weight: 800;
  color: var(--text-primary, var(--text));
  margin: 1.6rem 0 0.85rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px dashed var(--border-strong, #cbd5e1);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.45rem;
}
.book-subsubhead {
  font-family: 'Inter', sans-serif;
  font-size: 1.06rem;
  font-weight: 700;
  color: #1e40af;
  margin: 1.45rem 0 0.6rem;
}
.step-badge-inline {
  font-family: 'Inter', sans-serif;
  display: inline-block;
  background: rgba(37, 99, 235, 0.13);
  color: #2563eb;
  font-weight: 700;
  font-size: 0.75rem;
  padding: 0.18rem 0.6rem;
  border-radius: 999px;
  margin-right: 0.4rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  vertical-align: middle;
}
.student-qa-box {
  font-family: 'Inter', sans-serif;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.10), rgba(251, 191, 36, 0.05));
  border-left: 4px solid #d97706;
  border-radius: 12px;
  padding: 1.15rem 1.35rem;
  margin: 1.35rem 0;
  font-size: 0.94rem;
  line-height: 1.7;
  min-width: 0;
  max-width: 100%;
  overflow-x: auto;
}
.student-qa-box .qa-q {
  font-weight: 800;
  color: #b45309;
  margin-bottom: 0.45rem;
  display: block;
  font-size: 0.98rem;
}
.analogy-box {
  font-family: 'Inter', sans-serif;
  background: linear-gradient(135deg, rgba(13, 148, 136, 0.09), rgba(37, 99, 235, 0.07));
  border-left: 4px solid #0d9488;
  border-radius: 12px;
  padding: 1.15rem 1.35rem;
  margin: 1.35rem 0;
  font-size: 0.94rem;
  line-height: 1.7;
  min-width: 0;
  max-width: 100%;
  overflow-x: auto;
}
.derivation-box {
  font-family: 'Inter', sans-serif;
  background: rgba(37, 99, 235, 0.05);
  border: 1.5px solid rgba(37, 99, 235, 0.25);
  border-radius: 14px;
  padding: 1.25rem 1.4rem;
  margin: 1.4rem 0;
  font-size: 0.93rem;
  line-height: 1.7;
  min-width: 0;
  max-width: 100%;
  overflow-x: auto;
}
.derivation-title {
  font-weight: 800;
  color: #1d4ed8;
  font-size: 0.98rem;
  margin-bottom: 0.65rem;
  display: flex;
  align-items: center;
  gap: 0.45rem;
}
.history-box {
  font-family: 'Inter', sans-serif;
  background: rgba(100, 116, 139, 0.07);
  border-left: 4px solid #475569;
  border-radius: 12px;
  padding: 1.05rem 1.3rem;
  margin: 1.3rem 0;
  font-size: 0.91rem;
  line-height: 1.66;
  min-width: 0;
  max-width: 100%;
  overflow-x: auto;
}
.read-aloud-box {
  font-family: 'Inter', sans-serif;
  background: rgba(124, 58, 237, 0.07);
  border: 1px dashed rgba(124, 58, 237, 0.42);
  border-radius: 10px;
  padding: 0.9rem 1.15rem;
  margin: 0.75rem 0 1.3rem;
  font-size: 0.92rem;
  line-height: 1.66;
  min-width: 0;
  max-width: 100%;
  overflow-x: auto;
}
.eq-anatomy-grid {
  font-family: 'Inter', sans-serif;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 0.85rem;
  margin: 0.9rem 0 1.45rem;
}
.eq-anatomy-item {
  background: var(--bg-subtle, rgba(148, 163, 184, 0.08));
  border: 1px solid rgba(148, 163, 184, 0.26);
  border-radius: 10px;
  padding: 0.85rem 0.95rem;
  font-size: 0.87rem;
  line-height: 1.56;
  min-width: 0;
  overflow-x: auto;
}
.eq-anatomy-sym {
  font-weight: 800;
  font-size: 0.96rem;
  color: #2563eb;
  margin-bottom: 0.3rem;
}
.interactive-box {
  font-family: 'Inter', sans-serif;
  background: var(--card-bg, var(--surface, #ffffff));
  border: 2px solid rgba(37, 99, 235, 0.34);
  border-radius: 16px;
  padding: 1.4rem;
  margin: 1.75rem 0;
  box-shadow: 0 10px 28px rgba(37, 99, 235, 0.07);
  min-width: 0;
  max-width: 100%;
  overflow-x: auto;
}
.interactive-box-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.25);
  padding-bottom: 0.85rem;
  margin-bottom: 1.1rem;
}
.rung-btn-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(135px, 1fr));
  gap: 0.55rem;
  margin-bottom: 1rem;
}
.rung-step-btn {
  padding: 0.65rem 0.75rem;
  border-radius: 10px;
  border: 1.5px solid rgba(148, 163, 184, 0.35);
  background: var(--bg-subtle, rgba(148, 163, 184, 0.07));
  cursor: pointer;
  text-align: left;
  transition: all 0.18s ease;
  color: var(--text-primary, var(--text));
}
.rung-step-btn:hover {
  border-color: #2563eb;
  transform: translateY(-1px);
}
.rung-step-btn.active {
  background: rgba(37, 99, 235, 0.12);
  border-color: #2563eb;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.18);
}
.kw-chip {
  display: inline-block;
  font-family: monospace;
  font-size: 0.88rem;
  font-weight: 700;
  padding: 0.34rem 0.68rem;
  margin: 0.2rem;
  border-radius: 6px;
  border: 1.5px solid #38bdf8;
  background: rgba(56, 189, 248, 0.12);
  color: #0284c7;
  cursor: pointer;
  transition: all 0.15s ease;
}
.kw-chip:hover, .kw-chip.active {
  background: #0284c7;
  color: #ffffff;
}
.worked-step {
  font-family: 'Inter', sans-serif;
  border-left: 3px solid #2563eb;
  padding-left: 1rem;
  margin-bottom: 0.95rem;
  font-size: 0.93rem;
  line-height: 1.68;
  min-width: 0;
  max-width: 100%;
  overflow-x: auto;
}
.mc-option-btn {
  font-family: 'Inter', sans-serif;
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.75rem 1rem;
  margin-bottom: 0.55rem;
  border-radius: 8px;
  border: 1.5px solid rgba(148, 163, 184, 0.35);
  background: var(--card-bg, var(--surface, #fff));
  color: var(--text-primary, var(--text));
  cursor: pointer;
  font-size: 0.92rem;
  transition: all 0.15s ease;
}
.mc-option-btn:hover {
  border-color: #2563eb;
}
.mc-option-btn.correct {
  border-color: #059669;
  background: rgba(5, 150, 105, 0.12);
  font-weight: 600;
}
.mc-option-btn.wrong {
  border-color: #dc2626;
  background: rgba(220, 38, 38, 0.10);
}



/* ============================================================
   Unified textbook box titles & simulator cards (Block II and
   any chapter using the titled-box / simulator-card markup)
   ============================================================ */
.formula-title {
  display: block;
  font-family: 'Inter', sans-serif;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: .35rem;
}
.analogy-box .analogy-title,
.read-aloud-box .read-aloud-title,
.student-qa-box .student-qa-title {
  display: block;
  font-family: 'Inter', sans-serif;
  font-weight: 800;
  font-size: 0.97rem;
  margin-bottom: 0.45rem;
}
.analogy-box .analogy-title { color: #0f766e; }
.read-aloud-box .read-aloud-title { color: #1d4ed8; }
.student-qa-box .student-qa-title { color: #b45309; }
.analogy-box p, .read-aloud-box p, .student-qa-box p, .real-world-box p,
.chapter-bridge-intro p, .chapter-bridge-outro p {
  margin-bottom: 0;
}
.chapter-bridge-intro p + p { margin-top: 0.75rem; }
.book-paragraph { margin-bottom: 1rem; }

/* Simulator card */
.simulator-card {
  font-family: 'Inter', sans-serif;
  background: var(--card-bg, var(--surface, #ffffff));
  border: 2px solid rgba(37, 99, 235, 0.30);
  border-radius: 16px;
  padding: 1.3rem;
  box-shadow: 0 10px 28px rgba(37, 99, 235, 0.07);
  min-width: 0;
  max-width: 100%;
  overflow-x: auto;
}
.simulator-header { margin-bottom: 1rem; }
.simulator-badge {
  display: inline-block;
  background: rgba(37, 99, 235, 0.10);
  color: #1d4ed8;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
  border-radius: 999px;
  padding: 0.25rem 0.7rem;
  margin-bottom: 0.5rem;
}
.simulator-title {
  font-family: 'Inter', sans-serif;
  font-size: 1.05rem;
  font-weight: 800;
  margin: 0.2rem 0 0.4rem;
  color: var(--text);
}
.simulator-card .simulator-desc {
  font-family: 'Inter', sans-serif;
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--text-muted);
  margin: 0;
}
.simulator-controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.85rem;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem;
  margin-bottom: 1rem;
}
.simulator-controls .control-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.simulator-controls label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text);
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  justify-content: space-between;
}
.simulator-controls input[type="range"],
.simulator-controls select {
  width: 100%;
  accent-color: var(--accent-teal);
  padding: 0.3rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 0.84rem;
}
.simulator-canvas-wrapper {
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin-bottom: 1rem;
}
.simulator-canvas-wrapper svg { display: block; width: 100%; height: auto; }
.simulator-readout {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.65rem;
}
.simulator-readout .readout-item {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.simulator-readout .readout-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
}
.simulator-readout .readout-value {
  font-size: 0.98rem;
  font-weight: 800;
  color: var(--accent-blue);
  font-family: var(--font-mono);
}

/* ============================================================
   Justified Textbook Typography (Prose, Lists & Pedagogical Boxes)
   ============================================================ */
.book-chapter-section p,
.book-chapter-section li,
.book-subcard p,
.book-subcard li,
.card p,
.card li,
.chapter-bridge-intro,
.chapter-bridge-intro p,
.chapter-bridge-outro,
.chapter-bridge-outro p,
.analogy-box,
.analogy-box p,
.real-world-box,
.real-world-box p,
.student-qa-box,
.student-qa-box p,
.read-aloud-box,
.read-aloud-box p,
.derivation-box p,
.derivation-box li,
.history-box,
.history-box p,
.worked-step,
.worked-step p,
.key-message-box p,
.key-message-box li,
.key-message-list li,
.key-note-red p,
.key-note-red li,
.eq-anatomy-item,
.eq-anatomy-item p,
.simulator-card .simulator-desc,
.hero-lead {
  text-align: justify;
  hyphens: auto;
  -webkit-hyphens: auto;
}

/* Keep titles, headings, equation blocks, tables, and UI controls un-justified */
.book-chapter-section h1,
.book-chapter-section h2,
.book-chapter-section h3,
.book-chapter-section h4,
.book-subhead,
.book-subsubhead,
.section-header h2,
.section-header p,
.chapter-bridge-title,
.chapter-bridge-outro-title,
.real-world-box .rw-title,
.student-qa-box .qa-q,
.student-qa-box .student-qa-title,
.analogy-box .analogy-title,
.read-aloud-box .read-aloud-title,
.derivation-title,
.key-message-title,
.key-note-header,
.eq-anatomy-sym,
.simulator-title,
.simulator-badge {
  text-align: left;
  hyphens: none;
  -webkit-hyphens: none;
}

.formula-box,
.formula-box p,
.eq-box,
.eq-box p,
.katex-display {
  text-align: center;
  hyphens: none;
  -webkit-hyphens: none;
}

/* ============================================================
   Multi-Portrait Gallery & QM Giants Cards
   ============================================================ */
.bio-main-info p,
.bio-highlight-thermo p,
.bio-highlight-world p,
.bio-funny-box p {
  text-align: justify;
  hyphens: auto;
  -webkit-hyphens: auto;
}

.bio-portraits-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem;
  justify-content: center;
  padding: 1rem 1.15rem;
  background: var(--surface-sunken, #f8fafc);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: 0.35rem;
}

.bio-portrait-figure {
  margin: 0;
  width: 148px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.38rem;
}

.bio-portrait-figure .bio-portrait {
  width: 142px;
  height: 176px;
  object-fit: cover;
  object-position: center 18%;
  border-radius: 12px;
  border: 2px solid var(--border-strong, #cbd5e1);
  box-shadow: var(--shadow-sm);
  background: var(--surface-alt);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.bio-portrait-figure:hover .bio-portrait {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--accent-blue);
}

.bio-portrait-caption {
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.28;
  color: var(--text-primary);
}

.bio-portrait-years {
  display: block;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-top: 0.1rem;
}

.bio-portrait-nobel {
  display: inline-block;
  font-family: var(--font-sans);
  font-size: 0.66rem;
  font-weight: 800;
  color: #b45309;
  background: rgba(245, 158, 11, 0.14);
  border: 1px solid rgba(245, 158, 11, 0.35);
  border-radius: 999px;
  padding: 0.1rem 0.48rem;
}

.bio-section-banner {
  max-width: var(--read-width);
  margin: 1.5rem auto 0.5rem;
  padding: 1.25rem 1.5rem;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, rgba(2, 132, 199, 0.09), rgba(109, 40, 217, 0.08));
  border: 1px solid var(--teal-border);
  border-left: 5px solid var(--accent-blue);
}

.qm-giants-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(235px, 1fr));
  gap: 1rem;
  margin: 1.15rem 0;
}

.qm-giant-mini-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  box-shadow: var(--shadow-xs);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.qm-giant-mini-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--accent-blue);
}

.qm-giant-mini-top {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.qm-giant-mini-img {
  width: 72px;
  height: 96px;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  object-position: center 15%;
  border-radius: 10px;
  border: 1.5px solid var(--border-strong);
  flex-shrink: 0;
  background: var(--surface-alt);
}

.qm-giant-mini-meta h4 {
  font-family: var(--font-sans);
  font-size: 0.92rem;
  font-weight: 800;
  margin: 0 0 0.15rem;
  line-height: 1.25;
  color: var(--text-primary);
}

.qm-giant-mini-meta .gm-years {
  font-family: var(--font-sans);
  font-size: 0.73rem;
  font-weight: 600;
  color: var(--text-muted);
  display: block;
}

.qm-giant-mini- body,
.qm-giant-mini-card p {
  font-family: var(--font-sans);
  font-size: 0.81rem !important;
  line-height: 1.5 !important;
  margin: 0 !important;
  color: var(--text-secondary);
  text-align: justify !important;
  -webkit-hyphens: auto !important;
  hyphens: auto !important;
}

/* ==========================================================================
   TEXTBOOK PROSE JUSTIFICATION & TYPOGRAPHIC POLISH
   ========================================================================== */
.book-section p,
.book-section li,
.analogy-box p,
.analogy-box div,
.eq-desc,
.mistake-alert-box,
.mistake-alert-box p,
.read-aloud-box,
.read-aloud-box p,
.mb-card p,
.mb-card li,
.mb-explain p,
.giant-card p,
.mb-note,
.mb-quiz-fb {
  text-align: justify;
  -webkit-hyphens: auto;
  hyphens: auto;
}
.formula-box,
.formula-box p {
  text-align: center !important;
}

/* ==========================================================================
   SCIENTIFIC FIGURE PLATES (.mb-textbook-plate)
   ========================================================================== */
.mb-textbook-plate {
  margin: 1.75rem 0;
  border-radius: 16px;
  overflow: hidden;
  background: linear-gradient(145deg, #0b1120 0%, #111c33 100%);
  border: 1.5px solid rgba(56, 189, 248, 0.32);
  box-shadow: 0 16px 38px -10px rgba(2, 12, 27, 0.45);
  color: #f1f5f9;
}
.mb-plate-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.65rem;
  padding: 0.85rem 1.25rem;
  background: rgba(15, 23, 42, 0.88);
  border-bottom: 1px solid rgba(148, 163, 184, 0.22);
}
.mb-plate-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-sans);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.24rem 0.68rem;
  border-radius: 999px;
  background: linear-gradient(135deg, #0284c7 0%, #6d28d9 100%);
  color: #ffffff;
}
.mb-plate-title {
  font-family: var(--font-sans);
  font-size: 1.04rem;
  font-weight: 800;
  color: #f8fafc;
  margin: 0;
}
.mb-plate-img-wrap {
  position: relative;
  width: 100%;
  background: #090d16;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
}
.mb-plate-img-wrap img {
  width: 100%;
  height: auto;
  max-height: none;
  object-fit: contain;
  display: block;
  transition: transform 0.35s ease;
  cursor: zoom-in;
}
.mb-plate-img-wrap img.zoomed {
  max-height: none;
  transform: scale(1.04);
  cursor: zoom-out;
}
.mb-plate-callouts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.65rem;
  padding: 0.85rem 1.25rem;
  background: rgba(15, 23, 42, 0.92);
  border-top: 1px solid rgba(148, 163, 184, 0.18);
  border-bottom: 1px solid rgba(148, 163, 184, 0.18);
}
.mb-plate-callout-item {
  font-family: var(--font-sans);
  font-size: 0.8rem;
  line-height: 1.45;
  color: #cbd5e1;
  background: rgba(30, 41, 59, 0.65);
  border-left: 3px solid #38bdf8;
  padding: 0.45rem 0.65rem;
  border-radius: 6px;
  text-align: justify;
  hyphens: auto;
}
.mb-plate-callout-item strong {
  color: #38bdf8;
  display: block;
  margin-bottom: 0.12rem;
  font-size: 0.78rem;
}
.mb-plate-caption {
  padding: 0.95rem 1.25rem;
  font-family: var(--font-serif);
  font-size: 0.91rem;
  line-height: 1.62;
  color: #e2e8f0;
  background: rgba(9, 13, 22, 0.88);
  text-align: justify;
  -webkit-hyphens: auto;
  hyphens: auto;
}
.mb-plate-caption strong {
  color: #38bdf8;
  font-family: var(--font-sans);
}

/* ==========================================================================
   COURSE DOSSIER CARD — CONTEXT, RATIONALE & DETAILED OBJECTIVES
   ========================================================================== */
.course-dossier-card {
  position: relative;
  margin: 1.85rem 0 2.4rem;
  padding: 2.2rem 2.4rem;
  border-radius: 22px;
  background: linear-gradient(145deg, rgba(15, 23, 42, 0.96) 0%, rgba(17, 24, 39, 0.98) 100%);
  border: 1px solid rgba(56, 189, 248, 0.34);
  color: #f1f5f9;
  box-shadow: 0 20px 50px rgba(2, 6, 23, 0.2);
  overflow: hidden;
}
.course-dossier-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: linear-gradient(90deg, #0ea5e9, #10b981, #8b5cf6, #f59e0b);
}
.course-dossier-kicker {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.3rem 0.85rem;
  border-radius: 999px;
  background: rgba(56, 189, 248, 0.14);
  border: 1px solid rgba(56, 189, 248, 0.36);
  color: #38bdf8;
  font-family: var(--font-sans);
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.85rem;
}
.course-dossier-title {
  font-family: 'Plus Jakarta Sans', var(--font-sans);
  font-size: clamp(1.38rem, 2.3vw, 1.85rem);
  font-weight: 800;
  color: #ffffff;
  margin: 0 0 1rem;
  line-height: 1.25;
}
.course-dossier-lead {
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 1.05rem;
  line-height: 1.75;
  color: #e2e8f0;
  margin: 0 0 1.45rem;
  text-align: justify;
  -webkit-hyphens: auto;
  hyphens: auto;
}
.course-dossier-lead strong {
  color: #38bdf8;
}
.course-dossier-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.15rem;
  margin-top: 1.1rem;
}
.course-dossier-box {
  background: rgba(30, 41, 59, 0.72);
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: 15px;
  padding: 1.25rem 1.35rem;
}
.course-dossier-box h3 {
  font-family: var(--font-sans);
  font-size: 0.98rem;
  font-weight: 800;
  color: #34d399;
  margin: 0 0 0.6rem;
  display: flex;
  align-items: center;
  gap: 0.45rem;
}
.course-dossier-box p,
.course-dossier-box li {
  font-size: 0.9rem;
  line-height: 1.62;
  color: #cbd5e1;
  text-align: justify;
}
.course-dossier-box ul {
  margin: 0;
  padding-left: 1.15rem;
}
.course-dossier-box li {
  margin-bottom: 0.4rem;
}
.course-dossier-box li strong {
  color: #f8fafc;
}
@media (max-width: 768px) {
  .course-dossier-card {
    padding: 1.5rem 1.25rem;
  }
}

/* ============================================================================
   RECOMMENDED BIBLIOGRAPHY & REFERENCE BOOKS SECTION (.biblio-section)
   ============================================================================ */
.biblio-section {
  margin: 2.8rem 0 2.5rem;
  padding: 2.2rem 2.3rem;
  border-radius: 22px;
  background: linear-gradient(145deg, rgba(15, 23, 42, 0.96) 0%, rgba(17, 24, 39, 0.98) 100%);
  border: 1px solid rgba(56, 189, 248, 0.32);
  box-shadow: 0 20px 48px rgba(2, 6, 23, 0.22);
  color: #f1f5f9;
  position: relative;
  overflow: hidden;
}
.biblio-section::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: linear-gradient(90deg, #f59e0b, #38bdf8, #10b981, #8b5cf6);
}
.biblio-kicker {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.32rem 0.85rem;
  border-radius: 999px;
  background: rgba(245, 158, 11, 0.16);
  border: 1px solid rgba(245, 158, 11, 0.42);
  color: #fbbf24;
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.85rem;
}
.biblio-section-title {
  font-family: var(--font-sans);
  font-size: clamp(1.35rem, 2.4vw, 1.85rem);
  font-weight: 800;
  color: #ffffff;
  margin: 0 0 0.65rem;
  line-height: 1.25;
}
.biblio-section-lead {
  font-size: 0.98rem;
  line-height: 1.68;
  color: #cbd5e1;
  margin: 0 0 1.65rem;
  text-align: justify;
}
.biblio-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.35rem;
}
.biblio-card {
  display: flex;
  gap: 1.2rem;
  background: rgba(30, 41, 59, 0.78);
  border: 1px solid rgba(148, 163, 184, 0.26);
  border-radius: 16px;
  padding: 1.25rem;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  align-items: flex-start;
}
.biblio-card:hover {
  transform: translateY(-3px);
  border-color: rgba(56, 189, 248, 0.55);
  box-shadow: 0 14px 32px rgba(2, 6, 23, 0.4);
}
.biblio-cover-wrap {
  flex: 0 0 112px;
  width: 112px;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: -4px 6px 18px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.14);
  background: #0f172a;
  position: relative;
}
.biblio-cover-wrap img {
  width: 100%;
  height: 158px;
  object-fit: cover;
  display: block;
}
.biblio-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.biblio-badge-role {
  display: inline-block;
  align-self: flex-start;
  font-size: 0.69rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.18rem 0.58rem;
  border-radius: 6px;
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.32);
  margin-bottom: 0.4rem;
}
.biblio-book-title {
  font-family: var(--font-sans);
  font-size: 1.04rem;
  font-weight: 800;
  color: #ffffff;
  margin: 0 0 0.25rem;
  line-height: 1.3;
}
.biblio-book-authors {
  font-size: 0.85rem;
  font-weight: 700;
  color: #34d399;
  margin: 0 0 0.45rem;
}
.biblio-meta-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 0.6rem;
}
.biblio-meta-pill {
  font-size: 0.72rem;
  font-weight: 600;
  color: #cbd5e1;
  background: rgba(15, 23, 42, 0.72);
  border: 1px solid rgba(148, 163, 184, 0.22);
  padding: 0.15rem 0.5rem;
  border-radius: 6px;
}
.biblio-book-desc {
  font-size: 0.84rem;
  line-height: 1.56;
  color: #cbd5e1;
  margin: 0 0 0.85rem;
  text-align: justify;
}
.biblio-buy-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: auto;
}
.btn-amazon {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.38rem 0.75rem;
  border-radius: 8px;
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: #0f172a !important;
  font-size: 0.76rem;
  font-weight: 800;
  text-decoration: none !important;
  transition: transform 0.15s ease, filter 0.15s ease;
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.28);
}
.btn-amazon:hover {
  transform: translateY(-1px);
  filter: brightness(1.08);
}
.btn-amazon-es {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.38rem 0.72rem;
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(251, 191, 36, 0.45);
  color: #fde68a !important;
  font-size: 0.75rem;
  font-weight: 700;
  text-decoration: none !important;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.btn-amazon-es:hover {
  background: rgba(245, 158, 11, 0.16);
  border-color: #fbbf24;
}
@media (max-width: 820px) {
  .biblio-grid {
    grid-template-columns: 1fr;
  }
  .biblio-section {
    padding: 1.5rem 1.2rem;
  }
}
@media (max-width: 480px) {
  .biblio-card {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }
  .biblio-badge-role {
    align-self: center;
  }
  .biblio-meta-pills,
  .biblio-buy-row {
    justify-content: center;
  }
}

/* ==========================================================================
   CONTRAST & DARK-CONTAINER LEGIBILITY SHIELD (LIGHT & DARK MODES)
   Ensures dark boxes, 3D boards, GUI windows, code pills, and highlights
   never render dark-on-dark or light-on-light text in any course module.
   ========================================================================== */

/* 1. Global Inline Code & Mark Highlights */
:not(pre) > code {
  font-family: var(--font-mono);
  font-size: 0.86em;
  background: var(--teal-soft);
  color: var(--accent-teal);
  border: 1px solid var(--teal-border);
  padding: 0.12rem 0.4rem;
  border-radius: 5px;
  font-weight: 600;
}

html[data-theme="dark"] :not(pre) > code,
html[data-theme="dark"] .study-body :not(pre) > code,
html[data-theme="dark"] .portal-card :not(pre) > code {
  background: rgba(56, 189, 248, 0.15);
  color: #7dd3fc;
  border-color: rgba(56, 189, 248, 0.35);
}

pre code,
.code-block code,
.study-body pre code,
.portal-card pre code {
  background: transparent !important;
  border: 0 !important;
  padding: 0 !important;
  color: inherit !important;
  font-weight: inherit;
}

mark {
  background: rgba(251, 191, 36, 0.28);
  color: var(--text-primary);
  padding: 0.08rem 0.32rem;
  border-radius: 4px;
  font-weight: 600;
}

html[data-theme="dark"] mark {
  background: rgba(251, 191, 36, 0.22);
  color: #fde68a;
}

/* 2. Table Headers inside Dark Rows */
tr[style*="background:#0f172a"] th,
tr[style*="background: #0f172a"] th,
.card tr[style*="background:#0f172a"] th,
.card tr[style*="background: #0f172a"] th,
tr[style*="background:#1e293b"] th,
.card tr[style*="background:#1e293b"] th {
  color: #f8fafc !important;
  background: transparent !important;
}

/* 3. Universal Dark-Container Text & Highlight Legibility Shield */
:is(
  .course-dossier-card,
  .biblio-section,
  .mb-textbook-plate,
  .gui-window,
  .mol3d-wrapper,
  .terminal-window,
  .vi-editor-screen,
  .code-block-wrap,
  .mb-aa20-board,
  .mb-multi3d-board,
  .mb-aa3d-card,
  .bia-hero-stage,
  .bia-manifesto-card,
  .bia-gateway-banner,
  .catalog-hero,
  .svg-diagram-card,
  [style*="background:#0f172a"],
  [style*="background: #0f172a"],
  [style*="background:#090d16"],
  [style*="background: #090d16"],
  [style*="background:#020617"],
  [style*="background: #020617"],
  [style*="background:#0b1120"],
  [style*="background: #0b1120"],
  [style*="background:#0d1322"],
  [style*="background: #0d1322"],
  [style*="background:#111827"],
  [style*="background: #111827"],
  [style*="background:#1e293b"],
  [style*="background: #1e293b"],
  [style*="background:#1e1b4b"],
  [style*="background: #1e1b4b"],
  [style*="background:rgba(15,23,42"],
  [style*="background: rgba(15,23,42"],
  [style*="background:rgba(15, 23, 42"],
  [style*="background: rgba(15, 23, 42"],
  [style*="background:rgba(30,41,59"],
  [style*="background: rgba(30,41,59"],
  [style*="background:rgba(30, 41, 59"],
  [style*="background: rgba(30, 41, 59"],
  [style*="background:rgba(9,13,22"],
  [style*="background: rgba(9, 13, 22"],
  [style*="background:rgba(2,6,23"],
  [style*="background: rgba(2, 6, 23"],
  [style*="background:linear-gradient(135deg, rgba(15"],
  [style*="background: linear-gradient(135deg, rgba(15"],
  [style*="background:linear-gradient(145deg, rgba(15"],
  [style*="background: linear-gradient(145deg, rgba(15"],
  [style*="background:linear-gradient(180deg, rgba(15"],
  [style*="background: linear-gradient(180deg, rgba(15"],
  [style*="background:linear-gradient(135deg, #0"],
  [style*="background: linear-gradient(135deg, #0"],
  [style*="background:linear-gradient(135deg,#0"],
  [style*="background:linear-gradient(145deg, #0"],
  [style*="background: linear-gradient(145deg, #0"],
  [style*="background:linear-gradient(180deg, #0"],
  [style*="background: linear-gradient(180deg, #0"]
) {
  color: #e2e8f0;
  --text-primary: #f8fafc;
  --text-body: #e2e8f0;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --text: #f8fafc;
  --surface-sunken: rgba(15, 23, 42, 0.72);
  --surface-alt: rgba(30, 41, 59, 0.82);
  --border: rgba(148, 163, 184, 0.25);
  --border-strong: rgba(148, 163, 184, 0.4);
}

:is(
  .course-dossier-card,
  .biblio-section,
  .mb-textbook-plate,
  .gui-window,
  .mol3d-wrapper,
  .terminal-window,
  .vi-editor-screen,
  .code-block-wrap,
  .mb-aa20-board,
  .mb-multi3d-board,
  .mb-aa3d-card,
  .bia-hero-stage,
  .bia-manifesto-card,
  .bia-gateway-banner,
  .catalog-hero,
  .svg-diagram-card,
  [style*="background:#0f172a"],
  [style*="background: #0f172a"],
  [style*="background:#090d16"],
  [style*="background: #090d16"],
  [style*="background:#020617"],
  [style*="background: #020617"],
  [style*="background:#0b1120"],
  [style*="background: #0b1120"],
  [style*="background:#111827"],
  [style*="background: #111827"],
  [style*="background:#1e293b"],
  [style*="background: #1e293b"],
  [style*="background:rgba(15,23,42"],
  [style*="background: rgba(15,23,42"],
  [style*="background:rgba(15, 23, 42"],
  [style*="background: rgba(15, 23, 42"],
  [style*="background:rgba(30,41,59"],
  [style*="background: rgba(30,41,59"],
  [style*="background:rgba(30, 41, 59"],
  [style*="background: rgba(30, 41, 59"]
) :is(h1, h2, h3, h4, h5, h6, strong, b):not([style*="color:"]) {
  color: #f8fafc !important;
}

:is(
  .course-dossier-card,
  .biblio-section,
  .mb-textbook-plate,
  .gui-window,
  .mol3d-wrapper,
  .terminal-window,
  .vi-editor-screen,
  .code-block-wrap,
  .mb-aa20-board,
  .mb-multi3d-board,
  .mb-aa3d-card,
  .svg-diagram-card,
  [style*="background:#0f172a"],
  [style*="background: #0f172a"],
  [style*="background:#090d16"],
  [style*="background: #090d16"],
  [style*="background:#020617"],
  [style*="background: #020617"],
  [style*="background:#111827"],
  [style*="background: #111827"],
  [style*="background:#1e293b"],
  [style*="background: #1e293b"],
  [style*="background:rgba(15,23,42"],
  [style*="background: rgba(15,23,42"],
  [style*="background:rgba(15, 23, 42"],
  [style*="background: rgba(15, 23, 42"],
  [style*="background:rgba(30,41,59"],
  [style*="background: rgba(30,41,59"],
  [style*="background:rgba(30, 41, 59"],
  [style*="background: rgba(30, 41, 59"]
) :is(p, li, label):not([style*="color:#"]):not([style*="color: #"]) {
  color: #e2e8f0 !important;
}

.card :is(
  [style*="background:#0f172a"],
  [style*="background: #0f172a"],
  [style*="background:#1e293b"],
  [style*="background: #1e293b"],
  [style*="background:rgba(15,23,42"],
  [style*="background: rgba(15,23,42"],
  [style*="background:rgba(15, 23, 42"],
  [style*="background: rgba(15, 23, 42"]
) p[style*="text-secondary"],
.card:is(
  [style*="background:#0f172a"],
  [style*="background: #0f172a"],
  [style*="background:#1e293b"],
  [style*="background: #1e293b"],
  [style*="background:rgba(15,23,42"],
  [style*="background: rgba(15,23,42"],
  [style*="background:rgba(15, 23, 42"],
  [style*="background: rgba(15, 23, 42"]
) p[style*="text-secondary"] {
  background: rgba(15, 23, 42, 0.55) !important;
  color: #cbd5e1 !important;
  border-left-color: #38bdf8 !important;
}

:is(
  .course-dossier-card,
  .biblio-section,
  .mb-textbook-plate,
  .gui-window,
  .mol3d-wrapper,
  .terminal-window,
  .vi-editor-screen,
  .mb-aa20-board,
  .mb-multi3d-board,
  .mb-aa3d-card,
  .svg-diagram-card,
  [style*="background:#0f172a"],
  [style*="background: #0f172a"],
  [style*="background:#090d16"],
  [style*="background: #090d16"],
  [style*="background:#020617"],
  [style*="background: #020617"],
  [style*="background:#1e293b"],
  [style*="background: #1e293b"],
  [style*="background:rgba(15,23,42"],
  [style*="background: rgba(15,23,42"],
  [style*="background:rgba(15, 23, 42"],
  [style*="background: rgba(15, 23, 42"],
  [style*="background:rgba(30,41,59"],
  [style*="background: rgba(30,41,59"],
  [style*="background:rgba(30, 41, 59"],
  [style*="background: rgba(30, 41, 59"]
) :not(pre) > code {
  background: rgba(56, 189, 248, 0.16) !important;
  color: #7dd3fc !important;
  border: 1px solid rgba(56, 189, 248, 0.38) !important;
}

:is(
  .mb-aa20-board,
  .mb-multi3d-board,
  .mb-aa3d-card,
  .mol3d-wrapper,
  .gui-window,
  [style*="background:#0f172a"],
  [style*="background: #0f172a"],
  [style*="background:#090d16"],
  [style*="background:rgba(15,23,42"],
  [style*="background: rgba(15,23,42"]
) .btn-outline {
  background: rgba(30, 41, 59, 0.85);
  color: #e2e8f0 !important;
  border-color: #475569;
}

:is(
  .mb-aa20-board,
  .mb-multi3d-board,
  .mb-aa3d-card,
  .mol3d-wrapper,
  .gui-window,
  [style*="background:#0f172a"],
  [style*="background: #0f172a"],
  [style*="background:#090d16"],
  [style*="background:rgba(15,23,42"],
  [style*="background: rgba(15,23,42"]
) .btn-outline:hover {
  background: rgba(56, 189, 248, 0.22);
  color: #ffffff !important;
  border-color: #38bdf8;
}

:is(
  .mb-aa20-board,
  .mb-multi3d-board,
  .mb-aa3d-card,
  .mol3d-wrapper,
  .gui-window
) .btn-outline.active,
:is(
  .mb-aa20-board,
  .mb-multi3d-board,
  .mb-aa3d-card,
  .mol3d-wrapper,
  .gui-window
) .btn.active {
  background: #0284c7 !important;
  color: #ffffff !important;
  border-color: #38bdf8 !important;
}

:is(
  .mb-aa20-board,
  .mb-multi3d-board,
  .mb-aa3d-card,
  .mol3d-wrapper,
  .gui-window,
  [style*="background:#0f172a"],
  [style*="background: #0f172a"],
  [style*="background:rgba(15,23,42"],
  [style*="background: rgba(15,23,42"]
) select {
  background: #1e293b;
  color: #f8fafc;
  border-color: #475569;
}

:is(
  [style*="background:#0f172a"],
  [style*="background: #0f172a"],
  [style*="background:#090d16"],
  [style*="background:rgba(15,23,42"],
  [style*="background: rgba(15,23,42"],
  [style*="background:rgba(15, 23, 42"],
  [style*="background: rgba(15, 23, 42"]
) .katex {
  color: #f8fafc;
}

/* 4. Dark Mode Pedagogical Box Contrast Refinements */
html[data-theme="dark"] .book-subsubhead {
  background: rgba(56, 189, 248, 0.1) !important;
  border-left-color: #38bdf8 !important;
  color: #7dd3fc !important;
}

html[data-theme="dark"] .derivation-title {
  background: rgba(56, 189, 248, 0.12) !important;
  color: #7dd3fc !important;
}

html[data-theme="dark"] .read-aloud-box .read-aloud-title {
  color: #5eead4 !important;
}

html[data-theme="dark"] .simulator-badge {
  background: rgba(56, 189, 248, 0.15) !important;
  color: #7dd3fc !important;
  border-color: rgba(56, 189, 248, 0.35) !important;
}

html[data-theme="dark"] .eq-anatomy-sym {
  background: rgba(56, 189, 248, 0.15) !important;
  color: #7dd3fc !important;
  border-color: rgba(56, 189, 248, 0.35) !important;
}

html[data-theme="dark"] .step-badge-inline {
  background: rgba(56, 189, 248, 0.15) !important;
  color: #7dd3fc !important;
  border-color: rgba(56, 189, 248, 0.35) !important;
}

html[data-theme="dark"] .analogy-box .analogy-title {
  color: #fde68a !important;
}

html[data-theme="dark"] .student-qa-box .qa-q,
html[data-theme="dark"] .student-qa-box .student-qa-title {
  color: #c4b5fd !important;
}

/* ==========================================================================
   AUDIT 2026-11: READABILITY, SCANNABILITY, WAYFINDING & COURSE HARMONIZATION
   ========================================================================== */

/* 1. Top Reading Progress Bar */
#bia-reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 0%;
  height: 3.5px;
  background: linear-gradient(90deg, #0284c7 0%, #6366f1 55%, #d97706 100%);
  z-index: 9999;
  transition: width 0.12s ease-out;
  box-shadow: 0 1px 6px rgba(2, 132, 199, 0.35);
  pointer-events: none;
}

/* 2. Floating Quick-Jump Section Wayfinder */
#bia-wayfinder {
  position: fixed;
  right: 1.5rem;
  bottom: 1.5rem;
  z-index: 990;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.5rem;
  font-family: var(--font-sans, "Inter", -apple-system, sans-serif);
}

.bia-wf-panel {
  display: none;
  width: min(380px, calc(100vw - 2.5rem));
  max-height: 68vh;
  overflow-y: auto;
  background: rgba(255, 255, 255, 0.97);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: 16px;
  box-shadow: 0 20px 45px -12px rgba(15, 23, 42, 0.22);
  padding: 0.9rem;
}

#bia-wayfinder.open .bia-wf-panel {
  display: block;
  animation: biaWfFadeIn 0.18s ease-out;
}

@keyframes biaWfFadeIn {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.bia-wf-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.25rem 0.4rem 0.65rem;
  border-bottom: 1px solid #e2e8f0;
  margin-bottom: 0.5rem;
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #475569;
}

.bia-wf-list {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.bia-wf-item {
  display: flex;
  align-items: baseline;
  gap: 0.55rem;
  padding: 0.48rem 0.65rem;
  border-radius: 9px;
  font-size: 0.83rem;
  font-weight: 500;
  color: #334155;
  text-decoration: none;
  line-height: 1.35;
  transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.bia-wf-item:hover {
  background: #f0f9ff;
  color: #0284c7;
  transform: translateX(2px);
}

.bia-wf-item.active {
  background: linear-gradient(90deg, rgba(2, 132, 199, 0.12), rgba(99, 102, 241, 0.06));
  color: #0369a1;
  font-weight: 700;
  border-left: 3px solid #0284c7;
}

.bia-wf-idx {
  font-size: 0.7rem;
  font-weight: 800;
  color: #0284c7;
  background: rgba(2, 132, 199, 0.1);
  padding: 0.12rem 0.42rem;
  border-radius: 5px;
  flex-shrink: 0;
}

.bia-wf-controls {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.bia-wf-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.58rem 0.95rem;
  border-radius: 999px;
  border: 1px solid rgba(15, 23, 42, 0.14);
  background: rgba(15, 23, 42, 0.92);
  color: #f8fafc;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
  box-shadow: 0 10px 24px -6px rgba(15, 23, 42, 0.35);
  transition: transform 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.bia-wf-btn:hover {
  transform: translateY(-2px);
  background: #0284c7;
  border-color: #0284c7;
}

.bia-wf-top-btn {
  padding: 0.58rem 0.78rem;
  background: rgba(255, 255, 255, 0.95);
  color: #0f172a;
}

.bia-wf-top-btn:hover {
  background: #f1f5f9;
  color: #0284c7;
}

html[data-theme="dark"] .bia-wf-panel {
  background: rgba(15, 23, 42, 0.96);
  border-color: rgba(148, 163, 184, 0.2);
  box-shadow: 0 20px 45px -12px rgba(0, 0, 0, 0.65);
}

html[data-theme="dark"] .bia-wf-header {
  border-bottom-color: #1e293b;
  color: #94a3b8;
}

html[data-theme="dark"] .bia-wf-item {
  color: #cbd5e1;
}

html[data-theme="dark"] .bia-wf-item:hover {
  background: rgba(56, 189, 248, 0.1);
  color: #38bdf8;
}

html[data-theme="dark"] .bia-wf-item.active {
  background: rgba(56, 189, 248, 0.15);
  color: #7dd3fc;
  border-left-color: #38bdf8;
}

html[data-theme="dark"] .bia-wf-idx {
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.15);
}

html[data-theme="dark"] .bia-wf-btn {
  background: rgba(30, 41, 59, 0.95);
  border-color: rgba(56, 189, 248, 0.3);
  color: #f1f5f9;
}

html[data-theme="dark"] .bia-wf-btn:hover {
  background: #0284c7;
}

/* 3. Medicinal Chemistry 2x2 Scannable Treatise Pillar Grid */
.mc-treatise-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.25rem;
  margin: 1.35rem 0 1.6rem;
}

@media (max-width: 960px) {
  .mc-treatise-grid {
    grid-template-columns: 1fr;
  }
}

.mc-pillar-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-top: 3.5px solid #0284c7;
  border-radius: 14px;
  padding: 1.25rem 1.4rem;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.035);
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.mc-pillar-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.065);
}

.mc-pillar-card.mc-pillar-1 { border-top-color: #0284c7; background: linear-gradient(180deg, rgba(240, 249, 255, 0.55) 0%, #ffffff 38%); }
.mc-pillar-card.mc-pillar-2 { border-top-color: #4f46e5; background: linear-gradient(180deg, rgba(238, 242, 255, 0.55) 0%, #ffffff 38%); }
.mc-pillar-card.mc-pillar-3 { border-top-color: #0d9488; background: linear-gradient(180deg, rgba(240, 253, 250, 0.55) 0%, #ffffff 38%); }
.mc-pillar-card.mc-pillar-4 { border-top-color: #d97706; background: linear-gradient(180deg, rgba(255, 251, 235, 0.55) 0%, #ffffff 38%); }

.mc-pillar-head {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-family: var(--font-sans, "Inter", sans-serif);
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: #334155;
  padding-bottom: 0.55rem;
  border-bottom: 1px dashed #e2e8f0;
}

.mc-pillar-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 800;
  padding: 0.16rem 0.46rem;
  border-radius: 6px;
  background: #e0f2fe;
  color: #0369a1;
}

.mc-pillar-2 .mc-pillar-num { background: #e0e7ff; color: #4338ca; }
.mc-pillar-3 .mc-pillar-num { background: #ccfbf1; color: #0f766e; }
.mc-pillar-4 .mc-pillar-num { background: #fef3c7; color: #b45309; }

.mc-pillar-card p.book-paragraph {
  margin: 0 !important;
  font-size: 1.01rem !important;
  line-height: 1.76 !important;
  color: #1e293b;
}

html[data-theme="dark"] .mc-pillar-card {
  background: #0f172a !important;
  border-color: #1e293b !important;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
}

html[data-theme="dark"] .mc-pillar-card.mc-pillar-1 { border-top-color: #38bdf8 !important; }
html[data-theme="dark"] .mc-pillar-card.mc-pillar-2 { border-top-color: #818cf8 !important; }
html[data-theme="dark"] .mc-pillar-card.mc-pillar-3 { border-top-color: #2dd4bf !important; }
html[data-theme="dark"] .mc-pillar-card.mc-pillar-4 { border-top-color: #fbbf24 !important; }

html[data-theme="dark"] .mc-pillar-head {
  color: #cbd5e1;
  border-bottom-color: #1e293b;
}

html[data-theme="dark"] .mc-pillar-num { background: rgba(56, 189, 248, 0.16); color: #7dd3fc; }
html[data-theme="dark"] .mc-pillar-2 .mc-pillar-num { background: rgba(129, 140, 248, 0.16); color: #a5b4fc; }
html[data-theme="dark"] .mc-pillar-3 .mc-pillar-num { background: rgba(45, 212, 191, 0.16); color: #5eead4; }
html[data-theme="dark"] .mc-pillar-4 .mc-pillar-num { background: rgba(251, 191, 36, 0.16); color: #fde68a; }

html[data-theme="dark"] .mc-pillar-card p.book-paragraph {
  color: #e2e8f0 !important;
}

/* 4. Introducao a Quimica (IQ) Complete Course & Johnstone Triangle Styling */
.iq-card,
.iq-lesson-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 18px;
  padding: 2rem 2.25rem;
  margin-bottom: 2rem;
  box-shadow: 0 8px 26px -8px rgba(15, 23, 42, 0.06);
}

.iq-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.85rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  background: #e0f2fe;
  color: #0369a1;
  margin-bottom: 0.75rem;
}

.iq-body-text {
  font-family: var(--font-serif, "Source Serif 4", Georgia, serif);
  font-size: 1.07rem;
  line-height: 1.82;
  color: #1e293b;
  margin: 0.85rem 0 1.25rem;
}

.iq-eq-box {
  background: linear-gradient(135deg, #f8fafc 0%, #f0f9ff 100%);
  border: 1px solid #bae6fd;
  border-left: 4px solid #0284c7;
  border-radius: 12px;
  padding: 1.15rem 1.4rem;
  margin: 1.25rem 0;
  overflow-x: auto;
  font-size: 1.04rem;
  color: #0f172a;
}

.iq-johnstone-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.15rem;
  margin: 1.4rem 0;
}

@media (max-width: 900px) {
  .iq-johnstone-grid {
    grid-template-columns: 1fr;
  }
}

.iq-johnstone-cell {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-top: 3.5px solid #0284c7;
  border-radius: 12px;
  padding: 1.1rem 1.25rem;
  font-size: 0.95rem;
  line-height: 1.65;
  color: #334155;
}

.iq-johnstone-cell:nth-child(2) {
  border-top-color: #6366f1;
}

.iq-johnstone-cell:nth-child(3) {
  border-top-color: #0d9488;
}

.iq-johnstone-cell strong {
  display: block;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #0f172a;
  margin-bottom: 0.4rem;
}

.iq-svg-plate {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 1.1rem;
  margin: 1.35rem 0;
  text-align: center;
}

.iq-svg-plate svg,
.iq-svg-plate img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
}

.iq-quiz-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 1.35rem 1.5rem;
  margin-bottom: 1.15rem;
}

.iq-opt-btn {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.78rem 1.05rem;
  margin: 0.45rem 0;
  border-radius: 10px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #1e293b;
  font-size: 0.95rem;
  line-height: 1.5;
  cursor: pointer;
  transition: all 0.15s ease;
}

.iq-opt-btn:hover {
  border-color: #0284c7;
  background: #f0f9ff;
}

.iq-plate-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.25rem;
  margin: 1.5rem 0;
}

.iq-plate-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.05);
}

html[data-theme="dark"] .iq-card,
html[data-theme="dark"] .iq-lesson-card,
html[data-theme="dark"] .iq-svg-plate,
html[data-theme="dark"] .iq-plate-card {
  background: #0f172a;
  border-color: #1e293b;
  color: #e2e8f0;
}

html[data-theme="dark"] .iq-body-text {
  color: #e2e8f0;
}

html[data-theme="dark"] .iq-eq-box {
  background: rgba(15, 23, 42, 0.85);
  border-color: rgba(56, 189, 248, 0.3);
  border-left-color: #38bdf8;
  color: #f1f5f9;
}

html[data-theme="dark"] .iq-johnstone-cell,
html[data-theme="dark"] .iq-quiz-card {
  background: #1e293b;
  border-color: #334155;
  color: #cbd5e1;
}

html[data-theme="dark"] .iq-johnstone-cell strong {
  color: #f8fafc;
}

html[data-theme="dark"] .iq-opt-btn {
  background: #0f172a;
  border-color: #334155;
  color: #e2e8f0;
}

html[data-theme="dark"] .iq-opt-btn:hover {
  border-color: #38bdf8;
  background: rgba(56, 189, 248, 0.1);
}

/* 5. Enhanced Subsection Visual Separation & Scannability */
.book-subcard {
  scroll-margin-top: 90px;
}

.book-section {
  scroll-margin-top: 84px;
}


/* ==========================================================================
   6. BIA LEARN — BIA STUDIO 3D EDITORIAL BENTO & ARTBOARD DESIGN SYSTEM (2026)
   ========================================================================== */
:root {
  --bia-visual-bg: #070b16;
  --bia-visual-panel: rgba(15, 23, 42, 0.86);
  --bia-visual-border: rgba(56, 189, 248, 0.34);
  --bia-visual-grid-dot: rgba(148, 163, 184, 0.14);
  --bia-visual-glow: 0 20px 50px -12px rgba(2, 132, 199, 0.28), 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.bia-visual-frame {
  position: relative;
  border-radius: 18px;
  overflow: hidden;
  background: radial-gradient(circle at 18% 20%, rgba(14, 165, 233, 0.18), transparent 55%),
              radial-gradient(circle at 82% 80%, rgba(139, 92, 246, 0.18), transparent 55%),
              #070b16;
  border: 1px solid rgba(56, 189, 248, 0.38);
  box-shadow: var(--bia-visual-glow);
  margin: 1.15rem 0 1.5rem;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.25s ease, border-color 0.25s ease;
}

.bia-visual-frame:hover {
  transform: translateY(-3px);
  border-color: rgba(56, 189, 248, 0.72);
  box-shadow: 0 26px 60px -12px rgba(2, 132, 199, 0.38), 0 0 0 1px rgba(56, 189, 248, 0.32);
}

.bia-visual-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.6rem;
  padding: 0.55rem 0.95rem;
  background: rgba(10, 16, 30, 0.92);
  border-bottom: 1px solid rgba(148, 163, 184, 0.2);
  font-family: var(--font-mono, monospace);
  font-size: 0.73rem;
  color: #cbd5e1;
}

.bia-visual-dots {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.bia-visual-dots span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}
.bia-visual-dots span:nth-child(1) { background: #f43f5e; }
.bia-visual-dots span:nth-child(2) { background: #f59e0b; }
.bia-visual-dots span:nth-child(3) { background: #10b981; }

.bia-visual-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.18rem 0.62rem;
  border-radius: 999px;
  background: rgba(56, 189, 248, 0.14);
  border: 1px solid rgba(56, 189, 248, 0.4);
  color: #7dd3fc;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.bia-visual-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.bia-visual-btn {
  font-family: var(--font-sans, sans-serif);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.24rem 0.65rem;
  border-radius: 7px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(30, 41, 59, 0.85);
  color: #f8fafc;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
}

.bia-visual-btn:hover {
  background: #0284c7;
  border-color: #38bdf8;
  color: #ffffff;
}

.bia-visual-canvas {
  position: relative;
  overflow: hidden;
  background-color: #060a14;
  background-image: radial-gradient(rgba(148, 163, 184, 0.16) 1px, transparent 1px);
  background-size: 20px 20px;
}

.bia-visual-canvas img {
  width: 100%;
  height: auto;
  max-height: none;
  object-fit: contain;
  display: block;
  cursor: zoom-in;
  transition: transform 0.35s ease;
}

.bia-visual-frame.fit-contain .bia-visual-canvas img {
  object-fit: contain;
  height: auto;
  max-height: none;
  background: #060a14;
}

/* Lightbox Modal for Fullscreen BIA STUDIO 3D Plate Inspection */
.bia-plate-lightbox {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: rgba(4, 8, 18, 0.92);
  backdrop-filter: blur(12px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.bia-plate-lightbox.open {
  display: flex;
}

.bia-plate-lightbox-inner {
  max-width: 1480px;
  width: 96%;
  background: #090f1e;
  border: 1px solid rgba(56, 189, 248, 0.5);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.75);
}

.bia-plate-lightbox-inner img {
  width: 100%;
  max-height: 82vh;
  object-fit: contain;
  display: block;
  background: #050914;
}

/* ==========================================================================
   TEXTBOOK DEPTH COMPONENTS (QM-style chapters for QO / QI / QBI / IQ / MC)
   ========================================================================== */
.learning-outcomes { margin: 0.75rem 0 0; padding-left: 1.2rem; font-size: 0.92rem; line-height: 1.65; }
.learning-outcomes li { margin: 0.2rem 0; }
.worked-example {
  font-family: 'Inter', sans-serif; margin: 1.4rem 0; border-radius: 12px; overflow: hidden;
  border: 1px solid rgba(99, 102, 241, 0.35); background: rgba(99, 102, 241, 0.05);
}
.worked-example .we-head {
  display: flex; gap: 0.6rem; align-items: center; padding: 0.7rem 1.1rem;
  background: linear-gradient(90deg, rgba(99, 102, 241, 0.16), rgba(56, 189, 248, 0.08));
  font-weight: 800; font-size: 0.95rem; color: #4338ca;
}
.worked-example .we-body { padding: 0.9rem 1.2rem 1.05rem; font-size: 0.93rem; line-height: 1.7; }
.worked-example .we-problem { margin: 0 0 0.6rem; }
.worked-example ol.we-steps { margin: 0.4rem 0 0.6rem; padding-left: 1.3rem; }
.worked-example ol.we-steps li { margin: 0.35rem 0; }
.worked-example .we-answer {
  margin-top: 0.6rem; padding: 0.55rem 0.8rem; border-radius: 8px;
  background: rgba(16, 185, 129, 0.1); border-left: 3px solid #10b981; font-weight: 600;
}
.worked-example .we-check { margin-top: 0.45rem; font-size: 0.86rem; opacity: 0.9; }
.misconception-box {
  font-family: 'Inter', sans-serif; margin: 1.35rem 0; padding: 1rem 1.25rem; border-radius: 12px;
  border-left: 4px solid #e11d48; background: rgba(225, 29, 72, 0.06); font-size: 0.93rem; line-height: 1.65;
}
.misconception-box .mc-title { font-weight: 800; color: #be123c; margin-bottom: 0.4rem; }
.misconception-box ul { margin: 0.2rem 0 0; padding-left: 1.1rem; }
.misconception-box li { margin: 0.35rem 0; }
.callout-box {
  font-family: 'Inter', sans-serif; margin: 1.35rem 0; padding: 1rem 1.25rem; border-radius: 12px;
  border-left: 4px solid #d97706; background: rgba(245, 158, 11, 0.07); font-size: 0.93rem; line-height: 1.65;
}
.callout-box.history { border-left-color: #7c3aed; background: rgba(124, 58, 237, 0.06); }
.callout-box.lab { border-left-color: #0891b2; background: rgba(8, 145, 178, 0.06); }
.callout-box .cb-title { font-weight: 800; margin-bottom: 0.35rem; }
.tb-figure { margin: 1.4rem 0; padding: 0.9rem; border-radius: 12px; border: 1px solid rgba(148, 163, 184, 0.3); background: var(--bg-secondary, rgba(148,163,184,0.06)); }
.tb-figure svg { width: 100%; height: auto; display: block; color: var(--text-primary, #0f172a); }
.tb-figure figcaption { margin-top: 0.6rem; font-size: 0.86rem; line-height: 1.55; opacity: 0.92; }
.exercise-set { margin: 1.6rem 0; font-family: 'Inter', sans-serif; }
.exercise-set .ex-title { font-weight: 800; font-size: 1.02rem; margin-bottom: 0.6rem; }
.exercise-item { border: 1px solid rgba(148, 163, 184, 0.35); border-radius: 10px; padding: 0.75rem 1rem; margin: 0.6rem 0; font-size: 0.92rem; line-height: 1.65; }
.exercise-item .ex-level { display: inline-block; font-size: 0.7rem; font-weight: 800; letter-spacing: 0.04em; padding: 0.12rem 0.5rem; border-radius: 999px; margin-right: 0.4rem; }
.ex-level.l1 { background: rgba(16, 185, 129, 0.15); color: #047857; }
.ex-level.l2 { background: rgba(245, 158, 11, 0.16); color: #b45309; }
.ex-level.l3 { background: rgba(225, 29, 72, 0.14); color: #be123c; }
.exercise-item details { margin-top: 0.45rem; }
.exercise-item summary { cursor: pointer; font-weight: 700; color: #2563eb; }
.exercise-item .ex-solution { margin-top: 0.45rem; padding: 0.6rem 0.8rem; border-radius: 8px; background: rgba(37, 99, 235, 0.06); }
.tb-widget { margin-top: 0.4rem; }
[data-theme="dark"] .worked-example .we-head { color: #c7d2fe; }
[data-theme="dark"] .misconception-box .mc-title { color: #fda4af; }
[data-theme="dark"] .ex-level.l1 { color: #6ee7b7; }
[data-theme="dark"] .ex-level.l2 { color: #fcd34d; }
[data-theme="dark"] .ex-level.l3 { color: #fda4af; }
[data-theme="dark"] .exercise-item summary { color: #93c5fd; }

.eq-anatomy-item .eq-anatomy-sym { margin-right: 0.55rem; }
.eq-anatomy-item { gap: 0.5rem; }

/* ==========================================================================
   7. UNIFIED CROSS-COURSE COMPONENT CLASSES (ENSURING ZERO UNSTYLED ELEMENTS)
   ========================================================================== */

/* 7.1 Site Header (Landing Page & Course Catalog) */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  min-height: var(--nav-h, 64px);
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--border, #e2e8f0);
}
html[data-theme="dark"] .site-header {
  background: rgba(11, 17, 32, 0.88);
  border-bottom-color: rgba(148, 163, 184, 0.16);
}
.header-inner {
  max-width: var(--max-width, 1440px);
  margin: 0 auto;
  padding: 0.65rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}
.brand-badge {
  width: 40px;
  height: 40px;
  border-radius: 11px;
  background: linear-gradient(135deg, #2563eb 0%, #0284c7 55%, #6366f1 100%);
  color: #ffffff;
  font-family: var(--font-head, 'Inter', sans-serif);
  font-weight: 800;
  font-size: 0.88rem;
  letter-spacing: 0.03em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}
.site-header .brand-text h1 {
  font-size: 1.05rem;
  font-weight: 800;
  margin: 0;
  line-height: 1.15;
  color: var(--text-primary);
}
.site-header .brand-text p {
  font-family: var(--font-sans, 'Inter', sans-serif);
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  margin: 0.1rem 0 0;
  line-height: 1.25;
}
.header-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.65rem;
}
.course-Minimal-switcher {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.nav-pill,
.nav-link {
  font-family: var(--font-sans, 'Inter', sans-serif);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
  padding: 0.42rem 0.8rem;
  border-radius: 999px;
  text-decoration: none !important;
  transition: all 0.18s ease;
  border: 1px solid transparent;
}
.nav-pill:hover,
.nav-link:hover {
  color: var(--text-primary);
  background: var(--surface-alt);
}
.nav-pill.active,
.nav-link.active {
  background: rgba(2, 132, 199, 0.12);
  color: var(--accent-blue, #0284c7);
  border-color: rgba(2, 132, 199, 0.28);
  font-weight: 700;
}
html[data-theme="dark"] .nav-pill.active,
html[data-theme="dark"] .nav-link.active {
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
  border-color: rgba(56, 189, 248, 0.35);
}
.icon-btn,
.btn-icon,
.icon-only {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  min-width: 36px;
  height: 36px;
  padding: 0 0.65rem;
  border-radius: 9px;
  border: 1px solid var(--border-strong, #cbd5e1);
  background: var(--surface, #ffffff);
  color: var(--text-primary);
  font-family: var(--font-sans, 'Inter', sans-serif);
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.18s ease;
}
.icon-btn:hover,
.btn-icon:hover,
.icon-only:hover {
  border-color: var(--accent-blue, #0284c7);
  color: var(--accent-blue, #0284c7);
}
.theme-icon {
  font-size: 0.95rem;
  line-height: 1;
}

/* 7.2 BIA STUDIO 3D Artboard Variant Classes Used Across Course Blocks */
.bia-visual-dots {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.bia-visual-dots span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}
.bia-visual-dots span:nth-child(1) { background: #f43f5e; }
.bia-visual-dots span:nth-child(2) { background: #f59e0b; }
.bia-visual-dots span:nth-child(3) { background: #10b981; }

.bia-visual-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.18rem 0.65rem;
  border-radius: 999px;
  background: rgba(56, 189, 248, 0.14);
  border: 1px solid rgba(56, 189, 248, 0.4);
  color: #7dd3fc;
  font-family: var(--font-sans, 'Inter', sans-serif);
  font-size: 0.73rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.bia-visual-actions {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.45rem;
}
.bia-visual-btn {
  font-family: var(--font-sans, 'Inter', sans-serif);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.26rem 0.68rem;
  border-radius: 7px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(30, 41, 59, 0.88);
  color: #f8fafc;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none !important;
}
.bia-visual-btn:hover {
  background: #0284c7;
  border-color: #38bdf8;
  color: #ffffff;
}
.bia-visual-caption {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding: 0.75rem 1.05rem;
  background: rgba(10, 16, 30, 0.94);
  border-top: 1px solid rgba(148, 163, 184, 0.18);
  color: #cbd5e1;
  font-family: var(--font-sans, 'Inter', sans-serif);
  font-size: 0.82rem;
  line-height: 1.5;
}
.bia-visual-meta {
  font-family: var(--font-mono, monospace);
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.2rem 0.55rem;
  border-radius: 6px;
  background: rgba(148, 163, 184, 0.14);
  color: #94a3b8;
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.section-concept-artboard {
  margin: 1.25rem 0 1.5rem;
}

/* 7.3 Quiz Scoreboard, Filter Chips & Progress Track */
.quiz-scoreboard-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 0.75rem;
}
.quiz-score-title {
  font-family: var(--font-head, 'Inter', sans-serif);
  font-size: 1.06rem;
  font-weight: 800;
  color: var(--text-primary);
}
.quiz-score-badge {
  font-family: var(--font-mono, monospace);
  font-size: 0.85rem;
  font-weight: 800;
  padding: 0.35rem 0.8rem;
  border-radius: 999px;
  background: rgba(2, 132, 199, 0.12);
  border: 1px solid rgba(2, 132, 199, 0.32);
  color: var(--accent-blue, #0284c7);
  white-space: nowrap;
}
html[data-theme="dark"] .quiz-score-badge {
  background: rgba(56, 189, 248, 0.15);
  border-color: rgba(56, 189, 248, 0.38);
  color: #38bdf8;
}
.chip {
  font-family: var(--font-sans, 'Inter', sans-serif);
  font-size: 0.76rem;
  font-weight: 600;
  padding: 0.32rem 0.72rem;
  border-radius: 999px;
  border: 1px solid var(--border-strong, #cbd5e1);
  background: var(--surface, #ffffff);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
}
.chip:hover {
  border-color: var(--accent-blue, #0284c7);
  color: var(--text-primary);
}
.chip.active {
  background: var(--accent-blue, #0284c7);
  border-color: var(--accent-blue, #0284c7);
  color: #ffffff;
}
.quiz-progress-track {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: var(--surface-alt, #e2e8f0);
  overflow: hidden;
  margin: 0.65rem 0 0.85rem;
}
.quiz-progress-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, #0284c7 0%, #10b981 100%);
  transition: width 0.3s ease;
}

/* 7.4 IQ (Introduction to Chemistry) Layout & Component Classes */
.iq-container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 1.5rem 1.5rem 3.5rem;
}
.iq-hero {
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 55%, #0c4a6e 100%);
  color: #f8fafc;
  padding: 2.4rem 2.2rem;
  border-radius: 20px;
  margin: 0.5rem 0 1.85rem;
  box-shadow: 0 18px 40px -12px rgba(15, 23, 42, 0.25);
  border-top: 4px solid #38bdf8;
}
.iq-hero h1,
.iq-hero h2,
.iq-hero h3 {
  color: #ffffff;
}
.iq-grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 1.5rem;
}
.iq-grid-2 .iq-grid-2 {
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
}
.iq-grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
  gap: 1.2rem;
}
.iq-grid-4 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 1rem;
}
.iq-grid-2 > *,
.iq-grid-3 > *,
.iq-grid-4 > *,
.iq-card,
.iq-lesson-card,
.iq-plate-card,
.iq-quiz-card,
.iq-johnstone-cell {
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}
video {
  max-width: 100%;
  height: auto;
}
.iq-plate-card img {
  width: 100%;
  max-width: 100%;
  height: auto;
  display: block;
  object-fit: contain;
}
.iq-plate-card video {
  width: 100%;
  max-width: 100%;
  height: 190px;
  object-fit: cover;
  display: block;
  background: #050914;
}
.iq-hero .iq-plate-card video {
  height: 290px;
  max-height: 320px;
  object-fit: cover;
}
@media (max-width: 768px) {
  .iq-grid-2,
  .iq-grid-3,
  .iq-grid-4 {
    grid-template-columns: 1fr;
  }
}
.iq-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  font-family: var(--font-sans, 'Inter', sans-serif);
  font-size: 0.86rem;
  font-weight: 700;
  padding: 0.62rem 1.15rem;
  border-radius: 10px;
  text-decoration: none !important;
  cursor: pointer;
  transition: all 0.18s ease;
  border: 1px solid var(--border-strong, #cbd5e1);
  background: var(--surface, #ffffff);
  color: var(--text-primary);
}
.iq-btn-primary {
  background: linear-gradient(135deg, #0284c7, #2563eb);
  color: #ffffff !important;
  border-color: transparent;
  box-shadow: 0 6px 16px rgba(2, 132, 199, 0.28);
}
.iq-btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(2, 132, 199, 0.36);
}
.iq-btn-outline {
  background: var(--surface, #ffffff);
  color: var(--text-primary);
  border: 1px solid var(--border-strong, #cbd5e1);
}
.iq-btn-outline:hover {
  border-color: var(--accent-blue, #0284c7);
  color: var(--accent-blue, #0284c7);
}
.iq-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-top: 1.65rem;
  padding-top: 1.4rem;
  border-top: 1px solid rgba(148, 163, 184, 0.25);
}
.iq-stat-box {
  background: rgba(15, 23, 42, 0.55);
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: 12px;
  padding: 0.9rem 1.05rem;
}
.iq-stat-box .val {
  font-family: var(--font-head, 'Inter', sans-serif);
  font-size: 1.25rem;
  font-weight: 800;
  color: #38bdf8;
  margin-bottom: 0.2rem;
}
.iq-stat-box .lbl {
  font-family: var(--font-sans, 'Inter', sans-serif);
  font-size: 0.78rem;
  line-height: 1.45;
  color: #cbd5e1;
}
.iq-plate-caption {
  padding: 0.75rem 1rem;
  font-family: var(--font-sans, 'Inter', sans-serif);
  font-size: 0.82rem;
  line-height: 1.5;
  color: var(--text-secondary);
  border-top: 1px solid var(--border, #e2e8f0);
}
.iq-table,
.chem-table,
.comparison-table,
.equation-table,
.qm-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-sans, 'Inter', sans-serif);
  font-size: 0.86rem;
  margin: 1rem 0;
}
.iq-table th, .iq-table td,
.chem-table th, .chem-table td,
.comparison-table th, .comparison-table td,
.equation-table th, .equation-table td,
.qm-table th, .qm-table td {
  border: 1px solid var(--border, #e2e8f0);
  padding: 0.6rem 0.8rem;
  text-align: left;
  vertical-align: top;
}
.iq-table th,
.chem-table th,
.comparison-table th,
.equation-table th,
.qm-table th {
  background: var(--surface-alt, #f1f5f9);
  font-weight: 700;
  color: var(--text-primary);
}
.table-responsive,
.table-wrapper,
.equation-table-wrap {
  width: 100%;
  overflow-x: auto;
  margin: 1rem 0;
}
.iq-callout-info,
.callout-info {
  font-family: var(--font-sans, 'Inter', sans-serif);
  background: rgba(2, 132, 199, 0.07);
  border-left: 4px solid #0284c7;
  border-radius: 10px;
  padding: 0.95rem 1.2rem;
  margin: 1rem 0;
  font-size: 0.92rem;
  line-height: 1.6;
}
.iq-callout-warn,
.callout-warning {
  font-family: var(--font-sans, 'Inter', sans-serif);
  background: rgba(245, 158, 11, 0.08);
  border-left: 4px solid #d97706;
  border-radius: 10px;
  padding: 0.95rem 1.2rem;
  margin: 1rem 0;
  font-size: 0.92rem;
  line-height: 1.6;
}
.iq-opts-list {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin-top: 0.65rem;
}
.iq-feedback-msg,
.mc-quiz-fb {
  font-family: var(--font-sans, 'Inter', sans-serif);
  font-size: 0.88rem;
  line-height: 1.55;
  margin-top: 0.6rem;
  padding: 0.65rem 0.9rem;
  border-radius: 8px;
}

/* 7.5 Book Layout, Pager, Worked Examples & Block 6 / Block 8 Compatibility */
.book-content {
  min-width: 0;
}
.top-banner {
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 60%, #1e1b4b 100%);
  color: #f8fafc;
  padding: 1.5rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.25);
}
.banner-inner {
  max-width: var(--max-width, 1440px);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}
.top-banner .brand-title {
  color: #ffffff;
  font-size: clamp(1.25rem, 2.4vw, 1.75rem);
  margin: 0.25rem 0 0;
}
.brand-tag {
  display: inline-block;
  font-family: var(--font-mono, monospace);
  font-size: 0.74rem;
  font-weight: 700;
  color: #38bdf8;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.Quick-nav-link,
.quick-link {
  display: inline-flex;
  align-items: center;
  padding: 0.42rem 0.85rem;
  border-radius: 999px;
  font-family: var(--font-sans, 'Inter', sans-serif);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--surface, #ffffff);
  border: 1px solid var(--border, #e2e8f0);
  text-decoration: none !important;
  transition: all 0.15s ease;
}
.Quick-nav-link:hover,
.Quick-nav-link.active,
.quick-link:hover {
  background: var(--accent-blue, #0284c7);
  color: #ffffff;
  border-color: var(--accent-blue, #0284c7);
}
.pager-btn,
.chapter-pager-link,
.pager-card {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.7rem 1.15rem;
  border-radius: 12px;
  background: var(--surface, #ffffff);
  border: 1px solid var(--border-strong, #cbd5e1);
  color: var(--text-primary);
  font-family: var(--font-sans, 'Inter', sans-serif);
  font-size: 0.88rem;
  font-weight: 700;
  text-decoration: none !important;
  box-shadow: var(--shadow-xs);
  transition: all 0.18s ease;
}
.pager-btn:hover,
.chapter-pager-link:hover,
.pager-card:hover {
  border-color: var(--accent-blue, #0284c7);
  color: var(--accent-blue, #0284c7);
  transform: translateY(-1px);
}
.subsection-card,
.worked-example-box,
.worked-example-card,
.tsb-q-card,
.mc-treatise-en-box,
.textbook-pedagogy-panel,
.hist-card,
.dvs-card,
.hub-lab-box,
.md-ts-card {
  background: var(--surface, #ffffff);
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 14px;
  padding: 1.25rem 1.4rem;
  margin: 1.15rem 0;
  box-shadow: var(--shadow-xs);
}
.we-title,
.worked-example-title,
.we-header {
  font-family: var(--font-head, 'Inter', sans-serif);
  font-weight: 800;
  font-size: 0.98rem;
  color: var(--accent-blue, #0284c7);
  margin-bottom: 0.5rem;
}
.eq-term-card {
  background: var(--surface-sunken, #f8fafc);
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 10px;
  padding: 0.65rem 0.85rem;
  font-family: var(--font-sans, 'Inter', sans-serif);
  font-size: 0.86rem;
}
.eq-sym,
.eq-symbol,
.eq-term-symbol {
  font-family: var(--font-mono, monospace);
  font-weight: 700;
  color: var(--accent-blue, #0284c7);
  margin-right: 0.4rem;
}
.qm-readout-label {
  font-family: var(--font-sans, 'Inter', sans-serif);
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.qm-readout-value {
  font-family: var(--font-mono, monospace);
  font-size: 1.02rem;
  font-weight: 800;
  color: var(--text-primary);
}
.qm-control-item {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.code-block-title,
.code-header {
  font-family: var(--font-mono, monospace);
  font-size: 0.76rem;
  font-weight: 700;
  padding: 0.45rem 0.85rem;
  background: #0f172a;
  color: #38bdf8;
  border-radius: 10px 10px 0 0;
  border-bottom: 1px solid rgba(148, 163, 184, 0.2);
}
.btn-publisher-direct {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-family: var(--font-sans, 'Inter', sans-serif);
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.35rem 0.75rem;
  border-radius: 8px;
  background: rgba(2, 132, 199, 0.1);
  color: var(--accent-blue, #0284c7);
  border: 1px solid rgba(2, 132, 199, 0.28);
  text-decoration: none !important;
}
.btn-publisher-direct:hover {
  background: var(--accent-blue, #0284c7);
  color: #ffffff;
}
.hero-subtitle {
  font-family: var(--font-sans, 'Inter', sans-serif);
  font-size: 1.04rem;
  line-height: 1.68;
  color: var(--text-secondary);
  max-width: 920px;
  margin: 0.5rem auto 1.25rem;
}
.toc-list,
.toc-sublist,
.toc-sub {
  list-style: none;
  padding-left: 0;
  margin: 0.4rem 0;
}
.toc-sublist,
.toc-sub {
  padding-left: 0.85rem;
  border-left: 2px solid var(--border, #e2e8f0);
  margin-top: 0.3rem;
}
.toc-list li {
  margin: 0.35rem 0;
  font-family: var(--font-sans, 'Inter', sans-serif);
  font-size: 0.84rem;
  line-height: 1.45;
}
.giants-grid,
.qm-giants-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1.1rem;
  margin: 1.25rem 0;
}
.giant-name {
  font-family: var(--font-head, 'Inter', sans-serif);
  font-weight: 800;
  font-size: 0.98rem;
  color: var(--text-primary);
}
.giant-years {
  font-family: var(--font-mono, monospace);
  font-size: 0.75rem;
  color: var(--accent-blue, #0284c7);
  font-weight: 700;
}
.giant-bio {
  font-size: 0.84rem;
  line-height: 1.55;
  color: var(--text-secondary);
}
.hist-card img,
.giants-grid .giant-card > img {
  width: 100% !important;
  aspect-ratio: 3 / 4 !important;
  height: auto !important;
  object-fit: cover !important;
  object-position: center 15% !important;
  border-radius: 10px;
  display: block;
  margin-bottom: 0.65rem;
}

/* ==========================================================================
   EQUATION & TEXT LEGIBILITY ENHANCEMENTS (LIGHT & DARK MODE)
   ========================================================================== */
.katex {
  font-size: 1.06em;
  color: inherit;
}
.katex-display {
  overflow-x: auto;
  overflow-y: hidden;
  padding: 0.45rem 0.25rem;
  margin: 0.85rem 0;
  max-width: 100%;
}
.equation-box,
.qm-eq,
.math-block,
.derivation-box {
  color: var(--text-primary, #0f172a);
}
[data-theme="dark"] .katex,
[data-theme="dark"] .katex-display,
[data-theme="dark"] .equation-box,
[data-theme="dark"] .qm-eq,
[data-theme="dark"] .math-block,
[data-theme="dark"] .derivation-box,
[data-theme="dark"] .iq-johnstone-cell p {
  color: #f1f5f9 !important;
}
[data-theme="dark"] .derivation-title {
  color: #60a5fa !important;
}
[data-theme="dark"] .student-qa-box .qa-q {
  color: #fbbf24 !important;
}
[data-theme="dark"] .read-aloud-box strong {
  color: #c4b5fd !important;
}
[data-theme="dark"] [style*="color:#334155"],
[data-theme="dark"] [style*="color: #334155"],
[data-theme="dark"] [style*="color:#1e293b"],
[data-theme="dark"] [style*="color: #1e293b"],
[data-theme="dark"] [style*="color:#0f172a"],
[data-theme="dark"] [style*="color: #0f172a"],
[data-theme="dark"] [style*="color:#475569"],
[data-theme="dark"] [style*="color: #475569"] {
  color: #e2e8f0 !important;
}
.iq-opt-btn.correct {
  background: rgba(16, 185, 129, 0.14) !important;
  border-color: #10b981 !important;
  color: #065f46 !important;
  font-weight: 700;
}
.iq-opt-btn.wrong {
  background: rgba(239, 68, 68, 0.12) !important;
  border-color: #ef4444 !important;
  color: #991b1b !important;
}
[data-theme="dark"] .iq-opt-btn.correct {
  background: rgba(16, 185, 129, 0.22) !important;
  border-color: #34d399 !important;
  color: #a7f3d0 !important;
}
[data-theme="dark"] .iq-opt-btn.wrong {
  background: rgba(239, 68, 68, 0.22) !important;
  border-color: #f87171 !important;
  color: #fecaca !important;
}
[data-theme="dark"] .iq-card h2,
[data-theme="dark"] .iq-card h3,
[data-theme="dark"] .iq-card h4,
[data-theme="dark"] .iq-lesson-card h3,
[data-theme="dark"] .iq-lesson-card h4,
[data-theme="dark"] .iq-quiz-card h4 {
  color: #f8fafc !important;
}
[data-theme="dark"] .iq-callout-info,
[data-theme="dark"] .callout-info {
  background: rgba(56, 189, 248, 0.12) !important;
  color: #e0f2fe !important;
  border-left-color: #38bdf8 !important;
}
[data-theme="dark"] .iq-callout-warn,
[data-theme="dark"] .callout-warning {
  background: rgba(245, 158, 11, 0.14) !important;
  color: #fef3c7 !important;
  border-left-color: #fbbf24 !important;
}
[data-theme="dark"] .iq-card [style*="background:#f8fafc"],
[data-theme="dark"] .iq-card [style*="background: #f8fafc"],
[data-theme="dark"] .iq-card [style*="background:#f0f9ff"],
[data-theme="dark"] .iq-card [style*="background:#fef3c7"] {
  background: rgba(30, 41, 59, 0.85) !important;
  border-color: rgba(148, 163, 184, 0.28) !important;
  color: #e2e8f0 !important;
}
.nav-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-family: var(--font-head, 'Inter', sans-serif);
  font-weight: 800;
  font-size: 0.96rem;
  color: var(--text-primary);
  text-decoration: none !important;
}
.nav-brand:hover {
  color: var(--accent-blue, #0284c7);
}
body.lang-mode-en .lang-pt {
  display: none !important;
}
body:not(.lang-mode-en):not(.lang-en-active) html:not([data-lang="en"]) .lang-en {
  display: none !important;
}

/* ============================================================================
   INTERACTIVE SIMULATOR PEDAGOGICAL GUIDE & CLICKABLE SELECTOR EXPLANATIONS
   ============================================================================ */
.qm-sim-guide-box {
  background: linear-gradient(135deg, rgba(2, 132, 199, 0.08), rgba(13, 148, 136, 0.07));
  border: 1px solid rgba(2, 132, 199, 0.28);
  border-left: 4px solid #0284c7;
  border-radius: 12px;
  padding: 0.9rem 1.15rem;
  margin: 0.55rem 0 1rem;
  font-family: var(--font-sans, 'Inter', sans-serif);
  font-size: 0.87rem;
  line-height: 1.56;
  color: var(--text-primary, #0f172a);
}
[data-theme="dark"] .qm-sim-guide-box {
  background: linear-gradient(135deg, rgba(2, 132, 199, 0.14), rgba(13, 148, 136, 0.12));
  border-color: rgba(56, 189, 248, 0.32);
  border-left-color: #38bdf8;
  color: #e2e8f0;
}
.qm-sim-guide-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.45rem;
}
.qm-sim-guide-title {
  font-weight: 800;
  font-size: 0.9rem;
  color: #0369a1;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}
[data-theme="dark"] .qm-sim-guide-title {
  color: #38bdf8;
}
.qm-toggle-all-help-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-family: var(--font-sans, 'Inter', sans-serif);
  font-size: 0.76rem;
  font-weight: 700;
  padding: 0.26rem 0.7rem;
  border-radius: 999px;
  border: 1px solid rgba(2, 132, 199, 0.38);
  background: rgba(255, 255, 255, 0.85);
  color: #0369a1;
  cursor: pointer;
  transition: all 0.15s ease;
}
.qm-toggle-all-help-btn:hover {
  background: #0284c7;
  color: #ffffff;
  border-color: #0284c7;
}
[data-theme="dark"] .qm-toggle-all-help-btn {
  background: rgba(15, 23, 42, 0.75);
  color: #38bdf8;
  border-color: rgba(56, 189, 248, 0.4);
}
[data-theme="dark"] .qm-toggle-all-help-btn:hover {
  background: #0284c7;
  color: #ffffff;
}
.qm-ctrl-help {
  margin-top: 0.42rem;
  border-radius: 8px;
  font-family: var(--font-sans, 'Inter', sans-serif);
}
.qm-ctrl-help > summary {
  list-style: none;
  display: inline-flex;
  align-items: center;
  gap: 0.32rem;
  font-size: 0.75rem;
  font-weight: 700;
  color: #0284c7;
  background: rgba(2, 132, 199, 0.09);
  border: 1px solid rgba(2, 132, 199, 0.25);
  border-radius: 999px;
  padding: 0.18rem 0.62rem;
  cursor: pointer;
  user-select: none;
  transition: all 0.15s ease;
}
.qm-ctrl-help > summary::-webkit-details-marker {
  display: none;
}
.qm-ctrl-help > summary:hover {
  background: rgba(2, 132, 199, 0.18);
  border-color: #0284c7;
}
.qm-ctrl-help[open] > summary {
  background: #0284c7;
  color: #ffffff;
  border-color: #0284c7;
}
[data-theme="dark"] .qm-ctrl-help > summary {
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.12);
  border-color: rgba(56, 189, 248, 0.3);
}
[data-theme="dark"] .qm-ctrl-help[open] > summary {
  background: #0284c7;
  color: #ffffff;
}
.qm-ctrl-help-body {
  margin-top: 0.42rem;
  padding: 0.62rem 0.78rem;
  border-radius: 8px;
  background: var(--surface, #ffffff);
  border: 1px solid rgba(2, 132, 199, 0.24);
  border-left: 3px solid #0284c7;
  font-size: 0.81rem;
  line-height: 1.5;
  color: var(--text-secondary, #334155);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.05);
}
[data-theme="dark"] .qm-ctrl-help-body {
  background: rgba(15, 23, 42, 0.88);
  border-color: rgba(56, 189, 248, 0.28);
  border-left-color: #38bdf8;
  color: #cbd5e1;
}
.qm-preset-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  margin: 0.5rem 0 0.85rem;
}
.qm-preset-btn {
  font-family: var(--font-sans, 'Inter', sans-serif);
  font-size: 0.77rem;
  font-weight: 700;
  padding: 0.32rem 0.72rem;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.42);
  background: var(--surface, #ffffff);
  color: var(--text-primary, #1e293b);
  cursor: pointer;
  transition: all 0.15s ease;
}
.qm-preset-btn:hover {
  border-color: #0284c7;
  background: rgba(2, 132, 199, 0.09);
  color: #0369a1;
}
[data-theme="dark"] .qm-preset-btn {
  background: rgba(30, 41, 59, 0.85);
  color: #e2e8f0;
  border-color: rgba(148, 163, 184, 0.35);
}
[data-theme="dark"] .qm-preset-btn:hover {
  border-color: #38bdf8;
  background: rgba(56, 189, 248, 0.16);
  color: #38bdf8;
}
.qm-live-diag-box {
  margin-top: 0.75rem;
  padding: 0.78rem 1rem;
  border-radius: 10px;
  background: rgba(13, 148, 136, 0.07);
  border: 1px solid rgba(13, 148, 136, 0.28);
  border-left: 4px solid #0d9488;
  font-family: var(--font-sans, 'Inter', sans-serif);
  font-size: 0.85rem;
  line-height: 1.54;
  color: var(--text-primary, #0f172a);
}
[data-theme="dark"] .qm-live-diag-box {
  background: rgba(13, 148, 136, 0.13);
  border-color: rgba(45, 212, 191, 0.3);
  border-left-color: #2dd4bf;
  color: #e2e8f0;
}




