:root {
  --bg: #0a0e13;
  --bg-2: #0e141c;
  --surface: #121a24;
  --surface-2: #1a2430;
  --surface-3: #223042;
  --border: rgba(148, 163, 184, 0.14);
  --border-strong: rgba(148, 163, 184, 0.28);
  --text: #e8eef5;
  --muted: #93a4b6;
  --muted-2: #64748a;
  --accent: #e0524a;
  --accent-2: #ff8578;
  --accent-dim: rgba(224, 82, 74, 0.16);
  --gold: #e5b567;
  --green: #55c77e;
  --blue: #6ab0f3;
  --shadow: 0 14px 40px rgba(0, 0, 0, 0.45);
  --radius: 14px;
  --radius-sm: 9px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei",
    sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* {
  box-sizing: border-box;
}

html {
  color-scheme: dark;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

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

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

/* ---------- Top bar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(10, 14, 19, 0.82);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.topbar-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  height: 58px;
  display: flex;
  align-items: center;
  gap: 28px;
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 9px;
  font-weight: 700;
  letter-spacing: 0.2px;
}

.brand .logo {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), #b8392f);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 800;
  color: #fff;
  align-self: center;
}

.brand .name {
  font-size: 17px;
}

.brand .tag {
  color: var(--muted-2);
  font-size: 12.5px;
  font-weight: 500;
}

.topnav {
  margin-left: auto;
  display: flex;
  gap: 4px;
  align-items: center;
}

.topnav a {
  padding: 7px 12px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 500;
  transition: background 0.16s, color 0.16s;
}

.topnav a:hover {
  background: var(--surface-2);
  color: var(--text);
}

.topnav a.active {
  color: var(--text);
  background: var(--accent-dim);
}

/* ---------- Layout ---------- */
.wrap {
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 24px 80px;
}

/* ---------- Hero ---------- */
.hero {
  padding: 48px 0 34px;
  position: relative;
}

.hero .eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--accent-2);
  background: var(--accent-dim);
  padding: 6px 12px;
  border-radius: 999px;
  margin-bottom: 20px;
}

.hero h1 {
  margin: 0 0 14px;
  font-size: clamp(32px, 5vw, 50px);
  line-height: 1.08;
  letter-spacing: -0.02em;
  font-weight: 800;
}

.hero h1 .grad {
  background: linear-gradient(90deg, var(--accent-2), var(--gold));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero .sub {
  color: var(--muted);
  font-size: 17px;
  max-width: 720px;
  margin: 0 0 26px;
}

.hero .sub b {
  color: var(--text);
  font-weight: 600;
}

.stats {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 18px;
  min-width: 120px;
}

.stat strong {
  display: block;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.stat span {
  color: var(--muted);
  font-size: 12.5px;
}

/* ---------- Section headings ---------- */
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin: 44px 0 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.section-head h2 {
  margin: 0;
  font-size: 21px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.section-head .hint {
  color: var(--muted-2);
  font-size: 13px;
}

/* ---------- Lecture grid ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 20px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
  display: flex;
  flex-direction: column;
}

.card:hover {
  transform: translateY(-3px);
  border-color: var(--border-strong);
  box-shadow: var(--shadow);
}

.card .thumb {
  position: relative;
  aspect-ratio: 16 / 9;
  background: var(--bg-2);
  overflow: hidden;
}

.card .thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.card:hover .thumb img {
  transform: scale(1.04);
}

.card .thumb .num-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  background: rgba(10, 14, 19, 0.78);
  backdrop-filter: blur(6px);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  padding: 4px 9px;
  border-radius: 999px;
  letter-spacing: 0.3px;
}

.card .thumb .play-cta {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  opacity: 0;
  transition: opacity 0.2s;
}

.card:hover .thumb .play-cta {
  opacity: 1;
}

.play-cta .circle {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: var(--accent);
  display: grid;
  place-items: center;
  box-shadow: 0 8px 24px rgba(224, 82, 74, 0.5);
}

.play-cta .circle svg {
  width: 22px;
  height: 22px;
  fill: #fff;
  margin-left: 3px;
}

.card .body {
  padding: 14px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

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

.card .meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px 9px;
}

.chip.gold {
  color: var(--gold);
  border-color: rgba(229, 181, 103, 0.3);
  background: rgba(229, 181, 103, 0.08);
}

.chip.green {
  color: var(--green);
  border-color: rgba(85, 199, 126, 0.3);
  background: rgba(85, 199, 126, 0.08);
}

.chip.blue {
  color: var(--blue);
  border-color: rgba(106, 176, 243, 0.3);
  background: rgba(106, 176, 243, 0.08);
}

.chip.red {
  color: var(--accent-2);
  border-color: rgba(224, 82, 74, 0.3);
  background: rgba(224, 82, 74, 0.08);
}

.chip svg {
  width: 12px;
  height: 12px;
}

/* ---------- Materials ---------- */
.material-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 14px;
}

.material {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  transition: border-color 0.16s, background 0.16s;
}

.material:hover {
  border-color: var(--border-strong);
  background: var(--surface-2);
}

.material .icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  font-weight: 800;
  font-size: 13px;
}

.material .icon.pdf {
  background: rgba(224, 82, 74, 0.14);
  color: var(--accent-2);
}

.material .icon.code {
  background: rgba(106, 176, 243, 0.14);
  color: var(--blue);
  font-family: var(--mono);
}

.material .icon.video {
  background: rgba(229, 181, 103, 0.14);
  color: var(--gold);
}

.material .m-title {
  font-size: 14.5px;
  font-weight: 600;
}

.material .m-sub {
  font-size: 12.5px;
  color: var(--muted);
}

.material .m-arrow {
  margin-left: auto;
  color: var(--muted-2);
}

/* ---------- Footer ---------- */
footer {
  border-top: 1px solid var(--border);
  padding: 26px 24px;
  color: var(--muted-2);
  font-size: 13px;
  text-align: center;
}

footer a {
  color: var(--muted);
}

/* =========================================================
   Lecture player page
   ========================================================= */
.player-wrap {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 24px 80px;
}

.player-head {
  margin-bottom: 18px;
}

.player-head .crumbs {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.player-head .crumbs a {
  color: var(--muted);
}

.player-head .crumbs a:hover {
  color: var(--text);
}

.player-head h1 {
  margin: 0;
  font-size: clamp(20px, 3vw, 28px);
  font-weight: 750;
  letter-spacing: -0.01em;
  line-height: 1.25;
}

.player-head .meta-row {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.player-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 400px;
  gap: 22px;
  align-items: start;
}

@media (max-width: 1000px) {
  .player-layout {
    grid-template-columns: 1fr;
  }
}

.video-box {
  background: #000;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  aspect-ratio: 16 / 9;
  position: relative;
}

.video-box video {
  width: 100%;
  height: 100%;
  display: block;
}

/* synced bilingual subtitle bar */
.cuebar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-top: 14px;
  padding: 16px 20px;
  min-height: 92px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
}

.cuebar .cue-en {
  font-size: 17px;
  font-weight: 600;
  line-height: 1.5;
}

.cuebar .cue-zh {
  font-size: 15px;
  color: var(--gold);
  line-height: 1.5;
}

.cuebar .cue-empty {
  color: var(--muted-2);
  font-size: 14px;
}

.cuebar .cue-time {
  color: var(--muted-2);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  margin-bottom: 2px;
}

/* lecture info under player */
.lecture-info {
  margin-top: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
}

.lecture-info h3 {
  margin: 0 0 10px;
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--muted);
}

.lecture-info .desc {
  color: var(--muted);
  font-size: 14px;
  white-space: pre-wrap;
  max-height: 220px;
  overflow-y: auto;
  line-height: 1.6;
}

.lecture-info .desc:empty::after {
  content: "No description available.";
  color: var(--muted-2);
}

/* ---------- Transcript sidebar ---------- */
.transcript {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  position: sticky;
  top: 72px;
  max-height: calc(100vh - 96px);
  display: flex;
  flex-direction: column;
}

.transcript-head {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--surface-2);
}

.transcript-head h2 {
  margin: 0 auto 0 0;
  font-size: 14.5px;
  font-weight: 700;
}

.transcript-head .count {
  color: var(--muted);
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
}

.transcript-body {
  overflow-y: auto;
  flex: 1;
  scroll-behavior: smooth;
}

.cue-row {
  padding: 10px 18px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.07);
  cursor: pointer;
  transition: background 0.14s ease;
}

.cue-row:hover {
  background: rgba(106, 176, 243, 0.06);
}

.cue-row.active {
  background: var(--accent-dim);
  border-left: 3px solid var(--accent);
  padding-left: 15px;
}

.cue-row .t {
  font-size: 11.5px;
  color: var(--muted-2);
  font-variant-numeric: tabular-nums;
  font-family: var(--mono);
  margin-bottom: 4px;
}

.cue-row.active .t {
  color: var(--accent-2);
}

.cue-row .e {
  font-size: 13.5px;
  color: var(--text);
  line-height: 1.5;
}

.cue-row .z {
  font-size: 13px;
  color: var(--gold);
  line-height: 1.5;
  margin-top: 2px;
}

.cue-row .z:empty,
.cue-row .e:empty {
  display: none;
}

/* transcript language toggles */
.sub-lang {
  display: flex;
  gap: 6px;
}

.sub-lang button {
  background: var(--surface-3);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  cursor: pointer;
  font-family: var(--font);
  transition: all 0.14s;
}

.sub-lang button.on {
  background: var(--accent-dim);
  border-color: rgba(224, 82, 74, 0.45);
  color: var(--accent-2);
}

/* prev / next nav */
.lecture-nav {
  display: flex;
  gap: 10px;
  margin-top: 18px;
}

.lecture-nav a {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  transition: border-color 0.16s, background 0.16s;
}

.lecture-nav a:hover {
  border-color: var(--border-strong);
  background: var(--surface-2);
}

.lecture-nav .dir {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--muted-2);
  font-weight: 700;
}

.lecture-nav .t {
  font-size: 13.5px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lecture-nav a:first-child .t {
  text-align: left;
}

.lecture-nav a:last-child .t {
  text-align: right;
}

.lecture-nav a.disabled {
  opacity: 0.4;
  pointer-events: none;
}

/* loading state */
.skeleton {
  border-radius: var(--radius);
  background: linear-gradient(90deg, var(--surface) 25%, var(--surface-2) 50%, var(--surface) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
}

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

.spinner {
  width: 42px;
  height: 42px;
  border: 3px solid var(--surface-2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
  margin: 60px auto;
}

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

.empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--muted);
}

.error {
  color: var(--accent-2);
}

/* keyboard hint */
.kbd-hint {
  color: var(--muted-2);
  font-size: 12px;
  margin-top: 10px;
}

.kbd-hint kbd {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 5px;
  padding: 1px 6px;
  font-family: var(--mono);
  font-size: 11px;
}
