:root {
  --primary: #07c160;
  --primary-light: #e8f8ef;
  --bg: #f5f5f5;
  --text: #333;
  --text-secondary: #999;
  --border: #eee;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  padding-bottom: 80px;
}
#app { max-width: 750px; margin: 0 auto; min-height: 100vh; position: relative; }

/* Header */
.page-header {
  background: #fff;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid var(--border);
}
.page-header .back-btn {
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  font-size: 30px; color: var(--text);
  cursor: pointer; border: none; background: none;
  flex-shrink: 0;
}
.page-header .header-title {
  flex: 1; text-align: center;
  font-size: 17px; font-weight: 600;
  margin-right: 32px;
  min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.page-header .home-btn,
.lesson-header .home-btn {
  position: absolute;
  right: 0px;
  width: 50px; height: 50px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; color: var(--text);
  cursor: pointer; border: none; background: none;
  flex-shrink: 0;
}

/* Lesson header - white bg with title */
.lesson-header {
  background: #fff;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid var(--border);
}
.lesson-header .back-btn {
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  font-size: 30px; color: var(--text);
  cursor: pointer; border: none; background: none;
  flex-shrink: 0;
}
.lesson-header .header-title {
  flex: 1; text-align: center;
  font-size: 17px; font-weight: 600;
  margin-right: 32px;
  min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* Nav bar for lesson detail */
.lesson-nav {
  background: #fff;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 56px;
  z-index: 99;
}
.lesson-nav .nav-buttons {
  display: flex; justify-content: space-between; align-items: center;
}
.lesson-nav button {
  background: var(--primary);
  color: #fff; border: none;
  padding: 6px 14px; border-radius: 20px;
  font-size: 13px; cursor: pointer;
}
.lesson-nav button:disabled {
  background: #ddd;
  color: #aaa;
  cursor: not-allowed;
}
.nav-list-wrap {
  display: flex; align-items: center; gap: 2px;
}
.nav-list-text {
  font-size: 18px; color: var(--primary);
  cursor: pointer; font-weight: 500;
}
.nav-dropdown-btn {
  font-size: 35px;
  color: var(--primary);
  cursor: pointer;
  /*padding: 4px 8px;*/
  user-select: none;
  line-height: 1;
}
.nav-dropdown {
  position: absolute;
  left: 16px; right: 16px; top: 100%;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  z-index: 50;
  max-height: 300px;
  overflow-y: auto;
  padding: 4px 0;
}
.nav-dropdown-item {
  display: flex; align-items: center;
  padding: 10px 14px;
  cursor: pointer;
  gap: 10px;
}
.nav-dropdown-item:active { background: #f5f5f5; }
.nav-dropdown-item.current {
  background: var(--primary-light);
}
.nav-dropdown-num {
  width: 24px; height: 24px;
  background: var(--primary);
  color: #fff;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600;
  flex-shrink: 0;
}
.nav-dropdown-item.current .nav-dropdown-num {
  background: #ff6b35;
}
.nav-dropdown-title {
  font-size: 13px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* Course list */
.course-list { padding: 12px; }
.course-card {
  background: #fff;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  cursor: pointer;
  transition: box-shadow 0.2s;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.course-card:active { box-shadow: 0 2px 8px rgba(0,0,0,0.12); }
.course-card .card-icon {
  width: 44px; height: 44px;
  background: var(--primary-light);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; flex-shrink: 0;
  margin-right: 14px;
}
.course-card .card-info { flex: 1; min-width: 0; }
.course-card .card-title {
  font-size: 15px; font-weight: 500;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.course-card .card-count {
  font-size: 13px; color: var(--text-secondary);
  margin-top: 4px;
}
.course-card .card-arrow {
  color: #ccc; font-size: 18px; flex-shrink: 0; margin-left: 8px;
}

/* Lesson list */
.lesson-list { padding: 12px 12px 12px; }
.lesson-item {
  background: #fff;
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.lesson-item:active { background: #fafafa; }
.lesson-item .lesson-num {
  width: 30px; height: 30px;
  background: var(--primary);
  color: #fff;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600;
  flex-shrink: 0; margin-right: 12px;
}
.lesson-item .lesson-title {
  flex: 1; font-size: 14px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.lesson-item .lesson-arrow { color: #ccc; font-size: 16px; }

/* Lesson detail content */
.lesson-content { padding: 0 0 120px; }
.content-block { margin-bottom: 8px; }

/* Rich text */
.rich-text {
  padding: 12px 16px;
  line-height: 1.8;
  font-size: 15px;
  word-break: break-word;
}
.rich-text img { max-width: 100%; cursor: zoom-in; }
.rich-text p:has(> br:only-child) { display: none; }

/* Picture */
.content-picture {
  text-align: center;
  padding: 8px 16px;
}
.content-picture img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  cursor: zoom-in;
}

/* Video */
.content-video {
  padding: 8px 16px;
}
.video-wrapper {
  position: relative;
  width: 100%;
  padding-top: 56.25%;
  background: #000;
  border-radius: 10px;
  overflow: hidden;
}
.video-wrapper video {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  object-fit: contain;
}
.video-name {
  font-size: 13px; color: var(--text-secondary);
  margin-top: 6px; text-align: center;
}
.video-big-play-btn {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 72px; height: 72px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.5);
  color: #fff;
  border: none;
  display: flex; align-items: center; justify-content: center;
  font-size: 32px;
  cursor: pointer;
  z-index: 10;
}
.video-big-play-btn:hover {
  background: rgba(0, 0, 0, 0.7);
}
.video-wrapper {
  cursor: pointer;
}

/* Voice inline card */
.voice-card {
  margin: 8px 16px;
  background: #fff;
  border-radius: 12px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.voice-card .voice-avatar {
  width: 44px; height: 44px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  margin-right: 12px;
}
.voice-card .voice-info { flex: 1; min-width: 0; }
.voice-card .voice-name {
  font-size: 14px; font-weight: 500;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.voice-card .voice-duration {
  font-size: 12px; color: var(--text-secondary);
  margin-top: 2px;
}
.voice-card .voice-play-btn {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  border: none;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  cursor: pointer;
  flex-shrink: 0;
  margin-left: 10px;
}
.voice-card .voice-play-btn.playing {
  background: #ff6b35;
}

/* PDF */
.pdf-card {
  margin: 8px 16px;
  background: #fff;
  border-radius: 12px;
  padding: 14px;
  display: flex;
  align-items: center;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.pdf-card .pdf-icon {
  width: 40px; height: 40px;
  background: #ffe8e8;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
  margin-right: 12px;
}
.pdf-card .pdf-name {
  flex: 1; font-size: 14px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.pdf-card .pdf-link {
  color: var(--primary);
  font-size: 13px;
  text-decoration: none;
  flex-shrink: 0;
  margin-left: 8px;
}

/* Bottom floating audio player */
.audio-player-bar {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 750px;
  background: #fff;
  border-top: 1px solid var(--border);
  padding: 8px 14px 30px;
  display: flex;
  align-items: center;
  z-index: 200;
  box-shadow: 0 -2px 10px rgba(0,0,0,0.08);
}
.audio-player-bar .ap-avatar {
  width: 38px; height: 38px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  margin-right: 10px;
}
.audio-player-bar .ap-info { flex: 1; min-width: 0; }
.audio-player-bar .ap-name {
  font-size: 13px; font-weight: 500;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.audio-player-bar .ap-progress-wrap {
  margin-top: 4px;
  display: flex; align-items: center; gap: 6px;
}
.audio-player-bar .ap-time {
  font-size: 11px; color: var(--text-secondary);
  flex-shrink: 0; min-width: 36px;
}
.audio-player-bar .ap-progress {
  flex: 1; height: 4px;
  background: #e8e8e8;
  border-radius: 2px;
  position: relative;
  cursor: pointer;
}
.audio-player-bar .ap-progress-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 2px;
  transition: width 0.1s linear;
}
.audio-player-bar .ap-controls {
  display: flex; align-items: center; gap: 4px;
  margin-left: 8px; flex-shrink: 0;
}
.audio-player-bar .ap-btn {
  width: 34px; height: 34px;
  border-radius: 50%;
  border: none;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  font-size: 16px;
  background: var(--primary-light);
  color: var(--primary);
}
.audio-player-bar .ap-btn.play-btn {
  width: 40px; height: 40px;
  background: var(--primary);
  color: #fff;
  font-size: 18px;
}
.audio-player-bar .ap-close {
  width: 28px; height: 28px;
  border-radius: 50%;
  border: none;
  background: #f0f0f0;
  color: #999;
  font-size: 14px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  margin-left: 6px;
  flex-shrink: 0;
}

/* Image preview lightbox */
.image-preview {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.9);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: zoom-out;
  padding: 20px;
}
.image-preview img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 4px;
}

/* Pagination */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 16px 0 40px;
}
.pagination button {
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 8px 18px;
  border-radius: 20px;
  font-size: 13px;
  cursor: pointer;
}
.pagination button:disabled {
  background: #ddd;
  color: #aaa;
  cursor: not-allowed;
}
.pagination .page-info {
  font-size: 13px;
  color: var(--text-secondary);
  min-width: 50px;
  text-align: center;
}

/* Loading */
.loading-wrap {
  display: flex; justify-content: center; align-items: center;
  padding: 60px 0;
}

/* Empty */
.empty-wrap {
  text-align: center; padding: 60px 0;
  color: var(--text-secondary); font-size: 15px;
}

/* Section divider with number circle */
.section-header {
  display: flex; align-items: center; justify-content: center;
  padding: 20px 16px 10px;
}
.section-header .section-num {
  width: 28px; height: 28px;
  background: var(--primary);
  color: #fff;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 600;
  margin-right: 8px;
}
.section-header .section-title {
  font-size: 16px; font-weight: 600;
}
