:root {
  color: #e9edf5;
  background: #0f1115;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  --page: #0f1115;
  --surface: #181b21;
  --surface-hover: #20242c;
  --line: #2a2f39;
  --text: #f5f7fb;
  --muted: #9aa3b2;
  --brand: #ef4b3f;
}

* {
  box-sizing: border-box;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background: var(--page);
}

button,
input {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
}

.boot-state,
.error-state {
  display: flex;
  min-height: 100vh;
  padding: 32px;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--muted);
  text-align: center;
}

.boot-state img {
  width: 38px;
  height: 38px;
}

.error-state button {
  min-height: 40px;
  padding: 0 17px;
  color: #fff;
  border: 0;
  border-radius: 8px;
  background: var(--brand);
  cursor: pointer;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  height: 66px;
  border-bottom: 1px solid var(--line);
  background: rgb(15 17 21 / 94%);
  backdrop-filter: blur(14px);
}

.header-inner {
  display: flex;
  width: min(1320px, calc(100% - 48px));
  height: 100%;
  margin: 0 auto;
  align-items: center;
  gap: 24px;
}

.brand-link {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
}

.brand-link img {
  width: 34px;
  height: 34px;
  border-radius: 8px;
}

.brand-link strong {
  font-size: 16px;
}

.header-search {
  position: relative;
  width: min(420px, 42vw);
  margin-left: auto;
}

.header-search::before {
  position: absolute;
  top: 50%;
  left: 14px;
  width: 12px;
  height: 12px;
  border: 2px solid #747d8c;
  border-radius: 50%;
  content: "";
  transform: translateY(-58%);
}

.header-search::after {
  position: absolute;
  top: 34px;
  left: 25px;
  width: 6px;
  height: 2px;
  content: "";
  background: #747d8c;
  transform: rotate(45deg);
}

.header-search input {
  width: 100%;
  height: 40px;
  padding: 0 16px 0 40px;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 20px;
  outline: none;
  background: #1b1e24;
}

.header-search input::placeholder {
  color: #7e8796;
}

.header-search input:focus {
  border-color: #626d7e;
}

.open-aibox {
  display: inline-flex;
  min-height: 38px;
  padding: 0 16px;
  align-items: center;
  color: #fff;
  border-radius: 19px;
  background: var(--brand);
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
}

.page-shell {
  width: min(1320px, calc(100% - 48px));
  margin: 0 auto;
  padding: 38px 0 72px;
}

.course-heading {
  display: flex;
  margin-bottom: 24px;
  align-items: baseline;
  gap: 12px;
}

.course-heading h1 {
  margin: 0;
  color: var(--text);
  font-size: 28px;
  line-height: 1.2;
}

.course-heading span {
  color: var(--muted);
  font-size: 14px;
}

.lesson-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 28px 20px;
}

.lesson-card {
  display: block;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}

.lesson-cover {
  position: relative;
  overflow: hidden;
  border-radius: 10px;
  background:
    radial-gradient(circle at 72% 18%, rgb(78 119 185 / 42%), transparent 42%),
    linear-gradient(145deg, #222a37, #15181e 62%, #2a181b);
  aspect-ratio: 16 / 9;
}

.lesson-cover img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .2s ease;
}

.lesson-card:hover .lesson-cover img {
  transform: scale(1.025);
}

.cover-number {
  position: absolute;
  top: 50%;
  left: 50%;
  color: rgb(255 255 255 / 16%);
  font-size: clamp(70px, 9vw, 126px);
  font-weight: 900;
  line-height: 1;
  transform: translate(-50%, -50%);
}

.play-button {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: rgb(0 0 0 / 58%);
  box-shadow: 0 0 0 1px rgb(255 255 255 / 18%);
  opacity: 0;
  transform: translate(-50%, -50%) scale(.9);
  transition: opacity .18s, transform .18s;
}

.play-button::after {
  position: absolute;
  top: 15px;
  left: 21px;
  width: 0;
  height: 0;
  border-top: 11px solid transparent;
  border-bottom: 11px solid transparent;
  border-left: 16px solid #fff;
  content: "";
}

.lesson-card:hover .play-button {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.cover-duration {
  position: absolute;
  right: 8px;
  bottom: 8px;
  padding: 3px 6px;
  color: #fff;
  border-radius: 4px;
  background: rgb(0 0 0 / 74%);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.lesson-copy {
  padding: 12px 2px 0;
}

.lesson-copy h2 {
  margin: 0;
  overflow: hidden;
  color: var(--text);
  font-size: 17px;
  line-height: 1.45;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lesson-copy p {
  display: -webkit-box;
  margin: 7px 0 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.empty-state {
  grid-column: 1 / -1;
  padding: 70px 20px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  text-align: center;
}

.empty-state h1 {
  color: var(--text);
}

.empty-state a {
  color: #ff8b82;
}

.back-link {
  display: inline-block;
  margin-bottom: 18px;
  color: var(--muted);
  font-size: 14px;
  text-decoration: none;
}

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

.watch-layout {
  display: grid;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #090a0d;
  grid-template-columns: minmax(0, 1fr) 340px;
}

.video-frame {
  position: relative;
  background: #050608;
  aspect-ratio: 16 / 9;
}

.video-frame video,
.video-frame iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  object-fit: contain;
}

.video-placeholder {
  display: flex;
  width: 100%;
  height: 100%;
  padding: 30px;
  align-items: center;
  justify-content: center;
  color: #858e9c;
  background: radial-gradient(circle at 50% 30%, #202938, #090b0f 68%);
  text-align: center;
}

.video-placeholder strong,
.video-placeholder span {
  display: block;
}

.video-placeholder strong {
  margin-bottom: 8px;
  color: #f2f4f8;
  font-size: 18px;
}

.playlist {
  min-width: 0;
  border-left: 1px solid var(--line);
  background: #15181e;
}

.playlist-heading {
  display: flex;
  height: 52px;
  padding: 0 17px;
  align-items: center;
  justify-content: space-between;
  color: var(--text);
  border-bottom: 1px solid var(--line);
  font-size: 15px;
  font-weight: 700;
}

.playlist-heading span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
}

.playlist-scroll {
  max-height: calc((min(1320px, 100vw - 48px) - 340px) * .5625 - 52px);
  overflow-y: auto;
}

.playlist-item {
  display: grid;
  min-height: 62px;
  padding: 11px 14px;
  align-items: center;
  color: #c7cdd7;
  border-bottom: 1px solid rgb(255 255 255 / 5%);
  text-decoration: none;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  gap: 8px;
}

.playlist-item:hover {
  background: var(--surface-hover);
}

.playlist-item.active {
  color: #fff;
  background: #302124;
}

.playlist-item > span {
  color: #717a89;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.playlist-item.active > span {
  color: #ff8e85;
}

.playlist-item strong {
  overflow: hidden;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.playlist-item small {
  color: #707a89;
  font-size: 11px;
}

.lesson-title {
  max-width: 980px;
  padding: 25px 0 4px;
}

.lesson-title h1 {
  margin: 0;
  color: var(--text);
  font-size: clamp(24px, 3vw, 34px);
  line-height: 1.3;
}

.lesson-title p {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.7;
}

.chapter-list {
  display: flex;
  margin-top: 18px;
  gap: 9px;
  flex-wrap: wrap;
}

.chapter-button {
  display: inline-flex;
  min-height: 38px;
  padding: 0 12px;
  align-items: center;
  gap: 8px;
  color: #d2d7df;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  cursor: pointer;
}

.chapter-button:hover {
  background: var(--surface-hover);
}

.chapter-button span {
  color: #ff8b82;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
}

.article-body {
  max-width: 900px;
  margin-top: 46px;
  color: #cbd1db;
  font-size: 16px;
  line-height: 1.85;
}

.article-body h2,
.article-body h3 {
  color: var(--text);
}

.article-body > h2:first-child {
  margin: 0 0 20px;
  font-size: 22px;
}

.article-body h2 {
  margin: 40px 0 14px;
  font-size: 25px;
}

.article-body h3 {
  margin: 30px 0 10px;
  font-size: 20px;
}

.article-body p {
  margin: 13px 0;
}

.article-body ul,
.article-body ol {
  margin: 13px 0;
  padding-left: 25px;
}

.article-body li {
  margin: 7px 0;
}

.article-body blockquote {
  margin: 22px 0;
  padding: 14px 18px;
  color: #d2d7df;
  border-left: 3px solid var(--brand);
  background: #1b1e24;
}

.article-body code {
  padding: 2px 6px;
  border-radius: 4px;
  background: #242832;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: .9em;
}

.article-body pre {
  padding: 18px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #15181e;
}

.article-body pre code {
  padding: 0;
  background: transparent;
}

.article-body a {
  color: #73a9f1;
}

@media (max-width: 1000px) {
  .lesson-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .playlist {
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .playlist-scroll {
    display: grid;
    max-height: 250px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .site-header {
    height: 60px;
  }

  .header-inner,
  .page-shell {
    width: calc(100% - 28px);
  }

  .header-inner {
    gap: 9px;
  }

  .brand-link strong,
  .open-aibox {
    display: none;
  }

  .brand-link img {
    width: 36px;
    height: 36px;
  }

  .header-search {
    width: auto;
    flex: 1 1 auto;
  }

  .page-shell {
    padding-top: 25px;
  }

  .course-heading h1 {
    font-size: 24px;
  }

  .lesson-list {
    grid-template-columns: 1fr;
  }

  .lesson-copy h2 {
    font-size: 16px;
  }

  .play-button {
    opacity: 1;
  }

  .watch-layout {
    margin-right: -14px;
    margin-left: -14px;
    border-right: 0;
    border-left: 0;
    border-radius: 0;
  }

  .playlist-scroll {
    display: block;
  }

  .lesson-title h1 {
    font-size: 24px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition-duration: .01ms !important;
  }
}
