:root {
  color-scheme: dark;
  font-family: "Microsoft YaHei UI", "PingFang SC", "Noto Sans CJK SC", system-ui, sans-serif;
  --canvas: #0d1117;
  --surface: #161b22;
  --surface-hover: #21262d;
  --surface-selected: #15263d;
  --player-background: #010409;
  --text: #e6edf3;
  --muted: #9198a1;
  --line: #30363d;
  --accent: #58a6ff;
  --accent-text: #ff7b72;
  --accent-hover: #79c0ff;
  color: var(--text);
  background: var(--canvas);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--canvas);
}

.site {
  max-width: 76rem;
  margin-inline: auto;
  padding: clamp(1.25rem, 5vw, 4rem);
}

.hero {
  margin-bottom: clamp(1.4rem, 4vw, 2.7rem);
}

h1, h2, p {
  margin: 0;
}

h1 {
  max-width: 35rem;
  font-size: clamp(1.95rem, 5vw, 4.4rem);
  line-height: 1.1;
  letter-spacing: -.045em;
}

h1 span {
  color: var(--accent-text);
  white-space: nowrap;
}

.hero p {
  margin-top: .75rem;
  color: var(--muted);
  font-size: clamp(1rem, 2vw, 1.2rem);
  line-height: 1.6;
}

.lesson {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(13rem, 16rem);
  gap: clamp(1rem, 3vw, 1.75rem);
  align-items: start;
}

.chapters {
  grid-column: 2;
  grid-row: 1;
  border: 1px solid var(--line);
  border-radius: .65rem;
  background: var(--surface);
  overflow: hidden;
}

.chapters h2 {
  padding: .9rem 1rem;
  font-size: 1rem;
  color: var(--muted);
}

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

.chapter {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .55rem;
  min-height: 3.5rem;
  padding: .7rem 1rem;
  border-top: 1px solid var(--line);
  color: var(--text);
  text-decoration: none;
}

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

.chapter[aria-current="true"] {
  color: var(--accent-text);
  background: var(--surface-selected);
  box-shadow: inset 3px 0 var(--accent);
  font-weight: 700;
}

.chapter-time {
  flex: none;
  color: var(--muted);
  font-size: .875rem;
  font-variant-numeric: tabular-nums;
}

a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.viewing {
  grid-column: 1;
  grid-row: 1;
  min-width: 0;
}

.player {
  position: relative;
  aspect-ratio: 16 / 10;
  background: var(--player-background);
  border: 1px solid var(--line);
  border-radius: .65rem;
  overflow: hidden;
}

video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.cover {
  position: absolute;
  inset: 0;
  display: grid;
  width: 100%;
  place-items: end center;
  padding: 0 0 clamp(.75rem, 2.7vw, 1.8rem);
  border: 0;
  background: transparent;
  cursor: pointer;
}

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

.cover span {
  position: relative;
  padding: .85rem 1.25rem;
  border-radius: .5rem;
  background: var(--accent);
  color: var(--canvas);
  font: 700 1rem/1.2 system-ui, sans-serif;
}

.cover:hover span {
  background: var(--accent-hover);
}

.cover:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -3px;
}

[hidden] {
  display: none;
}

.details {
  margin-top: 1.1rem;
}

.details h2 {
  font-size: clamp(1.3rem, 3vw, 1.75rem);
}

.details p, #clip-status:not(:empty), noscript p {
  margin-top: .45rem;
  color: var(--muted);
  line-height: 1.6;
}

.file-link {
  display: inline-block;
  color: var(--accent-text);
  text-underline-offset: .22em;
}

.file-link {
  flex-shrink: 0;
  padding: .55rem 0 .55rem .35rem;
}

@media (max-width: 46rem) {
  .lesson {
    display: flex;
    flex-direction: column;
  }

  .chapters, .viewing {
    width: 100%;
  }

  .chapters ol {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .chapters li:nth-child(even) {
    border-left: 1px solid var(--line);
  }
}

@media (max-width: 24rem) {
  .chapter {
    align-items: flex-start;
    flex-direction: column;
    gap: .2rem;
  }

  .file-link {
    padding-left: 0;
  }
}
