/* Flexthink course shell — shared chrome for PBI + IA.
   Layout: sticky header + sidebar + main + mobile drawer.
   Courses override --primary (and related) for brand accent. */

/* Auth chrome toggles `hidden`; keep it winning over `display` rules below. */
[hidden] { display: none !important; }

:root {
  --bg: #f5f7fa;
  --card: #ffffff;
  --card-alt: #f8fafc;
  --text: #0f172a;
  --muted: #475569;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --primary: #0064d0;
  --primary-soft: #dbeafe;
  --success: #16a34a;
  --success-soft: #dcfce7;
  --warning: #ea580c;
  --warning-soft: #fff1e6;
  --code-bg: #f1f5f9;
  --code-border: #e2e8f0;
  --sidebar-w: 300px;
  --header-h: 60px;
  --radius: 10px;
  --radius-sm: 6px;
  --font-ui: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --flexauth-bg: var(--bg);
  --flexauth-card: var(--card);
  --flexauth-ink: var(--text);
  --flexauth-ink-soft: var(--muted);
  --flexauth-line: var(--border);
  --flexauth-accent: var(--primary);
  --flexauth-on-accent: #ffffff;
  --flexauth-radius: var(--radius);
  --flexauth-radius-sm: var(--radius-sm);
  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

/* Dark is the product default when theme is auto (matches PBI shell). */
:root:not([data-theme="light"]) {
  color-scheme: dark;
  --bg: #0e1520;
  --card: #1a2332;
  --card-alt: #131b27;
  --text: #f1f5f9;
  --muted: #cbd5e1;
  --border: #2d3a4f;
  --border-strong: #3f5068;
  --primary: #4dabf7;
  --primary-soft: rgba(77, 171, 247, 0.15);
  --success: #4ade80;
  --success-soft: rgba(74, 222, 128, 0.15);
  --warning: #fb923c;
  --warning-soft: rgba(251, 146, 60, 0.13);
  --code-bg: #0b111c;
  --code-border: #2d3a4f;
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f5f7fa;
  --card: #ffffff;
  --card-alt: #f8fafc;
  --text: #0f172a;
  --muted: #475569;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --primary: #0064d0;
  --primary-soft: #dbeafe;
  --success: #16a34a;
  --success-soft: #dcfce7;
  --warning: #ea580c;
  --warning-soft: #fff1e6;
  --code-bg: #f1f5f9;
  --code-border: #e2e8f0;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0e1520;
  --card: #1a2332;
  --card-alt: #131b27;
  --text: #f1f5f9;
  --muted: #cbd5e1;
  --border: #2d3a4f;
  --border-strong: #3f5068;
  --primary: #4dabf7;
  --primary-soft: rgba(77, 171, 247, 0.15);
  --success: #4ade80;
  --success-soft: rgba(74, 222, 128, 0.15);
  --warning: #fb923c;
  --warning-soft: rgba(251, 146, 60, 0.13);
  --code-bg: #0b111c;
  --code-border: #2d3a4f;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-ui);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* —— Header —— */
.course-header,
header.course-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  padding-top: env(safe-area-inset-top, 0px);
  background: var(--card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding-left: 20px;
  padding-right: 20px;
  gap: 16px;
}
.course-header .brand {
  font-weight: 600;
  font-size: 15px;
  color: var(--text);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-decoration: none;
}
.course-header .brand small {
  color: var(--muted);
  font-weight: 400;
  margin-left: 8px;
}
.course-header .progress-mini {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
}
.course-header .progress-mini .bar {
  width: 100px;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}
.course-header .progress-mini .bar > div {
  height: 100%;
  background: var(--primary);
  transition: width 0.3s;
}
.course-header button,
.course-header .hdr-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  cursor: pointer;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  min-width: 40px;
  justify-content: center;
  font-family: inherit;
}
.course-header button:hover,
.course-header button:active,
.course-header .hdr-btn:hover,
.course-header .hdr-btn:active {
  background: var(--card-alt);
  border-color: var(--border-strong);
}
/* Must beat `.course-header button { display: inline-flex }` */
.course-header .menu-toggle,
.menu-toggle { display: none !important; }

/* —— Layout —— */
.layout {
  display: flex;
  min-height: calc(100vh - var(--header-h));
}

aside.course-sidebar,
.course-sidebar {
  width: var(--sidebar-w);
  background: var(--card);
  border-right: 1px solid var(--border);
  padding: 20px 0;
  overflow-y: auto;
  overflow-x: hidden;
  position: sticky;
  top: var(--header-h);
  align-self: flex-start;
  max-height: calc(100vh - var(--header-h));
}

.course-sidebar .modulo { margin-bottom: 4px; }
.course-sidebar .modulo-header {
  padding: 12px 20px;
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  user-select: none;
  border-left: 3px solid transparent;
  gap: 8px;
}
.course-sidebar .modulo-header:hover,
.course-sidebar .modulo-header:active { background: var(--card-alt); }
.course-sidebar .modulo-header .chevron {
  color: var(--muted);
  transition: transform 0.2s;
  font-size: 10px;
}
.course-sidebar .modulo.collapsed .chevron { transform: rotate(-90deg); }
.course-sidebar .modulo.collapsed .secoes { display: none; }
.course-sidebar .modulo-mini-progress {
  font-size: 12px;
  color: var(--muted);
  margin-left: 8px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}
.course-sidebar .secoes { padding: 0; margin: 0; list-style: none; }
.course-sidebar .secoes li {
  padding: 10px 20px 10px 44px;
  font-size: 13px;
  cursor: pointer;
  color: var(--muted);
  border-left: 3px solid transparent;
  display: flex;
  align-items: center;
  gap: 8px;
  position: relative;
}
.course-sidebar .secoes li:hover,
.course-sidebar .secoes li:active {
  background: var(--card-alt);
  color: var(--text);
}
.course-sidebar .secoes li.active {
  background: var(--primary-soft);
  color: var(--primary);
  border-left-color: var(--primary);
  font-weight: 500;
}
.course-sidebar .secoes li .status {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: transparent;
  border: 1.5px solid var(--border-strong);
  flex-shrink: 0;
}
.course-sidebar .secoes li.completo .status {
  background: var(--success);
  border-color: var(--success);
}
.course-sidebar .secoes li.parcial .status {
  background: var(--warning);
  border-color: var(--warning);
}
.course-sidebar .secoes .tipo-badge {
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 3px;
  background: var(--card-alt);
  color: var(--muted);
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.3px;
  margin-left: auto;
  flex-shrink: 0;
}

.course-sidebar .side-home {
  padding: 10px 20px;
  margin-bottom: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border-left: 3px solid transparent;
  color: var(--text);
}
.course-sidebar .side-home:hover { background: var(--card-alt); }
.course-sidebar .side-home.active {
  background: var(--primary-soft);
  color: var(--primary);
  border-left-color: var(--primary);
}

.course-sidebar .modulo[data-access="free"] > .modulo-header::after {
  content: ' · grátis';
  font-size: 11px;
  color: var(--muted);
  font-weight: 500;
}
.course-sidebar .modulo[data-access="preview"] > .modulo-header::after {
  content: ' · amostra→pago';
  font-size: 11px;
  color: var(--muted);
  font-weight: 500;
}
.course-sidebar .modulo[data-access="gated"].is-locked { opacity: 0.55; }
.course-sidebar .modulo[data-access="gated"].is-locked > .modulo-header::after {
  content: ' · 🔒';
  font-size: 11px;
  color: var(--muted);
  font-weight: 500;
}

.access-banner {
  font-size: 12px;
  color: var(--muted);
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  line-height: 1.45;
}
.access-banner button {
  margin: 4px 0 0 8px;
  font: inherit;
  font-size: 13px;
  padding: 8px 12px;
  min-height: 40px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--card-alt);
  color: var(--primary);
  cursor: pointer;
}

main.course-main,
.course-main {
  flex: 1;
  padding: 32px 40px 80px 40px;
  max-width: 900px;
  overflow-x: clip; /* not hidden: that would make main a scroll container and break the sticky pager */
  min-width: 0;
}

/* —— Orientation home —— */
.home-hero { margin-bottom: 28px; }
.home-hero h1 { font-size: 30px; line-height: 1.25; margin: 0 0 10px; }
.home-hero p.sub { color: var(--muted); font-size: 16px; margin: 0 0 18px; }
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 8px;
  border: 1px solid var(--primary);
  background: var(--primary);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
:root:not([data-theme="light"]) .btn { color: #0e1520; }
/* Secundário não tem fundo: o texto escuro acima ficaria invisível no tema escuro. */
.btn.sec,
:root:not([data-theme="light"]) .btn.sec { background: transparent; color: var(--primary); }
.home-h2 { font-size: 20px; margin: 36px 0 12px; }
.mod-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 12px;
}
.mod-card {
  text-align: left;
  font: inherit;
  color: inherit;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.mod-card:hover,
.mod-card:focus-visible { border-color: var(--primary); }
.mod-card .n {
  font-size: 12px;
  font-weight: 700;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.mod-card .t { font-weight: 600; font-size: 16px; }
.mod-card .d { color: var(--muted); font-size: 13.5px; line-height: 1.5; flex: 1; }
.mod-card .m {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--muted);
  margin-top: 6px;
}
.mod-card .pb {
  display: block;
  height: 5px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}
.mod-card .pb > span {
  display: block;
  height: 100%;
  background: var(--success);
}
.mod-card > span { display: block; }

.modulo-tag {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 4px;
  background: var(--primary-soft);
  color: var(--primary);
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
h1.section-title {
  font-size: 28px;
  margin: 0 0 8px 0;
  color: var(--text);
  font-weight: 700;
  line-height: 1.3;
}

/* —— Pager —— */
.pager {
  margin-top: 60px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
}
.pager button {
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 12px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  max-width: 48%;
  text-align: left;
  font-family: inherit;
}
.pager button:hover,
.pager button:active {
  border-color: var(--primary);
  color: var(--primary);
}
.pager button:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}
.pager .prev { justify-content: flex-start; }
.pager .next { justify-content: flex-end; }
.pager .direction {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.pager .arrow {
  font-size: 18px;
  flex-shrink: 0;
}
.pager .lbl { flex: 1; min-width: 0; }

.loading-error {
  padding: 40px;
  text-align: center;
  color: var(--warning);
  font-size: 14px;
  line-height: 1.7;
}

.backdrop {
  display: none;
  position: fixed;
  top: var(--header-h);
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 85;
}
.backdrop.show { display: block; }

.course-footer-meta {
  font-size: 12px;
  color: var(--muted);
  margin: 24px 0 0;
}
.course-footer-copy {
  font-size: 12px;
  color: var(--muted);
  margin: 8px 0 24px;
}
.course-footer-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 8px;
}
.link-btn {
  background: none;
  border: none;
  padding: 0;
  color: var(--muted);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.link-btn:hover { color: var(--primary); }

/* —— Glossary terms + pop-up (shared/glossary.js) —— */
.term { border-bottom: 1px dotted var(--primary); cursor: help; }
.term:hover, .term:focus-visible { color: var(--primary); outline: none; }
#gloss-pop {
  position: absolute; z-index: 50; max-width: 320px;
  background: var(--card); border: 1px solid var(--border-strong);
  border-radius: 10px; padding: 12px 14px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.12);
  font-size: 13px; line-height: 1.5; color: var(--text); display: none;
}
#gloss-pop.open { display: block; }
#gloss-pop .g-term { font-weight: 600; margin-bottom: 4px; color: var(--primary); }
.gloss-list { margin: 0; }
.gloss-list dt { font-size: 16px; font-weight: 600; margin-top: 16px; }
.gloss-list dt .g-var { font-weight: 400; font-size: 13px; color: var(--muted); }
.gloss-list dd { margin: 4px 0 0; font-size: 15px; color: var(--text); line-height: 1.55; }
.gloss-list dd .g-fase { font-size: 12px; color: var(--muted); }

/* —— Attempt before the answer key (shared/attempt.js) —— */
.attempt {
  margin: 18px 0 4px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card-alt);
}
.attempt-label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--primary);
  margin-bottom: 8px;
}
.attempt-area {
  display: block;
  width: 100%;
  box-sizing: border-box;
  min-height: 120px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card);
  color: var(--text);
  font: inherit;
  font-size: 14.5px;
  line-height: 1.55;
  resize: vertical;
}
.attempt-area:focus { outline: 2px solid var(--primary); outline-offset: 1px; }
.attempt-foot {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 8px;
  font-size: 12.5px;
  color: var(--muted);
}
.attempt-status { white-space: nowrap; }
.attempt.has-attempt .attempt-status { color: var(--success); font-weight: 600; }
.attempt-lock {
  padding: 16px 18px;
  border: 1px dashed var(--border);
  border-radius: 10px;
  background: var(--card-alt);
  margin: 4px 0 8px;
}
.attempt-lock-title { display: block; font-size: 14px; color: var(--warning); margin-bottom: 4px; }
.attempt-lock-body { margin: 0 0 10px; font-size: 14px; color: var(--muted); line-height: 1.5; }
.attempt-go {
  display: inline-block;
  padding: 8px 14px;
  border: 0;
  border-radius: 6px;
  background: var(--primary);
  color: #fff;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.attempt-open-hint { font-size: 12.5px; color: var(--success); margin: 0 0 12px; }

/* —— Animated diagrams, step primitives (BK-034) ——
   A figure with class "anim" (.diagram.anim in the IA course, .diagrama.anim in the
   Power BI course) runs one cycle of --anim-dur (set on the figure; default 16s) split in
   10 slots of 10%. An element with class k<i> lights up at slot i and stays on until
   the cycle ends; p<i> lights up only during slot i; .anim-walk moves along the
   keyframes named in --walk (declared in a <style> inside the svg, with translate()
   stops at the slots). The pause button (.anim-toggle) toggles .is-paused on the
   figure. With "reduce motion" the final state is shown and nothing moves. */
.anim { position: relative; --anim-dur: 16s; }
.anim .anim-walk {
  animation-name: var(--walk);
  animation-duration: var(--anim-dur);
  animation-timing-function: linear;
  animation-iteration-count: infinite;
}
.anim .anim-halo {
  opacity: 0.28; transform-box: fill-box; transform-origin: center;
  animation: animHalo 1.6s ease-in-out infinite;
}
@keyframes animHalo { 0%, 100% { transform: scale(0.75); opacity: 0.18; } 50% { transform: scale(1.15); opacity: 0.4; } }
/* Live caption under the drawing: one line per step (k<i>); a later line paints over the
   earlier ones, so the text changes without a gap. */
.anim-steps {
  position: relative; min-height: 2.9em; margin: 10px 0 0;
  font-size: 13.5px; line-height: 1.45; text-align: left; color: var(--text);
}
.anim-steps > span {
  position: absolute; left: 0; right: 0; top: 0; padding: 2px 0;
  background: var(--card-alt); font-weight: 500;
}
.diagrama .anim-steps > span { background: var(--card); } /* the PBI figure sits on --card */
.anim.is-paused svg,
.anim.is-paused svg *,
.anim.is-paused .anim-steps > span { animation-play-state: paused !important; }
.anim-toggle {
  position: absolute; top: 8px; right: 8px; width: 30px; height: 26px; padding: 0;
  border: 1px solid var(--border-strong, var(--border)); border-radius: 6px;
  background: var(--card); color: var(--muted); font-size: 12px; cursor: pointer;
}
.anim-toggle:hover { color: var(--primary); border-color: var(--primary); }
.anim .k0, .anim .k1, .anim .k2, .anim .k3, .anim .k4, .anim .k5, .anim .k6, .anim .k7, .anim .k8, .anim .k9,
.anim .p0, .anim .p1, .anim .p2, .anim .p3, .anim .p4, .anim .p5, .anim .p6, .anim .p7, .anim .p8, .anim .p9 { opacity: 0; animation: animOff var(--anim-dur) linear infinite; }
.anim .k0 { animation-name: animK0; }
.anim .p0 { animation-name: animP0; }
.anim .k1 { animation-name: animK1; }
.anim .p1 { animation-name: animP1; }
.anim .k2 { animation-name: animK2; }
.anim .p2 { animation-name: animP2; }
.anim .k3 { animation-name: animK3; }
.anim .p3 { animation-name: animP3; }
.anim .k4 { animation-name: animK4; }
.anim .p4 { animation-name: animP4; }
.anim .k5 { animation-name: animK5; }
.anim .p5 { animation-name: animP5; }
.anim .k6 { animation-name: animK6; }
.anim .p6 { animation-name: animP6; }
.anim .k7 { animation-name: animK7; }
.anim .p7 { animation-name: animP7; }
.anim .k8 { animation-name: animK8; }
.anim .p8 { animation-name: animP8; }
.anim .k9 { animation-name: animK9; }
.anim .p9 { animation-name: animP9; }
@keyframes animOff { to { opacity: 0; } }
@keyframes animK0 { 0% { opacity: 0; } 1.5% { opacity: 1; } 100% { opacity: 1; } }
@keyframes animP0 { 0% { opacity: 0; } 1.5% { opacity: 1; } 8.5% { opacity: 1; } 10%, 100% { opacity: 0; } }
@keyframes animK1 { 0%, 10% { opacity: 0; } 11.5% { opacity: 1; } 100% { opacity: 1; } }
@keyframes animP1 { 0%, 10% { opacity: 0; } 11.5% { opacity: 1; } 18.5% { opacity: 1; } 20%, 100% { opacity: 0; } }
@keyframes animK2 { 0%, 20% { opacity: 0; } 21.5% { opacity: 1; } 100% { opacity: 1; } }
@keyframes animP2 { 0%, 20% { opacity: 0; } 21.5% { opacity: 1; } 28.5% { opacity: 1; } 30%, 100% { opacity: 0; } }
@keyframes animK3 { 0%, 30% { opacity: 0; } 31.5% { opacity: 1; } 100% { opacity: 1; } }
@keyframes animP3 { 0%, 30% { opacity: 0; } 31.5% { opacity: 1; } 38.5% { opacity: 1; } 40%, 100% { opacity: 0; } }
@keyframes animK4 { 0%, 40% { opacity: 0; } 41.5% { opacity: 1; } 100% { opacity: 1; } }
@keyframes animP4 { 0%, 40% { opacity: 0; } 41.5% { opacity: 1; } 48.5% { opacity: 1; } 50%, 100% { opacity: 0; } }
@keyframes animK5 { 0%, 50% { opacity: 0; } 51.5% { opacity: 1; } 100% { opacity: 1; } }
@keyframes animP5 { 0%, 50% { opacity: 0; } 51.5% { opacity: 1; } 58.5% { opacity: 1; } 60%, 100% { opacity: 0; } }
@keyframes animK6 { 0%, 60% { opacity: 0; } 61.5% { opacity: 1; } 100% { opacity: 1; } }
@keyframes animP6 { 0%, 60% { opacity: 0; } 61.5% { opacity: 1; } 68.5% { opacity: 1; } 70%, 100% { opacity: 0; } }
@keyframes animK7 { 0%, 70% { opacity: 0; } 71.5% { opacity: 1; } 100% { opacity: 1; } }
@keyframes animP7 { 0%, 70% { opacity: 0; } 71.5% { opacity: 1; } 78.5% { opacity: 1; } 80%, 100% { opacity: 0; } }
@keyframes animK8 { 0%, 80% { opacity: 0; } 81.5% { opacity: 1; } 100% { opacity: 1; } }
@keyframes animP8 { 0%, 80% { opacity: 0; } 81.5% { opacity: 1; } 88.5% { opacity: 1; } 90%, 100% { opacity: 0; } }
@keyframes animK9 { 0%, 90% { opacity: 0; } 91.5% { opacity: 1; } 100% { opacity: 1; } }
@keyframes animP9 { 0%, 90% { opacity: 0; } 91.5% { opacity: 1; } 98.5% { opacity: 1; } 100%, 100% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .anim .anim-walk, .anim-toggle { display: none; }
  .anim .anim-steps > span { position: static; display: block; opacity: 1; animation: none; }
  .anim .k0, .anim .k1, .anim .k2, .anim .k3, .anim .k4, .anim .k5, .anim .k6, .anim .k7, .anim .k8, .anim .k9 { animation: none; opacity: 1; }
  .anim .p0, .anim .p1, .anim .p2, .anim .p3, .anim .p4, .anim .p5, .anim .p6, .anim .p7, .anim .p8, .anim .p9 { animation: none; opacity: 0; }
}

/* —— Quick quiz (shared/quiz.js) —— */
.quiz {
  margin: 36px 0 0;
  padding: 18px 20px 6px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card);
}
.quiz-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 6px;
}
.quiz-title {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--primary);
}
.quiz-score {
  font-size: 13px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.quiz.is-complete .quiz-score { color: var(--success); font-weight: 600; }
.quiz-q { padding: 14px 0 16px; border-top: 1px solid var(--border); }
.quiz-stem { margin: 0 0 10px; font-size: 15px; line-height: 1.5; color: var(--text); }
.quiz-n { color: var(--muted); font-variant-numeric: tabular-nums; }
.quiz-opts { display: grid; gap: 8px; }
.quiz-opt {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card-alt);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  line-height: 1.45;
  text-align: left;
  cursor: pointer;
}
.quiz-opt:hover:not(:disabled) { border-color: var(--primary); }
.quiz-opt:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.quiz-opt:disabled { cursor: default; opacity: 0.7; }
.quiz-letter {
  flex: none;
  width: 22px; height: 22px;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  font-size: 12px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--muted);
}
.quiz-opt.is-key { border-color: var(--success); opacity: 1; }
.quiz-opt.is-key .quiz-letter { background: var(--success); border-color: var(--success); color: #fff; }
.quiz-opt.is-wrong { border-color: var(--warning); opacity: 1; }
.quiz-opt.is-wrong .quiz-letter { background: var(--warning); border-color: var(--warning); color: #fff; }
.quiz-why {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--primary-soft);
  font-size: 14px;
  line-height: 1.55;
  color: var(--text);
}
.quiz-why .quiz-verdict { color: var(--primary); }
.quiz-q:has(.quiz-opt.is-wrong) .quiz-why .quiz-verdict { color: var(--warning); }
.quiz-retry {
  display: inline-block;
  margin-left: 6px;
  padding: 6px 8px;
  background: none; border: none;
  color: var(--primary); font: inherit; font-size: 13px;
  text-decoration: underline; text-underline-offset: 2px; cursor: pointer;
}

@media (max-width: 768px) {
  aside.course-sidebar,
  .course-sidebar {
    position: fixed;
    top: var(--header-h);
    left: 0;
    height: calc(100vh - var(--header-h));
    z-index: 90;
    transform: translateX(-100%);
    transition: transform 0.25s;
    box-shadow: 4px 0 12px rgba(0, 0, 0, 0.15);
    max-height: none;
  }
  .course-sidebar.open { transform: translateX(0); }
  main.course-main,
  .course-main {
    padding: 20px 16px 60px 16px;
  }
  h1.section-title { font-size: 22px; }
  .home-hero h1 { font-size: 24px; }
  .course-header .menu-toggle,
  .menu-toggle { display: inline-flex !important; }
  .course-header .progress-mini { display: none; }
  .course-header {
    padding-left: 12px;
    padding-right: 12px;
    gap: 8px;
  }
  .course-header .brand { font-size: 14px; }
  .course-header .brand small { display: none; }

  /* Pager as a bar pinned to the bottom of the screen while the lesson scrolls
     (sticky inside main: it settles into place when the lesson ends). */
  .pager {
    position: sticky;
    bottom: 0;
    z-index: 80;
    flex-direction: row;
    margin: 40px -16px 0;
    padding: 8px 12px calc(8px + env(safe-area-inset-bottom, 0px));
    background: var(--card);
    border-top: 1px solid var(--border);
    gap: 8px;
  }
  .pager button {
    max-width: 50%;
    min-height: 48px;
    padding: 6px 10px;
    min-width: 0;
  }
  .pager .lbl {
    display: block;
    font-size: 12px;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
  }
  .pager .direction { font-size: 11px; }
  .pager button:disabled { visibility: hidden; }

  /* Tap targets: 40px or more without changing the visual size. */
  .course-footer-copy a,
  .link-btn {
    display: inline-block;
    padding: 12px 6px;
    margin: -8px 0;
  }
  .completion label,
  .atividade-footer label { padding: 10px 0; flex: 1; }
  .course-main .completion input[type="checkbox"],
  .course-main .atividade-footer input[type="checkbox"] { width: 24px; height: 24px; }

  /* Wide diagrams and tables scroll sideways inside their box: say so. */
  .diagrama,
  .markdown .table-wrap { position: relative; }
  .diagrama::before,
  .markdown .table-wrap::before {
    content: '↔ arraste para ver';
    position: absolute;
    top: 4px;
    right: 8px;
    z-index: 1;
    font-size: 11px;
    color: var(--muted);
    background: var(--card);
    padding: 2px 6px;
    border-radius: 4px;
    pointer-events: none;
  }
  html[lang^="en"] .diagrama::before,
  html[lang^="en"] .markdown .table-wrap::before { content: '↔ drag to see more'; }
  .markdown .table-wrap { padding-top: 22px; }
}

@media print {
  .course-header,
  .course-sidebar,
  .pager,
  .menu-toggle,
  .backdrop,
  .access-banner,
  .course-footer-actions { display: none !important; }
  main.course-main,
  .course-main { max-width: 100%; padding: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .course-sidebar,
  .course-header .progress-mini .bar > div,
  .course-sidebar .modulo-header .chevron { transition: none; }
}

/* EN free/preview labels (html[lang^=en]) */
html[lang^="en"] .course-sidebar .modulo[data-access="free"] > .modulo-header::after {
  content: ' · free';
}
html[lang^="en"] .course-sidebar .modulo[data-access="preview"] > .modulo-header::after {
  content: ' · sample→paid';
}
html[lang^="en"] .course-sidebar .modulo[data-access="gated"].is-locked > .modulo-header::after {
  content: ' · 🔒';
}
