/**
 * ═══════════════════════════════════════════════════════════════
 * 灵极乌托邦 Design System v4.0
 * 
 * 设计理念：
 * - 极简科技风（参考 Higgsfield）
 * - 品牌色来自 Logo：紫粉 → 青蓝 渐变
 * - 操作色：紫色 → 紫粉渐变；红色仅由站点触碰高光层使用
 * - 轻量优先：CSS 渐变 > 图片
 * ═══════════════════════════════════════════════════════════════
 */

:root {
  /* ════════════════════════════════════════════════════════════
     1. 背景层次
     ════════════════════════════════════════════════════════════ */
  --bg-void: #fbfaf8;              /* 米白页面底色 */
  --bg-surface: #ffffff;           /* 卡片/面板 */
  --bg-elevated: #ffffff;          /* 悬浮层/弹窗 */
  --bg-hover: #f5f1ff;             /* 悬停背景 */
  
  /* ════════════════════════════════════════════════════════════
     2. 品牌色（紫粉系）
     ════════════════════════════════════════════════════════════ */
  --brand-primary: #6f52ff;        /* 品牌紫 */
  --brand-dim: #5b43c7;            /* 深紫 */
  --brand-dark: #3a2b74;           /* 紫色深层 */
  
  /* 品牌渐变（紫粉系） */
  --gradient-brand: linear-gradient(135deg, #6f52ff 0%, #d846a0 100%);
  --gradient-brand-horizontal: linear-gradient(90deg, #6f52ff 0%, #d846a0 100%);
  --gradient-subtle: linear-gradient(135deg, rgba(111,82,255,0.08) 0%, rgba(216,70,160,0.08) 100%);
  
  /* ════════════════════════════════════════════════════════════
     3. 高亮/选中色（品牌紫）
     ════════════════════════════════════════════════════════════ */
  --accent-primary: #6f52ff;
  --accent-primary-dim: #5b43c7;
  --accent-primary-glow: rgba(111, 82, 255, 0.16);
  
  /* ════════════════════════════════════════════════════════════
     4. 功能色
     ════════════════════════════════════════════════════════════ */
  --color-success: #22c55e;        /* 成功/在线 */
  --color-warning: #f97316;        /* 警告 */
  --color-error: #ef4444;          /* 错误/HOT */
  --color-info: var(--accent-primary); /* 信息 */
  
  /* ════════════════════════════════════════════════════════════
     5. 文字
     ════════════════════════════════════════════════════════════ */
  --text-primary: #17131f;         /* 主文字 */
  --text-secondary: #625a70;       /* 次要 */
  --text-muted: #918a9c;           /* 弱化 */
  --text-inverse: #ffffff;         /* 反色（在品牌背景上） */
  
  /* ════════════════════════════════════════════════════════════
     6. 边框
     ════════════════════════════════════════════════════════════ */
  --border-subtle: rgba(70,58,93,0.10);
  --border-default: rgba(70,58,93,0.16);
  --border-hover: rgba(111,82,255,0.34);
  --border-brand: rgba(111,82,255,0.40);
  --border-accent: rgba(111,82,255,0.40);
  
  /* ════════════════════════════════════════════════════════════
     7. 圆角
     ════════════════════════════════════════════════════════════ */
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;
  
  /* ════════════════════════════════════════════════════════════
     8. 过渡
     ════════════════════════════════════════════════════════════ */
  --transition-fast: 0.15s ease;
  --transition-base: 0.25s ease;
  --transition-slow: 0.4s ease;
  
  /* ════════════════════════════════════════════════════════════
     9. 阴影（轻量）
     ════════════════════════════════════════════════════════════ */
  --shadow-sm: 0 2px 8px rgba(40,32,64,0.08);
  --shadow-md: 0 4px 16px rgba(40,32,64,0.11);
  --shadow-lg: 0 8px 32px rgba(40,32,64,0.14);
  --shadow-glow-brand: 0 0 20px rgba(111,82,255,0.20);
  --shadow-glow-accent: 0 0 20px var(--accent-primary-glow);
  
  /* ════════════════════════════════════════════════════════════
     10. 字体
     ════════════════════════════════════════════════════════════ */
  --font-sans: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', 'Segoe UI', sans-serif;
  --font-mono: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  
  /* 字号 */
  --text-xs: 11px;
  --text-sm: 13px;
  --text-base: 15px;
  --text-lg: 18px;
  --text-xl: 22px;
  --text-2xl: 28px;
  --text-3xl: 36px;
  --text-4xl: 48px;
  --text-5xl: 64px;
}

/* ════════════════════════════════════════════════════════════════
   全局重置
   ════════════════════════════════════════════════════════════════ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: 1.6;
  color: var(--text-primary);
  background-color: var(--bg-void);
}

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

img, video {
  max-width: 100%;
  height: auto;
  display: block;
}

button {
  font-family: inherit;
  cursor: pointer;
}

/* ════════════════════════════════════════════════════════════════
   通用组件
   ════════════════════════════════════════════════════════════════ */

/* --- 容器 --- */
.container {
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 24px;
}

@media (min-width: 768px) {
  .container { padding: 0 40px; }
}

/* --- 卡片 --- */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: var(--transition-base);
}

.card:hover {
  border-color: var(--border-hover);
  transform: translateY(-2px);
}

.card-interactive:hover {
  border-color: var(--border-brand);
  box-shadow: var(--shadow-glow-brand);
}

/* --- 按钮 --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  font-size: var(--text-sm);
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: none;
  transition: var(--transition-base);
  white-space: nowrap;
}

/* 品牌渐变按钮 */
.btn-brand {
  background: var(--gradient-brand);
  color: #fff;
}

.btn-brand:hover {
  opacity: 0.9;
  transform: translateY(-1px);
  box-shadow: var(--shadow-glow-brand);
}

/* 高亮按钮（品牌紫） */
.btn-accent {
  background: var(--accent-primary);
  color: var(--text-inverse);
}

.btn-accent:hover {
  background: var(--accent-primary-dim);
  box-shadow: var(--shadow-glow-accent);
}

/* 轮廓按钮 */
.btn-outline {
  background: transparent;
  border: 1px solid var(--border-default);
  color: var(--text-primary);
}

.btn-outline:hover {
  border-color: var(--text-primary);
  background: rgba(255,255,255,0.05);
}

/* 幽灵按钮 */
.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}

.btn-ghost:hover {
  color: var(--text-primary);
  background: rgba(255,255,255,0.05);
}

/* --- 标签 --- */
.tag {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  font-size: var(--text-xs);
  font-weight: 700;
  border-radius: var(--radius-xs);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.tag-accent {
  background: var(--accent-primary);
  color: var(--text-inverse);
}

.tag-brand {
  background: var(--accent-primary);
  color: #fff;
}

.tag-hot {
  background: var(--color-error);
  color: #fff;
}

.tag-new {
  background: var(--brand-primary);
  color: var(--text-inverse);
}

.tag-outline {
  background: transparent;
  border: 1px solid var(--border-default);
  color: var(--text-secondary);
}

/* --- 导航链接 --- */
.nav-link {
  padding: 8px 16px;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  transition: var(--transition-fast);
}

.nav-link:hover {
  color: var(--text-primary);
  background: rgba(111,82,255,0.06);
}

.nav-link.active {
  color: var(--accent-primary);
  background: rgba(111,82,255,0.10);
}

/* --- 标签页/Tab --- */
.tab {
  padding: 8px 16px;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-muted);
  background: transparent;
  border: none;
  border-radius: var(--radius-xs);
  transition: var(--transition-fast);
  cursor: pointer;
}

.tab:hover {
  color: var(--text-secondary);
}

.tab.active {
  color: var(--accent-primary);
  background: rgba(111,82,255,0.10);
}

/* --- 输入框 --- */
.input {
  width: 100%;
  padding: 12px 16px;
  font-size: var(--text-base);
  color: var(--text-primary);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  outline: none;
  transition: var(--transition-base);
}

.input::placeholder {
  color: var(--text-muted);
}

.input:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 2px rgba(111,82,255,0.16);
}

/* --- 分割线 --- */
.divider {
  height: 1px;
  background: var(--border-subtle);
  margin: 24px 0;
}

/* --- 标题样式 --- */
.section-title {
  font-size: var(--text-2xl);
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.section-subtitle {
  font-size: var(--text-base);
  color: var(--text-secondary);
}

/* 渐变标题 */
.gradient-text {
  background: var(--gradient-brand);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* 高亮标题（品牌紫） */
.highlight-text {
  color: var(--accent-primary);
}

/* ════════════════════════════════════════════════════════════════
   响应式断点
   ════════════════════════════════════════════════════════════════ */

/* 移动端优先 */
@media (max-width: 768px) {
  :root {
    --text-4xl: 36px;
    --text-5xl: 48px;
  }
  
  .container {
    padding: 0 16px;
  }
  
  .btn {
    min-height: 44px;
    font-size: var(--text-base);
  }
}

/* ════════════════════════════════════════════════════════════════
   实用类
   ════════════════════════════════════════════════════════════════ */

/* 文字对齐 */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

/* 弹性布局 */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.gap-6 { gap: 24px; }

/* 网格布局 */
.grid { display: grid; }
.grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid-cols-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 1024px) {
  .md\:grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .sm\:grid-cols-1 { grid-template-columns: 1fr; }
}

/* 间距 */
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mt-8 { margin-top: 32px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.p-4 { padding: 16px; }
.p-6 { padding: 24px; }

/* 隐藏 */
.hidden { display: none; }

@media (max-width: 768px) {
  .sm\:hidden { display: none; }
}

@media (min-width: 769px) {
  .md\:hidden { display: none; }
}

/* ════════════════════════════════════════════════════════════════
   iOS / 移动端 GPU 性能优化
   
   问题：backdrop-filter: blur() 在 iOS Safari 上是 GPU 密集型操作，
   导致滚动卡顿和页面切换延迟。background-attachment: fixed 在 iOS 上
   每帧重绘整个背景层，严重影响滚动流畅度。
   
   策略：移动端降级 blur 值或移除，桌面端完全不受影响。
   ════════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  /* 修复 iOS Safari 的 background-attachment: fixed 性能问题 */
  body {
    background-attachment: scroll !important;
  }

  /* 导航栏：blur(20px) → blur(4px)，视觉差异极小但 GPU 负担大幅降低 */
  .navbar,
  .top-bar {
    backdrop-filter: blur(4px) !important;
    -webkit-backdrop-filter: blur(4px) !important;
  }

  /* 弹窗/遮罩层：保留轻微模糊即可 */
  .wechat-backdrop,
  .modal-backdrop {
    backdrop-filter: blur(2px) !important;
    -webkit-backdrop-filter: blur(2px) !important;
  }

  /* 卡片/面板/侧边栏：移除 blur，用半透明背景替代，GPU 零负担 */
  .card,
  .panel,
  .sidebar,
  .filter-bar,
  .filter-wrap,
  .filter-section,
  .tab-bar,
  .bottom-bar,
  .course-body,
  .syllabus,
  .left-col,
  .right-col,
  [class*="card-"],
  [class*="-panel"],
  [class*="-modal"] {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }

  /* 全局：所有 backdrop-filter 降级（兜底规则） */
  * {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }

  /* 但导航栏保留轻微 blur（覆盖上面的 * 规则） */
  .navbar,
  .top-bar,
  nav {
    backdrop-filter: blur(4px) !important;
    -webkit-backdrop-filter: blur(4px) !important;
  }
}

/* ════════════════════════════════════════════════════════════════
   will-change 优化：提示浏览器提前创建合成层
   只用于真正需要动画的元素，避免滥用
   ════════════════════════════════════════════════════════════════ */
.navbar,
.top-bar {
  will-change: transform;
}

/* ════════════════════════════════════════════════════════════════
   骨架屏通用样式（全站复用）
   ════════════════════════════════════════════════════════════════ */
@keyframes skeleton-pulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 0.8; }
}

.skeleton {
  background: rgba(111,82,255,0.08);
  border-radius: 6px;
  animation: skeleton-pulse 1.4s ease-in-out infinite;
}

.skeleton-line { height: 14px; margin-bottom: 8px; }
.skeleton-title { height: 28px; width: 60%; margin-bottom: 12px; }
.skeleton-card { height: 200px; border-radius: 12px; }

/* ════════════════════════════════════════════════════════════════
   按钮尺寸变体
   ════════════════════════════════════════════════════════════════ */
.btn-sm {
  padding: 6px 14px;
  font-size: var(--text-xs, 12px);
  min-height: 32px;
  border-radius: var(--radius-sm, 6px);
}
.btn-lg {
  padding: 14px 28px;
  font-size: var(--text-lg, 18px);
  min-height: 52px;
  border-radius: var(--radius-md, 10px);
}

/* ════════════════════════════════════════════════════════════════
   Lucide 图标全局样式
   ════════════════════════════════════════════════════════════════ */
[data-lucide] {
  display: inline-block;
  vertical-align: middle;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
/* 图标尺寸预设 */
.icon-xs { width: 14px; height: 14px; }
.icon-sm { width: 16px; height: 16px; }
.icon-md { width: 20px; height: 20px; }
.icon-lg { width: 24px; height: 24px; }
.icon-xl { width: 32px; height: 32px; }
/* CTA图标高亮 */
.icon-brand {
  stroke: var(--brand-primary, #6f52ff);
  filter: drop-shadow(0 0 6px rgba(111,82,255,0.28));
}

/* ════════════════════════════════════════════════════════════════
   入场动画
   ════════════════════════════════════════════════════════════════ */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
.animate-fade-in-up {
  animation: fadeInUp 0.6s ease-out forwards;
}
.animate-fade-in {
  animation: fadeIn 0.5s ease-out forwards;
}
/* 延迟类 */
.delay-100 { animation-delay: 0.1s; }
.delay-200 { animation-delay: 0.2s; }
.delay-300 { animation-delay: 0.3s; }
.delay-400 { animation-delay: 0.4s; }
.delay-500 { animation-delay: 0.5s; }

/* ════════════════════════════════════════════════════════════════
   Safe Area 工具类（全面屏适配）
   ════════════════════════════════════════════════════════════════ */
.safe-bottom {
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.safe-top {
  padding-top: env(safe-area-inset-top, 0px);
}
.safe-all {
  padding-top: env(safe-area-inset-top, 0px);
  padding-right: env(safe-area-inset-right, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  padding-left: env(safe-area-inset-left, 0px);
}

/* ════════════════════════════════════════════════════════════════
   按钮物理反馈
   ════════════════════════════════════════════════════════════════ */
.btn:hover {
  transform: translateY(-1px);
  transition: all 0.22s ease;
}
.btn:active {
  transform: translateY(0) scale(0.98);
  transition: all 0.1s ease;
}
