@font-face {
  font-family: "Inter";
  src: url("assets/fonts/Inter-var-latin.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #0b0b10;
  --surface: #111118;
  --surface-2: #16161e;
  --surface-3: #1c1c26;
  --line: rgba(255, 255, 255, 0.07);
  --line-2: rgba(255, 255, 255, 0.11);
  --text: #f4f4f6;
  --muted: rgba(244, 244, 246, 0.66);
  --faint: rgba(244, 244, 246, 0.44);
  --a: #7c5cff;
  --b: #22d3ee;
  --grad: linear-gradient(90deg, #7c5cff, #22d3ee);
  --sidebar: 380px;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

* { box-sizing: border-box; }

html {
  background: var(--bg);
  color-scheme: dark;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-feature-settings: "cv11", "ss01";
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

button { font: inherit; color: inherit; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--b); outline-offset: 2px; }

/* ---------- layout ---------- */
.app {
  display: grid;
  grid-template-columns: var(--sidebar) minmax(0, 1fr);
  grid-template-rows: 1fr auto;
  min-height: 100vh;
  min-height: 100dvh;
}

.sidebar {
  grid-column: 1;
  grid-row: 1 / span 2;
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-right: 1px solid var(--line);
}

.main {
  grid-column: 2;
  grid-row: 1;
  min-width: 0;
  position: relative;
  padding: 40px 56px 16px;
  isolation: isolate;
}

.main::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 560px;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(640px 320px at 30% 0%, rgba(124, 92, 255, 0.13), transparent 70%),
    radial-gradient(560px 300px at 85% 10%, rgba(34, 211, 238, 0.07), transparent 70%);
}

.stage {
  /* keep the player, title and buttons inside one screen on short laptop displays */
  max-width: max(640px, min(1160px, calc((100vh - 250px) * 1.7778)));
  margin: 0 auto;
}

.foot {
  grid-column: 2;
  grid-row: 2;
  padding: 28px 56px 32px;
  font-size: 12.5px;
  color: var(--faint);
  text-align: center;
  letter-spacing: 0.01em;
}

/* ---------- brand ---------- */
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 26px 24px 22px;
  text-decoration: none;
}

.brand-mark {
  width: 40px;
  height: 40px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 11px;
  background: linear-gradient(180deg, #1b1b25, #121219);
  box-shadow: inset 0 0 0 1px var(--line-2), 0 6px 18px -8px rgba(124, 92, 255, 0.45);
}

.brand-mark img { width: 20px; height: auto; display: block; }

.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-name { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; line-height: 1.25; }
.brand-by { font-size: 12.5px; color: var(--faint); line-height: 1.35; }

/* ---------- overall progress ---------- */
.overall {
  margin: 0 16px 6px;
  padding: 16px 16px 14px;
  border-radius: 12px;
  background: var(--surface-2);
  box-shadow: inset 0 0 0 1px var(--line);
}

.overall-top { display: flex; align-items: baseline; justify-content: space-between; }
.overall-label { font-size: 12.5px; font-weight: 500; color: var(--muted); }
.overall-pct {
  font-size: 22px;
  font-weight: 650;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.bar {
  height: 6px;
  margin-top: 12px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.bar > i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: var(--grad);
  transition: width 0.6s var(--ease);
}

.overall-count {
  margin-top: 9px;
  font-size: 12.5px;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
}

/* ---------- lesson list ---------- */
.lessons {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 4px 10px 16px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.12) transparent;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 14px, #000 calc(100% - 14px), transparent 100%);
  mask-image: linear-gradient(to bottom, transparent 0, #000 14px, #000 calc(100% - 14px), transparent 100%);
}

.group-label {
  padding: 16px 12px 8px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--faint);
}

.lesson-list { list-style: none; margin: 0; padding: 0; }

.lesson a {
  position: relative;
  display: grid;
  grid-template-columns: 22px 84px minmax(0, 1fr) 18px;
  align-items: center;
  gap: 12px;
  padding: 8px 10px;
  border-radius: 10px;
  text-decoration: none;
  transition: background-color 0.15s ease;
}

.lesson a:hover { background: rgba(255, 255, 255, 0.04); }

.lesson.current a {
  background: linear-gradient(90deg, rgba(124, 92, 255, 0.16), rgba(34, 211, 238, 0.05));
  box-shadow: inset 0 0 0 1px rgba(124, 92, 255, 0.30);
}

.num {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--faint);
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.num img { width: 14px; height: auto; display: block; margin: 0 auto; opacity: 0.9; }
.lesson.current .num { color: var(--text); }

.thumb {
  position: relative;
  width: 84px;
  aspect-ratio: 16 / 9;
  border-radius: 6px;
  overflow: hidden;
  background: linear-gradient(135deg, #1d1b2e, #122126);
  box-shadow: inset 0 0 0 1px var(--line);
}

.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.thumb .prog {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  background: rgba(255, 255, 255, 0.16);
}

.thumb .prog > i {
  display: block;
  height: 100%;
  width: 0;
  background: var(--grad);
  transition: width 0.3s linear;
}

.ltext { min-width: 0; display: flex; flex-direction: column; gap: 2px; }

.ltitle {
  font-size: 13.5px;
  font-weight: 500;
  line-height: 1.35;
  color: rgba(244, 244, 246, 0.9);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.lesson.current .ltitle { color: #fff; }

.lmeta {
  font-size: 12px;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.lmeta .playing {
  font-weight: 600;
  color: transparent;
  background: linear-gradient(90deg, #a490ff, #22d3ee);
  -webkit-background-clip: text;
  background-clip: text;
}

.check {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, 0.14);
  transition: background 0.3s ease, box-shadow 0.3s ease;
}

.check svg { opacity: 0; transform: scale(0.6); transition: opacity 0.25s ease, transform 0.25s var(--ease); }
.lesson.done .check { background: var(--grad); box-shadow: none; }
.lesson.done .check svg { opacity: 1; transform: none; }

.sidebar-foot {
  padding: 12px 24px 18px;
  border-top: 1px solid var(--line);
}

.link {
  padding: 4px 0;
  border: 0;
  background: none;
  font-size: 12.5px;
  color: var(--faint);
  cursor: pointer;
}

.link:hover { color: var(--muted); text-decoration: underline; text-underline-offset: 3px; }

/* ---------- player ---------- */
.topbar { display: none; }

.player {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 16px;
  background: #000;
  box-shadow:
    0 0 0 1px var(--line-2),
    0 30px 80px -24px rgba(0, 0, 0, 0.8),
    0 0 140px -50px rgba(124, 92, 255, 0.45);
}

.player video {
  display: block;
  width: 100%;
  height: 100%;
  background: #000;
}

.sound-pill {
  position: absolute;
  top: 16px;
  left: 16px;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 16px 0 13px;
  border: 0;
  border-radius: 99px;
  background: rgba(12, 12, 18, 0.72);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2), 0 8px 24px -8px rgba(0, 0, 0, 0.6);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  color: #fff;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  animation: rise 0.45s var(--ease) both;
}

.sound-pill:hover { background: rgba(24, 24, 34, 0.86); }
.sound-pill[hidden] { display: none; }

.overlay {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: grid;
  place-items: center;
  background: rgba(8, 8, 12, 0.8);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  animation: fade 0.3s ease both;
}

.overlay[hidden] { display: none; }

.overlay-card {
  max-width: 560px;
  padding: 24px;
  text-align: center;
  animation: rise 0.45s var(--ease) both;
}

.overlay-label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.overlay-title {
  margin-top: 10px;
  font-size: 28px;
  font-weight: 650;
  line-height: 1.2;
  letter-spacing: -0.022em;
  text-wrap: balance;
}

.overlay-sub {
  margin-top: 8px;
  font-size: 15px;
  color: var(--muted);
}

.overlay-sub:empty { display: none; }

.overlay-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 22px;
}

.countdown { flex: none; transform: rotate(-90deg); }
.countdown[hidden] { display: none; }
.countdown circle { fill: none; stroke-width: 2.5; }
.countdown-track { stroke: rgba(11, 11, 16, 0.18); }
.countdown-fill {
  stroke: #0b0b10;
  stroke-linecap: round;
  stroke-dasharray: 50.27;
  stroke-dashoffset: 50.27;
}

.countdown.run .countdown-fill { animation: countdown 3s linear forwards; }

/* ---------- meta under player ---------- */
.meta {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 32px;
  margin-top: 28px;
}

.meta-text { min-width: 0; }

.eyebrow {
  display: inline-block;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: transparent;
  background: linear-gradient(90deg, #a490ff, #22d3ee);
  -webkit-background-clip: text;
  background-clip: text;
}

h1 {
  margin: 6px 0 0;
  font-size: 30px;
  font-weight: 650;
  line-height: 1.15;
  letter-spacing: -0.024em;
  text-wrap: balance;
}

.summary {
  margin: 10px 0 0;
  max-width: 64ch;
  font-size: 16px;
  line-height: 1.55;
  color: var(--muted);
  text-wrap: pretty;
}

.nav { display: flex; flex: none; gap: 10px; padding-top: 22px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  padding: 0 16px;
  border: 0;
  border-radius: 10px;
  background: var(--surface-2);
  box-shadow: inset 0 0 0 1px var(--line-2);
  color: var(--text);
  font-size: 14px;
  font-weight: 550;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.15s ease, transform 0.15s ease, opacity 0.15s ease;
}

.btn:hover { background: var(--surface-3); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.38; cursor: default; transform: none; }
.btn:disabled:hover { background: var(--surface-2); }

.btn-primary {
  background: #f4f4f6;
  box-shadow: none;
  color: #0b0b10;
}

.btn-primary:hover { background: #fff; }
.btn-primary:disabled:hover { background: #f4f4f6; }

.error-note {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  text-align: center;
  color: var(--muted);
  font-size: 15px;
}

.noscript { padding: 24px; color: var(--muted); text-align: center; }

@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes countdown { to { stroke-dashoffset: 0; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ---------- tablet / phone ---------- */
@media (max-width: 1100px) and (min-width: 901px) {
  :root { --sidebar: 340px; }
  .main { padding: 32px 36px 12px; }
  .foot { padding: 24px 36px 28px; }
  .meta { flex-direction: column; gap: 4px; }
  .nav { padding-top: 12px; }
}

@media (max-width: 900px) {
  .app {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto;
  }

  .main { grid-column: 1; grid-row: auto; order: 1; padding: 0; }
  .main::before { height: 420px; }

  .sidebar {
    grid-column: 1;
    grid-row: auto;
    order: 2;
    position: static;
    height: auto;
    background: transparent;
    border-right: 0;
  }

  .sidebar > .brand { display: none; }
  .foot { grid-column: 1; grid-row: auto; order: 3; padding: 20px 20px 32px; }

  .topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 16px;
    padding-top: max(10px, env(safe-area-inset-top));
    background: rgba(11, 11, 16, 0.86);
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--line);
  }

  .brand-compact { padding: 0; gap: 10px; }
  .brand-compact .brand-mark { width: 34px; height: 34px; border-radius: 10px; }
  .brand-compact .brand-mark img { width: 17px; }
  .brand-compact .brand-name { font-size: 14.5px; }
  .brand-compact .brand-by { font-size: 12px; }

  .ring {
    --p: 0;
    position: relative;
    width: 40px;
    height: 40px;
    flex: none;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: conic-gradient(from 0deg, #7c5cff, #22d3ee calc(var(--p) * 1%), rgba(255, 255, 255, 0.1) 0);
    font-size: 10.5px;
    font-weight: 650;
    font-variant-numeric: tabular-nums;
  }

  .ring::before {
    content: "";
    position: absolute;
    inset: 3px;
    border-radius: 50%;
    background: #101017;
  }

  .ring span { position: relative; }

  .stage { max-width: none; }
  .player { border-radius: 0; box-shadow: none; }
  .sound-pill { top: 10px; left: 10px; height: 34px; font-size: 13px; padding: 0 14px 0 11px; }

  .meta { flex-direction: column; gap: 16px; margin: 0; padding: 18px 20px 6px; }
  h1 { font-size: 23px; }
  .summary { font-size: 15px; }
  .nav { width: 100%; padding-top: 0; }
  .nav .btn { flex: 1; height: 44px; }

  .overall { margin: 20px 16px 4px; }
  .lessons { overflow: visible; padding: 0 8px 8px; -webkit-mask-image: none; mask-image: none; }
  .lesson a { grid-template-columns: 22px 96px minmax(0, 1fr) 18px; padding: 9px 8px; }
  .thumb { width: 96px; }
  .ltitle { font-size: 14px; }
  .sidebar-foot { border-top: 0; padding: 4px 24px 0; text-align: center; }

  .overlay-card { padding: 12px 16px; }
  .overlay-label { font-size: 10.5px; }
  .overlay-title { margin-top: 4px; font-size: 18px; }
  .overlay-sub { font-size: 13px; margin-top: 4px; }
  .overlay-actions { margin-top: 12px; }
  .overlay-actions .btn { height: 34px; padding: 0 13px; font-size: 13px; }
}
