/* ============================================================
   词根派 (Fresh)
   设计：奶油纸感底 + 深墨字 + 森林绿主色 + 琥珀橘强调
   ============================================================ */

/* ---------- 变量 ---------- */
:root {
  --bg:            #f3ede0;
  --bg-pattern:    #ede5d3;
  --surface:       #ffffff;
  --surface-2:     #fbf7ee;
  --surface-3:     #f7f1e3;
  --ink:           #2b2418;
  --ink-2:         #5a4f3c;
  --ink-3:         #8a7e6b;
  --accent:        #2d6a4f;          /* 森林绿 */
  --accent-soft:   #d8e2dc;
  --accent-deep:   #1b4332;
  --warm:          #c2410c;          /* 琥珀橘 */
  --warm-soft:     #fed7aa;
  --warm-deep:     #9a3412;
  --gold:          #b45309;
  --gold-soft:     #fef3c7;
  --danger:        #b91c1c;
  --danger-soft:   #fee2e2;
  --success:       #15803d;
  --success-soft:  #dcfce7;
  --border:        #e8e1d5;
  --border-strong: #d6cdb8;
  --shadow-sm:     0 1px 2px rgba(43, 36, 24, 0.04), 0 1px 3px rgba(43, 36, 24, 0.06);
  --shadow:        0 4px 12px rgba(43, 36, 24, 0.06), 0 1px 3px rgba(43, 36, 24, 0.04);
  --shadow-lg:     0 16px 40px rgba(43, 36, 24, 0.12), 0 4px 8px rgba(43, 36, 24, 0.06);
  --radius-sm:     8px;
  --radius:        12px;
  --radius-lg:     18px;
  --serif:         Georgia, 'Times New Roman', 'Source Han Serif SC', 'Songti SC', serif;
  --sans:          -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

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

html, body {
  font-family: var(--sans);
  color: var(--ink);
  background: var(--bg);
  background-image:
    radial-gradient(circle at 1px 1px, rgba(43, 36, 24, 0.05) 1px, transparent 0);
  background-size: 22px 22px;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  /* CJK 排版优化：标点悬挂规则 + 长英文/URL 任意断 + 中英文间自动调字距 */
  line-break: strict;
  overflow-wrap: anywhere;
  text-spacing-trim: space-all;
  word-spacing: 0.05em;
  letter-spacing: 0;
}

button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, textarea, select { font-family: inherit; color: inherit; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- App 框架 ---------- */
.app {
  max-width: 560px;
  margin: 0 auto;
  min-height: 100vh;
  padding-bottom: 67px;  /* 给底部导航留位（=bottom-nav 实际高度 67px） */
  position: relative;
  background: var(--bg);
  display: flex;
  flex-direction: column;
}

/* 顶部细栏 */
.app-bar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  background: rgba(243, 237, 224, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.app-bar-logo {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--serif);
  font-size: 18px; font-weight: 700;
  color: var(--ink);
}
.app-bar-logo .logo-mark {
  width: 30px; height: 30px;
  display: inline-block;
  border-radius: 6px;
  object-fit: contain;
}
.app-bar-actions { display: flex; align-items: center; gap: 6px; }
.app-bar-user {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 13px;
  color: var(--ink-2);
  font-weight: 500;
}
.app-bar-user .avatar {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
  color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700;
}
.icon-btn {
  width: 36px; height: 36px;
  border-radius: 10px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--ink-2);
  font-size: 16px;
  transition: background 0.2s;
}
.icon-btn:hover { background: var(--surface-3); }

/* 底部导航 */
.bottom-nav {
  position: fixed !important;
  bottom: 0 !important;
  left: 0 !important;
  right: 0 !important;
  width: 100% !important;
  max-width: 560px !important;
  margin: 0 auto !important;
  z-index: 9999 !important;
  display: flex;
  justify-content: space-around;
  align-items: stretch;
  background: rgba(251, 247, 238, 0.96);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--border);
  padding: 8px 4px calc(8px + env(safe-area-inset-bottom)) 4px;
  box-shadow: 0 -2px 12px rgba(43, 36, 24, 0.06);
}
.bottom-nav.hidden { display: none !important; }
.bottom-nav-item {
  flex: 1 1 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 3px;
  padding: 6px 0;
  color: var(--ink-3);
  font-size: 11px;
  font-weight: 500;
  border-radius: 8px;
  transition: color 0.2s;
  min-width: 0;
}
.bottom-nav-item .nav-icon { font-size: 19px; line-height: 1; }
.bottom-nav-item.active { color: var(--accent); }
.bottom-nav-item.active .nav-icon { transform: scale(1.08); }

/* ---------- 主内容区 ---------- */
.page { display: none; padding: 20px; animation: pageIn 0.35s ease; }
.page.active { display: block; }
@keyframes pageIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.page-title {
  font-family: var(--serif);
  font-size: 24px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 4px;
  letter-spacing: -0.01em;
}
.page-subtitle { font-size: 13px; color: var(--ink-3); margin-bottom: 18px; }

/* ---------- 卡片基础 ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-sm);
}
.card-title { font-size: 14px; font-weight: 600; color: var(--ink); margin-bottom: 10px; }
.card-row { display: flex; align-items: center; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--border); }
.card-row:last-child { border-bottom: none; }

/* ---------- 登录页 ---------- */
.auth-page {
  display: none;
  flex: 1;
  align-items: center;
  justify-content: center;
  padding: 24px;
  box-sizing: border-box;
}
.auth-page.active { display: flex; }   /* config.js 用 class 切换显示 */
.auth-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px 28px;
  box-shadow: var(--shadow-lg);
}
.auth-logo {
  width: 56px; height: 56px;
  margin: 0 auto 16px;
  display: block;
  border-radius: 14px;
  object-fit: contain;
}
.auth-title {
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 700;
  text-align: center;
  margin-bottom: 6px;
  color: var(--ink);
}
.auth-sub { font-size: 13px; color: var(--ink-3); text-align: center; margin-bottom: 22px; }

.form-group { margin-bottom: 16px; }
.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-2);
  margin-bottom: 6px;
}
.form-input {
  width: 100%;
  padding: 11px 14px;
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 14px;
  color: var(--ink);
  transition: all 0.2s;
  outline: none;
  box-sizing: border-box;
}
.form-input:focus {
  border-color: var(--accent);
  background: #fff;
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.form-input.error { border-color: var(--danger); }
.error-msg {
  color: var(--danger);
  font-size: 12px;
  margin-top: 5px;
  display: none;
}
.error-msg.show { display: block; }
.general-error {
  background: var(--danger-soft);
  color: var(--danger);
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 16px;
  display: none;
  border: 1px solid #fecaca;
}
.general-error.show { display: block; animation: shake 0.4s ease; }
@keyframes shake {
  0%,100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

.btn {
  width: 100%;
  padding: 12px 18px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  letter-spacing: 0.02em;
}
.btn:hover { background: var(--accent-deep); transform: translateY(-1px); box-shadow: 0 6px 16px rgba(45, 106, 79, 0.25); }
.btn:active { transform: translateY(0); }
.btn-warm { background: var(--warm); }
.btn-warm:hover { background: var(--warm-deep); box-shadow: 0 6px 16px rgba(194, 65, 12, 0.25); }
.btn-secondary {
  background: var(--surface-3);
  color: var(--ink);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--border); box-shadow: none; }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #991b1b; box-shadow: 0 6px 16px rgba(185, 28, 28, 0.25); }
.btn-sm {
  width: auto;
  padding: 6px 14px;
  font-size: 12px;
  border-radius: 8px;
  font-weight: 600;
}

.link-row { text-align: center; margin-top: 14px; font-size: 13px; color: var(--ink-3); }
.link-row a { color: var(--accent); font-weight: 500; }

/* ---------- 首页 ---------- */
.greet-card {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-deep) 100%);
  color: #fff;
  border-radius: var(--radius-lg);
  padding: 22px 20px;
  margin-bottom: 16px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.greet-card::after {
  content: '';
  position: absolute;
  top: -30px; right: -30px;
  width: 140px; height: 140px;
  background: rgba(255,255,255,0.08);
  border-radius: 50%;
}
.greet-card .greet-line { font-size: 13px; opacity: 0.85; margin-bottom: 4px; }
.greet-card .greet-name {
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 14px;
}
.greet-card .stat-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  position: relative;
  z-index: 1;
}
.greet-card .stat {
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 10px;
  padding: 8px 10px;
  text-align: center;
}
.greet-card .stat-val {
  font-size: 16px;
  font-weight: 700;
  font-family: var(--serif);
  line-height: 1.1;
}
.greet-card .stat-label { font-size: 11px; opacity: 0.85; margin-top: 2px; }

.streak-pill {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--warm-soft);
  color: var(--warm-deep);
  font-size: 12px; font-weight: 600;
  padding: 4px 12px;
  border-radius: 20px;
  border: 1px solid #fdba74;
  margin-bottom: 14px;
}
.streak-pill.streak-hint {
  background: var(--surface-3);
  color: var(--ink-3);
  border-color: var(--border);
  font-weight: 500;
}

/* ---------- 进度面板 ---------- */
.progress-bar-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 16px;
}
.progress-row {
  display: flex; align-items: baseline; justify-content: space-between;
  font-size: 13px;
  color: var(--ink-2);
  margin-bottom: 8px;
  gap: 12px;
}
.progress-row > span:first-child { min-width: 0; flex-shrink: 1; white-space: nowrap; }
.progress-row strong { color: var(--ink); font-weight: 700; font-size: 15px; white-space: nowrap; font-variant-numeric: tabular-nums; flex-shrink: 0; }
.progress-track {
  width: 100%;
  height: 8px;
  background: var(--surface-3);
  border-radius: 99px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-deep));
  border-radius: 99px;
  transition: width 0.5s ease;
}
.progress-fill.warm { background: linear-gradient(90deg, var(--warm), #fb923c); }
.progress-bar-card.is-full .progress-meta { border-top-color: transparent; }   /* 满进度：隐藏分隔虚线 */
.progress-meta {
  display: flex; justify-content: space-between;
  font-size: 12px; color: var(--ink-3);
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
  gap: 12px;
}
.progress-meta span { min-width: 0; flex-shrink: 1; white-space: nowrap; }
.progress-meta span strong { color: var(--ink); white-space: nowrap; font-variant-numeric: tabular-nums; font-weight: 700; }

/* ---------- 大 CTA 按钮（学习入口） ---------- */
.cta-stack { display: flex; flex-direction: column; gap: 10px; margin-bottom: 18px; }
.cta-card {
  display: flex; align-items: center; gap: 14px;
  padding: 16px 18px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s;
  text-align: left;
  width: 100%;
}
.cta-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(45, 106, 79, 0.12);
}
.cta-card.warm:hover {
  border-color: var(--warm);
  box-shadow: 0 8px 20px rgba(194, 65, 12, 0.12);
}
.cta-icon {
  width: 44px; height: 44px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  background: var(--accent-soft);
  flex-shrink: 0;
}
.cta-icon.warm { background: var(--warm-soft); }
.cta-body { flex: 1; min-width: 0; }
.cta-title {
  font-size: 15px; font-weight: 700;
  color: var(--ink);
  display: flex; align-items: center; gap: 8px;
}
.cta-desc { font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.cta-arrow { color: var(--ink-3); font-size: 18px; transition: transform 0.2s; }
.cta-card:hover .cta-arrow { color: var(--accent); transform: translateX(3px); }
.cta-card.warm:hover .cta-arrow { color: var(--warm); }

.badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 22px; height: 22px;
  padding: 0 8px;
  border-radius: 11px;
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}
.badge.orange { background: var(--warm); }
.badge.green { background: var(--success); }
.badge.muted { background: var(--ink-3); }

/* ---------- 词书网格（添加页） ---------- */
.section-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  margin: 4px 0 10px;
  display: flex; align-items: center; justify-content: space-between;
}
.section-title .right-link { font-size: 12px; color: var(--accent); font-weight: 500; }

.tabs {
  display: flex;
  background: var(--surface-3);
  border-radius: 12px;
  padding: 4px;
  margin-bottom: 14px;
  gap: 4px;
}
.tab {
  flex: 1;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-3);
  text-align: center;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}
.tab.active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}

.search-bar {
  position: relative;
  margin-bottom: 14px;
}
.search-bar input {
  width: 100%;
  padding: 11px 14px 11px 38px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 14px;
  outline: none;
  transition: all 0.2s;
  box-sizing: border-box;
}
.search-bar input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.search-bar::before {
  content: '⌕';
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--ink-3);
  font-size: 16px;
}

.exam-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 18px;
}
.exam-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 12px;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
  position: relative;
}
.exam-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}
.exam-icon { font-size: 28px; margin-bottom: 4px; }
.exam-name {
  font-family: var(--serif);
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 2px;
  word-break: keep-all;
  overflow-wrap: anywhere;
}
.exam-count { font-size: 11px; color: var(--ink-3); }
.exam-badge {
  display: inline-block;
  margin-top: 6px;
  font-size: 10px;
  padding: 2px 8px;
  background: var(--accent-soft);
  color: var(--accent-deep);
  border-radius: 10px;
  font-weight: 600;
}

/* ---------- 列表项（卡片式） ---------- */
.list-toolbar {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin-bottom: 12px;
  align-items: center;
}
.list-toolbar .pill-btn {
  padding: 6px 12px;
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: 99px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-2);
  cursor: pointer;
  transition: all 0.2s;
}
.list-toolbar .pill-btn:hover { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-deep); }
.list-toolbar .pill-btn.prefix { background: #e0e7ff; color: #3730a3; border-color: #c7d2fe; }
.list-toolbar .pill-btn.root { background: var(--accent-soft); color: var(--accent-deep); border-color: #b7d4c5; }
.list-toolbar .pill-btn.suffix { background: var(--warm-soft); color: var(--warm-deep); border-color: #fdba74; }

.card-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 540px;
  overflow-y: auto;
  padding-right: 4px;
}
.card-list::-webkit-scrollbar { width: 4px; }
.card-list::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 2px; }

.card-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.card-item:hover {
  border-color: var(--accent);
  transform: translateX(2px);
  box-shadow: var(--shadow);
}
.card-left { flex: 1; min-width: 0; }
.card-top {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 3px;
  flex-wrap: wrap;
}
.card-text {
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
  font-style: italic;
}
.card-tag-admin {
  font-size: 10px;
  padding: 2px 6px;
  background: var(--gold-soft);
  color: var(--gold);
  border-radius: 4px;
  font-weight: 600;
}
.card-type-label {
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 600;
}
.card-type-label.prefix { background: #e0e7ff; color: #3730a3; }
.card-type-label.root { background: var(--accent-soft); color: var(--accent-deep); }
.card-type-label.suffix { background: var(--warm-soft); color: var(--warm-deep); }
.difficulty-dots { display: flex; gap: 3px; }
.diff-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--border-strong); }
.diff-dot.filled { background: var(--accent); }
.card-bottom { font-size: 13px; color: var(--ink-2); }
.card-meaning { color: var(--ink-2); }
.card-example {
  font-size: 12px;
  color: var(--ink-3);
  font-style: italic;
  margin-top: 2px;
}
.card-example-cn { color: var(--ink-3); font-style: normal; }
.card-tags { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 4px; }
.card-tag {
  font-size: 10px;
  padding: 2px 6px;
  background: var(--surface-3);
  color: var(--ink-2);
  border-radius: 4px;
  font-weight: 500;
}
.card-right { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.card-add-btn {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-deep);
  font-size: 16px;
  font-weight: 700;
  border: 1px solid transparent;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
}
.card-add-btn:hover { background: var(--accent); color: #fff; }
.card-add-btn.added { background: var(--success-soft); color: var(--success); }
.card-arrow { color: var(--ink-3); font-size: 16px; }

/* ---------- 词条空状态 ---------- */
.list-empty {
  text-align: center;
  color: var(--ink-3);
  padding: 40px 20px;
  font-size: 13px;
}
.list-empty-icon { font-size: 36px; margin-bottom: 8px; opacity: 0.6; }
.vocab-empty-tip {
  text-align: center;
  padding: 40px 20px;
  background: var(--surface);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
}
.vocab-empty-tip .tip-icon { font-size: 36px; margin-bottom: 8px; opacity: 0.7; }
.vocab-empty-tip .tip-text { font-size: 15px; font-weight: 600; color: var(--ink); margin-bottom: 4px; }
.vocab-empty-tip .tip-sub { font-size: 12px; color: var(--ink-3); }

/* ---------- 模态框 ---------- */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(43, 36, 24, 0.5);
  z-index: 100;
  justify-content: center;
  align-items: flex-end;
  animation: pageIn 0.2s ease;
  padding: 20px;
}
.modal-overlay.active { display: flex; }
.modal-content {
  background: var(--surface);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  width: 100%;
  max-width: 480px;
  max-height: 85vh;
  overflow-y: auto;
  padding: 24px 22px calc(24px + env(safe-area-inset-bottom));
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.25s ease;
  position: relative;
}
.modal-overlay.center .modal-content { border-radius: var(--radius-lg); align-self: center; max-width: 380px; }
@keyframes slideUp {
  from { transform: translateY(40px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
.modal-close {
  position: absolute;
  top: 12px; right: 14px;
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  color: var(--ink-3);
  border-radius: 50%;
  background: var(--surface-3);
  transition: all 0.2s;
}
.modal-close:hover { background: var(--border); color: var(--ink); }

.modal-word {
  font-family: var(--serif);
  font-size: 32px;
  font-weight: 700;
  font-style: italic;
  color: var(--ink);
  margin-bottom: 8px;
}
.modal-type-badge {
  display: inline-block;
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 10px;
  font-weight: 600;
  margin-bottom: 18px;
}
.modal-type-badge.prefix { background: #e0e7ff; color: #3730a3; }
.modal-type-badge.root { background: var(--accent-soft); color: var(--accent-deep); }
.modal-type-badge.suffix { background: var(--warm-soft); color: var(--warm-deep); }
.modal-section { margin-bottom: 16px; }
.modal-section-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-3);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 4px;
}
.modal-section-value { font-size: 15px; color: var(--ink); line-height: 1.55; }
.modal-section-value.example { font-style: italic; color: var(--accent); }
.modal-difficulty { display: flex; align-items: center; gap: 6px; }
.modal-difficulty .diff-dot { width: 9px; height: 9px; }
.modal-tags { display: flex; gap: 5px; flex-wrap: wrap; }
.modal-btn {
  width: 100%;
  padding: 12px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 8px;
  transition: all 0.2s;
}
.modal-btn:hover { background: var(--accent-deep); }
.modal-btn.primary { background: var(--accent); }
.modal-btn.added {
  background: var(--success-soft);
  color: var(--success);
  cursor: default;
}

/* ---------- 设置页 ---------- */
.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.setting-row:last-child { border-bottom: none; }
.setting-label { font-size: 14px; font-weight: 600; color: var(--ink); }
.setting-desc { font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.setting-input {
  width: 72px;
  padding: 8px 10px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 15px;
  text-align: center;
  outline: none;
  background: var(--surface-2);
  font-weight: 600;
  color: var(--ink);
}
.setting-input:focus { border-color: var(--accent); }

/* iOS 风格开关 */
.switch { position: relative; display: inline-block; width: 46px; height: 26px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider {
  position: absolute; cursor: pointer; inset: 0;
  background: var(--border-strong);
  transition: 0.3s;
  border-radius: 26px;
}
.switch .slider::before {
  position: absolute; content: "";
  height: 20px; width: 20px;
  left: 3px; bottom: 3px;
  background: #fff;
  transition: 0.3s;
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0,0,0,0.15);
}
.switch input:checked + .slider { background: var(--accent); }
.switch input:checked + .slider::before { transform: translateX(20px); }

.save-msg {
  margin-top: 14px;
  text-align: center;
  font-size: 13px;
  color: var(--success);
  display: none;
}
.save-msg.show { display: block; }

/* ---------- 账号页 ---------- */
.account-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 16px;
  margin-bottom: 16px;
  text-align: center;
}
.account-avatar {
  width: 56px; height: 56px;
  margin: 0 auto 8px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
  color: #fff;
  font-family: var(--serif);
  font-size: 24px;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.account-name {
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
}
.account-label { font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.btn-row { display: flex; gap: 10px; }
.btn-row .btn { flex: 1; }
.muted-note { font-size: 12px; color: var(--ink-3); text-align: center; margin-top: 10px; line-height: 1.5; }

/* ---------- 排行榜 ---------- */
.rank-meta {
  font-size: 12px;
  color: var(--ink-3);
  text-align: center;
  margin-bottom: 14px;
}
.rank-podium {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
  margin-bottom: 14px;
}
.podium {
  text-align: center;
  padding: 14px 8px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  position: relative;
}
.podium.first {
  background: linear-gradient(180deg, #fef3c7 0%, #fde68a 100%);
  border-color: #fcd34d;
  transform: translateY(-6px);
}
.podium .podium-medal { font-size: 22px; }
.podium .podium-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  margin-top: 4px;
  word-break: keep-all;
  overflow-wrap: anywhere;
  display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden;
}
.podium .podium-score {
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 700;
  color: var(--accent-deep);
  margin-top: 2px;
}
.podium .podium-me-tag {
  position: absolute; top: 6px; right: 6px;
  font-size: 10px;
  background: var(--accent);
  color: #fff;
  padding: 2px 6px;
  border-radius: 6px;
  font-weight: 600;
}

.rank-list {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.rank-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
.rank-item:last-child { border-bottom: none; }
.rank-item.current {
  background: var(--accent-soft);
  border-left: 3px solid var(--accent);
}
.rank-num {
  width: 28px;
  font-family: var(--serif);
  font-size: 16px;
  font-weight: 700;
  color: var(--ink-3);
  text-align: center;
}
.rank-item.current .rank-num { color: var(--accent-deep); }
.rank-medal { font-size: 18px; }
.rank-name { flex: 1; font-size: 14px; color: var(--ink); }
.rank-score {
  font-family: var(--serif);
  font-size: 16px;
  font-weight: 700;
  color: var(--accent-deep);
}

/* ---------- 复习时间线 ---------- */
.review-timeline-compact { margin-bottom: 14px; }
.review-bucket {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s;
}
.review-bucket:hover { border-color: var(--accent); transform: translateX(2px); }
.review-bucket .bucket-icon { font-size: 16px; }
.review-bucket .bucket-label { flex: 1; font-size: 13px; font-weight: 600; color: var(--ink); }
.review-bucket .bucket-count { font-size: 16px; font-weight: 700; color: var(--accent); font-family: var(--serif); }
.review-bucket .bucket-arrow { color: var(--ink-3); }

.timeline-empty {
  text-align: center;
  color: var(--ink-3);
  font-size: 13px;
  padding: 10px;
  background: var(--surface-3);
  border-radius: 10px;
}

/* ---------- 学习/复习全屏 overlay ---------- */
.quiz-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: linear-gradient(135deg, #2d6a4f 0%, #1b4332 100%);
  z-index: 200;
  flex-direction: column;
  padding: 20px;
}
.quiz-overlay.active { display: flex; animation: pageIn 0.3s ease; }
.quiz-inner {
  width: 100%;
  max-width: 460px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  flex: 1;
  justify-content: center;
  gap: 16px;
}
.quiz-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: #fff;
}
.quiz-topbar #learn-progress { font-size: 15px; font-weight: 600; }
.quiz-topbar #learn-mode-label {
  background: rgba(255, 213, 79, 0.2);
  color: #ffd54f;
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 99px;
}
.quiz-topbar #learn-score { font-size: 15px; font-weight: 600; }
.quiz-exit {
  width: 36px; height: 36px;
  background: rgba(255,255,255,0.15);
  color: #fff;
  border-radius: 50%;
  font-size: 18px;
  transition: background 0.2s;
}
.quiz-exit:hover { background: rgba(255,255,255,0.3); }

.quiz-card {
  background: #fff;
  border-radius: 20px;
  padding: 28px 22px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
  display: flex;
  flex-direction: column;
}
.learn-question {
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 700;
  font-style: italic;
  color: var(--ink);
  text-align: center;
  line-height: 1.4;
  margin-bottom: 20px;
}
.learn-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.learn-option {
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 13px 16px;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 14px;
  color: var(--ink);
  text-align: left;
  font-weight: 500;
}
.learn-option:hover:not(.disabled) {
  border-color: var(--accent);
  background: #fff;
  transform: translateX(3px);
}
.learn-option.correct {
  border-color: var(--success);
  background: var(--success-soft);
  color: var(--success);
}
.learn-option.wrong {
  border-color: var(--danger);
  background: var(--danger-soft);
  color: var(--danger);
}
.learn-option.disabled { cursor: not-allowed; opacity: 0.7; }
@keyframes correctPop {
  0% { transform: scale(1); }
  50% { transform: scale(1.04); box-shadow: 0 0 24px rgba(21, 128, 61, 0.4); }
  100% { transform: scale(1); }
}
.learn-option.correct-anim { animation: correctPop 0.4s ease; }
@keyframes wrongShake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-8px); }
  40% { transform: translateX(8px); }
  60% { transform: translateX(-6px); }
  80% { transform: translateX(6px); }
}
.learn-option.wrong-anim { animation: wrongShake 0.45s ease; }
.learn-feedback {
  margin-top: 14px;
  font-weight: 600;
  font-size: 14px;
  text-align: center;
  min-height: 22px;
}

.learn-detail {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
}
.learn-detail .detail-row {
  font-size: 13px;
  color: var(--ink-2);
  margin-bottom: 4px;
  line-height: 1.5;
}
.learn-detail .detail-row strong { color: var(--ink); font-family: var(--serif); font-style: italic; }
.learn-detail .detail-row:last-child { margin-bottom: 0; }

.learn-buttons {
  display: flex;
  gap: 10px;
}
.learn-buttons button { flex: 1; }
.btn-slash {
  background: var(--warm);
  color: #fff;
}
.btn-slash:hover { background: var(--warm-deep); }
.btn-slash:disabled { background: var(--border-strong); color: var(--ink-3); cursor: not-allowed; transform: none; box-shadow: none; }

/* ---------- Loading ---------- */
.loading-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(243, 237, 224, 0.7);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 999;
  justify-content: center;
  align-items: center;
}
.loading-overlay.show { display: flex; }
.loading-card {
  background: var(--surface);
  padding: 22px 28px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 14px;
  max-width: 320px;
}
.loading-spinner {
  width: 26px; height: 26px;
  border: 3px solid var(--accent-soft);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-text { font-size: 13px; color: var(--ink-2); }

/* ---------- Toast ---------- */
.toast-container {
  position: fixed;
  top: 70px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 998;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  width: 90%;
  max-width: 380px;
}
.toast {
  padding: 10px 16px;
  background: var(--ink);
  color: #fff;
  border-radius: 10px;
  font-size: 13px;
  text-align: center;
  box-shadow: var(--shadow);
  animation: toastIn 0.25s ease;
  pointer-events: auto;
}
.toast.success { background: var(--success); }
.toast.warning { background: var(--warm); }
.toast.info { background: var(--ink-2); }
@keyframes toastIn {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- 反馈/弹窗表单 ---------- */
.feedback-textarea {
  width: 100%;
  min-height: 130px;
  padding: 10px 14px;
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 14px;
  resize: vertical;
  box-sizing: border-box;
  outline: none;
  font-family: inherit;
  color: var(--ink);
  transition: all 0.2s;
}
.feedback-textarea:focus { border-color: var(--accent); background: var(--surface); }
.feedback-textarea::placeholder { color: var(--ink-3); }
.feedback-select {
  width: 100%;
  padding: 10px 14px;
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 14px;
  outline: none;
  color: var(--ink);
}
.admin-pwd-error {
  background: var(--danger-soft);
  color: var(--danger);
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 12px;
  display: none;
}
.admin-pwd-error.show { display: block; }
.admin-pwd-success {
  background: var(--success-soft);
  color: var(--success);
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 12px;
  display: none;
}
.admin-pwd-success.show { display: block; }

/* ---------- 完成态卡片（新学完成 / 词库空） ---------- */
.complete-card {
  text-align: center;
  padding: 22px 18px;
  background: var(--gold-soft);
  border: 1px solid #fde68a;
  border-radius: var(--radius);
  margin-top: 14px;
}
.complete-card .complete-icon { font-size: 36px; margin-bottom: 6px; }
.complete-card .complete-text {
  font-family: var(--serif);
  font-size: 16px;
  font-weight: 700;
  color: var(--gold);
}

/* ---------- 通用文本 ---------- */
.vocab-count { font-size: 12px; color: var(--ink-3); }

/* ---------- 响应式微调 ---------- */
/* 手机（< 600px）：紧凑布局 */
@media (max-width: 599px) {
  .app { padding-bottom: 67px; }
  .page { padding: 16px; }
  .greet-card .stat-val { font-size: 15px; }
  .greet-card { padding: 18px 16px; }
  .greet-card .greet-name { font-size: 20px; }
  .exam-grid { grid-template-columns: 1fr 1fr; }
  .auth-card { padding: 28px 22px; }
  .cta-card { padding: 14px 14px; }
  .cta-icon { width: 40px; height: 40px; font-size: 20px; }
}

/* iPad / 中屏（600–1023px）：中等布局 */
@media (min-width: 600px) and (max-width: 1023px) {
  .app { max-width: 600px; padding-bottom: 67px; }
  .page { padding: 24px; }
  .greet-card .stat-row { grid-template-columns: repeat(3, 1fr); gap: 14px; }
  .greet-card .greet-name { font-size: 24px; }
  .cta-card { padding: 18px 20px; }
  .exam-grid { grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
  .card-list { max-height: 600px; }
  .auth-card { padding: 36px 30px; }
}

/* PC / 大屏（≥ 1024px）：宽松布局 */
@media (min-width: 1024px) {
  .app {
    max-width: 760px;
    padding-bottom: 67px;
    padding-top: 12px;
  }
  .app-bar { padding: 16px 28px; }
  .page { padding: 28px; }
  .page-title { font-size: 26px; }
  .greet-card { padding: 26px 24px; }
  .greet-card .stat-row { gap: 16px; }
  .greet-card .stat-val { font-size: 18px; }
  .greet-card .greet-name { font-size: 26px; }
  .cta-card { padding: 18px 22px; }
  .cta-icon { width: 48px; height: 48px; font-size: 24px; }
  .exam-grid { grid-template-columns: 1fr 1fr 1fr 1fr; gap: 12px; }
  .card-list { max-height: 680px; }
  .auth-card { padding: 40px 36px; max-width: 420px; }
  .auth-card .auth-title { font-size: 26px; }
  /* PC 上底部导航同样为全宽 max-width 760 */
  .bottom-nav { max-width: 760px !important; }
}

/* ---------- 可访问性 ---------- */
button:focus-visible, a:focus-visible, input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
button:focus:not(:focus-visible) { outline: none; }


/* ============================================================
   TECH 主题覆盖（html[data-theme="tech"]）
   来源：8-19 之前 study-dy-tech 的 styles.css 设计风格
   - 深蓝黑底 + 电青色 accent + monospace 字体
   - HUD 4 角 + 卡片 4 角 + 玻璃态 + 天际线背景 + SVG 导航
============================================================ */

/* 默认 fresh — 装饰元素隐藏 */
.app-bar-hud, .auth-bg { display: none !important; }
.card::before, .card::after { content: none !important; display: none !important; }

/* tech 主题 — 变量覆盖 */
html[data-theme="tech"] {
  --bg:            #0e1530;
  --bg-pattern:    #131c38;
  --surface:       rgba(20, 28, 50, 0.88);
  --surface-2:     rgba(30, 40, 65, 0.92);
  --surface-3:     rgba(35, 45, 75, 0.92);
  --ink:           #ffffff;
  --ink-2:         #c8d4e3;
  --ink-3:         #8a99b0;
  --accent:        #00f0ff;
  --accent-soft:   rgba(0, 240, 255, 0.12);
  --accent-deep:   #05b4c2;
  --warm:          #ff2a6d;
  --warm-soft:     rgba(255, 42, 109, 0.12);
  --warm-deep:     #c71d52;
  --gold:          #ffd700;
  --gold-soft:     rgba(255, 215, 0, 0.12);
  --danger:        #ff3c3c;
  --danger-soft:   rgba(255, 60, 60, 0.12);
  --success:       #39ff14;
  --success-soft:  rgba(57, 255, 14, 0.12);
  --border:        rgba(0, 240, 255, 0.18);
  --border-strong: rgba(0, 240, 255, 0.32);
  --shadow-sm:     0 1px 2px rgba(0, 0, 0, 0.4), 0 0 6px rgba(0, 240, 255, 0.04);
  --shadow:        0 4px 16px rgba(0, 0, 0, 0.5), 0 0 12px rgba(0, 240, 255, 0.06);
  --shadow-lg:     0 16px 40px rgba(0, 0, 0, 0.6), 0 0 24px rgba(0, 240, 255, 0.08);
  --glow-accent:   0 0 8px rgba(0, 240, 255, 0.45);
  --glow-warm:     0 0 8px rgba(255, 42, 109, 0.45);
  --mono:          'JetBrains Mono', 'Fira Code', 'SF Mono', Consolas, monospace;
}

html[data-theme="tech"] html, html[data-theme="tech"] body {
  font-family: var(--mono);
  background: var(--bg);
  background-image:
    radial-gradient(circle at 1px 1px, rgba(0, 240, 255, 0.05) 1px, transparent 0),
    linear-gradient(180deg, rgba(0, 240, 255, 0.04) 0%, transparent 40%);
  background-size: 22px 22px, 100% 100%;
  color: var(--ink);
}

html[data-theme="tech"] body { background: var(--bg); }

/* tech 主题：HUD 4 角显示 */
html[data-theme="tech"] .app-bar-hud {
  display: block !important;
  position: absolute; inset: 0;
  z-index: 0;
  pointer-events: none;
}

html[data-theme="tech"] .hud-corner {
  width: 12px; height: 12px;
  border-style: solid;
  border-width: 0;
  position: absolute;
  opacity: 0.95;
  filter: drop-shadow(0 0 4px rgba(0, 240, 255, 0.8));
}
html[data-theme="tech"] .hud-corner.tl { top: 4px; left: 4px; border-top-width: 2.5px; border-left-width: 2.5px; border-color: var(--accent); }
html[data-theme="tech"] .hud-corner.tr { top: 4px; right: 4px; border-top-width: 2.5px; border-right-width: 2.5px; border-color: var(--accent); }
html[data-theme="tech"] .hud-corner.bl { bottom: 4px; left: 4px; border-bottom-width: 2.5px; border-left-width: 2.5px; border-color: var(--accent); }
html[data-theme="tech"] .hud-corner.br { bottom: 4px; right: 4px; border-bottom-width: 2.5px; border-right-width: 2.5px; border-color: var(--accent); }

/* tech 主题：app-bar 背景 + 文字 */
html[data-theme="tech"] .app-bar {
  background: rgba(14, 21, 48, 0.85);
  box-shadow: 0 2px 16px rgba(0, 0, 0, 0.5);
  border-bottom: 1px solid var(--border);
}
html[data-theme="tech"] .app-bar > :not(.app-bar-hud) { position: relative; z-index: 1; }
html[data-theme="tech"] .app-bar-logo { font-family: var(--mono); }
html[data-theme="tech"] .app-bar-logo span { text-shadow: var(--glow-accent); }

/* tech 主题：卡片 4 角 */
html[data-theme="tech"] .card::before,
html[data-theme="tech"] .card::after {
  content: '' !important;
  display: block !important;
  position: absolute;
  pointer-events: none;
  opacity: 0.95;
  filter: drop-shadow(0 0 4px rgba(0, 240, 255, 0.7));
}
html[data-theme="tech"] .card {
  position: relative;
  overflow: hidden;
}
html[data-theme="tech"] .card::before {
  top: -1px; left: -1px;
  width: 16px; height: 16px;
  border-top: 2.5px solid var(--accent);
  border-left: 2.5px solid var(--accent);
  border-radius: 3px 0 0 0;
}
html[data-theme="tech"] .card::after {
  bottom: -1px; right: -1px;
  width: 16px; height: 16px;
  border-bottom: 2.5px solid var(--accent);
  border-right: 2.5px solid var(--accent);
  border-radius: 0 0 3px 0;
}
html[data-theme="tech"] .card-title { font-family: var(--mono); }

/* tech 主题：登录页背景（天际线 + 玻璃态） */
html[data-theme="tech"] .auth-bg {
  display: block !important;
  position: absolute; inset: 0;
  pointer-events: none;
  z-index: 0;
}
html[data-theme="tech"] .auth-skyline {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 42%;
  margin: 0;
  pointer-events: none;
  z-index: 0;
}
html[data-theme="tech"] .auth-skyline img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: center top;
  opacity: 0.85;
  filter: drop-shadow(0 0 8px rgba(0, 240, 255, 0.25)) saturate(0.95);
  -webkit-mask-image: linear-gradient(180deg, transparent 0%, rgba(0,0,0,0.5) 25%, #000 60%, #000 100%);
          mask-image: linear-gradient(180deg, transparent 0%, rgba(0,0,0,0.5) 25%, #000 60%, #000 100%);
}
html[data-theme="tech"] .auth-overlay {
  position: absolute; inset: 0;
  pointer-events: none;
  z-index: 0;
  background: linear-gradient(180deg, rgba(14, 21, 48, 0.45) 0%, rgba(14, 21, 48, 0.25) 35%, rgba(14, 21, 48, 0.25) 65%, rgba(14, 21, 48, 0.6) 100%);
}
html[data-theme="tech"] .auth-card {
  position: relative; z-index: 1;
  background: rgba(20, 28, 50, 0.22);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-lg), 0 0 32px rgba(0, 240, 255, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(14px) saturate(1.4);
  -webkit-backdrop-filter: blur(14px) saturate(1.4);
}
html[data-theme="tech"] .auth-logo { filter: drop-shadow(0 0 12px rgba(0, 240, 255, 0.6)); }
html[data-theme="tech"] .auth-title { font-family: var(--mono); text-shadow: var(--glow-accent); }

/* tech 主题：底部导航 */
html[data-theme="tech"] .bottom-nav {
  background: rgba(14, 21, 48, 0.95);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 -2px 20px rgba(0, 0, 0, 0.5), 0 0 16px rgba(0, 240, 255, 0.05);
}
html[data-theme="tech"] .bottom-nav-item .nav-icon {
  width: 22px; height: 22px;
  line-height: 1;
  font-size: 0;   /* 隐藏 emoji 字符 */
}
html[data-theme="tech"] .bottom-nav-item .nav-icon svg {
  width: 22px; height: 22px; display: block;
  stroke: currentColor;
}
html[data-theme="tech"] .bottom-nav-item.active { color: var(--accent); text-shadow: var(--glow-accent); }
html[data-theme="tech"] .bottom-nav-item.active .nav-icon { transform: scale(1.08); filter: drop-shadow(0 0 6px var(--accent)); }

/* tech 主题：按钮 / icon-btn */
html[data-theme="tech"] .btn {
  background: transparent;
  color: var(--accent);
  border: 1.5px solid var(--accent);
  position: relative;
  overflow: hidden;
}
html[data-theme="tech"] .btn::before {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(0, 240, 255, 0.15), transparent);
  transform: translateX(-100%);
  transition: transform 0.4s;
}
html[data-theme="tech"] .btn:hover { background: var(--accent-soft); box-shadow: var(--glow-accent); transform: translateY(-1px); }
html[data-theme="tech"] .btn:hover::before { transform: translateX(100%); }
html[data-theme="tech"] .btn-primary { background: rgba(0, 240, 255, 0.12); }
html[data-theme="tech"] .btn-secondary { color: var(--ink-2); border-color: var(--border); }
html[data-theme="tech"] .btn-danger { color: var(--danger); border-color: rgba(255, 60, 60, 0.4); }
html[data-theme="tech"] .btn-danger:hover { background: var(--danger-soft); box-shadow: 0 0 12px rgba(255, 60, 60, 0.35); }

html[data-theme="tech"] .icon-btn {
  background: rgba(0, 240, 255, 0.05);
  border: 1px solid var(--border);
  color: var(--ink);
}
html[data-theme="tech"] .icon-btn:hover {
  background: var(--surface-2);
  border-color: var(--border);
  color: var(--accent);
  box-shadow: var(--glow-accent);
}

/* tech 主题：首页装饰 */
html[data-theme="tech"] .page-title { font-family: var(--mono); text-shadow: var(--glow-accent); }
html[data-theme="tech"] .greet-card {
  background: linear-gradient(135deg, rgba(0, 240, 255, 0.18) 0%, rgba(5, 180, 194, 0.08) 100%);
  border: 1px solid var(--border-strong);
  overflow: hidden;
  box-shadow: var(--shadow), 0 0 24px rgba(0, 240, 255, 0.08);
  position: relative;
}
html[data-theme="tech"] .greet-card::before {
  content: '';
  position: absolute;
  background: rgba(0, 240, 255, 0.08);
  filter: blur(20px);
}
html[data-theme="tech"] .greet-card .greet-name { font-family: var(--mono); text-shadow: var(--glow-accent); }
html[data-theme="tech"] .greet-card .stat-val { font-family: var(--mono); color: var(--accent); text-shadow: var(--glow-accent); }
html[data-theme="tech"] .greet-card .stat-label { color: var(--ink-2); }

/* tech 主题：表单 */
html[data-theme="tech"] .form-input {
  background: rgba(0, 240, 255, 0.04);
  border: 1px solid var(--border);
  color: var(--ink);
  font-family: var(--mono);
}
html[data-theme="tech"] .form-input:focus {
  outline: none;
  border-color: var(--accent);
  background: rgba(0, 240, 255, 0.06);
  box-shadow: 0 0 0 3px var(--accent-soft), var(--glow-accent);
}
html[data-theme="tech"] .form-input.error { border-color: var(--danger); box-shadow: 0 0 0 2px rgba(255, 60, 60, 0.25); }

/* tech 主题：链接 */
html[data-theme="tech"] a { color: var(--accent); text-shadow: 0 0 4px rgba(0, 240, 255, 0.3); }
html[data-theme="tech"] a:hover { text-shadow: var(--glow-accent); }

/* tech 主题：进度条 */
html[data-theme="tech"] .progress-fill {
  background: linear-gradient(90deg, var(--accent), #39ff14);
  box-shadow: 0 0 8px var(--accent);
}
html[data-theme="tech"] .progress-fill.warm { background: linear-gradient(90deg, var(--warm), #ff7a9d); box-shadow: var(--glow-warm); }

/* tech 主题：CTA 卡片 */
html[data-theme="tech"] .cta-card {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow), 0 0 16px rgba(0, 240, 255, 0.06);
  backdrop-filter: blur(10px);
}
html[data-theme="tech"] .cta-card.warm { border-color: var(--warm); box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4), 0 0 16px rgba(255, 42, 109, 0.12); }
html[data-theme="tech"] .cta-card .cta-icon { color: var(--accent); }

/* tech 主题：账户卡 */
html[data-theme="tech"] .account-card {
  background: linear-gradient(135deg, rgba(0, 240, 255, 0.18) 0%, rgba(5, 180, 194, 0.08) 100%);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow), 0 0 24px rgba(0, 240, 255, 0.08);
}
html[data-theme="tech"] .account-avatar {
  background: rgba(0, 240, 255, 0.2);
  color: var(--accent);
  border: 1px solid var(--accent);
  box-shadow: var(--glow-accent);
}
html[data-theme="tech"] .account-name { font-family: var(--mono); text-shadow: var(--glow-accent); }

/* tech 主题：列表项 */
html[data-theme="tech"] .card-list-item {
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(10px);
}

/* tech 主题：模态框 */
html[data-theme="tech"] .modal-content {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(16px);
}
html[data-theme="tech"] .modal-overlay { background: rgba(0, 0, 0, 0.7); backdrop-filter: blur(4px); }

/* tech 主题：loading */
html[data-theme="tech"] .loading-overlay { background: rgba(14, 21, 48, 0.92); }
html[data-theme="tech"] .loading-card {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-lg), 0 0 32px rgba(0, 240, 255, 0.2);
}
html[data-theme="tech"] .loading-spinner {
  border: 2px solid var(--accent-soft);
  border-top-color: var(--accent);
  box-shadow: 0 0 8px var(--accent);
}

/* tech 主题：toast */
html[data-theme="tech"] .toast {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-lg);
  color: var(--ink);
  font-family: var(--mono);
}
html[data-theme="tech"] .toast-success { border-color: var(--success); color: var(--success); }
html[data-theme="tech"] .toast-warning { border-color: var(--warm); color: var(--warm); }
html[data-theme="tech"] .toast-error { border-color: var(--danger); color: var(--danger); }

/* tech 主题：quiz overlay */
html[data-theme="tech"] .quiz-overlay { background: rgba(14, 21, 48, 0.98); }
html[data-theme="tech"] .quiz-card {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-lg), 0 0 32px rgba(0, 240, 255, 0.2);
  backdrop-filter: blur(16px);
}
html[data-theme="tech"] .learn-question { font-family: var(--mono); text-shadow: var(--glow-accent); }
html[data-theme="tech"] .learn-option {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--ink);
}
html[data-theme="tech"] .learn-option:hover { background: var(--accent-soft); border-color: var(--accent); box-shadow: var(--glow-accent); }
html[data-theme="tech"] .learn-option.correct { background: var(--success-soft); border-color: var(--success); color: var(--success); }
html[data-theme="tech"] .learn-option.wrong { background: var(--danger-soft); border-color: var(--danger); color: var(--danger); }

/* tech 主题：tab / pill */
html[data-theme="tech"] .tab.active { color: var(--accent); border-color: var(--accent); box-shadow: var(--glow-accent); }
html[data-theme="tech"] .pill-btn { background: rgba(0, 240, 255, 0.05); border: 1px solid var(--border); color: var(--ink); }
html[data-theme="tech"] .pill-btn:hover { background: var(--accent-soft); border-color: var(--accent); box-shadow: var(--glow-accent); }
html[data-theme="tech"] .pill-btn.prefix { color: var(--accent); }
html[data-theme="tech"] .pill-btn.root { color: var(--warm); }
html[data-theme="tech"] .pill-btn.suffix { color: var(--gold); }

/* tech 主题：base 字体 */
html[data-theme="tech"] { font-family: var(--mono); }
html[data-theme="tech"] body { font-family: var(--mono); color: var(--ink); }


/* ============================================================
   主题切换：底部导航 emoji / SVG
============================================================ */

/* 默认 fresh — emoji 显示，SVG 隐藏 */
.nav-icon svg { display: none; }
.nav-icon .nav-emoji { display: inline; font-size: 22px; line-height: 1; }

/* tech 主题 — SVG 显示，emoji 隐藏 */
html[data-theme="tech"] .nav-icon svg { display: block; }
html[data-theme="tech"] .nav-icon .nav-emoji { display: none; }

/* ============================================================
   启动阶段（launch-stage）— 从 index.html 内联 <style> 搬出（8-31）
   ============================================================ */
#launch-stage {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: none;            /* 默认隐藏：JS 决定是否显示 */
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: #0e1530;
  background-image:
    radial-gradient(circle at 1px 1px, rgba(0, 240, 255, 0.05) 1px, transparent 0),
    linear-gradient(180deg, rgba(0, 240, 255, 0.04) 0%, transparent 40%);
  background-size: 22px 22px, 100% 100%;
  color: #ffffff;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', Roboto, sans-serif;
}
#launch-stage .launch-card {
  width: 100%;
  max-width: 440px;
  background: rgba(20, 28, 50, 0.92);
  border: 1px solid rgba(0, 240, 255, 0.32);
  border-radius: 20px;
  padding: 36px 32px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6), 0 0 32px rgba(0, 240, 255, 0.12);
  text-align: center;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}
#launch-stage .launch-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 18px;
  display: block;
  border-radius: 14px;
  filter: drop-shadow(0 0 16px rgba(0, 240, 255, 0.5));
}
#launch-stage .launch-title {
  font-family: 'JetBrains Mono', 'Fira Code', 'SF Mono', Consolas, monospace;
  font-size: 24px;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 6px;
  text-shadow: 0 0 12px rgba(0, 240, 255, 0.4);
}
#launch-stage .launch-sub {
  font-size: 13px;
  color: #8a99b0;
  margin-bottom: 22px;
}
#launch-stage .device-pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
  background: rgba(0, 240, 255, 0.05);
  border: 1px solid rgba(0, 240, 255, 0.18);
  border-radius: 999px;
  margin-bottom: 22px;
  font-size: 14px;
  box-shadow: 0 0 12px rgba(0, 240, 255, 0.08);
}
#launch-stage .device-pill .device-icon { font-size: 20px; }
#launch-stage .device-pill .device-name { font-weight: 700; color: #ffffff; }
#launch-stage .device-pill .device-spec {
  font-size: 12px;
  color: #8a99b0;
  font-family: 'JetBrains Mono', 'Fira Code', 'SF Mono', Consolas, monospace;
  padding-left: 10px;
  border-left: 1px solid rgba(0, 240, 255, 0.18);
}
#launch-stage .size-picker { margin-top: 8px; }
#launch-stage .size-picker-title {
  font-size: 12px;
  font-weight: 600;
  color: #8a99b0;
  margin-bottom: 12px;
  letter-spacing: 0.04em;
  font-family: 'JetBrains Mono', 'Fira Code', 'SF Mono', Consolas, monospace;
}
#launch-stage .size-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
#launch-stage .size-opt {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 14px 8px;
  background: rgba(20, 28, 50, 0.92);
  border: 1.5px solid rgba(0, 240, 255, 0.18);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
  color: #ffffff;
}
#launch-stage .size-opt:hover {
  border-color: #00f0ff;
  background: rgba(0, 240, 255, 0.06);
  transform: translateY(-2px);
  box-shadow: 0 0 12px rgba(0, 240, 255, 0.4);
}
#launch-stage .size-opt.active {
  border-color: #00f0ff;
  background: rgba(0, 240, 255, 0.06);
  box-shadow: 0 0 12px rgba(0, 240, 255, 0.4);
}
#launch-stage .size-opt .size-icon { font-size: 22px; }
#launch-stage .size-opt .size-label { font-size: 13px; font-weight: 700; }
#launch-stage .size-opt .size-dim {
  font-size: 10px;
  color: #8a99b0;
  font-family: 'JetBrains Mono', 'Fira Code', 'SF Mono', Consolas, monospace;
  background: rgba(0, 240, 255, 0.05);
  padding: 2px 6px;
  border-radius: 4px;
}
#launch-stage .reset-hint {
  margin-top: 18px;
  font-size: 11px;
  color: #8a99b0;
  font-family: 'JetBrains Mono', 'Fira Code', 'SF Mono', Consolas, monospace;
}
#launch-stage .reset-hint a {
  color: #00f0ff;
  text-decoration: none;
  cursor: pointer;
}
#launch-stage .reset-hint a:hover { text-decoration: underline; }

/* ===== 选中的窗口尺寸 → 限制 .app 最大宽度（Chrome 不允许 resizeTo 改用户窗口） ===== */
.app { max-width: 560px; }       /* 默认不变（styles.css 已有） */
html[data-size="phone"] .app  { max-width: 400px;  }
html[data-size="ipad-p"] .app { max-width: 830px;  }
html[data-size="ipad-l"] .app { max-width: 1180px; }
html[data-size="pc"] .app     { max-width: 1280px; }

/* .app 变宽时，bottom-nav 也跟着变宽（保持底部对齐） */
html[data-size="phone"]   .bottom-nav { max-width: 400px  !important; }
html[data-size="ipad-p"]  .bottom-nav { max-width: 830px  !important; }
html[data-size="ipad-l"]  .bottom-nav { max-width: 1180px !important; }
html[data-size="pc"]      .bottom-nav { max-width: 1280px !important; }

/* 窗口周围填底色（避免透明背景透下去） */
html[data-size] body { background: #050810; }

/* 手机/平板视图：.app 外面加细分隔线 + 发光 */
html[data-size="phone"] .app,
html[data-size="ipad-p"] .app,
html[data-size="ipad-l"] .app {
    border-left: 1px solid rgba(0, 240, 255, 0.12);
    border-right: 1px solid rgba(0, 240, 255, 0.12);
    box-shadow: 0 0 32px rgba(0, 240, 255, 0.06);
}

/* ============================================================
   进度面板 skeleton（8-31：词库未加载完时显示）
   ============================================================ */
.progress-skeleton { animation: pulse 1.5s ease-in-out infinite; }
.progress-skeleton > * { margin-bottom: 10px; }
.progress-skeleton > *:last-child { margin-bottom: 0; }
.skeleton-row {
  display: flex; justify-content: space-between; align-items: baseline;
  gap: 12px; margin-bottom: 10px;
}
.skeleton-track {
  height: 8px; background: var(--surface-3); border-radius: 99px; overflow: hidden;
}
.skeleton-track .skeleton-bar-fill {
  width: 40%; height: 100%; border-radius: 99px;
}
.skeleton-meta {
  display: flex; justify-content: space-between; gap: 12px; padding-top: 10px;
  border-top: 1px dashed var(--border);
}
.skeleton-bar {
  display: block; height: 12px; border-radius: 4px;
  background: var(--surface-3);
}
.skeleton-bar-sm { height: 14px; }
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}
