/* ApexFlows Academy — dark, premium, glass.
   Brand tokens mirror apexflows.ai (Slate 900 + Cyan 500). */

:root {
  /* Surfaces */
  --bg:           #0f172a;            /* Slate 900 */
  --bg-elev:      #111827;            /* Slate 900 lift */
  --bg-card:      rgba(15, 23, 42, 0.72);
  --bg-panel:     rgba(17, 25, 40, 0.7);
  --bg-input:     rgba(255, 255, 255, 0.04);

  /* Text */
  --text:         #f8fafc;            /* Slate 50 */
  --text-dim:     #94a3b8;            /* Slate 400 */
  --text-mute:    #64748b;            /* Slate 500 */

  /* Brand */
  --accent:       #06b6d4;            /* Cyan 500 */
  --accent-soft:  #0891b2;            /* Cyan 600 */
  --accent-glow:  rgba(6, 182, 212, 0.35);
  --accent-bg:    rgba(6, 182, 212, 0.10);

  /* State */
  --success:      #06b6d4;            /* cyan to match brand */
  --warning:      #a3e635;            /* Lime 400 — neon, replaces amber */
  --warning-glow: rgba(163, 230, 53, 0.22);
  --danger:       #f43f5e;            /* Rose 500 */

  /* Borders */
  --border:       rgba(255, 255, 255, 0.10);
  --border-strong:rgba(255, 255, 255, 0.18);
  --border-accent:rgba(6, 182, 212, 0.45);

  /* Spacing / Radius / Shadow */
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 22px;
  --shadow-card:  0 10px 30px -10px rgba(0, 0, 0, 0.5);
  --shadow-glow:  0 0 0 1px rgba(6, 182, 212, 0.45), 0 0 24px -4px var(--accent-glow);
  --shadow-lift:  0 18px 50px -15px rgba(0, 0, 0, 0.65);

  /* Sizing */
  --sidebar-w: 320px;
  --header-h: 96px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  background-image:
    radial-gradient(rgba(255, 255, 255, 0.025) 0.5px, transparent 0.5px);
  background-size: 24px 24px;
  background-attachment: fixed;
}

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

/* Display font for big numbers / kickers */
.kicker, .mod-num, .mod-label, .q-num, .narration-slide-label {
  font-family: "Syncopate", "Inter", sans-serif;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

/* ─────────────── Header ─────────────── */
.site-header {
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  padding: 14px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--header-h);
}
.site-header .brand { display: flex; align-items: center; gap: 14px; }
.site-header .brand-logo {
  /* Crop the bundled PNG whitespace via object-fit instead of negative
     margin so the logo sits flush within a smaller top nav. The PNG is
     1536x1024 (1.5:1); a 240x80 box (3:1) trims roughly 25% off the top
     and bottom of the image, which is where the empty padding sits. */
  height: 80px;
  width: 240px;
  object-fit: cover;
  object-position: center;
  display: block;
  margin: 0;
}
.site-header .brand a {
  display: inline-flex;
  align-items: center;
}
.site-header .brand-name {
  font-family: "Syncopate", sans-serif;
  font-weight: 700;
  font-size: 16px;
  letter-spacing: 0.08em;
  color: var(--text);
  text-transform: uppercase;
}
.site-header .brand-tag {
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.02em;
}
.site-header .progress-summary {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-dim);
  font-size: 13px;
}
.progress-pill {
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 7px 14px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 12.5px;
  color: var(--text);
  transition: all 0.2s ease;
}
.progress-pill:hover {
  border-color: var(--border-accent);
  box-shadow: 0 0 16px -4px var(--accent-glow);
  text-decoration: none;
}

/* Language picker (refined) */
.lang-picker select {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 7px 30px 7px 12px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--text-dim) 50%),
    linear-gradient(135deg, var(--text-dim) 50%, transparent 50%);
  background-position: calc(100% - 14px) 50%, calc(100% - 9px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  transition: all 0.2s ease;
}
.lang-picker select:hover { border-color: var(--border-accent); box-shadow: 0 0 16px -4px var(--accent-glow); }
.lang-picker select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

/* ─────────────── Index (course home) ─────────────── */
.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 32px 32px 80px;
}

.hero {
  position: relative;
  padding: 72px 0 56px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 56px;
  overflow: hidden;
}
.hero::before {
  content: "";
  position: absolute;
  top: -20%;
  right: -10%;
  width: 520px;
  height: 520px;
  background: radial-gradient(circle, rgba(6, 182, 212, 0.18) 0%, transparent 60%);
  filter: blur(40px);
  animation: blob 14s ease-in-out infinite;
  pointer-events: none;
  z-index: 0;
}
.hero::after {
  content: "";
  position: absolute;
  top: 30%;
  left: -10%;
  width: 380px;
  height: 380px;
  background: radial-gradient(circle, rgba(139, 92, 246, 0.12) 0%, transparent 60%);
  filter: blur(50px);
  animation: blob 18s ease-in-out infinite reverse;
  pointer-events: none;
  z-index: 0;
}
.hero > * { position: relative; z-index: 1; }
@keyframes blob {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33%      { transform: translate(40px, -30px) scale(1.05); }
  66%      { transform: translate(-30px, 20px) scale(0.95); }
}

.hero .hero-kicker {
  display: inline-block;
  font-family: "Syncopate", sans-serif;
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.18em;
  color: var(--accent);
  background: var(--accent-bg);
  border: 1px solid var(--border-accent);
  padding: 6px 12px;
  border-radius: 999px;
  margin-bottom: 20px;
  text-transform: uppercase;
}
.hero h1 {
  font-size: clamp(38px, 5vw, 56px);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.05;
  margin: 0 0 16px;
  background: linear-gradient(180deg, #ffffff 0%, #cbd5e1 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.hero p {
  font-size: 17px;
  line-height: 1.65;
  color: var(--text-dim);
  max-width: 780px;
  margin: 0 0 24px;
}
.hero-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 12px;
}
.hero-stat {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 13px;
  color: var(--text-dim);
}
.hero-stat strong { color: var(--text); font-weight: 700; }

/* Act sections */
.act-section { margin-bottom: 56px; }
.act-section h2 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0 0 6px;
  display: flex;
  align-items: center;
  gap: 14px;
}
.act-section h2::before {
  content: "";
  display: inline-block;
  width: 3px;
  height: 22px;
  background: var(--accent);
  border-radius: 2px;
}
.act-desc {
  color: var(--text-dim);
  margin: 0 0 24px 17px;
  font-size: 14px;
}

/* Module grid + cards */
.module-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 18px;
}
.module-card {
  display: block;
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 22px 22px 20px;
  color: var(--text);
  text-decoration: none;
  position: relative;
  overflow: hidden;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
.module-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent 60%, rgba(6, 182, 212, 0.06) 100%);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}
.module-card.built:hover {
  border-color: var(--border-accent);
  box-shadow: var(--shadow-lift), var(--shadow-glow);
  transform: translateY(-2px);
  text-decoration: none;
}
.module-card.built:hover::before { opacity: 1; }
.module-card.locked,
.module-card.planned { opacity: 0.55; cursor: not-allowed; }
.module-card .mod-num {
  font-size: 11px;
  color: var(--accent);
  margin-bottom: 8px;
}
.module-card .mod-title {
  font-size: 17px;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 16px;
  letter-spacing: -0.01em;
}
.module-card .mod-meta {
  font-size: 12.5px;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Status dots */
.status-dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--text-mute);
  box-shadow: 0 0 0 3px rgba(100, 116, 139, 0.18);
}
.status-dot.complete { background: var(--accent); box-shadow: 0 0 0 3px var(--accent-bg), 0 0 12px var(--accent-glow); }
.status-dot.in-progress { background: var(--warning); box-shadow: 0 0 0 3px var(--warning-glow), 0 0 12px var(--warning-glow); }
.status-dot.not-built { background: var(--text-mute); box-shadow: none; opacity: 0.5; }

/* ─────────────── Module page (sidebar layout) ─────────────── */
.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: calc(100vh - var(--header-h));
}

/* Sidebar */
.sidebar {
  border-right: 1px solid var(--border);
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  position: sticky;
  top: var(--header-h);
  height: calc(100vh - var(--header-h));
  overflow-y: auto;
  padding: 24px 0 32px;
}
.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: #334155; border-radius: 3px; }
.sidebar::-webkit-scrollbar-thumb:hover { background: #475569; }

.sidebar-progress {
  margin: 0 20px 24px;
  padding: 14px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
}
.sidebar-progress-label {
  font-size: 11px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 8px;
}
.sidebar-progress-bar {
  height: 6px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 8px;
}
.sidebar-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #22d3ee);
  border-radius: 3px;
  box-shadow: 0 0 12px var(--accent-glow);
  transition: width 0.4s ease;
}
.sidebar-progress-meta {
  font-size: 12px;
  color: var(--text-dim);
  display: flex;
  justify-content: space-between;
}
.sidebar-progress-meta strong { color: var(--text); font-weight: 700; }

.sidebar-act { margin-bottom: 18px; }
.sidebar-act-label {
  font-family: "Syncopate", sans-serif;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--text-mute);
  text-transform: uppercase;
  padding: 8px 24px 6px;
}
.sidebar-module {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 24px 9px 22px;
  color: var(--text-dim);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  border-left: 2px solid transparent;
  transition: all 0.15s ease;
}
.sidebar-module:hover {
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  text-decoration: none;
}
.sidebar-module.active {
  background: var(--accent-bg);
  color: var(--text);
  border-left-color: var(--accent);
  font-weight: 600;
}
.sidebar-module.locked { opacity: 0.45; cursor: not-allowed; }
.sidebar-module .sidebar-dot {
  flex-shrink: 0;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-mute);
}
.sidebar-module .sidebar-dot.complete { background: var(--accent); box-shadow: 0 0 0 2px var(--accent-bg); }
.sidebar-module .sidebar-dot.in-progress { background: var(--warning); box-shadow: 0 0 0 2px var(--warning-glow), 0 0 8px var(--warning-glow); }
.sidebar-module .sidebar-dot.not-built { opacity: 0.4; }
.sidebar-module-num {
  font-family: "Syncopate", sans-serif;
  font-size: 10px;
  font-weight: 700;
  color: var(--text-mute);
  letter-spacing: 0.06em;
  width: 22px;
  flex-shrink: 0;
}
.sidebar-module.active .sidebar-module-num { color: var(--accent); }
.sidebar-module-title {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Sidebar toggle (mobile) */
.sidebar-toggle {
  display: none;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 14px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 13px;
}

/* Module content area */
.module-content {
  padding: 28px 36px 80px;
  min-width: 0;
}

.module-header { margin-bottom: 22px; }
.breadcrumb {
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 14px;
}
.breadcrumb a { color: var(--text-dim); }
.breadcrumb a:hover { color: var(--accent); }
#mod-title {
  font-size: clamp(28px, 3.4vw, 38px);
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: 1.1;
  margin: 0;
  display: flex;
  align-items: baseline;
  gap: 18px;
  flex-wrap: wrap;
}
.mod-num-display {
  font-family: "Syncopate", sans-serif;
  color: var(--accent);
  font-size: 0.7em;
  letter-spacing: 0.08em;
  font-weight: 700;
}

/* Tab bar */
.tab-bar {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin: 24px 0 28px;
  overflow-x: auto;
  scrollbar-width: none;
}
.tab-bar::-webkit-scrollbar { display: none; }
.tab-bar button {
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  padding: 12px 18px;
  cursor: pointer;
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  transition: color 0.15s ease;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.tab-bar button:hover { color: var(--text); }
.tab-bar button.active {
  color: var(--text);
  border-bottom-color: var(--accent);
}
.completion-mark {
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
}

/* Slides iframe */
.slides-frame {
  width: 100%;
  height: calc(100vh - 240px);
  min-height: 520px;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: #000;
  box-shadow: var(--shadow-card);
}

/* Markdown / Resources / Lab */
.markdown-pane {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 32px 38px;
  font-size: 15.5px;
  line-height: 1.72;
  color: var(--text);
}
.markdown-pane h1 {
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0 0 18px;
  background: linear-gradient(180deg, #fff 0%, #cbd5e1 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.markdown-pane h2 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.015em;
  margin: 40px 0 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.markdown-pane h3 {
  font-size: 17px;
  font-weight: 700;
  margin: 28px 0 10px;
  color: var(--text);
}
.markdown-pane p { margin: 0 0 14px; color: var(--text); }
.markdown-pane ul, .markdown-pane ol {
  margin: 0 0 16px;
  padding-left: 22px;
}
.markdown-pane li { margin-bottom: 6px; }
.markdown-pane strong { color: #fff; font-weight: 700; }
.markdown-pane code {
  background: rgba(6, 182, 212, 0.10);
  color: #67e8f9;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: "JetBrains Mono", "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.88em;
  border: 1px solid rgba(6, 182, 212, 0.18);
}
.markdown-pane pre {
  background: #020617;
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  padding: 16px 18px;
  border-radius: var(--r-md);
  overflow-x: auto;
  margin: 0 0 18px;
}
.markdown-pane pre code {
  background: none;
  color: #e2e8f0;
  border: none;
  padding: 0;
  font-size: 13px;
  line-height: 1.6;
}
.markdown-pane table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 18px;
  font-size: 14px;
}
.markdown-pane th, .markdown-pane td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.markdown-pane th { color: var(--text-dim); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; }
.markdown-pane blockquote {
  border-left: 3px solid var(--accent);
  padding: 6px 16px;
  margin: 0 0 18px;
  color: var(--text-dim);
  font-style: italic;
}

/* Toolbar over markdown (PDF download etc.) */
.pane-toolbar {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-bottom: 14px;
}

/* Buttons */
.btn {
  background: var(--accent);
  color: #082f49;
  border: 1px solid transparent;
  padding: 10px 18px;
  border-radius: 999px;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  letter-spacing: 0.01em;
  box-shadow: 0 0 0 1px rgba(6, 182, 212, 0.3), 0 6px 20px -8px var(--accent-glow);
}
.btn:hover {
  background: #22d3ee;
  box-shadow: 0 0 0 1px var(--accent), 0 8px 28px -6px var(--accent-glow), 0 0 0 4px var(--accent-bg);
  transform: translateY(-1px);
}
.btn.secondary {
  background: var(--bg-card);
  color: var(--text);
  border-color: var(--border);
  box-shadow: none;
}
.btn.secondary:hover {
  border-color: var(--border-accent);
  background: rgba(6, 182, 212, 0.06);
  box-shadow: 0 0 16px -4px var(--accent-glow);
}
.btn.ghost {
  background: transparent;
  color: var(--text-dim);
  border-color: var(--border);
  box-shadow: none;
}
.btn.ghost:hover { color: var(--text); border-color: var(--border-accent); background: rgba(255, 255, 255, 0.03); }
.btn[disabled] { opacity: 0.4; cursor: not-allowed; transform: none; }

.pdf-btn::before {
  content: "↓";
  display: inline-block;
  margin-right: 6px;
  font-weight: 700;
}

/* Quiz */
.quiz-pane {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 32px 38px;
}
.quiz-pane h1 {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0 0 6px;
}
.quiz-question {
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 22px 24px;
  margin-bottom: 16px;
}
.q-num {
  font-size: 10.5px;
  color: var(--accent);
  margin-bottom: 8px;
}
.q-text {
  font-size: 16px;
  font-weight: 600;
  line-height: 1.5;
  margin-bottom: 16px;
}
.quiz-option {
  display: block;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 12px 16px;
  margin-bottom: 8px;
  cursor: pointer;
  font-size: 14.5px;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  gap: 12px;
}
.quiz-option:hover {
  border-color: var(--border-strong);
  background: rgba(255, 255, 255, 0.06);
}
.quiz-option input[type="radio"] {
  accent-color: var(--accent);
  flex-shrink: 0;
}
.quiz-option.correct {
  border-color: var(--accent);
  background: var(--accent-bg);
  color: var(--text);
}
.quiz-option.incorrect {
  border-color: var(--danger);
  background: rgba(244, 63, 94, 0.08);
  color: var(--text);
}
.quiz-explain {
  margin-top: 12px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.03);
  border-left: 3px solid var(--accent);
  border-radius: 4px;
  font-size: 13.5px;
  color: var(--text-dim);
  line-height: 1.55;
}
.quiz-explain strong { color: var(--text); }
.quiz-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 22px;
}
.quiz-result {
  font-size: 13.5px;
  font-weight: 600;
}
.quiz-result.passed { color: var(--accent); }
.quiz-result.failed { color: var(--danger); }

/* Empty / fallback */
.empty-module {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 48px 32px;
  text-align: center;
  color: var(--text-dim);
}

/* Footer */
.site-footer {
  text-align: center;
  padding: 32px 24px 24px;
  color: var(--text-mute);
  font-size: 12px;
  border-top: 1px solid var(--border);
  margin-top: 32px;
}

/* Loading state */
.loading-skeleton {
  background: linear-gradient(90deg, rgba(255,255,255,0.04) 0%, rgba(255,255,255,0.08) 50%, rgba(255,255,255,0.04) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: var(--r-md);
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ─────────────── Responsive ─────────────── */
@media (max-width: 980px) {
  :root { --sidebar-w: 280px; }
  .module-content { padding: 24px 22px 60px; }
  .markdown-pane, .quiz-pane { padding: 22px 22px; }
}

@media (max-width: 760px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    top: var(--header-h);
    left: 0;
    width: 88vw;
    max-width: 340px;
    height: calc(100vh - var(--header-h));
    z-index: 40;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    box-shadow: var(--shadow-lift);
    border-right: 1px solid var(--border);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-toggle { display: inline-block; margin-bottom: 16px; }
  .container { padding: 24px 20px 60px; }
  .hero { padding: 48px 0 36px; margin-bottom: 36px; }
  .site-header { padding: 12px 18px; }
  .site-header .brand-tag { display: none; }
}

/* ─────────────── Print / PDF stylesheet ─────────────── */
@media print {
  body { background: #fff; color: #0f172a; }
  .site-header, .tab-bar, .pane-toolbar, .sidebar, .sidebar-toggle, .site-footer { display: none !important; }
  .app-shell { display: block; }
  .module-content { padding: 0; }
  .markdown-pane, .quiz-pane {
    background: #fff;
    color: #0f172a;
    border: none;
    padding: 0;
    box-shadow: none;
  }
  .markdown-pane h1, .markdown-pane h2, .markdown-pane h3, .markdown-pane strong {
    color: #0f172a;
    -webkit-text-fill-color: #0f172a;
  }
  .markdown-pane code { background: #f1f5f9; color: #0e7490; border-color: #cbd5e1; }
  .markdown-pane pre { background: #f8fafc; border-color: #cbd5e1; color: #1e293b; }
  .markdown-pane pre code { color: #1e293b; }
  a { color: #0e7490; }
}

/* PDF cover (used by html2pdf wrapper) */
.pdf-doc {
  font-family: "Inter", sans-serif;
  color: #0f172a;
  background: #fff;
  padding: 0;
}
.pdf-cover {
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 60%, #0e7490 100%);
  color: #f8fafc;
  padding: 96px 64px 88px;
  page-break-after: always;
  position: relative;
  min-height: 900px;
}
.pdf-cover::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(6, 182, 212, 0.25) 1px, transparent 1px);
  background-size: 28px 28px;
  opacity: 0.5;
}
.pdf-cover > * { position: relative; }
.pdf-cover .pdf-brand {
  font-family: "Syncopate", sans-serif;
  font-size: 14px;
  letter-spacing: 0.18em;
  color: #67e8f9;
  text-transform: uppercase;
  margin-bottom: 64px;
  font-weight: 700;
}
.pdf-cover .pdf-mod-num {
  font-family: "Syncopate", sans-serif;
  font-size: 18px;
  letter-spacing: 0.12em;
  color: #67e8f9;
  text-transform: uppercase;
  margin-bottom: 16px;
  font-weight: 700;
}
.pdf-cover h1 {
  font-size: 44px;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin: 0 0 24px;
  color: #fff;
}
.pdf-cover .pdf-deliverable-type {
  font-size: 22px;
  font-weight: 600;
  color: #cbd5e1;
  margin-bottom: 56px;
}
.pdf-cover .pdf-meta {
  border-top: 1px solid rgba(255, 255, 255, 0.15);
  padding-top: 28px;
  font-size: 13px;
  color: #94a3b8;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.pdf-cover .pdf-meta strong { color: #f8fafc; font-weight: 600; }
.pdf-body {
  padding: 56px 64px 64px;
  font-size: 13px;
  line-height: 1.65;
  color: #0f172a;
}
.pdf-body h1 {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0 0 16px;
  color: #0f172a;
}
.pdf-body h2 {
  font-size: 18px;
  font-weight: 700;
  margin: 28px 0 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid #cbd5e1;
  color: #0f172a;
}
.pdf-body h3 {
  font-size: 14px;
  font-weight: 700;
  margin: 20px 0 8px;
  color: #1e293b;
}
.pdf-body p { margin: 0 0 10px; }
.pdf-body ul, .pdf-body ol { padding-left: 20px; margin: 0 0 12px; }
.pdf-body li { margin-bottom: 4px; }
.pdf-body strong { font-weight: 700; color: #0f172a; }
.pdf-body code {
  background: #f1f5f9;
  color: #0e7490;
  padding: 1px 5px;
  border-radius: 3px;
  font-family: "JetBrains Mono", "SF Mono", Consolas, monospace;
  font-size: 0.88em;
}
.pdf-body pre {
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-left: 3px solid #06b6d4;
  padding: 12px 14px;
  border-radius: 6px;
  overflow: hidden;
  margin: 0 0 14px;
}
.pdf-body pre code {
  background: none;
  color: #1e293b;
  padding: 0;
  font-size: 11.5px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}
.pdf-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 14px;
  font-size: 12px;
}
.pdf-body th, .pdf-body td {
  border: 1px solid #cbd5e1;
  padding: 6px 8px;
  text-align: left;
}
.pdf-body th { background: #f1f5f9; font-weight: 700; }
.pdf-body a { color: #0e7490; text-decoration: underline; }
.pdf-footer {
  border-top: 1px solid #cbd5e1;
  padding: 16px 64px;
  font-size: 10px;
  color: #64748b;
  text-align: center;
  font-family: "Syncopate", sans-serif;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
