:root {
  --primary: #C0392B;
  --primary-light: #E74C3C;
  --accent: #F39C12;
  --bg: #F0F2F5;
  --surface: #FFFFFF;
  --surface2: #F7F8FA;
  --border: #E2E8F0;
  --text: #1A202C;
  --text2: #64748B;
  --text3: #94A3B8;
  --sidebar-w: 220px;
  --radius: 14px;
  --shadow: 0 4px 24px rgba(0,0,0,0.08);
  --font-ui: 'Inter', sans-serif;
  --font-hanzi: 'Noto Sans SC', serif;
}
[data-theme="dark"] {
  --bg: #0F0F1A;
  --surface: #1A1A2E;
  --surface2: #16213E;
  --border: #2D3748;
  --text: #F1F5F9;
  --text2: #94A3B8;
  --text3: #4A5568;
  --shadow: 0 4px 24px rgba(0,0,0,0.4);
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-ui);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  transition: background .3s, color .3s;
}

/* ── SIDEBAR ── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  padding: 24px 0 16px;
  transition: background .3s;
}
.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 20px 28px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}
.logo-icon {
  width: 40px; height: 40px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  font-family: var(--font-hanzi);
  font-size: 20px;
  font-weight: 700;
  flex-shrink: 0;
}
.logo-text { font-weight: 700; font-size: 15px; color: var(--text); }
.sidebar-nav { flex: 1; display: flex; flex-direction: column; gap: 4px; padding: 0 12px; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  text-decoration: none;
  color: var(--text2);
  font-size: 14px;
  font-weight: 500;
  transition: all .2s;
}
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }
.nav-item:hover { background: var(--surface2); color: var(--text); }
.nav-item.active { background: var(--primary); color: #fff; }
.sidebar-footer {
  padding: 16px 20px 0;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
}
.btn-icon {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  cursor: pointer;
  font-size: 16px;
  transition: .2s;
}
.btn-icon:hover { transform: scale(1.1); }
.btn-lang {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 12px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  color: var(--text2);
  transition: .2s;
}
.btn-lang:hover { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ── MAIN ── */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-height: 100vh;
  padding: 32px;
  max-width: 960px;
}
.mobile-header { display: none; }

/* ── PAGES ── */
.page { display: none; animation: fadeIn .3s ease; }
.page.active { display: block; }
@keyframes fadeIn { from { opacity:0; transform:translateY(8px); } to { opacity:1; transform:translateY(0); } }
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
}
.page-header h1 { font-size: 26px; font-weight: 700; }
.page-header p { color: var(--text2); margin-top: 4px; font-size: 14px; }

/* ── HOME ── */
.stats-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 36px; }
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
  box-shadow: var(--shadow);
  transition: transform .2s;
}
.stat-card:hover { transform: translateY(-2px); }
.stat-num { font-size: 36px; font-weight: 700; color: var(--primary); }
.stat-label { font-size: 12px; color: var(--text2); margin-top: 4px; font-weight: 500; }
.level-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 16px; }
.level-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 16px;
  cursor: pointer;
  text-align: center;
  transition: all .2s;
  box-shadow: var(--shadow);
}
.level-card:hover { transform: translateY(-3px); box-shadow: 0 8px 30px rgba(192,57,43,.2); border-color: var(--primary); }
.level-badge {
  font-size: 22px;
  font-weight: 800;
  font-family: var(--font-hanzi);
  background: linear-gradient(135deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.level-count { font-size: 12px; color: var(--text2); margin-top: 6px; }

/* ── DICTIONARY ── */
.search-box { position: relative; margin-bottom: 16px; }
.search-box input {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 48px 14px 20px;
  font-size: 15px;
  color: var(--text);
  font-family: var(--font-ui);
  outline: none;
  transition: border .2s;
}
.search-box input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(192,57,43,.1); }
.search-icon { position: absolute; right: 16px; top: 50%; transform: translateY(-50%); font-size: 18px; pointer-events: none; }
.search-tabs { display: flex; gap: 8px; margin-bottom: 20px; flex-wrap: wrap; }
.stab {
  padding: 6px 16px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text2);
  font-size: 13px;
  cursor: pointer;
  transition: .2s;
}
.stab.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.dict-results { display: flex; flex-direction: column; gap: 10px; }
.dict-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: all .2s;
}
.dict-card:hover { border-color: var(--primary); transform: translateX(4px); }
.dict-hanzi { font-family: var(--font-hanzi); font-size: 28px; font-weight: 500; color: var(--text); flex-shrink: 0; width: 60px; }
.dict-info { flex: 1; }
.dict-pinyin { font-size: 13px; color: var(--accent); font-weight: 500; margin-bottom: 4px; }
.dict-meaning { font-size: 14px; color: var(--text2); }
.dict-hsk { font-size: 11px; background: var(--primary); color: #fff; border-radius: 6px; padding: 2px 8px; flex-shrink: 0; }
.hint { color: var(--text3); text-align: center; padding: 40px 0; font-size: 15px; }

/* ── LEARN SECTION (MULTI-MODE) ── */
.learn-header { margin-bottom: 16px; }
.mode-select-wrap {
  margin-top: 10px;
}
#learnModeSelect {
  padding: 8px 16px;
  border-radius: 10px;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}
.learn-setup-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-bottom: 24px;
}
.setup-mode-badge {
  display: inline-block;
  background: var(--surface2);
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--primary);
  align-self: flex-start;
}
.setup-fields { display: flex; gap: 20px; flex-wrap: wrap; }
.setup-field { display: flex; flex-direction: column; gap: 8px; }
.setup-field label { font-size: 13px; color: var(--text2); font-weight: 600; }
.setup-field select {
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
  min-width: 120px;
}
.btn-start-learn { padding: 14px; font-size: 16px; margin-top: 8px; }

/* Session Header shared */
.session-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}
.fc-progress { color: var(--text2); font-size: 14px; font-weight: 600; }
.session-score { font-size: 14px; font-weight: 600; color: var(--text); background: var(--surface); padding: 4px 12px; border-radius: 20px; border: 1px solid var(--border); }
.btn-exit { background: var(--surface); border: 1px solid var(--border); width: 32px; height: 32px; border-radius: 50%; color: var(--text2); cursor: pointer; transition: .2s; }
.btn-exit:hover { background: var(--primary); color: #fff; border-color: transparent; }

/* Flashcard */
.flashcard {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 48px 32px;
  text-align: center;
  min-height: 280px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform .15s;
  perspective: 1000px;
  position: relative;
}
.flashcard:active { transform: scale(0.97); }
.fc-front, .fc-back { width: 100%; }
.fc-back { display: none; }
.flashcard.flipped .fc-front { display: none; }
.flashcard.flipped .fc-back { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.fc-hanzi { font-family: var(--font-hanzi); font-size: 72px; font-weight: 400; line-height: 1.2; color: var(--text); }
.fc-hanzi-sm { font-family: var(--font-hanzi); font-size: 40px; font-weight: 400; color: var(--text); }
.fc-pinyin { color: var(--accent); font-size: 20px; margin-top: 8px; font-weight: 500; }
.fc-pinyin-back { color: var(--accent); font-size: 16px; font-weight: 500; }
.fc-tap { color: var(--text3); font-size: 13px; margin-top: 24px; }
.fc-meaning-vi { font-size: 20px; font-weight: 600; color: var(--primary); margin-top: 8px; }
.fc-meaning-en { font-size: 15px; color: var(--text2); }
.fc-ex-block { background: var(--surface2); padding: 12px; border-radius: 12px; margin-top: 16px; width: 100%; text-align: left; border: 1px solid var(--border); }
.fc-ex-zh { font-family: var(--font-hanzi); font-size: 15px; color: var(--text); margin-bottom: 4px; }
.fc-ex-py { font-size: 12px; color: var(--text3); }

/* SRS Buttons */
.srs-buttons { display: flex; gap: 10px; margin-top: 24px; justify-content: center; }
.srs-btn {
  flex: 1; max-width: 120px;
  padding: 12px 8px;
  border-radius: 12px;
  border: 1px solid var(--border);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  transition: .2s;
  background: var(--surface);
  color: var(--text);
}
.srs-btn small { font-size: 11px; font-weight: 400; color: var(--text2); }
.srs-again:hover { background: #FEE2E2; color: #991B1B; border-color: transparent; }
.srs-hard:hover { background: #FFEDD5; color: #9A3412; border-color: transparent; }
.srs-good:hover { background: #E0E7FF; color: #3730A3; border-color: transparent; }
.srs-easy:hover { background: #D1FAE5; color: #065F46; border-color: transparent; }
[data-theme="dark"] .srs-again:hover { background: #450A0A; color: #FCA5A5; }
[data-theme="dark"] .srs-hard:hover { background: #431407; color: #FDBA74; }
[data-theme="dark"] .srs-good:hover { background: #1E1B4B; color: #A5B4FC; }
[data-theme="dark"] .srs-easy:hover { background: #064E3B; color: #6EE7B7; }

/* Typing Mode */
.typing-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 32px;
  box-shadow: var(--shadow);
}
.ty-label { font-size: 12px; color: var(--text3); font-weight: 600; text-transform: uppercase; margin-bottom: 6px; }
.ty-meaning { font-size: 24px; font-weight: 700; color: var(--text); margin-bottom: 16px; }
.ty-example { font-family: var(--font-hanzi); font-size: 16px; color: var(--text2); margin-bottom: 24px; background: var(--surface2); padding: 12px; border-radius: 8px; border-left: 3px solid var(--primary); }
.ty-hint-label { font-size: 12px; color: var(--text3); font-weight: 600; margin-bottom: 4px; }
.ty-hint { font-size: 20px; font-family: monospace; letter-spacing: 2px; color: var(--primary); margin-bottom: 20px; }
.ty-input-row { display: flex; gap: 12px; }
.ty-input-row input {
  flex: 1;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  font-size: 16px;
  color: var(--text);
  outline: none;
  transition: .2s;
}
.ty-input-row input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(192,57,43,.1); }
.ty-feedback { margin-top: 16px; padding: 12px; border-radius: 8px; font-weight: 600; font-size: 14px; text-align: center; }
.ty-feedback.correct { background: #D1FAE5; color: #065F46; }
.ty-feedback.wrong { background: #FEE2E2; color: #991B1B; }
[data-theme="dark"] .ty-feedback.correct { background: #064E3B; color: #6EE7B7; }
[data-theme="dark"] .ty-feedback.wrong { background: #450A0A; color: #FCA5A5; }

.ty-answer-block { margin-top: 24px; border-top: 1px solid var(--border); padding-top: 24px; text-align: center; }
.ty-ans-row { display: flex; align-items: center; justify-content: center; gap: 12px; margin-bottom: 8px; }
.ty-ans-hanzi { font-family: var(--font-hanzi); font-size: 40px; color: var(--primary); }
.ty-ans-pinyin { font-size: 18px; color: var(--text2); }
.ty-ans-meaning { font-size: 16px; font-weight: 500; margin-bottom: 16px; }
.ty-next-btn { width: 100%; }

/* MCQ Mode */
.mcq-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 32px;
  box-shadow: var(--shadow);
  text-align: center;
}
.mcq-question-word { margin-bottom: 24px; }
.mcq-hanzi { font-family: var(--font-hanzi); font-size: 56px; line-height: 1.2; color: var(--text); }
.mcq-pinyin { font-size: 18px; color: var(--text2); margin-top: 4px; }
.mcq-prompt { font-size: 14px; font-weight: 600; color: var(--primary); margin-bottom: 24px; }

/* Inline TTS Button */
.tts-inline-btn {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 32px; height: 32px;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
  font-size: 16px;
  transition: .2s;
}
.tts-inline-btn:hover { background: var(--primary); color: #fff; border-color: transparent; }

/* Session Result */
.session-result { text-align: center; padding: 48px 0; }
.sr-emoji { font-size: 64px; margin-bottom: 16px; }
.sr-title { font-size: 24px; margin-bottom: 32px; }
.sr-stats-row { display: flex; justify-content: center; gap: 24px; margin-bottom: 40px; }
.sr-stat { display: flex; flex-direction: column; align-items: center; }
.sr-stat span { font-size: 32px; font-weight: 700; color: var(--text); }
.sr-stat small { font-size: 13px; color: var(--text2); font-weight: 500; text-transform: uppercase; margin-top: 4px; }
.sr-correct span { color: #059669; }
.sr-wrong span { color: #DC2626; }
[data-theme="dark"] .sr-correct span { color: #34D399; }
[data-theme="dark"] .sr-wrong span { color: #F87171; }


/* ── QUIZ ── */
.quiz-setup { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 28px; display: flex; flex-direction: column; gap: 20px; }
.setup-row { display: flex; align-items: center; gap: 16px; }
.setup-row label { font-size: 14px; font-weight: 500; color: var(--text2); min-width: 70px; }
.quiz-progress { color: var(--text2); font-size: 14px; margin-bottom: 16px; text-align: center; }
.quiz-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 32px; box-shadow: var(--shadow); }
.q-question { font-family: var(--font-hanzi); font-size: 48px; text-align: center; margin-bottom: 28px; color: var(--text); }
.q-options { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.q-opt {
  padding: 14px 18px;
  background: var(--surface2);
  border: 2px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  transition: all .2s;
  text-align: center;
}
.q-opt:hover { border-color: var(--primary); color: var(--primary); }
.q-opt.correct { background: #D1FAE5; border-color: #059669; color: #065F46; }
.q-opt.wrong { background: #FEE2E2; border-color: #DC2626; color: #991B1B; }
[data-theme="dark"] .q-opt.correct { background: #064E3B; color: #6EE7B7; }
[data-theme="dark"] .q-opt.wrong { background: #450A0A; color: #FCA5A5; }
.quiz-result { text-align: center; padding: 48px 0; }
.result-circle {
  width: 120px; height: 120px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: 50%;
  margin: 0 auto 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 36px;
  font-weight: 800;
}
.result-circle small { font-size: 13px; font-weight: 400; }
.quiz-result h2 { font-size: 22px; margin-bottom: 24px; }

/* ── VAULT ── */
.vault-empty { text-align: center; padding: 60px 0; color: var(--text3); font-size: 16px; }
.vault-empty p:first-child { font-size: 48px; margin-bottom: 12px; }
.vault-list { display: flex; flex-direction: column; gap: 10px; }
.vault-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
}
.vault-hanzi { font-family: var(--font-hanzi); font-size: 24px; min-width: 44px; }
.vault-info { flex: 1; }
.vault-pinyin { font-size: 12px; color: var(--accent); }
.vault-meaning { font-size: 13px; color: var(--text2); }
.btn-remove { background: none; border: none; color: var(--text3); cursor: pointer; font-size: 18px; transition: .2s; padding: 4px; }
.btn-remove:hover { color: var(--primary); }

/* ── BUTTONS ── */
.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 12px 24px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all .2s;
  font-family: var(--font-ui);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 4px 16px rgba(192,57,43,.4); }
.btn-sm { padding: 8px 16px; font-size: 13px; }
.w-full { width: 100%; margin-top: 16px; }

/* ── MODAL ── */
.modal-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.6);
  backdrop-filter: blur(4px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--surface);
  border-radius: 20px;
  padding: 32px;
  max-width: 400px;
  width: 100%;
  position: relative;
  animation: slideUp .3s ease;
}
@keyframes slideUp { from { opacity:0; transform:translateY(30px); } to { opacity:1; transform:translateY(0); } }
.modal-close { position: absolute; top: 16px; right: 16px; background: var(--surface2); border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px; cursor: pointer; color: var(--text2); }
.modal-hanzi { font-family: var(--font-hanzi); font-size: 64px; text-align: center; margin-bottom: 8px; }
.modal-pinyin { text-align: center; color: var(--accent); font-size: 20px; font-weight: 500; margin-bottom: 8px; }
.modal-level { text-align: center; margin-bottom: 20px; }
.modal-level span { background: var(--primary); color: #fff; font-size: 12px; padding: 3px 10px; border-radius: 8px; }
.modal-meanings { display: flex; flex-direction: column; gap: 10px; margin-bottom: 20px; background: var(--surface2); border-radius: 12px; padding: 16px; }
.meaning-row { display: flex; align-items: center; gap: 12px; font-size: 16px; }
.lang-badge { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 6px; }
.lang-badge.vi { background: #FEF3C7; color: #92400E; }
.lang-badge.en { background: #DBEAFE; color: #1E40AF; }
[data-theme="dark"] .lang-badge.vi { background: #451A03; color: #FCD34D; }
[data-theme="dark"] .lang-badge.en { background: #1E3A5F; color: #93C5FD; }

/* ── BOTTOM NAV ── */
.bottom-nav { display: none; }

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .main-content { margin-left: 0; padding: 16px 16px 90px; max-width: 100%; }
  .mobile-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 0 20px;
    margin-bottom: 4px;
  }
  .mobile-header .logo-text { flex: 1; font-weight: 700; font-size: 16px; }
  .header-actions { display: flex; align-items: center; gap: 8px; }
  .btn-lang-sm {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 700;
    color: var(--text2);
    cursor: pointer;
  }
  .bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    background: var(--surface);
    border-top: 1px solid var(--border);
    z-index: 100;
    padding: 8px 0 env(safe-area-inset-bottom, 8px);
  }
  .bnav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 6px 4px;
    text-decoration: none;
    color: var(--text3);
    font-size: 10px;
    font-weight: 500;
    transition: color .2s;
  }
  .bnav-item svg { width: 20px; height: 20px; }
  .bnav-item.active { color: var(--primary); }
  .stats-row { grid-template-columns: repeat(3,1fr); gap: 10px; }
  .stat-num { font-size: 26px; }
  .level-grid { grid-template-columns: repeat(2,1fr); }
  .q-options { grid-template-columns: 1fr; }
  .page-header h1 { font-size: 22px; }
  .fc-hanzi { font-size: 56px; }
}

/* ── HSK VERSION SWITCH ── */
.hsk-version-switch {
  padding: 12px 12px 0;
  border-top: 1px solid var(--border);
  margin-top: 8px;
}
.vsw-label { font-size: 11px; font-weight: 600; color: var(--text3); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 8px; padding: 0 4px; }
.vsw-row { display: flex; flex-direction: column; gap: 6px; }
.vsw {
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text2);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  transition: .2s;
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-ui);
}
.vsw.active { background: linear-gradient(135deg,var(--primary),var(--primary-light)); color:#fff; border-color:transparent; }
.vsw.coming { opacity:.75; cursor:default; }
.badge-soon {
  font-size: 10px;
  background: var(--accent);
  color: #fff;
  border-radius: 4px;
  padding: 1px 6px;
  margin-left: auto;
  font-weight: 700;
}
.ver-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 6px;
  background: #DBEAFE;
  color: #1E40AF;
  margin-left: 8px;
  vertical-align: middle;
}
[data-theme="dark"] .ver-chip { background: #1E3A5F; color: #93C5FD; }

/* ── RADICAL BROWSER ── */
.radical-browser {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 16px;
}
.rad-label { font-size: 12px; font-weight: 600; color: var(--text2); margin-bottom: 10px; }
.rad-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.rad-chip {
  padding: 7px 12px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  transition: all .2s;
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-ui);
}
.rad-chip .rc-char { font-family: var(--font-hanzi); font-size: 18px; line-height: 1; }
.rad-chip .rc-info { font-size: 11px; color: var(--text3); }
.rad-chip:hover { border-color: var(--primary); color: var(--primary); }
.rad-chip:hover .rc-info { color: var(--primary); opacity:.7; }
.rad-chip.active { background: var(--primary); color: #fff; border-color: transparent; }
.rad-chip.active .rc-info { color: rgba(255,255,255,.75); }
.rad-results-label { font-size: 13px; color: var(--text2); margin-bottom: 12px; font-weight: 500; }

/* ── QUICK ADD BUTTON ── */
.quick-add {
  width: 32px; height: 32px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--primary);
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all .2s;
  line-height: 1;
}
.quick-add:hover { background: var(--primary); color: #fff; border-color: transparent; transform: scale(1.1); }
.quick-add.added { background: #D1FAE5; color: #059669; border-color: #059669; font-size: 14px; }
[data-theme="dark"] .quick-add.added { background: #064E3B; color: #6EE7B7; border-color: #059669; }

/* ── EXAMPLE SENTENCE IN MODAL ── */
.modal-example {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 16px;
}
.ex-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: 10px;
}
.ex-zh { font-family: var(--font-hanzi); font-size: 16px; color: var(--text); margin-bottom: 4px; line-height: 1.5; }
.ex-py { font-size: 12px; color: var(--accent); margin-bottom: 6px; }
.ex-vi { font-size: 13px; color: var(--text2); margin-bottom: 2px; }
.ex-vi::before { content: "🇻🇳 "; }
.ex-en { font-size: 13px; color: var(--text3); }
.ex-en::before { content: "🇬🇧 "; }

/* ── HSK 3.0 COMING SOON BANNER ── */
.coming-soon-banner {
  text-align: center;
  padding: 40px 20px;
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: 16px;
  color: var(--text2);
}
.coming-soon-banner .cs-icon { font-size: 48px; margin-bottom: 12px; }
.coming-soon-banner h3 { font-size: 18px; margin-bottom: 8px; color: var(--text); }
.coming-soon-banner p { font-size: 14px; }

/* ── DECK BROWSER ── */
.deck-tabs { display: flex; gap: 8px; margin-bottom: 20px; }
.dtab {
  padding: 8px 20px; border-radius: 20px;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text2); font-size: 14px; font-weight: 600; cursor: pointer; transition: .2s;
}
.dtab.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.deck-view-toggle { display: flex; gap: 6px; }
.dvt-btn {
  width: 34px; height: 34px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text2); font-size: 16px; cursor: pointer; transition: .2s;
}
.dvt-btn.active { background: var(--primary); color: #fff; border-color: transparent; }

/* Deck Grid */
.deck-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px,1fr)); gap: 16px; }
.deck-grid.list-view { grid-template-columns: 1fr; gap: 10px; }

/* Deck Card */
.deck-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 16px; padding: 20px; cursor: pointer;
  transition: all .2s; box-shadow: var(--shadow); position: relative;
}
.deck-card:hover { transform: translateY(-3px); border-color: var(--primary); box-shadow: 0 8px 24px rgba(192,57,43,.15); }
.deck-card-icon { font-size: 28px; margin-bottom: 8px; }
.deck-card-title { font-size: 16px; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.deck-card-count { font-size: 12px; color: var(--text2); margin-bottom: 10px; }
.deck-progress-bar { height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; margin-bottom: 6px; }
.deck-progress-fill { height: 100%; border-radius: 3px; background: linear-gradient(90deg, var(--primary), var(--accent)); transition: width .4s; }
.deck-progress-pct { font-size: 11px; color: var(--text3); margin-bottom: 10px; }
.deck-card-actions { display: flex; gap: 8px; margin-top: 12px; }
.deck-card-actions .btn-primary { flex: 1; padding: 8px; font-size: 13px; }
.deck-card-menu { position: absolute; top: 12px; right: 12px; background: none; border: none; color: var(--text3); font-size: 18px; cursor: pointer; padding: 2px 6px; border-radius: 6px; transition: .2s; }
.deck-card-menu:hover { background: var(--surface2); color: var(--text); }
.deck-card-due { font-size: 11px; color: var(--accent); font-weight: 600; }

/* List view card */
.deck-grid.list-view .deck-card { display: flex; align-items: center; gap: 16px; padding: 14px 20px; }
.deck-grid.list-view .deck-card-icon { font-size: 22px; margin-bottom: 0; flex-shrink: 0; }
.deck-grid.list-view .deck-card-body { flex: 1; }
.deck-grid.list-view .deck-card-title { font-size: 15px; margin-bottom: 2px; }
.deck-grid.list-view .deck-card-count { margin-bottom: 4px; }
.deck-grid.list-view .deck-progress-bar { margin-bottom: 0; }
.deck-grid.list-view .deck-card-actions { margin-top: 0; flex-shrink: 0; }

/* Create deck card */
.deck-card-create {
  border: 2px dashed var(--border); background: transparent;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px; color: var(--text3); min-height: 140px; font-size: 14px; font-weight: 500;
}
.deck-card-create:hover { border-color: var(--primary); color: var(--primary); transform: translateY(-3px); }
.deck-card-create .plus { font-size: 32px; }

/* My Decks toolbar */
.my-decks-toolbar { display: flex; gap: 10px; margin-bottom: 16px; }
.btn-outline {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text2); font-size: 13px; font-weight: 600; cursor: pointer; transition: .2s;
}
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }

/* Deck Detail / Setup */
.btn-back {
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 10px; padding: 8px 14px; font-size: 13px; font-weight: 600;
  color: var(--text2); cursor: pointer; transition: .2s;
}
.btn-back:hover { background: var(--primary); color: #fff; border-color: transparent; }
.deck-detail-meta { display: flex; gap: 16px; margin-bottom: 20px; }
.deck-detail-meta span { font-size: 14px; font-weight: 600; color: var(--text2); background: var(--surface2); padding: 4px 12px; border-radius: 20px; }

/* Mode Picker */
.mode-picker { display: grid; grid-template-columns: repeat(4,1fr); gap: 10px; margin-bottom: 8px; }
.mode-btn {
  background: var(--surface); border: 2px solid var(--border); border-radius: 14px;
  padding: 14px 8px; display: flex; flex-direction: column; align-items: center; gap: 6px;
  font-size: 22px; cursor: pointer; transition: all .2s; color: var(--text);
}
.mode-btn span { font-size: 12px; font-weight: 600; color: var(--text2); text-align: center; line-height: 1.3; }
.mode-btn small { font-size: 10px; color: var(--text3); }
.mode-btn:hover:not(.disabled) { border-color: var(--primary); transform: translateY(-2px); }
.mode-btn.active { border-color: var(--primary); background: rgba(192,57,43,.08); }
.mode-btn.active span { color: var(--primary); }
.mode-btn.disabled { opacity: .5; cursor: default; }

/* Word Preview */
.deck-word-preview { margin-top: 20px; }
.deck-word-preview-label { font-size: 12px; font-weight: 600; color: var(--text3); text-transform: uppercase; margin-bottom: 10px; }
.preview-word-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.preview-word-chip {
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
  padding: 6px 12px; font-family: var(--font-hanzi); font-size: 16px; color: var(--text);
}
.preview-word-chip small { font-size: 11px; color: var(--text2); margin-left: 4px; font-family: var(--font-ui); }

/* Vault Deck List */
.vault-deck-list { display: flex; flex-direction: column; gap: 12px; }
.vault-deck-item {
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  padding: 16px 20px; display: flex; align-items: center; gap: 14px;
}
.vdi-icon { font-size: 24px; flex-shrink: 0; }
.vdi-info { flex: 1; }
.vdi-title { font-size: 15px; font-weight: 700; color: var(--text); }
.vdi-meta { font-size: 12px; color: var(--text2); margin-top: 2px; }
.vdi-actions { display: flex; gap: 8px; }
.vdi-btn {
  background: var(--surface2); border: 1px solid var(--border); border-radius: 8px;
  padding: 6px 12px; font-size: 12px; font-weight: 600; color: var(--text2);
  cursor: pointer; transition: .2s; white-space: nowrap;
}
.vdi-btn:hover { background: var(--primary); color: #fff; border-color: transparent; }
.vdi-btn.danger:hover { background: #DC2626; }

/* Edit Deck */
.edit-deck-name-row { display: flex; gap: 10px; margin-bottom: 16px; }
.deck-name-input {
  flex: 1; background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 10px 14px; font-size: 15px; color: var(--text);
  outline: none; font-family: var(--font-ui); transition: .2s;
}
.deck-name-input:focus { border-color: var(--primary); }
.edit-deck-search { margin-bottom: 16px; }
.edit-deck-search input {
  width: 100%; background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 12px 16px; font-size: 14px; color: var(--text);
  outline: none; font-family: var(--font-ui); transition: .2s;
}
.edit-deck-search input:focus { border-color: var(--primary); }
.edit-search-results { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; max-height: 200px; overflow-y: auto; }
.edit-search-item {
  display: flex; align-items: center; gap: 12px; padding: 8px 12px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
}
.esi-hanzi { font-family: var(--font-hanzi); font-size: 22px; flex-shrink: 0; }
.esi-info { flex: 1; }
.esi-pinyin { font-size: 12px; color: var(--accent); }
.esi-meaning { font-size: 13px; color: var(--text2); }
.esi-add { background: var(--primary); color: #fff; border: none; border-radius: 8px; width: 28px; height: 28px; font-size: 16px; cursor: pointer; transition: .2s; flex-shrink: 0; }
.esi-add:hover { transform: scale(1.1); }
.esi-add.added { background: #059669; }
.edit-words-label { font-size: 13px; font-weight: 600; color: var(--text2); margin-bottom: 10px; }
.edit-words-list { display: flex; flex-wrap: wrap; gap: 8px; }
.edit-word-chip {
  display: flex; align-items: center; gap: 6px;
  background: var(--surface2); border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px;
}
.ewc-hanzi { font-family: var(--font-hanzi); font-size: 18px; }
.ewc-meaning { font-size: 12px; color: var(--text2); }
.ewc-del { background: none; border: none; color: var(--text3); cursor: pointer; font-size: 14px; padding: 0 2px; transition: .2s; }
.ewc-del:hover { color: #DC2626; }

/* Add-to-Deck Popup */
.popup-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.5); backdrop-filter: blur(4px);
  z-index: 2000; display: flex; align-items: center; justify-content: center; padding: 20px;
}
.add-deck-popup {
  background: var(--surface); border-radius: 16px; padding: 20px;
  min-width: 260px; max-width: 320px; width: 100%;
  box-shadow: 0 20px 60px rgba(0,0,0,.3); position: relative;
  animation: slideUp .25s ease;
}
.adp-title { font-size: 14px; font-weight: 700; color: var(--text); margin-bottom: 14px; }
.adp-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; max-height: 240px; overflow-y: auto; }
.adp-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px; background: var(--surface2); border: 1px solid var(--border);
  border-radius: 10px; cursor: pointer; transition: .2s; font-size: 14px; font-weight: 500;
}
.adp-item:hover { border-color: var(--primary); }
.adp-item.in-deck { border-color: #059669; color: #059669; }
.adp-item .adp-check { font-size: 16px; }
.adp-new {
  width: 100%; padding: 10px; background: var(--surface2); border: 1px dashed var(--border);
  border-radius: 10px; color: var(--text2); font-size: 14px; font-weight: 600;
  cursor: pointer; transition: .2s; margin-bottom: 6px; font-family: var(--font-ui);
}
.adp-new:hover { border-color: var(--primary); color: var(--primary); }
.adp-close {
  position: absolute; top: 12px; right: 12px; background: var(--surface2);
  border: 1px solid var(--border); border-radius: 8px; padding: 4px 8px;
  cursor: pointer; color: var(--text2); font-size: 14px; transition: .2s;
}
.adp-close:hover { background: var(--primary); color: #fff; }

@media (max-width: 768px) {
  .mode-picker { grid-template-columns: repeat(2,1fr); }
  .deck-grid { grid-template-columns: repeat(2,1fr); gap: 10px; }
  .deck-grid.list-view { grid-template-columns: 1fr; }
  .deck-card { padding: 14px; }
  .vdi-actions { flex-direction: column; gap: 4px; }
}



/* ─── WORD DETAIL MODAL ────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.6); backdrop-filter: blur(6px);
  z-index: 3000; display: flex; align-items: center; justify-content: center;
  padding: 20px; opacity: 0; pointer-events: none; transition: opacity .25s;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal {
  background: var(--surface); border-radius: 20px; padding: 28px 24px;
  max-width: 420px; width: 100%; position: relative;
  box-shadow: 0 24px 80px rgba(0,0,0,.4); animation: slideUp .25s ease;
  max-height: 90vh; overflow-y: auto;
}
.modal-close {
  position: absolute; top: 14px; right: 14px; background: var(--surface2);
  border: 1px solid var(--border); border-radius: 10px;
  width: 32px; height: 32px; font-size: 14px; color: var(--text2);
  cursor: pointer; transition: .2s; display: flex; align-items: center; justify-content: center;
}
.modal-close:hover { background: var(--primary); color: #fff; border-color: transparent; }
.modal-hanzi-row { display: flex; align-items: center; justify-content: center; gap: 12px; margin-bottom: 6px; }
.modal-hanzi { font-family: var(--font-hanzi); font-size: 62px; font-weight: 700; color: var(--text); line-height: 1; text-align: center; }
.modal-tts-btn {
  background: var(--surface2); border: 1px solid var(--border); border-radius: 12px;
  width: 40px; height: 40px; font-size: 20px; cursor: pointer; transition: .2s;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.modal-tts-btn:hover { background: var(--primary); border-color: transparent; transform: scale(1.1); }
.modal-pinyin { font-size: 20px; color: var(--accent); font-weight: 500; text-align: center; margin-bottom: 4px; }
.modal-level { text-align: center; margin-bottom: 16px; }
.modal-level span { font-size: 13px; color: var(--text2); }
.ver-chip { background: var(--primary); color: #fff; border-radius: 6px; padding: 2px 6px; font-size: 11px; margin-left: 6px; }
.modal-stroke-container {
  background: var(--surface2); border: 1px solid var(--border); border-radius: 14px;
  padding: 16px; margin-bottom: 16px; display: flex; flex-direction: column; align-items: center; gap: 12px;
}
.stroke-btns { display: flex; gap: 8px; }
.stroke-btn { background: var(--primary); color: #fff; border: none; border-radius: 10px; padding: 8px 16px; font-size: 13px; font-weight: 600; cursor: pointer; transition: .2s; font-family: var(--font-ui); }
.stroke-btn:hover { opacity: .85; transform: translateY(-1px); }
.stroke-btn.outline { background: transparent; border: 1.5px solid var(--primary); color: var(--primary); }
.stroke-btn.outline:hover { background: var(--primary); color: #fff; }
.modal-meanings { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.meaning-row { display: flex; align-items: flex-start; gap: 10px; }
.lang-badge { background: var(--primary); color: #fff; border-radius: 6px; padding: 2px 7px; font-size: 11px; font-weight: 700; flex-shrink: 0; margin-top: 2px; }
.lang-badge.en { background: #2980B9; }
.modal-example { background: var(--surface2); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; margin-bottom: 16px; display: flex; flex-direction: column; gap: 4px; }
.ex-label { font-size: 11px; font-weight: 700; color: var(--text2); text-transform: uppercase; margin-bottom: 6px; }
.ex-zh { font-family: var(--font-hanzi); font-size: 17px; color: var(--text); }
.ex-py { font-size: 13px; color: var(--accent); }
.ex-vi { font-size: 13px; color: var(--text2); }
.ex-en { font-size: 12px; color: var(--text3); }
.w-full { width: 100%; }
.sr-xp { font-size: 22px; font-weight: 700; color: var(--accent); text-align: center; margin: 8px 0; }

/* HSK List View (Sub-deck tree) */
.deck-list-view { display: flex; flex-direction: column; gap: 2px; }
.hsk-list-row {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 12px 16px; transition: .2s; margin-bottom: 2px;
}
.hsk-list-row:hover { border-color: var(--primary); background: var(--surface2); }
.hsk-expand-btn {
  background: var(--surface2); border: 1px solid var(--border); border-radius: 8px;
  width: 28px; height: 28px; font-size: 11px; cursor: pointer; transition: .2s;
  flex-shrink: 0; color: var(--text2);
}
.hsk-expand-btn:hover { background: var(--primary); color: #fff; border-color: transparent; }
.hsk-row-icon { font-size: 22px; flex-shrink: 0; }
.hsk-row-info { flex: 1; }
.hsk-row-title { font-size: 15px; font-weight: 700; color: var(--text); }
.hsk-row-sub { font-size: 12px; color: var(--text2); margin-top: 2px; }
.hsk-row-badges { display: flex; gap: 4px; flex-wrap: wrap; }
.btn-learn-deck {
  background: var(--primary); color: #fff; border: none; border-radius: 8px;
  padding: 7px 14px; font-size: 13px; font-weight: 600; cursor: pointer;
  transition: .2s; white-space: nowrap; flex-shrink: 0; font-family: var(--font-ui);
}
.btn-learn-deck:hover { opacity: .85; transform: translateY(-1px); }

/* Sub-deck rows */
.hsk-sub-row {
  align-items: center; gap: 10px; padding: 9px 16px 9px 40px;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 10px; margin-bottom: 2px; transition: .2s;
}
.hsk-sub-row:hover { border-color: var(--accent); }
.hsk-sub-indent { color: var(--text3); font-size: 14px; flex-shrink: 0; }
.hsk-sub-icon { font-size: 16px; flex-shrink: 0; }
.hsk-sub-name { font-size: 14px; font-weight: 600; color: var(--text); flex: 1; }
.hsk-sub-count { font-size: 12px; color: var(--text2); white-space: nowrap; }
.hsk-sub-badges { display: flex; gap: 4px; }
.btn-learn-sub {
  background: var(--surface); border: 1px solid var(--primary); color: var(--primary);
  border-radius: 8px; padding: 5px 12px; font-size: 12px; font-weight: 600;
  cursor: pointer; transition: .2s; white-space: nowrap; font-family: var(--font-ui);
}
.btn-learn-sub:hover { background: var(--primary); color: #fff; }

/* SRS Badges */
.srs-badge {
  font-size: 11px; font-weight: 600; border-radius: 6px;
  padding: 2px 7px; white-space: nowrap;
}
.srs-new    { background: rgba(59,130,246,.15); color: #3B82F6; }
.srs-due    { background: rgba(245,158,11,.15); color: #D97706; }
.srs-relearn{ background: rgba(239,68,68,.15);  color: #DC2626; }
.srs-done   { background: rgba(16,185,129,.15); color: #059669; }

/* Deck card SRS badges */
.deck-srs-badges { display: flex; gap: 4px; flex-wrap: wrap; margin: 6px 0 2px; }

/* Deck Detail SRS stats row */
.deck-srs-stats {
  gap: 8px; flex-wrap: wrap; padding: 10px 0; margin-bottom: 4px;
}
.srs-stat {
  font-size: 13px; font-weight: 600; padding: 5px 12px;
  border-radius: 8px; white-space: nowrap;
}
.srs-stat.srs-new    { background: rgba(59,130,246,.12); color: #3B82F6; }
.srs-stat.srs-due    { background: rgba(245,158,11,.12); color: #D97706; }
.srs-stat.srs-relearn{ background: rgba(239,68,68,.12);  color: #DC2626; }

/* XP Bar */
.xp-bar-wrap {
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  padding: 14px 18px; margin-bottom: 16px;
}
.xp-bar-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.xp-label { font-size: 14px; font-weight: 700; color: var(--accent); }
.xp-level-label { font-size: 12px; color: var(--text2); }
.xp-bar-track { height: 8px; background: var(--surface2); border-radius: 99px; overflow: hidden; }
.xp-bar-fill { height: 100%; background: linear-gradient(90deg, var(--primary), var(--accent)); border-radius: 99px; transition: width .6s ease; }
.xp-bar-footer { font-size: 12px; color: var(--text2); margin-top: 6px; }

/* Streak Calendar */
.streak-calendar {
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  padding: 14px 18px; margin-bottom: 20px;
}
.sc-title { font-size: 13px; font-weight: 600; color: var(--text2); margin-bottom: 10px; }
.sc-days { display: flex; gap: 6px; justify-content: space-between; }
.sc-day {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  flex: 1; padding: 8px 4px; border-radius: 10px;
  background: var(--surface2); border: 1px solid var(--border); transition: .2s;
}
.sc-day.active { background: rgba(234,88,12,.12); border-color: #EA580C; }
.sc-day.today { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(var(--primary-rgb),.2); }
.sc-dot { font-size: 18px; line-height: 1; }
.sc-label { font-size: 10px; color: var(--text2); font-weight: 600; }
.sc-day.active .sc-label { color: #EA580C; }

/* Streak stat card */
.streak-card { position: relative; overflow: hidden; }
.streak-card::before {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(135deg, rgba(234,88,12,.08), transparent);
  pointer-events: none;
}
.streak-fire { font-size: 18px; margin-left: 2px; }

/* Feedback Page */
.feedback-section {
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  padding: 16px 18px; margin-bottom: 14px;
}
.fb-section-title { font-size: 13px; font-weight: 700; color: var(--text2); margin-bottom: 12px; text-transform: uppercase; letter-spacing: .5px; }
.fb-stars { display: flex; gap: 8px; font-size: 32px; cursor: pointer; }
.fb-star { color: var(--surface2); transition: .15s; user-select: none; }
.fb-star.active, .fb-star.hover { color: #F59E0B; }
.fb-category-row { display: flex; flex-wrap: wrap; gap: 8px; }
.fb-cat {
  background: var(--surface2); border: 1.5px solid var(--border); border-radius: 10px;
  padding: 7px 14px; font-size: 13px; font-weight: 600; cursor: pointer;
  transition: .2s; color: var(--text2); font-family: var(--font-ui);
}
.fb-cat.active { background: var(--primary); color: #fff; border-color: transparent; }
.fb-cat:hover:not(.active) { border-color: var(--primary); color: var(--primary); }
.fb-textarea {
  width: 100%; background: var(--surface2); border: 1px solid var(--border);
  border-radius: 12px; padding: 12px 14px; font-size: 14px; color: var(--text);
  outline: none; resize: vertical; font-family: var(--font-ui); transition: .2s;
}
.fb-textarea:focus { border-color: var(--primary); }
.fb-success {
  text-align: center; padding: 20px; background: rgba(16,185,129,.1);
  border: 1px solid #059669; border-radius: 12px; margin: 12px 0;
  color: #059669; font-weight: 600; font-size: 15px;
}
.fb-success-icon { font-size: 32px; margin-bottom: 6px; }
.fb-hist-title { font-size: 13px; font-weight: 700; color: var(--text2); margin: 20px 0 12px; }
.fb-hist-item {
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 12px 16px; margin-bottom: 8px;
}
.fb-hist-header { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; font-size: 13px; flex-wrap: wrap; }
.fb-hist-header > span:first-child { color: #F59E0B; letter-spacing: 2px; }
.fb-hist-cat { background: var(--surface2); border-radius: 6px; padding: 2px 8px; color: var(--text2); font-size: 11px; font-weight: 600; }
.fb-hist-date { margin-left: auto; color: var(--text3); font-size: 11px; }
.fb-hist-msg { font-size: 14px; color: var(--text); line-height: 1.5; }
/* ══ ANKI-STYLE DECK DETAIL ══════════════════════════════ */

/* Header */
.dd-header {
  display: flex; align-items: center; gap: 14px; margin-bottom: 12px;
}
.dd-header-info { flex: 1; }
.dd-header-info h2 { margin: 0; font-size: 20px; font-weight: 800; }
.dd-meta-row { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text2); margin-top: 2px; }
.dd-dot { color: var(--text3); }

/* Preview Card Wrap */
.preview-card-wrap {
  position: relative; margin: 14px 0; display: flex;
  align-items: center; justify-content: center; gap: 12px;
}

/* Large Preview Card */
.preview-card {
  flex: 1; min-height: 220px; max-width: 600px;
  background: linear-gradient(145deg, #1e2536 0%, #151c2e 100%);
  border-radius: 18px; border: 1.5px solid rgba(255,255,255,.08);
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 10px; padding: 32px 20px;
  cursor: pointer; user-select: none; position: relative;
  transition: transform .15s, box-shadow .15s;
  box-shadow: 0 8px 32px rgba(0,0,0,.25);
}
.preview-card:hover { transform: translateY(-2px); box-shadow: 0 12px 40px rgba(0,0,0,.3); }
.preview-card.flipped { background: linear-gradient(145deg, #1b2e20 0%, #121f17 100%); }
.pc-hanzi {
  font-size: 72px; line-height: 1; color: #fff;
  font-family: 'Noto Sans SC', sans-serif; text-align: center;
}
.pc-pinyin {
  font-size: 22px; color: #7dd3fc; font-style: italic; text-align: center;
}
.pc-tts {
  background: rgba(255,255,255,.1); border: none; border-radius: 50%;
  width: 36px; height: 36px; font-size: 16px; cursor: pointer;
  transition: .2s; color: #fff; position: absolute; top: 14px; right: 14px;
}
.pc-tts:hover { background: rgba(255,255,255,.2); transform: scale(1.1); }
.pc-meaning {
  font-size: 24px; color: #86efac; font-weight: 600; text-align: center;
  margin-top: 6px;
}
.pc-tap-hint {
  font-size: 12px; color: rgba(255,255,255,.35); margin-top: 8px;
  letter-spacing: .5px;
}

/* Nav arrows */
.preview-nav {
  background: var(--surface); border: 1.5px solid var(--border);
  border-radius: 50%; width: 40px; height: 40px; font-size: 18px;
  cursor: pointer; transition: .2s; color: var(--text2); flex-shrink: 0;
}
.preview-nav:hover { background: var(--primary); color: #fff; border-color: transparent; }

/* Counter */
.preview-counter {
  position: absolute; bottom: -28px; left: 50%; transform: translateX(-50%);
  font-size: 13px; color: var(--text2); font-weight: 600;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 20px; padding: 3px 12px;
}

/* Keyboard hint */
.kb-hint {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  font-size: 12px; color: var(--text3); margin: 36px 0 14px;
  padding: 8px 12px; background: var(--surface2); border-radius: 8px;
}
.kb-hint kbd {
  background: var(--surface); border: 1px solid var(--border); border-radius: 5px;
  padding: 2px 6px; font-size: 11px; font-family: monospace; color: var(--text2);
}

/* Mode Chips (horizontal) */
.mode-chips-row {
  display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px;
}
.mode-chip {
  background: var(--surface); border: 1.5px solid var(--border); border-radius: 22px;
  padding: 8px 18px; font-size: 14px; font-weight: 600; cursor: pointer;
  transition: .2s; color: var(--text2); font-family: var(--font-ui);
  display: flex; align-items: center; gap: 6px;
}
.mode-chip.active {
  background: var(--primary); color: #fff; border-color: transparent;
  box-shadow: 0 4px 12px rgba(99,102,241,.3);
}
.mode-chip:hover:not(.active):not(.disabled) {
  border-color: var(--primary); color: var(--primary);
}
.mode-chip.disabled { opacity: .45; cursor: not-allowed; }
.mode-chip small { font-size: 10px; font-weight: 400; opacity: .7; }

/* Study Now CTA */
.btn-study-now {
  width: 100%; padding: 16px; font-size: 17px; font-weight: 800;
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  color: #fff; border: none; border-radius: 14px; cursor: pointer;
  transition: .2s; margin-bottom: 24px; font-family: var(--font-ui);
  letter-spacing: .3px; box-shadow: 0 6px 20px rgba(99,102,241,.35);
}
.btn-study-now:hover { transform: translateY(-2px); box-shadow: 0 8px 28px rgba(99,102,241,.45); }
.btn-study-now:active { transform: translateY(0); }

/* Word List header */
.dd-word-list-header {
  display: flex; align-items: center; gap: 8px;
  font-size: 14px; font-weight: 700; color: var(--text2);
  margin-bottom: 10px; padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.dd-wl-count { font-size: 12px; color: var(--text3); }

/* Word List rows */
.dd-word-list { display: flex; flex-direction: column; gap: 4px; }
.ddwl-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px; border-radius: 10px;
  background: var(--surface); border: 1px solid transparent;
  cursor: pointer; transition: .15s;
}
.ddwl-row:hover { border-color: var(--primary); background: var(--surface2); }
.ddwl-num { font-size: 11px; color: var(--text3); min-width: 22px; text-align: right; }
.ddwl-hanzi { font-size: 22px; min-width: 44px; text-align: center; font-family: 'Noto Sans SC', sans-serif; }
.ddwl-info { flex: 1; }
.ddwl-pinyin { font-size: 13px; color: var(--primary); font-weight: 500; }
.ddwl-meaning { font-size: 13px; color: var(--text2); }
.ddwl-tts {
  background: none; border: none; font-size: 16px; cursor: pointer;
  opacity: .5; transition: .2s; padding: 4px;
}
.ddwl-tts:hover { opacity: 1; transform: scale(1.15); }


/* ══════════════════════════════════════════════════════
   ⚙️  SETTINGS MODAL
══════════════════════════════════════════════════════ */

.settings-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.6);
  z-index: 1200; display: flex; align-items: center;
  justify-content: center; padding: 16px;
  backdrop-filter: blur(4px);
  animation: fadeIn .2s ease;
}

.settings-modal {
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 20px; width: 100%; max-width: 520px;
  max-height: 90vh; overflow-y: auto; padding: 0;
  box-shadow: 0 20px 60px rgba(0,0,0,.5);
  animation: slideUp .25s ease;
}

.sm-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px 16px; border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: var(--bg); z-index: 1;
  border-radius: 20px 20px 0 0;
}
.sm-header h2 { margin: 0; font-size: 18px; font-weight: 800; }
.sm-close {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 50%; width: 32px; height: 32px; font-size: 14px;
  cursor: pointer; color: var(--text2); transition: .2s;
}
.sm-close:hover { background: var(--danger, #ef4444); color: #fff; border-color: transparent; }

.sm-section {
  padding: 16px 24px; border-bottom: 1px solid var(--border);
}
.sm-section:last-of-type { border-bottom: none; }
.sm-section-title {
  font-size: 12px; font-weight: 700; color: var(--primary);
  text-transform: uppercase; letter-spacing: .8px; margin-bottom: 12px;
}

.sm-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 8px 0; border-bottom: 1px solid rgba(255,255,255,.04);
}
.sm-row:last-child { border-bottom: none; }
.sm-row > label {
  font-size: 14px; color: var(--text); flex: 1; cursor: default;
}
.sm-control { flex-shrink: 0; }

/* Number & Select inputs in settings */
.sm-control input[type="number"],
.sm-control select {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; color: var(--text); font-size: 14px;
  padding: 6px 10px; width: 100px; text-align: center;
  font-family: var(--font-ui);
}
.sm-control select { width: 180px; text-align: left; cursor: pointer; }
.sm-control input:focus, .sm-control select:focus {
  outline: none; border-color: var(--primary);
}

/* Toggle Switch */
.sm-toggle {
  position: relative; display: inline-block;
  width: 46px; height: 26px; cursor: pointer;
}
.sm-toggle input { opacity: 0; width: 0; height: 0; }
.sm-slider {
  position: absolute; inset: 0; background: var(--surface2);
  border-radius: 26px; border: 1px solid var(--border);
  transition: .3s;
}
.sm-slider::before {
  content: ''; position: absolute;
  width: 20px; height: 20px; border-radius: 50%;
  background: #fff; bottom: 2px; left: 2px; transition: .3s;
  box-shadow: 0 1px 4px rgba(0,0,0,.3);
}
.sm-toggle input:checked + .sm-slider { background: var(--primary); border-color: var(--primary); }
.sm-toggle input:checked + .sm-slider::before { transform: translateX(20px); }

/* Actions row */
.sm-actions {
  display: flex; gap: 12px; padding: 16px 24px 20px;
  position: sticky; bottom: 0; background: var(--bg);
  border-top: 1px solid var(--border);
}
.sm-btn-reset {
  flex: 1; padding: 11px; border-radius: 12px;
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text2); font-size: 14px; font-weight: 600;
  cursor: pointer; transition: .2s; font-family: var(--font-ui);
}
.sm-btn-reset:hover { border-color: var(--primary); color: var(--primary); }
.sm-btn-save {
  flex: 2; padding: 11px; border-radius: 12px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border: none; color: #fff; font-size: 14px; font-weight: 700;
  cursor: pointer; transition: .2s; font-family: var(--font-ui);
  box-shadow: 0 4px 12px rgba(99,102,241,.3);
}
.sm-btn-save:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(99,102,241,.4); }

/* Animations */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(30px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* ── STREAK CALENDAR ── */
.streak-calendar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 28px;
  box-shadow: var(--shadow);
}
.sc-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 12px;
}
.sc-days {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}
.sc-day {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  flex: 1;
  padding: 10px 6px;
  border-radius: 10px;
  background: var(--surface2);
  border: 1px solid var(--border);
  transition: all .2s;
}
.sc-day.today {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(192,57,43,.15);
}
.sc-day.active {
  background: linear-gradient(135deg, rgba(192,57,43,.1), rgba(243,156,18,.1));
  border-color: var(--accent);
}
[data-theme="dark"] .sc-day.active {
  background: linear-gradient(135deg, rgba(192,57,43,.2), rgba(243,156,18,.15));
}
.sc-dot {
  font-size: 18px;
  line-height: 1;
}
.sc-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text3);
}
.sc-day.today .sc-label { color: var(--primary); font-weight: 700; }
.sc-day.active .sc-label { color: var(--accent); }

/* ── MODAL HANZI ROW ── */
.modal-hanzi-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 8px;
}
.modal-tts-btn {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  font-size: 18px;
  transition: all .2s;
  flex-shrink: 0;
}
.modal-tts-btn:hover {
  background: var(--primary);
  color: #fff;
  border-color: transparent;
  transform: scale(1.1);
}

/* ── STROKE CONTAINER IN MODAL ── */
.modal-stroke-container {
  text-align: center;
  margin-bottom: 16px;
  padding: 16px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.stroke-btns {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 12px;
}
.stroke-btn {
  padding: 6px 16px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: .2s;
}
.stroke-btn:hover { background: var(--primary); color: #fff; border-color: transparent; }
.stroke-btn.outline { background: transparent; }
.stroke-btn.outline:hover { background: var(--surface2); color: var(--primary); border-color: var(--primary); }

/* ── XP BAR ── */
.xp-bar-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.xp-bar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.xp-label { font-size: 14px; font-weight: 700; color: var(--accent); }
.xp-level-label { font-size: 12px; color: var(--text2); font-weight: 600; }
.xp-bar-track {
  height: 8px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
}
.xp-bar-fill {
  height: 100%;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  transition: width .6s ease;
}
.xp-bar-footer {
  margin-top: 6px;
  font-size: 11px;
  color: var(--text3);
}

/* ── STREAK CARD GLOW ── */
.streak-card {
  position: relative;
  overflow: hidden;
}
.streak-card .stat-num { color: var(--accent); }
.streak-fire { font-size: 24px; vertical-align: middle; margin-left: 2px; }
