:root {
  color-scheme: dark;
  --background: #0b0912;
  --surface: #15111f;
  --surface-raised: #1d1830;
  --border: #2a2340;
  --text: #f1edf9;
  --muted: #948da9;
  --purple: #7c4dff;
  --purple-deep: #7c3aed;
  --lilac: #b79cff;
  --green: #34d399;
  --focus: #d8c8ff;
  --sidebar-width: 290px;
  font-family: "Manrope", system-ui, sans-serif;
  background: var(--background);
  color: var(--text);
}

* { box-sizing: border-box; }

html { min-width: 320px; scroll-behavior: smooth; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background: var(--background);
  color: var(--text);
  line-height: 1.55;
  text-rendering: optimizeLegibility;
}

button, a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; }
a { color: inherit; }
::selection { color: #0b0912; background: var(--lilac); }

::-webkit-scrollbar { width: 11px; }
::-webkit-scrollbar-track { background: var(--background); }
::-webkit-scrollbar-thumb { background: #3d3458; border: 3px solid var(--background); border-radius: 10px; }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }

.skip-link {
  position: fixed;
  z-index: 100;
  top: 12px;
  left: 12px;
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--text);
  color: var(--background);
  transform: translateY(-160%);
  transition: transform 180ms cubic-bezier(.16, 1, .3, 1);
}

.skip-link:focus { transform: translateY(0); }
.app-shell { min-height: 100vh; }

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 20;
  display: flex;
  width: var(--sidebar-width);
  flex-direction: column;
  padding: 28px 20px 24px;
  overflow-y: auto;
  border-right: 1px solid var(--border);
  background: var(--surface);
}

.sidebar__top { display: flex; align-items: center; justify-content: space-between; }

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  width: fit-content;
  text-decoration: none;
}

.brand__logo { width: 38px; height: 38px; object-fit: contain; }
.mobile-brand { width: 34px; height: 34px; object-fit: contain; }
.brand__name { max-width: 92px; color: var(--muted); font-size: .66rem; font-weight: 600; line-height: 1.2; }

.sidebar__heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-top: 48px;
}

.sidebar__heading h1 {
  margin: 0 0 3px;
  font-family: "Sora", system-ui, sans-serif;
  font-size: 1.2rem;
  letter-spacing: -0.025em;
}

.sidebar__heading p { margin: 0; color: var(--muted); font-size: .78rem; }
.progress-count { color: var(--lilac); font-size: .78rem; font-weight: 700; font-variant-numeric: tabular-nums; }

.progress-track { height: 3px; margin: 15px 0 24px; overflow: hidden; border-radius: 3px; background: var(--border); }
.progress-track span { display: block; width: 0; height: 100%; background: var(--purple); }

.lesson-nav ol { display: grid; gap: 7px; margin: 0; padding: 0; list-style: none; }

.lesson-nav__button {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) 20px;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 55px;
  padding: 9px 10px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: var(--muted);
  text-align: left;
  cursor: pointer;
  transition: color 160ms ease, background 160ms ease, border-color 160ms ease;
}

.lesson-nav__button:hover { color: var(--text); background: #1a1527; }
.lesson-nav__button.is-active { border-color: #44356d; background: #261d3d; color: var(--text); }
.lesson-nav__number { font-size: .72rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.lesson-nav__title { min-width: 0; overflow-wrap: anywhere; font-size: .82rem; font-weight: 600; line-height: 1.3; }
.lesson-nav__status { display: grid; width: 19px; height: 19px; place-items: center; border: 1px solid #413850; border-radius: 50%; color: transparent; }
.lesson-nav__status svg { width: 12px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 2.5; }
.lesson-nav__button.is-complete .lesson-nav__status { border-color: var(--green); background: #163a30; color: var(--green); }

.sidebar__close, .mobile-header { display: none; }
.main { min-height: 100vh; margin-left: var(--sidebar-width); }

.content-wrap {
  width: min(100%, 1060px);
  margin: 0 auto;
  padding: clamp(52px, 7vw, 92px) clamp(32px, 6vw, 72px) 52px;
}

.route-notice {
  margin-bottom: 28px;
  padding: 12px 15px;
  border: 1px solid #4b3d75;
  border-radius: 12px;
  background: #1d1730;
  color: #d9cffa;
  font-size: .88rem;
}

.lesson__intro { margin-bottom: 28px; }
.lesson-position { margin: 0 0 10px; color: var(--lilac); font-size: .86rem; font-weight: 700; }

.lesson h2 {
  overflow-wrap: anywhere;
  max-width: 17ch;
  margin: 0;
  font-family: "Sora", system-ui, sans-serif;
  font-size: clamp(2rem, 4.5vw, 3.65rem);
  line-height: 1.08;
  letter-spacing: -0.035em;
  text-wrap: balance;
}

.lesson-description { max-width: 68ch; margin: 16px 0 0; color: var(--muted); }

.video-parts {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 12px;
}

.video-parts__button {
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: #c3bcd2;
  font-size: .78rem;
  font-weight: 700;
  cursor: pointer;
  transition: color 160ms ease, border-color 160ms ease, background 160ms ease;
}

.video-parts__button:hover { border-color: #51436f; color: var(--text); }
.video-parts__button.is-active { border-color: #6548a8; background: #2a2044; color: var(--text); }

.video-frame {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 16px;
  background: #050408;
  box-shadow: 0 22px 55px rgba(0, 0, 0, .32);
}

.video-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

.video-frame--empty {
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  background: var(--surface-raised);
  box-shadow: none;
}

.video-empty { display: flex; align-items: center; gap: 20px; max-width: 440px; padding: 28px; }
.video-empty__icon { display: grid; width: 54px; height: 54px; flex: 0 0 auto; place-items: center; border-radius: 14px; background: #29203e; color: var(--lilac); }
.video-empty__icon svg { width: 25px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.7; }
.video-empty strong { display: block; font-family: "Sora", system-ui, sans-serif; font-size: 1.02rem; }
.video-empty p { margin: 5px 0 10px; color: var(--muted); font-size: .88rem; }
.video-empty div > span { color: var(--lilac); font-size: .75rem; font-weight: 700; }

.lesson-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 18px; margin-top: 22px; }

.button {
  display: inline-flex;
  min-height: 46px;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease, color 160ms ease, transform 160ms ease;
}

.button svg { width: 18px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 2.3; }
.button--primary { background: var(--purple-deep); color: #fff; }
.button--primary:hover { background: #8b5cf6; transform: translateY(-1px); }
.button--primary.is-complete { border-color: #267c62; background: #173c31; color: var(--green); }
.button--primary.is-complete:hover { background: #1b493b; }
.button:disabled, .pagination-button:disabled, .text-link:disabled { cursor: not-allowed; opacity: .45; transform: none; }

.lesson-actions__links { display: flex; flex-wrap: wrap; align-items: center; gap: 22px; }
.text-link { display: inline-flex; min-height: 44px; align-items: center; gap: 7px; padding: 6px 0; border: 0; background: transparent; color: #c3bcd2; font-size: .82rem; font-weight: 600; text-decoration: underline; text-decoration-color: transparent; text-underline-offset: 4px; cursor: pointer; }
.text-link:hover { color: var(--text); text-decoration-color: currentColor; }
.text-link svg { width: 15px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }

.lesson-pagination { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 54px; padding-top: 24px; border-top: 1px solid var(--border); }
.pagination-button { display: flex; min-width: 0; align-items: center; gap: 12px; padding: 13px 15px; border: 1px solid transparent; border-radius: 12px; background: transparent; color: var(--text); text-align: left; cursor: pointer; }
.pagination-button:hover:not(:disabled) { border-color: var(--border); background: var(--surface); }
.pagination-button--next { justify-content: flex-end; text-align: right; }
.pagination-button svg { width: 20px; flex: 0 0 auto; fill: none; stroke: var(--lilac); stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }
.pagination-button span { display: grid; min-width: 0; }
.pagination-button small { color: var(--muted); font-size: .72rem; }
.pagination-button strong { overflow: hidden; font-size: .84rem; text-overflow: ellipsis; white-space: nowrap; }

.icon-button { display: grid; width: 44px; height: 44px; padding: 0; place-items: center; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-raised); color: var(--text); }
.icon-button svg { width: 21px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-width: 1.8; }
.sidebar__close { display: none; }
.scrim[hidden], [hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
noscript { position: fixed; right: 16px; bottom: 16px; z-index: 50; max-width: 360px; padding: 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-raised); color: var(--text); }

@media (max-width: 1023px) {
  body.panel-open { overflow: hidden; }
  .sidebar { width: min(88vw, 330px); padding: 20px 18px 24px; visibility: hidden; transform: translateX(-102%); transition: transform 260ms cubic-bezier(.16, 1, .3, 1), visibility 260ms; }
  .sidebar.is-open { visibility: visible; transform: translateX(0); }
  .sidebar__close { display: grid; cursor: pointer; }
  .sidebar__heading { margin-top: 36px; }
  .scrim { position: fixed; inset: 0; z-index: 15; background: rgba(5, 4, 8, .74); }
  .main { margin-left: 0; }
  .mobile-header { position: sticky; top: 0; z-index: 10; display: flex; min-height: 66px; align-items: center; justify-content: space-between; padding: 0 18px; border-bottom: 1px solid var(--border); background: rgba(11, 9, 18, .95); backdrop-filter: blur(12px); }
  .mobile-lessons-button { display: inline-flex; min-height: 44px; align-items: center; gap: 8px; padding: 0 13px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-raised); color: var(--text); font-size: .78rem; font-weight: 700; }
  .mobile-lessons-button svg { width: 18px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-width: 1.8; }
  .content-wrap { padding: 40px 18px 32px; }
  .lesson__intro { margin-bottom: 22px; }
  .lesson h2 { font-size: clamp(1.8rem, 9vw, 2.7rem); }
  .video-frame { border-radius: 13px; }
  .video-parts { overflow-x: auto; padding-bottom: 2px; }
  .video-parts__button { flex: 0 0 auto; }
  .video-empty { display: grid; justify-items: center; gap: 12px; padding: 18px; text-align: center; }
  .video-empty__icon { width: 46px; height: 46px; }
  .video-empty p { margin-bottom: 6px; }
  .lesson-actions { align-items: stretch; flex-direction: column; }
  .button { width: 100%; }
  .lesson-actions__links { justify-content: space-between; }
  .lesson-pagination { gap: 5px; margin-top: 38px; }
  .pagination-button { padding: 12px 7px; }
  .pagination-button strong { max-width: 29vw; }
}

@media (max-width: 420px) {
  .lesson-actions__links { align-items: flex-start; flex-direction: column; gap: 5px; }
  .pagination-button small { font-size: .68rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
