:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-muted: #f1f5f9;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --text: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-soft: #eff6ff;

  --phys: #2563eb;
  --phys-bg: #eff6ff;
  --phys-border: #bfdbfe;

  --chem: #0891b2;
  --chem-bg: #ecfeff;
  --chem-border: #a5f3fc;

  --bio: #059669;
  --bio-bg: #ecfdf5;
  --bio-border: #a7f3d0;

  --geo: #d97706;
  --geo-bg: #fffbeb;
  --geo-border: #fde68a;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 4px 16px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 12px 32px rgba(15, 23, 42, 0.08);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

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

button {
  font: inherit;
  cursor: pointer;
}

.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px;
}

/* Navbar */
.navbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.navbar-inner {
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

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

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: linear-gradient(135deg, #1d4ed8 0%, #0891b2 100%);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 16px;
  font-weight: 800;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.25);
}

.brand-sub {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  margin-left: 4px;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 24px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
}

.nav-links a:hover {
  color: var(--primary);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  border: 1px solid transparent;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

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

.btn-outline {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border-strong);
}

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

.btn-sm {
  padding: 6px 12px;
  font-size: 13px;
}

/* Hero */
.hero {
  padding: 40px 0 32px;
  background: radial-gradient(
      circle at 15% 15%,
      rgba(37, 99, 235, 0.07),
      transparent 45%
    ),
    radial-gradient(
      circle at 85% 20%,
      rgba(8, 145, 178, 0.08),
      transparent 45%
    ),
    var(--bg);
  border-bottom: 1px solid var(--border);
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  gap: 32px;
  align-items: center;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 12px;
  font-weight: 600;
  border: 1px solid var(--phys-border);
  margin-bottom: 14px;
}

.hero-title {
  margin: 0 0 14px;
  font-size: clamp(28px, 3.4vw, 42px);
  line-height: 1.2;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text);
}

.hero-desc {
  margin: 0 0 22px;
  font-size: 16px;
  color: var(--text-secondary);
  max-width: 560px;
}

.hero-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 24px;
}

.hero-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  font-size: 13px;
  color: var(--text-muted);
}

.hero-stats strong {
  color: var(--text);
  font-weight: 700;
}

/* Hero Preview Card */
.hero-preview {
  background: #0f172a;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  border: 1px solid rgba(148, 163, 184, 0.25);
}

.hero-preview-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: #1e293b;
  color: #e2e8f0;
  font-size: 12px;
  gap: 10px;
}

.preview-live-dot {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  color: #38bdf8;
}

.preview-live-dot::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 8px #22c55e;
}

.preview-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.preview-select {
  background: #0f172a;
  color: #e2e8f0;
  border: 1px solid #334155;
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 12px;
}

.hero-preview-frame-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  background: #020617;
}

.hero-preview-frame-wrap iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

/* Subject Cards Row */
.subject-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-top: 28px;
}

.subject-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
  text-align: left;
}

.subject-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.subject-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.subject-tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid transparent;
}

.subj-phys {
  color: var(--phys);
  background: var(--phys-bg);
  border-color: var(--phys-border);
}

.subj-chem {
  color: var(--chem);
  background: var(--chem-bg);
  border-color: var(--chem-border);
}

.subj-bio {
  color: var(--bio);
  background: var(--bio-bg);
  border-color: var(--bio-border);
}

.subj-geo {
  color: var(--geo);
  background: var(--geo-bg);
  border-color: var(--geo-border);
}

.subject-card-title {
  font-size: 17px;
  font-weight: 700;
}

.subject-card-desc {
  font-size: 13px;
  color: var(--text-muted);
}

.subject-card-count {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}

/* Sections */
.section {
  padding: 40px 0;
}

.section-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.section-eyebrow {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--primary);
  margin-bottom: 4px;
}

.section-title {
  margin: 0;
  font-size: 24px;
  font-weight: 800;
}

.section-subtitle {
  margin: 4px 0 0;
  font-size: 14px;
  color: var(--text-muted);
}

/* Featured Grid */
.featured-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

.featured-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.featured-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.featured-cover {
  background: var(--surface-muted);
  position: relative;
  min-height: 200px;
}

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

.featured-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
}

/* Filter Toolbar */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 22px;
  background: var(--surface);
  padding: 12px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}

.tabs {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.tab-btn {
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  transition: all 0.15s ease;
}

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

.tab-btn.active {
  background: var(--text);
  color: #fff;
  border-color: var(--text);
}

.search-box {
  position: relative;
  min-width: 280px;
  flex: 1;
  max-width: 380px;
}

.search-box input {
  width: 100%;
  padding: 9px 14px 9px 36px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  outline: none;
}

.search-box input:focus {
  border-color: var(--primary);
  background: var(--surface);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.search-icon {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
  font-size: 14px;
}

/* Course Grid */
.course-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

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

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

.course-cover {
  position: relative;
  aspect-ratio: 16 / 10;
  background: var(--surface-muted);
  overflow: hidden;
}

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

.course-card:hover .course-cover img {
  transform: scale(1.03);
}

.course-cover-badges {
  position: absolute;
  top: 10px;
  left: 10px;
  right: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  pointer-events: none;
}

.type-pill {
  padding: 2px 8px;
  border-radius: 6px;
  background: rgba(15, 23, 42, 0.72);
  color: #f8fafc;
  font-size: 11px;
  font-weight: 600;
  backdrop-filter: blur(4px);
}

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

.course-title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.35;
}

.course-textbook {
  font-size: 12px;
  color: var(--text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.course-question {
  font-size: 13px;
  color: var(--text-secondary);
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.course-footer {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.course-steps-meta {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
}

.course-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Usage Cards */
.usage-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.usage-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 22px;
}

.usage-card h3 {
  margin: 0 0 8px;
  font-size: 17px;
}

.usage-card p {
  margin: 0;
  font-size: 14px;
  color: var(--text-secondary);
}

.code-snippet {
  margin-top: 12px;
  padding: 10px 12px;
  background: #0f172a;
  color: #e2e8f0;
  border-radius: 8px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  overflow-x: auto;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  background: var(--surface);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-md);
  color: var(--text-muted);
}

/* Footer */
.footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: 28px 0;
  font-size: 13px;
  color: var(--text-muted);
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

/* Course Player Page */
.player-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.player-topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.player-title-group {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.player-title {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
}

.player-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.player-stage {
  background: #020617;
  padding: 16px 24px;
}

.player-frame-box {
  max-width: 1400px;
  margin: 0 auto;
  aspect-ratio: 16 / 9;
  min-height: 520px;
  max-height: calc(100vh - 140px);
  width: 100%;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid #1e293b;
  background: #000;
}

.player-frame-box iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

.player-info {
  padding: 28px 0 48px;
}

.info-grid {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 24px;
}

.info-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
}

.info-card h2 {
  margin: 0 0 12px;
  font-size: 16px;
}

.steps-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.step-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--surface-muted);
  border: 1px solid var(--border);
  font-size: 13px;
  font-weight: 500;
}

.step-num {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 700;
}

.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #0f172a;
  color: #fff;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: all 0.2s ease;
  z-index: 100;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

/* Responsive */
@media (max-width: 1024px) {
  .hero-grid {
    grid-template-columns: 1fr;
  }
  .subject-strip {
    grid-template-columns: repeat(2, 1fr);
  }
  .featured-grid {
    grid-template-columns: 1fr;
  }
  .course-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .usage-grid,
  .info-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .nav-links {
    display: none;
  }
  .subject-strip,
  .course-grid {
    grid-template-columns: 1fr;
  }
  .featured-card {
    grid-template-columns: 1fr;
  }
  .search-box {
    min-width: 100%;
  }
}

