/* ===== 变量 & 重置 ===== */
:root {
  --sidebar-w: 255px;
  --bg: #f3f4f6;
  --sidebar-bg: #1a1a2e;
  --card-bg: #fff;
  --text: #1f2937;
  --text-muted: #9ca3af;
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --primary-light: #eef2ff;
  --danger: #ef4444;
  --danger-hover: #dc2626;
  --danger-light: #fef2f2;
  --border: #e5e7eb;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.05), 0 2px 4px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.08), 0 4px 10px rgba(0, 0, 0, 0.04);
  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* 全局：输入框 placeholder 超长时显示省略号 */
input::placeholder {
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
}

/* ===== 布局 ===== */
#app {
  display: flex;
  min-height: 100vh;
}
/* #main-app 占满 #app（sidebar 为 fixed 脱离文档流）：无此规则时 flex 项目按内容收缩宽度，
   导致 main 的 margin 居中基于收缩宽度计算而失效（内容偏左） */
#main-app {
  flex: 1;
  width: 100%;
  min-width: 0;
}

/* ===== 侧边栏导航 ===== */
.sidebar {
  width: var(--sidebar-w);
  background: linear-gradient(180deg, #1e1b4b 0%, #1a1a2e 40%, #16213e 100%);
  color: #c8c8d8;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  flex-shrink: 0;
}

.logo-icon {
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  font-size: 18px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
  flex-shrink: 0;
  user-select: none;
  -webkit-user-select: none;
}

.logo-text {
  font-size: 13px;
  font-weight: 700;
  color: #e0e0f0;
  letter-spacing: 0;
  line-height: 1.25;
}

.sidebar-greeting {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  margin: 8px 12px 4px;
  padding: 10px 8px 9px;
  font-size: 12.5px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.88);
  text-align: center;
  letter-spacing: 0.2px;
  line-height: 1.55;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.38), rgba(139, 92, 246, 0.26));
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
}
.sidebar-greeting-emoji { font-size: 20px; line-height: 1; }
.sidebar-greeting-kao {
  font-size: 11.5px;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.55);
}

.nav {
  padding: 10px 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 1px;
  flex: 1 1 0%;
  min-height: 0;                 /* 允许 flex 子项收缩，启用内部滚动 */
  overflow-y: auto;              /* 侧边栏内容超高时可滚动，避免被裁切 */
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.16) transparent;
}
.nav::-webkit-scrollbar { width: 6px; }
.nav::-webkit-scrollbar-track { background: transparent; }
.nav::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.16);
  border-radius: 3px;
}
.nav::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.28); }

.nav-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 12px;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  color: #9ca3af;
  background: transparent;
  transition: all var(--transition);
  flex-shrink: 0;
}

.nav-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #e5e7eb;
}
.nav-btn.active {
  background: rgba(99, 102, 241, 0.2);
  color: #fff;
  font-weight: 600;
}

.nav-icon {
  font-size: 16px;
  width: 20px;
  text-align: center;
}

.nav-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 10px;
  background: var(--danger);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  margin-left: auto;
}

.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  flex-shrink: 0;
}

.api-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: #6b7280;
}
.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #6b7280;
}
.status-dot.ok {
  background: #10b981;
  box-shadow: 0 0 6px rgba(16, 185, 129, 0.5);
}

/* ===== 主区域 ===== */
/* ===== 主内容区 ===== */
.main {
  /* 视口内居中：宽屏时内容中心=屏幕中心；窄屏时自动取侧边栏宽度，避免遮挡 */
  margin-left: max(var(--sidebar-w), calc((100% - 1040px) / 2));
  margin-right: auto;
  flex: 1;
  padding: 40px 48px;
  max-width: 1040px;
}

.page {
  display: none;
}
.page.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

/* ===== 页面加载指示器 ===== */
.page-loader {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
  z-index: 999;
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  padding: 24px 32px;
  background: rgba(255,255,255,0.95);
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.1);
  backdrop-filter: blur(8px);
}
.page-loader-spinner {
  width: 32px; height: 32px;
  border: 3px solid #e5e7eb;
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
.page-loader-text {
  font-size: 13px; color: var(--text-muted); font-weight: 500;
}

/* ===== 页面头部 ===== */
.page-header {
  margin-bottom: 28px;
}
.page-header h1 {
  font-size: 26px;
  font-weight: 800;
  margin-bottom: 6px;
  letter-spacing: -0.3px;
}
.subtitle {
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 400;
}

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

/* ===== 生成盒子 ===== */
/* ===== 单词生成页 ===== */
.generate-box {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border);
}

.input-row {
  display: flex;
  gap: 10px;
}

.topic-input {
  flex: 1;
  padding: 12px 16px;
  font-size: 15px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
  transition: all var(--transition);
  background: var(--bg);
}
.topic-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.difficulty-select {
  padding: 12px 10px;
  font-size: 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
  min-width: 110px;
  transition: all var(--transition);
}
.difficulty-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.extra-input {
  width: 230px;
  padding: 12px 12px;
  font-size: 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
  background: var(--bg);
  transition: all var(--transition);
}
.extra-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.topic-suggestions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 16px;
  flex-wrap: wrap;
}

/* 单词生成配额条 */
.quota-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  padding: 10px 14px;
  background: #f9fafb;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  font-size: 13px;
}

.quota-icon {
  font-size: 16px;
  flex-shrink: 0;
}

.quota-text {
  color: var(--text);
  font-weight: 500;
  white-space: nowrap;
}

.quota-text .quota-highlight {
  color: var(--primary);
  font-weight: 700;
}

.quota-text.warning .quota-highlight {
  color: #f59e0b;
}

.quota-text.danger .quota-highlight {
  color: var(--danger);
}

.quota-text.unlimited .quota-highlight {
  color: #10b981;
}

.quota-progress {
  flex: 1;
  height: 6px;
  background: #e5e7eb;
  border-radius: 3px;
  overflow: hidden;
  min-width: 60px;
}

.quota-progress-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 3px;
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1), background 0.3s;
}

.quota-progress-fill.warning {
  background: #f59e0b;
}

.quota-progress-fill.danger {
  background: var(--danger);
}

.suggest-label {
  font-size: 13px;
  color: var(--text-muted);
}

.tag {
  padding: 5px 14px;
  font-size: 13px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--bg);
  cursor: pointer;
  color: var(--text);
  transition: all var(--transition);
  font-weight: 500;
}
.tag:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-light);
  transform: translateY(-1px);
}

/* ===== 按钮 ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 22px;
  font-size: 14px;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
  letter-spacing: 0.2px;
}

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

.btn-primary {
  background: linear-gradient(135deg, #6366f1, #5558e6);
  color: #fff;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.25);
}
.btn-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, #4f46e5, #4845d6);
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
  transform: translateY(-1px);
}
.btn-primary:active:not(:disabled) {
  transform: translateY(0);
}

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

.btn-danger {
  background: transparent;
  border: 1.5px solid var(--danger);
  color: var(--danger);
}
.btn-danger:hover:not(:disabled) {
  background: var(--danger);
  color: #fff;
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.25);
}

/* ===== 欢迎语 ===== */
.generate-welcome {
  text-align: center;
  padding: 48px 16px;
}

.generate-welcome-text {
  font-size: 22px;
  color: var(--text-main);
  letter-spacing: 1px;
  margin-bottom: 8px;
}

.generate-welcome-sub {
  font-size: 15px;
  color: var(--text-muted);
}

/* ===== 流式预览 ===== */
.stream-preview {
  display: none;
  max-height: 200px;
  overflow-y: auto;
  margin: 12px auto 0;
  padding: 10px 12px;
  font-size: 12px;
  font-family: var(--font-mono, "Consolas", "Courier New", monospace);
  color: var(--text-muted);
  background: rgba(0, 0, 0, 0.04);
  border-radius: 6px;
  white-space: pre-wrap;
  word-break: break-all;
  text-align: left;
  max-width: 600px;
}

/* ===== 加载 ===== */
.loading {
  text-align: center;
  padding: 48px 0;
  color: var(--text-muted);
}

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin: 0 auto 16px;
}

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

/* ===== 结果区域 ===== */
.result-area {
  margin-top: 24px;
}

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

.result-header h2 {
  font-size: 17px;
  color: var(--text);
}

.result-header h2::before {
  content: "「";
}
.result-header h2::after {
  content: "」的单词";
}

.result-actions {
  display: flex;
  gap: 8px;
}

.word-cards {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ===== 单词卡片 ===== */
.word-card {
  background: var(--card-bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  display: flex;
  gap: 14px;
  align-items: flex-start;
  transition: all var(--transition);
  cursor: pointer;
}

.word-card:hover {
  border-color: #c7d2fe;
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}
.word-card.selected {
  border-color: var(--primary);
  background: var(--primary-light);
  box-shadow: 0 0 0 1px rgba(99, 102, 241, 0.15);
}

.word-card .checkbox {
  width: 22px;
  height: 22px;
  border: 2px solid #d1d5db;
  border-radius: 6px;
  flex-shrink: 0;
  margin-top: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
  font-size: 12px;
  color: #fff;
}

.word-card.selected .checkbox {
  background: var(--primary);
  border-color: var(--primary);
}

.word-card .card-body {
  flex: 1;
  min-width: 0;
}

.card-main {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}

.card-jp {
  font-size: 18px;
  font-weight: 700;
  color: #1f2937;
}

.speak-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border: none;
  border-radius: 50%;
  background: #f3f4f6;
  cursor: pointer;
  font-size: 13px;
  color: #9ca3af;
  transition: all var(--transition);
  flex-shrink: 0;
}

.speak-btn:hover {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}
.speak-btn.speaking {
  background: var(--primary);
  color: #fff;
  animation: pulse 0.5s ease-in-out infinite alternate;
}

@keyframes pulse {
  from {
    transform: scale(1);
  }
  to {
    transform: scale(1.18);
  }
}

/* 收藏星星按钮 */
.star-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px; height: 28px;
  border: none; border-radius: 50%;
  background: transparent;
  cursor: pointer;
  font-size: 18px;
  color: #d1d5db;
  transition: all 0.2s;
  flex-shrink: 0;
  margin-left: auto;
  min-height: auto;
}
.star-btn:hover {
  color: #f59e0b;
  transform: scale(1.2);
}
.star-btn.saved {
  color: #f59e0b;
}
.star-btn.saved:hover {
  color: #d97706;
}

.card-kana {
  font-size: 13px;
  color: var(--text-muted);
}
.card-chinese {
  font-size: 14px;
  color: var(--text);
  margin-left: auto;
  font-weight: 500;
}

.card-example {
  font-size: 13px;
  color: #6b7280;
  display: flex;
  gap: 8px;
  padding-top: 6px;
  border-top: 1px dashed var(--border);
}

.card-example .example-cn {
  color: #9ca3af;
}

/* ===== 词库页面 ===== */
/* ===== 词库管理页 ===== */
.wordbank-layout {
  display: flex;
  gap: 28px;
}

.wordbank-sidebar {
  width: 220px;
  flex-shrink: 0;
}

.search-input {
  width: 100%;
  padding: 10px 14px;
  font-size: 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card-bg);
  outline: none;
  margin-bottom: 16px;
  transition: all var(--transition);
  box-sizing: border-box;
}
.search-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.08);
}

.topic-list {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.topic-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 9px 12px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  cursor: pointer;
  font-size: 13px;
  color: var(--text);
  transition: all var(--transition);
}
.topic-item:hover {
  background: #f3f4f6;
}
.topic-item.active {
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 600;
}

.topic-count {
  font-size: 11px;
  color: var(--text-muted);
  background: #f3f4f6;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 500;
}

/* ── JLPT 等级标签 ── */
.jlpt-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
  letter-spacing: 0.5px;
  line-height: 1.4;
}
.jlpt-badge.N1 { background: #fce4ec; color: #c62828; }
.jlpt-badge.N2 { background: #f3e5f5; color: #7b1fa2; }
.jlpt-badge.N3 { background: #e8eaf6; color: #283593; }
.jlpt-badge.N4 { background: #e0f2f1; color: #00695c; }
.jlpt-badge.N5 { background: #fff3e0; color: #e65100; }
.topic-item.active .topic-count {
  background: #ddd6fe;
  color: var(--primary);
}

.wordbank-main {
  flex: 1;
  min-width: 0;
}

.wordbank-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.wordbank-info {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
}

/* 添加单词表单 */
.add-word-form {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-sm);
}

.add-word-row {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}
.add-word-row:last-child {
  margin-bottom: 0;
}

.add-word-select {
  padding: 8px 12px;
  font-size: 13px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  outline: none;
  min-width: 110px;
  transition: all var(--transition);
}
.add-word-select:focus {
  border-color: var(--primary);
}

.add-word-input {
  flex: 1;
  min-width: 0;
  padding: 8px 12px;
  font-size: 13px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
  background: var(--bg);
  transition: all var(--transition);
}
.add-word-input:focus {
  border-color: var(--primary);
}

.add-word-wide {
  flex: 1.5;
}

/* 词单删除按钮 */
.topic-delete {
  background: none;
  border: none;
  cursor: pointer;
  color: #d1d5db;
  font-size: 15px;
  padding: 0 3px;
  line-height: 1;
  border-radius: 4px;
  transition: all var(--transition);
  flex-shrink: 0;
}
.topic-delete:hover {
  color: var(--danger);
  background: var(--danger-light);
}

.wordbank-cards {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.wordbank-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 20px;
  padding: 8px 0;
}

.wb-page-info {
  font-size: 13px;
  color: var(--text-muted);
  min-width: 100px;
  text-align: center;
}

.wb-jump {
  font-size: 13px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
}

.wb-jump-input {
  width: 48px;
  padding: 4px 6px;
  font-size: 13px;
  text-align: center;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--card-bg);
  color: var(--text-main);
}
.wb-jump-input::-webkit-inner-spin-button,
.wb-jump-input::-webkit-outer-spin-button {
  -webkit-appearance: none;
}

.wordbank-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  transition: all var(--transition);
}
.wordbank-card:hover {
  box-shadow: var(--shadow);
  border-color: #d1d5db;
}

.wordbank-card .card-main {
  margin-bottom: 4px;
}
.wordbank-card .card-example {
  border-top: none;
  padding-top: 2px;
}

.delete-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: #d1d5db;
  font-size: 16px;
  padding: 6px;
  line-height: 1;
  border-radius: 6px;
  transition: all var(--transition);
  flex-shrink: 0;
}
.delete-btn:hover {
  color: var(--danger);
  background: var(--danger-light);
}

/* ===== 空状态 ===== */
.empty-state {
  text-align: center;
  padding: 72px 20px;
  color: var(--text-muted);
}

.empty-icon {
  font-size: 56px;
  margin-bottom: 16px;
  opacity: 0.7;
}
.empty-state p {
  font-size: 15px;
  margin-bottom: 20px;
  color: #9ca3af;
}

/* ===== 错误 ===== */
.error-msg {
  background: var(--danger-light);
  color: var(--danger);
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  margin-top: 16px;
  border: 1px solid #fecaca;
}

/* ===== 背词页面 ===== */

/* ===== 学习页（子标签、日历、统计） ===== */
.study-subtabs {
  display: inline-flex;
  gap: 3px;
  background: var(--border);
  border-radius: var(--radius-sm);
  padding: 3px;
  margin-bottom: 20px;
}

.study-subtab {
  padding: 8px 22px;
  border: none;
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
  font-size: 14px;
  color: var(--text-muted);
  font-weight: 500;
  transition: all var(--transition);
}
.study-subtab:hover {
  color: var(--text);
}
.study-subtab.active {
  background: var(--card-bg);
  color: var(--primary);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

.study-calendar {
  margin-bottom: 20px;
}

.study-calendar-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 10px;
}

.study-calendar-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.study-calendar-new-hint {
  font-size: 12px;
  color: var(--text-muted);
}

.study-calendar-grid {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.study-calendar-day {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  text-align: center;
  min-width: 58px;
  flex-shrink: 0;
  transition: all var(--transition);
}
.study-calendar-day.today {
  border-color: var(--primary);
  background: var(--primary-light);
  box-shadow: 0 0 0 1px rgba(99, 102, 241, 0.1);
}

.study-calendar-day-label {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 2px;
}
.study-calendar-day-date {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
}
.study-calendar-day-count {
  font-size: 18px;
  font-weight: 700;
  color: var(--primary);
  margin-top: 2px;
}
.study-calendar-day-count.zero {
  color: #d1d5db;
  font-weight: 400;
}

/* ===== 背词统计 ===== */
.study-stats {
  display: flex;
  gap: 14px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.study-stat-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 22px;
  text-align: center;
  min-width: 100px;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition);
}
.study-stat-card:hover {
  box-shadow: var(--shadow);
}

.study-stat-num {
  font-size: 30px;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: -0.5px;
}
.study-stat-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
  font-weight: 500;
}

.study-topic-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  max-height: 172px;  /* 2行 */
  overflow-y: auto;
  padding: 2px;
}

.study-all-done {
  grid-column: 1 / -1;
  text-align: center;
  padding: 32px 16px;
  font-size: 18px;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}

.study-topic-card {
  background: var(--card-bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  cursor: pointer;
  text-align: center;
  transition: all var(--transition);
  user-select: none;
}
.study-topic-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}
.study-topic-card.selected {
  border-color: var(--primary);
  background: var(--primary-light);
}

.study-topic-card .stc-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.study-topic-card .stc-count {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

.study-mode-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 20px;
}

.study-mode-label {
  font-size: 14px;
  color: var(--text);
  font-weight: 600;
}

.btn-sm {
  padding: 6px 14px;
  font-size: 13px;
}
.mode-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

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

/* 背诵进度 */
.study-progress {
  margin-bottom: 24px;
}
.study-progress > span {
  font-size: 13px;
  color: var(--text-muted);
}
.study-bar {
  width: 100%;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  margin-top: 8px;
  overflow: hidden;
}

.study-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), #8b5cf6);
  border-radius: 3px;
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== 抽认卡（3D翻转） ===== */
.flashcard {
  perspective: 1000px;
  margin-bottom: 24px;
}

.flashcard-inner {
  position: relative;
  width: 100%;
  min-height: 280px;
  transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  transform-style: preserve-3d;
  cursor: pointer;
  user-select: none;
}

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

/* 正面 */
.flashcard-front {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 42px;
  font-weight: 800;
  color: var(--text);
  background: var(--card-bg);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: box-shadow 0.3s;
}

.flashcard-inner:not(.flipped):hover .flashcard-front {
  box-shadow: var(--shadow-md);
  border-color: #c7d2fe;
}

/* 背面 */
.flashcard-back {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  transform: rotateY(180deg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 24px;
  background: var(--primary-light);
  border: 2px solid var(--primary);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  overflow-y: auto;
}

.flashcard-answer {
  font-size: 38px;
  font-weight: 800;
  color: var(--text);
}

.flashcard-meaning {
  font-size: 20px;
  color: var(--primary);
  font-weight: 600;
}

/* 例句 */
.flashcard-example {
  margin-top: 8px;
  padding-top: 12px;
  border-top: 1px solid #c7d2fe;
  width: 100%;
  text-align: center;
}

.flashcard-example-ja {
  font-size: 15px;
  color: var(--text);
  line-height: 1.7;
  font-weight: 500;
}

.flashcard-example-cn {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* 配图 */
.flashcard-img {
  margin-top: 8px;
  border-radius: 10px;
  overflow: hidden;
  max-width: 200px;
}

.flashcard-img img {
  width: 100%;
  max-height: 150px;
  object-fit: cover;
  border-radius: 10px;
  cursor: pointer;
  border: 1px solid var(--border);
}

/* 学习进度 */
.flashcard-study-info {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 6px;
}

.flashcard-study-info .study-stage-bar {
  display: flex;
  gap: 3px;
}

/* 朗读按钮 */
.flashcard-speak-btn {
  margin-top: 6px;
  width: 32px;
  height: 32px;
}

.flashcard-hint {
  text-align: center;
  font-size: 12px;
  color: #d1d5db;
  margin-top: 10px;
}

.study-buttons {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.study-buttons .btn {
  min-width: 130px;
}

.study-quality-buttons {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}

.btn-quality {
  min-width: 72px;
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
}
.btn-quality:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn-quality.q-0 {
  background: #e5e7eb;
  color: #6b7280;
}
.btn-quality.q-1 {
  background: #fecaca;
  color: #b91c1c;
}
.btn-quality.q-2 {
  background: #fed7aa;
  color: #c2410c;
}
.btn-quality.q-3 {
  background: #fde68a;
  color: #a16207;
}
.btn-quality.q-4 {
  background: #bbf7d0;
  color: #15803d;
}
.btn-quality.q-5 {
  background: #86efac;
  color: #14532d;
}

/* ── 听力模式按钮组 ── */
.study-listening-actions {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-bottom: 20px;
}

.study-listening-actions .btn {
  padding: 14px 28px;
  font-size: 16px;
  border-radius: 14px;
}

/* ── 会话内操作栏（撤销按钮）── */
.study-session-actions {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 12px;
  min-height: 32px;
}

/* ── 会话统计（完成页面）── */
.study-done-container {
  max-width: 640px;
  margin: 0 auto;
  padding: 24px;
}

.study-done-header {
  text-align: center;
  margin-bottom: 20px;
}

.session-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.session-stat-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 16px;
  text-align: center;
  box-shadow: var(--shadow-sm);
}

.session-stat-num {
  font-size: 28px;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: -0.5px;
}

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

.session-ring-wrap {
  display: flex;
  justify-content: center;
}

/* 评分分布 */
.session-dist {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  box-shadow: var(--shadow-sm);
}

.session-dist-item {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.session-dist-item:last-child {
  margin-bottom: 0;
}

.session-dist-label {
  font-size: 12px;
  color: var(--text-muted);
  min-width: 60px;
  text-align: right;
  font-weight: 500;
}

.session-dist-bar-wrap {
  flex: 1;
  height: 8px;
  background: #f3f4f6;
  border-radius: 4px;
  overflow: hidden;
}

.session-dist-bar {
  height: 100%;
  border-radius: 4px;
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  min-width: 0;
}

.session-dist-count {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  min-width: 24px;
  text-align: left;
}

/* ===== 设置页面 ===== */
/* ===== 设置页 ===== */
.settings-box {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 28px 32px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  max-width: 520px;
}
.settings-box + .settings-box {
  margin-top: 16px;
}
.settings-box-wide {
  max-width: 720px;
}
.settings-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
}
.settings-column {
  min-width: 0;
}
.settings-box-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  padding-bottom: 12px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border);
}
.settings-sub-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  margin: 4px 0 14px;
  padding-bottom: 6px;
  border-bottom: 1px dashed var(--border);
}
.settings-sub-title:not(:first-of-type) {
  margin-top: 24px;
}
.setting-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 6px;
}
.setting-pw-row {
  position: relative;
}
.setting-pw-row .setting-input {
  padding-right: 44px;
}
.setting-pw-toggle {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 14px;
  opacity: 0.6;
  transition: opacity var(--transition), background var(--transition);
}
.setting-pw-toggle:hover {
  opacity: 1;
  background: var(--primary-light);
}

.setting-group {
  margin-bottom: 22px;
}
.setting-group:last-of-type {
  margin-bottom: 0;
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.setting-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.setting-value {
  font-size: 13px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  min-width: 36px;
  text-align: right;
}

.setting-select {
  width: 100%;
  padding: 10px 14px;
  font-size: 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  outline: none;
  cursor: pointer;
  transition: all var(--transition);
}
.setting-select:focus {
  border-color: var(--primary);
}

.setting-input {
  width: 100%;
  padding: 10px 14px;
  font-size: 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  outline: none;
  transition: all var(--transition);
  box-sizing: border-box;
}
.setting-input:focus {
  border-color: var(--primary);
}
.setting-input:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.setting-range {
  width: 100%;
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  border-radius: 3px;
  background: var(--border);
  outline: none;
}

.setting-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
  transition: all var(--transition);
  box-shadow: 0 2px 6px rgba(99, 102, 241, 0.3);
}
.setting-range::-webkit-slider-thumb:hover {
  transform: scale(1.2);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.setting-actions {
  display: flex;
  gap: 10px;
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

/* ===== Toast ===== */
/* ===== Toast 消息提示 ===== */
.toast {
  position: fixed;
  top: 24px;
  right: 24px;
  padding: 14px 24px;
  border-radius: var(--radius-sm);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  z-index: 9999;
  animation: slideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  backdrop-filter: blur(8px);
}

.toast.success {
  background: linear-gradient(135deg, #10b981, #059669);
}
.toast.error {
  background: linear-gradient(135deg, #ef4444, #dc2626);
}
.toast.info {
  background: linear-gradient(135deg, #6366f1, #4f46e5);
}
.toast.achievement {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  font-size: 16px;
  padding: 18px 28px;
  animation: achievementPop 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes achievementPop {
  0% {
    transform: translateX(40px) scale(0.8);
    opacity: 0;
  }
  50% {
    transform: translateX(0) scale(1.08);
    opacity: 1;
  }
  100% {
    transform: translateX(0) scale(1);
  }
}

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

/* ===== 短文页面 ===== */
.essay-section-label {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 12px;
}

/* 词单折叠面板 */
/* ===== 短文生成页 ===== */
.essay-toggle-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 12px 16px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  background: var(--card-bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  user-select: none;
  transition: all var(--transition);
  margin-bottom: 12px;
}

.essay-toggle-btn:hover {
  border-color: var(--primary);
  background: var(--primary-light);
}

.essay-toggle-arrow {
  display: inline-block;
  transition: transform 0.2s;
  font-size: 11px;
  color: var(--text-muted);
}

.essay-toggle-btn.expanded .essay-toggle-arrow {
  transform: rotate(90deg);
}

.essay-toggle-count {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  margin-left: auto;
}

.essay-topic-wrap {
  margin-bottom: 16px;
}

.essay-topic-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  max-height: 172px;  /* 2行: 每行约80px卡片+10px间距 */
  overflow-y: auto;
  padding: 2px;
}

.essay-topic-card {
  background: var(--card-bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  cursor: pointer;
  text-align: center;
  transition: all var(--transition);
  user-select: none;
}
.essay-topic-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}
.essay-topic-card.selected {
  border-color: var(--primary);
  background: var(--primary-light);
}

.essay-config-row {
  display: flex;
  gap: 20px;
  margin-bottom: 20px;
}

.essay-config-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.essay-config-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
}

.essay-select {
  padding: 10px 14px;
  font-size: 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card-bg);
  color: var(--text);
  outline: none;
  cursor: pointer;
  min-width: 140px;
  transition: all var(--transition);
}
.essay-select:focus {
  border-color: var(--primary);
}

.essay-title-input {
  padding: 10px 14px;
  font-size: 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card-bg);
  color: var(--text);
  outline: none;
  width: 100%;
  box-sizing: border-box;
  transition: all var(--transition);
}

.essay-title-input::placeholder {
  color: var(--text-muted);
  opacity: 0.6;
}

.essay-title-input:focus {
  border-color: var(--primary);
}

.essay-generate-row {
  margin-bottom: 20px;
}

.essay-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 28px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}

.essay-content {
  font-size: 18px;
  line-height: 2;
  color: var(--text);
  white-space: pre-wrap;
}

.essay-vocab-highlight {
  background: linear-gradient(0deg, #fde68a 40%, transparent 40%);
  border-bottom: 2px solid #f59e0b;
  font-weight: 600;
  padding: 0 2px;
  border-radius: 2px;
}

.essay-words-used {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.essay-word-tag {
  padding: 5px 14px;
  font-size: 13px;
  border: 1px solid var(--primary);
  border-radius: 20px;
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 500;
}

/* ── 短文单词选择器 ── */
.essay-word-picker {
  margin-bottom: 20px;
  padding: 16px 20px;
  background: var(--bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.essay-word-hint {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 400;
}

.essay-word-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0;
  max-height: 240px;
  overflow-y: auto;
}

.essay-word-chip {
  padding: 5px 14px;
  font-size: 13px;
  border: 1.5px solid var(--border);
  border-radius: 20px;
  background: var(--card-bg);
  cursor: pointer;
  color: var(--text);
  transition: all var(--transition);
  font-weight: 500;
  user-select: none;
  white-space: nowrap;
}

.essay-word-chip:hover {
  border-color: var(--primary);
  color: var(--primary);
  transform: translateY(-1px);
}

.essay-word-chip.selected {
  border-color: var(--primary);
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 600;
}

.essay-word-chip .chip-kana {
  font-size: 11px;
  color: var(--text-muted);
  margin-left: 4px;
}

.essay-word-chip.selected .chip-kana {
  color: var(--primary);
  opacity: 0.7;
}

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

.essay-translation {
  font-size: 16px;
  line-height: 1.8;
  color: var(--text);
  white-space: pre-wrap;
}

#essay-result .result-header h2::before,
#essay-result .result-header h2::after {
  content: none;
}

/* ── 保存页搜索栏 ── */
.saved-search-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
}
.saved-search-input {
  flex: 1;
  padding: 10px 14px;
  font-size: 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card-bg);
  outline: none;
  transition: border-color 0.2s;
}
.saved-search-input:focus {
  border-color: var(--primary);
}

/* ── 模态窗 ── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 9998;
  background: rgba(0,0,0,0.5);
  display: flex; align-items: center; justify-content: center;
}
.modal-content.saved-modal {
  background: #fff;
  border-radius: var(--radius);
  width: 90vw; max-width: 700px; max-height: 85vh;
  display: flex; flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 17px; margin: 0; }
.modal-close {
  background: none; border: none;
  font-size: 24px; color: var(--text-muted);
  cursor: pointer; padding: 0 4px; line-height: 1;
  min-height: auto;
}
.modal-close:hover { color: var(--text); }
.modal-body {
  flex: 1; overflow-y: auto;
  padding: 20px 24px;
  font-size: 15px; line-height: 1.9;
  white-space: pre-wrap;
}
.modal-footer {
  display: flex; gap: 8px; justify-content: flex-end;
  padding: 12px 20px;
  border-top: 1px solid var(--border);
}

/* ── 已保存短文列表 ── */
/* ===== 保存列表（短文、语法、完型填空共用） ===== */
.essay-saved-list {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.saved-card-num {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  opacity: 0.6;
}

.essay-saved-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: all var(--transition);
  display: flex;
  flex-direction: column;
  min-height: 150px;
}

.essay-saved-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

.essay-saved-card-header {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px;
  cursor: pointer;
  user-select: none;
  flex: 1;
}

.essay-saved-card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: flex-start;
  gap: 8px;
  line-height: 1.4;
}

.essay-saved-card-title .es-arrow {
  display: inline-block;
  transition: transform 0.25s ease;
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 4px;
  flex-shrink: 0;
}

.essay-saved-card.expanded .es-arrow {
  transform: rotate(90deg);
}

.essay-saved-card-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--text-muted);
}

.essay-saved-card-preview {
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-muted);
  opacity: 0.7;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  margin-top: 4px;
}

.essay-saved-card-body {
  display: none;
  padding: 0 16px 16px;
  border-top: 1px solid var(--border);
}

.essay-saved-card.expanded {
  grid-column: 1 / -1;
  min-height: auto;
}

.essay-saved-card.expanded .essay-saved-card-body {
  display: block;
}

.essay-saved-card-content {
  font-size: 15px;
  line-height: 2;
  color: var(--text);
  white-space: pre-wrap;
  margin-top: 16px;
  margin-bottom: 14px;
}

.essay-saved-card-translation {
  font-size: 14px;
  line-height: 1.8;
  color: #6b7280;
  white-space: pre-wrap;
  margin-bottom: 14px;
  padding: 12px 16px;
  background: var(--bg);
  border-radius: var(--radius-sm);
}

.essay-saved-card-actions {
  display: flex;
  gap: 8px;
}

.essay-saved-card-actions .btn {
  padding: 4px 12px;
  font-size: 12px;
}

/* ===== 词库学习状态 ===== */
.wordbank-study-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 6px;
  font-size: 12px;
  color: var(--text-muted);
}

.study-stage-bar {
  display: flex;
  align-items: center;
  gap: 3px;
}

.study-stage-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #e5e7eb;
  transition: all var(--transition);
}
.study-stage-dot.filled {
  background: var(--primary);
}
.study-stage-dot.mastered {
  background: #10b981;
  box-shadow: 0 0 4px rgba(16, 185, 129, 0.4);
}

.study-next-review {
  font-size: 11px;
}
.study-next-review.overdue {
  color: var(--danger);
  font-weight: 600;
}
.study-next-review.today {
  color: var(--primary);
  font-weight: 600;
}

/* ===== 认证页面 ===== */
.auth-overlay {
  position: fixed;
  inset: 0;
  background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-container {
  display: flex;
  background: #fff;
  border-radius: 20px;
  box-shadow:
    0 20px 60px rgba(0, 0, 0, 0.1),
    0 8px 20px rgba(0, 0, 0, 0.06);
  overflow: hidden;
  width: 800px;
  max-width: 94vw;
  min-height: 440px;
}

.auth-brand {
  flex: 0 0 340px;
  background: linear-gradient(160deg, #312e81 0%, #4f46e5 40%, #6366f1 70%, #818cf8 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  color: #fff;
  position: relative;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
}
.auth-brand::before {
  content: "";
  position: absolute;
  top: -60px;
  right: -60px;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
}
.auth-brand::after {
  content: "";
  position: absolute;
  bottom: -40px;
  left: -40px;
  width: 140px;
  height: 140px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.04);
}

.auth-brand-icon {
  font-size: 56px;
  font-weight: 300;
  margin-bottom: 10px;
  opacity: 0.95;
  position: relative;
  z-index: 1;
  user-select: none;
  -webkit-user-select: none;
}

.auth-brand-title {
  font-size: 11px;
  letter-spacing: 2px;
  opacity: 0.6;
  margin-bottom: 10px;
  position: relative;
  z-index: 1;
}

.auth-brand-sub {
  font-size: 19px;
  font-weight: 800;
  letter-spacing: 2px;
  position: relative;
  z-index: 1;
  text-align: center;
  line-height: 1.3;
}

.auth-panel {
  flex: 1;
  padding: 48px 44px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.auth-panel-header {
  margin-bottom: 28px;
}

.auth-panel-title {
  font-size: 22px;
  font-weight: 800;
  color: #1f2937;
  margin: 0;
  letter-spacing: -0.3px;
}

.auth-fields {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.auth-field-input {
  width: 100%;
  padding: 13px 16px;
  font-size: 14px;
  border: 1.5px solid #e5e7eb;
  border-radius: var(--radius-sm);
  outline: none;
  background: #f9fafb;
  color: #1f2937;
  transition: all var(--transition);
  box-sizing: border-box;
}
.auth-field-input:focus {
  border-color: #6366f1;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.auth-msg {
  min-height: 20px;
  margin-top: 10px;
  font-size: 13px;
  color: var(--danger);
  line-height: 20px;
}

.auth-submit {
  width: 100%;
  padding: 13px;
  margin-top: 18px;
  background: linear-gradient(135deg, #6366f1, #4f46e5);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: 4px;
  transition: all var(--transition);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}
.auth-submit:hover {
  background: linear-gradient(135deg, #4f46e5, #4338ca);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
  transform: translateY(-1px);
}
.auth-submit:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.auth-foot {
  margin-top: 20px;
  text-align: center;
  font-size: 13px;
  color: #9ca3af;
}

.auth-switch-btn {
  background: none;
  border: none;
  color: #6366f1;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}
.auth-switch-btn:hover {
  color: #4f46e5;
}

/* ===== 侧边栏用户 ===== */
.user-info {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
}

.user-icon {
  font-size: 18px;
}

.user-name {
  font-size: 13px;
  color: #d1d5db;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
}

.btn-logout {
  display: block;
  margin-bottom: 8px;
  font-size: 12px;
  color: #9ca3af;
  transition: color var(--transition);
}
.btn-logout:hover {
  color: #e5e7eb;
}

/* ===== 管理员页面 ===== */
.admin-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}

.admin-stat-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 18px;
  text-align: center;
  box-shadow: var(--shadow);
  transition: all var(--transition);
}
.admin-stat-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

/* ── 登录记录面板 ── */
.login-report-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 12px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.login-report-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  cursor: pointer;
  user-select: none;
  transition: background var(--transition);
}
.login-report-header:hover {
  background: var(--bg);
}

.login-report-user {
  display: flex;
  align-items: center;
  gap: 12px;
}

.login-report-avatar {
  font-size: 28px;
}

.login-report-username {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}

.login-report-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.login-report-toggle {
  font-size: 14px;
  color: var(--text-muted);
  transition: transform 0.2s;
}

.login-report-body {
  border-top: 1px solid var(--border);
}

.login-table {
  margin: 0;
}
.login-table th {
  font-size: 12px;
}
.login-table td {
  font-size: 13px;
}

.admin-stat-num {
  font-size: 30px;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: -0.5px;
}

.admin-stat-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
  font-weight: 500;
}

/* ── 管理面板用户卡片 ── */
.admin-cards-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.admin-user-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: box-shadow 0.2s;
}
.admin-user-card:hover {
  box-shadow: var(--shadow-md);
}

/* 卡片头部 */
.admin-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  gap: 10px;
}
.admin-card-user {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.admin-card-avatar {
  font-size: 26px;
  flex-shrink: 0;
}
.admin-card-username {
  font-weight: 700;
  font-size: 15px;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.admin-card-role {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 600;
  flex-shrink: 0;
}
.admin-card-role.admin { background: #d1fae5; color: #065f46; }
.admin-card-role.user { background: #f3f4f6; color: #6b7280; }

.admin-card-meta {
  display: flex;
  gap: 14px;
  font-size: 11px;
  color: var(--text-muted);
  flex-shrink: 0;
}
.admin-card-meta span { white-space: nowrap; }

/* 卡片备注 */
.admin-card-remark {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 18px;
  font-size: 12px;
  color: var(--text-muted);
  background: #fffbeb;
  border-bottom: 1px solid #fef3c7;
}
.admin-card-remark-text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.admin-card-remark-text .dim { opacity: 0.4; font-style: italic; }
.admin-card-remark-edit {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 13px;
  padding: 2px 6px;
  border-radius: 4px;
  transition: all 0.2s;
  flex-shrink: 0;
  min-height: auto;
}
.admin-card-remark-edit:hover {
  color: var(--primary);
  background: var(--primary-light);
}

/* 实验分组行（大创实验用） */
.admin-card-group {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 18px;
  font-size: 12px;
  color: var(--text-muted);
  background: #f0fdf4;
  border-bottom: 1px solid #dcfce7;
}
.admin-card-group-label {
  flex: 1;
}
.admin-group-select {
  font-size: 12px;
  padding: 3px 8px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  cursor: pointer;
}

/* 卡片身体 — 限额行 */
.admin-card-body {
  padding: 6px 18px 14px;
}

.admin-limit-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid #f3f4f6;
}
.admin-limit-row:last-child {
  border-bottom: none;
}

.admin-limit-icon {
  font-size: 17px;
  width: 24px;
  text-align: center;
  flex-shrink: 0;
}
.admin-limit-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  min-width: 44px;
  flex-shrink: 0;
}
.admin-limit-usage {
  font-size: 12px;
  color: var(--text-muted);
  min-width: 56px;
  text-align: right;
  flex-shrink: 0;
}
.admin-limit-usage .used { font-weight: 700; color: var(--text); }
.admin-limit-usage .warn { color: #f59e0b; font-weight: 700; }
.admin-limit-usage .full { color: var(--danger); font-weight: 700; }

.admin-limit-bar-wrap {
  flex: 1;
  height: 6px;
  background: #e5e7eb;
  border-radius: 3px;
  overflow: hidden;
  min-width: 40px;
}
.admin-limit-bar-fill {
  height: 100%;
  border-radius: 3px;
  background: var(--primary);
  transition: width 0.3s, background 0.3s;
}
.admin-limit-bar-fill.warn { background: #f59e0b; }
.admin-limit-bar-fill.full { background: var(--danger); }

.admin-limit-select {
  font-size: 11px;
  padding: 3px 6px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: #fff;
  color: var(--text-muted);
  cursor: pointer;
  max-width: 90px;
  flex-shrink: 0;
}

/* 卡片底部操作 */
.admin-card-actions {
  display: flex;
  gap: 6px;
  padding: 10px 18px;
  border-top: 1px solid var(--border);
  background: #fafafa;
}
.admin-card-actions .btn {
  font-size: 12px;
  padding: 5px 12px;
}
.admin-card-actions .btn-sm-danger {
  font-size: 11px;
  padding: 5px 10px;
}

.admin-table-wrap {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow-x: auto;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.admin-table th {
  text-align: left;
  padding: 12px 16px;
  background: var(--bg);
  font-weight: 600;
  color: var(--text-muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
}

.admin-table td {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}

.admin-table tr:last-child td {
  border-bottom: none;
}
.admin-table tr:hover td {
  background: #fafafe;
}

.admin-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
}

.admin-badge.admin {
  background: #d1fae5;
  color: #065f46;
}
.admin-badge.user {
  background: #f3f4f6;
  color: #6b7280;
}

.btn-sm-danger {
  padding: 5px 14px;
  font-size: 12px;
  border: 1px solid var(--danger);
  border-radius: 6px;
  background: #fff;
  color: var(--danger);
  cursor: pointer;
  transition: all var(--transition);
  margin-left: 6px;
  font-weight: 500;
}
.btn-sm-danger:hover {
  background: var(--danger);
  color: #fff;
}

/* ===== 管理员标签页 ===== */
.admin-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 18px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  width: fit-content;
  box-shadow: var(--shadow-sm);
}

.admin-tab {
  padding: 10px 26px;
  font-size: 14px;
  font-weight: 500;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
}
.admin-tab.active {
  background: var(--primary);
  color: #fff;
}
.admin-tab:not(.active):hover {
  color: var(--text);
  background: var(--bg);
}

.limit-select {
  padding: 5px 10px;
  font-size: 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
  transition: all var(--transition);
}
.limit-select:focus {
  border-color: var(--primary);
  outline: none;
}

.limit-badge {
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 10px;
  font-weight: 600;
}
.limit-badge.unlimited {
  background: #d1fae5;
  color: #065f46;
}
.limit-badge.limited {
  background: #fed7aa;
  color: #9a3412;
}

.usage-bar-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
}

.usage-bar {
  width: 44px;
  height: 5px;
  border-radius: 3px;
  background: #e5e7eb;
  overflow: hidden;
}

.usage-bar-fill {
  height: 100%;
  border-radius: 3px;
  background: var(--primary);
  transition: width 0.3s;
}
.usage-bar-fill.warn {
  background: #f59e0b;
}
.usage-bar-fill.full {
  background: var(--danger);
}

/* ===== Grammar ===== */
.grammar-panel {
  margin-top: 20px;
}

.grammar-hint {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 10px;
  margin-bottom: 0;
  line-height: 1.5;
  padding: 8px 14px;
  background: var(--primary-light);
  border-radius: var(--radius-sm);
}

.grammar-point-card {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 16px 20px;
  margin-bottom: 12px;
  border-left: 4px solid var(--primary);
}

.grammar-point-card .gp-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.grammar-point-card .gp-name {
  font-size: 1.1em;
  font-weight: 700;
  color: var(--primary);
}

.grammar-point-card .gp-level {
  font-size: 0.75em;
  padding: 2px 8px;
  border-radius: 10px;
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 600;
}

.grammar-point-card .gp-meaning {
  font-size: 0.9em;
  color: var(--text-muted, #666);
}

.grammar-point-card .gp-explain {
  margin-top: 8px;
  font-size: 0.95em;
  line-height: 1.6;
}

.grammar-point-card .gp-example {
  margin-top: 8px;
  padding: 8px 12px;
  background: var(--bg);
  border-radius: 8px;
  font-size: 0.9em;
}

.grammar-correct-card {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 20px;
}

.grammar-correct-card .gc-original {
  padding: 12px;
  background: #fff0f0;
  border-radius: 8px;
  margin-bottom: 12px;
}

.grammar-correct-card .gc-corrected {
  padding: 12px;
  background: #f0fff0;
  border-radius: 8px;
  margin-bottom: 16px;
}

.grammar-correct-card .gc-corrected .gc-text {
  color: #2e7d32;
  font-weight: 600;
}

.grammar-error-item {
  padding: 10px 14px;
  margin-bottom: 8px;
  background: var(--bg);
  border-radius: 8px;
  border-left: 3px solid var(--danger);
}

.grammar-error-item .ge-type {
  font-size: 0.75em;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--danger);
  color: #fff;
  margin-right: 8px;
}

.grammar-compare-summary {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 16px 20px;
  margin-bottom: 16px;
  line-height: 1.7;
}

.grammar-compare-table-wrap {
  overflow-x: auto;
}

.grammar-compare-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--card-bg);
  border-radius: 12px;
  overflow: hidden;
}

.grammar-compare-table th {
  background: var(--primary);
  color: #fff;
  padding: 10px 14px;
  text-align: left;
  font-weight: 600;
  white-space: nowrap;
}

.grammar-compare-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border, #e5e7eb);
  vertical-align: top;
}

.grammar-compare-table tr:last-child td {
  border-bottom: none;
}

.grammar-compare-table .gct-pattern {
  font-family: monospace;
  font-size: 0.9em;
  white-space: nowrap;
}

.no-errors-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: #f0fff0;
  color: #2e7d32;
  border-radius: 8px;
  font-weight: 600;
}

/* ===== 语法记录页面 ===== */
.grammar-saved-list {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.grammar-saved-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: all var(--transition);
  display: flex;
  flex-direction: column;
  min-height: 140px;
}

.grammar-saved-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

.grammar-saved-card-header {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 16px;
  cursor: pointer;
  user-select: none;
  flex: 1;
}

.grammar-saved-card-topic {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: flex-start;
  gap: 8px;
  line-height: 1.4;
}

.grammar-saved-card-topic .gs-arrow {
  display: inline-block;
  transition: transform 0.25s ease;
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 4px;
  flex-shrink: 0;
}

.grammar-saved-card.expanded .gs-arrow {
  transform: rotate(90deg);
}

.grammar-saved-card-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--text-muted);
}

.grammar-saved-card-body {
  display: none;
  padding: 0 16px 16px;
  border-top: 1px solid var(--border);
}

.grammar-saved-card.expanded {
  grid-column: 1 / -1;
  min-height: auto;
}

.grammar-saved-card.expanded .grammar-saved-card-body {
  display: block;
}

.grammar-saved-card-body .grammar-compare-summary {
  margin-top: 16px;
  margin-bottom: 12px;
}

.saved-panel {
  margin-top: 16px;
}

#grammar-compare-result .result-header h2::before,
#grammar-compare-result .result-header h2::after {
  content: none;
}

/* ===== 成就页面 ===== */
.achievement-stats-row {
  display: flex;
  gap: 14px;
  margin-bottom: 24px;
}

.achievement-stat {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 24px;
  text-align: center;
  flex: 1;
  box-shadow: var(--shadow-sm);
}

.achievement-stat-num {
  font-size: 28px;
  font-weight: 800;
  color: var(--primary);
}

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

.achievement-grid {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.achievement-category {
  /* wraps a category group */
}

.achievement-cat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 10px;
  padding: 10px 14px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  user-select: none;
  transition: background var(--transition);
}

.achievement-cat-header:hover {
  background: var(--bg);
}

.achievement-cat-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.achievement-cat-arrow {
  display: inline-block;
  transition: transform 0.2s;
  font-size: 12px;
  color: var(--text-muted);
}

.achievement-category.expanded .achievement-cat-arrow {
  transform: rotate(90deg);
}

.achievement-cat-progress {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
}

.achievement-cat-cards {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  transition: max-height 0.3s ease, opacity 0.3s ease, margin 0.3s ease;
  margin-top: 0;
}

.achievement-category.expanded .achievement-cat-cards {
  max-height: 2000px;
  opacity: 1;
  margin-top: 12px;
}

.achievement-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
  transition: all var(--transition);
  box-shadow: var(--shadow-sm);
}

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

.achievement-card.locked {
  opacity: 0.45;
  filter: grayscale(0.6);
}

.achievement-card.locked:hover {
  transform: none;
  box-shadow: var(--shadow-sm);
}

.achievement-icon {
  font-size: 40px;
  margin-bottom: 10px;
}

.achievement-card.locked .achievement-icon {
  filter: grayscale(1);
}

.achievement-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}

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

.achievement-date {
  font-size: 11px;
  color: var(--primary);
  margin-top: 8px;
  font-weight: 500;
}

/* ===== 完型填空 ===== */
/* ===== 完型填空页 ===== */
.cloze-passage {
  font-size: 17px;
  line-height: 2.6;
  color: var(--text);
  white-space: pre-wrap;
}

.cloze-blank-input {
  width: 80px;
  padding: 4px 8px;
  border: 2px dashed var(--primary);
  border-radius: 6px;
  font-size: 16px;
  text-align: center;
  background: var(--primary-light);
  color: var(--text);
  transition: all var(--transition);
  margin: 0 4px;
}

.cloze-blank-input:focus {
  outline: none;
  border-color: var(--primary-hover);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.cloze-blank-input.correct {
  border-color: #10b981;
  background: #ecfdf5;
  color: #065f46;
}

.cloze-blank-input.incorrect {
  border-color: var(--danger);
  background: var(--danger-light);
  color: var(--danger);
}

.cloze-score {
  margin-top: 16px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 18px;
  font-weight: 700;
  text-align: center;
}

.cloze-score.good {
  background: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}

.cloze-score.needs-work {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
}

.cloze-answers {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cloze-answer-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--bg);
  border-radius: var(--radius-sm);
}

.cloze-answer-num {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  min-width: 24px;
}

.cloze-answer-word {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
}

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

.cloze-answer-hint {
  font-size: 13px;
  color: var(--text-muted);
  font-style: italic;
}

/* ===== 词库单词配图 ===== */
.wordbank-card-img {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  object-fit: cover;
  cursor: pointer;
  border: 1px solid var(--border);
  transition: transform var(--transition);
  margin-left: auto;
  flex-shrink: 0;
}

.wordbank-card-img:hover {
  transform: scale(1.1);
}

.img-gen-btn {
  padding: 4px 12px;
  border: 1.5px solid var(--primary);
  border-radius: 20px;
  background: var(--primary-light);
  color: var(--primary);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  margin-left: auto;
  flex-shrink: 0;
  white-space: nowrap;
}

.img-gen-btn:hover {
  background: var(--primary);
  color: #fff;
}

.img-gen-btn.has-image {
  background: #ecfdf5;
  border-color: #10b981;
  color: #059669;
}

.img-gen-btn.has-image:hover {
  background: #10b981;
  color: #fff;
}

.img-gen-btn:disabled {
  opacity: 0.6;
  cursor: wait;
  background: var(--bg);
  border-color: var(--border);
  color: var(--text-muted);
}

/* 图片生成进度条 */
.img-gen-progress {
  margin-top: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: linear-gradient(135deg, #f8f7ff 0%, #f0eeff 100%);
  border-radius: 10px;
  border: 1px solid #e0dcf8;
}
.img-gen-progress-track {
  flex: 1;
  height: 6px;
  background: #e5e0f0;
  border-radius: 4px;
  overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.06);
}
.img-gen-progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #6366f1, #8b5cf6, #a78bfa, #6366f1);
  background-size: 200% 100%;
  border-radius: 4px;
  animation: shimmer 2s linear infinite;
  box-shadow: 0 0 6px rgba(99,102,241,0.3);
}
@keyframes shimmer {
  0%   { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}
.img-gen-progress-text {
  font-size: 13px;
  font-weight: 700;
  color: #6366f1;
  min-width: 36px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.5px;
}

/* 词库卡片内嵌图片 */
.wordbank-card-inline-img {
  margin-top: 12px;
  border-radius: 10px;
  overflow: hidden;
  animation: fadeIn 0.25s ease;
}

.wordbank-card-inline-img img {
  width: 100%;
  max-height: 300px;
  object-fit: cover;
  display: block;
  cursor: pointer;
  border-radius: 10px;
  border: 1px solid var(--border);
}

/* 图片灯箱 */
.image-lightbox {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}

.image-lightbox-bg {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
}

.image-lightbox-img {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
  z-index: 1;
}

.image-lightbox-close {
  position: absolute;
  top: 20px;
  right: 24px;
  z-index: 2;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition);
}

.image-lightbox-close:hover {
  background: rgba(255, 255, 255, 0.35);
}

/* ===== 图片词卡页面 ===== */
/* 侧边栏美化 */
#image-sidebar .wordbank-sidebar-label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-bottom: 10px;
  padding: 0 4px;
}

#image-sidebar {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 16px;
  border: 1px solid var(--border);
}

#image-sidebar .wordbank-topic-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 14px;
  color: var(--text);
  transition: all var(--transition);
  margin-bottom: 2px;
}

#image-sidebar .wordbank-topic-item::before {
  content: "📁";
  margin-right: 8px;
  font-size: 14px;
  opacity: 0.7;
}

#image-sidebar .wordbank-topic-item:hover {
  background: var(--primary-light);
  color: var(--primary);
}

#image-sidebar .wordbank-topic-item.active {
  background: var(--primary);
  color: #fff;
  font-weight: 600;
}

#image-sidebar .wordbank-topic-item.active::before {
  content: "📂";
  opacity: 1;
}

#image-sidebar .wordbank-topic-count {
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 12px;
  background: var(--bg);
  color: var(--text-muted);
  font-weight: 600;
}

#image-sidebar .wordbank-topic-item.active .wordbank-topic-count {
  background: rgba(255, 255, 255, 0.25);
  color: #fff;
}

/* 图片懒加载占位符 */
.img-placeholder {
  width: 100%; height: 100%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px;
  color: var(--text-muted);
  font-size: 13px;
  background: linear-gradient(135deg, #f0eeff 0%, #e8e4f8 100%);
}
.img-placeholder span:first-child { font-size: 36px; opacity: 0.6; }

/* 图片词卡网格 */
.image-card-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

/* 单张图片词卡 */
.image-card {
  background: var(--card-bg);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid var(--border);
}

.image-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: #c7d2fe;
}

/* 图片区域 */
.image-card-img-wrap {
  position: relative;
  width: 100%;
  height: 220px;
  overflow: hidden;
  cursor: pointer;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.image-card-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.image-card:hover .image-card-img-wrap img {
  transform: scale(1.08);
}

/* 图片上的渐变遮罩 */
.image-card-img-wrap::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.3));
  pointer-events: none;
  z-index: 1;
}

/* 图片上的放大提示 */
.image-card-img-wrap::before {
  content: "🔍 点击放大";
  position: absolute;
  bottom: 10px;
  right: 12px;
  z-index: 2;
  font-size: 11px;
  color: #fff;
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

.image-card:hover .image-card-img-wrap::before {
  opacity: 1;
}

/* 文字内容区 */
.image-card-body {
  padding: 18px 20px;
}

.image-card-words {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 8px;
}

.image-card-jp {
  font-size: 22px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: 0.5px;
}

.image-card-kana {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
}

.image-card-speak-btn {
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1.5px solid var(--border);
  border-radius: 50%;
  background: var(--card-bg);
  color: var(--primary);
  font-size: 12px;
  cursor: pointer;
  transition: all var(--transition);
  margin-left: auto;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.image-card-speak-btn:hover {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.image-card-speak-btn.speaking {
  background: var(--primary);
  color: #fff;
  animation: pulse 0.5s ease-in-out infinite alternate;
}

.image-card-meaning {
  display: inline-block;
  font-size: 13px;
  color: var(--primary);
  margin-bottom: 12px;
  font-weight: 600;
  background: var(--primary-light);
  padding: 3px 10px;
  border-radius: 6px;
}

/* 例句分隔线 */
.image-card-example {
  font-size: 13px;
  color: var(--text);
  line-height: 1.7;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  margin-bottom: 4px;
  position: relative;
}

.image-card-example::before {
  content: "💬 ";
  font-size: 11px;
}

.example-speak-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: transparent;
  color: var(--text-muted);
  font-size: 9px;
  cursor: pointer;
  transition: all var(--transition);
  margin-left: 6px;
  vertical-align: middle;
  flex-shrink: 0;
}

.example-speak-btn:hover {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.example-speak-btn.speaking {
  background: var(--primary);
  color: #fff;
  animation: pulse 0.5s ease-in-out infinite alternate;
}

.image-card-example-cn {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
}
/* ── PDF 导出面板 ── */
.export-panel {
  background: #fff;
  border-radius: 14px;
  width: 400px;
  max-width: 94vw;
  box-shadow: 0 16px 48px rgba(0,0,0,0.15);
  overflow: hidden;
  animation: exportIn 0.2s ease;
}
@keyframes exportIn {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

.export-panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 20px 22px 16px;
}
.export-panel-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}
.export-panel-sub {
  font-size: 13px;
  color: var(--text-muted);
}

.export-panel-body {
  padding: 0 22px 18px;
}

/* 布局选项行 */
.export-quick-row {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}
.export-quick-opt {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  background: var(--card-bg);
  transition: all 0.15s;
  user-select: none;
}
.export-quick-opt:has(input:checked) {
  border-color: var(--primary);
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 600;
}
.export-quick-opt:hover {
  border-color: var(--primary);
}
.export-quick-opt input { display: none; }

/* 复选框行 */
.export-checks {
  display: flex;
  gap: 16px;
}
.export-checks label {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
}

/* 加载状态 */
.export-loading-box {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
}
.export-loading-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.export-loading-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* 进度条 */
.export-progress {
  height: 4px;
  background: #e5e7eb;
  border-radius: 2px;
  overflow: hidden;
}
.export-progress-fill {
  height: 100%;
  width: 0%;
  background: var(--primary);
  border-radius: 2px;
  transition: width 0.3s ease;
}

/* 完成状态 */
.export-done-box {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: #ecfdf5;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  color: #059669;
}
.export-done-icon { font-size: 20px; }

/* 底部 */
.export-panel-footer {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  padding: 12px 22px 18px;
}

/* ── 彩蛋：樱花飘落 ── */
.sakura-container {
  position: fixed; inset: 0; z-index: 99999;
  pointer-events: none; overflow: hidden;
}
.sakura-petal {
  position: absolute; top: -40px;
  animation: sakuraFall linear forwards;
  opacity: 0.9;
}
@keyframes sakuraFall {
  0%   { transform: translateY(0) rotate(0deg); opacity: 1; }
  100% { transform: translateY(110vh) rotate(720deg); opacity: 0; }
}

/* ── 网站备案号 ── */
.site-footer {
  text-align: center;
  padding: 12px 16px 16px;
  font-size: 12px;
  color: var(--text-muted);
}
.site-footer a {
  color: var(--text-muted);
  text-decoration: none;
}
.site-footer a:hover {
  color: var(--primary);
  text-decoration: underline;
}

/* ── 移动端元素在桌面端完全隐藏 ── */
.mobile-only {
  display: none !important;
  visibility: hidden !important;
  width: 0 !important;
  height: 0 !important;
  overflow: hidden !important;
  position: absolute !important;
  pointer-events: none !important;
  clip: rect(0 0 0 0) !important;
}
/* 子页注入的移动端抽屉（common.js injectMobileDrawer）：桌面端隐藏，仅手机端显示 */
.mobile-only-sidebar { display: none; }

/* ═══ 社区 ═══ */
.community-announcements {
  background: #fffbeb;
  border: 1px solid #fcd34d;
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 16px;
}
.community-announcements-title { font-weight: 700; margin-bottom: 8px; color: #92400e; }
.community-publish {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: var(--shadow);
}
.community-content-input {
  width: 100%;
  min-height: 120px;
  resize: vertical;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
  background: var(--card-bg);
  color: var(--text);
}
.community-content-input:focus { outline: none; border-color: var(--primary); }
.community-publish-actions { display: flex; gap: 8px; justify-content: flex-end; }
.community-post {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 12px;
  cursor: pointer;
  border: 1px solid transparent;
  box-shadow: var(--shadow-sm);
  transition: border-color var(--transition);
}
.community-post:hover { border-color: var(--primary); }
.community-post.announcement { border-left: 3px solid #f59e0b; }
.community-post-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; flex-wrap: wrap; }
.community-post-title { font-weight: 700; font-size: 15px; color: var(--text); }
.community-tag {
  font-size: 12px;
  background: #fef3c7;
  color: #92400e;
  border-radius: 4px;
  padding: 1px 6px;
  flex-shrink: 0;
}
.community-tag.pin { background: #e0e7ff; color: #3730a3; }
.community-post-meta {
  display: flex;
  gap: 12px;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.community-post-content {
  font-size: 14px;
  line-height: 1.7;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
}
.community-load-more { text-align: center; margin: 16px 0; }
.community-detail-meta {
  display: flex;
  gap: 12px;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 10px;
  align-items: center;
  flex-wrap: wrap;
}
.community-detail-content {
  font-size: 15px;
  line-height: 1.8;
  white-space: pre-wrap;
  word-break: break-word;
  margin-bottom: 12px;
  color: var(--text);
}
.community-detail-like-bar {
  font-size: 13px;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  padding-top: 10px;
  margin-bottom: 12px;
}
.community-comments-title { font-weight: 700; margin-bottom: 8px; color: var(--text); }
.community-comments { margin-bottom: 12px; }
.community-comment {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px dashed var(--border);
  font-size: 13px;
}
.community-comment-user { color: var(--primary); font-weight: 600; flex-shrink: 0; }
.community-comment-text { flex: 1; word-break: break-word; color: var(--text); }
.community-comment-time { color: var(--text-muted); font-size: 11px; flex-shrink: 0; }
.community-comment-del {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
  flex-shrink: 0;
  padding: 0 2px;
}
.community-comment-del:hover { color: var(--danger); }
.community-no-comments { color: var(--text-muted); font-size: 13px; padding: 8px 0; }
.community-comment-form { display: flex; gap: 8px; }
.community-comment-form .topic-input { flex: 1; }
#community-modal-like.liked { color: var(--danger); }

/* --- 首页（学习仪表盘） --- */
.home-welcome {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  gap: 16px;
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 55%, #a855f7 100%);
  color: #fff;
  border-radius: var(--radius);
  padding: 26px 28px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-md);
}
.home-welcome::before {
  content: "";
  position: absolute;
  right: -40px;
  top: -40px;
  width: 170px;
  height: 170px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.09);
}
.home-welcome::after {
  content: "";
  position: absolute;
  right: 70px;
  bottom: -70px;
  width: 130px;
  height: 130px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
}
.home-welcome-emoji {
  font-size: 48px;
  line-height: 1;
  animation: homeFloat 3s ease-in-out infinite;
  position: relative;
  z-index: 1;
}
@keyframes homeFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
.home-welcome-text { flex: 1; min-width: 0; position: relative; z-index: 1; }
.home-welcome-title { font-size: 28px; font-weight: 700; margin: 0; }
.home-welcome-sub { font-size: 15px; opacity: 0.92; margin: 8px 0 0; }
.home-welcome-date {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 14px;
  font-size: 13px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.95);
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  padding: 5px 14px;
  backdrop-filter: blur(4px);
}
/* 装饰性漂浮假名（填满横幅右侧留白，营造氛围） */
.home-welcome-deco {
  position: absolute;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.14);
  user-select: none;
  pointer-events: none;
  animation: homeFloat 4s ease-in-out infinite;
}
.home-welcome-deco.d1 { font-size: 44px; right: 24%; top: 16px; animation-delay: 0s; }
.home-welcome-deco.d2 { font-size: 30px; right: 13%; bottom: 30px; animation-delay: 1.1s; }
.home-welcome-deco.d3 { font-size: 22px; right: 36%; bottom: 12px; animation-delay: 2s; }
.home-welcome-deco.d4 { font-size: 20px; right: 6%; top: 52%; animation-delay: 0.5s; }
.home-welcome-cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #fff;
  color: var(--primary);
  font-weight: 700;
  font-size: 14px;
  padding: 10px 20px;
  border-radius: 999px;
  text-decoration: none;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
  transition: transform var(--transition), box-shadow var(--transition);
  white-space: nowrap;
  position: relative;
  z-index: 1;
}
.home-welcome-cta:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.26);
}

/* 首页顶部：欢迎横幅（左） + 每日签到卡片（右上） */
.home-top {
  display: flex;
  gap: 16px;
  align-items: stretch;
  margin-bottom: 20px;
}
.home-top .home-welcome { flex: 1; margin-bottom: 0; }
.home-checkin {
  width: 340px;
  flex-shrink: 0;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
}
.home-checkin::before {
  content: "";
  position: absolute;
  top: -40px;
  right: -40px;
  width: 110px;
  height: 110px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.14), rgba(168, 85, 247, 0.1));
}
.home-checkin-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  position: relative;
  z-index: 1;
}
.home-checkin-title { font-weight: 700; font-size: 15px; color: var(--text); }
.home-checkin-streak {
  font-size: 12px;
  font-weight: 600;
  color: #b45309;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 999px;
  padding: 3px 10px;
  white-space: nowrap;
}
.home-checkin-btn {
  position: relative;
  z-index: 1;
  border: none;
  border-radius: 999px;
  padding: 11px 0;
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  cursor: pointer;
  background: linear-gradient(135deg, #f59e0b, #f97316);
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.35);
  transition: transform var(--transition), box-shadow var(--transition), filter var(--transition);
}
.home-checkin-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(245, 158, 11, 0.45);
}
.home-checkin-btn:disabled { cursor: default; }
.home-checkin-btn.done {
  background: linear-gradient(135deg, #10b981, #059669);
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.3);
}
.home-checkin-word {
  position: relative;
  z-index: 1;
  background: var(--bg);
  border: 1px dashed var(--border);
  border-radius: 12px;
  padding: 12px 14px;
}
.home-checkin-word-label { font-size: 12px; font-weight: 700; color: var(--text-muted); margin-bottom: 6px; }
.home-checkin-word-body { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.home-checkin-word-jp { font-size: 20px; font-weight: 800; color: var(--text); }
.home-checkin-word-kana { font-size: 13px; color: var(--text-muted); }
.home-checkin-word-cn { font-size: 13px; color: var(--text); flex: 1; min-width: 0; }
.home-checkin-word-body .btn { margin-left: auto; }
.home-checkin-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  position: relative;
  z-index: 1;
}
.home-checkin-hint { font-size: 11px; color: var(--text-muted); }
.home-checkin-link { font-size: 12px; color: var(--primary); font-weight: 600; text-decoration: none; }
.home-checkin-link:hover { text-decoration: underline; }
.home-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}
.home-stat-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 18px 16px;
  text-align: center;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}
.home-stat-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--primary);
}
.home-stat-icon { font-size: 22px; display: block; margin-bottom: 8px; }
.home-stat-num {
  font-size: 30px;
  font-weight: 800;
  background: linear-gradient(135deg, var(--primary), #8b5cf6);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.home-stat-label { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.home-announcements {
  background: #fffbeb;
  border: 1px solid #fcd34d;
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 20px;
}
.home-announcements-title { font-weight: 700; margin-bottom: 8px; color: #92400e; }
.home-announcement-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 7px 4px;
  cursor: pointer;
  border-bottom: 1px dashed #fde68a;
  font-size: 13px;
}
.home-announcement-item:last-child { border-bottom: none; }
.home-announcement-item:hover { color: var(--primary); }
.home-announcement-item-title { color: var(--text); }
.home-announcement-item-time { color: var(--text-muted); font-size: 11px; flex-shrink: 0; margin-left: 8px; }
.home-daily {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 22px 24px 22px 28px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
}
.home-daily-title { font-size: 15px; font-weight: 700; color: var(--text); margin-bottom: 12px; }
.home-daily-jp { font-size: 22px; font-weight: 700; color: var(--text); line-height: 1.6; }
.home-daily-cn { font-size: 13px; color: var(--text-muted); margin-top: 6px; }
.home-daily-actions { margin-top: 12px; }
.home-recommend {
  margin-top: 16px;
  border-top: 1px dashed var(--border);
  padding-top: 14px;
}
.home-recommend-label { font-size: 12px; font-weight: 700; color: var(--text-muted); margin-bottom: 6px; }
.home-recommend-body { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.home-recommend-word { font-size: 18px; font-weight: 700; color: var(--primary); }
.home-recommend-kana { font-size: 14px; color: var(--text-muted); }
.home-recommend-cn { font-size: 13px; color: var(--text); }

/* 独立子页导航: a 链接复用 .nav-btn 样式, 不覆盖 color(继承浅色, 适配深色侧边栏) */
.nav a.nav-btn {
  text-decoration: none;
  cursor: pointer;
}


/* ═══ 独立子页（无侧边栏，简洁顶栏，阶段二） ═══ */
body.subpage { background: var(--bg); }
.subpage-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 20px;
  background: var(--sidebar-bg);
  box-shadow: var(--shadow-sm);
}
.subpage-nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #e5e7eb;
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  transition: background var(--transition);
}
.subpage-nav-btn:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }
.subpage-header-actions { display: flex; align-items: center; gap: 8px; }
/* 顶栏上的 outline 按钮：浅色边框/文字，适配深色背景 */
.subpage-btn {
  color: #e5e7eb !important;
  border-color: rgba(255, 255, 255, 0.35) !important;
  background: transparent !important;
}
.subpage-btn:hover { color: #fff !important; border-color: rgba(255, 255, 255, 0.6) !important; }
body.subpage .main {
  margin-left: 0;
  padding-top: 20px;
  max-width: 960px;
  margin-left: auto;
  margin-right: auto;
  padding-left: 20px;
  padding-right: 20px;
}


/* ═══ 独立子页视觉美化 ═══ */
body.subpage {
  background: linear-gradient(180deg, #f6f7fb 0%, var(--bg) 320px);
}
.subpage-header {
  background: linear-gradient(135deg, #1a1a2e 0%, #2d2a4a 100%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.subpage-nav-btn {
  padding: 7px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
}
.subpage-nav-btn:hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.22);
}
/* 页面标题区 */
body.subpage .page-header { margin-bottom: 18px; }
body.subpage .page-header h1 {
  font-size: 26px;
  background: linear-gradient(135deg, var(--primary), #8b5cf6);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}
/* 发布区 */
.community-publish {
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  border-radius: 14px;
}
.community-publish .topic-input,
.community-content-input {
  border-radius: 10px;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.community-publish .topic-input:focus,
.community-content-input:focus {
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}
/* 帖子卡片 */
.community-post {
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  border-radius: 14px;
  transition: all var(--transition);
}
.community-post:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  border-color: rgba(99, 102, 241, 0.4);
}
.community-post-title { font-size: 16px; }
.community-post-content { color: #4b5563; }
/* 公告区 */
.community-announcements {
  border-radius: 14px;
  box-shadow: var(--shadow-sm);
}
/* 加载更多按钮居中强化 */
.community-load-more .btn {
  min-width: 160px;
  border-radius: 999px;
}

/* ═══ 社区页美化（v2）═══ */
/* 顶部横幅 Hero */
.community-hero {
  position: relative;
  overflow: hidden;
  border-radius: 16px;
  padding: 26px 28px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  background: linear-gradient(120deg, #4f46e5 0%, #7c3aed 55%, #a855f7 100%);
  box-shadow: 0 10px 30px rgba(99, 102, 241, 0.28);
}
.community-hero::before,
.community-hero::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.09);
}
.community-hero::before { width: 170px; height: 170px; right: -40px; top: -55px; }
.community-hero::after { width: 110px; height: 110px; right: 130px; bottom: -60px; background: rgba(255, 255, 255, 0.06); }
.community-hero-text { position: relative; z-index: 1; }
.community-hero h1 {
  font-size: 26px;
  color: #fff;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}
.community-hero-sub { margin: 6px 0 0; font-size: 13px; color: rgba(255, 255, 255, 0.88); }
.community-hero-chips { display: flex; gap: 10px; position: relative; z-index: 1; flex-wrap: wrap; }
.community-hero-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.28);
  color: #fff;
  font-size: 13px;
  padding: 7px 14px;
  border-radius: 999px;
  backdrop-filter: blur(4px);
}
.community-hero-chip b { font-size: 16px; }

/* 头像（渐变盘，按 id 稳定取色） */
.community-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  color: #fff;
  font-weight: 700;
  font-size: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  user-select: none;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
}
.community-avatar.sm { width: 34px; height: 34px; font-size: 14px; }
.community-avatar.xs { width: 26px; height: 26px; font-size: 12px; box-shadow: none; }
.community-avatar.grad-1 { background: linear-gradient(135deg, #6366f1, #8b5cf6); }
.community-avatar.grad-2 { background: linear-gradient(135deg, #ec4899, #f97316); }
.community-avatar.grad-3 { background: linear-gradient(135deg, #10b981, #14b8a6); }
.community-avatar.grad-4 { background: linear-gradient(135deg, #0ea5e9, #6366f1); }
.community-avatar.grad-5 { background: linear-gradient(135deg, #f59e0b, #ef4444); }
.community-avatar.grad-6 { background: linear-gradient(135deg, #8b5cf6, #ec4899); }

/* 发布区 */
.community-publish { padding: 18px; border-radius: 14px; }
.community-publish-head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.community-publish-icon { font-size: 18px; }
.community-publish-title { font-weight: 700; font-size: 15px; color: var(--text); }
.community-publish-hint { font-size: 12px; color: var(--text-muted); }
.community-publish-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.community-char-count { font-size: 12px; color: var(--text-muted); }
.community-char-count b { color: var(--primary); font-weight: 600; }
#btn-community-submit { border-radius: 999px; padding: 8px 22px; }
#btn-announcement-submit {
  border-radius: 999px;
  color: #92400e;
  border-color: #fcd34d;
  background: #fffbeb;
}
#btn-announcement-submit:hover { background: #fef3c7; }

/* 帖子卡片 */
.community-post {
  padding: 16px 18px;
  margin-bottom: 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--card-bg);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}
.community-post:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
  border-color: rgba(99, 102, 241, 0.45);
}
.community-post.announcement {
  border-left: 4px solid #f59e0b;
  background: linear-gradient(180deg, #fffbeb 0%, #fff 65%);
}
.community-post.announcement:hover { border-color: rgba(245, 158, 11, 0.55); }
.community-post-head { display: flex; align-items: center; gap: 12px; margin-bottom: 0; }
.community-post-main { flex: 1; min-width: 0; }
.community-post-title-line {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 3px;
}
.community-post-title { font-weight: 700; font-size: 16px; color: var(--text); line-height: 1.4; }
.community-post-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
  flex-wrap: wrap;
  margin-bottom: 0;
}
.community-post-meta .dot { color: #d1d5db; }
.community-post-stats { display: flex; gap: 6px; flex-shrink: 0; }
.community-stat {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 12px;
  color: var(--text-muted);
  background: var(--bg);
  border-radius: 999px;
  padding: 3px 10px;
}
.community-stat b { color: var(--text); font-weight: 600; }
.community-post-content {
  margin-top: 10px;
  font-size: 14px;
  line-height: 1.7;
  color: #4b5563;
  white-space: pre-wrap;
  word-break: break-word;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.community-post-content.empty,
.community-detail-content.empty {
  color: var(--text-muted);
  font-style: italic;
  -webkit-line-clamp: 1;
}

/* 标签（胶囊） */
.community-tag {
  font-size: 11px;
  border-radius: 999px;
  padding: 2px 9px;
  font-weight: 600;
}

/* 公告区 */
.community-announcements {
  padding: 14px 16px;
  background: linear-gradient(180deg, #fffbeb, #fefce8);
  border: 1px solid #fde68a;
  border-radius: 14px;
  margin-bottom: 18px;
  box-shadow: var(--shadow-sm);
}
.community-announcements-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  margin-bottom: 10px;
  color: #92400e;
}
.community-announcements .community-post { margin-bottom: 8px; }
.community-announcements .community-post:last-child { margin-bottom: 0; }
.community-announcements .community-post-content { -webkit-line-clamp: 2; }

/* 加载更多（渐变胶囊） */
.community-load-more .btn {
  min-width: 180px;
  padding: 10px 24px;
  border: none;
  border-radius: 999px;
  color: #fff;
  background: linear-gradient(135deg, var(--primary), #8b5cf6);
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.3);
  font-weight: 600;
  transition: transform var(--transition), box-shadow var(--transition);
}
.community-load-more .btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.42);
}

/* 空状态（社区页内浮动动画） */
#page-community .empty-state .empty-icon {
  animation: homeFloat 2.4s ease-in-out infinite;
}

/* 帖子详情模态框 */
.community-detail-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.community-detail-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-muted);
  flex-wrap: wrap;
  margin-bottom: 0;
}
.community-detail-user { color: var(--primary); font-weight: 700; font-size: 14px; }
.community-detail-time { font-size: 12px; }
.community-detail-content {
  background: var(--bg);
  border-radius: 12px;
  padding: 14px 16px;
  font-size: 15px;
  line-height: 1.8;
  white-space: pre-wrap;
  word-break: break-word;
  margin-bottom: 14px;
  color: var(--text);
}
.community-detail-like-bar {
  font-size: 13px;
  color: var(--text-muted);
  border-top: 1px dashed var(--border);
  padding-top: 10px;
  margin-bottom: 14px;
}
.community-comments-title { font-size: 14px; margin-bottom: 10px; }
.community-comment {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px dashed var(--border);
  font-size: 13px;
}
.community-comment:last-child { border-bottom: none; }
.community-comment-main { flex: 1; min-width: 0; }
.community-comment-head { display: flex; align-items: center; gap: 8px; margin-bottom: 2px; }
.community-comment-user { color: var(--primary); font-weight: 600; flex-shrink: 0; }
.community-comment-time { color: var(--text-muted); font-size: 11px; margin-left: auto; flex-shrink: 0; }
.community-comment-text { word-break: break-word; color: var(--text); line-height: 1.6; }
.community-comment-del {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 16px;
  flex-shrink: 0;
  padding: 0 2px;
  line-height: 1;
  margin-left: 2px;
}
.community-comment-del:hover { color: var(--danger); }
.community-no-comments {
  color: var(--text-muted);
  font-size: 13px;
  padding: 16px 0;
  text-align: center;
}
.community-comment-form { margin-top: 14px; }
#community-modal-like.liked {
  color: var(--danger);
  background: var(--danger-light);
  border-color: rgba(239, 68, 68, 0.35);
}
#community-modal-delete {
  color: var(--danger);
  border-color: rgba(239, 68, 68, 0.4);
}


/* ═══════════════════════════════════════════════════════════════════
   多模态记忆实验页
   ═══════════════════════════════════════════════════════════════════ */
.exp-panel {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 26px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 20px;
}
.exp-config-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.exp-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  min-width: 72px;
}
.exp-input {
  flex: 1;
  min-width: 220px;
  padding: 10px 14px;
  font-size: 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  outline: none;
}
.exp-input:focus { border-color: var(--primary); }
.exp-select {
  padding: 10px 14px;
  font-size: 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  outline: none;
}
.exp-note {
  font-size: 13px;
  line-height: 1.8;
  color: var(--text-muted);
  background: var(--primary-light);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  margin-bottom: 18px;
}
.exp-hint { font-size: 13px; color: var(--text-muted); margin-left: 12px; }
.exp-section-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  margin: 24px 0 12px;
}

/* 进度条 */
.exp-progress-bar { margin-bottom: 18px; }
.exp-progress-info {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--text);
  font-weight: 600;
  margin-bottom: 8px;
}
.exp-progress-track {
  height: 8px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
}
.exp-progress-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--primary), #8b5cf6);
  transition: width 0.3s ease;
}
.exp-progress-hint { font-size: 12px; color: var(--text-muted); margin-top: 6px; }

/* 学习卡片 */
.exp-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 14px;
}
.exp-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  background: var(--card-bg);
  transition: box-shadow var(--transition), border-color var(--transition);
}
.exp-card:hover { box-shadow: var(--shadow-md); border-color: var(--primary); }
.exp-card-mm { border-left: 4px solid var(--primary); }
.exp-card-plain { border-left: 4px solid var(--border); }
.exp-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.exp-card-jp { font-size: 20px; font-weight: 700; color: var(--text); }
.exp-speak {
  border: 1px solid var(--border);
  background: transparent;
  border-radius: 8px;
  padding: 4px 8px;
  cursor: pointer;
  font-size: 14px;
}
.exp-speak:hover { border-color: var(--primary); }
.exp-card-kana { font-size: 13px; color: var(--text-muted); margin-top: 2px; }
.exp-card-img {
  margin: 10px 0;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg);
  min-height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.exp-card-img img { width: 100%; height: auto; display: block; }
.exp-img-loading { font-size: 12px; color: var(--text-muted); padding: 30px 0; }
.exp-card-ex { font-size: 13px; color: var(--text); line-height: 1.7; margin-top: 6px; }
.exp-card-ex-cn { font-size: 12px; color: var(--text-muted); line-height: 1.6; margin-top: 2px; }

/* 测试题 */
.exp-test-list { display: flex; flex-direction: column; gap: 16px; }
.exp-quiz-item {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
}
.exp-quiz-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 12px; }
.exp-quiz-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--primary-light);
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
}
.exp-quiz-jp { font-size: 20px; font-weight: 700; color: var(--text); }
.exp-quiz-kana { font-size: 13px; color: var(--text-muted); }
.exp-quiz-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 10px;
}
.exp-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 14px;
  transition: all var(--transition);
}
.exp-option:hover { border-color: var(--primary); background: var(--primary-light); }
.exp-option input { accent-color: var(--primary); }

/* 结果 */
.exp-result-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 18px;
}
.exp-result-card {
  border-radius: var(--radius);
  padding: 20px 22px;
  text-align: center;
  border: 1px solid var(--border);
}
.exp-result-card.mm { background: linear-gradient(135deg, #eef2ff, #f5f3ff); border-color: #c7d2fe; }
.exp-result-card.plain { background: var(--bg); }
.exp-result-label { font-size: 14px; font-weight: 700; color: var(--text); }
.exp-result-rate {
  font-size: 34px;
  font-weight: 800;
  margin: 8px 0 4px;
  background: linear-gradient(135deg, var(--primary), #8b5cf6);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.exp-result-sub { font-size: 13px; color: var(--text); }
.exp-result-desc { font-size: 12px; color: var(--text-muted); margin-top: 6px; }
.exp-result-verdict {
  font-size: 14px;
  line-height: 1.9;
  color: var(--text);
  background: var(--primary-light);
  border-left: 4px solid var(--primary);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
}
.exp-verdict-note { font-size: 12px; color: var(--text-muted); }
.exp-detail-table-wrap { overflow-x: auto; }
.exp-detail-table { font-size: 13px; }
.exp-ok { color: #16a34a; font-weight: 700; }
.exp-bad { color: var(--danger); font-weight: 700; }

/* 历史记录 */
.exp-history { display: flex; flex-direction: column; gap: 10px; }
.exp-history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 13px;
}
.exp-history-main { display: flex; align-items: center; gap: 12px; }
.exp-history-topic { font-weight: 600; color: var(--text); }
.exp-history-time { color: var(--text-muted); font-size: 12px; }
.exp-history-scores { display: flex; gap: 10px; }
.exp-score { padding: 3px 10px; border-radius: 999px; font-size: 12px; }
.exp-score.mm { background: var(--primary-light); color: var(--primary); font-weight: 600; }
.exp-score.plain { background: var(--bg); color: var(--text-muted); }
.exp-history-pending { color: var(--text-muted); font-size: 12px; }
.exp-history-empty { color: var(--text-muted); font-size: 13px; padding: 12px 0; }


/* 管理页 · 实验数据面板 */
.exp-admin-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}
.exp-admin-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  background: var(--card-bg);
}
.exp-admin-card.mm { background: linear-gradient(135deg, #eef2ff, #f5f3ff); border-color: #c7d2fe; }
.exp-admin-card.plain { background: var(--bg); }
.exp-admin-card.diff { border-color: var(--primary); }
.exp-admin-card-label { font-size: 12px; color: var(--text-muted); font-weight: 600; }
.exp-admin-card-value {
  font-size: 26px;
  font-weight: 800;
  margin: 6px 0 4px;
  color: var(--primary);
}
.exp-admin-card-sub { font-size: 12px; color: var(--text-muted); }
.exp-admin-table-wrap { overflow-x: auto; }
.exp-admin-table { font-size: 13px; width: 100%; }


/* 预置实验套题选择 */
.exp-preset-note {
  font-size: 13px;
  color: #16a34a;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin-bottom: 16px;
}


/* 自主生成模式耗时提示（警告样式） */
.exp-preset-note.warn {
  color: #b45309;
  background: #fffbeb;
  border-color: #fcd34d;
  line-height: 1.8;
}


/* 学习阶段：两组分区展示 */
.exp-grid { display: block; }
.exp-group { margin-bottom: 26px; }
.exp-group:last-child { margin-bottom: 0; }
.exp-group-title {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.exp-group-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 14px;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: 999px;
}
.exp-group-badge.mm { background: linear-gradient(135deg, #eef2ff, #f5f3ff); color: var(--primary); border: 1px solid #c7d2fe; }
.exp-group-badge.plain { background: var(--bg); color: var(--text-muted); border: 1px solid var(--border); }
.exp-group-count { font-size: 12px; color: var(--text-muted); }
.exp-group-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 14px;
}

/* 测试题：只显示假名读音 */
.exp-quiz-kana-main {
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.02em;
}


/* ══════════════ 科研问卷页（/questionnaire） ══════════════ */
.qq-progress-note {
  margin: 4px 0 18px;
}
.qq-progress-note-inner {
  display: inline-block;
  padding: 9px 16px;
  border-radius: var(--radius);
  background: var(--primary-light);
  color: var(--primary-hover);
  font-size: 13.5px;
  border: 1px solid rgba(99, 102, 241, 0.18);
}

/* ── 问卷卡片列表 ── */
.qq-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 14px;
}
.qq-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: box-shadow var(--transition), border-color var(--transition);
}
.qq-card:hover {
  box-shadow: var(--shadow-md);
  border-color: rgba(99, 102, 241, 0.35);
}
.qq-card.is-done {
  background: #fbfcff;
}
.qq-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.qq-card-name {
  font-size: 15.5px;
  font-weight: 700;
  color: var(--text);
}
.qq-badge {
  flex: none;
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 999px;
  white-space: nowrap;
}
.qq-badge.done {
  background: #ecfdf5;
  color: #047857;
  border: 1px solid #a7f3d0;
}
.qq-badge.todo {
  background: #fffbeb;
  color: #b45309;
  border: 1px solid #fde68a;
}
.qq-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  font-size: 12.5px;
  color: var(--text-muted);
}
.qq-card-timing,
.qq-card-time {
  font-size: 12.5px;
  color: var(--text-muted);
}
.qq-card-time {
  color: #047857;
}
.qq-card-actions {
  margin-top: 4px;
}

/* ── 提交记录 ── */
.qq-section-title {
  margin: 30px 0 12px;
  font-size: 16px;
  color: var(--text);
}
.qq-history {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.qq-history-item {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-left: 3px solid var(--primary);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
}
.qq-history-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.qq-history-meta {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ── 答题视图 ── */
.qq-form-head {
  margin-bottom: 10px;
}
.qq-form-title {
  font-size: 21px;
  font-weight: 700;
  color: var(--text);
}
.qq-form-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  margin-top: 6px;
  font-size: 12.5px;
  color: var(--text-muted);
}
.qq-intro {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  font-size: 13px;
  line-height: 1.75;
  color: #475569;
  margin: 14px 0 18px;
}
.qq-intro-title {
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}
.qq-pagebar {
  position: sticky;
  top: 64px;
  z-index: 5;
  background: var(--bg);
  padding: 8px 0 10px;
}
.qq-progress-track {
  height: 6px;
  border-radius: 999px;
  background: var(--border);
  overflow: hidden;
}
.qq-progress-fill {
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, #6366f1, #8b5cf6);
  transition: width var(--transition);
}
.qq-progress-text {
  margin-top: 6px;
  font-size: 12.5px;
  color: var(--text-muted);
}
.qq-page-title {
  margin: 8px 0 14px;
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}

/* ── 题目 ── */
.qq-q {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 12px;
}
.qq-q-missing {
  border-color: var(--danger);
  background: var(--danger-light);
}
.qq-q-text {
  font-size: 14px;
  line-height: 1.7;
  color: var(--text);
  margin-bottom: 10px;
}
.qq-q-no {
  display: inline-block;
  min-width: 34px;
  font-weight: 700;
  color: var(--primary);
}
.qq-req {
  color: var(--danger);
  margin-left: 4px;
}
.qq-opt {
  color: var(--text-muted);
  font-size: 12.5px;
  margin-left: 4px;
}
.qq-scale-hint {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

/* ── 矩阵量表 ── */
.qq-matrix-wrap {
  overflow-x: auto;
}
.qq-matrix {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.qq-matrix th {
  padding: 6px 4px;
  font-weight: 600;
  color: var(--text-muted);
  font-size: 12.5px;
  text-align: center;
  min-width: 46px;
}
.qq-scale-cap {
  display: block;
  font-size: 11px;
  font-weight: 400;
}
.qq-matrix td {
  padding: 7px 6px;
  border-top: 1px solid var(--border);
  text-align: center;
}
.qq-row-label {
  text-align: left;
  color: var(--text);
  line-height: 1.6;
  min-width: 220px;
}
.qq-block-row td {
  background: #f8fafc;
  font-weight: 700;
  color: var(--primary-hover);
  font-size: 12.5px;
  text-align: left;
  padding: 6px 8px;
}
.qq-radio {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.qq-radio input {
  width: 17px;
  height: 17px;
  accent-color: var(--primary);
  cursor: pointer;
  margin: 0;
}

/* ── 单选 / 填空 ── */
.qq-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
}
.qq-option {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13.5px;
  color: var(--text);
  cursor: pointer;
}
.qq-option input {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
  cursor: pointer;
}
.qq-input,
.qq-textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-family: inherit;
  color: var(--text);
  background: #fff;
}
.qq-input:focus,
.qq-textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}
.qq-textarea {
  resize: vertical;
  line-height: 1.7;
}
.qq-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 20px 0 40px;
}
.qq-hint {
  font-size: 12.5px;
  color: var(--text-muted);
}

/* ── 已提交回顾 ── */
.qq-done-card {
  background: var(--card-bg);
  border: 1px solid #a7f3d0;
  border-radius: var(--radius);
  padding: 26px 20px;
  text-align: center;
  box-shadow: var(--shadow-sm);
}
.qq-done-icon {
  font-size: 40px;
  line-height: 1;
}
.qq-done-title {
  margin-top: 10px;
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
}
.qq-done-sub {
  margin-top: 6px;
  font-size: 13px;
  color: var(--text-muted);
}
.qq-done-page {
  margin: 22px 0 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  font-weight: 700;
  color: var(--primary-hover);
}
.qq-done-q {
  margin: 10px 0 6px;
  font-size: 13.5px;
  color: var(--text);
  line-height: 1.65;
}
.qq-done-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin-bottom: 12px;
}
.qq-done-table td {
  padding: 6px 8px;
  border-top: 1px solid var(--border);
}
.qq-done-val {
  text-align: center;
  font-weight: 700;
  color: var(--primary-hover);
  width: 70px;
}
.qq-done-text {
  font-size: 13.5px;
  color: #475569;
  background: #f8fafc;
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  margin-bottom: 12px;
  line-height: 1.7;
}

@media (max-width: 768px) {
  .qq-row-label {
    min-width: 130px;
    font-size: 12.5px;
  }
  .qq-matrix th {
    min-width: 38px;
  }
  .qq-cards {
    grid-template-columns: 1fr;
  }
}


/* ══════════════ 管理页 · 问卷回答情况 ══════════════ */
.qq-admin-title {
  margin: 34px 0 12px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  font-size: 16px;
  color: var(--text);
}
.qq-admin-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.qq-admin-label {
  font-size: 13px;
  color: var(--text-muted);
}
.qq-admin-select {
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  background: #fff;
  color: var(--text);
  min-width: 240px;
}
.qq-admin-note {
  font-size: 12.5px;
  color: var(--text-muted);
}
.qq-admin-row {
  cursor: pointer;
}
.qq-admin-row:hover {
  background: var(--primary-light);
}
.qq-admin-detail td {
  background: #f8fafc;
  padding: 12px 14px;
}
.qq-score-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}
.qq-score-chip {
  font-size: 12px;
  padding: 3px 9px;
  border-radius: 999px;
  background: #eef2ff;
  color: var(--primary-hover);
  border: 1px solid rgba(99, 102, 241, 0.2);
  white-space: nowrap;
}


/* ══════════════ 词级呈现模式徽章（被试内实验） ══════════════ */
.mode-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  white-space: nowrap;
  vertical-align: middle;
}
.mode-badge.multimodal {
  background: #eef2ff;
  color: #4f46e5;
  border: 1px solid rgba(99, 102, 241, 0.25);
}
.mode-badge.text-only {
  background: #f3f4f6;
  color: #4b5563;
  border: 1px solid #e5e7eb;
}
/* 未选中具体词单时，呈现模式相关按钮置灰（仍可点击以给出提示） */
#btn-set-modes:disabled,
#btn-export-bindings:disabled {
  cursor: not-allowed;
}


/* ══════════════ 实验页：正式测试（四类题型） ══════════════ */
/* 材料来源 = 我的实验词单：词单多选 */
.exp-topic-list {
  flex: 1;
  min-width: 240px;
  max-width: 100%;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.exp-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  cursor: pointer;
  font-size: 13px;
  transition: border-color var(--transition), background var(--transition);
}
.exp-check:hover { border-color: var(--primary); background: var(--primary-light); }
.exp-check input { accent-color: var(--primary); }
.exp-check-name { font-weight: 600; color: var(--text); }
.exp-check-count { font-size: 12px; color: var(--text-muted); }

/* 无实验词单时的提醒 */
.exp-topic-hint {
  font-size: 13px;
  line-height: 1.7;
  color: #b45309;
  background: #fffbeb;
  border: 1px solid #fcd34d;
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin: 0 0 16px;
}

/* 测试模式单选 */
.exp-radio {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  cursor: pointer;
  font-size: 13.5px;
  transition: border-color var(--transition), background var(--transition);
}
.exp-radio:hover { border-color: var(--primary); background: var(--primary-light); }
.exp-radio input { accent-color: var(--primary); }

/* 测试题：题型标签 / 听辨播放按钮 / 打字题 */
.exp-quiz-type {
  font-size: 12px;
  font-weight: 600;
  color: var(--primary);
  background: var(--primary-light);
  border-radius: 999px;
  padding: 3px 10px;
  white-space: nowrap;
}
.exp-quiz-audio {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.exp-play-audio { font-size: 15px; padding: 10px 22px; }
.exp-play-audio.speaking { border-color: var(--primary); color: var(--primary); }
.exp-quiz-audio-hint { font-size: 12px; color: var(--text-muted); }
.exp-quiz-prompt {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.8;
  margin-bottom: 12px;
  word-break: break-word;
}
.exp-quiz-prompt.cloze { font-size: 17px; font-weight: 600; }
.exp-quiz-input { max-width: 320px; font-size: 16px; }
.exp-quiz-input::placeholder { font-size: 13px; color: var(--text-muted); }

/* 学习卡片：中文释义（两组同给，唯一差异是配图与发音） */
.exp-card-cn { font-size: 13px; font-weight: 600; color: var(--primary); margin-top: 4px; }

/* 结果页：维度分卡片 */
.exp-result-card.dim {
  background: linear-gradient(135deg, #eff6ff, #f0f9ff);
  border-color: #bfdbfe;
}
.exp-result-card.dim-productive {
  background: linear-gradient(135deg, #fef3c7, #fffbeb);
  border-color: #fde68a;
}

/* 结果页：窄屏横向滚动（模态 × 维度 交叉表 / 逐题明细表） */
.exp-cross-table { font-size: 13px; width: 100%; min-width: 560px; }
.exp-detail-table { min-width: 660px; }

/* 长文案 toast（未绑定呈现模式提醒等）折行显示 */
.toast.toast-long {
  max-width: min(460px, 86vw);
  white-space: normal;
  line-height: 1.6;
}

/* ── 断点续答提示条（学生端实验页：有未完成会话时显示）── */
.exp-resume {
  border: 1.5px solid var(--primary);
  background: var(--primary-light);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  margin: 0 0 16px;
}
.exp-resume-text {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.7;
}
.exp-resume-time {
  display: block;
  font-size: 12px;
  font-weight: 400;
  color: var(--text-muted);
}
.exp-resume-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}

/* ── 完成情况清单：状态着色 ── */
.exp-completion-ok { color: #059669; font-weight: 600; }
.exp-completion-doing { color: #b45309; font-weight: 600; }
.exp-completion-none { color: var(--text-muted); }

/* ── 管理后台：实验设置「状态大卡 + 一键动作」（易用性优先，细节收进折叠区）── */
.exp-hero {
  border-radius: var(--radius-md, 12px);
  border: 1.5px solid var(--border);
  background: var(--bg);
  padding: 18px 20px;
  margin: 0 0 16px;
}
.exp-hero-idle { border-color: #6ee7b7; background: linear-gradient(135deg, #ecfdf5, #f0fdf4); }
.exp-hero-live { border-color: #fca5a5; background: linear-gradient(135deg, #fef2f2, #fff1f2); }
.exp-hero-title { font-size: 19px; font-weight: 700; color: var(--text); line-height: 1.5; }
.exp-hero-desc { font-size: 14px; color: var(--text); line-height: 1.8; margin-top: 6px; }
.exp-hero-meta { font-size: 12.5px; color: var(--text-muted); line-height: 1.7; margin-top: 8px; }

.exp-quick-actions { display: flex; gap: 12px; flex-wrap: wrap; align-items: stretch; margin-bottom: 18px; }
.exp-quick-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 14px 22px;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.4;
  text-align: left;
}
.exp-quick-btn small { font-size: 12px; font-weight: 400; opacity: 0.85; }
.exp-quick-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.exp-quick-hint {
  flex-basis: 100%;
  margin: 2px 0 0;
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.7;
}

/* ── 管理后台：折叠区（实验明细 / 问卷 / 高级设置）── */
.admin-details {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  padding: 0 16px;
  margin: 18px 0 0;
}
.admin-details > summary {
  cursor: pointer;
  padding: 14px 0;
  font-size: 14.5px;
  font-weight: 600;
  color: var(--text);
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
}
.admin-details > summary::-webkit-details-marker { display: none; }
.admin-details > summary::before {
  content: "▶";
  font-size: 11px;
  color: var(--text-muted);
  transition: transform var(--transition);
}
.admin-details[open] > summary::before { transform: rotate(90deg); }
.admin-details > summary:hover { color: var(--primary); }
.admin-details > *:not(summary) { padding-bottom: 4px; }
.admin-details > *:last-child { padding-bottom: 16px; }

@media (max-width: 768px) {
  .exp-quick-actions { flex-direction: column; }
  .exp-quick-btn { width: 100%; }
}
