/* ========================================
   门窗外贸英语学习平台 - 核心样式
   PC端优先，移动端自适应
   ======================================== */

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

:root {
  /* 主题色 */
  --accent: #2563eb;
  --accent2: #0ea5e9;
  --success: #10b981;
  --success-light: #ecfdf5;
  --warning: #f59e0b;
  --warning-light: #fffbeb;
  --danger: #ef4444;
  --danger-light: #fef2f2;

  /* 背景 / 文字 */
  --bg: #f8fafc;
  --bg2: #ffffff;
  --ink: #1e293b;
  --muted: #64748b;
  --rule: #e2e8f0;

  /* 侧边栏 */
  --sidebar-bg: #1e293b;
  --sidebar-text: #94a3b8;
  --sidebar-active: #2563eb;

  /* 阴影 */
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);

  /* 圆角 */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-full: 999px;

  /* 过渡 */
  --transition: all 0.3s ease;

  /* 侧边栏宽度 */
  --sidebar-width: 240px;

  /* 兼容旧变量名 */
  --primary: #2563eb;
  --primary-light: #3b82f6;
  --primary-dark: #1d4ed8;
  --bg-white: #ffffff;
  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --text-light: #94a3b8;
  --border: #e2e8f0;
  --error: #ef4444;
  --error-light: #fef2f2;
}

html {
  font-size: 16px;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans SC', sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ========================================
   侧边栏（PC端默认显示）
   ======================================== */
.sidebar {
  position: fixed;
  left: 0;
  top: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  z-index: 200;
  overflow-y: auto;
  transition: var(--transition);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 24px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.sidebar-logo .logo-icon {
  width: 36px;
  height: 36px;
  background: var(--sidebar-active);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sidebar-logo .logo-icon svg {
  width: 20px;
  height: 20px;
  color: #fff;
}

.sidebar-logo .logo-text,
.sidebar-logo-text {
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.3;
}

.sidebar-logo .logo-subtext,
.sidebar-logo-text span {
  color: var(--sidebar-text);
  font-size: 11px;
  font-weight: 400;
  display: block;
}

/* 侧边栏导航 */
.sidebar-nav {
  flex: 1;
  padding: 16px 0;
}

.sidebar-nav-item,
.sidebar-nav .nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  transition: var(--transition);
  position: relative;
  border-left: 3px solid transparent;
}

.sidebar-nav-item svg,
.sidebar-nav .nav-link svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.sidebar-nav-item:hover,
.sidebar-nav .nav-link:hover {
  color: #fff;
  background: rgba(255,255,255,0.06);
}

.sidebar-nav-item.active,
.sidebar-nav .nav-link.active {
  color: #fff;
  background: rgba(37, 99, 235, 0.15);
  border-left-color: var(--sidebar-active);
}

.sidebar-nav-item.active svg,
.sidebar-nav .nav-link.active svg {
  color: var(--sidebar-active);
}

/* 侧边栏底部 */
.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,0.08);
}

.sidebar-footer .sidebar-settings-btn,
.sidebar-footer .nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  color: var(--sidebar-text);
  background: none;
  border: none;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  width: 100%;
  text-align: left;
  transition: var(--transition);
}

.sidebar-footer .sidebar-settings-btn svg,
.sidebar-footer .nav-link svg {
  width: 18px;
  height: 18px;
}

.sidebar-footer .sidebar-settings-btn:hover,
.sidebar-footer .nav-link:hover {
  color: #fff;
}

.sidebar-footer .sidebar-version {
  font-size: 11px;
  color: rgba(148, 163, 184, 0.6);
  margin-top: 8px;
}

/* ========================================
   主内容区（PC端）
   ======================================== */
.app-container {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
}

.main-area {
  max-width: 960px;
  margin: 0 auto;
  padding: 2rem;
}

/* ========================================
   顶部导航栏（保留用于移动端和learn.html）
   ======================================== */
.top-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg2);
  border-bottom: 1px solid var(--rule);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
}

.top-nav .btn-back {
  display: flex;
  align-items: center;
  gap: 4px;
  background: none;
  border: none;
  color: var(--accent);
  font-size: 15px;
  cursor: pointer;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.top-nav .btn-back:hover {
  background: rgba(37, 99, 235, 0.08);
}

.top-nav .btn-back svg {
  width: 20px;
  height: 20px;
}

.top-nav .nav-title {
  flex: 1;
  text-align: center;
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 0 8px;
}

.top-nav .nav-progress {
  font-size: 13px;
  color: var(--muted);
  background: var(--bg);
  padding: 4px 10px;
  border-radius: var(--radius-full);
  white-space: nowrap;
  font-weight: 500;
}

/* ========================================
   Header（index.html页面头部，PC端隐藏或替换为侧边栏）
   ======================================== */
.header {
  background: var(--bg2);
  border-bottom: 1px solid var(--rule);
  padding: 12px 16px;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-logo {
  width: 36px;
  height: 36px;
  background: var(--accent);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
}

.header-logo svg {
  width: 20px;
  height: 20px;
}

.header-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
}

.header-subtitle {
  font-size: 11px;
  color: var(--muted);
}

.header-right {
  display: flex;
  gap: 8px;
}

.header-btn {
  width: 36px;
  height: 36px;
  background: var(--bg);
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--muted);
  transition: var(--transition);
}

.header-btn svg {
  width: 18px;
  height: 18px;
}

.header-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ========================================
   统计横幅（PC端3列网格）
   ======================================== */
.stats-banner {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  background: var(--bg2);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px 16px;
  gap: 4px;
}

.stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--accent);
  line-height: 1.2;
}

.stat-value.secondary {
  color: var(--accent2);
}

.stat-value.success {
  color: var(--success);
}

.stat-label {
  font-size: 13px;
  color: var(--muted);
  font-weight: 500;
}

.stat-divider {
  display: none;
}

/* ========================================
   每日贴士
   ======================================== */
.daily-tip {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px;
  background: var(--bg2);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--rule);
}

.daily-tip-icon {
  width: 36px;
  height: 36px;
  background: var(--warning-light);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--warning);
}

.daily-tip-icon svg {
  width: 20px;
  height: 20px;
}

.daily-tip-content {
  flex: 1;
  min-width: 0;
}

.daily-tip-label {
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 4px;
}

.daily-tip-text {
  font-size: 14px;
  color: var(--ink);
  line-height: 1.5;
}

.daily-tip-text-en {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
  margin-top: 2px;
}

/* ========================================
   Section Header
   ======================================== */
.section {
  margin-top: 24px;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
}

.section-title-icon {
  display: flex;
  align-items: center;
  color: var(--accent);
}

.section-title-icon svg {
  width: 13px;
  height: 13px;
}

.section-more {
  font-size: 13px;
  color: var(--muted);
  font-weight: 500;
}

/* ========================================
   筛选标签（水平排列）
   ======================================== */
.filter-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.filter-tab {
  padding: 8px 18px;
  border: 1.5px solid var(--rule);
  border-radius: var(--radius-full);
  background: var(--bg2);
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}

.filter-tab:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.filter-tab.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* ========================================
   课程卡片网格（PC端多列）
   ======================================== */
.course-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.course-card {
  background: var(--bg2);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  position: relative;
  display: flex;
  flex-direction: column;
}

.course-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.course-card.completed {
  opacity: 0.85;
}

.course-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 16px 16px 0;
  position: relative;
}

/* 左侧等级色条 */
.course-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--muted);
  transition: background 0.3s ease;
}

.course-card[data-level="beginner"]::before,
.course-card.beginner::before {
  background: var(--success);
}

.course-card[data-level="intermediate"]::before,
.course-card.intermediate::before {
  background: var(--warning);
}

.course-card[data-level="advanced"]::before,
.course-card.advanced::before {
  background: var(--danger);
}

.course-unit {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

.course-unit-badge {
  width: 36px;
  height: 36px;
  background: var(--accent);
  color: #fff;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  flex-shrink: 0;
}

.course-titles {
  flex: 1;
  min-width: 0;
}

.course-title-cn {
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.course-title-en {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.course-level-tag {
  display: inline-block;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
  flex-shrink: 0;
  margin-left: 8px;
}

.course-level-tag.beginner {
  background: var(--success-light);
  color: var(--success);
}

.course-level-tag.intermediate {
  background: var(--warning-light);
  color: var(--warning);
}

.course-level-tag.advanced {
  background: var(--danger-light);
  color: var(--danger);
}

.course-desc {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
  padding: 8px 16px 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.course-meta {
  display: flex;
  gap: 16px;
  padding: 10px 16px 0;
  font-size: 12px;
  color: var(--muted);
}

.course-meta-item {
  display: flex;
  align-items: center;
  gap: 4px;
}

.course-meta-item svg {
  width: 14px;
  height: 14px;
  color: var(--muted);
}

.course-meta-item .count {
  font-weight: 600;
  color: var(--ink);
}

/* 课程卡片进度条 */
.progress-wrapper {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px 16px;
  margin-top: auto;
}

.progress-wrapper .progress-bar {
  flex: 1;
  height: 4px;
  background: var(--rule);
  border-radius: 2px;
  overflow: hidden;
}

.progress-wrapper .progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  border-radius: 2px;
  transition: width 0.4s ease;
}

.progress-wrapper .progress-fill.complete {
  background: var(--success);
}

.progress-text {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  flex-shrink: 0;
  min-width: 36px;
  text-align: right;
}

.progress-text.complete {
  color: var(--success);
}

/* 空状态 */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
}

.empty-state-icon {
  width: 64px;
  height: 64px;
  color: var(--rule);
  margin-bottom: 16px;
}

.empty-state-icon svg {
  width: 100%;
  height: 100%;
}

.empty-state-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 8px;
}

.empty-state-desc {
  font-size: 14px;
  color: var(--muted);
  max-width: 300px;
}

/* ========================================
   底部Tab栏（移动端显示，PC端隐藏）
   ======================================== */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 150;
  background: var(--bg2);
  border-top: 1px solid var(--rule);
  display: none; /* PC端默认隐藏 */
  padding: 6px 0;
  padding-bottom: calc(6px + env(safe-area-inset-bottom, 0px));
  box-shadow: 0 -1px 8px rgba(0,0,0,0.06);
}

.bottom-nav .nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 4px 0;
  text-decoration: none;
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  transition: var(--transition);
}

.bottom-nav .nav-item svg {
  width: 22px;
  height: 22px;
}

.bottom-nav .nav-item.active {
  color: var(--accent);
}

.bottom-nav .nav-item:hover {
  color: var(--accent);
}

/* 底部导航flex容器（移动端显示时生效） */
.bottom-nav {
  justify-content: space-around;
}

/* ========================================
   Mode Tabs（学习页面的模式切换）
   ======================================== */
.mode-tabs {
  background: var(--bg2);
  display: flex;
  padding: 0 16px;
  gap: 4px;
  border-bottom: 1px solid var(--rule);
}

.mode-tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 8px;
  background: none;
  border: none;
  border-bottom: 2.5px solid transparent;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}

.mode-tab svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.mode-tab.active {
  color: #FFFFFF;
  background: var(--accent);
  border-bottom-color: var(--accent);
}

.mode-tab:hover {
  color: var(--primary-light);
  background: rgba(37, 99, 235, 0.04);
}

/* ========================================
   Main Content Area（学习页面）
   ======================================== */
.main-content {
  padding: 20px 16px 100px;
  max-width: 700px;
  margin: 0 auto;
}

/* ========================================
   Progress Bar（全局进度条）
   ======================================== */
.progress-bar-container {
  padding: 0 16px;
  background: var(--bg2);
}

.progress-bar-container .progress-bar {
  height: 3px;
  background: var(--rule);
  border-radius: 2px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  border-radius: 2px;
  transition: width 0.4s ease;
}

/* ========================================
   Sentence Card（共享组件）
   ======================================== */
.sentence-card {
  background: var(--bg2);
  border-radius: var(--radius-lg);
  padding: 24px 20px;
  box-shadow: var(--shadow-md);
  margin-bottom: 16px;
}

.sentence-card .label {
  font-size: 12px;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
  font-weight: 600;
}

.sentence-card .en-text {
  font-size: 22px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.5;
  margin-bottom: 8px;
  word-break: break-word;
}

.sentence-card .cn-text {
  font-size: 16px;
  color: var(--muted);
  line-height: 1.5;
  margin-bottom: 8px;
}

.sentence-card .phonetic {
  font-size: 14px;
  color: var(--text-light);
  font-family: 'Lucida Sans Unicode', 'Arial Unicode MS', sans-serif;
  margin-bottom: 4px;
}

/* ========================================
   Play Button
   ======================================== */
.btn-play {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: var(--radius-full);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}

.btn-play:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
}

.btn-play:active {
  transform: translateY(0);
}

.btn-play.playing {
  animation: pulse-play 1s infinite;
}

.btn-play svg {
  width: 18px;
  height: 18px;
}

@keyframes pulse-play {
  0%, 100% { box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3); }
  50% { box-shadow: 0 2px 20px rgba(37, 99, 235, 0.6); }
}

/* ========================================
   Favorite Button
   ======================================== */
.btn-fav {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: none;
  border: 2px solid var(--rule);
  border-radius: 50%;
  cursor: pointer;
  transition: var(--transition);
  color: var(--text-light);
}

.btn-fav:hover {
  border-color: var(--danger);
  color: var(--danger);
}

.btn-fav.active {
  background: var(--danger);
  border-color: var(--danger);
  color: white;
}

.btn-fav svg {
  width: 20px;
  height: 20px;
}

/* ========================================
   Navigation Buttons (prev/next)
   ======================================== */
.nav-buttons {
  display: flex;
  gap: 12px;
  margin-top: 20px;
}

.btn-nav {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 16px;
  background: var(--bg2);
  border: 1.5px solid var(--rule);
  border-radius: var(--radius-md);
  color: var(--ink);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}

.btn-nav:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(37, 99, 235, 0.04);
}

.btn-nav:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-nav:disabled:hover {
  border-color: var(--rule);
  color: var(--ink);
  background: var(--bg2);
}

.btn-nav svg {
  width: 18px;
  height: 18px;
}

/* ========================================
   Learn Mode Specific
   ======================================== */
.learn-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--rule);
}

.learn-actions-left {
  display: flex;
  gap: 10px;
}

/* ========================================
   Puzzle Mode
   ======================================== */
.puzzle-answer-area {
  min-height: 56px;
  background: var(--bg);
  border: 2px dashed var(--rule);
  border-radius: var(--radius-md);
  padding: 12px;
  margin-bottom: 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  transition: var(--transition);
}

.puzzle-answer-area.has-words {
  border-color: var(--primary-light);
  border-style: solid;
}

.puzzle-answer-area.correct {
  border-color: var(--success);
  background: var(--success-light);
}

.puzzle-answer-area .placeholder-text {
  color: var(--text-light);
  font-size: 14px;
  width: 100%;
  text-align: center;
}

.puzzle-word-btn {
  display: inline-flex;
  align-items: center;
  padding: 8px 16px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  animation: wordPop 0.2s ease;
}

.puzzle-word-btn:hover {
  background: var(--primary-dark);
}

.puzzle-word-btn.selected {
  background: var(--text-light);
  color: white;
  cursor: default;
}

@keyframes wordPop {
  0% { transform: scale(0.8); opacity: 0.5; }
  100% { transform: scale(1); opacity: 1; }
}

.puzzle-word-pool {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}

.puzzle-word-pool .puzzle-word-btn {
  background: var(--bg2);
  color: var(--ink);
  border: 1.5px solid var(--rule);
  box-shadow: var(--shadow-sm);
}

.puzzle-word-pool .puzzle-word-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(37, 99, 235, 0.04);
}

.puzzle-controls {
  display: flex;
  gap: 10px;
}

.btn-puzzle-ctrl {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  background: var(--bg2);
  border: 1.5px solid var(--rule);
  border-radius: var(--radius-full);
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}

.btn-puzzle-ctrl:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.btn-puzzle-ctrl svg {
  width: 16px;
  height: 16px;
}

/* Correct animation */
.correct-feedback {
  display: none;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: var(--success-light);
  border: 1px solid var(--success);
  border-radius: var(--radius-sm);
  color: var(--success);
  font-size: 14px;
  font-weight: 600;
  margin-top: 12px;
  animation: slideUp 0.3s ease;
}

.correct-feedback.show {
  display: flex;
}

@keyframes slideUp {
  0% { transform: translateY(10px); opacity: 0; }
  100% { transform: translateY(0); opacity: 1; }
}

/* ========================================
   Dictation Mode
   ======================================== */
.dictation-input-area {
  margin-top: 16px;
}

.dictation-input {
  width: 100%;
  padding: 14px 16px;
  border: 2px solid var(--rule);
  border-radius: var(--radius-md);
  font-size: 16px;
  color: var(--ink);
  background: var(--bg2);
  transition: var(--transition);
  outline: none;
  font-family: inherit;
}

.dictation-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.dictation-input.correct {
  border-color: var(--success);
  background: var(--success-light);
}

.dictation-input.wrong {
  border-color: var(--danger);
  background: var(--danger-light);
}

.btn-submit {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 14px;
  margin-top: 12px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.btn-submit:hover {
  background: var(--primary-dark);
}

.btn-submit:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.dictation-result {
  margin-top: 16px;
  display: none;
}

.dictation-result.show {
  display: block;
  animation: slideUp 0.3s ease;
}

.dictation-result .result-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 14px;
  font-weight: 600;
}

.dictation-result .result-header.correct {
  color: var(--success);
}

.dictation-result .result-header.wrong {
  color: var(--danger);
}

.dictation-result .result-detail {
  font-size: 14px;
  color: var(--muted);
  line-height: 1.8;
}

.dictation-result .diff-word {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 4px;
  margin: 2px;
}

.dictation-result .diff-word.correct {
  background: var(--success-light);
  color: var(--success);
  text-decoration: line-through;
  text-decoration-color: var(--success);
}

.dictation-result .diff-word.wrong {
  background: var(--danger-light);
  color: var(--danger);
  text-decoration: line-through;
  text-decoration-color: var(--danger);
}

.dictation-result .diff-word.missing {
  background: #fffbeb;
  color: var(--warning);
}

.dictation-score {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  padding: 10px 16px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--muted);
}

.dictation-score .score-value {
  font-size: 20px;
  font-weight: 700;
  color: var(--accent);
}

/* ========================================
   Speaking Mode
   ======================================== */
.speaking-area {
  margin-top: 16px;
}

.btn-record {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 16px;
  background: var(--bg2);
  border: 2px solid var(--rule);
  border-radius: var(--radius-md);
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
  transition: var(--transition);
}

.btn-record:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.btn-record.recording {
  border-color: var(--danger);
  color: var(--danger);
  background: var(--danger-light);
  animation: pulse-record 1.5s infinite;
}

.btn-record svg {
  width: 22px;
  height: 22px;
}

@keyframes pulse-record {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.3); }
  50% { box-shadow: 0 0 0 12px rgba(239, 68, 68, 0); }
}

.speaking-result {
  margin-top: 16px;
  display: none;
}

.speaking-result.show {
  display: block;
  animation: slideUp 0.3s ease;
}

.speaking-result .recognized-text {
  padding: 14px 16px;
  background: var(--bg);
  border-radius: var(--radius-md);
  font-size: 16px;
  color: var(--ink);
  margin-bottom: 12px;
}

.speaking-result .recognized-text .label {
  font-size: 12px;
  color: var(--text-light);
  margin-bottom: 4px;
}

.speaking-comparison {
  padding: 14px 16px;
  background: var(--bg2);
  border: 1px solid var(--rule);
  border-radius: var(--radius-md);
}

.speaking-comparison .compare-row {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 14px;
  line-height: 1.6;
}

.speaking-comparison .compare-row:last-child {
  margin-bottom: 0;
}

.speaking-comparison .compare-label {
  flex-shrink: 0;
  font-weight: 600;
  color: var(--muted);
  min-width: 50px;
}

.speaking-comparison .compare-value {
  flex: 1;
  word-break: break-word;
}

.speaking-score {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  padding: 10px 16px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--muted);
}

.speaking-score .score-value {
  font-size: 20px;
  font-weight: 700;
  color: var(--accent);
}

/* ========================================
   Vocabulary Mode - 词汇学习
   ======================================== */
.vocabulary-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.word-card {
  background: var(--bg2);
  border-radius: var(--radius-md);
  padding: 20px;
  border: 1px solid var(--rule);
  transition: var(--transition);
  position: relative;
}

.word-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-sm);
}

.word-card.mastered {
  border-color: var(--success);
  background: var(--success-light);
}

.word-card .word-en {
  font-size: 20px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 4px;
}

.word-card .word-phonetic {
  font-size: 13px;
  color: var(--muted);
  font-family: 'Lucida Sans Unicode', sans-serif;
  margin-bottom: 4px;
}

.word-card .word-cn {
  font-size: 15px;
  color: var(--muted);
  margin-bottom: 10px;
}

.word-card .word-example {
  font-size: 13px;
  color: var(--text-light);
  line-height: 1.5;
  font-style: italic;
  padding-top: 10px;
  border-top: 1px solid var(--rule);
}

.word-card .word-example-cn {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
  font-style: normal;
}

.word-card .word-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
}

.word-card .btn-mastered {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  background: var(--bg);
  border: 1px solid var(--rule);
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  color: var(--muted);
}

.word-card .btn-mastered:hover {
  border-color: var(--success);
  color: var(--success);
}

.word-card .btn-mastered.active {
  background: var(--success);
  border-color: var(--success);
  color: white;
}

.word-card .btn-mastered svg {
  width: 14px;
  height: 14px;
}

.word-card .btn-word-play {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: var(--accent);
  border: none;
  border-radius: 50%;
  color: white;
  cursor: pointer;
  transition: var(--transition);
}

.word-card .btn-word-play:hover {
  background: var(--primary-dark);
}

.word-card .btn-word-play svg {
  width: 14px;
  height: 14px;
}

.vocabulary-progress {
  text-align: center;
  padding: 16px;
  margin-top: 16px;
  background: var(--bg2);
  border-radius: var(--radius-md);
  border: 1px solid var(--rule);
  font-size: 14px;
  color: var(--muted);
}

.vocabulary-progress .progress-count {
  font-weight: 700;
  color: var(--accent);
  font-size: 18px;
}

.vocabulary-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--muted);
}

/* 移动端词汇网格单列 */
@media (max-width: 768px) {
  .vocabulary-grid {
    grid-template-columns: 1fr;
  }
}

/* ========================================
   Mode Panel Transitions
   ======================================== */
.mode-panel {
  display: none;
  animation: fadeIn 0.25s ease;
}

.mode-panel.active {
  display: block;
}

@keyframes fadeIn {
  0% { opacity: 0; transform: translateY(8px); }
  100% { opacity: 1; transform: translateY(0); }
}

/* ========================================
   Not Supported Banner
   ======================================== */
.not-supported-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: #fffbeb;
  border: 1px solid var(--warning);
  border-radius: var(--radius-sm);
  color: #92400e;
  font-size: 13px;
  margin-bottom: 16px;
}

.not-supported-banner svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

/* ========================================
   Loading State
   ======================================== */
.loading-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  gap: 16px;
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--rule);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-text {
  color: var(--muted);
  font-size: 14px;
}

/* ========================================
   Error State
   ======================================== */
.error-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  gap: 16px;
  text-align: center;
  padding: 20px;
}

.error-icon {
  width: 64px;
  height: 64px;
  color: var(--text-light);
}

.error-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--ink);
}

.error-message {
  font-size: 14px;
  color: var(--muted);
  max-width: 300px;
}

/* ========================================
   Toast Notifications
   ======================================== */
.toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  background: var(--ink);
  color: #fff;
  padding: 12px 24px;
  border-radius: var(--radius-full);
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.3s ease, toastOut 0.3s ease 2.7s;
  pointer-events: none;
}

@keyframes toastIn {
  0% { opacity: 0; transform: translateX(-50%) translateY(-20px); }
  100% { opacity: 1; transform: translateX(-50%) translateY(0); }
}

@keyframes toastOut {
  0% { opacity: 1; transform: translateX(-50%) translateY(0); }
  100% { opacity: 0; transform: translateX(-50%) translateY(-20px); }
}

/* ========================================
   Sound Animation
   ======================================== */
.sound-wave {
  display: flex;
  align-items: center;
  gap: 3px;
}

.sound-wave span {
  display: inline-block;
  width: 3px;
  background: var(--accent);
  border-radius: 2px;
  animation: soundWave 0.8s ease-in-out infinite;
}

.sound-wave span:nth-child(1) { height: 8px; animation-delay: 0s; }
.sound-wave span:nth-child(2) { height: 16px; animation-delay: 0.15s; }
.sound-wave span:nth-child(3) { height: 24px; animation-delay: 0.3s; }
.sound-wave span:nth-child(4) { height: 16px; animation-delay: 0.45s; }
.sound-wave span:nth-child(5) { height: 8px; animation-delay: 0.6s; }

@keyframes soundWave {
  0%, 100% { transform: scaleY(0.5); }
  50% { transform: scaleY(1); }
}

/* ========================================
   PC端（>768px）增强样式
   ======================================== */

/* PC端：隐藏移动端header，使用侧边栏 */
.app-container > .header {
  display: none;
}

/* PC端：隐藏底部Tab栏 */
.bottom-nav {
  display: none;
}

/* PC端：统计横幅使用网格 */
.stats-banner {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
}

.stat-divider {
  display: none;
}

/* PC端：课程列表网格 */
.course-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

/* PC端学习页面增强 */
@media (min-width: 769px) {
  /* 模式标签改为水平按钮组，不使用sticky */
  .mode-tabs {
    position: static;
    box-shadow: none;
    background: transparent;
    border-bottom: none;
    display: inline-flex;
    gap: 0;
    padding: 0;
    margin-bottom: 24px;
  }

  .mode-tab {
    padding: 10px 20px;
    border-radius: var(--radius-full) 0 0 var(--radius-full);
    border: 1.5px solid var(--rule);
    border-right: none;
    background: var(--bg2);
    font-size: 14px;
  }

  .mode-tab:last-child {
    border-radius: 0 var(--radius-full) var(--radius-full) 0;
    border-right: 1.5px solid var(--rule);
  }

  .mode-tab.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
    border-bottom-color: var(--accent);
  }

  /* 学习内容区域最大宽度700px */
  .main-content {
    max-width: 700px;
    margin: 0 auto;
    padding: 2rem;
  }

  /* 句子显示更大 */
  .sentence-card .en-text {
    font-size: 1.5rem;
  }

  .sentence-card .cn-text {
    font-size: 1.125rem;
  }

  .sentence-card {
    padding: 28px 24px;
  }

  /* 拼图单词按钮更大 */
  .puzzle-word-btn {
    padding: 10px 20px;
    font-size: 16px;
  }

  /* 听写输入框更宽 */
  .dictation-input {
    padding: 16px 20px;
    font-size: 18px;
  }

  /* 录音按钮更紧凑（PC端） */
  .btn-record {
    padding: 14px 24px;
    width: auto;
    display: inline-flex;
    border-radius: var(--radius-full);
  }

  /* 进度条容器padding适配 */
  .progress-bar-container {
    padding: 0;
  }
}

/* PC端：主内容区适配侧边栏 */
@media (min-width: 769px) {
  .app-container {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
  }

  /* index.html页面内容居中 */
  .app-container > .stats-banner,
  .app-container > .daily-tip,
  .app-container > .section,
  .app-container > .filter-tabs,
  .app-container > .course-list,
  .app-container > .not-supported-banner {
    max-width: 960px;
    margin-left: auto;
    margin-right: auto;
    padding-left: 2rem;
    padding-right: 2rem;
  }

  .app-container > .stats-banner {
    margin-top: 2rem;
  }

  .app-container > .section {
    margin-top: 1.5rem;
    padding-left: 2rem;
    padding-right: 2rem;
  }

  .app-container > .filter-tabs {
    margin-left: auto;
    margin-right: auto;
    padding-left: 2rem;
    padding-right: 2rem;
  }

  .app-container > .course-list {
    padding-left: 2rem;
    padding-right: 2rem;
    margin-bottom: 2rem;
  }

  .app-container > .daily-tip {
    margin-top: 1rem;
  }

  .app-container > .not-supported-banner {
    margin-top: 1.5rem;
  }

  /* PC端底部不需要为Tab栏留空间 */
  .main-content {
    padding-bottom: 2rem;
  }
}

/* ========================================
   移动端（<=768px）适配
   ======================================== */
@media (max-width: 768px) {
  /* 移动端隐藏侧边栏 */
  .sidebar {
    display: none;
  }

  /* 移动端不偏移 */
  .app-container {
    margin-left: 0;
  }

  /* 移动端显示底部Tab栏 */
  .bottom-nav {
    display: flex;
  }

  /* 移动端显示header */
  .app-container > .header {
    display: block;
  }

  /* 移动端统计横幅单行 */
  .stats-banner {
    display: flex;
    align-items: center;
    justify-content: space-around;
    padding: 16px;
    background: var(--bg2);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
  }

  .stat-divider {
    display: block;
    width: 1px;
    height: 32px;
    background: var(--rule);
  }

  .stat-item {
    padding: 0;
    flex: 1;
    align-items: center;
  }

  .stat-value {
    font-size: 22px;
  }

  .stat-label {
    font-size: 11px;
  }

  /* 移动端课程列表单列 */
  .course-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
  }

  .course-list {
    padding: 0 16px;
  }

  /* 移动端减少padding */
  .main-content {
    padding: 20px 16px 100px;
    max-width: 100%;
  }

  .section {
    padding: 0 16px;
  }

  .filter-tabs {
    padding: 0 16px;
  }

  .daily-tip {
    margin: 0 16px;
  }

  /* 移动端mode-tabs保持sticky */
  .mode-tabs {
    position: sticky;
    top: 0;
    z-index: 99;
    box-shadow: var(--shadow-sm);
  }

  /* 移动端句子文字稍小 */
  .sentence-card .en-text {
    font-size: 20px;
  }

  .sentence-card {
    padding: 20px 16px;
  }

  /* 移动端录音按钮全宽 */
  .btn-record {
    width: 100%;
    border-radius: var(--radius-md);
  }
}

/* ========================================
   大屏（>=1200px）微调
   ======================================== */
@media (min-width: 1200px) {
  .app-container > .stats-banner,
  .app-container > .daily-tip,
  .app-container > .section,
  .app-container > .filter-tabs,
  .app-container > .course-list,
  .app-container > .not-supported-banner {
    max-width: 960px;
  }
}

/* ========================================
   Utility Classes
   ======================================== */
.hidden {
  display: none !important;
}

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

.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-20 { margin-top: 20px; }
.mb-8 { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }

/* ========================================
   Game Status Bar - 游戏状态栏
   ======================================== */
.game-status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 12px;
  margin-bottom: 16px;
  color: white;
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.game-score {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
}

.game-score .score-num {
  font-size: 20px;
  font-weight: 800;
}

.game-combo {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255,255,255,0.2);
  padding: 4px 12px;
  border-radius: 20px;
}

.game-combo .combo-label {
  font-size: 12px;
  opacity: 0.9;
}

.game-combo .combo-num {
  font-size: 16px;
  font-weight: 700;
}

.game-lives {
  display: flex;
  gap: 4px;
  font-size: 18px;
}

.game-lives .heart.lost {
  opacity: 0.3;
  filter: grayscale(1);
}

/* Combo effect - 连击浮动文字 */
.combo-effect {
  position: fixed;
  top: 40%;
  left: 50%;
  transform: translateX(-50%);
  font-size: 48px;
  font-weight: 900;
  color: #f59e0b;
  text-shadow: 0 4px 12px rgba(245, 158, 11, 0.4);
  z-index: 9999;
  pointer-events: none;
  animation: comboFloat 1s ease-out forwards;
}

@keyframes comboFloat {
  0% { opacity: 0; transform: translateX(-50%) translateY(20px) scale(0.5); }
  30% { opacity: 1; transform: translateX(-50%) translateY(0) scale(1.2); }
  100% { opacity: 0; transform: translateX(-50%) translateY(-60px) scale(1); }
}

/* Score popup - 得分浮动 */
.score-popup {
  position: absolute;
  font-size: 24px;
  font-weight: 800;
  color: #10b981;
  pointer-events: none;
  animation: scoreFloat 0.8s ease-out forwards;
  z-index: 100;
}

@keyframes scoreFloat {
  0% { opacity: 1; transform: translateX(-50%) translateY(0); }
  100% { opacity: 0; transform: translateX(-50%) translateY(-40px); }
}

/* Game Over - 游戏结算 */
.game-over-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  animation: fadeInOverlay 0.3s ease;
}

@keyframes fadeInOverlay {
  from { opacity: 0; }
  to { opacity: 1; }
}

.game-over-card {
  background: white;
  border-radius: 20px;
  padding: 32px;
  text-align: center;
  max-width: 360px;
  width: 90%;
  animation: popIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes popIn {
  0% { opacity: 0; transform: scale(0.8); }
  100% { opacity: 1; transform: scale(1); }
}

.game-over-card h2 {
  font-size: 24px;
  margin: 0 0 8px 0;
  color: var(--ink);
}

.game-over-card .stars {
  font-size: 40px;
  margin: 16px 0;
  letter-spacing: 8px;
  color: #f59e0b;
}

.game-over-card .stars .star-empty {
  opacity: 0.2;
}

.game-over-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 20px 0;
}

.game-over-stat {
  background: var(--bg);
  padding: 12px;
  border-radius: 10px;
}

.game-over-stat .stat-value {
  font-size: 24px;
  font-weight: 800;
  color: var(--accent);
}

.game-over-stat .stat-label {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

.game-over-btn {
  width: 100%;
  padding: 14px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.game-over-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.4);
}

.game-over-btn.secondary {
  background: var(--bg2);
  color: var(--ink);
  border: 1px solid var(--rule);
  box-shadow: none;
  margin-top: 10px;
}

/* Dictation result enhance */
.dictation-result .result-header.correct::before {
  content: '🎉 ';
}

/* Shake animation for wrong answer */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

.shake {
  animation: shake 0.3s ease;
}

/* Pulse for correct */
@keyframes pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.02); }
  100% { transform: scale(1); }
}

.pulse {
  animation: pulse 0.3s ease;
}

/* ========================================
   Progressive Dictation - 渐进式听写
   ======================================== */

.dictation-wrapper {
  max-width: 700px;
  margin: 0 auto;
}

/* Level Indicator */
.level-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px;
  margin-bottom: 20px;
  background: var(--bg2);
  border-radius: var(--radius-md);
  border: 1px solid var(--rule);
}

.level-tag {
  padding: 6px 16px;
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  background: var(--bg);
  transition: all 0.3s;
}

.level-tag.active {
  background: var(--accent);
  color: white;
  box-shadow: 0 2px 8px rgba(37,99,235,0.3);
}

.level-tag.completed {
  background: var(--success);
  color: white;
}

.level-arrow {
  color: var(--rule);
  font-size: 14px;
}

/* Hint Area */
.dictation-hint {
  text-align: center;
  padding: 24px;
  background: linear-gradient(135deg, #f0f4ff 0%, #e8f0fe 100%);
  border-radius: var(--radius-md);
  margin-bottom: 24px;
  border: 1px solid #d0e0fc;
}

.dictation-hint .hint-cn {
  font-size: 24px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 8px;
}

.dictation-hint .hint-pos {
  display: inline-block;
  padding: 3px 12px;
  background: var(--accent);
  color: white;
  font-size: 12px;
  font-weight: 600;
  border-radius: var(--radius-full);
}

/* Character Slots */
.dictation-input-area {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 6px;
  padding: 32px 20px;
  background: var(--bg2);
  border-radius: var(--radius-md);
  border: 2px solid var(--rule);
  min-height: 120px;
  margin-bottom: 16px;
}

.char-slot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 48px;
  font-size: 24px;
  font-weight: 700;
  font-family: 'Menlo', 'Consolas', monospace;
  border-radius: 6px;
  border-bottom: 3px solid #D1D5DB;
  background: #F9FAFB;
  color: transparent;
  transition: all 0.2s ease;
}

.char-slot.space {
  width: 20px;
  border-bottom: none;
  background: transparent;
}

.char-slot.correct {
  color: var(--success);
  border-bottom-color: var(--success);
  background: #F0FDF4;
  animation: slotPop 0.3s ease;
}

.char-slot.wrong {
  color: var(--danger);
  border-bottom-color: var(--danger);
  background: #FEF2F2;
  animation: slotShake 0.3s ease;
}

@keyframes slotPop {
  0% { transform: scale(0.8); }
  50% { transform: scale(1.1); }
  100% { transform: scale(1); }
}

@keyframes slotShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-3px); }
  75% { transform: translateX(3px); }
}

/* Completed Panel */
.dictation-completed {
  text-align: center;
  padding: 32px;
  background: var(--bg2);
  border-radius: var(--radius-md);
  border: 2px solid var(--success);
  animation: fadeIn 0.5s ease;
}

.dictation-completed .completed-word {
  font-size: 36px;
  font-weight: 800;
  color: var(--success);
  margin-bottom: 12px;
}

.dictation-completed .completed-phonetic {
  font-size: 18px;
  color: var(--muted);
  font-family: 'Lucida Sans Unicode', sans-serif;
  margin-bottom: 8px;
}

.dictation-completed .completed-cn {
  font-size: 20px;
  color: var(--ink);
  margin-bottom: 8px;
}

.dictation-completed .completed-pos {
  display: inline-block;
  padding: 4px 14px;
  background: #EEF2FF;
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
  border-radius: var(--radius-full);
  margin-bottom: 20px;
}

/* Hint Text */
.dictation-hint-text {
  text-align: center;
  font-size: 13px;
  color: var(--muted);
  margin-top: 8px;
}

/* Continue Button */
.btn-continue {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 32px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: var(--radius-full);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 4px 12px rgba(37,99,235,0.3);
}

.btn-continue:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(37,99,235,0.4);
}

/* Confetti */
.confetti-container { position: fixed; top:0; left:0; right:0; bottom:0; pointer-events: none; z-index: 9999; }
.confetti { position: absolute; width: 10px; height: 10px; border-radius: 2px; animation: confettiFly 2s ease-out forwards; }
@keyframes confettiFly {
  0% { transform: translate(0,0) rotate(0deg); opacity:1; }
  30% { opacity:1; }
  100% { transform: translate(var(--vx), calc(var(--vy) + 350px)) rotate(1080deg); opacity:0; }
}

/* Dictation area shake */
.dictation-input-area.shake {
  animation: shake 0.4s ease;
}

/* ========================================
   双平台互导 - Cross Platform Linking
   ======================================== */

/* 导流Banner */
.cross-promo-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  text-decoration: none;
  color: #fff;
  transition: var(--transition);
  margin-bottom: 0;
  border: 1px solid rgba(255,255,255,0.1);
}

.cross-promo-banner:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.cross-promo-left {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 1;
  min-width: 0;
}

.cross-promo-icon {
  width: 44px;
  height: 44px;
  background: rgba(255,255,255,0.15);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.cross-promo-icon svg {
  width: 24px;
  height: 24px;
  color: #fff;
}

.cross-promo-text {
  flex: 1;
  min-width: 0;
}

.cross-promo-title {
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 2px;
}

.cross-promo-desc {
  font-size: 12px;
  color: rgba(255,255,255,0.7);
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cross-promo-btn {
  padding: 8px 18px;
  background: rgba(255,255,255,0.2);
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  flex-shrink: 0;
  border: 1px solid rgba(255,255,255,0.25);
  transition: var(--transition);
}

.cross-promo-banner:hover .cross-promo-btn {
  background: rgba(255,255,255,0.3);
}

/* 侧边栏获客链接 */
.cross-nav-link {
  position: relative;
}

.cross-nav-badge {
  margin-left: auto;
  padding: 2px 8px;
  background: linear-gradient(135deg, #f59e0b, #ef4444);
  border-radius: var(--radius-full);
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.5px;
  animation: badgePulse 2s ease-in-out infinite;
}

@keyframes badgePulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

/* 关联服务卡片 */
.services-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.service-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  background: var(--bg2);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  text-decoration: none;
  color: var(--ink);
  transition: var(--transition);
  border: 1px solid var(--rule);
}

.service-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.service-icon {
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.service-icon svg {
  width: 24px;
  height: 24px;
  color: #fff;
}

.service-info {
  flex: 1;
  min-width: 0;
}

.service-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 2px;
}

.service-desc {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
}

.service-arrow {
  font-size: 18px;
  color: var(--accent);
  font-weight: 700;
  flex-shrink: 0;
  transition: var(--transition);
}

.service-card:hover .service-arrow {
  transform: translateX(4px);
}

/* 移动端适配 */
@media (max-width: 768px) {
  .cross-promo-banner {
    margin: 0 16px;
    padding: 14px 16px;
  }
  
  .cross-promo-desc {
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
  }
  
  .cross-promo-btn {
    display: none;
  }
}

/* PC端间距适配 */
@media (min-width: 769px) {
  .cross-promo-banner {
    max-width: 960px;
    margin-left: auto;
    margin-right: auto;
    padding-left: 2rem;
    padding-right: 2rem;
    margin-top: 1rem;
  }
  
  .services-grid {
    padding: 0;
  }
}
