:root {
  --bg: #090a0f;
  --bg-soft: #0f111a;
  --surface: #141725;
  --surface-2: #1a1e2f;
  --line: #232839;
  --text: #eef1f8;
  --muted: #98a1b8;
  --muted-2: #6f7893;
  --accent: #7c5cff;
  --accent-2: #22d3ee;
  --danger: #ff5c7a;
  --radius: 16px;
  --radius-sm: 10px;
  --max: 1400px;
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  background: var(--bg);
  background-image:
    radial-gradient(900px 500px at 12% -10%, rgba(124, 92, 255, 0.16), transparent 60%),
    radial-gradient(700px 400px at 95% 0%, rgba(34, 211, 238, 0.1), transparent 55%);
  background-repeat: no-repeat;
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font: inherit;
  color: inherit;
}

img {
  display: block;
  max-width: 100%;
}

/* ---------- topbar ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 14px clamp(16px, 4vw, 48px);
  background: rgba(9, 10, 15, 0.82);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(35, 40, 57, 0.7);
}

body.locked .topbar {
  display: none;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  letter-spacing: -0.02em;
  font-size: 18px;
  flex: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  font-size: 13px;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 8px 24px -8px rgba(124, 92, 255, 0.9);
}

.search {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  max-width: 520px;
  padding: 0 14px;
  height: 42px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  transition: border-color 0.15s ease, background 0.15s ease;
}

.search:focus-within {
  border-color: rgba(124, 92, 255, 0.65);
  background: var(--surface-2);
}

.search svg {
  width: 18px;
  height: 18px;
  flex: none;
  fill: none;
  stroke: var(--muted);
  stroke-width: 1.8;
  stroke-linecap: round;
}

.search input {
  width: 100%;
  height: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 14.5px;
}

.search input::placeholder {
  color: var(--muted-2);
}

.top-actions {
  margin-left: auto;
  display: flex;
  gap: 8px;
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  font-size: 16px;
  transition: 0.15s ease;
}

.icon-btn:hover {
  color: var(--text);
  border-color: #333a52;
  background: var(--surface-2);
}

/* ---------- layout ---------- */

main {
  max-width: var(--max);
  margin: 0 auto;
  padding: clamp(20px, 3vw, 36px) clamp(16px, 4vw, 48px) 80px;
}

.boot {
  display: grid;
  place-items: center;
  min-height: 60vh;
}

.spinner {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.12);
  border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

h1,
h2,
h3 {
  margin: 0;
  letter-spacing: -0.02em;
}

.muted {
  color: var(--muted);
}

.eyebrow {
  margin: 0 0 10px;
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent-2);
  font-weight: 700;
}

/* ---------- hero ---------- */

.hero {
  position: relative;
  overflow: hidden;
  border-radius: 22px;
  border: 1px solid var(--line);
  min-height: 260px;
  display: flex;
  align-items: flex-end;
  margin-bottom: 34px;
  isolation: isolate;
}

.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(6, 7, 11, 0.9) 8%, rgba(6, 7, 11, 0.35) 60%, transparent);
  z-index: 0;
  pointer-events: none;
}

.hero-body {
  position: relative;
  z-index: 1;
  padding: clamp(22px, 4vw, 44px);
  max-width: 640px;
}

.hero h1 {
  font-size: clamp(26px, 4vw, 42px);
  line-height: 1.08;
  margin-bottom: 10px;
}

.hero p.muted {
  margin: 0 0 20px;
  font-size: 15px;
}

/* ---------- buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 44px;
  padding: 0 20px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  cursor: pointer;
  font-weight: 600;
  font-size: 14.5px;
  transition: 0.15s ease;
}

.btn:hover {
  background: var(--surface-2);
}

.btn.primary {
  border: 0;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), #5b8cff);
  box-shadow: 0 16px 34px -16px rgba(124, 92, 255, 0.95);
}

.btn.primary:hover {
  filter: brightness(1.08);
}

.btn.ghost {
  background: transparent;
}

.btn.small {
  height: 36px;
  padding: 0 14px;
  font-size: 13px;
}

.chip {
  height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
}

.chip[aria-pressed="true"] {
  color: #fff;
  border-color: transparent;
  background: linear-gradient(135deg, var(--accent), #5b8cff);
}

/* ---------- sections ---------- */

.row {
  margin-bottom: 36px;
}

.row-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 14px;
}

.row h2 {
  font-size: 19px;
}

.row-head .link {
  margin-left: auto;
  font-size: 13px;
  color: var(--muted);
}

.row-head .link:hover {
  color: var(--text);
}

.rail {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(250px, 270px);
  gap: 16px;
  overflow-x: auto;
  padding-bottom: 8px;
  scroll-snap-type: x proximity;
  scrollbar-width: thin;
}

.rail > * {
  scroll-snap-align: start;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(236px, 1fr));
  gap: 18px;
}

/* ---------- card ---------- */

.card {
  display: block;
  border-radius: var(--radius);
  transition: transform 0.18s ease;
}

.card:hover {
  transform: translateY(-3px);
}

.cover {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  background: var(--surface);
  box-shadow: 0 18px 40px -26px #000;
}

.cover img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cover::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 45%, rgba(0, 0, 0, 0.55));
  opacity: 0;
  transition: opacity 0.18s ease;
  z-index: 2;
}

.card:hover .cover::before {
  opacity: 1;
}

.cover-letter {
  font-size: clamp(30px, 6vw, 46px);
  font-weight: 800;
  color: rgba(255, 255, 255, 0.82);
  letter-spacing: -0.04em;
  text-transform: uppercase;
  z-index: 1;
}

.cover .play {
  position: absolute;
  z-index: 3;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.3);
  backdrop-filter: blur(6px);
  opacity: 0;
  transform: scale(0.9);
  transition: 0.18s ease;
}

.card:hover .cover .play {
  opacity: 1;
  transform: scale(1);
}

.badge {
  position: absolute;
  z-index: 3;
  right: 8px;
  bottom: 8px;
  padding: 2px 7px;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 700;
  color: #fff;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(4px);
}

.tag.warn {
  position: absolute;
  z-index: 3;
  left: 8px;
  top: 8px;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  background: rgba(255, 180, 60, 0.16);
  border: 1px solid rgba(255, 180, 60, 0.45);
  color: #ffc861;
}

.seen {
  position: absolute;
  z-index: 3;
  right: 8px;
  top: 8px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 800;
  color: #07110b;
  background: #4ade80;
}

.pbar {
  position: absolute;
  z-index: 3;
  left: 0;
  right: 0;
  bottom: 0;
  height: 4px;
  background: rgba(255, 255, 255, 0.16);
}

.pbar i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}

.card-title {
  margin: 10px 2px 2px;
  font-size: 14.5px;
  font-weight: 600;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-sub {
  margin: 0 2px;
  font-size: 12.5px;
  color: var(--muted-2);
}

/* ---------- course header ---------- */

.course-head {
  position: relative;
  border-radius: 22px;
  border: 1px solid var(--line);
  padding: clamp(22px, 4vw, 40px);
  margin-bottom: 30px;
  overflow: hidden;
}

.course-head::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(6, 7, 11, 0.92), rgba(6, 7, 11, 0.45));
}

.course-head > * {
  position: relative;
  z-index: 1;
}

.back {
  display: inline-block;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 14px;
}

.back:hover {
  color: var(--text);
}

.course-head h1 {
  font-size: clamp(24px, 3.4vw, 36px);
  margin-bottom: 8px;
}

.course-head p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.section-title {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 30px 0 14px;
  font-size: 16px;
  color: var(--muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

/* ---------- watch ---------- */

.watch {
  max-width: 1100px;
  margin: 0 auto;
}

.watch-head {
  margin-bottom: 16px;
}

.watch-head h1 {
  font-size: clamp(19px, 2.6vw, 26px);
  margin-bottom: 6px;
  line-height: 1.25;
}

.watch-head .meta {
  color: var(--muted);
  font-size: 13.5px;
  margin: 0;
}

.player {
  position: relative;
  background: #000;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid var(--line);
  box-shadow: 0 40px 90px -50px #000;
}

.player video {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  outline: none;
}

.player:fullscreen video {
  width: 100vw;
  height: 100vh;
  aspect-ratio: auto;
  object-fit: contain;
}

.watch-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.watch-bar .speeds {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.watch-bar .spacer {
  flex: 1;
}

.hint {
  margin: 18px 0 0;
  font-size: 12.5px;
  color: var(--muted-2);
}

.notice {
  border-radius: var(--radius);
  border: 1px solid rgba(255, 180, 60, 0.35);
  background: rgba(255, 180, 60, 0.08);
  padding: 20px 22px;
  line-height: 1.6;
}

.notice code {
  background: rgba(255, 255, 255, 0.08);
  padding: 2px 6px;
  border-radius: 6px;
  font-size: 13px;
}

/* ---------- lock ---------- */

.lock {
  max-width: 360px;
  margin: 14vh auto 0;
  display: grid;
  gap: 14px;
  padding: 32px;
  border-radius: 22px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: 0 40px 80px -50px #000;
}

.lock-icon {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  font-size: 18px;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  justify-self: center;
}

.lock h1 {
  text-align: center;
  font-size: 22px;
}

.lock p {
  text-align: center;
  margin: 0;
  font-size: 14px;
}

.lock input {
  height: 46px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--bg-soft);
  color: var(--text);
  font-size: 15px;
  outline: none;
}

.lock input:focus {
  border-color: rgba(124, 92, 255, 0.7);
}

.err {
  min-height: 18px;
  color: var(--danger) !important;
  font-size: 13px !important;
}

/* ---------- misc ---------- */

.empty {
  max-width: 520px;
  margin: 12vh auto;
  text-align: center;
  padding: 32px;
  border-radius: var(--radius);
  border: 1px dashed var(--line);
}

.empty h2 {
  margin-bottom: 10px;
}

.empty p {
  color: var(--muted);
  line-height: 1.6;
}

.skeleton {
  display: grid;
  gap: 18px;
}

.sk-line {
  height: 14px;
  border-radius: 8px;
  background: linear-gradient(90deg, #141725, #1b2033, #141725);
  background-size: 200% 100%;
  animation: shimmer 1.2s infinite linear;
}

.sk-card {
  aspect-ratio: 16 / 9;
  border-radius: var(--radius);
  background: linear-gradient(90deg, #141725, #1b2033, #141725);
  background-size: 200% 100%;
  animation: shimmer 1.2s infinite linear;
}

.sk-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(236px, 1fr));
  gap: 18px;
}

@keyframes shimmer {
  to {
    background-position: -200% 0;
  }
}

@media (max-width: 720px) {
  .topbar {
    gap: 10px;
    padding: 10px 14px;
  }

  .brand-name {
    display: none;
  }

  .search {
    height: 38px;
  }

  .grid,
  .sk-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
  }

  .rail {
    grid-auto-columns: 200px;
  }

  .card-title {
    font-size: 13px;
  }

  .hero {
    min-height: 220px;
  }

  main {
    padding-bottom: 40px;
  }

  .hint {
    display: none;
  }
}

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