/* ========================================
   爽文背单词 Pro - 样式文件
   ======================================== */

:root {
  --primary: #6F7F5F;
  --primary-light: rgba(111, 127, 95, 0.7);
  --primary-lighter: rgba(111, 127, 95, 0.22);
  --primary-dark: #42513A;
  --bg-body: #f5f5f4;
  --bg-card: rgba(255, 255, 255, 0.85);
  --bg-muted: rgba(0, 0, 0, 0.03);
  --text-foreground: #1c1c1e;
  --text-muted: #6b7280;
  --text-muted-light: rgba(0, 0, 0, 0.5);
  --border: rgba(0, 0, 0, 0.06);
  --border-hover: rgba(111, 127, 95, 0.25);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.12);
  --green: #10b981;
  --green-light: rgba(16, 185, 129, 0.1);
  --amber: #f59e0b;
  --amber-light: rgba(245, 158, 11, 0.1);
  --sky: #0ea5e9;
  --sky-light: rgba(14, 165, 233, 0.1);
  --navbar-blur: blur(20px);
  --dropdown-blur: blur(40px);
}

/* 深色模式 */
body.dark {
  --bg-body: #0a0a0a;
  --bg-card: rgba(30, 30, 30, 0.8);
  --bg-muted: rgba(255,255,255,0.05);
  --text-foreground: #f5f5f5;
  --text-muted: #9ca3af;
  --text-muted-light: rgba(255,255,255,0.4);
  --border: rgba(255,255,255,0.08);
  --border-hover: rgba(111,127,95,0.4);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.4);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.5);
  --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.6);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
  background: var(--bg-body);
  color: var(--text-foreground);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  padding-top: 64px; /* 为固定导航栏留出空间 */
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.25rem;
}
@media (min-width: 768px) {
  .container {
    padding: 0 2rem;
  }
}
@media (min-width: 1024px) {
  .container {
    padding: 0 2.5rem;
  }
}

/* ========== 导航栏 ========== */
.navbar {
  background: var(--bg-card);
  backdrop-filter: var(--navbar-blur) saturate(180%);
  -webkit-backdrop-filter: var(--navbar-blur) saturate(180%);
  border-bottom: 1px solid var(--border);
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  box-shadow: var(--shadow-sm);
}

.nav-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  position: relative;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.25rem;
}
@media (min-width: 768px) {
  .nav-container {
    padding: 0 2rem;
  }
}
@media (min-width: 1024px) {
  .nav-container {
    padding: 0 2.5rem;
  }
}

.logo-btn {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: none;
  border: none;
  cursor: pointer;
  flex-shrink: 0;
}
.logo-btn:hover { opacity: 0.8; }
.logo-icon { height: 2rem; width: 2rem; flex-shrink: 0; }
.logo-title { font-size: 1rem; font-weight: 600; color: var(--text-foreground); white-space: nowrap; }
@media (min-width: 768px) { .logo-title { font-size: 1.125rem; } }
.logo-subtitle { display: none; font-size: 0.625rem; font-weight: 500; letter-spacing: 0.18em; color: var(--text-muted-light); text-transform: uppercase; }
@media (min-width: 768px) { .logo-subtitle { display: inline-block; } }

/* 顶部导航菜单 */
.top-nav {
  display: none;
  align-items: center;
  gap: 0.125rem;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}
@media (min-width: 768px) { .top-nav { display: flex; } }

.top-nav-item {
  padding: 0.375rem 0.75rem;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.15s, background 0.15s;
  white-space: nowrap;
}
.top-nav-item:hover { color: var(--text-foreground); background: var(--bg-muted); }
.top-nav-item.active { color: var(--primary); font-weight: 600; }

/* 右侧操作区 */
.nav-actions { display: flex; align-items: center; gap: 0.375rem; }

/* 移动端汉堡按钮 */
.mobile-menu-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 0.5rem;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
}
@media (min-width: 768px) { .mobile-menu-btn { display: none; } }

/* 移动端展开菜单 */
.mobile-nav {
  display: none;
  flex-direction: column;
  gap: 0.125rem;
  border-top: 1px solid var(--border);
  padding: 0.5rem 1rem 0.75rem;
}
.mobile-nav.open { display: flex; }
@media (min-width: 768px) { .mobile-nav { display: none !important; } }

.mobile-nav-item {
  padding: 0.625rem 0.75rem;
  border-radius: 0.5rem;
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
}
.mobile-nav-item:hover { background: var(--bg-muted); color: var(--text-foreground); }
.mobile-nav-item.active { color: var(--primary); }

/* 用户菜单 */
.user-menu-wrapper { position: relative; }

.nav-menu-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 2.4rem;
  max-width: 220px;
  padding: 0.25rem 0.65rem 0.25rem 0.3rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255,255,255,0.72);
  color: var(--text-foreground);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: background 0.2s, border-color 0.2s, transform 0.2s, box-shadow 0.2s;
}
.nav-menu-btn:hover,
.user-menu-wrapper.open .nav-menu-btn {
  background: var(--bg-card);
  border-color: rgba(111,127,95,0.35);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}
.nav-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.85rem;
  height: 1.85rem;
  flex-shrink: 0;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(111,127,95,0.95), rgba(138,154,122,0.9));
  color: white;
  font-size: 0.8125rem;
  font-weight: 700;
}
.nav-user-copy {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.1;
  min-width: 0;
}
.nav-user-copy #navUsername,
#usernameDesktop {
  max-width: 82px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.8125rem;
  font-weight: 700;
}
.nav-user-copy #navRole {
  font-size: 0.625rem;
  color: var(--text-muted);
}
.nav-user-copy #navRole.vip { color: #b45309; }
.nav-user-copy #navRole.admin { color: #dc2626; }
.vip-forever-badge {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 1.1rem;
  height: 1.1rem;
  border-radius: 50%;
  background: linear-gradient(135deg, #f59e0b, #facc15);
  border: 1px solid rgba(146, 64, 14, 0.18);
  color: #fff7ed;
  font-size: 0.7rem;
  font-weight: 900;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1;
  box-shadow: 0 3px 8px rgba(180, 83, 9, 0.18);
}
#crownIcon[style*="display: none"] {
  display: none !important;
}

.user-menu-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  background: var(--bg-muted);
  border: none;
  color: var(--text-foreground);
  cursor: pointer;
  transition: background 0.2s;
}
.user-menu-btn:hover { background: rgba(0,0,0,0.06); }
.user-menu-btn svg { width: 1rem; height: 1rem; }

/* 已登录用户按钮 */
.user-info-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.3rem 0.625rem 0.3rem 0.3rem;
  border-radius: 2rem;
  border: 1px solid var(--border);
  background: var(--bg-card);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.user-info-btn:hover { border-color: var(--border-hover); background: var(--bg-muted); }

.avatar-circle {
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  background: var(--primary-lighter);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.avatar-circle svg { width: 1rem; height: 1rem; color: var(--primary); }

.user-info-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.2;
}
.nav-username {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-foreground);
  max-width: 80px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.nav-role-badge { font-size: 0.625rem; color: var(--text-muted); font-weight: 500; }
.nav-role-badge.vip { color: #b45309; }
.nav-role-badge.admin { color: #dc2626; }

.nav-expires-text {
  font-size: 0.5625rem;
  color: var(--text-muted);
  font-weight: 400;
  margin-top: 1px;
}

.chevron-icon {
  width: 0.875rem;
  height: 0.875rem;
  color: var(--text-muted);
  transition: transform 0.2s;
  flex-shrink: 0;
}
.user-menu-wrapper.open .chevron-icon { transform: rotate(180deg); }

@media (max-width: 480px) {
  .user-info-text { display: none; }
  .chevron-icon { display: none; }
}

/* 下拉菜单 */
.user-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  min-width: 220px;
  padding: 0.35rem;
  background: rgba(255,255,255,0.9);
  backdrop-filter: var(--dropdown-blur) saturate(180%);
  -webkit-backdrop-filter: var(--dropdown-blur) saturate(180%);
  border: 1px solid rgba(111,127,95,0.16);
  border-radius: 1rem;
  box-shadow: var(--shadow-lg);
  z-index: 2000;
  overflow: hidden;
  animation: dropdownIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes dropdownIn {
  from {
    opacity: 0;
    transform: translateY(-8px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}
.user-dropdown.open { display: block; }

.dropdown-divider { height: 1px; background: var(--border); margin: 0.25rem 0; }

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  width: 100%;
  padding: 0.65rem 0.75rem;
  border-radius: 0.7rem;
  font-size: 0.8125rem;
  color: var(--text-foreground);
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s, color 0.15s;
  text-decoration: none;
}
.dropdown-item-label {
  margin: 0;
  padding: 0.65rem 0.75rem 0.45rem;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 600;
}
.dropdown-item:hover { background: var(--bg-muted); }
.dropdown-item.danger { color: #dc2626; }
.dropdown-item.danger:hover { background: rgba(220,38,38,0.06); }

/* 主题切换 */
.dropdown-theme {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 1rem;
}
.dropdown-theme-label { font-size: 0.8125rem; color: var(--text-muted); }

.theme-toggle {
  display: flex;
  border: 1px solid var(--border);
  border-radius: 0.375rem;
  overflow: hidden;
}
.theme-btn {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  background: none;
  border: none;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.theme-btn.active { background: var(--primary-lighter); color: var(--primary-dark); font-weight: 600; }

/* ========== 主内容区 ========== */
.main-content {
  min-height: calc(100vh - 64px);
  padding: 2rem 0 3rem;
}
@media (min-width: 768px) {
  .main-content {
    padding: 2.5rem 0 4rem;
  }
}
@media (min-width: 1024px) {
  .main-content {
    padding: 3rem 0 5rem;
  }
}

/* Hero */
.hero-card {
  position: relative;
  border-radius: 1.25rem;
  border: 1px solid var(--border);
  background: var(--bg-card);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  overflow: hidden;
  padding: 1.75rem 1.5rem;
  margin-bottom: 1.75rem;
  box-shadow: var(--shadow-md);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}
@media (min-width: 768px) {
  .hero-card {
    padding: 2.5rem 2.5rem;
    margin-bottom: 2.5rem;
    border-radius: 1.5rem;
  }
}
@media (min-width: 1024px) {
  .hero-card {
    padding: 3rem 3rem;
  }
}
.hero-pattern { pointer-events: none; position: absolute; top: -0.25rem; right: -0.25rem; opacity: 0.7; }
.hero-content { position: relative; z-index: 1; }
.hero-label { font-size: 0.688rem; color: var(--text-muted); margin-bottom: 0.375rem; letter-spacing: 0.18em; text-transform: uppercase; font-weight: 500; }
.hero-title { font-size: 1.5rem; font-weight: 700; color: var(--text-foreground); letter-spacing: -0.02em; line-height: 1.3; margin: 0 0 0.375rem; }
@media (min-width: 768px) { .hero-title { font-size: 1.875rem; } }
.hero-desc { font-size: 0.875rem; color: var(--text-muted); margin: 0; }

/* 学习目标选择器 */
.level-selector-wrapper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  gap: 1rem;
}
.level-label {
  font-size: 0.8125rem;
  color: var(--text-muted);
  font-weight: 500;
}
.level-selector {
  display: inline-flex;
  flex-wrap: wrap;
  border: 1px solid var(--border);
  background: var(--bg-muted);
  padding: 0.25rem;
  border-radius: 0.75rem;
  gap: 0.25rem;
  box-shadow: var(--shadow-sm);
}
.level-btn {
  border-radius: 0.625rem;
  font-weight: 500;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  padding: 0.375rem 0.875rem;
  font-size: 0.8125rem;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
}
.level-btn:hover {
  color: var(--text-foreground);
  background: rgba(0,0,0,0.04);
}
.level-btn.active {
  background: var(--primary);
  color: white;
  box-shadow: 0 2px 8px rgba(111, 127, 95, 0.3);
  transform: scale(1.02);
}

/* 布局 */
.mobile-layout { display: block; }
@media (min-width: 768px) { .mobile-layout { display: none; } }
.desktop-layout { display: none; }
@media (min-width: 768px) {
  .desktop-layout {
    display: flex;
    gap: 2rem;
  }
}
@media (min-width: 1024px) {
  .desktop-layout {
    gap: 2.5rem;
  }
}
.sidebar { width: 18rem; flex-shrink: 0; }
.main-area { flex: 1; min-width: 0; }

/* 操作卡片（移动端） */
.action-cards-mobile {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}
.action-card-mobile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  border-radius: 1rem;
  border: 1px solid var(--border);
  background: var(--bg-card);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  padding: 1.25rem 0.75rem;
  box-shadow: var(--shadow-md);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  cursor: pointer;
}
.action-card-mobile:active {
  transform: scale(0.95);
}
.action-card-mobile:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}
.action-card-mobile .action-icon {
  color: var(--primary-light);
  width: 1.5rem;
  height: 1.5rem;
}
.action-card-mobile .action-title {
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--text-foreground);
  letter-spacing: 0.02em;
}
.action-card-mobile .action-desc {
  font-size: 0.6875rem;
  color: var(--text-muted);
  text-align: center;
}

/* 操作卡片（桌面端） */
.action-area {
  display: grid;
  grid-template-columns: 3fr 2fr;
  gap: 1.25rem;
  margin-bottom: 1.75rem;
}
.action-cards {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.action-card {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 1rem;
  border-radius: 1rem;
  border: 1px solid var(--border);
  background: var(--bg-card);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  padding: 1rem 1.25rem;
  text-align: left;
  box-shadow: var(--shadow-md);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  cursor: pointer;
}
.action-card:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}
.action-card:active {
  transform: scale(0.98);
}
.action-card .action-icon {
  color: var(--primary-light);
  width: 1.5rem;
  height: 1.5rem;
  flex-shrink: 0;
}
.action-card .action-title {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--text-foreground);
  margin: 0;
}
.action-card .action-desc {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin: 0;
}

/* 学习统计 */
.stats-section-mobile, .stats-section { margin-bottom: 1.5rem; }
.section-label {
  font-size: 0.6875rem;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-weight: 600;
}
.section-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-foreground);
  letter-spacing: -0.02em;
  margin: 0 0 1.25rem;
}
.stats-grid-mobile {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
}
@media (min-width: 768px) {
  .stats-grid-mobile {
    grid-template-columns: 1fr;
  }
}
.stats-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
}
.stat-card {
  border: 1px solid var(--border);
  background: var(--bg-card);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: var(--shadow-md);
  border-radius: 1rem;
  padding: 1rem;
  min-height: 80px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
.stat-card:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}
@media (min-width: 768px) {
  .stat-card {
    padding: 1.25rem;
  }
}
.stat-header { display: flex; align-items: center; justify-content: space-between; }
.stat-label { font-size: 0.625rem; color: var(--text-muted); font-weight: 500; }
@media (min-width: 768px) { .stat-label { font-size: 0.688rem; } }
.stat-icon { width: 0.875rem; height: 0.875rem; color: var(--primary); opacity: 0.5; }
.stat-value { display: flex; align-items: baseline; gap: 0.25rem; margin-top: 0.25rem; }
.stat-value span:first-child { font-size: 1.25rem; font-weight: 700; color: var(--text-foreground); }
@media (min-width: 768px) { .stat-value span:first-child { font-size: 1.5rem; } }
.stat-unit { font-size: 0.688rem; color: var(--text-muted); }

/* 日历 */
.calendar-card {
  border: 1px solid var(--border);
  background: var(--bg-card);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: var(--shadow-md);
  border-radius: 1rem;
  padding: 1.75rem;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
.calendar-card:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-lg);
}
.calendar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}
.calendar-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-foreground);
  margin: 0;
}
.calendar-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.calendar-nav-btn {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 0.375rem;
  padding: 0.25rem;
  cursor: pointer;
  color: var(--text-muted);
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.calendar-nav-btn:hover {
  background: var(--bg-muted);
  border-color: var(--primary);
  color: var(--primary);
}
.calendar-body { display: flex; flex-direction: column; gap: 0.75rem; }
.calendar-month {
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-muted);
  min-width: 80px;
}
.calendar-weekdays { display: grid; grid-template-columns: repeat(7, 1fr); gap: 0.25rem; text-align: center; }
.calendar-weekdays div { font-size: 0.625rem; color: var(--text-muted); font-weight: 500; }
.calendar-days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 0.25rem; }
.calendar-day {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.688rem;
  font-weight: 500;
  border-radius: 0.375rem;
  cursor: pointer;
  color: var(--text-foreground);
  position: relative;
}
.calendar-day:hover { background: var(--bg-muted); }
.calendar-day.checked {
  background: var(--primary-lighter);
  color: var(--primary-dark);
  font-weight: 600;
}
.calendar-day .check-mark {
  position: absolute;
  bottom: 2px;
  right: 2px;
  width: 10px;
  height: 10px;
  opacity: 0.9;
}

/* 故事列表 */
.story-section { margin-top: 2rem; grid-column: 1 / -1; }
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  gap: 1rem;
  flex-wrap: wrap;
}
.section-heading {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text-foreground);
}
.section-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}
.level-filter {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.level-btn {
  padding: 0.375rem 0.875rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--bg-muted);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  cursor: pointer;
  transition: all 0.2s;
}
.level-btn:hover {
  background: var(--primary-lighter);
  border-color: var(--primary);
  color: var(--primary);
}
.level-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}
.view-all-btn {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-muted);
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  transition: all 0.2s;
  white-space: nowrap;
}
.view-all-btn:hover {
  color: var(--primary);
  transform: translateX(2px);
}
.view-all-btn svg { width: 0.875rem; height: 0.875rem; }
/* 故事列表 */
.story-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}
@media (min-width: 768px) {
  .story-list {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (min-width: 1024px) {
  .story-list {
    grid-template-columns: repeat(3, 1fr);
  }
}

.story-card {
  border-radius: 1rem;
  border: 1px solid var(--border);
  background: var(--bg-card);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  cursor: pointer;
  isolation: isolate;
}
/* 封面图 */
.story-card-cover {
  width: 100%;
  height: 0;
  padding-bottom: 56.25%;
  position: relative;
  overflow: hidden;
  background: var(--bg-muted);
}
.story-card-cover img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* 故事库页面：一行4列 */
body.story-library-page .story-list {
  grid-template-columns: repeat(2, 1fr);
}
@media (min-width: 768px) {
  body.story-library-page .story-list {
    grid-template-columns: repeat(4, 1fr);
  }
}
.story-card:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}
.story-card:active {
  transform: scale(0.995);
}
.story-card-body {
  padding: 1rem 1.25rem;
}
.story-header { display: flex; align-items: center; gap: 0.5rem; min-width: 0; }
.story-title { flex: 1; min-width: 0; font-size: 0.875rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-foreground); }
.story-badge { flex-shrink: 0; font-size: 0.625rem; font-weight: 500; padding: 0.0625rem 0.375rem; border-radius: 0.25rem; border: 1px solid; line-height: 1.6; }
.story-badge.trial { color: var(--green); border-color: rgba(16,185,129,0.25); }
.story-badge.vip { color: var(--amber); border-color: rgba(245,158,11,0.25); }
.story-status { font-size: 0.625rem; font-weight: 500; padding: 0.0625rem 0.375rem; border-radius: 9999px; flex-shrink: 0; }
.story-status.completed { background: var(--green-light); color: var(--green); }
.story-status.learning { background: var(--primary-lighter); color: var(--primary); }
.story-tags { margin-top: 0.375rem; display: flex; align-items: center; gap: 0.25rem; overflow: hidden; }
.story-tag { font-size: 0.625rem; padding: 0.0625rem 0.375rem; border-radius: 0.125rem; line-height: 1.6; flex-shrink: 0; border: 1px solid; }
.story-tag.level-basic { color: rgba(180,83,9,0.7); border-color: rgba(251,191,36,0.2); background: rgba(254,243,199,0.4); }
.story-tag.level-intermediate { color: rgba(7,89,133,0.7); border-color: rgba(56,189,248,0.2); background: rgba(224,242,254,0.4); }
.story-tag.normal { color: var(--text-muted-light); border-color: rgba(0,0,0,0.12); background: rgba(0,0,0,0.02); }
.story-progress { margin-top: 0.375rem; display: flex; align-items: center; gap: 0.5rem; }
.story-progress-bar-wrapper { flex: 1; display: flex; align-items: center; gap: 0.375rem; }
.story-progress-bar { flex: 1; height: 3px; border-radius: 9999px; background: rgba(80,70,50,0.07); overflow: hidden; }
.story-progress-fill { height: 100%; border-radius: 9999px; transition: width 0.5s; }
.story-progress-text { font-size: 0.625rem; flex-shrink: 0; width: 1.75rem; text-align: right; font-weight: 500; }
.story-meta { display: flex; align-items: center; gap: 0.25rem; flex-shrink: 0; font-size: 0.625rem; color: rgba(0,0,0,0.4); }
.story-meta svg { width: 0.625rem; height: 0.625rem; }

/* ========== VIP锁定卡片 ========== */
.story-card-locked {
  opacity: 0.55;
  position: relative;
}
/* 用伪元素实现背景高斯模糊效果，不影响卡片内容 */
.story-card-locked::after {
  content: '';
  position: absolute;
  inset: 0;
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  pointer-events: none;
  z-index: 0;
}
/* 确保卡片子元素在模糊层之上 */
.story-card-locked > * {
  position: relative;
  z-index: 1;
}
.story-card-clickable {
  pointer-events: auto;
  cursor: pointer;
}
.story-locked-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 10;
  background: rgba(0, 0, 0, 0.7);
  color: #fbbf24;
  padding: 0.75rem 1.5rem;
  border-radius: 0.75rem;
  font-size: 0.875rem;
  font-weight: 600;
  white-space: nowrap;
  pointer-events: none;
  backdrop-filter: blur(4px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

@media (max-width: 767px) { .main-content { padding-bottom: 2rem; } }

/* ========== 弹窗 ========== */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 3000;
  align-items: center;
  justify-content: center;
  animation: overlayIn 0.2s ease;
}
@keyframes overlayIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--bg-card);
  backdrop-filter: var(--dropdown-blur) saturate(180%);
  -webkit-backdrop-filter: var(--dropdown-blur) saturate(180%);
  border: 1px solid var(--border);
  border-radius: 1.25rem;
  width: 100%;
  max-width: 400px;
  margin: 1.5rem;
  box-shadow: var(--shadow-lg);
  animation: modalIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes modalIn {
  from {
    opacity: 0;
    transform: scale(0.92) translateY(20px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.5rem 1.5rem 0;
}
.modal-header h3 {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text-foreground);
}
.modal-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
}
.modal-close:hover {
  background: var(--bg-muted);
  color: var(--text-foreground);
}
.modal-body {
  padding: 1.25rem 1.5rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.form-group label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-foreground);
}
.form-label-hint {
  font-weight: 400;
  color: var(--text-muted);
}
.form-group input {
  height: 2.75rem;
  padding: 0 1rem;
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  font-size: 0.9375rem;
  color: var(--text-foreground);
  background: var(--bg-body);
  outline: none;
  transition: all 0.2s;
}
.form-group input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(111, 127, 95, 0.1);
}
.form-error {
  font-size: 0.8125rem;
  color: #dc2626;
  padding: 0.625rem 0.875rem;
  background: rgba(220,38,38,0.08);
  border-radius: 0.625rem;
  border: 1px solid rgba(220,38,38,0.2);
}
.form-submit {
  height: 2.75rem;
  border-radius: 0.75rem;
  background: var(--primary);
  color: white;
  font-size: 0.9375rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  margin-top: 0.5rem;
  box-shadow: 0 2px 8px rgba(111, 127, 95, 0.3);
}
.form-submit:hover {
  background: var(--primary-dark);
  box-shadow: 0 4px 12px rgba(111, 127, 95, 0.4);
  transform: translateY(-1px);
}
.form-submit:active {
  transform: translateY(0);
}
.form-switch {
  text-align: center;
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin: 0;
}
.form-switch a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
  transition: color 0.2s;
}
.form-switch a:hover {
  color: var(--primary-dark);
}

/* 响应式：移动端分类筛选 */
@media (max-width: 767px) {
  .section-header {
    flex-direction: column;
    align-items: flex-start;
  }
  .section-actions {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
  }
  .level-filter {
    width: 100%;
    justify-content: flex-start;
  }
  .level-btn {
    flex: 0 0 auto;
    font-size: 0.75rem;
    padding: 0.375rem 0.75rem;
  }
  .view-all-btn {
    width: 100%;
    justify-content: center;
    padding: 0.5rem;
    font-size: 0.875rem;
  }
}
