:root {
  --bg: #f6f6f7;
  --panel: #ffffff;
  --line: #e8e8ea;
  --text: #101114;
  --muted: #62646c;
  --accent: #191b20;
  --soft: #f1f2f4;
  --success: #dff5e6;
  --success-text: #166534;
  --danger: #fde8e8;
  --danger-text: #b42318;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background: var(--bg);
}
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; }
.container {
  width: min(1360px, calc(100% - 32px));
  margin: 0 auto;
}
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(10px);
  background: rgba(246,246,247,.88);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 72px;
  gap: 16px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
}
.brand-badge {
  width: 38px;
  height: 38px;
  border-radius: 14px;
  background: var(--accent);
  color: white;
  display: grid;
  place-items: center;
  font-size: 14px;
}
.nav-links {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.nav-links a, .nav-links button {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 999px;
  padding: 10px 16px;
  cursor: pointer;
}
.hero { padding: 32px 0 20px; }
.hero-card, .panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 24px;
}
.grid-2 {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 20px;
}
.grid-2-admin {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
.section-title {
  font-size: 22px;
  font-weight: 700;
  margin: 0 0 10px;
}
.small-title {
  font-size: 18px;
  margin-bottom: 4px;
}
.muted {
  color: var(--muted);
  line-height: 1.7;
}
.card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.course-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 24px;
  overflow: hidden;
}
.course-cover {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  background: var(--soft);
}
.course-body { padding: 18px; }
.course-desc-box {
  margin-top: 8px;
}
.course-desc-text {
  margin: 0;
  line-height: 1.75;
  white-space: pre-wrap;
}
.course-desc-box.is-collapsed .course-desc-text {
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.desc-toggle {
  margin-top: 10px;
}
.pill {
  display: inline-flex;
  padding: 7px 12px;
  border-radius: 999px;
  background: var(--soft);
  color: var(--muted);
  font-size: 12px;
  margin-right: 8px;
  margin-bottom: 8px;
}
.success {
  background: var(--success);
  color: var(--success-text);
}
.danger {
  background: var(--danger);
  color: var(--danger-text);
}
.input, .textarea, .select {
  width: 100%;
  border: 1px solid var(--line);
  background: white;
  border-radius: 16px;
  padding: 12px 14px;
  outline: none;
}
.textarea { min-height: 120px; resize: vertical; }
.input-row {
  display: grid;
  gap: 12px;
}
.form-block { margin-top: 16px; }
.label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  font-size: 14px;
}
.btn {
  border: none;
  background: var(--accent);
  color: white;
  border-radius: 16px;
  padding: 12px 16px;
  cursor: pointer;
}
.btn[disabled] {
  opacity: .65;
  cursor: not-allowed;
}
.btn.secondary {
  background: white;
  color: var(--text);
  border: 1px solid var(--line);
}
.btn.danger {
  background: #b42318;
  color: white;
}
.btn.small {
  padding: 9px 12px;
  border-radius: 12px;
  font-size: 13px;
}
.actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.empty {
  padding: 32px;
  text-align: center;
  border: 1px dashed var(--line);
  border-radius: 20px;
  color: var(--muted);
  background: #fcfcfd;
}
.hidden { display: none !important; }
.notice {
  padding: 12px 14px;
  border-radius: 16px;
  margin-top: 12px;
  font-size: 14px;
}
.list { display: grid; gap: 14px; }
.compact-list { max-height: 520px; overflow: auto; }
.list-card {
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 18px;
  background: white;
}
.video-wrap {
  border-radius: 20px;
  overflow: hidden;
  background: black;
}
.video-wrap video {
  width: 100%;
  aspect-ratio: 16 / 9;
  display: block;
}
.lesson-btn {
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  background: white;
  border-radius: 16px;
  padding: 14px;
  cursor: pointer;
  margin-bottom: 10px;
}
.lesson-btn.active {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}
.auth-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.kpi {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
}
.code-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 12px;
}
.code-table th, .code-table td {
  padding: 10px 8px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-size: 14px;
}
.footer-space { height: 32px; }

.service-banner {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 14px;
  padding: 14px 16px;
  border-radius: 18px;
  background: #fff7e6;
  border: 1px solid #f3d8a6;
  color: #7a4b00;
}
.service-banner strong {
  font-size: 15px;
}

.admin-shell {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}
.admin-sidebar {
  position: sticky;
  top: 92px;
  display: grid;
  gap: 20px;
}
.sidebar-panel { overflow: hidden; }
.sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.course-nav {
  display: grid;
  gap: 10px;
  max-height: calc(100vh - 330px);
  overflow: auto;
  padding-right: 4px;
}
.course-nav-item {
  display: block;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px 16px;
  background: white;
  transition: .2s ease;
}
.course-nav-item:hover {
  border-color: #d0d5dd;
  transform: translateY(-1px);
}
.course-nav-item.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(25,27,32,.06);
}
.course-nav-title {
  font-weight: 700;
  margin-bottom: 6px;
}
.course-nav-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--muted);
}
.admin-main {
  display: grid;
  gap: 20px;
}
.empty-panel { min-height: 360px; display: grid; align-content: center; }
.detail-header-panel { padding-bottom: 18px; }
.detail-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
  flex-wrap: wrap;
}
.detail-title {
  font-size: 30px;
  line-height: 1.2;
  margin: 6px 0 0;
}
.detail-desc {
  max-width: 840px;
  margin: 10px 0 0;
}
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
.detail-cover {
  width: 100%;
  max-width: 460px;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: var(--soft);
}
.upload-status {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 16px;
  background: #fafafa;
  border: 1px solid var(--line);
}
.progress-track {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: var(--soft);
  overflow: hidden;
}
.progress-bar {
  width: 0;
  height: 100%;
  background: var(--accent);
  border-radius: inherit;
  transition: width .25s ease;
}
.progress-meta {
  margin-top: 8px;
  font-size: 13px;
  color: var(--muted);
}

@media (max-width: 1100px) {
  .admin-shell,
  .detail-grid,
  .grid-2,
  .grid-2-admin,
  .card-grid,
  .auth-grid {
    grid-template-columns: 1fr;
  }
  .admin-sidebar {
    position: static;
  }
  .course-nav {
    max-height: none;
  }
}

@media (max-width: 680px) {
  .container {
    width: min(100%, calc(100% - 20px));
  }
  .hero-card, .panel {
    padding: 18px;
    border-radius: 20px;
  }
  .detail-title {
    font-size: 24px;
  }
}


.section-toggle-head {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 12px;
  flex-wrap: wrap;
}
.student-course-shell,
.lesson-shell {
  max-height: 78vh;
  overflow: auto;
  transition: max-height .28s ease, opacity .25s ease;
  padding-right: 4px;
}
.student-course-shell.collapsed,
.lesson-shell.collapsed {
  max-height: 0;
  opacity: 0;
  overflow: hidden;
}
.student-course-shell .list,
.student-course-shell .card-grid {
  max-height: none;
  overflow: visible;
}
.student-course-shell .card-grid {
  align-content: start;
}
.video-shell {
  position: relative;
}
.watermark-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}
.video-watermark {
  position: absolute;
  color: rgba(255,255,255,.34);
  font-size: clamp(12px, 1.4vw, 18px);
  font-weight: 700;
  letter-spacing: .04em;
  text-shadow: 0 1px 2px rgba(0,0,0,.45);
  white-space: nowrap;
  user-select: none;
}
.wm-1 { animation: driftOne 18s linear infinite; top: 8%; left: 4%; }
.wm-2 { animation: driftTwo 22s linear infinite; top: 62%; left: 58%; }
.wm-3 { animation: driftThree 20s linear infinite; top: 34%; left: 20%; }
.wm-4 { animation: driftFour 24s linear infinite; top: 74%; left: 8%; }
@keyframes driftOne {
  0% { transform: translate(0, 0); }
  25% { transform: translate(240px, 40px); }
  50% { transform: translate(520px, 180px); }
  75% { transform: translate(180px, 300px); }
  100% { transform: translate(0, 0); }
}
@keyframes driftTwo {
  0% { transform: translate(0, 0); }
  30% { transform: translate(-280px, -120px); }
  55% { transform: translate(-40px, -260px); }
  80% { transform: translate(160px, -80px); }
  100% { transform: translate(0, 0); }
}
@keyframes driftThree {
  0% { transform: translate(0, 0); }
  20% { transform: translate(340px, -40px); }
  50% { transform: translate(140px, 210px); }
  80% { transform: translate(-90px, 40px); }
  100% { transform: translate(0, 0); }
}
@keyframes driftFour {
  0% { transform: translate(0, 0); }
  25% { transform: translate(300px, -180px); }
  50% { transform: translate(520px, -20px); }
  75% { transform: translate(120px, -260px); }
  100% { transform: translate(0, 0); }
}
@media (max-width: 680px) {
  .video-watermark {
    font-size: 11px;
  }
  .student-course-shell,
  .lesson-shell {
    max-height: 70vh;
  }
}


.video-shell:fullscreen,
.video-shell:-webkit-full-screen {
  width: 100vw;
  height: 100vh;
  max-width: none;
  border-radius: 0;
  background: #000;
}
.video-shell:fullscreen video,
.video-shell:-webkit-full-screen video {
  width: 100%;
  height: 100%;
  aspect-ratio: auto;
  object-fit: contain;
  background: #000;
}
.video-shell:fullscreen .watermark-layer,
.video-shell:-webkit-full-screen .watermark-layer {
  position: absolute;
  inset: 0;
  z-index: 3;
}
.video-shell:fullscreen .video-watermark,
.video-shell:-webkit-full-screen .video-watermark {
  font-size: clamp(14px, 1.5vw, 22px);
}


.video-shell {
  position: relative;
}
.video-overlay-actions {
  position: absolute;
  right: 14px;
  bottom: 14px;
  z-index: 4;
  display: flex;
  gap: 10px;
}
.video-fs-btn {
  background: rgba(16,17,20,.78);
  border: 1px solid rgba(255,255,255,.18);
  color: #fff;
  backdrop-filter: blur(8px);
}
.video-fs-btn:hover {
  background: rgba(16,17,20,.92);
}
.video-shell.is-fullscreen,
.video-shell:fullscreen,
.video-shell:-webkit-full-screen,
.video-shell:-ms-fullscreen {
  width: 100vw;
  height: 100vh;
  max-width: none;
  border-radius: 0;
  background: #000;
}
.video-shell.is-fullscreen video,
.video-shell:fullscreen video,
.video-shell:-webkit-full-screen video,
.video-shell:-ms-fullscreen video {
  width: 100%;
  height: 100%;
  aspect-ratio: auto;
  object-fit: contain;
  background: #000;
}
.video-shell.is-fullscreen .video-overlay-actions,
.video-shell:fullscreen .video-overlay-actions,
.video-shell:-webkit-full-screen .video-overlay-actions,
.video-shell:-ms-fullscreen .video-overlay-actions {
  right: 20px;
  bottom: 20px;
}
.video-shell.is-fullscreen .watermark-layer,
.video-shell:fullscreen .watermark-layer,
.video-shell:-webkit-full-screen .watermark-layer,
.video-shell:-ms-fullscreen .watermark-layer {
  inset: 0;
}
@media (max-width: 680px) {
  .video-overlay-actions {
    right: 10px;
    bottom: 10px;
  }
  .video-fs-btn {
    padding: 8px 10px;
    font-size: 12px;
  }
}

.code-table-wrap {
  max-height: 430px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: white;
}
.code-table-wrap .code-table {
  margin-top: 0;
}
.code-table thead th {
  position: sticky;
  top: 0;
  background: white;
  z-index: 1;
}
.code-pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 12px;
}
.lesson-manager-toolbar {
  justify-content: flex-end;
}
.lesson-list-scroll {
  max-height: 620px;
}
.lesson-manage-card {
  display: grid;
  gap: 12px;
}
.lesson-manage-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}
.lesson-checkline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--muted);
}
.lesson-manage-grid {
  display: grid;
  grid-template-columns: minmax(0,1fr) 120px;
  gap: 14px;
  align-items: end;
}
.lesson-sort-wrap {
  min-width: 0;
}
.lesson-sort-input {
  min-width: 0;
}
.auth-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 8px;
}
.linklike {
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 14px;
  padding: 0;
  cursor: pointer;
  text-decoration: underline;
}
.info-card {
  margin-top: 16px;
}
.verify-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 16px;
  background: var(--bg);
}
.verify-card {
  width: min(100%, 560px);
  background: white;
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 28px;
  box-shadow: var(--shadow);
}
.verify-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 18px;
}
@media (max-width: 680px) {
  .lesson-manage-grid,
  .code-pagination {
    grid-template-columns: 1fr;
  }
  .lesson-manager-toolbar {
    justify-content: flex-start;
  }
}
