/* ============================================
   文都网课平台 UI 重设计 — 自定义样式
   版本: v2.1 | P2: 暗色模式 + 动效体系 + A11y
   ============================================ */

/* ============================================
   1. CSS 变量 (Design Tokens)
   ============================================ */
:root {
  /* 亮色主题 */
  --color-bg:         #f9fafb;
  --color-surface:    #ffffff;
  --color-border:     #e5e7eb;
  --color-text:       #1f2937;
  --color-text-secondary: #6b7280;
  --color-primary:    #f97316;
  --color-primary-hover: #ea580c;

  /* P2-4: 动效 token 变量 */
  --duration-fast: 150ms;
  --duration-normal: 300ms;
  --duration-slow: 500ms;
  --easing-default: cubic-bezier(0.4, 0, 0.2, 1);
  --easing-enter: cubic-bezier(0, 0, 0.2, 1);
  --easing-exit: cubic-bezier(0.4, 0, 1, 1);

  /* P2-5: 热力图颜色变量（亮色） */
  --heatmap-level-0: #ebedf0;
  --heatmap-level-1: #9be9a8;
  --heatmap-level-2: #40c463;
  --heatmap-level-3: #30a14e;
  --heatmap-level-4: #216e39;

  /* P2: 扩展颜色变量（用于暗色模式切换） */
  --color-bg-primary: #f9fafb;
  --color-bg-card: #ffffff;
  --color-text-primary: #1f2937;
  --color-accent: #f59e0b;
  --color-success: #10b981;
  --color-warning: #f59e0b;
  --color-danger: #ef4444;
  --color-primary-rgb: 249, 115, 22;
  --color-shadow: rgba(0, 0, 0, 0.08);

  /* 兼容旧版变量名 (被现有 nc- 工具类使用) */
  --nc-primary:       #f97316;
  --nc-primary-dark:  #ea580c;
  --nc-primary-light: #fff7ed;
  --nc-secondary:     #6b7280;
  --nc-accent:        #f59e0b;
  --nc-success:       #10b981;
  --nc-success-light: #d1fae5;
  --nc-warning:       #f59e0b;
  --nc-warning-light: #fef3c7;
  --nc-danger:        #ef4444;
  --nc-danger-light:  #fee2e2;
  --nc-info:          #3b82f6;
  --nc-info-light:    #dbeafe;
  --nc-bg:            #f9fafb;
  --nc-bg-card:       #ffffff;
  --nc-border:        #e5e7eb;
  --nc-text-primary:  #1f2937;
  --nc-text-secondary:#6b7280;
  --nc-text-muted:    #9ca3af;
  --nc-shadow-sm:     0 1px 3px rgba(0, 0, 0, 0.06);
  --nc-shadow:        0 2px 8px rgba(0, 0, 0, 0.08);
  --nc-shadow-lg:     0 8px 24px rgba(0, 0, 0, 0.12);
  --nc-shadow-hover:  0 4px 16px rgba(0, 0, 0, 0.12);
  --nc-radius-sm:     6px;
  --nc-radius:        12px;
  --nc-radius-lg:     20px;
  --nc-transition:    all var(--duration-normal) var(--easing-default);
  --nc-transition-fast: all var(--duration-fast) var(--easing-default);
}

/* ============================================
   P2-1: 暗色主题覆盖块
   ============================================ */
[data-theme="dark"] {
  --color-bg: #1a1a2e;
  --color-surface: #16213e;
  --color-border: #2d2d3d;
  --color-text: #e4e4e7;
  --color-text-secondary: #a1a1aa;
  --color-primary: #fb923c;
  --color-primary-hover: #fdba74;

  --color-bg-primary: #1a1a2e;
  --color-bg-card: #16213e;
  --color-text-primary: #e4e4e7;
  --color-accent: #f59e0b;
  --color-success: #22c55e;
  --color-warning: #f59e0b;
  --color-danger: #ef4444;
  --color-primary-rgb: 251, 146, 60;
  --color-shadow: rgba(0, 0, 0, 0.3);

  --nc-primary: #fb923c;
  --nc-primary-dark: #fdba74;
  --nc-primary-light: rgba(251, 146, 60, 0.16);
  --nc-secondary: #a1a1aa;
  --nc-accent: #f59e0b;
  --nc-success: #22c55e;
  --nc-success-light: #064e3b;
  --nc-warning: #f59e0b;
  --nc-warning-light: #78350f;
  --nc-danger: #ef4444;
  --nc-danger-light: #7f1d1d;
  --nc-info: #60a5fa;
  --nc-info-light: #1e3a5f;
  --nc-bg: #1a1a2e;
  --nc-bg-card: #16213e;
  --nc-border: #2d2d3d;
  --nc-text-primary: #e4e4e7;
  --nc-text-secondary: #a1a1aa;
  --nc-text-muted: #71717a;
  --nc-shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --nc-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
  --nc-shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);
  --nc-shadow-hover: 0 4px 16px rgba(0, 0, 0, 0.5);

  --heatmap-level-0: #2d2d3d;
  --heatmap-level-1: #0e4429;
  --heatmap-level-2: #006d32;
  --heatmap-level-3: #26a641;
  --heatmap-level-4: #39d353;
}

/* ============================================
   P2-4: 全局过渡（html/body 主题切换平滑）
   ============================================ */
html,
body {
  transition: background-color var(--duration-normal) var(--easing-default),
              color var(--duration-normal) var(--easing-default);
}

/* ============================================
   P2-4: prefers-reduced-motion 全局覆盖
   ============================================ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ============================================
   P2-2: 全局 :focus-visible 规则
   ============================================ */
*:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
  border-radius: 2px;
}

/* ============================================
   P2-2: Skip-to-content 链接
   ============================================ */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 8px;
  z-index: 10000;
  padding: 0.5rem 1rem;
  background: var(--color-primary);
  color: #ffffff;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: none;
}
.skip-link:focus {
  left: 8px;
}

/* ============================================
   P2-4: Toast 入场/出场 keyframes
   ============================================ */
@keyframes toast-enter {
  from { opacity: 0; transform: translateY(1rem) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes toast-exit {
  from { opacity: 1; transform: translateY(0) scale(1); }
  to { opacity: 0; transform: translateY(-0.5rem) scale(0.95); }
}

/* ============================================
   2. 自定义动画 (Keyframes)
   ============================================ */

/* 空状态图标弹入 */
@keyframes nc-empty-bounce-in {
  0% { opacity: 0; transform: scale(0.3); }
  50% { transform: scale(1.08); }
  100% { opacity: 1; transform: scale(1); }
}

/* 空状态图标浮动 */
@keyframes nc-empty-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

/* 完成对勾弹跳 */
@keyframes nc-check-pop {
  0% { transform: scale(0); }
  60% { transform: scale(1.3); }
  100% { transform: scale(1); }
}

/* Toast 滑入（复用 P2-4 token） */
@keyframes nc-slide-up {
  from { opacity: 0; transform: translateY(1rem); }
  to { opacity: 1; transform: translateY(0); }
}

/* 骨架屏 shimmer（复用 P2-4 token） */
@keyframes nc-shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

/* 页面淡入 */
@keyframes nc-fade-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* 闪烁 (测验倒计时) */
@keyframes nc-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* 旋转 (loading spinner) */
@keyframes nc-spin {
  to { transform: rotate(360deg); }
}

/* P2-5: Hamburger slide-in */
@keyframes hamburger-slide-in {
  from { transform: translateX(-100%); }
  to { transform: translateX(0); }
}
@keyframes hamburger-slide-out {
  from { transform: translateX(0); }
  to { transform: translateX(-100%); }
}

/* P2-5: Backdrop fade */
@keyframes backdrop-fade-in {
  from { opacity: 0; }
  to { opacity: 0.5; }
}

/* ============================================
   3. nc- 工具类 (Utility Classes)
   ============================================ */

/* 通用过渡（使用 P2-4 token） */
.nc-transition {
  transition: all var(--duration-normal) var(--easing-default);
}
.nc-transition-fast {
  transition: all var(--duration-fast) var(--easing-default);
}

/* 空状态动画 */
.nc-empty-animate {
  animation: nc-empty-bounce-in var(--duration-slow) var(--easing-enter) both;
}
.nc-empty-icon-float {
  animation: nc-empty-float 3s var(--easing-default) infinite;
}

/* 对勾弹跳 */
.nc-check-pop {
  animation: nc-check-pop var(--duration-normal) var(--easing-default);
}

/* Toast */
.nc-toast {
  animation: toast-enter var(--duration-normal) var(--easing-enter);
}

/* 骨架屏 */
.nc-skeleton {
  background: linear-gradient(90deg, var(--color-bg-card) 25%, var(--color-border) 50%, var(--color-bg-card) 75%);
  background-size: 200% 100%;
  animation: nc-shimmer 1.5s var(--easing-default) infinite;
  border-radius: 0.5rem;
}

/* 页面进入 */
.nc-page-enter {
  animation: nc-fade-in var(--duration-normal) var(--easing-default);
}

/* 闪烁 */
.nc-blink {
  animation: nc-blink 1s infinite;
}

/* Spin */
.nc-spin {
  animation: nc-spin 0.8s linear infinite;
}

/* ============================================
   P2-4: 微交互规则
   ============================================ */

/* button :active 轻微缩放 */
button:active:not(.nc-no-scale) {
  transform: scale(0.97);
}

/* input :focus border-color 过渡 */
input:focus,
select:focus,
textarea:focus {
  border-color: var(--color-primary) !important;
  transition: border-color var(--duration-fast) var(--easing-default),
              box-shadow var(--duration-fast) var(--easing-default);
}

/* card :hover shadow 提升 */
.nc-card-hover {
  transition: box-shadow var(--duration-normal) var(--easing-default),
              transform var(--duration-normal) var(--easing-default);
}
.nc-card-hover:hover {
  box-shadow: var(--nc-shadow-lg);
  transform: translateY(-2px);
}

/* ============================================
   P2-3: 骨架屏 (skeleton) 样式
   ============================================ */

/* 骨架卡片容器 */
.skeleton-card {
  border-radius: var(--nc-radius);
  overflow: hidden;
}

/* 骨架占位块 */
.skeleton-block {
  background: linear-gradient(90deg,
    var(--color-bg-card) 25%,
    var(--color-border) 50%,
    var(--color-bg-card) 75%);
  background-size: 200% 100%;
  animation: nc-shimmer 1.5s var(--easing-default) infinite;
  border-radius: 0.375rem;
}

/* 骨架屏→内容 fade-in */
.skeleton-fade-in {
  animation: nc-fade-in var(--duration-normal) var(--easing-enter);
}

/* ============================================
   P2-5: 热力图 (Study Heatmap) 样式
   ============================================ */

.nc-heatmap-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
}

.nc-heatmap-cell {
  aspect-ratio: 1;
  border-radius: 3px;
  cursor: pointer;
  transition: transform var(--duration-fast) var(--easing-default);
}
.nc-heatmap-cell:hover {
  transform: scale(1.3);
  z-index: 1;
}

.nc-heatmap-level-0 { background-color: var(--heatmap-level-0); }
.nc-heatmap-level-1 { background-color: var(--heatmap-level-1); }
.nc-heatmap-level-2 { background-color: var(--heatmap-level-2); }
.nc-heatmap-level-3 { background-color: var(--heatmap-level-3); }
.nc-heatmap-level-4 { background-color: var(--heatmap-level-4); }

.nc-heatmap-legend {
  display: flex;
  align-items: center;
  gap: 4px;
  justify-content: flex-end;
  font-size: 0.75rem;
  color: var(--color-text-secondary);
}

.nc-heatmap-legend-cell {
  width: 12px;
  height: 12px;
  border-radius: 2px;
}

/* ============================================
   4. 章节列表项增强 (P1-ready)
   ============================================ */

/* 章节项完成对勾动画 (挂载到 Bootstrap 图标的父元素) */
.nc-chapter-item__status--completed {
  animation: nc-check-pop var(--duration-normal) var(--easing-default);
}

/* ============================================
   5. Django 表单控件全局样式 (替代 Bootstrap form-control)
   ============================================ */

/* 输入框、下拉框、文本域基类 */
.form-control,
input[type="text"]:not(.nc-no-style),
input[type="password"]:not(.nc-no-style),
input[type="email"]:not(.nc-no-style),
input[type="number"]:not(.nc-no-style),
input[type="url"]:not(.nc-no-style),
input[type="search"]:not(.nc-no-style),
select:not(.nc-no-style),
textarea:not(.nc-no-style) {
  display: block;
  width: 100%;
  padding: 0.625rem 0.875rem;
  font-size: 0.9375rem;
  line-height: 1.5;
  color: var(--color-text-primary);
  background-color: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: 0.5rem;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  transition: border-color var(--duration-fast) var(--easing-default),
              box-shadow var(--duration-fast) var(--easing-default);
  font-family: inherit;
}

.form-control:focus,
input[type="text"]:not(.nc-no-style):focus,
input[type="password"]:not(.nc-no-style):focus,
input[type="email"]:not(.nc-no-style):focus,
input[type="number"]:not(.nc-no-style):focus,
select:not(.nc-no-style):focus,
textarea:not(.nc-no-style):focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(var(--color-primary-rgb), 0.15);
}

.form-control::placeholder,
input[type="text"]:not(.nc-no-style)::placeholder,
input[type="password"]:not(.nc-no-style)::placeholder,
input[type="email"]:not(.nc-no-style)::placeholder,
textarea:not(.nc-no-style)::placeholder {
  color: var(--nc-text-muted);
}

/* 下拉框专用 */
select:not(.nc-no-style) {
  appearance: none;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%239ca3af' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 14px 10px;
  padding-right: 2.25rem;
}

/* 文本域 */
textarea:not(.nc-no-style) {
  min-height: 100px;
  resize: vertical;
}

/* checkbox / radio 相邻 label */
.form-check-label {
  font-size: 0.9375rem;
  color: var(--color-text);
  cursor: pointer;
}

/* checkbox / radio 输入框 */
.form-check-input,
input[type="checkbox"]:not(.nc-no-style),
input[type="radio"]:not(.nc-no-style) {
  width: 1rem;
  height: 1rem;
  accent-color: var(--color-primary);
  cursor: pointer;
}

/* 文件上传 */
input[type="file"]:not(.nc-no-style) {
  font-size: 0.875rem;
  color: var(--color-text-secondary);
}

input[type="file"]:not(.nc-no-style)::file-selector-button {
  padding: 0.375rem 0.875rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--color-primary);
  background: var(--nc-primary-light);
  border: 1px solid var(--color-border);
  border-radius: 0.375rem;
  cursor: pointer;
  margin-right: 0.75rem;
  transition: all var(--duration-fast) var(--easing-default);
}

input[type="file"]:not(.nc-no-style)::file-selector-button:hover {
  background: var(--color-border);
}

/* ============================================
   7. 测验计时器闪烁
   ============================================ */
#quizTimer.blink {
  animation: nc-blink 1s infinite;
}

/* ============================================
   8. 测验加载遮罩
   ============================================ */
.nc-quiz-loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}
.nc-quiz-loading-overlay p {
  color: white;
}

/* ============================================
   9. 打印样式 (证书)
   ============================================ */
@media print {
  .navbar,
  nav {
    display: none !important;
  }
  body {
    background: white !important;
  }
  .skip-link {
    display: none !important;
  }
}

/* ============================================
   P1-3: Global search dropdown
   ============================================ */

.nc-search-dropdown {
    border: 1px solid var(--color-border);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.10);
    background: var(--color-bg-card);
    border-radius: 0.75rem;
    overflow: hidden;
}

.nc-search-item {
    transition: background-color 0.1s var(--easing-default),
                color 0.1s var(--easing-default);
    user-select: none;
}

.nc-search-item--active {
    background-color: var(--nc-primary-light);
    color: var(--color-primary);
}

.nc-search-container .nc-no-style {
    outline: none;
}

/* ============================================
   P1-5: Quiz ring progress chart
   ============================================ */

.nc-progress-ring {
    display: block;
}

.nc-progress-ring-circle {
    transition: stroke-dashoffset 0.35s var(--easing-default),
                stroke 0.35s var(--easing-default);
}

/* ============================================
   P1-5: Quiz timer tiers (3-level urgency)
   ============================================ */

.nc-timer-normal {
    background-color: #ef4444;
    color: #ffffff;
}

.nc-timer-warning {
    background-color: #f59e0b;
    color: #ffffff;
    animation: nc-blink 2s infinite;
}

.nc-timer-danger {
    background-color: #dc2626;
    color: #ffffff;
    animation: nc-blink 0.5s infinite;
    font-weight: 700;
}

/* Override existing quizTimer.blink to use nc-blink-intense */
#quizTimer.blink,
#quizTimer.nc-timer-danger.blink {
    animation: nc-blink 0.5s infinite;
}

/* ============================================
   P1-5: Quiz word count
   ============================================ */

.nc-word-count {
    font-size: 0.75rem;
    color: var(--nc-text-muted);
    pointer-events: none;
    user-select: none;
}

/* ============================================
   P2-5: Hamburger mobile nav
   ============================================ */

.nc-mobile-nav-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1050;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--duration-normal) var(--easing-default);
}
.nc-mobile-nav-overlay.active {
  opacity: 1;
  pointer-events: auto;
}
.nc-mobile-nav-overlay--visible {
  opacity: 1;
  pointer-events: auto;
}

.nc-mobile-nav-panel {
  position: fixed;
  top: 0;
  left: 0;
  width: 280px;
  height: 100%;
  background: var(--color-bg-card);
  z-index: 1051;
  transform: translateX(-100%);
  transition: transform var(--duration-normal) var(--easing-default);
  overflow-y: auto;
}
.nc-mobile-nav-panel.active {
  transform: translateX(0);
}
.nc-mobile-nav-panel--open {
  transform: translateX(0);
}

/* P2-6 fix: 桌面端 (>= lg 断点 1024px) 强制隐藏移动面板。
   即使 JS 尚未执行或 resize 事件未触发，CSS 也保证桌面宽屏下绝不渲染移动面板，
   彻底杜绝从窄屏放大到桌面后面板残留的问题。退出该断点后恢复为默认可显示状态。 */
@media (min-width: 1024px) {
  .nc-mobile-nav-panel,
  .nc-mobile-nav-panel--open,
  .nc-mobile-nav-panel.active {
    display: none !important;
  }
  .nc-mobile-nav-overlay,
  .nc-mobile-nav-overlay--visible,
  .nc-mobile-nav-overlay.active {
    display: none !important;
  }
}

/* ============================================
   P2-5: Accordion 过渡
   ============================================ */

.nc-accordion-header {
  cursor: pointer;
  user-select: none;
}
.nc-accordion-body {
  overflow: hidden;
  max-height: 0;
  transition: max-height var(--duration-normal) var(--easing-default);
}
.nc-accordion-body.open {
  max-height: 600px;
}

/* ============================================
   P2-5: 触控安全区 (min 44x44px)
   ============================================ */

.touch-safe {
  min-height: 44px;
  min-width: 44px;
}

/* ============================================
   P2-5: 徽章展示 (Badge Display)
   ============================================ */

.nc-badge-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 1rem;
}

.nc-badge-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 1rem 0.75rem;
  border-radius: var(--nc-radius);
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  text-align: center;
  transition: box-shadow var(--duration-fast) var(--easing-default),
              transform var(--duration-fast) var(--easing-default);
}
.nc-badge-card:hover {
  box-shadow: var(--nc-shadow);
  transform: translateY(-2px);
}

.nc-badge-card--locked {
  opacity: 0.5;
  filter: grayscale(0.8);
}

.nc-badge-icon {
  font-size: 2rem;
  line-height: 1;
}

/* ============================================
   P2-5: 头像上传 (Avatar Upload)
   ============================================ */

.nc-avatar-wrapper {
  position: relative;
  display: inline-block;
  cursor: pointer;
}

.nc-avatar-overlay {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--color-primary);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  border: 2px solid var(--color-bg-card);
  box-shadow: var(--nc-shadow-sm);
}

.nc-avatar-zoom-slider {
  width: 100%;
  accent-color: var(--color-primary);
}

/* ============================================
   10. 响应式微调
   ============================================ */

/* P2-6: 全站防水平溢出 */
html,
body {
  overflow-x: hidden;
}

/* P2-6: 移动端单栏布局 */
@media (max-width: 1023px) {
  .nc-chapter-layout {
    display: flex;
    flex-direction: column;
  }
  .nc-chapter-layout > * {
    width: 100%;
  }
}

/* P2-6: 管理表格响应式 */
.nc-table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.nc-table-sticky-col {
  position: sticky;
  left: 0;
  z-index: 10;
  background: var(--color-bg-card);
}

/* ============================================
   P2-6: 测验选项触控安全区
   ============================================ */

.quiz-option label {
  min-height: 44px;
  min-width: 44px;
}

/* ============================================
   P2: 暗色模式下的特定覆盖
   ============================================ */

[data-theme="dark"] .bg-white {
  background-color: var(--color-bg-card) !important;
}
[data-theme="dark"] .bg-neutral-50 {
  background-color: var(--color-bg-primary) !important;
}
[data-theme="dark"] .text-neutral-800 {
  color: var(--color-text-primary) !important;
}
[data-theme="dark"] .text-neutral-700 {
  color: var(--color-text-primary) !important;
}
[data-theme="dark"] .text-neutral-600 {
  color: var(--color-text-secondary) !important;
}
[data-theme="dark"] .text-neutral-500 {
  color: var(--color-text-secondary) !important;
}
[data-theme="dark"] .border-neutral-100,
[data-theme="dark"] .border-neutral-200 {
  border-color: var(--color-border) !important;
}
[data-theme="dark"] .bg-neutral-100 {
  background-color: var(--color-border) !important;
}
[data-theme="dark"] .hover\:bg-neutral-50:hover,
[data-theme="dark"] .hover\:bg-neutral-50\/50:hover {
  background-color: rgba(45, 45, 61, 0.5) !important;
}
[data-theme="dark"] .divide-neutral-100 > *,
[data-theme="dark"] .divide-y > * {
  border-color: var(--color-border) !important;
}
[data-theme="dark"] .nc-search-dropdown {
  background: var(--color-bg-card);
  border-color: var(--color-border);
}
[data-theme="dark"] .nc-dropdown-menu {
  background: var(--color-bg-card);
  border-color: var(--color-border);
}
[data-theme="dark"] .nc-toast {
  background: var(--color-bg-card);
}

/* ============================================
   P3-1: Star Rating (Course Reviews)
   ============================================ */

.nc-star-rating {
  display: inline-flex;
  gap: 2px;
  direction: ltr;
}

.nc-star-rating .nc-star {
  font-size: 1.25rem;
  color: #d1d5db;
  cursor: pointer;
  transition: color var(--duration-fast) var(--easing-default),
              transform var(--duration-fast) var(--easing-default);
}

.nc-star-rating .nc-star:hover {
  transform: scale(1.15);
}

.nc-star-rating .nc-star.nc-star--active {
  color: #f59e0b;
}

.nc-star-rating.nc-star-rating--readonly .nc-star {
  cursor: default;
}

.nc-star-rating.nc-star-rating--readonly .nc-star:hover {
  transform: none;
}

.nc-star-rating .nc-star.nc-star--half {
  position: relative;
}

/* Rating summary bar */
.nc-rating-bar {
  height: 8px;
  border-radius: 999px;
  background: var(--color-border);
  overflow: hidden;
}

.nc-rating-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #f59e0b, #fbbf24);
  transition: width var(--duration-normal) var(--easing-default);
}

/* Review card */
.nc-review-card {
  border-left: 3px solid var(--color-primary);
  transition: box-shadow var(--duration-fast) var(--easing-default);
}
.nc-review-card:hover {
  box-shadow: var(--nc-shadow);
}

/* ============================================
   P3-4: Discussion Forum
   ============================================ */

.nc-discussion-card {
  transition: box-shadow var(--duration-fast) var(--easing-default),
              transform var(--duration-fast) var(--easing-default);
}
.nc-discussion-card:hover {
  box-shadow: var(--nc-shadow);
  transform: translateY(-1px);
}

/* Reply indent for nested visual */
.nc-reply-card {
  position: relative;
}
.nc-reply-card::before {
  content: '';
  position: absolute;
  left: -12px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--color-border);
  border-radius: 1px;
}

/* Discussion markdown rendered HTML */
.nc-markdown-content p {
  margin: 0 0 0.5rem 0;
}
.nc-markdown-content p:last-child {
  margin-bottom: 0;
}
.nc-markdown-content ul {
  margin: 0.25rem 0 0.5rem 1.25rem;
  padding: 0;
}
.nc-markdown-content code {
  background: var(--nc-primary-light);
  color: var(--color-primary);
  padding: 0.125rem 0.375rem;
  border-radius: 4px;
  font-size: 0.85em;
  font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
}

/* ============================================
   P3-5: Notification Center
   ============================================ */

.nc-notification-unread {
  position: relative;
}

/* Notification bell dropdown */
#nc-notification-dropdown {
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
  border: 1px solid var(--color-border);
}

/* Notification type icons in center */
.nc-notification-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.nc-notification-icon--badge {
  background: #fef3c7;
  color: #f59e0b;
}

.nc-notification-icon--quiz {
  background: #dbeafe;
  color: #3b82f6;
}

.nc-notification-icon--certificate {
  background: #d1fae5;
  color: #10b981;
}

.nc-notification-icon--reply {
  background: #e0f2fe;
  color: #0ea5e9;
}

.nc-notification-icon--system {
  background: #f3f4f6;
  color: #6b7280;
}

/* ============================================
   P3-9: Leaderboard V2
   ============================================ */

.nc-lb-rank-badge {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.8rem;
  flex-shrink: 0;
}

.nc-lb-rank-badge--gold {
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  color: #fff;
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.4);
}

.nc-lb-rank-badge--silver {
  background: linear-gradient(135deg, #d1d5db, #9ca3af);
  color: #fff;
  box-shadow: 0 2px 8px rgba(156, 163, 175, 0.4);
}

.nc-lb-rank-badge--bronze {
  background: linear-gradient(135deg, #fb923c, #ea580c);
  color: #fff;
  box-shadow: 0 2px 8px rgba(234, 88, 12, 0.4);
}

.nc-lb-rank-badge--normal {
  background: var(--color-border);
  color: var(--color-text-secondary);
}

.nc-lb-entry {
  transition: box-shadow var(--duration-fast) var(--easing-default),
              transform var(--duration-fast) var(--easing-default);
}
.nc-lb-entry:hover {
  box-shadow: var(--nc-shadow);
  transform: translateX(2px);
}

/* Period tab active indicator */
.nc-lb-period-btn {
  min-width: 80px;
}

/* ============================================
   P3-8: PWA install prompt
   ============================================ */

.nc-pwa-install-bar {
  animation: toast-enter var(--duration-normal) var(--easing-enter);
}

/* Standalone mode adjustments */
@media (display-mode: standalone) {
  .nc-pwa-install-bar {
    display: none !important;
  }
}

/* ============================================
   P3-2: Wrong Answer Book
   ============================================ */

.nc-wa-correct-answer {
  background: var(--nc-success-light);
  border: 1px solid var(--color-success);
  color: var(--color-success);
}

.nc-wa-wrong-answer {
  background: var(--nc-danger-light);
  border: 1px solid var(--color-danger);
  color: var(--color-danger);
}

/* ============================================
   P3-9: Leaderboard opt-out toggle switch
   ============================================ */

.nc-toggle-switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 26px;
  flex-shrink: 0;
}

.nc-toggle-switch .nc-toggle-input {
  opacity: 0;
  width: 0;
  height: 0;
}

.nc-toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #d1d5db;
  border-radius: 26px;
  transition: background-color var(--duration-fast) var(--easing-default);
}

.nc-toggle-slider::before {
  content: "";
  position: absolute;
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 3px;
  background-color: #ffffff;
  border-radius: 50%;
  transition: transform var(--duration-fast) var(--easing-default);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

.nc-toggle-input:checked + .nc-toggle-slider {
  background-color: var(--color-primary);
}

.nc-toggle-input:checked + .nc-toggle-slider::before {
  transform: translateX(22px);
}

.nc-toggle-input:focus-visible + .nc-toggle-slider {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* ============================================
   P0~P2: 上传元数据自动识别 · 组件样式
   全部复用现有 --nc-* / --nc-bg-card / --nc-border / --nc-text-* 变量，
   [data-theme="dark"] 下变量已重定义，无需额外适配。
   ============================================ */

/* 屏幕阅读器专用（JS 注入的 .sr-only 说明兜底） */
.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0);
  white-space: nowrap; border: 0;
}

/* 通用卡片（左侧上传/预览/封面卡、右侧表单卡） */
.nc-card {
  background: var(--nc-bg-card);
  border: 1px solid var(--nc-border);
  border-radius: var(--nc-radius);
}

/* ---- 2.1 Dropzone ---- */
.nc-dropzone {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  min-height: 160px;
  padding: 1.5rem;
  text-align: center;
  border: 2px dashed var(--nc-border);
  border-radius: var(--nc-radius);
  background: var(--nc-bg-card);
  color: var(--nc-text-secondary);
  cursor: pointer;
  transition: border-color var(--duration-fast) var(--easing-default),
              background-color var(--duration-fast) var(--easing-default),
              box-shadow var(--duration-fast) var(--easing-default);
}
.nc-dropzone:hover {
  border-color: var(--nc-primary);
}
.nc-dropzone:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}
.nc-dropzone__icon {
  font-size: 2.25rem;
  line-height: 1;
  color: var(--nc-primary);
}
.nc-dropzone__title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--nc-text-primary);
}
.nc-dropzone__hint {
  font-size: 0.75rem;
  color: var(--nc-text-muted);
}
.nc-dropzone--dragover {
  border-style: solid;
  border-color: var(--nc-primary);
  background: var(--nc-primary-light);
}
.nc-dropzone--disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.nc-dropzone--error {
  border-color: var(--nc-danger);
  background: var(--nc-danger-light);
}
.nc-dropzone--error .nc-dropzone__icon {
  color: var(--nc-danger);
}

/* ---- 2.2 上传进度条 ---- */
.nc-upload-progress {
  display: block;
}
.nc-upload-progress__track {
  height: 8px;
  width: 100%;
  background: var(--nc-border);
  border-radius: var(--nc-radius-sm);
  overflow: hidden;
}
.nc-upload-progress__fill {
  height: 100%;
  width: 0%;
  background: var(--nc-primary);
  border-radius: var(--nc-radius-sm);
  transition: width var(--duration-slow) var(--easing-default),
              background-color var(--duration-normal) var(--easing-default);
}
.nc-upload-progress__meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  margin-top: 0.375rem;
}
.nc-upload-progress__percent {
  font-size: 0.875rem;
  font-weight: 700;
  font-family: 'JetBrains Mono', 'Consolas', monospace;
  color: var(--nc-text-primary);
}
.nc-upload-progress__detail {
  font-size: 0.75rem;
  color: var(--nc-text-muted);
  font-family: 'JetBrains Mono', 'Consolas', monospace;
}
.nc-upload-progress--probing .nc-upload-progress__fill {
  background: var(--nc-primary);
  background-image: linear-gradient(
    90deg, var(--nc-primary-light) 25%, var(--nc-primary) 50%, var(--nc-primary-light) 75%
  );
  background-size: 200% 100%;
  animation: nc-shimmer 1.5s var(--easing-default) infinite;
}
.nc-upload-progress--success .nc-upload-progress__fill {
  background: var(--nc-success);
}
.nc-upload-progress--error .nc-upload-progress__fill {
  background: var(--nc-danger);
}

/* ---- 2.3 批量上传队列 ---- */
.nc-upload-queue {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.25rem;
}
.nc-queue-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem;
  border: 1px solid var(--nc-border);
  border-radius: var(--nc-radius-sm);
  background: var(--nc-bg-card);
  transition: box-shadow var(--duration-fast) var(--easing-default);
}
.nc-queue-item__thumb {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--nc-radius-sm);
  background: var(--nc-primary-light);
  color: var(--nc-primary);
  font-size: 1.5rem;
}
.nc-queue-item__body {
  flex: 1 1 auto;
  min-width: 0;
}
.nc-queue-item__name {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--nc-text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.nc-queue-item__bar {
  height: 4px;
  margin-top: 0.375rem;
  background: var(--nc-border);
  border-radius: 999px;
  overflow: hidden;
}
.nc-queue-item__fill {
  height: 100%;
  width: 0%;
  background: var(--nc-primary);
  border-radius: 999px;
  transition: width var(--duration-slow) var(--easing-default);
}
.nc-queue-item__status {
  margin-top: 0.25rem;
  font-size: 0.75rem;
  color: var(--nc-text-muted);
}
.nc-queue-item__action {
  flex-shrink: 0;
}
.nc-queue-item--uploading .nc-queue-item__status { color: var(--nc-primary); }
.nc-queue-item--probing .nc-queue-item__fill {
  background-image: linear-gradient(90deg, var(--nc-primary-light) 25%, var(--nc-primary) 50%, var(--nc-primary-light) 75%);
  background-size: 200% 100%;
  animation: nc-shimmer 1.5s var(--easing-default) infinite;
}
.nc-queue-item--success .nc-queue-item__fill { background: var(--nc-success); }
.nc-queue-item--success .nc-queue-item__status { color: var(--nc-success); }
.nc-queue-item--error .nc-queue-item__fill { background: var(--nc-danger); }
.nc-queue-item--error .nc-queue-item__status { color: var(--nc-danger); }
.nc-queue-item__use,
.nc-queue-item__retry {
  min-height: 36px;
  padding: 0.375rem 0.75rem;
  font-size: 0.8125rem;
  font-weight: 600;
  border-radius: var(--nc-radius-sm);
  border: 1px solid var(--nc-border);
  background: var(--nc-bg-card);
  color: var(--nc-text-primary);
  cursor: pointer;
  transition: background-color var(--duration-fast) var(--easing-default),
              border-color var(--duration-fast) var(--easing-default);
}
.nc-queue-item__use {
  background: var(--nc-primary);
  border-color: var(--nc-primary);
  color: #ffffff;
}
.nc-queue-item__use:hover { background: var(--nc-primary-dark); }
.nc-queue-item__retry:hover { background: var(--nc-primary-light); }

/* ---- 2.4 自动字段 + 🤖 徽章 ---- */
.nc-auto-badge-slot {
  display: inline-flex;
  align-items: center;
  vertical-align: middle;
}
.nc-auto-badge {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  margin-left: 6px;
  padding: 2px 8px;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.4;
  color: var(--nc-primary);
  background: var(--nc-primary-light);
  border-radius: 999px;
  animation: nc-fade-in var(--duration-fast) var(--easing-default);
}
.nc-auto-field__input[data-auto] {
  background-color: var(--nc-primary-light);
  border-color: var(--nc-primary);
}

/* ---- 2.5 元数据预览卡片 ---- */
.nc-meta-card {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.nc-meta-card__row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
}
.nc-meta-card__row dt {
  font-size: 0.75rem;
  color: var(--nc-text-muted);
}
.nc-meta-card__row dd {
  margin: 0;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--nc-text-primary);
  font-family: 'JetBrains Mono', 'Consolas', monospace;
  text-align: right;
}
.nc-meta-card--ready {
  animation: nc-fade-in var(--duration-normal) var(--easing-default);
}

/* ---- 2.6 视频预览 ---- */
.nc-video-preview {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: var(--nc-radius-sm);
  overflow: hidden;
  background: var(--nc-bg);
  border: 1px solid var(--nc-border);
}
.nc-video-preview__placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  color: var(--nc-text-muted);
  font-size: 0.8125rem;
}
.nc-video-preview__placeholder i {
  font-size: 2.5rem;
}
.nc-video-preview__player {
  width: 100%;
  height: 100%;
  display: block;
  background: #000;
}

/* ---- 2.7 封面选择器 ---- */
.nc-cover-selector__preview {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: var(--nc-radius-sm);
  overflow: hidden;
  background: var(--nc-bg);
  border: 1px solid var(--nc-border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--nc-text-muted);
  font-size: 0.8125rem;
}
.nc-cover-selector__img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.nc-cover-selector__caption {
  position: absolute;
  left: 0.5rem;
  bottom: 0.5rem;
  padding: 2px 8px;
  font-size: 0.75rem;
  font-weight: 600;
  color: #fff;
  background: rgba(0, 0, 0, 0.55);
  border-radius: 999px;
}
.nc-cover-selector__input {
  width: 5rem;
  padding: 0.375rem 0.5rem;
  font-family: 'JetBrains Mono', 'Consolas', monospace;
  font-size: 0.875rem;
  color: var(--nc-text-primary);
  background: var(--nc-bg-card);
  border: 1px solid var(--nc-border);
  border-radius: var(--nc-radius-sm);
}
.nc-cover-selector--loading .nc-cover-selector__preview {
  opacity: 0.6;
}
.nc-cover-selector--error .nc-cover-selector__preview {
  border-color: var(--nc-danger);
}

/* ---- 2.8 行内提示条 ---- */
.nc-upload-alert {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border-left: 4px solid transparent;
  border-radius: var(--nc-radius-sm);
  font-size: 0.875rem;
  box-shadow: var(--nc-shadow-sm);
  animation: toast-enter var(--duration-normal) cubic-bezier(0.4, 0, 0.2, 1);
}
.nc-upload-alert[hidden] { display: none; }
.nc-upload-alert__icon { font-size: 1.125rem; flex-shrink: 0; }
.nc-upload-alert__msg { flex: 1 1 auto; }
.nc-upload-alert--info {
  background: var(--nc-info-light);
  border-left-color: var(--nc-info);
  color: var(--nc-info);
}
.nc-upload-alert--success {
  background: var(--nc-success-light);
  border-left-color: var(--nc-success);
  color: var(--nc-success);
}
.nc-upload-alert--error {
  background: var(--nc-danger-light);
  border-left-color: var(--nc-danger);
  color: var(--nc-danger);
}

/* ---- 2.9 元数据徽章（列表/详情页） ---- */
.nc-meta-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 2px 8px;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--nc-text-secondary);
  background: var(--nc-bg);
  border: 1px solid var(--nc-border);
  border-radius: 999px;
  transition: background-color var(--duration-fast) var(--easing-default);
}
.nc-meta-badge i {
  font-size: 0.75rem;
  line-height: 1;
  color: var(--nc-text-muted);
}
.nc-meta-badge__text {
  font-family: 'JetBrains Mono', 'Consolas', monospace;
}
a:hover > .nc-meta-badge,
.nc-meta-badge:hover {
  background: var(--nc-border);
}

/* === P4: Warm Orange Visual Refresh === */

/* (a) 页面背景 */
.nc-app-bg { background: linear-gradient(180deg, #fff7ed 0%, #fffaf5 22%, #f8fafc 60%); background-attachment: fixed; }
[data-theme="dark"] .nc-app-bg { background: linear-gradient(180deg, #1a1a2e 0%, #16213e 100%); background-attachment: fixed; }

/* (b) 原生表单字段 */
input[type="text"], input[type="password"], input[type="email"], input[type="search"], input[type="number"], input[type="url"], input[type="tel"], textarea, select {
  display: block; width: 100%; padding: .6rem .85rem; font-size: .95rem; line-height: 1.5;
  color: var(--nc-text-primary); background: #fff; border: 1px solid var(--nc-border);
  border-radius: var(--nc-radius); transition: var(--nc-transition); box-shadow: var(--nc-shadow-sm);
}
input:focus, textarea:focus, select:focus {
  outline: none; border-color: var(--nc-primary);
  box-shadow: 0 0 0 3px rgba(var(--color-primary-rgb), .18);
}
[data-theme="dark"] input, [data-theme="dark"] textarea, [data-theme="dark"] select {
  background: #0f172a; color: #e4e4e7; border-color: #2d2d3d;
}

/* (c) 统一正文内容表格 */
#main-content table { width: 100%; border-collapse: collapse; }
#main-content thead th { text-align: left; font-weight: 600; color: var(--nc-text-secondary);
  background: var(--nc-bg); padding: .75rem 1rem; border-bottom: 1px solid var(--nc-border); }
#main-content tbody td { padding: .7rem 1rem; border-bottom: 1px solid var(--nc-border); }
#main-content tbody tr:hover { background: rgba(var(--color-primary-rgb), .05); }
#main-content tbody tr:last-child td { border-bottom: 0; }

/* (d) 选中色 + 平滑滚动 */
::selection { background: rgba(var(--color-primary-rgb), .22); }
html { scroll-behavior: smooth; }

/* (e) 页脚样式 */
.nc-footer { margin-top: 2.5rem; background: #fff; border-top: 1px solid var(--nc-border); }
[data-theme="dark"] .nc-footer { background: #16213e; }
.nc-footer__inner { max-width: 80rem; margin: 0 auto; padding: 2rem 1.5rem; display: flex; flex-wrap: wrap; gap: 1.5rem; justify-content: space-between; align-items: center; }
.nc-footer__brand { font-weight: 800; font-size: 1.05rem; background: linear-gradient(90deg, var(--nc-primary), var(--nc-accent)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.nc-footer__links { display: flex; gap: 1.25rem; flex-wrap: wrap; }
.nc-footer__links a { color: var(--nc-text-secondary); text-decoration: none; font-size: .9rem; transition: var(--nc-transition-fast); }
.nc-footer__links a:hover { color: var(--nc-primary); }
.nc-footer__copy { color: var(--nc-text-muted); font-size: .8rem; width: 100%; text-align: center; padding-top: 1rem; border-top: 1px solid var(--nc-border); margin-top: .5rem; }
/* ============================================
   P4-anim: 课程 Hero & 排行榜 动效增强
   ============================================ */

/* ---- Keyframes ---- */
@keyframes nc-aurora {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}
@keyframes nc-float-soft {
  0%, 100% { transform: translateY(0) translateX(0); }
  50%      { transform: translateY(-18px) translateX(10px); }
}
@keyframes nc-rise-in {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes nc-pop-in {
  from { opacity: 0; transform: scale(.92); }
  to   { opacity: 1; transform: scale(1); }
}
@keyframes nc-shine {
  0%   { transform: translateX(-120%) skewX(-20deg); }
  60%  { transform: translateX(220%) skewX(-20deg); }
  100% { transform: translateX(220%) skewX(-20deg); }
}
@keyframes nc-pulse-ring {
  0%   { transform: scale(.8); opacity: .7; }
  70%  { transform: scale(1.6); opacity: 0; }
  100% { transform: scale(1.6); opacity: 0; }
}
@keyframes nc-count-pop {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.18); }
  100% { transform: scale(1); }
}

/* ---- 课程 Hero ---- */
.nc-course-hero {
  position: relative; overflow: hidden;
  border-radius: var(--nc-radius-lg);
  margin-bottom: 1.5rem;
  background: linear-gradient(120deg, #f97316 0%, #f59e0b 50%, #ea580c 100%);
  background-size: 200% 200%;
  animation: nc-aurora 14s ease-in-out infinite;
  color: #fff;
  box-shadow: var(--nc-shadow-lg);
}
.nc-course-hero__bg { position: absolute; inset: 0; pointer-events: none; }
.nc-hero-blob {
  position: absolute; border-radius: 50%; filter: blur(38px); opacity: .45;
  background: radial-gradient(circle at 30% 30%, rgba(255,255,255,.9), rgba(255,255,255,0));
  animation: nc-float-soft 9s ease-in-out infinite;
}
.nc-hero-blob--1 { width: 260px; height: 260px; top: -60px; left: -40px; }
.nc-hero-blob--2 { width: 200px; height: 200px; bottom: -50px; right: 10%; animation-delay: -3s; opacity: .35; }
.nc-hero-blob--3 { width: 150px; height: 150px; top: 30%; right: -30px; animation-delay: -6s; opacity: .3; }
.nc-course-hero__inner {
  position: relative; z-index: 1;
  display: grid; grid-template-columns: 220px 1fr; gap: 1.75rem; align-items: center;
  padding: 2rem;
}
.nc-course-hero__cover {
  width: 100%; aspect-ratio: 16/10; object-fit: cover; border-radius: var(--nc-radius);
  border: 3px solid rgba(255,255,255,.5); box-shadow: 0 12px 30px rgba(0,0,0,.25);
  animation: nc-pop-in .6s var(--easing-enter) both;
}
.nc-course-hero__cover--fallback {
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,.15); border: 3px solid rgba(255,255,255,.5);
  font-size: 4rem; color: #fff;
}
.nc-course-hero__eyebrow {
  display: inline-block; font-size: .8rem; font-weight: 600; letter-spacing: .04em;
  background: rgba(255,255,255,.18); padding: .25rem .75rem; border-radius: 999px; margin-bottom: .75rem;
}
.nc-course-hero__title {
  font-size: clamp(1.6rem, 3vw, 2.4rem); font-weight: 800; line-height: 1.2;
  margin: 0 0 .75rem; text-shadow: 0 2px 8px rgba(0,0,0,.18);
}
.nc-course-hero__desc { font-size: .95rem; opacity: .92; max-width: 60ch; margin: 0 0 1rem; }
.nc-course-hero__meta {
  display: flex; flex-wrap: wrap; gap: .5rem 1.25rem; font-size: .875rem; opacity: .95; margin-bottom: 1.25rem;
}
.nc-course-hero__meta span { display: inline-flex; align-items: center; gap: .4rem; }
.nc-course-hero__actions { display: flex; gap: .75rem; flex-wrap: wrap; }
.nc-hero-cta {
  display: inline-flex; align-items: center; gap: .5rem; padding: .7rem 1.4rem;
  border-radius: 999px; font-weight: 700; font-size: .95rem; text-decoration: none; transition: var(--nc-transition);
}
.nc-hero-cta--primary { background: #fff; color: var(--nc-primary-dark); box-shadow: 0 8px 20px rgba(0,0,0,.18); }
.nc-hero-cta--primary:hover { transform: translateY(-2px); box-shadow: 0 12px 26px rgba(0,0,0,.28); }
.nc-hero-cta--ghost { background: rgba(255,255,255,.15); color: #fff; border: 1px solid rgba(255,255,255,.5); }
.nc-hero-cta--ghost:hover { background: rgba(255,255,255,.28); transform: translateY(-2px); }
.nc-course-hero__body > * { animation: nc-rise-in .6s var(--easing-enter) both; }
.nc-course-hero__body > *:nth-child(1) { animation-delay: .12s; }
.nc-course-hero__body > *:nth-child(2) { animation-delay: .20s; }
.nc-course-hero__body > *:nth-child(3) { animation-delay: .28s; }
.nc-course-hero__body > *:nth-child(4) { animation-delay: .36s; }
.nc-course-hero__body > *:nth-child(5) { animation-delay: .44s; }
@media (max-width: 768px) {
  .nc-course-hero__inner { grid-template-columns: 1fr; text-align: center; padding: 1.5rem; }
  .nc-course-hero__actions, .nc-course-hero__meta { justify-content: center; }
  .nc-course-hero__cover { max-width: 280px; margin: 0 auto; }
}

/* ---- 排行榜 v2 表头 + 行 + 奖牌 ---- */
.nc-lb-hero { position: relative; margin-bottom: 2rem; }
.nc-lb-trophy {
  display: inline-flex; align-items: center; justify-content: center;
  width: 72px; height: 72px; border-radius: 50%; font-size: 2rem; color: #fff;
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  box-shadow: 0 10px 24px rgba(245,158,11,.4); position: relative; overflow: hidden;
  animation: nc-pop-in .6s var(--easing-enter) both;
}
.nc-lb-trophy::after {
  content: ''; position: absolute; top: 0; left: 0; width: 45%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.7), transparent);
  animation: nc-shine 3.5s ease-in-out infinite;
}
.nc-lb-title {
  font-size: clamp(1.8rem, 4vw, 2.6rem); font-weight: 800;
  background: linear-gradient(90deg, var(--nc-primary), var(--nc-accent));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.nc-lb-row {
  opacity: 0; transform: translateY(20px);
  animation: nc-rise-in .5s var(--easing-enter) forwards;
  animation-delay: calc(var(--i, 0) * 60ms);
  transition: transform .2s var(--easing-default), box-shadow .2s var(--easing-default);
}
.nc-lb-row:hover { transform: translateY(-3px); box-shadow: var(--nc-shadow-lg); }
.nc-lb-row--top1 { background: linear-gradient(100deg, #fffbeb, #fff7ed); border-color: #fde68a !important; }
.nc-lb-row--top2 { background: linear-gradient(100deg, #f8fafc, #f1f5f9); border-color: #e2e8f0 !important; }
.nc-lb-row--top3 { background: linear-gradient(100deg, #fff7ed, #ffedd5); border-color: #fed7aa !important; }
.nc-lb-medal { position: relative; overflow: hidden; }
.nc-lb-medal::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(120deg, transparent 30%, rgba(255,255,255,.65) 50%, transparent 70%);
  transform: translateX(-120%) skewX(-20deg); animation: nc-shine 3s ease-in-out infinite;
}
.nc-lb-count { display: inline-block; }
.nc-lb-count.is-animating { animation: nc-count-pop .4s var(--easing-default); }
[data-theme="dark"] .nc-lb-row--top1 { background: linear-gradient(100deg, #3a2f12, #2a2410); border-color: #5c4a16 !important; }
[data-theme="dark"] .nc-lb-row--top2 { background: linear-gradient(100deg, #1e2433, #172033); border-color: #2d3a52 !important; }
[data-theme="dark"] .nc-lb-row--top3 { background: linear-gradient(100deg, #33240f, #2a1c0a); border-color: #5c3d16 !important; }
[data-theme="dark"] .nc-lb-trophy { box-shadow: 0 10px 24px rgba(245,158,11,.25); }

/* ---- 排行榜 v1（服务端表格） ---- */
.nc-lb-table-wrap { border-radius: var(--nc-radius); overflow: hidden; box-shadow: var(--nc-shadow-sm); }
.nc-lb-table tbody tr { animation: nc-rise-in .5s var(--easing-enter) both; animation-delay: calc(var(--i, 0) * 50ms); }
.nc-lb-table tbody tr:hover { background: rgba(var(--color-primary-rgb), .06); }

/* ============================================================
   P4-unify: 通用错落 / 悬浮（全站统一动画语言）
   复用 P4-anim 的 nc-rise-in 入场 + 排行榜同款 hover 提升
   用于章节侧边栏与个人中心等任意卡片 / 列表项
   ============================================================ */
/* 单块入场（无需错落时，例如标题、区块头） */
.nc-enter {
  animation: nc-rise-in .6s var(--easing-enter) both;
}
/* 错落入场 + hover 悬浮提升（设置 --i 控制顺序延迟） */
.nc-stagger-row {
  opacity: 0;
  transform: translateY(18px);
  animation: nc-rise-in .5s var(--easing-enter) both;
  animation-delay: calc(var(--i, 0) * 55ms);
  transition: transform .2s var(--easing-default),
              box-shadow .2s var(--easing-default),
              background-color .2s var(--easing-default),
              border-color .2s var(--easing-default);
}
.nc-stagger-row:hover {
  transform: translateY(-3px);
  box-shadow: var(--nc-shadow-lg);
}
/* 暗色主题下 hover 提升的阴影已由 --nc-shadow-lg 适配，无需额外覆盖 */
@media (prefers-reduced-motion: reduce) {
  .nc-stagger-row,
  .nc-enter {
    opacity: 1 !important;
    transform: none !important;
    animation: none !important;
  }
}

