/* =============================================================================
   Lingua Atlas — 温暖编辑式"语言图谱"美学
   ============================================================================= */

:root {
  --bg: #F7F2E8;
  --bg-2: #F0E8D8;
  --surface: #FFFBF3;
  --surface-2: #FDF7EC;
  --ink: #1C1917;
  --ink-soft: #57534E;
  --ink-faint: #A8A29E;
  --line: #E5DCC8;
  --line-soft: #EFE7D4;

  --primary: #1A3A4A;
  --primary-deep: #0F2A36;
  --primary-soft: #E8F0F3;
  --accent: #D97706;
  --accent-deep: #B45309;
  --accent-soft: #FEF3C7;
  --accent-glow: rgba(217, 119, 6, 0.15);

  --success: #10B981;
  --danger: #DC2626;
  --warning: #F59E0B;

  --radius: 14px;
  --radius-lg: 22px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 3px rgba(28, 25, 23, 0.06), 0 1px 2px rgba(28, 25, 23, 0.04);
  --shadow: 0 4px 16px rgba(28, 25, 23, 0.08), 0 2px 4px rgba(28, 25, 23, 0.04);
  --shadow-lg: 0 16px 40px rgba(28, 25, 23, 0.12), 0 4px 12px rgba(28, 25, 23, 0.06);

  --font-display: 'Fraunces', 'Songti SC', Georgia, serif;
  --font-body: 'Manrope', -apple-system, 'PingFang SC', 'Microsoft YaHei', sans-serif;

  --maxw: 1200px;
}

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

html, body { height: 100%; }

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  background-image:
    radial-gradient(circle at 15% 20%, rgba(217, 119, 6, 0.04) 0%, transparent 40%),
    radial-gradient(circle at 85% 80%, rgba(26, 58, 74, 0.04) 0%, transparent 40%);
  background-attachment: fixed;
}

/* 纸张纹理叠加 */
body::before {
  content: '';
  position: fixed; inset: 0;
  pointer-events: none;
  opacity: 0.5;
  z-index: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.03'/%3E%3C/svg%3E");
}

#app { position: relative; z-index: 1; min-height: 100vh; }
.app-inner { max-width: var(--maxw); margin: 0 auto; padding: 0 24px 60px; }

a { color: inherit; text-decoration: none; cursor: pointer; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, textarea, select { font-family: inherit; }

/* =============================================================================
   按钮
   ============================================================================= */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-weight: 600; font-size: 14px;
  transition: all 0.2s ease;
  white-space: nowrap;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-deep); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(26, 58, 74, 0.3); }
.btn-accent { background: var(--accent); color: #fff; }
.btn-accent:hover { background: var(--accent-deep); transform: translateY(-1px); }
.btn-secondary { background: var(--primary-soft); color: var(--primary); }
.btn-secondary:hover { background: #d4e3e9; }
.btn-ghost { background: transparent; color: var(--ink-soft); border: 1px solid var(--line); }
.btn-ghost:hover { background: var(--surface-2); color: var(--ink); }
.btn-block { width: 100%; }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn.disabled, .btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none !important; }

/* =============================================================================
   顶部导航
   ============================================================================= */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 24px;
  padding: 14px 24px;
  background: rgba(247, 242, 232, 0.85);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
  max-width: var(--maxw);
  margin: 0 auto;
}
.brand { display: flex; align-items: center; gap: 12px; cursor: pointer; flex-shrink: 0; }
.brand-mark {
  font-size: 28px; color: var(--accent);
  font-family: var(--font-display);
  font-weight: 900;
  transform: rotate(-8deg);
  display: inline-block;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-name { font-family: var(--font-display); font-weight: 700; font-size: 18px; color: var(--primary); letter-spacing: -0.02em; }
.brand-tag { font-size: 10px; color: var(--ink-faint); letter-spacing: 0.2em; text-transform: uppercase; }

.nav-main { display: flex; gap: 4px; flex: 1; justify-content: center; }
.nav-item {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 14px;
  border-radius: 10px;
  font-size: 13px; font-weight: 500; color: var(--ink-soft);
  transition: all 0.2s;
}
.nav-item:hover { background: var(--surface-2); color: var(--ink); }
.nav-item.active { background: var(--primary); color: #fff; }
.nav-icon { font-size: 14px; }

.topbar-right { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }

.lang-switcher {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 13px;
  position: relative;
}
.lang-flag { font-size: 16px; }
.lang-name { font-weight: 600; }
.lang-select {
  position: absolute; inset: 0; opacity: 0; cursor: pointer;
}

.xp-pill, .streak-pill {
  display: flex; align-items: center; gap: 4px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 13px; font-weight: 700;
}
.xp-pill { background: var(--accent-soft); color: var(--accent-deep); }
.streak-pill { background: #FEE2E2; color: #B91C1C; }

.user-chip {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 8px 4px 4px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
}
.avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px;
  font-family: var(--font-display);
}
.username { font-size: 13px; font-weight: 600; }
.icon-btn { color: var(--ink-faint); padding: 4px 8px; border-radius: 6px; }
.icon-btn:hover { background: var(--bg-2); color: var(--danger); }

/* =============================================================================
   通用页面
   ============================================================================= */
.page { padding-top: 28px; animation: fadeUp 0.5s ease; }
.page-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  margin-bottom: 28px; gap: 16px; flex-wrap: wrap;
}
.page-title {
  font-family: var(--font-display);
  font-size: 36px; font-weight: 700;
  color: var(--primary);
  letter-spacing: -0.02em;
  line-height: 1.1;
}
.page-sub { color: var(--ink-soft); font-size: 14px; margin-top: 4px; }

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

.card-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 10px;
  background: var(--accent-soft);
  color: var(--accent-deep);
  border-radius: 999px;
  font-size: 12px; font-weight: 600;
}

/* =============================================================================
   认证页
   ============================================================================= */
.auth-wrap {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  padding: 0;
  margin: 0 -24px;
}
.auth-hero {
  position: relative;
  background: linear-gradient(135deg, var(--primary) 0%, #0F2A36 100%);
  color: #fff;
  padding: 60px;
  display: flex; flex-direction: column; justify-content: center;
  overflow: hidden;
}
.auth-hero-inner { position: relative; z-index: 2; max-width: 460px; }
.auth-brand {
  font-family: var(--font-display);
  font-size: 20px; font-weight: 700;
  color: var(--accent);
  margin-bottom: 32px;
  letter-spacing: 0.05em;
}
.auth-hero h1 {
  font-family: var(--font-display);
  font-size: 56px; font-weight: 900;
  line-height: 1.05;
  letter-spacing: -0.03em;
  margin-bottom: 20px;
}
.auth-hero p { color: rgba(255, 255, 255, 0.7); font-size: 16px; margin-bottom: 40px; }
.auth-features { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.auth-feat {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-sm);
  font-size: 14px;
}
.auth-feat span { font-size: 18px; }

.auth-decoration { position: absolute; inset: 0; pointer-events: none; z-index: 1; }
.floating-char {
  position: absolute;
  font-family: var(--font-display);
  font-weight: 900;
  color: rgba(217, 119, 6, 0.15);
  animation: float 6s ease-in-out infinite;
}
.char-1 { font-size: 180px; top: 8%; right: 10%; animation-delay: 0s; }
.char-2 { font-size: 140px; top: 45%; right: 25%; animation-delay: 1.5s; }
.char-3 { font-size: 160px; bottom: 10%; right: 8%; animation-delay: 0.8s; }
.char-4 { font-size: 100px; top: 30%; left: 60%; animation-delay: 2s; color: rgba(255,255,255,0.06); }
.char-5 { font-size: 120px; bottom: 30%; left: 50%; animation-delay: 1s; color: rgba(255,255,255,0.05); }

@keyframes float {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-20px) rotate(5deg); }
}

.auth-card-wrap {
  display: flex; align-items: center; justify-content: center;
  padding: 40px;
  background: var(--surface);
}
.auth-card {
  width: 100%; max-width: 400px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 36px;
  box-shadow: var(--shadow-lg);
}
.auth-tabs {
  display: flex;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  padding: 4px;
  margin-bottom: 28px;
}
.auth-tab {
  flex: 1;
  padding: 10px;
  border-radius: 6px;
  font-size: 14px; font-weight: 600;
  color: var(--ink-soft);
  transition: all 0.2s;
}
.auth-tab.active { background: var(--primary); color: #fff; }

.form-field { margin-bottom: 18px; }
.form-field label { display: block; font-size: 13px; font-weight: 600; color: var(--ink-soft); margin-bottom: 6px; }
.form-field input, .form-field textarea, .form-field select {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-size: 14px;
  transition: all 0.2s;
}
.form-field input:focus, .form-field textarea:focus, .form-field select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.auth-hint { text-align: center; font-size: 12px; color: var(--ink-faint); margin-top: 16px; }

/* =============================================================================
   仪表盘
   ============================================================================= */
.hero-section {
  display: flex; align-items: center; justify-content: space-between;
  gap: 32px;
  padding: 36px;
  background: linear-gradient(135deg, var(--surface) 0%, var(--surface-2) 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  margin-bottom: 28px;
  position: relative;
  overflow: hidden;
}
.hero-section::after {
  content: '';
  position: absolute; right: -40px; top: -40px;
  width: 200px; height: 200px;
  background: radial-gradient(circle, var(--accent-glow) 0%, transparent 70%);
  pointer-events: none;
}
.hero-greeting { color: var(--accent-deep); font-weight: 600; font-size: 14px; margin-bottom: 8px; }
.hero-title {
  font-family: var(--font-display);
  font-size: 40px; font-weight: 700;
  color: var(--primary);
  letter-spacing: -0.02em;
  line-height: 1.15;
}
.accent-text { color: var(--accent); font-style: italic; }
.hero-sub { color: var(--ink-soft); margin-top: 12px; font-size: 15px; }

.hero-stats { display: flex; gap: 16px; }
.stat-bubble {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 24px;
  text-align: center;
  min-width: 110px;
  box-shadow: var(--shadow-sm);
}
.stat-num {
  display: block;
  font-family: var(--font-display);
  font-size: 32px; font-weight: 700;
  color: var(--primary);
  line-height: 1;
}
.stat-label { font-size: 12px; color: var(--ink-soft); margin-top: 6px; display: block; }

.dash-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 20px;
}
.dash-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}
.primary-card { grid-column: 1 / -1; background: linear-gradient(135deg, var(--surface) 0%, var(--accent-soft) 200%); }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.card-head h2 { font-family: var(--font-display); font-size: 20px; font-weight: 700; color: var(--primary); }
.card-link { color: var(--accent); font-size: 13px; font-weight: 600; cursor: pointer; }

.continue-card {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.25s;
}
.continue-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--accent); }
.continue-left { display: flex; align-items: center; gap: 16px; }
.continue-icon {
  width: 52px; height: 52px;
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px;
}
.continue-type { font-size: 12px; font-weight: 600; color: var(--ink-soft); }
.continue-title { font-size: 16px; font-weight: 700; color: var(--ink); margin: 2px 0; }
.continue-level { font-size: 12px; color: var(--ink-faint); }

/* 周活跃图表 */
.week-chart {
  display: flex; align-items: flex-end; justify-content: space-between;
  height: 140px;
  gap: 8px;
}
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; height: 100%; justify-content: flex-end; }
.bar-value { font-size: 11px; color: var(--ink-faint); margin-bottom: 4px; height: 14px; }
.bar { width: 100%; max-width: 28px; height: 100%; background: var(--line-soft); border-radius: 6px 6px 0 0; overflow: hidden; display: flex; align-items: flex-end; }
.bar-fill { width: 100%; background: linear-gradient(to top, var(--primary), var(--accent)); border-radius: 6px 6px 0 0; transition: height 0.6s ease; }
.bar-label { font-size: 11px; color: var(--ink-soft); margin-top: 6px; }

/* 学习路径 */
.path-steps { display: flex; flex-direction: column; gap: 14px; margin-bottom: 20px; }
.path-step { display: flex; align-items: center; gap: 14px; padding: 12px; background: var(--surface-2); border-radius: var(--radius-sm); border-left: 3px solid var(--line); }
.path-step.current { border-left-color: var(--accent); background: var(--accent-soft); }
.step-num {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px;
  flex-shrink: 0;
}
.path-step.current .step-num { background: var(--accent); }
.step-text strong { display: block; font-size: 14px; color: var(--ink); }
.step-text span { font-size: 12px; color: var(--ink-soft); }

.weak-areas { background: var(--surface-2); border-radius: var(--radius-sm); padding: 12px; }
.weak-title { font-size: 13px; font-weight: 600; color: var(--ink-soft); margin-bottom: 8px; }
.weak-item { display: flex; justify-content: space-between; padding: 6px 8px; border-radius: 6px; cursor: pointer; font-size: 13px; }
.weak-item:hover { background: var(--surface); }
.weak-pct { color: var(--accent-deep); font-weight: 600; }

.achievements-mini { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.mini-ach {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 12px 6px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  transition: all 0.2s;
}
.mini-ach.earned { background: var(--accent-soft); }
.mini-ach.locked { opacity: 0.4; filter: grayscale(0.6); }
.mini-ach-icon { font-size: 22px; }
.mini-ach-name { font-size: 11px; color: var(--ink-soft); text-align: center; }

.empty-state { text-align: center; padding: 40px 20px; color: var(--ink-faint); }
.empty-icon { font-size: 48px; margin-bottom: 12px; }

/* =============================================================================
   课程页
   ============================================================================= */
.level-nav { display: flex; gap: 10px; margin-bottom: 28px; flex-wrap: wrap; }
.level-chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 13px; font-weight: 600;
  transition: all 0.2s;
}
.level-chip:hover { border-color: var(--lv-color); transform: translateY(-1px); }
.level-chip-id { color: var(--lv-color); font-weight: 700; }
.level-chip-count {
  background: var(--lv-color); color: #fff;
  font-size: 11px;
  padding: 1px 8px;
  border-radius: 999px;
}

.level-section { margin-bottom: 36px; scroll-margin-top: 80px; }
.level-header {
  display: flex; align-items: center; gap: 16px;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 2px solid var(--line);
}
.level-badge {
  background: var(--lv-color); color: #fff;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-family: var(--font-display);
  font-weight: 700;
}
.level-name { font-family: var(--font-display); font-size: 22px; color: var(--primary); }
.level-desc { font-size: 13px; color: var(--ink-soft); }

.course-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 18px; }
.course-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  cursor: pointer;
  transition: all 0.25s;
  position: relative;
  overflow: hidden;
}
.course-card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0;
  height: 4px;
  background: var(--card-accent, var(--accent));
}
.course-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--card-accent); }
.course-card-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.course-level-badge { background: var(--card-accent); color: #fff; font-size: 11px; font-weight: 700; padding: 2px 10px; border-radius: 999px; }
.course-lang { font-size: 12px; color: var(--ink-faint); }
.course-title { font-family: var(--font-display); font-size: 18px; font-weight: 700; color: var(--ink); margin-bottom: 14px; }
.course-lessons { display: flex; gap: 6px; margin-bottom: 14px; }
.lesson-pill {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: var(--bg-2);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
}
.lesson-pill.done { background: var(--success); color: #fff; }
.course-progress { display: flex; align-items: center; gap: 10px; }
.progress-bar { flex: 1; height: 6px; background: var(--line-soft); border-radius: 3px; overflow: hidden; }
.progress-fill { height: 100%; background: linear-gradient(to right, var(--primary), var(--accent)); border-radius: 3px; transition: width 0.5s; }
.progress-text { font-size: 12px; color: var(--ink-soft); font-weight: 600; }

/* =============================================================================
   课程详情
   ============================================================================= */
.back-btn {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--ink-soft); font-size: 14px; font-weight: 500;
  margin-bottom: 20px;
  padding: 6px 0;
  transition: color 0.2s;
}
.back-btn:hover { color: var(--primary); }

.course-hero {
  background: linear-gradient(135deg, var(--surface) 0%, var(--ch-color) 400%);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 32px;
  margin-bottom: 28px;
  position: relative;
  overflow: hidden;
}
.course-hero-top { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.course-hero-level, .course-hero-unit {
  background: var(--ch-color); color: #fff;
  font-size: 12px; font-weight: 700;
  padding: 4px 12px; border-radius: 999px;
}
.course-hero-lang { background: var(--surface); border: 1px solid var(--line); padding: 4px 12px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.course-hero-title { font-family: var(--font-display); font-size: 36px; font-weight: 700; color: var(--primary); margin-bottom: 8px; }
.course-hero-desc { color: var(--ink-soft); margin-bottom: 24px; }

.course-hero-progress { display: flex; align-items: center; }
.ch-step { display: flex; align-items: center; }
.ch-step-num {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--line-soft);
  color: var(--ink-soft);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px;
}
.ch-step.done .ch-step-num { background: var(--success); color: #fff; }
.ch-step-line { width: 40px; height: 2px; background: var(--line-soft); }
.ch-step:last-child .ch-step-line { display: none; }
.ch-step.done .ch-step-line { background: var(--success); }

.lessons-list { display: flex; flex-direction: column; gap: 10px; }
.lesson-row {
  display: flex; align-items: center; gap: 16px;
  padding: 16px 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s;
}
.lesson-row:hover { transform: translateX(4px); border-color: var(--accent); box-shadow: var(--shadow); }
.lesson-row.done { opacity: 0.7; }
.lesson-row-num {
  width: 36px; height: 36px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; flex-shrink: 0;
}
.lesson-row-icon { font-size: 22px; flex-shrink: 0; }
.lesson-row-main { flex: 1; }
.lesson-row-type { font-size: 12px; font-weight: 600; }
.lesson-row-title { font-size: 15px; font-weight: 600; color: var(--ink); margin-top: 2px; }
.lesson-row-action { font-size: 13px; font-weight: 600; color: var(--ink-soft); }

/* =============================================================================
   学习模块通用
   ============================================================================= */
.page-lesson { max-width: 760px; margin: 0 auto; }
.lesson-head { display: flex; align-items: center; gap: 20px; margin-bottom: 28px; flex-wrap: wrap; }
.lesson-head-info { flex: 1; min-width: 200px; }
.lesson-head-badge {
  display: inline-flex; align-items: center; gap: 6px;
  color: #fff; font-size: 12px; font-weight: 700;
  padding: 4px 12px; border-radius: 999px;
  margin-bottom: 8px;
}
.lesson-head-title { font-family: var(--font-display); font-size: 28px; font-weight: 700; color: var(--primary); }
.lesson-head-level { font-size: 13px; color: var(--ink-soft); }

.module {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: var(--shadow-sm);
}
.module-progress { display: flex; align-items: center; gap: 12px; margin-bottom: 28px; }
.mp-bar { flex: 1; height: 6px; background: var(--line-soft); border-radius: 3px; overflow: hidden; }
.mp-fill { height: 100%; background: linear-gradient(to right, var(--primary), var(--accent)); border-radius: 3px; transition: width 0.4s; }
.mp-text { font-size: 13px; font-weight: 600; color: var(--ink-soft); }

/* 翻转卡片 */
.flashcard {
  width: 100%; height: 260px;
  perspective: 1200px;
  cursor: pointer;
  margin-bottom: 24px;
}
.fc-face {
  position: absolute; inset: 0;
  backface-visibility: hidden;
  border-radius: var(--radius-lg);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 32px;
  transition: transform 0.6s;
  text-align: center;
}
.fc-front {
  background: linear-gradient(135deg, var(--surface) 0%, var(--accent-soft) 100%);
  border: 2px solid var(--line);
}
.fc-back {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-deep) 100%);
  color: #fff;
  transform: rotateY(180deg);
}
.flashcard.flipped .fc-front { transform: rotateY(180deg); }
.flashcard.flipped .fc-back { transform: rotateY(0deg); }
.fc-word { font-family: var(--font-display); font-size: 48px; font-weight: 700; color: var(--primary); margin-bottom: 8px; }
.fc-pos { font-size: 14px; color: var(--ink-soft); margin-bottom: 20px; }
.fc-hint { font-size: 13px; color: var(--ink-faint); }
.fc-meaning { font-family: var(--font-display); font-size: 36px; font-weight: 700; margin-bottom: 16px; }
.fc-example { font-size: 16px; color: rgba(255,255,255,0.8); font-style: italic; }

.vocab-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin-bottom: 20px; }
.vocab-summary { text-align: center; padding-top: 16px; border-top: 1px solid var(--line); color: var(--ink-soft); }
.vocab-summary strong { color: var(--accent-deep); font-size: 18px; }
.vocab-summary .btn { margin-top: 12px; }

/* 语法 */
.grammar-intro { margin-bottom: 24px; padding: 16px; background: var(--surface-2); border-radius: var(--radius-sm); border-left: 3px solid var(--accent); }
.grammar-intro h3 { font-family: var(--font-display); color: var(--primary); margin-bottom: 4px; }
.grammar-intro p { font-size: 14px; color: var(--ink-soft); }
.grammar-q { text-align: center; }
.gq-num { font-size: 13px; color: var(--ink-faint); margin-bottom: 12px; }
.gq-text { font-family: var(--font-display); font-size: 28px; font-weight: 600; color: var(--ink); margin-bottom: 28px; line-height: 1.4; }
.gq-options { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 24px; }
.gq-option {
  padding: 16px;
  background: var(--surface);
  border: 2px solid var(--line);
  border-radius: var(--radius);
  font-size: 18px; font-weight: 600;
  color: var(--ink);
  transition: all 0.2s;
}
.gq-option:hover { border-color: var(--accent); background: var(--accent-soft); }
.gq-option.selected { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }
.grammar-result { text-align: center; padding: 20px; }
.grammar-result.correct { background: #ECFDF5; border-radius: var(--radius); }
.grammar-result.wrong { background: #FEF2F2; border-radius: var(--radius); }
.gr-icon { font-size: 48px; }
.grammar-result.correct .gr-icon { color: var(--success); }
.grammar-result.wrong .gr-icon { color: var(--danger); }
.gr-title { font-family: var(--font-display); font-size: 22px; font-weight: 700; margin: 8px 0; }
.gr-explain { color: var(--ink-soft); margin-bottom: 12px; }
.gr-answer { margin-bottom: 16px; }
.gr-answer strong { color: var(--accent-deep); }

.lesson-summary { text-align: center; padding: 24px; }
.ls-icon { font-size: 56px; margin-bottom: 12px; }
.lesson-summary h2 { font-family: var(--font-display); font-size: 28px; color: var(--primary); margin-bottom: 8px; }
.ls-actions { display: flex; gap: 12px; justify-content: center; margin-top: 20px; }

/* 听力 */
.listen-player { text-align: center; padding: 20px; }
.play-btn {
  width: 120px; height: 120px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-deep));
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 20px;
  box-shadow: 0 8px 24px rgba(26, 58, 74, 0.3);
  transition: all 0.2s;
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 8px 24px rgba(26, 58, 74, 0.3); }
  50% { box-shadow: 0 8px 32px rgba(217, 119, 6, 0.5); }
}
.play-btn:hover { transform: scale(1.05); }
.play-icon { font-size: 40px; margin-left: 6px; }
.play-hint { color: var(--ink-soft); margin-bottom: 20px; }
.listen-controls { display: flex; gap: 10px; justify-content: center; margin-bottom: 20px; flex-wrap: wrap; }
.listen-text {
  max-height: 0; overflow: hidden;
  transition: all 0.3s;
  background: var(--surface-2);
  border-radius: var(--radius);
  padding: 0 20px;
}
.listen-text.show { max-height: 200px; padding: 20px; margin-bottom: 20px; }
.lt-original { font-family: var(--font-display); font-size: 22px; color: var(--primary); margin-bottom: 6px; }
.lt-meaning { color: var(--ink-soft); }

/* 口语 */
.speak-card { text-align: center; padding: 20px; }
.speak-target {
  font-family: var(--font-display);
  font-size: 32px; font-weight: 600;
  color: var(--primary);
  padding: 32px 20px;
  background: var(--accent-soft);
  border-radius: var(--radius);
  margin-bottom: 20px;
  line-height: 1.4;
}
.speak-record { margin: 24px 0; }
.record-btn {
  display: inline-flex; align-items: center; gap: 12px;
  padding: 16px 32px;
  background: var(--surface);
  border: 2px solid var(--line);
  border-radius: 999px;
  font-size: 15px; font-weight: 600;
  color: var(--ink);
  transition: all 0.2s;
}
.record-btn:hover { border-color: var(--danger); }
.record-btn.recording { background: #FEF2F2; border-color: var(--danger); color: var(--danger); }
.record-dot {
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--danger);
  animation: blink 1s infinite;
}
.record-btn.recording .record-dot { animation: blink 0.5s infinite; }
@keyframes blink { 50% { opacity: 0.3; } }
.speak-result { margin-top: 16px; }
.speak-recognized { color: var(--ink-soft); font-style: italic; margin-bottom: 8px; }
.speak-score { font-weight: 700; font-size: 18px; }
.speak-score.good { color: var(--success); }
.speak-score.mid { color: var(--warning); }
.speak-score.low { color: var(--danger); }
.speak-no-support { color: var(--warning); padding: 12px; background: #FFFBEB; border-radius: var(--radius-sm); }
.speak-tip { color: var(--ink-faint); font-size: 13px; margin: 16px 0; }

/* =============================================================================
   训练中心
   ============================================================================= */
.practice-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 20px; }
.practice-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 28px;
  border-top: 4px solid var(--pc-color);
  transition: all 0.25s;
}
.practice-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.pc-icon { font-size: 40px; margin-bottom: 12px; }
.practice-card h3 { font-family: var(--font-display); font-size: 22px; color: var(--primary); margin-bottom: 6px; }
.practice-card p { color: var(--ink-soft); font-size: 14px; margin-bottom: 20px; }
.pc-courses { display: flex; flex-direction: column; gap: 8px; }
.pc-course-btn {
  text-align: left;
  padding: 10px 14px;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 500;
  color: var(--ink);
  transition: all 0.2s;
}
.pc-course-btn:hover { background: var(--accent-soft); color: var(--accent-deep); }

/* =============================================================================
   进度页
   ============================================================================= */
.progress-overview {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 20px;
  margin-bottom: 32px;
}
.po-main {
  display: flex; align-items: center; gap: 32px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 32px;
}
.po-circle {
  width: 140px; height: 140px;
  border-radius: 50%;
  background: conic-gradient(var(--accent) calc(var(--pct) * 1%), var(--line-soft) 0);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  flex-shrink: 0;
  position: relative;
}
.po-circle::before {
  content: '';
  position: absolute; inset: 12px;
  background: var(--surface);
  border-radius: 50%;
}
.po-pct { position: relative; font-family: var(--font-display); font-size: 32px; font-weight: 700; color: var(--primary); }
.po-label { position: relative; font-size: 12px; color: var(--ink-soft); }
.po-details { flex: 1; display: flex; flex-direction: column; gap: 10px; }
.po-row { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px dashed var(--line-soft); }
.po-row:last-child { border-bottom: none; }
.po-row span { color: var(--ink-soft); }
.po-row strong { color: var(--ink); font-family: var(--font-display); font-size: 18px; }

.po-radar {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 24px;
  text-align: center;
}
.po-radar h3 { font-family: var(--font-display); color: var(--primary); margin-bottom: 12px; }
.radar-svg { width: 100%; max-width: 280px; height: auto; }
.radar-label { font-size: 12px; fill: var(--ink-soft); font-weight: 600; }

.progress-section { margin-bottom: 32px; }
.progress-section h2 { font-family: var(--font-display); font-size: 22px; color: var(--primary); margin-bottom: 16px; }

.unit-progress-list { display: flex; flex-direction: column; gap: 10px; }
.unit-progress {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s;
  gap: 16px;
}
.unit-progress:hover { border-color: var(--accent); transform: translateX(3px); }
.up-left { display: flex; align-items: center; gap: 12px; flex: 1; }
.up-level { color: #fff; font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: 6px; }
.up-title { font-weight: 600; }
.up-right { display: flex; align-items: center; gap: 12px; min-width: 160px; }
.up-bar { flex: 1; height: 8px; background: var(--line-soft); border-radius: 4px; overflow: hidden; }
.up-fill { height: 100%; background: linear-gradient(to right, var(--primary), var(--accent)); border-radius: 4px; }
.up-pct { font-weight: 700; color: var(--ink-soft); min-width: 40px; text-align: right; }

.log-list { display: flex; flex-direction: column; gap: 8px; }
.log-row { display: flex; align-items: center; gap: 12px; padding: 8px 12px; background: var(--surface); border-radius: var(--radius-sm); }
.log-date { width: 60px; font-size: 13px; color: var(--ink-soft); font-family: var(--font-display); font-weight: 600; }
.log-bar { flex: 1; height: 8px; background: var(--line-soft); border-radius: 4px; overflow: hidden; }
.log-fill { height: 100%; background: linear-gradient(to right, var(--primary), var(--accent)); border-radius: 4px; }
.log-xp { width: 60px; text-align: right; font-size: 13px; font-weight: 600; color: var(--accent-deep); }

/* =============================================================================
   社区
   ============================================================================= */
.post-form {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 24px;
}
.pf-row { display: flex; gap: 10px; margin-bottom: 12px; }
.pf-row input { flex: 1; padding: 10px 14px; border: 1.5px solid var(--line); border-radius: var(--radius-sm); background: var(--bg); }
.pf-row select { padding: 10px 14px; border: 1.5px solid var(--line); border-radius: var(--radius-sm); background: var(--bg); }
.pf-row input:focus, .pf-row select:focus, textarea:focus { outline: none; border-color: var(--accent); }
.post-form textarea { width: 100%; padding: 12px 14px; border: 1.5px solid var(--line); border-radius: var(--radius-sm); background: var(--bg); resize: vertical; margin-bottom: 12px; }
.pf-actions { display: flex; justify-content: flex-end; gap: 10px; }

.posts-list { display: flex; flex-direction: column; gap: 16px; }
.post {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 22px;
  transition: all 0.2s;
}
.post:hover { border-color: var(--accent); box-shadow: var(--shadow-sm); }
.post-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.post-avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--primary-soft);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
}
.post-meta { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-soft); }
.post-author { font-weight: 700; color: var(--ink); }
.post-lang-tag { font-size: 16px; }
.post-title { font-family: var(--font-display); font-size: 18px; color: var(--primary); margin-bottom: 6px; }
.post-content { color: var(--ink-soft); line-height: 1.6; margin-bottom: 14px; }
.post-foot { display: flex; align-items: center; justify-content: space-between; }
.post-replies-count { font-size: 13px; color: var(--ink-faint); }

.replies { margin-top: 16px; padding-top: 16px; border-top: 1px dashed var(--line); }
.reply { display: flex; gap: 10px; margin-bottom: 12px; }
.reply-avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--accent-soft);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; flex-shrink: 0;
}
.reply-meta { display: flex; gap: 8px; font-size: 12px; color: var(--ink-faint); margin-bottom: 2px; }
.reply-meta span:first-child { font-weight: 600; color: var(--ink); }
.reply p { font-size: 14px; color: var(--ink-soft); }
.reply-input { display: flex; gap: 8px; margin-top: 12px; }
.reply-input input { flex: 1; padding: 8px 12px; border: 1.5px solid var(--line); border-radius: var(--radius-sm); background: var(--bg); font-size: 13px; }
.reply-input input:focus { outline: none; border-color: var(--accent); }

/* =============================================================================
   成就页
   ============================================================================= */
.ach-progress { display: flex; align-items: center; gap: 12px; min-width: 200px; }
.ap-bar { flex: 1; height: 8px; background: var(--line-soft); border-radius: 4px; overflow: hidden; }
.ap-fill { height: 100%; background: linear-gradient(to right, var(--accent), var(--accent-deep)); border-radius: 4px; }
.ach-progress span { font-weight: 700; color: var(--accent-deep); }

.achievements-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 16px; }
.achievement {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  text-align: center;
  transition: all 0.25s;
  position: relative;
}
.achievement.earned {
  border-color: var(--accent);
  background: linear-gradient(135deg, var(--surface) 0%, var(--accent-soft) 100%);
  box-shadow: var(--shadow);
}
.achievement.locked { opacity: 0.5; filter: grayscale(0.7); }
.achievement:hover { transform: translateY(-3px); }
.ach-icon { font-size: 44px; margin-bottom: 10px; }
.ach-name { font-family: var(--font-display); font-size: 16px; font-weight: 700; color: var(--primary); margin-bottom: 4px; }
.ach-desc { font-size: 12px; color: var(--ink-soft); margin-bottom: 10px; }
.ach-earned { font-size: 11px; color: var(--success); font-weight: 700; }
.ach-locked { font-size: 11px; color: var(--ink-faint); }

/* =============================================================================
   Toast
   ============================================================================= */
#toast-container { position: fixed; top: 20px; right: 20px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; }
.toast {
  padding: 12px 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  font-size: 14px; font-weight: 500;
  transform: translateX(120%);
  transition: transform 0.3s ease;
  max-width: 320px;
}
.toast.show { transform: translateX(0); }
.toast-success { border-left: 4px solid var(--success); }
.toast-error { border-left: 4px solid var(--danger); }
.toast-info { border-left: 4px solid var(--primary); }

/* ==================== 语音诊断面板 ==================== */
.voice-diag { max-width: 880px; margin: 0 auto; }
.voice-diag h2 { font-family: var(--font-display); font-size: 1.8rem; margin-bottom: 4px; }
.voice-diag h3 { font-size: 1.1rem; margin: 24px 0 12px; color: var(--text); }
.voice-sub { color: var(--text-muted); margin-bottom: 20px; font-size: .9rem; }

.voice-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 8px; }
.voice-card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 16px; text-align: center; }
.voice-card.ok { border-color: #10B981; }
.voice-card.bad { border-color: var(--danger); }
.vc-label { font-size: .75rem; color: var(--text-muted); margin-bottom: 6px; }
.vc-value { font-size: 1.1rem; font-weight: 700; }

.voice-table { width: 100%; border-collapse: collapse; font-size: .85rem; margin-bottom: 8px; }
.voice-table th { text-align: left; padding: 8px; border-bottom: 2px solid var(--line); color: var(--text-muted); }
.voice-table td { padding: 8px; border-bottom: 1px solid var(--line); }
.voice-table code { font-size: .78rem; background: rgba(255,255,255,.06); padding: 2px 6px; border-radius: 4px; }

.voice-test-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.voice-test-input { flex: 1; min-width: 200px; padding: 10px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; color: var(--text); font-size: .9rem; }

/* 语音诊断面板：试听/扬声器测试 控件（独立 class，避免与顶部 lang-select 冲突） */
.vt-lang {
  position: static !important; opacity: 1 !important; visibility: visible !important;
  padding: 10px 12px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 10px; color: var(--ink); font-size: .9rem; cursor: pointer;
  -webkit-appearance: menulist; appearance: menulist;
}
.vt-text {
  flex: 1; min-width: 200px; padding: 10px 12px; background: var(--surface);
  border: 1px solid var(--line); border-radius: 10px; color: var(--ink); font-size: .9rem;
}
.vt-btn {
  position: relative; z-index: auto; pointer-events: auto;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}

.voice-all-list { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px; }
.voice-all-list details { margin-bottom: 6px; }
.voice-all-list summary { cursor: pointer; font-weight: 600; padding: 4px 0; }
.voice-sub-list { list-style: none; padding-left: 12px; margin-top: 6px; }
.voice-sub-list li { padding: 3px 0; font-size: .82rem; display: flex; align-items: center; gap: 6px; }
.vtag { font-size: .65rem; padding: 1px 6px; border-radius: 4px; font-weight: 700; }
.vtag-f { background: rgba(244,114,182,.15); color: #F472B6; }
.vtag-m { background: rgba(59,130,246,.15); color: #60A5FA; }
.vtag-u { background: rgba(156,163,175,.15); color: #9CA3AF; }

.voice-tips details { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px; margin-bottom: 8px; }
.voice-tips summary { cursor: pointer; font-weight: 600; }
.voice-tips ul { margin: 8px 0 0 16px; }
.voice-tips li { padding: 4px 0; font-size: .85rem; line-height: 1.5; }

@media (max-width: 640px) {
  .voice-cards { grid-template-columns: 1fr; }
  .voice-test-row { flex-direction: column; align-items: stretch; }
  .voice-test-input { width: 100%; }
}

/* =============================================================================
   响应式
   ============================================================================= */
@media (max-width: 960px) {
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-hero { padding: 40px; }
  .auth-hero h1 { font-size: 40px; }
  .dash-grid { grid-template-columns: 1fr; }
  .progress-overview { grid-template-columns: 1fr; }
  .po-main { flex-direction: column; text-align: center; }
  .nav-label { display: none; }
  .nav-item { padding: 8px 10px; }
}
@media (max-width: 640px) {
  .app-inner { padding: 0 14px 40px; }
  .topbar { padding: 12px 14px; gap: 10px; }
  .brand-text { display: none; }
  .hero-section { flex-direction: column; padding: 24px; text-align: center; }
  .hero-stats { flex-wrap: wrap; justify-content: center; }
  .stat-bubble { min-width: 90px; padding: 14px; }
  .hero-title { font-size: 28px; }
  .page-title { font-size: 28px; }
  .gq-options { grid-template-columns: 1fr; }
  .module { padding: 20px; }
  .fc-word { font-size: 36px; }
  .course-hero-title { font-size: 26px; }
  .po-circle { width: 110px; height: 110px; }
}
