:root {
  --bg: #f3f6fb;
  --card: #ffffff;
  --text: #172033;
  --muted: #64748b;
  --line: #e2e8f0;
  --primary: #2563eb;
  --primary-soft: #dbeafe;
  --dark: #101827;
  --shadow: 0 18px 42px rgba(15, 23, 42, 0.08);
  --radius: 20px;
}

* { box-sizing: border-box; }

html,
body {
  margin: 0;
  padding: 0;
  background:
    radial-gradient(circle at top left, rgba(37, 99, 235, 0.08), transparent 30rem),
    linear-gradient(180deg, #f8fafc 0%, #eef2f7 100%);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
}

body { padding: 24px; }

.course-shell {
  max-width: 1380px;
  margin: 0 auto;
}

.course-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  background: linear-gradient(135deg, #111827, #1e293b);
  color: #ffffff;
  border-radius: 24px;
  padding: 24px;
  margin-bottom: 28px;
  box-shadow: var(--shadow);
}

.course-layout {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 28px;
  align-items: start;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.learner-chip {
  padding: 10px 14px;
  border-radius: 14px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.14);
}

.learner-chip span {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  opacity: 0.7;
  margin-bottom: 4px;
}

.learner-chip strong {
  display: block;
  font-size: 14px;
  font-weight: 700;
}

.course-status {
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.course-progress-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 16px;
}

.logo {
  width: 58px;
  height: 58px;
  background: linear-gradient(135deg, #4f46e5, #2563eb);
  color: #ffffff;
  border-radius: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 750;
  letter-spacing: -0.04em;
  font-size: 18px;
}

.header-text h1 {
  margin: 0;
  font-size: 24px;
  line-height: 1.12;
  font-weight: 700;
  letter-spacing: -0.025em;
}

.header-text p {
  margin: 5px 0 0;
  color: #cbd5e1;
  font-size: 15px;
}

.back-home {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 10px 14px;
  border-radius: 999px;
  color: #ffffff;
  background: rgba(255, 255, 255, 0.10);
  border: 1px solid rgba(255, 255, 255, 0.18);
  text-decoration: none;
  font-weight: 650;
  font-size: 14px;
  white-space: nowrap;
}

.back-home:hover { background: rgba(255, 255, 255, 0.16); }

.sidebar {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  position: sticky;
  top: 24px;
}

.sidebar-top {
  border-bottom: 1px solid var(--line);
  padding-bottom: 14px;
  margin-bottom: 14px;
}

.eyebrow {
  margin: 0 0 7px;
  color: var(--primary);
  font-size: 11px;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: 0.14em;
}

.sidebar h2 {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.025em;
}

.lesson-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.lesson-item {
  width: 100%;
  text-align: left;
  border: 1px solid transparent;
  border-radius: 14px;
  background: transparent;
  color: var(--text);
  padding: 12px;
  padding-left: 44px;
  font-size: 15px;
  font-weight: 620;
  line-height: 1.35;
  cursor: pointer;
  transition: 0.16s ease;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.lesson-item:hover {
  background: #f8fafc;
  border-color: var(--line);
}

.lesson-item.active {
  background: #eef2ff;
  border-color: #bfdbfe;
  color: #1e3a8a;
}

.lesson-item span {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  opacity: 0.75;
}

.lesson-item.active span {
  opacity: 1;
  color: #3b82f6;
}

.lesson-item::before {
  content: "";
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  border-radius: 999px;
  border: 2px solid #cbd5e1;
  background: #ffffff;
  transition: background 200ms ease, border-color 200ms ease, box-shadow 220ms ease;
}

.lesson-item.completed::before {
  background: #22c55e;
  border-color: #22c55e;
  box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.12);
}

.lesson-item.active::before {
  background: #2563eb;
  border-color: #2563eb;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

.lesson-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 42px;
}

.lesson-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  margin-bottom: 16px;
}

.lesson-pill {
  background: var(--primary-soft);
  color: #1d4ed8;
  border-radius: 999px;
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.progress-track {
  width: 100%;
  height: 7px;
  background: #e5e7eb;
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 24px;
}

.progress-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--primary), #06b6d4);
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.lesson-meta {
  color: var(--muted);
  font-size: 14px;
  margin: 0 0 8px;
}

h2 {
  margin: 0;
  font-size: clamp(24px, 2.6vw, 32px);
  line-height: 1.18;
  font-weight: 700;
  letter-spacing: -0.03em;
}

h3 {
  margin: 0 0 12px;
  font-size: 17px;
  font-weight: 700;
}

.content-panel { margin-top: 22px; }

.lesson-body {
  font-size: 16px;
  line-height: 1.72;
  margin-bottom: 24px;
  max-width: 880px;
}

.lesson-body p { margin-top: 0; }

.lesson-callout {
  margin: 1.8em 0;
  padding: 16px 20px;
  background: rgba(37, 99, 235, 0.05);
  border: 1px solid rgba(37, 99, 235, 0.16);
  border-left: 4px solid var(--primary);
  border-radius: 0 12px 12px 0;
  font-size: 15px;
  line-height: 1.78;
  color: var(--text);
}

.media-block {
  margin: 24px 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #f8fafc;
}

video {
  width: 100%;
  max-width: 760px;
  display: block;
  border-radius: 14px;
  background: #000000;
}

audio {
  width: 100%;
  display: block;
}

.nav-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  margin-top: 26px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

button {
  border: none;
  border-radius: 12px;
  background: var(--dark);
  color: #ffffff;
  padding: 11px 17px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: 0.16s ease;
}

button:hover {
  transform: translateY(-1px);
  background: #020617;
}

.secondary-btn {
  background: #ffffff;
  color: var(--text);
  border: 1px solid #cbd5e1;
}

.secondary-btn:hover {
  background: #f8fafc;
  transform: none;
}

button:disabled {
  opacity: 0.42;
  cursor: not-allowed;
  transform: none;
}

.hidden { display: none !important; }


/* =========================
   CONTENT REVEAL PACING
========================= */

@keyframes blockReveal {
  from {
    opacity: 0;
    transform: translateY(5px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.lesson-body.content-entering > * {
  opacity: 0;
  animation: blockReveal 0.28s ease forwards;
}

.lesson-body.content-entering > *:nth-child(1) { animation-delay: 0s; }
.lesson-body.content-entering > *:nth-child(2) { animation-delay: 0.05s; }
.lesson-body.content-entering > *:nth-child(3) { animation-delay: 0.10s; }
.lesson-body.content-entering > *:nth-child(4) { animation-delay: 0.14s; }
.lesson-body.content-entering > *:nth-child(n+5) { animation-delay: 0.18s; }


/* =========================
   RESPONSIVE
========================= */

@media (max-width: 900px) {
  body { padding: 14px; }

  .course-layout { grid-template-columns: 1fr; }

  .sidebar { position: static; }

  .course-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .header-right {
    width: 100%;
    align-items: stretch;
    flex-direction: column;
  }

  .back-home { width: 100%; text-align: center; }

  .lesson-top { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  .progress-fill { transition: none; }

  .lesson-body.content-entering > * {
    animation: none !important;
    opacity: 1 !important;
  }

  .lesson-item::before { transition: none !important; }
}
