:root {
  --bg: #f4f6fb;
  --surface: #ffffff;
  --ink: #121723;
  --muted: #687083;
  --line: #e3e7ef;
  --blue: #2f54eb;
  --blue-soft: #eaf0ff;
  --violet: #6e44ff;
  --orange: #f2793d;
  --green: #16966f;
  --shadow: 0 14px 40px rgba(25, 35, 58, .08);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.65 "Manrope", system-ui, sans-serif; }
a { color: inherit; }
button, input { font: inherit; }
button { cursor: pointer; }
.skip-link { position: fixed; left: 1rem; top: -5rem; z-index: 100; background: var(--ink); color: white; padding: .7rem 1rem; border-radius: .7rem; }
.skip-link:focus { top: 1rem; }

.app-shell { display: grid; grid-template-columns: 278px minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; background: #101522; color: #edf2ff; padding: 1.6rem 1.1rem; display: flex; flex-direction: column; z-index: 20; }
.brand { display: flex; gap: .85rem; align-items: center; text-decoration: none; padding: .45rem .55rem 1.6rem; }
.brand-mark { width: 42px; height: 42px; border-radius: 14px 14px 5px 14px; display: grid; place-items: center; background: linear-gradient(145deg, #6d5dfc, #3158e9); color: #fff; font-weight: 800; font-size: 1.15rem; box-shadow: 0 8px 24px rgba(65, 91, 235, .3); }
.brand b { display: block; font-size: 1rem; }
.brand small { display: block; color: #9da7bd; font-size: .73rem; margin-top: -.15rem; }
.module-nav { display: grid; gap: .35rem; }
.module-nav a { display: grid; grid-template-columns: 34px 1fr; gap: .7rem; align-items: center; padding: .78rem; border-radius: 12px; text-decoration: none; color: #bbc4d7; font-size: .88rem; line-height: 1.35; }
.module-nav a:hover, .module-nav a.active { background: #1d2535; color: #fff; }
.nav-icon { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: #283147; font-size: 1rem; }
.source-note { margin-top: auto; border-top: 1px solid #293247; padding: 1rem .55rem 0; display: grid; gap: .15rem; }
.source-note span { font-size: .72rem; color: #748099; text-transform: uppercase; letter-spacing: .1em; }
.source-note a { font-size: .82rem; color: #bec9df; text-decoration: none; }

main { min-width: 0; padding: 0 clamp(1.25rem, 4vw, 4.5rem) 5rem; }
.topbar { min-height: 78px; display: flex; align-items: center; justify-content: space-between; gap: 1rem; border-bottom: 1px solid var(--line); }
.eyebrow { color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .12em; font-weight: 700; }
.menu-button { display: none; border: 0; background: transparent; font-size: 1.25rem; }
.search { width: min(460px, 50vw); height: 44px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface); display: flex; align-items: center; gap: .7rem; padding: 0 .8rem; color: #8d95a7; }
.search input { border: 0; outline: 0; background: transparent; width: 100%; min-width: 0; color: var(--ink); }
.search kbd { font-size: .72rem; border: 1px solid #dbe0ea; border-radius: 6px; padding: .05rem .38rem; background: #f7f8fa; color: #9299a8; white-space: nowrap; }
.intro { max-width: 1180px; margin: 0 auto; padding: clamp(2.3rem, 6vw, 5rem) 0 2.4rem; display: flex; align-items: end; justify-content: space-between; gap: 2rem; }
.kicker { margin: 0 0 .45rem; color: var(--blue); font-size: .78rem; text-transform: uppercase; letter-spacing: .13em; font-weight: 800; }
h1 { font-size: clamp(2rem, 4.2vw, 4.5rem); line-height: 1.04; letter-spacing: -.055em; max-width: 850px; margin: 0; }
.intro-copy { color: var(--muted); max-width: 650px; margin: 1.1rem 0 0; font-size: 1.03rem; }
.stats { display: flex; gap: 1.8rem; background: #111827; color: white; padding: 1.1rem 1.25rem; border-radius: 18px; box-shadow: var(--shadow); }
.stats div { display: grid; min-width: 54px; }
.stats strong { font-size: 1.4rem; line-height: 1.1; }
.stats span { color: #9ca7bb; font-size: .7rem; }
.toolbar { max-width: 1180px; margin: 0 auto 1.4rem; display: flex; justify-content: space-between; gap: 1rem; align-items: center; }
.filter-tabs { display: flex; flex-wrap: wrap; gap: .45rem; }
.filter, .expand-all { border: 1px solid var(--line); background: var(--surface); color: var(--muted); border-radius: 999px; padding: .55rem .9rem; font-size: .84rem; font-weight: 700; }
.filter.active { background: var(--ink); color: white; border-color: var(--ink); }
.expand-all { border-radius: 10px; color: var(--ink); }

#course { max-width: 1180px; margin: 0 auto; display: grid; gap: 1.25rem; }
.module { scroll-margin-top: 1rem; background: var(--surface); border: 1px solid var(--line); border-radius: 24px; overflow: hidden; box-shadow: 0 6px 22px rgba(30, 40, 65, .045); }
.module-head { padding: 1.5rem 1.6rem; display: flex; justify-content: space-between; align-items: center; gap: 1rem; border-bottom: 1px solid var(--line); background: linear-gradient(120deg, var(--module-soft), #fff 62%); }
.module-title { display: flex; gap: 1rem; align-items: center; }
.module-badge { width: 50px; height: 50px; border-radius: 16px; background: var(--module-color); display: grid; place-items: center; color: white; font-size: 1.25rem; box-shadow: 0 8px 24px color-mix(in srgb, var(--module-color) 28%, transparent); }
.module h2 { margin: 0; font-size: 1.35rem; line-height: 1.25; letter-spacing: -.025em; }
.module-head small { color: var(--muted); }
.lessons { padding: .55rem 1rem 1rem; }
.lesson { border-bottom: 1px solid var(--line); }
.lesson:last-child { border-bottom: 0; }
.lesson[hidden] { display: none; }
.lesson summary { list-style: none; display: grid; grid-template-columns: 40px minmax(0,1fr) auto; gap: .8rem; align-items: center; padding: 1rem .6rem; cursor: pointer; border-radius: 12px; }
.lesson summary::-webkit-details-marker { display: none; }
.lesson summary:hover { background: #f8f9fc; }
.lesson-number { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; background: var(--module-soft); color: var(--module-color); font-weight: 800; font-size: .78rem; }
.lesson-name { min-width: 0; }
.lesson-name strong { display: block; font-size: .98rem; }
.lesson-name small { color: var(--muted); }
.summary-side { display: flex; gap: .55rem; align-items: center; color: #8a91a0; }
.tag { font-size: .67rem; padding: .18rem .48rem; border-radius: 999px; background: #eef2f7; color: #657084; font-weight: 800; letter-spacing: .03em; }
.tag.hw { background: #fff0e8; color: #bd5421; }
.chevron { font-size: 1.25rem; transition: transform .2s; }
.lesson[open] .chevron { transform: rotate(90deg); }
.lesson-body { margin: 0 .55rem 1.2rem 3.75rem; padding: .25rem 0 .35rem; color: #333b4b; }
.lesson-body p { margin: .55rem 0; }
.lesson-body ul, .lesson-body ol { padding-left: 1.25rem; }
.lesson-body h3 { margin: 1.35rem 0 .5rem; font-size: 1rem; color: var(--ink); }
.video-link { display: inline-flex; gap: .65rem; align-items: center; padding: .68rem .9rem; border: 1px solid #f0d6d6; background: #fffafa; color: #b72c2c; border-radius: 12px; text-decoration: none; font-weight: 800; margin: .35rem 0 .85rem; }
.video-link:hover { border-color: #e7a5a5; background: #fff2f2; }
.homework { margin: 1rem 0; padding: 1rem 1.1rem; border-radius: 14px; background: #fff8f3; border: 1px solid #f6d9c8; border-left: 4px solid var(--orange); }
.homework h3 { margin: 0 0 .55rem; color: #9b481f; text-transform: uppercase; letter-spacing: .08em; font-size: .76rem; }
.extra { margin: 1rem 0; padding: 1rem 1.1rem; border-radius: 14px; background: #f1f7ff; border: 1px solid #d8e7ff; }
.extra h3 { margin: 0 0 .55rem; color: #254ea2; }
.resources { display: flex; flex-wrap: wrap; gap: .55rem; margin: .75rem 0; }
.resource { display: inline-flex; align-items: center; gap: .45rem; border: 1px solid var(--line); border-radius: 10px; padding: .5rem .7rem; color: #30415e; text-decoration: none; background: white; font-size: .82rem; font-weight: 700; }
.resource:hover { border-color: #abb9d6; transform: translateY(-1px); }
.code { display: block; padding: .9rem 1rem; border-radius: 12px; background: #111827; color: #dbe5ff; white-space: pre-wrap; overflow-wrap: anywhere; font: .78rem/1.55 ui-monospace, SFMono-Regular, Menlo, monospace; }
.asset-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: .75rem; margin-top: .8rem; }
.asset-card { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: #fff; }
.asset-card img { display: block; width: 100%; aspect-ratio: 16/9; object-fit: cover; background: #eef1f6; }
.asset-card a { display: block; padding: .65rem .75rem; font-size: .77rem; text-decoration: none; font-weight: 700; }
.empty { max-width: 1180px; margin: 1rem auto; text-align: center; padding: 4rem 1rem; border: 1px dashed #ccd3df; border-radius: 20px; color: var(--muted); }
.empty strong, .empty span { display: block; }
.backdrop { position: fixed; inset: 0; background: rgba(5,9,18,.46); z-index: 15; }

@media (max-width: 980px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; transform: translateX(-105%); width: 290px; transition: transform .2s; }
  .sidebar.open { transform: translateX(0); }
  .menu-button { display: inline-grid; }
  .eyebrow { display: none; }
  .topbar { justify-content: flex-start; position: sticky; top: 0; background: rgba(244,246,251,.92); backdrop-filter: blur(12px); z-index: 10; }
  .search { width: 100%; }
  .intro { align-items: flex-start; flex-direction: column; }
}
@media (max-width: 660px) {
  main { padding: 0 1rem 4rem; }
  .search kbd { display: none; }
  .intro { padding-top: 2.3rem; }
  .stats { width: 100%; justify-content: space-between; }
  .toolbar { align-items: flex-start; }
  .expand-all { display: none; }
  .module-head { padding: 1.2rem; }
  .lessons { padding: .4rem .55rem .8rem; }
  .lesson summary { grid-template-columns: 34px minmax(0,1fr) auto; padding: .9rem .35rem; }
  .lesson-body { margin-left: .35rem; }
  .tag { display: none; }
  .asset-grid { grid-template-columns: 1fr; }
}
