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

svg {
  max-width: 24px;
  max-height: 24px;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.nav-logo svg {
  width: 20px !important;
  height: 20px !important;
}

/* 基础变量 - CSS紫蓝渐变主题 */
:root {
  --primary: #8B5CF6;
  --primary-dark: #7C3AED;
  --primary-light: #EDE9FE;
  --code-bg: #1E1B4B;
  --code-border: #312E81;
  --code-text: #E0E7FF;
  --gray-50: #FAFAFA;
  --gray-100: #F3F4F6;
  --gray-200: #E5E7EB;
  --gray-300: #D1D5DB;
  --gray-400: #9CA3AF;
  --gray-500: #6B7280;
  --gray-600: #4B5563;
  --gray-700: #374151;
  --gray-800: #1F2937;
  --gray-900: #111827;
  --success: #10B981;
  --error: #EF4444;
  --radius: 12px;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background-color: var(--gray-50);
  color: var(--gray-800);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

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

/* 导航 */
.nav {
  padding: 20px 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--gray-100);
  margin-bottom: 48px;
}

.nav-logo {
  font-size: 18px;
  font-weight: 700;
  color: var(--gray-900);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-logo .emoji {
  font-size: 20px !important;
  width: 20px !important;
  height: 20px !important;
}

.nav-links {
  display: flex;
  gap: 24px;
  list-style: none;
}

.nav-link {
  text-decoration: none;
  color: var(--gray-600);
  font-weight: 500;
  transition: var(--transition);
  font-size: 14px;
}

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

/* Hero区 */
.hero {
  text-align: center;
  margin-bottom: 64px;
}

.hero-title {
  font-size: 48px;
  font-weight: 800;
  line-height: 1.1;
  margin-bottom: 20px;
  background: linear-gradient(135deg, #8B5CF6 0%, #EC4899 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-subtitle {
  font-size: 18px;
  color: var(--gray-600);
  max-width: 600px;
  margin: 0 auto 32px;
  line-height: 1.6;
}

.hero-cta {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
}

/* 按钮 */
.btn {
  padding: 10px 20px;
  border-radius: 10px;
  font-weight: 600;
  text-decoration: none;
  transition: var(--transition);
  border: none;
  cursor: pointer;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

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

.btn-primary:hover {
  background-color: var(--primary-dark);
  transform: translateY(-2px);
  box-shadow: 0 10px 20px -5px rgba(139, 92, 246, 0.3);
}

.btn-secondary {
  background-color: var(--gray-50);
  color: var(--gray-700);
  border: 1px solid var(--gray-200);
}

.btn-secondary:hover {
  background-color: var(--gray-100);
  border-color: var(--gray-300);
  transform: translateY(-2px);
}

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

/* 统计卡片 */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 20px;
  margin-bottom: 64px;
}

.stat-card {
  background-color: white;
  padding: 24px;
  border-radius: 16px;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.05), 0 1px 2px 0 rgba(0, 0, 0, 0.03);
  text-align: center;
  transition: var(--transition);
  border: 1px solid #F1F5F9;
}

.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.05), 0 10px 10px -5px rgba(0, 0, 0, 0.02);
}

.stat-value {
  font-size: 36px;
  font-weight: 800;
  background: linear-gradient(135deg, #8B5CF6 0%, #EC4899 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 8px;
}

.stat-label {
  color: var(--gray-600);
  font-size: 14px;
  font-weight: 500;
}

/* 卡片通用样式 */
.card {
  background-color: white;
  border-radius: 16px;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.05), 0 1px 2px 0 rgba(0, 0, 0, 0.03);
  padding: 32px;
  transition: var(--transition);
  border: 1px solid #F1F5F9;
}

.card:hover {
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.03);
  transform: translateY(-2px);
}

/* 闪卡样式 */
.flashcard {
  max-width: 600px;
  margin: 0 auto;
  perspective: 1500px;
  height: 380px;
  cursor: pointer;
}

.flashcard-inner {
  position: relative;
  width: 100%;
  height: 100%;
  text-align: center;
  transition: transform 0.7s cubic-bezier(0.4, 0, 0.2, 1);
  transform-style: preserve-3d;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  border-radius: 20px;
}

.flashcard.flipped .flashcard-inner {
  transform: rotateY(180deg);
}

.flashcard-front, .flashcard-back {
  position: absolute;
  width: 100%;
  height: 100%;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  border-radius: 20px;
  padding: 48px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.flashcard-front {
  background: linear-gradient(135deg, white 0%, #FAFAFA 100%);
  border: 1px solid #F1F5F9;
}

.flashcard-back {
  background: linear-gradient(135deg, #F5F3FF 0%, #EDE9FE 100%);
  transform: rotateY(180deg);
  border: 1px solid #C4B5FD;
}

/* 学习卡片 */
.learn-card {
  max-width: 800px;
  margin: 0 auto;
}

.learn-card-title {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 16px;
  color: var(--gray-900);
}

.learn-card-meta {
  color: var(--gray-500);
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--gray-100);
  font-size: 14px;
}

.learn-card-description {
  font-size: 16px;
  line-height: 1.8;
  color: var(--gray-700);
  margin-bottom: 32px;
}

.learn-card-examples {
  background-color: var(--gray-50);
  padding: 24px;
  border-radius: 14px;
  margin-bottom: 32px;
}

.learn-card-example {
  margin-bottom: 24px;
}

.learn-card-example:last-child {
  margin-bottom: 0;
}

.example-title {
  font-weight: 600;
  color: var(--gray-900);
  margin-bottom: 10px;
  font-size: 15px;
}

.example-code {
  background-color: var(--code-bg);
  color: var(--code-text);
  padding: 20px;
  border-radius: 12px;
  font-family: 'Fira Code', 'SFMono-Regular', 'Menlo', 'Monaco', 'Consolas', monospace;
  font-size: 13px;
  line-height: 1.7;
  overflow-x: auto;
  border: 1px solid var(--code-border);
  white-space: pre;
  word-wrap: normal;
}

.example-code::-webkit-scrollbar {
  height: 6px;
}

.example-code::-webkit-scrollbar-track {
  background: var(--code-border);
  border-radius: 3px;
}

.example-code::-webkit-scrollbar-thumb {
  background: #6366F1;
  border-radius: 3px;
}

.example-code::-webkit-scrollbar-thumb:hover {
  background: #818CF8;
}

.learn-navigation {
  display: flex;
  justify-content: space-between;
  margin-top: 40px;
  align-items: center;
}

/* 测试题样式 */
.quiz {
  background-color: var(--gray-50);
  padding: 24px;
  border-radius: 14px;
}

.quiz-question {
  font-size: 17px;
  font-weight: 600;
  margin-bottom: 20px;
  color: var(--gray-900);
}

.quiz-options {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 24px;
}

.quiz-option {
  padding: 14px 18px;
  background-color: white;
  border: 2px solid var(--gray-200);
  border-radius: 12px;
  cursor: pointer;
  transition: var(--transition);
  font-size: 15px;
}

.quiz-option:hover {
  border-color: var(--primary);
  background-color: var(--primary-light);
}

.quiz-option.selected {
  border-color: var(--primary);
  background-color: var(--primary-light);
}

.quiz-option.correct {
  border-color: var(--success);
  background-color: #D1FAE5;
  color: #065F46;
}

.quiz-option.incorrect {
  border-color: var(--error);
  background-color: #FEE2E2;
  color: #991B1B;
}

.quiz-feedback {
  padding: 16px;
  border-radius: 12px;
  font-weight: 600;
  margin-bottom: 24px;
  font-size: 14px;
}

.quiz-feedback.correct {
  background-color: #D1FAE5;
  color: #065F46;
}

.quiz-feedback.incorrect {
  background-color: #FEE2E2;
  color: #991B1B;
}

/* 索引网格 */
.roots-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
  margin-bottom: 40px;
}

.root-card {
  background-color: white;
  padding: 24px;
  border-radius: 16px;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.05), 0 1px 2px 0 rgba(0, 0, 0, 0.03);
  text-decoration: none;
  color: inherit;
  transition: var(--transition);
  border: 1px solid #F1F5F9;
  border-left: 4px solid var(--primary);
}

.root-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.05), 0 10px 10px -5px rgba(0, 0, 0, 0.02);
  border-left-color: var(--primary-dark);
}

/* 搜索框 */
.search-box {
  width: 100%;
  max-width: 600px;
  margin: 0 auto 40px;
}

.search-input {
  width: 100%;
  padding: 14px 18px;
  border: 2px solid var(--gray-200);
  border-radius: 12px;
  font-size: 15px;
  transition: var(--transition);
  background-color: white;
}

.search-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.1);
}

/* 分类筛选按钮 */
.filter-btn {
  font-size: 13px !important;
}

.filter-btn.bg-primary\/10 {
  background-color: var(--primary-light) !important;
  color: var(--primary) !important;
  border-color: var(--primary) !important;
}

/* 进度页面 */
.progress-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 20px;
  margin-bottom: 40px;
}

.progress-card {
  background-color: white;
  padding: 24px;
  border-radius: 16px;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.05), 0 1px 2px 0 rgba(0, 0, 0, 0.03);
  text-align: center;
  border: 1px solid #F1F5F9;
}

.progress-number {
  font-size: 36px;
  font-weight: 800;
  background: linear-gradient(135deg, #8B5CF6 0%, #EC4899 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 8px;
}

.progress-label {
  color: var(--gray-600);
  font-size: 14px;
  font-weight: 500;
}

.progress-list {
  background-color: white;
  padding: 32px;
  border-radius: 16px;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.05), 0 1px 2px 0 rgba(0, 0, 0, 0.03);
  border: 1px solid #F1F5F9;
}

.progress-list-title {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 24px;
  color: var(--gray-900);
}

/* 工具类 */
.text-center { text-align: center; }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }
.mb-8 { margin-bottom: 32px; }
.text-3xl { font-size: 30px; }
.font-bold { font-weight: 700; }
.text-gray-900 { color: var(--gray-900); }
.text-gray-600 { color: var(--gray-600); }
.text-gray-500 { color: var(--gray-500); }
.text-sm { font-size: 14px; }
.text-xs { font-size: 12px; }
.font-medium { font-weight: 500; }
.px-2 { padding-left: 8px; padding-right: 8px; }
.py-1 { padding-top: 4px; padding-bottom: 4px; }
.px-3 { padding-left: 12px; padding-right: 12px; }
.rounded-full { border-radius: 9999px; }
.bg-blue-100 { background-color: #DBEAFE; }
.text-blue-800 { color: #1E40AF; }
.bg-green-100 { background-color: #D1FAE5; }
.text-green-800 { color: #065F46; }
.bg-yellow-100 { background-color: #FEF3C7; }
.text-yellow-800 { color: #92400E; }
.bg-primary\/10 { background-color: var(--primary-light); }
.text-primary { color: var(--primary); }
.hover\:underline:hover { text-decoration: underline; }
.hover\:bg-gray-200:hover { background-color: var(--gray-200); }
.bg-gray-100 { background-color: var(--gray-100); }
.text-gray-700 { color: var(--gray-700); }
.bg-green-50 { background-color: #ECFDF5; }
.text-green-700 { color: #047857; }
.hover\:bg-green-100:hover { background-color: #D1FAE5; }
.inline-flex { display: inline-flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }
.justify-center { justify-content: center; }
.gap-4 { gap: 16px; }
.gap-2 { gap: 8px; }
.hidden { display: none; }
.mt-4 { margin-top: 16px; }
.mt-8 { margin-top: 32px; }
.flex { display: flex; }
.h-full { height: 100%; }
.rounded-full { border-radius: 9999px; }
.transition-all { transition: all 0.2s; }
.duration-500 { transition-duration: 500ms; }

/* 页脚 */
.footer {
  margin-top: 80px;
  padding: 40px 0;
  border-top: 1px solid var(--gray-100);
  text-align: center;
  color: var(--gray-500);
}

.footer-tagline {
  font-size: 20px;
  font-weight: 700;
  color: var(--gray-900);
  margin-bottom: 12px;
}

.footer-description {
  max-width: 600px;
  margin: 0 auto 24px;
  font-size: 15px;
  line-height: 1.7;
}

/* 响应式适配 */
@media (max-width: 768px) {
  .hero-title { font-size: 32px; }
  .hero-subtitle { font-size: 16px; }
  .nav-links { gap: 12px; font-size: 13px; }
  .nav { flex-direction: column; gap: 16px; padding-bottom: 16px; }
  .flashcard { height: 300px; }
  .flashcard-front, .flashcard-back { padding: 24px; }
  .roots-grid { grid-template-columns: 1fr; }
  .stats, .progress-stats { grid-template-columns: repeat(2, 1fr); }
  .card, .progress-list { padding: 24px; }
  .learn-card-title { font-size: 24px; }
}

@media (max-width: 480px) {
  .stats, .progress-stats { grid-template-columns: 1fr; }
  .hero-cta { flex-direction: column; align-items: center; gap: 12px; }
  .btn { width: 100%; max-width: 280px; justify-content: center; }
}
