/* ============================================
   EnglishLab - 英语学习网站样式表
   参考TEco Lab设计理念
   ============================================ */

/* CSS Variables */
:root {
  --primary: #6C5CE7;
  --primary-light: #A29BFE;
  --primary-dark: #5A4BD1;
  --accent: #00CEC9;
  --accent-light: #81ECEC;
  --warning: #FDCB6E;
  --danger: #FF7675;
  --success: #00B894;
  --bg-dark: #0F0F1A;
  --bg-card: #1A1A2E;
  --bg-card-hover: #222240;
  --bg-input: #16162B;
  --text-primary: #F5F5F7;
  --text-secondary: #B2B2CC;
  --text-muted: #6C6C8A;
  --border: #2A2A45;
  --shadow: 0 4px 24px rgba(0,0,0,0.3);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --font-main: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-display: 'Space Grotesk', var(--font-main);
}

/* Reset & Base */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: var(--font-main);
  background: var(--bg-dark);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

a {
  color: var(--primary-light);
  text-decoration: none;
  transition: var(--transition);
}

a:hover {
  color: var(--accent);
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 6px;
}
::-webkit-scrollbar-track {
  background: var(--bg-dark);
}
::-webkit-scrollbar-thumb {
  background: var(--primary);
  border-radius: 3px;
}

/* ============================================
   Navigation
   ============================================ */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: rgba(15, 15, 26, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  padding: 0 2rem;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: var(--transition);
}

.navbar.scrolled {
  background: rgba(15, 15, 26, 0.95);
  box-shadow: 0 2px 20px rgba(0,0,0,0.3);
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-primary);
  cursor: pointer;
}

.nav-brand .logo-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 8px;
  list-style: none;
}

.nav-links a {
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 6px;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--text-primary);
  background: rgba(108, 92, 231, 0.15);
}

.nav-links a.active {
  color: var(--primary-light);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: var(--transition);
  font-family: var(--font-main);
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  box-shadow: 0 4px 15px rgba(108, 92, 231, 0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 25px rgba(108, 92, 231, 0.4);
}

.btn-outline {
  background: transparent;
  color: var(--primary-light);
  border: 1.5px solid var(--primary);
}

.btn-outline:hover {
  background: rgba(108, 92, 231, 0.1);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  padding: 8px 12px;
}

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

.btn-accent {
  background: linear-gradient(135deg, var(--accent), #00B894);
  color: white;
  box-shadow: 0 4px 15px rgba(0, 206, 201, 0.3);
}

.btn-accent:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 25px rgba(0, 206, 201, 0.4);
}

.btn-sm {
  padding: 6px 14px;
  font-size: 0.8rem;
}

.btn-lg {
  padding: 14px 28px;
  font-size: 1rem;
}

.btn-icon {
  width: 40px;
  height: 40px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

/* Mobile nav toggle */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 4px;
}

/* ============================================
   Page Sections
   ============================================ */
.page-section {
  display: none;
  padding-top: 64px;
  min-height: 100vh;
}

.page-section.active {
  display: block;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem;
}

/* ============================================
   Hero Section (Home)
   ============================================ */
.hero {
  position: relative;
  padding: 6rem 0 4rem;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -30%;
  width: 80%;
  height: 150%;
  background: radial-gradient(ellipse, rgba(108, 92, 231, 0.12) 0%, transparent 70%);
  pointer-events: none;
}

.hero::after {
  content: '';
  position: absolute;
  top: -20%;
  right: -20%;
  width: 60%;
  height: 120%;
  background: radial-gradient(ellipse, rgba(0, 206, 201, 0.08) 0%, transparent 70%);
  pointer-events: none;
}

.hero-content {
  position: relative;
  text-align: center;
  max-width: 720px;
  margin: 0 auto;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  background: rgba(108, 92, 231, 0.15);
  border: 1px solid rgba(108, 92, 231, 0.3);
  border-radius: 50px;
  font-size: 0.85rem;
  color: var(--primary-light);
  margin-bottom: 1.5rem;
}

.hero h1 {
  font-family: var(--font-display);
  font-size: 3.5rem;
  font-weight: 800;
  line-height: 1.15;
  margin-bottom: 1.2rem;
  background: linear-gradient(135deg, var(--text-primary), var(--primary-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero p {
  font-size: 1.15rem;
  color: var(--text-secondary);
  margin-bottom: 2rem;
  line-height: 1.7;
}

.hero-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.hero-stats {
  display: flex;
  justify-content: center;
  gap: 3rem;
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}

.hero-stat {
  text-align: center;
}

.hero-stat .number {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary-light);
}

.hero-stat .label {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ============================================
   Features Grid (Home)
   ============================================ */
.features-section {
  padding: 4rem 0;
}

.section-header {
  text-align: center;
  margin-bottom: 3rem;
}

.section-header h2 {
  font-family: var(--font-display);
  font-size: 2.2rem;
  font-weight: 700;
  margin-bottom: 0.8rem;
}

.section-header p {
  color: var(--text-secondary);
  font-size: 1.05rem;
  max-width: 500px;
  margin: 0 auto;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
}

.feature-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  transition: var(--transition);
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.feature-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  opacity: 0;
  transition: var(--transition);
}

.feature-card:hover {
  transform: translateY(-4px);
  border-color: var(--primary);
  box-shadow: 0 8px 30px rgba(108, 92, 231, 0.15);
}

.feature-card:hover::before {
  opacity: 1;
}

.feature-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  margin-bottom: 1rem;
}

.feature-icon.purple {
  background: rgba(108, 92, 231, 0.15);
}

.feature-icon.teal {
  background: rgba(0, 206, 201, 0.15);
}

.feature-icon.yellow {
  background: rgba(253, 203, 110, 0.15);
}

.feature-icon.red {
  background: rgba(255, 118, 117, 0.15);
}

.feature-card h3 {
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.feature-card p {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* ============================================
   Featured Corpus (Home)
   ============================================ */
.featured-section {
  padding: 4rem 0;
}

.featured-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.corpus-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: var(--transition);
  cursor: pointer;
}

.corpus-card:hover {
  transform: translateY(-3px);
  border-color: rgba(108, 92, 231, 0.5);
  box-shadow: 0 8px 30px rgba(0,0,0,0.2);
}

.corpus-thumb {
  position: relative;
  height: 160px;
  background: linear-gradient(135deg, #1a1a3e, #2d2d5e);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

/* 图片thumbnail样式 */
.corpus-thumb img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.corpus-card:hover .corpus-thumb img {
  transform: scale(1.05);
}

/* 图片上方渐变遮罩 */
.corpus-thumb .thumb-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    to bottom,
    rgba(15, 15, 26, 0.1) 0%,
    rgba(15, 15, 26, 0.4) 60%,
    rgba(26, 26, 46, 0.9) 100%
  );
  z-index: 1;
  pointer-events: none;
}

.corpus-thumb::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 40px;
  background: linear-gradient(transparent, var(--bg-card));
  pointer-events: none;
  z-index: 1;
}

.corpus-thumb .play-overlay {
  width: 48px;
  height: 48px;
  background: rgba(108, 92, 231, 0.9);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  color: white;
  transition: var(--transition);
  z-index: 2;
}

.corpus-card:hover .play-overlay {
  transform: scale(1.1);
  background: var(--primary);
}

.corpus-thumb .duration {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: rgba(0,0,0,0.7);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  color: white;
  z-index: 2;
}

.corpus-thumb .difficulty-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  padding: 3px 10px;
  border-radius: 50px;
  font-size: 0.75rem;
  font-weight: 600;
  z-index: 2;
}

.difficulty-1 { background: #00B894; color: white; }
.difficulty-2 { background: #00CEC9; color: white; }
.difficulty-3 { background: #FDCB6E; color: #333; }
.difficulty-4 { background: #E17055; color: white; }
.difficulty-5 { background: #FF7675; color: white; }

.corpus-info {
  padding: 1rem 1.2rem;
}

.corpus-info h4 {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 6px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.corpus-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.corpus-meta span {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ============================================
   Corpus Library Page
   ============================================ */
.library-page {
  padding: 2rem 0;
}

.library-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.library-header h2 {
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 700;
}

.filter-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.search-box {
  position: relative;
  flex: 1;
  min-width: 200px;
  max-width: 400px;
}

.search-box input {
  width: 100%;
  padding: 10px 16px 10px 42px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.9rem;
  font-family: var(--font-main);
  transition: var(--transition);
}

.search-box input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.15);
}

.search-box .search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 0.9rem;
}

.filter-chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.chip {
  padding: 6px 14px;
  border-radius: 50px;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  transition: var(--transition);
}

.chip:hover {
  border-color: var(--primary);
  color: var(--primary-light);
}

.chip.active {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

/* ============================================
   Player / Study Page
   ============================================ */
.study-page {
  padding: 2rem 0;
}

.study-layout {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 24px;
}

.player-container {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.video-area {
  position: relative;
  aspect-ratio: 16/9;
  background: linear-gradient(135deg, #0a0a1a 0%, #1a1a3e 50%, #0d0d2b 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.video-area::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(ellipse at center, rgba(108, 92, 231, 0.08) 0%, transparent 60%);
  animation: videoBgFloat 8s ease-in-out infinite;
}

@keyframes videoBgFloat {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(3%, -3%); }
}

.video-area video,
.video-area iframe {
  width: 100%;
  height: 100%;
}

.video-placeholder {
  text-align: center;
  color: var(--text-muted);
}

.video-placeholder .big-play {
  width: 72px;
  height: 72px;
  background: var(--primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  color: white;
  margin: 0 auto 1rem;
  cursor: pointer;
  transition: var(--transition);
}

.video-placeholder .big-play:hover {
  transform: scale(1.1);
  background: var(--primary-dark);
}

/* 视频区域背景图遮罩 */
.video-bg-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    to bottom,
    rgba(15, 15, 26, 0.3) 0%,
    rgba(15, 15, 26, 0.5) 50%,
    rgba(15, 15, 26, 0.85) 100%
  );
  z-index: 1;
  pointer-events: none;
}

.video-area[style*="background-image"] .video-placeholder {
  position: relative;
  z-index: 2;
}

.video-area[style*="background-image"] .video-placeholder p {
  text-shadow: 0 2px 8px rgba(0,0,0,0.8);
}

/* Player Controls */
.player-controls {
  padding: 1rem 1.2rem;
  display: flex;
  align-items: center;
  gap: 12px;
  border-top: 1px solid var(--border);
}

.player-controls .progress-bar {
  flex: 1;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  cursor: pointer;
  position: relative;
}

.player-controls .progress-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 2px;
  width: 0%;
  transition: width 0.1s linear;
}

.player-time {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  min-width: 40px;
}

.control-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 1.1rem;
  padding: 4px;
  transition: var(--transition);
}

.control-btn:hover {
  color: var(--primary-light);
}

.control-btn.active {
  color: var(--primary);
}

/* Subtitle Area */
.subtitle-area {
  padding: 1.2rem;
  border-top: 1px solid var(--border);
  min-height: 120px;
}

.subtitle-line {
  padding: 8px 12px;
  margin-bottom: 4px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  font-size: 0.95rem;
  line-height: 1.5;
}

.subtitle-line:hover {
  background: rgba(108, 92, 231, 0.08);
}

.subtitle-line.active {
  background: rgba(108, 92, 231, 0.15);
  border-left: 3px solid var(--primary);
  color: var(--primary-light);
}

.subtitle-line .en-text {
  display: block;
  margin-bottom: 2px;
}

.subtitle-line .cn-text {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Sidebar Panel */
.sidebar-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.panel-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.2rem;
}

.panel-card h3 {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.word-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}

.word-item:last-child {
  border-bottom: none;
}

.word-main {
  flex: 1;
}

.word-main .word {
  font-weight: 600;
  font-size: 0.95rem;
}

.word-main .phonetic {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.word-main .meaning {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

.word-actions {
  display: flex;
  gap: 6px;
}

.word-action-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.9rem;
  padding: 4px;
  transition: var(--transition);
}

.word-action-btn:hover {
  color: var(--primary-light);
}

.word-action-btn.saved {
  color: var(--warning);
}

/* ============================================
   Shadow Reading Page
   ============================================ */
.shadow-page {
  padding: 2rem 0;
}

.shadow-layout {
  max-width: 800px;
  margin: 0 auto;
}

.shadow-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  margin-bottom: 1.5rem;
}

.shadow-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.shadow-header h3 {
  font-size: 1.2rem;
  font-weight: 600;
}

.shadow-audio {
  margin-bottom: 1.5rem;
}

.shadow-audio audio {
  width: 100%;
  border-radius: var(--radius-sm);
}

.shadow-script {
  margin-bottom: 1.5rem;
}

.script-line {
  padding: 10px 14px;
  margin-bottom: 6px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  border-left: 3px solid transparent;
}

.script-line:hover {
  background: rgba(108, 92, 231, 0.06);
}

.script-line.active {
  background: rgba(108, 92, 231, 0.12);
  border-left-color: var(--primary);
}

.script-line .en {
  font-size: 1rem;
  line-height: 1.5;
}

.script-line .cn {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Recording Area */
.recording-area {
  text-align: center;
  padding: 2rem 0;
}

.record-btn {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  border: 3px solid var(--primary);
  background: rgba(108, 92, 231, 0.1);
  color: var(--primary-light);
  font-size: 1.8rem;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1rem;
}

.record-btn:hover {
  background: rgba(108, 92, 231, 0.2);
  transform: scale(1.05);
}

.record-btn.recording {
  border-color: var(--danger);
  background: rgba(255, 118, 117, 0.15);
  color: var(--danger);
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 118, 117, 0.4); }
  50% { box-shadow: 0 0 0 15px rgba(255, 118, 117, 0); }
}

.record-status {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-top: 0.5rem;
}

/* Score Display */
.score-display {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2rem;
  margin-top: 1.5rem;
  padding: 1.5rem;
  background: var(--bg-input);
  border-radius: var(--radius);
}

.score-item {
  text-align: center;
}

.score-item .score-value {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
}

.score-item .score-value.excellent { color: var(--success); }
.score-item .score-value.good { color: var(--primary-light); }
.score-item .score-value.fair { color: var(--warning); }
.score-item .score-value.poor { color: var(--danger); }

.score-item .score-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ============================================
   Vocabulary Page
   ============================================ */
.vocab-page {
  padding: 2rem 0;
}

.vocab-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 24px;
}

.vocab-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.vocab-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.vocab-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.2rem;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: var(--transition);
}

.vocab-item:hover {
  border-color: var(--primary);
}

.vocab-item .word-cell {
  flex: 1;
}

.vocab-item .word-cell .word {
  font-weight: 600;
  font-size: 1.05rem;
}

.vocab-item .word-cell .phonetic {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.vocab-item .meaning-cell {
  flex: 1.5;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.vocab-item .source-cell {
  font-size: 0.8rem;
  color: var(--text-muted);
  min-width: 120px;
}

.vocab-item .actions-cell {
  display: flex;
  gap: 8px;
}

/* Stats Sidebar */
.stats-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1rem;
}

.stats-card h3 {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.stat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}

.stat-row:last-child {
  border-bottom: none;
}

.stat-row .stat-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.stat-row .stat-value {
  font-weight: 600;
  font-size: 0.95rem;
}

/* Progress Ring */
.progress-ring-container {
  text-align: center;
  padding: 1rem 0;
}

.progress-ring {
  position: relative;
  width: 120px;
  height: 120px;
  margin: 0 auto;
}

.progress-ring svg {
  transform: rotate(-90deg);
}

.progress-ring .bg {
  fill: none;
  stroke: var(--border);
  stroke-width: 8;
}

.progress-ring .fg {
  fill: none;
  stroke: var(--primary);
  stroke-width: 8;
  stroke-linecap: round;
  transition: stroke-dashoffset 1s ease;
}

.progress-ring .center-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
}

.progress-ring .center-text .pct {
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--primary-light);
}

.progress-ring .center-text .pct-label {
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* ============================================
   Progress Page
   ============================================ */
.progress-page {
  padding: 2rem 0;
}

.progress-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-bottom: 2rem;
}

.progress-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
}

.progress-card .card-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  margin-bottom: 1rem;
}

.progress-card .card-value {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
}

.progress-card .card-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Streak Calendar */
.streak-calendar {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.streak-calendar h3 {
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.calendar-day {
  aspect-ratio: 1;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  color: var(--text-muted);
  transition: var(--transition);
}

.calendar-day.active {
  background: var(--primary);
  color: white;
}

.calendar-day.today {
  border: 2px solid var(--accent);
}

.calendar-day.empty {
  background: transparent;
}

/* Chart Placeholder */
.chart-area {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.chart-area h3 {
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

.bar-chart {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  height: 160px;
  padding-top: 1rem;
}

.bar-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.bar {
  width: 100%;
  max-width: 40px;
  border-radius: 4px 4px 0 0;
  transition: height 0.5s ease;
}

.bar-label {
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* ============================================
   Modal
   ============================================ */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.modal-overlay.active {
  display: flex;
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  max-width: 500px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.2rem 1.5rem;
  border-bottom: 1px solid var(--border);
}

.modal-header h3 {
  font-size: 1.1rem;
  font-weight: 600;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.3rem;
  cursor: pointer;
  padding: 4px;
}

.modal-body {
  padding: 1.5rem;
}

.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* ============================================
   Toast Notification
   ============================================ */
.toast-container {
  position: fixed;
  top: 80px;
  right: 20px;
  z-index: 3000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.9rem;
  box-shadow: var(--shadow);
  animation: slideIn 0.3s ease;
  min-width: 250px;
}

.toast.success { border-left: 3px solid var(--success); }
.toast.error { border-left: 3px solid var(--danger); }
.toast.info { border-left: 3px solid var(--primary); }

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@keyframes slideOut {
  from { transform: translateX(0); opacity: 1; }
  to { transform: translateX(100%); opacity: 0; }
}

/* ============================================
   Footer
   ============================================ */
.site-footer {
  padding: 3rem 0;
  border-top: 1px solid var(--border);
  margin-top: 4rem;
}

.footer-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  font-weight: 600;
}

.footer-links {
  display: flex;
  gap: 1.5rem;
}

.footer-links a {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.footer-copyright {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 1rem;
  text-align: center;
  width: 100%;
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 1024px) {
  .study-layout {
    grid-template-columns: 1fr;
  }
  .vocab-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .navbar {
    padding: 0 1rem;
  }

  .nav-links {
    display: none;
    position: fixed;
    top: 64px;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-dark);
    flex-direction: column;
    padding: 2rem;
    gap: 4px;
  }

  .nav-links.open {
    display: flex;
  }

  .nav-links a {
    font-size: 1.1rem;
    padding: 12px 16px;
  }

  .nav-toggle {
    display: block;
  }

  .hero h1 {
    font-size: 2.2rem;
  }

  .hero-stats {
    gap: 1.5rem;
  }

  .hero-stat .number {
    font-size: 1.5rem;
  }

  .features-grid {
    grid-template-columns: 1fr;
  }

  .container {
    padding: 0 1rem;
  }
}

@media (max-width: 480px) {
  .hero h1 {
    font-size: 1.8rem;
  }

  .hero-actions {
    flex-direction: column;
  }

  .hero-stats {
    flex-direction: column;
    gap: 1rem;
  }
}

/* ============================================
   Utility Classes
   ============================================ */
.text-gradient {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hidden { display: none !important; }

.fade-in {
  animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.skeleton {
  background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-card-hover) 50%, var(--bg-card) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ============================================
   PWA / iPad 安全区域适配
   ============================================ */

/* iOS PWA 全屏模式下的安全区域 */
@supports (padding: env(safe-area-inset-top)) {
  .navbar {
    top: env(safe-area-inset-top);
    height: calc(64px + env(safe-area-inset-top));
    padding-left: calc(2rem + env(safe-area-inset-left));
    padding-right: calc(2rem + env(safe-area-inset-right));
  }

  body {
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
  }

  /* 首页内容区域需要额外顶部空间 */
  #page-home {
    padding-top: calc(env(safe-area-inset-top) + 64px);
  }

  /* 底部导航或固定元素适配 */
  .site-footer {
    padding-bottom: env(safe-area-inset-bottom);
  }
}

/* iPad 横屏优化 */
@media (min-width: 768px) and (max-width: 1024px) and (orientation: landscape) {
  .hero {
    flex-direction: row;
    align-items: center;
    gap: 3rem;
    text-align: left;
  }

  .features-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .featured-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* iPad Pro 大屏优化 */
@media (min-width: 1024px) and (orientation: portrait) {
  .container {
    max-width: 860px;
    margin: 0 auto;
  }

  .featured-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* PWA 独立模式（添加到主屏幕后） */
html.pwa-standalone {
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}

html.pwa-standalone body {
  overscroll-behavior-y: contain;
}

html.pwa-standalone .navbar {
  height: calc(64px + constant(safe-area-inset-top));
  height: calc(64px + env(safe-area-inset-top));
}

/* 启动屏动画 */
.pwa-splash {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-dark);
  transition: opacity 0.6s ease, visibility 0.6s ease;
}

.pwa-splash.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.pwa-splash-inner {
  text-align: center;
}

.pwa-splash-icon {
  width: 120px;
  height: 120px;
  border-radius: 28px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 56px;
  font-weight: 800;
  color: white;
  margin-bottom: 20px;
  animation: splash-pulse 1.5s ease-in-out infinite;
  box-shadow: 0 12px 40px rgba(108, 92, 231, 0.4);
}

.pwa-splash-text {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 2px;
}

@keyframes splash-pulse {
  0%, 100% { transform: scale(1); box-shadow: 0 12px 40px rgba(108, 92, 231, 0.4); }
  50% { transform: scale(1.05); box-shadow: 0 16px 50px rgba(108, 92, 231, 0.55); }
}
