/* TOCFL Easy — Stylesheet */
@import url('https://fonts.googleapis.com/css2?family=Be+Vietnam+Pro:wght@300;400;500;600;700&family=Noto+Serif+TC:wght@400;500;700&display=swap');

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

:root {
  --primary: #c0392b;
  --primary-dark: #96281b;
  --gold: #d4af37;
  --bg: #f5f5f7;
  --card: #ffffff;
  --nav-bg: #ffffff;
  --text: #2c3e50;
  --text-muted: #7f8c8d;
  --border: #e0e0e0;
  --radius: 12px;
  --shadow: 0 2px 12px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 20px rgba(0,0,0,0.12);
  --transition: 0.2s ease;
  --font: 'Be Vietnam Pro', system-ui, sans-serif;
  --font-zh: 'Noto Serif TC', 'STSong', serif;
  --input-bg: #f5f5f7;
}

/* ── DARK MODE ── */
[data-theme="dark"] {
  --bg: #0e0e1a;
  --card: #1a1a2e;
  --nav-bg: #12121f;
  --text: #e2e2f0;
  --text-muted: #8888aa;
  --border: #2a2a44;
  --shadow: 0 2px 12px rgba(0,0,0,0.35);
  --shadow-md: 0 4px 24px rgba(0,0,0,0.5);
  --input-bg: #22223a;
}
[data-theme="dark"] body { background: var(--bg); color: var(--text); }
[data-theme="dark"] #navbar { background: var(--nav-bg); border-bottom-color: var(--border); }
[data-theme="dark"] .nav-link { color: #9999bb; }
[data-theme="dark"] .nav-link:hover, [data-theme="dark"] .nav-link.active { background: #2a2a44; color: #e0e0ff; }
[data-theme="dark"] .nav-link.active { background: #e2e2f0; color: #1a1a2e; }
[data-theme="dark"] .level-card,
[data-theme="dark"] .feature-card,
[data-theme="dark"] .vocab-card,
[data-theme="dark"] .vocab-card-sm,
[data-theme="dark"] .srs-stat-card,
[data-theme="dark"] .ptv2-card,
[data-theme="dark"] .mwc-big-card,
[data-theme="dark"] .ll-lesson-group,
[data-theme="dark"] .tl-panel,
[data-theme="dark"] .ptv2-header,
[data-theme="dark"] .ptv2-band-info,
[data-theme="dark"] .home-search-section,
[data-theme="dark"] .srs-stat-card { background: var(--card); border-color: var(--border); color: var(--text); }
[data-theme="dark"] .hss-search-wrap { background: #22223a; border-color: var(--border); }
[data-theme="dark"] .hss-input { color: var(--text); }
[data-theme="dark"] .hss-input::placeholder { color: #5555770; }
[data-theme="dark"] .form-input, [data-theme="dark"] .form-select { background: var(--input-bg); border-color: var(--border); color: var(--text); }
[data-theme="dark"] .modal-content { background: #1a1a2e; }
[data-theme="dark"] .add-word-modal, [data-theme="dark"] .awm-form { background: #1a1a2e; color: var(--text); }
[data-theme="dark"] .ptv2-q-body { background: #1a1a2e; }
[data-theme="dark"] .ptv2-opt { background: #22223a; border-color: var(--border); color: var(--text); }
[data-theme="dark"] .ptv2-result { background: var(--card); }
[data-theme="dark"] .ptv2-result-bar { background: #2a2a44; }
[data-theme="dark"] .ptv2-review-item.ptv2-ri-ok { background: #1a2e1a; }
[data-theme="dark"] .ptv2-review-item.ptv2-ri-fail { background: #2e1a1a; }
[data-theme="dark"] .lesson-group .ll-lesson-head { background: #22223a; }
[data-theme="dark"] .ll-audio-item { background: #22223a; border-color: var(--border); }
[data-theme="dark"] .vp-url-bar, [data-theme="dark"] .vp-sub-col { background: var(--card); border-color: var(--border); }
[data-theme="dark"] .vp-url-wrap { background: #22223a; }
[data-theme="dark"] .vp-url-input, [data-theme="dark"] .vp-textarea { color: var(--text); background: transparent; }
[data-theme="dark"] .vp-output { background: #16162a; }
[data-theme="dark"] .tl-main { background: #1a1a2e; border-color: var(--border); }
[data-theme="dark"] .tl-panel-head { background: #16162a; border-color: var(--border); }
[data-theme="dark"] .tl-output { background: #16162a; }
[data-theme="dark"] .tl-textarea { color: var(--text); }
[data-theme="dark"] .mw-collections, [data-theme="dark"] .mwc-big-card, [data-theme="dark"] .mwc-add-card { background: var(--card); border-color: var(--border); }
[data-theme="dark"] .mwc-empty-state h2 { color: var(--text); }
[data-theme="dark"] .lv-toolbar, [data-theme="dark"] .lesson-header { color: var(--text); }
[data-theme="dark"] .lesson-group { border-color: var(--border); }
[data-theme="dark"] .lesson-header-toggle:hover { background: rgba(255,255,255,0.05); }
[data-theme="dark"] .vc-hanzi, [data-theme="dark"] .srs-hanzi { color: var(--text); }
[data-theme="dark"] .ptv2-band-tab { background: #22223a; border-color: var(--border); color: var(--text-muted); }
[data-theme="dark"] .ptv2-band-tab.ptv2-tab-active { background: #e2e2f0; color: #1a1a2e; }
[data-theme="dark"] .hss-tab { background: #22223a; color: var(--text-muted); }
[data-theme="dark"] .hss-tab.hss-tab-active { background: #e2e2f0; color: #1a1a2e; }
[data-theme="dark"] .lvsb-cancel { background: rgba(255,255,255,0.1) !important; }
[data-theme="dark"] .section-title { color: var(--text); }
[data-theme="dark"] .lc-name, [data-theme="dark"] .lc-desc { color: var(--text); }
[data-theme="dark"] .btn-outline { border-color: var(--border); color: var(--text); }
[data-theme="dark"] .btn-outline:hover { border-color: var(--primary); color: var(--primary); background: #2e1a1a; }
[data-theme="dark"] input::placeholder { color: var(--text-muted); }

html { scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: #f5f5f7;
  color: var(--text);
  min-height: 100vh;
  padding-top: 68px;
  line-height: 1.6;
}

/* ── NAVBAR ── */
#navbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  background: #fff;
  border-bottom: 1px solid #ebebeb;
  box-shadow: 0 1px 6px rgba(0,0,0,0.05);
  height: 68px;
}
.nav-inner {
  max-width: 1280px; margin: 0 auto;
  display: flex; align-items: center;
  height: 100%; padding: 0 24px; gap: 0;
}

/* ── Logo ── */
.nav-brand {
  display: flex; align-items: center; gap: 10px;
  cursor: pointer; text-decoration: none; flex-shrink: 0;
  margin-right: 28px;
}
.brand-icon {
  width: 42px; height: 42px;
  background: linear-gradient(135deg, var(--primary) 0%, #a93226 100%);
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 8px rgba(192,57,43,0.35);
}
.brand-zh-char {
  font-family: var(--font-zh);
  font-size: 1.5rem; font-weight: 700; color: #fff;
  line-height: 1;
}
.brand-name { display: flex; align-items: baseline; gap: 1px; }
.brand-tocfl {
  font-size: 1.15rem; font-weight: 800; color: #1a1a2e;
  letter-spacing: -0.3px;
}
.brand-easy-text {
  font-size: 1.15rem; font-weight: 600; color: var(--primary);
}

/* ── Nav links (center) ── */
.nav-links {
  display: flex; align-items: center; gap: 2px;
  flex: 1; justify-content: center;
}
.nav-link {
  padding: 8px 18px;
  border-radius: 22px;
  text-decoration: none;
  color: #555; font-weight: 500; font-size: 0.9rem;
  transition: background 0.18s, color 0.18s;
  white-space: nowrap;
}
.nav-link:hover { background: #f2f2f5; color: #1a1a2e; }
.nav-link.active {
  background: #1a1a2e; color: #fff;
}
.nav-link-ai {
  color: #27ae60; border: 1.5px solid #a9dfbf;
  padding: 7px 16px;
}
.nav-link-ai:hover { background: #eafaf1; color: #1e8449; border-color: #27ae60; }

/* ── Right ── */
.nav-right { flex-shrink: 0; margin-left: 20px; display: flex; align-items: center; gap: 10px; }

/* ── Mobile hamburger + dropdown menu (hidden on desktop; shown <=1080px) ── */
.nav-hamburger {
  display: none; flex-direction: column; justify-content: center; align-items: center;
  gap: 5px; width: 40px; height: 40px; margin-left: 8px; flex-shrink: 0;
  background: none; border: none; cursor: pointer; padding: 0;
}
.hb-bar { width: 22px; height: 2px; background: #333; border-radius: 2px; transition: transform 0.2s, opacity 0.2s; }
[data-theme="dark"] .hb-bar { background: #e2e2f0; }
.nav-hamburger[aria-expanded="true"] .hb-bar:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-hamburger[aria-expanded="true"] .hb-bar:nth-child(2) { opacity: 0; }
.nav-hamburger[aria-expanded="true"] .hb-bar:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.mobile-nav-menu {
  display: none; flex-direction: column;
  position: fixed; top: 68px; left: 0; right: 0; z-index: 99;
  background: var(--card, #fff); border-bottom: 1px solid var(--border, #ebebeb);
  box-shadow: 0 8px 16px rgba(0,0,0,0.08);
  max-height: calc(100vh - 68px); overflow-y: auto;
}
.mobile-nav-menu.is-open { display: flex; }
.mobile-nav-menu .nav-link.mnm-link {
  padding: 14px 20px; border-radius: 0; border-bottom: 1px solid var(--border, #f0f0f0);
  color: var(--text, #333); font-size: 0.95rem;
}
.mobile-nav-menu .nav-link.mnm-link.active { background: var(--primary, #1a1a2e); color: #fff; }
.mobile-nav-menu .nav-link-ai { color: #27ae60; border-bottom: 1px solid var(--border, #f0f0f0); }

@media (max-width: 1080px) {
  .nav-links { display: none; }
  .nav-hamburger { display: flex; }
}

/* ── Char Mode Button (简 / 繁) ── */
.char-mode-btn {
  width: 42px; height: 32px; border-radius: 8px;
  background: #f2f2f5; border: 1.5px solid #e5e5e5;
  cursor: pointer; font-family: var(--font-zh); font-size: 1rem;
  font-weight: 700; color: #555; transition: all 0.2s;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.char-mode-btn:hover { background: #e0e0e5; border-color: #1a1a2e; color: #1a1a2e; }
.char-mode-btn.char-trad-active {
  background: #1a1a2e; border-color: #1a1a2e; color: #fff;
  box-shadow: 0 2px 8px rgba(26,26,46,0.25);
}
[data-theme="dark"] .char-mode-btn { background: #2a2a44; border-color: #3a3a5c; color: #aaa; }
[data-theme="dark"] .char-mode-btn.char-trad-active { background: #e2e2f0; color: #1a1a2e; }

/* ── Theme Toggle Button ── */
.theme-toggle {
  position: relative; display: flex; align-items: center;
  width: 64px; height: 32px; border-radius: 20px;
  background: #e0e0e0; border: none; cursor: pointer;
  transition: background 0.3s ease; flex-shrink: 0;
  overflow: hidden; padding: 0 4px;
}
.theme-toggle:hover { background: #ccc; }
[data-theme="dark"] .theme-toggle { background: #3a3a5c; }
[data-theme="dark"] .theme-toggle:hover { background: #4a4a6c; }

.theme-icon-sun, .theme-icon-moon {
  font-size: 0.9rem; line-height: 1;
  position: absolute; transition: opacity 0.3s, transform 0.3s;
}
.theme-icon-sun { left: 6px; opacity: 1; transform: scale(1); }
.theme-icon-moon { right: 6px; opacity: 0.4; transform: scale(0.8); }
[data-theme="dark"] .theme-icon-sun { opacity: 0.4; transform: scale(0.8); }
[data-theme="dark"] .theme-icon-moon { opacity: 1; transform: scale(1); }

.theme-toggle-thumb {
  position: absolute; width: 24px; height: 24px; border-radius: 50%;
  background: #fff; box-shadow: 0 2px 6px rgba(0,0,0,0.2);
  left: 4px; transition: left 0.3s cubic-bezier(0.34,1.56,0.64,1);
}
[data-theme="dark"] .theme-toggle-thumb { left: 36px; background: #1a1a2e; box-shadow: 0 2px 6px rgba(0,0,0,0.4); }

#main-content { max-width: 1280px; margin: 0 auto; padding: 24px 24px 60px; }

/* ── HOME HERO (compact) ── */
.home-hero {
  background: linear-gradient(120deg, #1a1a2e 0%, #c0392b 100%);
  border-radius: 18px;
  padding: 22px 28px;
  margin-bottom: 0;
  color: #fff;
}
.hero-top-row {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 16px; margin-bottom: 14px;
}
.hero-logo-area { display: flex; align-items: center; gap: 14px; }
.hero-brand-icon {
  width: 48px; height: 48px; background: rgba(255,255,255,0.15);
  border-radius: 13px; display: flex; align-items: center; justify-content: center;
  font-family: var(--font-zh); font-size: 1.7rem; font-weight: 700; color: #fff;
  border: 1.5px solid rgba(255,255,255,0.25);
}
.hero-brand-name {
  font-size: 1.4rem; font-weight: 800; line-height: 1.1;
  display: flex; gap: 3px; align-items: baseline;
}
.hero-brand-name span:first-child { color: #fff; }
.hero-brand-easy { color: #ffd580; }
.hero-brand-sub { font-size: 0.78rem; opacity: 0.7; margin-top: 3px; }
.hero-brand-switch { color: #ffd580; text-decoration: underline; margin-left: 8px; opacity: 0.9; }
.hero-brand-switch:hover { opacity: 1; }
.hero-stats-chips {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.hsc-item { text-align: center; }
.hsc-num { font-size: 1.1rem; font-weight: 800; display: block; }
.hsc-lab { font-size: 0.65rem; opacity: 0.7; text-transform: uppercase; letter-spacing: 0.3px; display: block; }
.hsc-sep { opacity: 0.3; font-size: 1.2rem; }
.hero-progress-mini { display: flex; align-items: center; gap: 10px; }
.hpm-bar {
  flex: 1; height: 5px; background: rgba(255,255,255,0.2);
  border-radius: 10px; overflow: hidden; max-width: 200px;
}
.hpm-fill { height: 100%; background: #ffd580; border-radius: 10px; transition: width 0.6s; }
.hpm-label { font-size: 0.75rem; opacity: 0.75; white-space: nowrap; }

/* ── HOME SEARCH (Hanzii-style) ── */
.home-search-section {
  background: #fff;
  border-radius: 18px;
  padding: 28px 28px 20px;
  margin: 14px 0 24px;
  box-shadow: 0 2px 16px rgba(0,0,0,0.06);
  border: 1px solid #ebebeb;
}
.hss-inner { max-width: 700px; margin: 0 auto; }
.hss-search-wrap {
  display: flex; align-items: center; gap: 0;
  background: #f5f5f7; border-radius: 50px;
  border: 1.5px solid #e0e0e0;
  padding: 4px 6px 4px 18px;
  transition: border-color 0.2s, box-shadow 0.2s;
  margin-bottom: 14px;
}
.hss-search-wrap:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(192,57,43,0.1);
  background: #fff;
}
.hss-icon { font-size: 1rem; color: #aaa; flex-shrink: 0; margin-right: 10px; }
.hss-input {
  flex: 1; border: none; background: transparent;
  font-size: 0.95rem; font-family: var(--font); color: var(--text);
  outline: none; padding: 8px 0;
}
.hss-input::placeholder { color: #bbb; }
.hss-btn-go {
  background: var(--primary); color: #fff;
  border: none; border-radius: 40px;
  padding: 9px 22px; font-weight: 700; font-size: 0.88rem;
  cursor: pointer; font-family: var(--font);
  transition: background 0.18s; flex-shrink: 0;
}
.hss-btn-go:hover { background: var(--primary-dark); }
.hss-tabs {
  display: flex; gap: 6px; flex-wrap: wrap; justify-content: center;
}
.hss-tab {
  background: #f2f2f5; border: none; border-radius: 20px;
  padding: 6px 18px; font-size: 0.83rem; font-weight: 600;
  color: #666; cursor: pointer; font-family: var(--font);
  transition: background 0.15s, color 0.15s;
}
.hss-tab:hover { background: #e5e5e8; color: #333; }
.hss-tab-active { background: #1a1a2e; color: #fff; }
/* ── Input Methods (Camera / Voice / Handwriting) ── */
.hss-input-methods {
  display: flex; gap: 10px; justify-content: center; flex-wrap: wrap;
}
.him-btn {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  background: #f5f5f7; border: 1.5px solid #e5e5e5; border-radius: 16px;
  padding: 14px 24px; cursor: pointer; font-family: var(--font);
  transition: all 0.18s; min-width: 130px; flex: 1;
}
.him-btn:hover { background: #eee; border-color: #1a1a2e; transform: translateY(-2px); box-shadow: 0 4px 14px rgba(0,0,0,0.1); }
.him-icon { font-size: 1.6rem; line-height: 1; }
.him-label { font-size: 0.85rem; font-weight: 700; color: #1a1a2e; }
.him-desc { font-size: 0.68rem; color: #aaa; }
.him-btn.him-listening {
  background: #fdecea; border-color: var(--primary);
  animation: himPulse 1s ease-in-out infinite alternate;
}
.him-btn.him-listening .him-icon { animation: himPulse 0.5s ease-in-out infinite alternate; }
@keyframes himPulse { from { transform: scale(1); } to { transform: scale(1.05); } }

[data-theme="dark"] .him-btn { background: #22223a; border-color: #3a3a5c; }
[data-theme="dark"] .him-btn:hover { background: #2a2a44; border-color: #e2e2f0; }
[data-theme="dark"] .him-label { color: #e2e2f0; }

/* Camera drop zone */
.cam-drop {
  border: 2px dashed var(--border); border-radius: 14px;
  min-height: 200px; display: flex; align-items: center; justify-content: center;
  cursor: pointer; overflow: hidden; background: #f9f9f9;
  transition: all 0.15s; margin-bottom: 12px;
}
.cam-drop:hover, .cam-drop-over { border-color: var(--primary); background: #fdf5f5; }
.cam-placeholder { text-align: center; color: #bbb; display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 20px; }

/* Handwriting canvas */
.hw-canvas-wrap { display: flex; flex-direction: column; align-items: center; gap: 8px; margin-bottom: 12px; }
.hw-canvas {
  border: 2px solid var(--border); border-radius: 14px;
  cursor: crosshair; touch-action: none; display: block;
  box-shadow: 0 2px 12px rgba(0,0,0,0.08);
  width: 280px; height: 280px;
  image-rendering: pixelated;
}
.hw-hint { font-size: 0.75rem; color: #bbb; font-style: italic; }

.hss-results {
  margin-top: 10px; background: #fff;
  border: 1px solid #e8e8e8; border-radius: 14px;
  overflow: hidden; box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}
.hss-results.hidden { display: none; }
.hss-result-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px; cursor: pointer;
  border-bottom: 1px solid #f5f5f5;
  transition: background 0.12s;
}
.hss-result-item:hover { background: #fafafa; }
.hss-r-badge {
  font-size: 0.65rem; font-weight: 700; color: #fff;
  padding: 2px 7px; border-radius: 5px; flex-shrink: 0;
}
.hss-r-hanzi { font-family: var(--font-zh); font-size: 1.1rem; font-weight: 700; color: var(--text); min-width: 48px; }
.hss-r-py { font-size: 0.78rem; color: var(--primary); font-weight: 600; min-width: 90px; }
.hss-r-vn { font-size: 0.82rem; color: var(--text-muted); flex: 1; }
.hss-no-result { padding: 14px 16px; color: var(--text-muted); font-size: 0.85rem; text-align: center; }
.hss-see-all {
  padding: 10px 16px; text-align: center;
  font-size: 0.83rem; color: var(--primary); font-weight: 600;
  cursor: pointer; background: #fdf8f8;
}
.hss-see-all:hover { background: #faeaea; }

.section-title {
  font-size: 1.05rem; font-weight: 700;
  margin-bottom: 16px; color: #333;
  display: flex; align-items: center; gap: 8px;
}
.section-levels { margin-bottom: 32px; }
.levels-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 14px;
}
.level-card {
  background: #fff;
  border-radius: 16px;
  padding: 20px;
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition);
  box-shadow: 0 1px 8px rgba(0,0,0,0.07);
  border-top: 4px solid var(--lc, #333);
  position: relative;
}
.level-card:hover { transform: translateY(-3px); box-shadow: 0 6px 24px rgba(0,0,0,0.12); }
.lc-badge {
  display: inline-block;
  background: var(--lc, #333);
  color: #fff;
  font-size: 0.75rem; font-weight: 700;
  padding: 3px 10px; border-radius: 6px;
  margin-bottom: 8px; letter-spacing: 1px;
}
.lc-name { font-size: 1rem; font-weight: 700; margin-bottom: 6px; }
.lc-desc { font-size: 0.82rem; color: var(--text-muted); margin-bottom: 14px; line-height: 1.4; }
.lc-stats { margin-bottom: 12px; }
.lc-bar {
  background: var(--border);
  border-radius: 10px; height: 5px; overflow: hidden; margin-bottom: 4px;
}
.lc-bar-fill { height: 100%; background: var(--lc, #333); border-radius: 10px; transition: width 0.6s; }
.lc-stats span { font-size: 0.78rem; color: var(--text-muted); }
.lc-score { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 10px; }
.lc-top-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.lc-cefr { font-size: 0.68rem; font-weight: 600; color: var(--text-muted); background: var(--bg); padding: 2px 7px; border-radius: 4px; }
.lc-official-stats { display: flex; flex-direction: column; gap: 3px; margin-bottom: 10px; }
.lc-official-stats span { font-size: 0.75rem; color: var(--text-muted); }
.lc-actions { display: flex; gap: 8px; }

/* ── CURRICULUM SELECT PAGE ── */
.page-curriculum-select { max-width: 900px; margin: 40px auto; padding: 0 16px; text-align: center; }
.cs-header { margin-bottom: 32px; }
.cs-logo {
  width: 64px; height: 64px; margin: 0 auto 16px; background: var(--primary);
  border-radius: 18px; display: flex; align-items: center; justify-content: center;
  font-family: var(--font-zh); font-size: 2.2rem; font-weight: 700; color: #fff;
  box-shadow: 0 4px 16px rgba(192,57,43,0.3);
}
.cs-header h1 { font-size: 1.5rem; font-weight: 800; margin-bottom: 6px; color: var(--text); }
.cs-header p { color: var(--text-muted); font-size: 0.92rem; }
.cs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 18px; text-align: left;
}
.cs-card {
  background: var(--card); border-radius: 18px; padding: 24px;
  cursor: pointer; position: relative;
  border: 2px solid var(--border); border-top: 5px solid var(--cc, #333);
  transition: transform var(--transition), box-shadow var(--transition);
}
.cs-card:hover { transform: translateY(-4px); box-shadow: 0 10px 28px rgba(0,0,0,0.12); }
.cs-card-active { border-color: var(--cc, #333); }
.cs-card-current {
  position: absolute; top: 14px; right: 14px;
  background: var(--cc, #333); color: #fff; font-size: 0.68rem; font-weight: 700;
  padding: 3px 10px; border-radius: 20px;
}
.cs-card-icon {
  width: 52px; height: 52px; border-radius: 14px; background: var(--cc, #333);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-zh); font-size: 1.6rem; font-weight: 700; color: #fff;
  margin-bottom: 14px;
}
.cs-card h2 { font-size: 1.1rem; font-weight: 800; margin-bottom: 4px; color: var(--text); }
.cs-card-subtitle { font-size: 0.78rem; color: var(--cc, #333); font-weight: 600; margin-bottom: 10px; }
.cs-card-desc { font-size: 0.85rem; color: var(--text-muted); line-height: 1.5; margin-bottom: 16px; }
.cs-card-footer { display: flex; }
.cs-card-count, .cs-card-badge {
  font-size: 0.75rem; font-weight: 700; padding: 4px 12px; border-radius: 20px;
}
.cs-card-count { background: var(--bg); color: var(--cc, #333); }
.cs-card-badge { background: #fef3c7; color: #92400e; }
[data-theme="dark"] .cs-card-badge { background: #451a03; color: #fbbf24; }
.cs-cancel { margin-top: 28px; }

@media (max-width: 600px) {
  .page-curriculum-select { margin: 20px auto; }
  .cs-grid { grid-template-columns: 1fr; }
}

.section-features { margin-bottom: 40px; }
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}
.feature-card {
  background: #fff;
  border-radius: 16px;
  padding: 22px 18px;
  text-align: center;
  cursor: pointer;
  box-shadow: 0 1px 8px rgba(0,0,0,0.07);
  transition: transform var(--transition), box-shadow var(--transition);
  border: 1px solid #f0f0f0;
}
.feature-card:hover { transform: translateY(-3px); box-shadow: 0 6px 24px rgba(0,0,0,0.12); }
.fc-icon { font-size: 2rem; margin-bottom: 12px; }
.fc-title { font-weight: 700; margin-bottom: 8px; }
.fc-desc { font-size: 0.82rem; color: var(--text-muted); line-height: 1.5; }

/* ── BUTTONS ── */
.btn-primary {
  background: var(--primary); color: #fff;
  border: none; border-radius: 8px;
  padding: 10px 20px; font-size: 0.9rem; font-weight: 600;
  cursor: pointer; transition: background var(--transition);
  font-family: var(--font);
}
.btn-primary:hover { background: var(--primary-dark); }
.btn-outline {
  background: transparent; color: var(--text);
  border: 1.5px solid var(--border); border-radius: 8px;
  padding: 10px 20px; font-size: 0.9rem; font-weight: 500;
  cursor: pointer; transition: border-color var(--transition), background var(--transition);
  font-family: var(--font);
}
.btn-outline:hover { border-color: var(--primary); color: var(--primary); background: #fdf0ef; }
.btn-white {
  background: rgba(255,255,255,0.2); color: #fff;
  border: 1.5px solid rgba(255,255,255,0.5); border-radius: 8px;
  padding: 8px 18px; font-size: 0.88rem; font-weight: 600;
  cursor: pointer; transition: background var(--transition);
  font-family: var(--font);
}
.btn-white:hover { background: rgba(255,255,255,0.35); }
.btn-sm {
  padding: 6px 14px; font-size: 0.82rem; border-radius: 6px;
  border: none; cursor: pointer; font-weight: 600;
  font-family: var(--font); transition: var(--transition);
}
.btn-sm.btn-primary { background: var(--primary); color: #fff; }
.btn-sm.btn-primary:hover { background: var(--primary-dark); }
.btn-sm.btn-outline {
  background: transparent; color: var(--text);
  border: 1.5px solid var(--border);
}
.btn-sm.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.back-btn {
  background: rgba(255,255,255,0.2); color: #fff;
  border: 1px solid rgba(255,255,255,0.4); border-radius: 8px;
  padding: 6px 14px; font-size: 0.85rem;
  cursor: pointer; font-family: var(--font); font-weight: 500;
  margin-bottom: 16px;
}
.back-btn:hover { background: rgba(255,255,255,0.35); }

/* ── VOCABULARY ── */
.page-vocab .vocab-header {
  margin-bottom: 24px;
}
.page-vocab .vocab-header h1 { font-size: 1.6rem; font-weight: 700; }
.page-vocab .vocab-header p { color: var(--text-muted); font-size: 0.9rem; }
.vocab-controls { margin-bottom: 16px; }
.search-wrap {
  position: relative; display: flex; align-items: center;
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 0 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
  transition: border-color var(--transition);
}
.search-wrap:focus-within { border-color: var(--primary); }
.search-icon { font-size: 1rem; color: var(--text-muted); margin-right: 10px; }
.search-input {
  flex: 1; border: none; outline: none; background: transparent;
  padding: 14px 0; font-size: 1rem; font-family: var(--font);
  color: var(--text);
}
.search-clear {
  background: none; border: none; cursor: pointer;
  font-size: 1rem; color: var(--text-muted); padding: 4px;
}
.search-clear:hover { color: var(--text); }
.level-filter { display: flex; flex-wrap: wrap; gap: 8px; }
.filter-btn {
  padding: 6px 14px; border-radius: 20px;
  border: 1.5px solid var(--border);
  background: #fff; color: var(--text);
  font-size: 0.82rem; font-weight: 600;
  cursor: pointer; transition: var(--transition);
  font-family: var(--font);
}
.filter-btn:hover { border-color: var(--primary); color: var(--primary); }
.filter-btn.active { border-color: transparent; }
.vocab-count { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 16px; }
.vocab-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}
.vocab-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  transition: transform var(--transition), box-shadow var(--transition), opacity var(--transition);
  position: relative;
}
.vocab-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.vocab-card.is-known { opacity: 0.65; }
.vc-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.vc-level-tag {
  font-size: 0.7rem; font-weight: 700; color: #fff;
  padding: 2px 8px; border-radius: 5px;
}
.vc-star {
  background: none; border: none; cursor: pointer;
  font-size: 1.1rem; color: #ccc; transition: color var(--transition); padding: 0;
}
.vc-star.starred, .vc-star:hover { color: #f1c40f; }

/* ── SPEAK BUTTON ── */
.vc-hanzi-row { display: flex; align-items: center; gap: 6px; margin-bottom: 2px; }
.vc-speak-btn {
  background: none; border: 1.5px solid #ddd; border-radius: 50%;
  width: 28px; height: 28px; font-size: 0.72rem;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: all 0.15s; flex-shrink: 0; padding: 0; line-height: 1;
}
.vc-speak-btn:hover { border-color: #2980b9; background: #ebf5fb; transform: scale(1.1); }
.vc-speak-btn.speak-active { border-color: #27ae60; background: #eafaf1; animation: speakPulse 0.6s ease infinite alternate; }
.vc-speak-sm { width: 22px; height: 22px; font-size: 0.6rem; }
@keyframes speakPulse { from { transform: scale(1); } to { transform: scale(1.2); } }
.fc-pinyin-row { display: flex; align-items: center; justify-content: center; gap: 8px; }
.fc-speak-btn {
  background: rgba(255,255,255,0.15); border: 1.5px solid rgba(255,255,255,0.3);
  border-radius: 50%; width: 32px; height: 32px; font-size: 0.85rem;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: all 0.15s; padding: 0;
}
.fc-speak-btn:hover { background: rgba(255,255,255,0.25); transform: scale(1.12); }
.fc-speak-btn.speak-active { background: rgba(39,174,96,0.3); border-color: #27ae60; animation: speakPulse 0.6s ease infinite alternate; }
[data-theme="dark"] .vc-speak-btn { border-color: #3a3a5c; }
[data-theme="dark"] .vc-speak-btn:hover { border-color: #5b9bd5; background: #1a2a3a; }

.vc-hanzi {
  font-family: var(--font-zh);
  font-size: 1.8rem; font-weight: 700;
  color: var(--text); margin-bottom: 2px;
  line-height: 1.2;
}
.vc-trad { font-family: var(--font-zh); font-size: 0.82rem; color: #aaa; margin-bottom: 4px; letter-spacing: 0.5px; }
.vc-pinyin { font-size: 0.88rem; color: var(--primary); font-weight: 600; margin-bottom: 6px; }
.vc-vn { font-size: 0.9rem; font-weight: 600; color: var(--text); margin-bottom: 2px; }
.vc-en { font-size: 0.8rem; color: var(--text-muted); margin-bottom: 8px; }
.vc-meta { display: flex; gap: 8px; font-size: 0.72rem; color: var(--text-muted); }
.vc-pos { background: var(--bg); padding: 1px 6px; border-radius: 4px; font-weight: 600; }

/* ── LEVEL PAGE ── */
.page-level { }
.level-header {
  color: #fff;
  border-radius: 20px;
  padding: 32px 28px;
  margin-bottom: 0;
  position: relative;
}
.lh-content { margin-bottom: 20px; }
.lh-top-row { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.lh-badge {
  display: inline-block;
  background: rgba(255,255,255,0.25);
  font-size: 0.8rem; font-weight: 800; letter-spacing: 2px;
  padding: 3px 12px; border-radius: 6px;
}
.lh-cefr-tag, .lh-tocfl-tag {
  font-size: 0.7rem; font-weight: 600;
  background: rgba(255,255,255,0.18);
  padding: 3px 10px; border-radius: 5px; opacity: 0.9;
}
.lh-title { font-size: 1.6rem; font-weight: 700; margin-bottom: 8px; }
.lh-official-row {
  display: flex; flex-wrap: wrap; gap: 10px;
  margin-bottom: 14px;
}
.lh-official-row span { font-size: 0.78rem; opacity: 0.85; background: rgba(255,255,255,0.15); padding: 3px 10px; border-radius: 5px; }
.lh-progress span { font-size: 0.8rem; opacity: 0.8; margin-top: 6px; display: block; }
.lh-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.level-tabs {
  display: flex; background: var(--card);
  border-radius: 0; margin-bottom: 24px;
  border-bottom: 2px solid var(--border);
  position: sticky; top: 64px; z-index: 10;
}
.tab-btn {
  flex: 1; padding: 16px 8px;
  border: none; background: transparent;
  font-size: 0.9rem; font-weight: 600; cursor: pointer;
  color: var(--text-muted); font-family: var(--font);
  transition: color var(--transition);
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--primary); }
.level-content { transition: opacity 0.2s ease; }

/* Level vocab grid */
.lesson-group { margin-bottom: 8px; border-radius: 10px; overflow: hidden; border: 1px solid var(--border); }
.lesson-header {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 10px 14px; border-bottom: none; margin-bottom: 0;
  background: var(--card);
}
.lesson-header-toggle {
  cursor: pointer; user-select: none;
  transition: background 0.15s;
}
.lesson-header-toggle:hover { background: var(--hover, rgba(128,128,128,0.08)); }

/* Chevron */
.lesson-chevron {
  font-size: 0.65rem; color: var(--text-muted);
  display: inline-block;
  transition: transform 0.2s ease;
  margin-right: 2px; flex-shrink: 0;
}
.lesson-group.is-open .lesson-chevron { transform: rotate(90deg); }

/* Word count label */
.lesson-word-count {
  font-size: 0.75rem; color: var(--text-muted); margin-right: 4px;
}

/* Collapsible body */
.lesson-body {
  display: none;
  padding: 12px 14px 14px;
  background: var(--bg, #f5f5f5);
}
[data-theme="dark"] .lesson-body { background: #181826; }
.lesson-group.is-open .lesson-body { display: block; }

.lesson-title-wrap {
  display: flex; align-items: center; gap: 6px;
}
.lesson-title {
  font-size: 0.85rem; font-weight: 700; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 1px;
}
.lesson-action-btn {
  background: none; border: 1px solid var(--border);
  border-radius: 6px; cursor: pointer; font-family: var(--font);
  transition: var(--transition); line-height: 1;
}
.lesson-rename-btn {
  padding: 2px 7px; font-size: 0.8rem; color: var(--text-muted);
}
.lesson-rename-btn:hover { border-color: #3498db; color: #3498db; background: #ebf5fb; }

.lesson-del-btn { padding: 2px 7px; font-size: 0.8rem; color: #e74c3c; border-color: #fde; }
.lesson-del-btn:hover { border-color: #e74c3c; background: #fdecea; }

.lesson-hdr-right { display: flex; align-items: center; gap: 6px; }

.lesson-selall-btn {
  padding: 3px 9px; font-size: 0.75rem;
  color: #e67e22; border-color: #f0c080;
}
.lesson-selall-btn:hover { background: #e67e22; color: #fff; border-color: #e67e22; }

.lesson-add-btn {
  padding: 3px 10px; font-size: 0.8rem;
  color: var(--primary); border-color: rgba(192,57,43,0.3);
}
.lesson-add-btn:hover { background: var(--primary); color: #fff; border-color: var(--primary); }

.lesson-study-btn {
  padding: 3px 10px; font-size: 0.8rem;
  color: #8e44ad; border-color: #d6c2e8;
}
.lesson-study-btn:hover { background: #8e44ad; color: #fff; border-color: #8e44ad; }

/* Custom lesson (user-created) */
.lesson-group-custom { border-left: 3px solid #27ae60; padding-left: 10px; }
.lv-empty-lesson {
  padding: 16px 18px; font-size: 0.82rem; color: #aaa; font-style: italic;
  background: #f9f9f9; border-radius: 8px; margin-top: 4px;
}
.lv-custom-count { color: #8e44ad; font-size: 0.8rem; font-weight: 600; }
.vocab-grid-level {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 10px;
}
.vocab-card-sm {
  background: var(--card);
  border-radius: 10px;
  padding: 14px 12px;
  box-shadow: var(--shadow);
  transition: transform var(--transition), opacity var(--transition);
  position: relative;
}
.vocab-card-sm:hover { transform: translateY(-2px); }
.vocab-card-sm.is-known { opacity: 0.55; }
.vocab-card-sm .vc-top { margin-bottom: 6px; justify-content: flex-end; }
.vcl-top { justify-content: space-between !important; }
.vcl-actions { display: flex; gap: 3px; }
.vcl-btn {
  background: none; border: 1px solid transparent;
  border-radius: 5px; width: 22px; height: 22px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 0.72rem; color: var(--text-muted);
  transition: var(--transition); padding: 0;
}
.vcl-edit:hover { border-color: #3498db; color: #3498db; background: #ebf5fb; }
.vcl-del:hover, .vcl-hide:hover { border-color: #e74c3c; color: #e74c3c; background: #fdf0ef; }
.vocab-card-sm .vc-hanzi { font-size: 1.5rem; }
.lv-toolbar {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 16px; flex-wrap: wrap; gap: 8px;
}

/* Bulk select toolbar (inside lv-vocab) */
.lv-sel-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  background: #fff3cd; border: 1px solid #ffc107; border-radius: 10px;
  padding: 8px 14px; margin-bottom: 14px; gap: 10px; flex-wrap: wrap;
}
.lv-sel-hint { font-size: 0.8rem; font-weight: 600; color: #856404; }
.lv-sel-toggle { transition: all 0.15s !important; }

/* Selected card state */
.vocab-card-sm.lv-selected {
  border: 2px solid #1a1a2e !important;
  box-shadow: 0 0 0 3px rgba(26,26,46,0.15) !important;
  background: #f0f0f8 !important;
}
.vocab-card-sm.lv-selected.is-known { opacity: 1 !important; }

/* Checkbox overlay */
.lv-sel-check {
  position: absolute; top: 8px; left: 8px;
  width: 22px; height: 22px; border-radius: 50%;
  background: #fff; border: 2px solid #ccc;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem; font-weight: 900; z-index: 2;
  transition: all 0.15s;
}
.lv-sel-check.lv-sel-checked {
  background: #1a1a2e; border-color: #1a1a2e; color: #fff;
}
.vocab-card-sm { position: relative; }

/* Floating action bar */
.lv-sel-bar {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: #1a1a2e; color: #fff; border-radius: 14px;
  padding: 12px 20px; z-index: 150;
  display: flex; align-items: center; gap: 14px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.3);
  min-width: 400px; flex-wrap: wrap; justify-content: space-between;
}
.lvsb-count { font-size: 0.88rem; font-weight: 700; white-space: nowrap; }
.lvsb-actions { display: flex; gap: 8px; align-items: center; }
.lvsb-move:disabled, .lvsb-col:disabled { opacity: 0.4; cursor: not-allowed; }

/* Bulk add to collection modal */
.bac-col-list { display: flex; flex-direction: column; gap: 8px; max-height: 250px; overflow-y: auto; margin-top: 6px; }
.bac-col-item { align-items: flex-start !important; padding: 10px 14px !important; }
.bac-col-info { display: flex; flex-direction: column; gap: 2px; }
.bac-col-count { font-size: 0.7rem; color: var(--text-muted); font-weight: 400; }

/* Move words preview */
.mv-word-preview { background: #f8f9fa; border-radius: 10px; padding: 12px 14px; margin-bottom: 4px; }
.mv-preview-label { font-size: 0.78rem; font-weight: 700; color: var(--text-muted); margin-bottom: 8px; }
.mv-word-list { display: flex; flex-wrap: wrap; gap: 6px; }
.mv-word-chip {
  background: #fff; border: 1.5px solid #e0e0e0; border-radius: 8px;
  padding: 4px 10px; font-family: var(--font-zh); font-size: 0.9rem;
  color: var(--text);
}
.mv-more { color: var(--text-muted); font-family: var(--font); font-size: 0.75rem; border-style: dashed; }

.lvsb-all, .lvsb-desel, .lvsb-cancel {
  background: rgba(255,255,255,0.12) !important;
  border-color: rgba(255,255,255,0.2) !important;
  color: #fff !important;
}
.lvsb-all:hover, .lvsb-desel:hover, .lvsb-cancel:hover {
  background: rgba(255,255,255,0.2) !important;
}
.lvsb-del:disabled { opacity: 0.4; cursor: not-allowed; }

@media (max-width: 600px) {
  .lv-sel-bar { min-width: unset; width: calc(100% - 32px); bottom: 16px; }
  .lvsb-actions { flex-wrap: wrap; }
}

/* Grammar */
.lv-grammar { display: flex; flex-direction: column; gap: 16px; }
.grammar-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  display: flex; gap: 16px;
}
.gc-num {
  flex-shrink: 0; width: 32px; height: 32px;
  background: var(--primary); color: #fff;
  border-radius: 50%; font-size: 0.85rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.gc-body { flex: 1; }
.gc-title { font-size: 1rem; font-weight: 700; margin-bottom: 10px; color: var(--primary); }
.gc-head-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.gc-head-row .gc-title { margin-bottom: 10px; }
.gc-actions { display: flex; gap: 3px; flex-shrink: 0; }
.gc-pattern {
  background: #fff8f0; border-left: 3px solid var(--gold);
  padding: 8px 12px; border-radius: 0 6px 6px 0;
  margin-bottom: 12px; font-size: 0.88rem;
}
.gc-pattern-label { font-weight: 600; margin-right: 8px; color: var(--text-muted); }
.gc-pattern code { font-family: monospace; font-size: 0.95rem; color: var(--text); background: none; }
.gc-example {
  background: var(--bg); border-radius: 8px; padding: 12px;
  margin-bottom: 10px;
}
.gc-zh {
  font-family: var(--font-zh);
  font-size: 1.2rem; font-weight: 700;
  color: var(--text); margin-bottom: 4px;
}
.gc-py { font-size: 0.85rem; color: var(--primary); font-weight: 600; margin-bottom: 4px; }
.gc-vn { font-size: 0.88rem; color: var(--text); margin-bottom: 2px; }
.gc-en { font-size: 0.82rem; color: var(--text-muted); }
.gc-neg { font-size: 0.85rem; margin-bottom: 10px; display: flex; gap: 8px; flex-wrap: wrap; align-items: baseline; }
.gc-neg-label { color: var(--text-muted); font-weight: 600; flex-shrink: 0; }
.gc-zh-inline { font-family: var(--font-zh); font-weight: 700; }
.gc-py-inline { color: var(--primary); font-size: 0.82rem; }
.gc-vn-inline { color: var(--text-muted); font-size: 0.82rem; }
.gc-note {
  background: #f0f8ff; border-radius: 6px; padding: 8px 12px;
  font-size: 0.82rem; color: var(--text-muted); line-height: 1.5;
}

/* Exercises */
.lv-exercise { display: flex; flex-direction: column; gap: 16px; }
.lv-section-title {
  font-size: 0.8rem; font-weight: 700; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 1px;
  margin: 4px 0 -4px;
}
.ex-intro {
  background: #fff8e6; border-radius: 8px; padding: 10px 16px;
  font-size: 0.85rem; color: #7d6608;
  border-left: 3px solid var(--gold);
}
.exercise-item {
  background: var(--card);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}
.ei-head-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.ei-head-row .ei-num { margin-bottom: 8px; }
.ei-num { font-size: 0.75rem; font-weight: 700; color: var(--text-muted); margin-bottom: 8px; text-transform: uppercase; letter-spacing: 1px; }
.ei-question { font-size: 1.05rem; font-weight: 600; margin-bottom: 16px; font-family: var(--font-zh); }
.ei-options { display: flex; flex-direction: column; gap: 8px; }
.opt-btn {
  display: flex; align-items: center; gap: 12px;
  background: var(--bg); border: 1.5px solid var(--border);
  border-radius: 8px; padding: 10px 16px;
  cursor: pointer; font-size: 0.9rem; font-family: var(--font);
  color: var(--text); text-align: left;
  transition: border-color var(--transition), background var(--transition);
}
.opt-btn:hover:not(:disabled) { border-color: var(--primary); background: #fdf0ef; }
.opt-btn:disabled { cursor: default; }
.opt-btn.correct { background: #eafaf1; border-color: #27ae60; color: #1a7941; }
.opt-btn.wrong { background: #fdecea; border-color: #e74c3c; color: #c0392b; }
.opt-letter {
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; flex-shrink: 0;
  background: var(--border); border-radius: 6px;
  font-size: 0.75rem; font-weight: 700; color: var(--text-muted);
}
.opt-btn.correct .opt-letter { background: #27ae60; color: #fff; }
.opt-btn.wrong .opt-letter { background: #e74c3c; color: #fff; }
.ei-explanation {
  margin-top: 10px; padding: 10px 14px;
  background: #f0f8ff; border-radius: 6px;
  font-size: 0.85rem; color: var(--text-muted); line-height: 1.5;
}
.hidden { display: none !important; }

/* ── TEST V2 (Hanzii style) ── */
.page-test-v2 { max-width: 900px; margin: 0 auto; }

/* Header */
.ptv2-header {
  background: #fff; border-radius: 16px; padding: 20px 22px;
  margin-bottom: 16px; border: 1px solid var(--border);
  box-shadow: 0 1px 8px rgba(0,0,0,0.06);
}
.ptv2-title-row { display: flex; align-items: baseline; gap: 12px; margin-bottom: 14px; }
.ptv2-title { font-size: 1.6rem; font-weight: 900; color: #1a1a2e; }
.ptv2-subtitle { font-size: 0.82rem; color: var(--text-muted); }
.ptv2-band-tabs { display: flex; gap: 6px; }
.ptv2-band-tab {
  padding: 8px 24px; border: 1.5px solid #e0e0e0; border-radius: 22px;
  font-size: 0.88rem; font-weight: 700; cursor: pointer;
  font-family: var(--font); color: #666; background: #fff;
  transition: all 0.18s;
}
.ptv2-band-tab:hover { border-color: #1a1a2e; color: #1a1a2e; }
.ptv2-tab-active { border-color: #1a1a2e !important; }

/* Band info bar */
.ptv2-band-info {
  display: flex; align-items: center; gap: 14px;
  background: #fff; border-radius: 12px; padding: 12px 18px;
  margin-bottom: 16px; border: 1px solid var(--border);
}
.ptv2-band-icon { font-size: 1.6rem; }
.ptv2-band-name { font-size: 0.95rem; font-weight: 700; }
.ptv2-cefr { font-size: 0.72rem; background: #f2f2f5; padding: 2px 8px; border-radius: 8px; color: #666; margin-left: 6px; }
.ptv2-band-desc { font-size: 0.78rem; color: var(--text-muted); margin-top: 2px; }

/* Test cards */
.ptv2-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px,1fr)); gap: 14px; }
.ptv2-card {
  background: #fff; border-radius: 16px; padding: 18px;
  border: 1px solid var(--border); box-shadow: 0 1px 8px rgba(0,0,0,0.06);
  transition: transform 0.18s, box-shadow 0.18s;
}
.ptv2-card:hover { transform: translateY(-3px); box-shadow: 0 6px 20px rgba(0,0,0,0.1); }
.ptv2-card-top { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 14px; }
.ptv2-card-title { font-size: 1rem; font-weight: 800; color: #1a1a2e; }
.ptv2-score-badge { font-size: 0.7rem; font-weight: 700; color: #fff; padding: 3px 9px; border-radius: 10px; }
.ptv2-card-illus { font-size: 2.2rem; line-height: 1; }
.ptv2-card-meta { display: flex; flex-direction: column; gap: 5px; margin-bottom: 16px; }
.ptv2-card-meta span { font-size: 0.78rem; color: var(--text-muted); }
.ptv2-card-actions { }
.ptv2-start-btn {
  width: 100%; color: #fff; border: none; border-radius: 10px;
  padding: 11px; font-weight: 700; font-size: 0.9rem;
  cursor: pointer; font-family: var(--font); transition: opacity 0.18s;
}
.ptv2-start-btn:hover { opacity: 0.88; }

/* Slot number & skill label on cards */
.ptv2-card-slot-num { font-size: 1.1rem; font-weight: 900; color: #1a1a2e; }
[data-theme="dark"] .ptv2-card-slot-num { color: #e2e2f0; }
.ptv2-card-skill-tag { font-size: 0.72rem; color: var(--text-muted); margin-top: 2px; }

/* Empty slot card */
.ptv2-card-empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px; text-align: center; min-height: 180px;
  border: 2px dashed var(--border) !important; background: transparent !important;
  box-shadow: none !important;
}
.ptv2-card-empty:hover { border-color: #1a1a2e !important; }
.ptv2-empty-slot-num { font-size: 0.9rem; font-weight: 800; color: var(--text-muted); align-self: flex-start; }
.ptv2-empty-slot-icon { font-size: 1.8rem; opacity: 0.4; }
.ptv2-empty-slot-label { font-size: 0.82rem; font-weight: 700; color: var(--text-muted); }
.ptv2-empty-slot-hint { font-size: 0.7rem; color: #bbb; }
.ptv2-upload-slot-btn {
  background: transparent; border: 1.5px solid; border-radius: 10px;
  padding: 9px 18px; font-size: 0.82rem; font-weight: 700;
  cursor: pointer; font-family: var(--font); transition: all 0.18s;
  margin-top: 4px;
}
.ptv2-upload-slot-btn:hover { opacity: 0.8; transform: scale(1.02); }

/* Method tabs in upload modal */
.tu-slot-info { display: flex; align-items: center; gap: 8px; font-size: 0.85rem; color: var(--text-muted); margin-bottom: 14px; }
.tu-slot-badge { color: #fff; font-size: 0.7rem; font-weight: 800; padding: 2px 9px; border-radius: 6px; }
.tu-method-tabs { display: flex; gap: 6px; margin-bottom: 14px; }
.tu-method-tab {
  flex: 1; padding: 8px 14px; border: 1.5px solid var(--border); border-radius: 10px;
  background: #f5f5f7; font-family: var(--font); font-size: 0.82rem; font-weight: 600;
  cursor: pointer; color: var(--text-muted); transition: all 0.15s;
}
.tu-method-active { background: #1a1a2e; color: #fff; border-color: #1a1a2e; }
.tu-manual-info { font-size: 0.8rem; color: var(--text-muted); padding: 12px 0; }

/* Skill type tabs */
.ptv2-skill-tabs { display: flex; gap: 10px; margin-bottom: 18px; flex-wrap: wrap; }
.ptv2-skill-tab {
  flex: 1; min-width: 180px; display: flex; align-items: center; justify-content: center;
  gap: 10px; padding: 14px 20px; border-radius: 14px;
  border: 2px solid var(--border); background: var(--card);
  cursor: pointer; font-family: var(--font); font-weight: 700; font-size: 0.95rem;
  transition: all 0.18s; color: var(--text);
}
.ptv2-skill-tab:hover { border-color: #1a1a2e; transform: translateY(-2px); box-shadow: 0 4px 14px rgba(0,0,0,0.1); }
.ptv2-skill-active { box-shadow: 0 4px 16px rgba(0,0,0,0.15); }
.ptv2-skill-count { font-size: 0.72rem; font-weight: 500; opacity: 0.8; }

/* Listening question box */
.ptv2-listen-box {
  background: #f0f7ff; border: 2px solid #aed6f1; border-radius: 14px;
  padding: 16px 18px; margin-bottom: 16px;
}
[data-theme="dark"] .ptv2-listen-box { background: #1a2535; border-color: #2a4060; }
.ptv2-listen-desc { font-size: 0.82rem; font-weight: 700; color: #1a5276; margin-bottom: 10px; }
[data-theme="dark"] .ptv2-listen-desc { color: #7fb3d3; }
.ptv2-listen-controls { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.ptv2-play-btn {
  background: #2980b9; color: #fff; border: none; border-radius: 10px;
  padding: 10px 22px; font-weight: 700; font-size: 0.9rem;
  cursor: pointer; font-family: var(--font); transition: background 0.18s;
}
.ptv2-play-btn:hover { background: #1a6fa0; }
.ptv2-play-btn:disabled { background: #27ae60; opacity: 0.8; }
.ptv2-play-hint { font-size: 0.72rem; color: #7f8c8d; }
.ptv2-show-script {
  background: none; border: 1px solid #aed6f1; border-radius: 8px;
  padding: 5px 12px; font-size: 0.75rem; cursor: pointer; color: #1a5276;
  margin-top: 10px; font-family: var(--font);
}
.ptv2-show-script:hover { background: #d6eaf8; }
.ptv2-listen-script { background: #fff; border-radius: 8px; padding: 12px 14px; margin-top: 10px; border: 1px solid #d6eaf8; }
.ptv2-script-label { font-size: 0.72rem; font-weight: 700; color: #7f8c8d; margin-bottom: 6px; }
.ptv2-script-text { font-family: var(--font-zh); font-size: 0.95rem; line-height: 1.8; color: var(--text); }
.ptv2-q-skill-tag { font-size: 0.7rem; background: #f0f0f5; padding: 2px 8px; border-radius: 8px; margin-left: 6px; color: #888; }

/* Question page */
.page-test-q { max-width: 700px; }
.ptv2-q-header {
  border-radius: 16px 16px 0 0; padding: 16px 20px 10px; color: #fff;
}
.ptv2-q-meta { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.ptv2-q-back { background: rgba(255,255,255,0.2); border: none; color: #fff; border-radius: 8px; padding: 5px 12px; font-size: 0.82rem; cursor: pointer; font-family: var(--font); }
.ptv2-q-back:hover { background: rgba(255,255,255,0.3); }
.ptv2-q-title { font-weight: 700; font-size: 0.88rem; }
.ptv2-q-timer { font-size: 0.88rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.ptv2-q-progress { background: rgba(255,255,255,0.25); border-radius: 4px; height: 5px; overflow: hidden; margin-bottom: 8px; }
.ptv2-q-bar { height: 100%; background: #fff; border-radius: 4px; transition: width 0.4s; }
.ptv2-q-counter { font-size: 0.75rem; opacity: 0.8; }

.ptv2-q-body {
  background: #fff; border-radius: 0 0 16px 16px;
  padding: 28px 24px; box-shadow: 0 2px 12px rgba(0,0,0,0.08);
  margin-bottom: 20px;
}
.ptv2-q-num { font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; color: var(--text-muted); margin-bottom: 10px; }
.ptv2-question { font-size: 1.18rem; font-weight: 700; line-height: 1.5; margin-bottom: 24px; color: #1a1a2e; font-family: var(--font-zh); }
.ptv2-options { display: flex; flex-direction: column; gap: 10px; }
.ptv2-opt {
  display: flex; align-items: center; gap: 14px;
  background: #f8f9fa; border: 2px solid #e8e8e8;
  border-radius: 12px; padding: 14px 16px;
  cursor: pointer; font-size: 0.95rem; font-family: var(--font);
  color: var(--text); text-align: left; transition: all 0.15s;
}
.ptv2-opt:hover:not(:disabled) { border-color: #1a1a2e; background: #f0f0f5; transform: translateX(4px); }
.ptv2-opt:disabled { cursor: default; }
.ptv2-opt-letter {
  width: 32px; height: 32px; border-radius: 50%; color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 0.85rem; flex-shrink: 0;
}
.ptv2-opt-text { font-size: 0.95rem; line-height: 1.4; }
.ptv2-opt-correct { background: #eafaf1 !important; border-color: #27ae60 !important; }
.ptv2-opt-correct .ptv2-opt-letter { background: #27ae60 !important; }
.ptv2-opt-wrong { background: #fdecea !important; border-color: #e74c3c !important; }
.ptv2-opt-wrong .ptv2-opt-letter { background: #e74c3c !important; }
.ptv2-exp { background: #fef9e7; border: 1px solid #f1c40f; border-radius: 8px; padding: 10px 14px; font-size: 0.82rem; color: #7d6608; margin-top: 16px; }
.ptv2-exp.hidden { display: none; }

/* Result */
.ptv2-result { background: #fff; border-radius: 18px; overflow: hidden; box-shadow: 0 4px 20px rgba(0,0,0,0.1); }
.ptv2-result-header { padding: 32px 28px; text-align: center; color: #fff; }
.ptv2-result-emoji { font-size: 3.5rem; margin-bottom: 10px; }
.ptv2-result-grade { font-size: 1.8rem; font-weight: 900; margin-bottom: 6px; }
.ptv2-result-band { font-size: 0.88rem; opacity: 0.85; }
.ptv2-result-score-row {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  padding: 20px; border-bottom: 1px solid #f0f0f0;
}
.ptv2-rs-item { text-align: center; }
.ptv2-rs-num { display: block; font-size: 2rem; font-weight: 900; }
.ptv2-rs-lab { display: block; font-size: 0.7rem; color: var(--text-muted); text-transform: uppercase; }
.ptv2-rs-sep { font-size: 1.5rem; color: #ddd; }
.ptv2-result-bar-wrap { padding: 0 28px 16px; }
.ptv2-result-bar { background: #f0f0f0; border-radius: 10px; height: 10px; overflow: hidden; margin-top: 12px; }
.ptv2-result-fill { height: 100%; border-radius: 10px; transition: width 0.8s ease; }
.ptv2-review { padding: 0 20px 20px; max-height: 400px; overflow-y: auto; }
.ptv2-review-title { font-size: 0.88rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; padding: 16px 0 10px; }
.ptv2-review-item { display: flex; gap: 12px; padding: 10px; border-radius: 10px; margin-bottom: 8px; }
.ptv2-ri-ok { background: #eafaf1; }
.ptv2-ri-fail { background: #fdecea; }
.ptv2-ri-icon { width: 22px; height: 22px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 0.8rem; font-weight: 800; flex-shrink: 0; margin-top: 1px; }
.ptv2-ri-ok .ptv2-ri-icon { background: #27ae60; color: #fff; }
.ptv2-ri-fail .ptv2-ri-icon { background: #e74c3c; color: #fff; }
.ptv2-ri-q { font-size: 0.85rem; font-weight: 600; margin-bottom: 4px; }
.ptv2-ri-ans { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 4px; }
.ptv2-ri-correct { font-size: 0.78rem; color: #1a7941; font-weight: 700; }
.ptv2-ri-chosen { font-size: 0.78rem; color: #c0392b; }
.ptv2-ri-exp { font-size: 0.75rem; color: #7d6608; background: #fef9e7; padding: 4px 8px; border-radius: 5px; margin-top: 2px; }
.ptv2-result-actions { display: flex; gap: 10px; padding: 16px 20px; justify-content: center; flex-wrap: wrap; border-top: 1px solid #f0f0f0; }

@media (max-width: 600px) { .ptv2-cards { grid-template-columns: 1fr 1fr; } }

/* Upload PDF button */
.ptv2-upload-btn {
  background: #fff; border: 1.5px solid var(--primary); color: var(--primary);
  border-radius: 10px; padding: 8px 16px;
  font-size: 0.82rem; font-weight: 700; cursor: pointer;
  font-family: var(--font); white-space: nowrap; flex-shrink: 0;
  transition: var(--transition);
}
.ptv2-upload-btn:hover { background: var(--primary); color: #fff; }

/* Official exam downloads (PDF from tocfl.edu.tw) */
.ptv2-official-section { margin-top: 28px; }
.ptv2-official-title {
  font-size: 1rem; font-weight: 800; color: var(--text);
  display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap;
  margin-bottom: 14px;
}
.ptv2-official-sub { font-size: 0.72rem; font-weight: 500; color: var(--text-muted); }
.ptv2-official-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px,1fr)); gap: 14px; }
.ptv2-official-card {
  background: var(--card); border-radius: 14px; padding: 16px;
  border: 1px solid var(--border); box-shadow: 0 1px 8px rgba(0,0,0,0.05);
}
.ptv2-official-card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.ptv2-official-skill { font-size: 0.78rem; color: var(--text-muted); font-weight: 600; }
.ptv2-official-band { font-size: 0.68rem; font-weight: 800; color: #fff; padding: 2px 9px; border-radius: 8px; }
.ptv2-official-card-title { font-size: 0.92rem; font-weight: 700; color: var(--text); margin-bottom: 14px; }
.ptv2-official-card-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.ptv2-official-btn {
  flex: 1; min-width: 88px; text-align: center; text-decoration: none;
  background: #f2f2f5; color: var(--text); border-radius: 9px;
  padding: 8px 10px; font-size: 0.78rem; font-weight: 700;
  font-family: var(--font); transition: opacity 0.18s;
}
[data-theme="dark"] .ptv2-official-btn { background: #2a2a3a; }
.ptv2-official-btn:hover { opacity: 0.8; }
.ptv2-official-btn-main { color: #fff; }

/* Custom test card */
.ptv2-card-custom { border-top: 3px solid #e67e22; }
.ptv2-custom-tag {
  background: #fdebd0; color: #e67e22;
  font-size: 0.65rem; font-weight: 700; padding: 1px 7px; border-radius: 8px;
  margin-left: 6px; vertical-align: middle;
}
.ptv2-del-btn {
  background: #fdecea; border: none; border-radius: 8px;
  padding: 8px 10px; cursor: pointer; font-size: 0.9rem;
  transition: background 0.15s;
}
.ptv2-del-btn:hover { background: #fadbd8; }
.ptv2-card-actions { display: flex; gap: 8px; }
.ptv2-start-btn { flex: 1; }

/* ── Test Upload Modal ── */
.tu-modal { padding: 4px 2px; }
.tu-band-row { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; }
.tu-label { font-size: 0.85rem; font-weight: 600; color: #555; margin-right: 4px; }
.tu-band-btn {
  padding: 6px 18px; border: 1.5px solid #e0e0e0; border-radius: 20px;
  font-size: 0.85rem; font-weight: 700; cursor: pointer;
  font-family: var(--font); color: #666; background: #fff;
  transition: all 0.15s;
}
.tu-band-btn:hover { border-color: #555; color: #333; }

.tu-drop {
  border: 2px dashed var(--border); border-radius: 12px;
  padding: 28px 20px; text-align: center; cursor: pointer;
  background: var(--bg); transition: all var(--transition);
  margin-bottom: 12px;
}
.tu-drop:hover, .tu-drop-over { border-color: var(--primary); background: #fdf5f5; }
.tu-drop-icon { font-size: 2.2rem; margin-bottom: 8px; }
.tu-drop-sub { font-size: 0.75rem; color: var(--text-muted); margin-top: 4px; }

.tu-status { padding: 10px 14px; border-radius: 8px; font-size: 0.83rem; margin-bottom: 10px; }
.tu-loading { background: #e8f4fd; color: #1a5276; }
.tu-ok { background: #eafaf1; color: #1a7941; }
.tu-warn { background: #fef9e7; color: #7d6608; }
.tu-error { background: #fdecea; color: #922b21; }

.tu-ai-warn {
  background: #fef9e7; border: 1px solid #f1c40f; border-radius: 8px;
  padding: 10px 14px; font-size: 0.82rem; color: #7d6608; margin-bottom: 10px;
}
.tu-ai-warn a { color: var(--primary); text-decoration: none; font-weight: 700; }

.tu-preview { margin: 12px 0; }
.tu-preview-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; font-weight: 700; font-size: 0.88rem; }
.tu-btn-sm { padding: 5px 12px; font-size: 0.78rem; }
.tu-q-list { max-height: 360px; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; }

.tu-q-item { background: #f8f9fa; border-radius: 10px; padding: 14px; border: 1px solid #e8e8e8; }
.tu-q-num { font-size: 0.75rem; font-weight: 700; color: #888; margin-bottom: 8px; display: flex; justify-content: space-between; }
.tu-q-del { background: none; border: none; color: #e74c3c; cursor: pointer; font-size: 0.8rem; padding: 0; }
.tu-q-input { margin-bottom: 8px; font-size: 0.9rem; }
.tu-opts { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.tu-opt-row { display: flex; align-items: center; gap: 8px; }
.tu-opt-label { display: flex; align-items: center; gap: 6px; cursor: pointer; flex-shrink: 0; }
.tu-opt-letter { width: 24px; height: 24px; border-radius: 50%; background: #ddd; color: #555; font-size: 0.72rem; font-weight: 800; display: flex; align-items: center; justify-content: center; }
input[type="radio"]:checked + .tu-opt-letter { background: #27ae60; color: #fff; }
.tu-opt-input { flex: 1; font-size: 0.85rem; padding: 6px 10px; }
.tu-exp-input { font-size: 0.8rem; color: #888; padding: 6px 10px; }

/* ── FLASHCARD MODAL ── */
.modal {
  position: fixed; inset: 0; z-index: 200;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.modal-overlay {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.6); backdrop-filter: blur(4px);
}
.modal-content {
  position: relative; z-index: 1;
  background: var(--card);
  border-radius: 20px;
  max-width: 480px; width: 100%;
  max-height: 90vh; overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.flashcard-modal { padding: 24px; }
.fcm-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 8px; font-size: 0.88rem; color: var(--text-muted); font-weight: 600;
}
.fcm-close {
  background: var(--bg); border: none; border-radius: 6px;
  width: 28px; height: 28px; cursor: pointer; font-size: 0.85rem;
}
.fcm-progress {
  background: var(--border); border-radius: 10px; height: 4px; overflow: hidden;
  margin-bottom: 20px;
}
.fcm-prog-fill { height: 100%; border-radius: 10px; transition: width 0.3s; }
.flashcard {
  min-height: 240px; cursor: pointer;
  perspective: 800px;
  position: relative; margin-bottom: 20px;
}
.fc-front, .fc-back {
  background: linear-gradient(135deg, #f8f9fa, #fff);
  border: 1.5px solid #e5e5ea;
  border-radius: 16px;
  padding: 28px 24px;
  text-align: center;
  min-height: 240px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  backface-visibility: hidden;
  animation: fcFaceIn 0.18s ease;
  color: #2c3e50; /* card faces are always light, regardless of site theme */
}
.fc-back { background: linear-gradient(135deg, #fff8f0, #fff); }
/* Only one face is shown at a time — front by default, back once flipped */
.fc-back { display: none; }
.flashcard.flipped .fc-front { display: none; }
.flashcard.flipped .fc-back { display: flex; }
@keyframes fcFaceIn { from { opacity: 0; } to { opacity: 1; } }
.fc-hint { font-size: 0.75rem; color: #8a96a3; margin-bottom: 12px; }
.fc-hanzi {
  font-family: var(--font-zh);
  font-size: 3rem; font-weight: 700;
  color: #1a1a2e; margin-bottom: 8px; line-height: 1.1;
}
.fc-hanzi-sm { font-size: 1.8rem; }
.fc-trad { font-family: var(--font-zh); font-size: 1.1rem; color: #8a96a3; margin-bottom: 8px; }
.fc-pinyin { font-size: 1rem; color: var(--primary); font-weight: 700; margin-bottom: 8px; }
.fc-pos { font-size: 0.78rem; color: #8a96a3; background: #f0f1f3; padding: 2px 10px; border-radius: 6px; margin-bottom: 8px; }
.fc-vn { font-size: 1.1rem; font-weight: 700; color: #2c3e50; margin-bottom: 6px; }
.fc-en { font-size: 0.9rem; color: #8a96a3; margin-bottom: 8px; }
.fc-meta-info { font-size: 0.75rem; color: #8a96a3; }
.fc-speak-standalone {
  margin-top: 14px; width: 40px; height: 40px; font-size: 1.2rem;
  background: #f5f5f7; border: 1.5px solid #e0e0e0;
}
.fc-speak-standalone:hover { background: #fdf0ef; border-color: var(--primary); transform: scale(1.1); }
.fcm-actions { display: flex; gap: 8px; margin-bottom: 12px; }
.fc-btn {
  flex: 1; padding: 10px;
  border-radius: 8px; border: 1.5px solid var(--border);
  background: var(--bg); color: var(--text);
  font-size: 0.88rem; font-weight: 600; cursor: pointer;
  transition: var(--transition); font-family: var(--font);
}
.fc-btn:hover:not(:disabled) { border-color: var(--primary); background: #fdf0ef; color: var(--primary); }
.fc-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.fc-btn-next { background: var(--primary); color: #fff; border-color: var(--primary); }
.fc-btn-next:hover:not(:disabled) { background: var(--primary-dark); }
.fc-btn-star { border-color: #f1c40f; color: #7d6400; background: #fffbe0; }
.fc-btn-star.fc-starred { background: #f1c40f; color: #5d4900; }
.fcm-keys { font-size: 0.72rem; color: var(--text-muted); text-align: center; }

/* ── TOAST ── */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: #2c3e50; color: #fff;
  padding: 10px 24px; border-radius: 24px;
  font-size: 0.9rem; font-weight: 500;
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
  opacity: 0; transition: opacity 0.25s, transform 0.25s;
  z-index: 300; white-space: nowrap;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── MISC ── */
.empty-state {
  text-align: center; padding: 48px 20px;
  color: var(--text-muted); font-size: 0.9rem;
}
.test-header .hp-track { background: rgba(255,255,255,0.3); margin: 0; }
.test-header .hp-fill { background: #fff; }

/* ── RESPONSIVE ── */
@media (max-width: 780px) {
  .nav-links { gap: 1px; }
  .nav-link { padding: 7px 11px; font-size: 0.82rem; }
  .brand-name { display: none; }
  .hero-stats-chips { display: none; }
}
@media (max-width: 600px) {
  body { padding-top: 60px; }
  .mobile-nav-menu { top: 60px; max-height: calc(100vh - 60px); }
  #navbar { height: 60px; }
  .nav-inner { padding: 0 12px; }
  .nav-right { display: none; }
  #main-content { padding: 16px 12px 48px; }
  .home-hero { padding: 18px 16px; }
  .home-search-section { padding: 18px 14px 14px; }
  .levels-grid { grid-template-columns: 1fr 1fr; }
  .features-grid { grid-template-columns: 1fr 1fr; }
  .vocab-grid { grid-template-columns: 1fr 1fr; }
  .vocab-grid-level { grid-template-columns: 1fr 1fr; }
  .grammar-card { flex-direction: column; }
  .fc-hanzi { font-size: 2.2rem; }
  .level-header { padding: 24px 18px; }
  .lh-actions { flex-wrap: wrap; }
  .tab-btn { font-size: 0.8rem; padding: 12px 4px; }
}
@media (max-width: 380px) {
  .levels-grid { grid-template-columns: 1fr; }
  .features-grid { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  /* 2-col forced by the 600px breakpoint above is too tight for real phone widths —
     card content (hanzi + pinyin + vi + en + actions) overflows it. Single column here. */
  .vocab-grid { grid-template-columns: 1fr; }
  .vocab-grid-level { grid-template-columns: 1fr; }
}

/* ── FEATURE CARD UPLOAD ── */
.feature-card-upload {
  border: 2px dashed #e67e22;
  position: relative; overflow: hidden;
}
.feature-card-upload:hover { border-color: #c0392b; border-style: solid; }
.fc-badge-new {
  position: absolute; top: 10px; right: 10px;
  background: #e67e22; color: #fff;
  font-size: 0.62rem; font-weight: 800; letter-spacing: 0.5px;
  padding: 2px 8px; border-radius: 10px;
}

/* ── UPLOAD MODAL ── */
.upload-modal {
  font-family: var(--font);
  max-height: 90vh; overflow-y: auto;
}
.um-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: #fff; z-index: 1;
}
.um-title-row { display: flex; align-items: center; gap: 10px; }
.um-icon { font-size: 1.4rem; }
.um-header h2 { font-size: 1.1rem; font-weight: 700; margin: 0; }
.um-close {
  background: var(--bg); border: none; border-radius: 8px;
  width: 32px; height: 32px; cursor: pointer; font-size: 1rem;
  display: flex; align-items: center; justify-content: center;
  transition: background var(--transition);
}
.um-close:hover { background: #f0f0f0; }

.um-body { padding: 20px 24px 24px; display: flex; flex-direction: column; gap: 20px; }

.um-step { }
.um-step-label {
  display: flex; align-items: center; gap: 8px;
  font-size: 0.9rem; font-weight: 700; color: var(--text);
  margin-bottom: 10px;
}
.um-step-n {
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--primary); color: #fff;
  font-size: 0.75rem; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.um-badge-free {
  background: #27ae60; color: #fff;
  font-size: 0.62rem; font-weight: 800; padding: 2px 8px;
  border-radius: 10px; letter-spacing: 0.5px;
}

/* Provider tabs */
.um-provider-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.um-ptab {
  display: flex; flex-direction: column; align-items: flex-start;
  padding: 10px 14px; border-radius: 10px;
  border: 2px solid var(--border); background: var(--bg);
  cursor: pointer; font-family: var(--font); text-align: left;
  transition: var(--transition); flex: 1; min-width: 140px;
}
.um-ptab:hover { border-color: var(--primary); background: #fdf5f5; }
.um-ptab-active { border-color: var(--primary) !important; background: #fdf5f5 !important; }
.um-ptab-icon { font-size: 1.2rem; margin-bottom: 2px; }
.um-ptab-name { font-size: 0.85rem; font-weight: 700; color: var(--text); }
.um-ptab-badge { font-size: 0.68rem; color: #27ae60; font-weight: 600; margin-top: 2px; }
.um-key-section { }

/* Drop zone */
.upload-dz {
  border: 2px dashed var(--border);
  border-radius: 12px;
  padding: 28px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
  background: var(--bg);
}
.upload-dz:hover, .upload-dz.dz-active {
  border-color: var(--primary);
  background: #fdf5f5;
}
.dz-icon-big { font-size: 2rem; margin-bottom: 8px; }
.dz-main-text { font-size: 0.9rem; color: var(--text); margin-bottom: 4px; }
.dz-sub-text { font-size: 0.78rem; color: var(--text-muted); }

.um-excel-hint {
  display: flex; align-items: center; justify-content: space-between;
  background: #f0faf4; border: 1px solid #a9dfbf;
  border-radius: 8px; padding: 8px 14px;
  margin-top: 10px; gap: 12px; flex-wrap: wrap;
}
.um-excel-hint span { font-size: 0.82rem; color: #1a7941; }
.um-dl-template {
  background: #27ae60; color: #fff;
  border: none; border-radius: 7px;
  padding: 6px 14px; font-size: 0.8rem; font-weight: 700;
  cursor: pointer; font-family: var(--font);
  transition: background var(--transition); white-space: nowrap;
}
.um-dl-template:hover { background: #1e8449; }

/* File status */
.um-file-status {
  margin-top: 8px; padding: 8px 12px;
  border-radius: 8px; font-size: 0.83rem;
}
.um-status-loading { background: #e8f4fd; color: #1a5276; }
.um-status-ok { background: #eafaf1; color: #1a7941; }
.um-status-warn { background: #fef9e7; color: #7d6608; border: 1px solid #f1c40f; }
.um-status-error { background: #fdecea; color: #922b21; }

/* API Key */
.um-key-row { display: flex; gap: 8px; align-items: center; }
.um-key-input {
  flex: 1; padding: 10px 14px;
  border: 1.5px solid var(--border); border-radius: 8px;
  font-size: 0.9rem; font-family: monospace;
  background: var(--bg); color: var(--text);
  outline: none; transition: border-color var(--transition);
}
.um-key-input:focus { border-color: var(--primary); background: #fff; }
.um-key-eye {
  background: var(--bg); border: 1.5px solid var(--border);
  border-radius: 8px; padding: 8px 12px; cursor: pointer; font-size: 1rem;
}
.um-key-note {
  margin-top: 6px; font-size: 0.78rem; color: var(--text-muted); line-height: 1.5;
}
.um-key-note a { color: var(--primary); font-weight: 600; }

/* Meta fields */
.um-meta-row { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 10px; }
.um-step-toggle { display: flex; align-items: center; gap: 8px; }
.um-step-toggle:hover { opacity: 0.8; }
.um-meta-toggle-hint { font-size: 0.72rem; color: var(--text-muted); font-weight: 400; }
.um-meta-summary {
  margin-top: 6px; font-size: 0.8rem; color: #27ae60;
  background: #eafaf1; border-radius: 6px; padding: 5px 10px;
}
.um-meta-summary.hidden { display: none; }
.um-meta-field { display: flex; flex-direction: column; gap: 4px; }
.um-meta-field label { font-size: 0.78rem; font-weight: 600; color: var(--text-muted); }
.um-select {
  padding: 8px 12px; border: 1.5px solid var(--border); border-radius: 8px;
  background: var(--bg); font-family: var(--font); font-size: 0.88rem;
  color: var(--text); cursor: pointer; min-width: 130px;
}
.um-number {
  padding: 8px 12px; border: 1.5px solid var(--border); border-radius: 8px;
  background: var(--bg); font-family: var(--font); font-size: 0.88rem;
  color: var(--text); width: 70px; text-align: center;
}

/* Action buttons */
.um-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.um-btn-primary {
  flex: 1; background: var(--primary); color: #fff;
  border: none; border-radius: 10px; padding: 12px 20px;
  font-size: 0.95rem; font-weight: 700; cursor: pointer;
  font-family: var(--font); transition: background var(--transition);
  min-width: 200px;
}
.um-btn-primary:hover:not(:disabled) { background: var(--primary-dark); }
.um-btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.um-btn-secondary {
  background: var(--bg); color: var(--text);
  border: 1.5px solid var(--border); border-radius: 10px; padding: 12px 20px;
  font-size: 0.88rem; font-weight: 600; cursor: pointer;
  font-family: var(--font); transition: var(--transition);
}
.um-btn-secondary:hover:not(:disabled) { border-color: var(--primary); color: var(--primary); }
.um-btn-secondary:disabled { opacity: 0.5; cursor: not-allowed; }
.um-actions-note { font-size: 0.75rem; color: var(--text-muted); }

/* Status */
.um-status {
  padding: 10px 14px; border-radius: 8px;
  font-size: 0.85rem; line-height: 1.5;
}
.um-status a { color: inherit; font-weight: 600; }

/* Results */
#um-results { border-top: 1px solid var(--border); padding-top: 20px; }
.umr-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 12px; flex-wrap: wrap; gap: 10px;
}
.umr-header-left { display: flex; flex-direction: column; gap: 2px; }
.umr-title { font-size: 1rem; font-weight: 700; }
.umr-existing-note { font-size: 0.78rem; color: var(--text-muted); }
.umr-header-right { display: flex; gap: 6px; flex-wrap: wrap; }
.umr-btn {
  background: var(--bg); border: 1.5px solid var(--border);
  border-radius: 6px; padding: 5px 12px;
  font-size: 0.78rem; font-weight: 600; cursor: pointer;
  font-family: var(--font); transition: var(--transition);
}
.umr-btn:hover { border-color: var(--primary); color: var(--primary); }
.umr-btn-only-new { border-color: #e67e22; color: #e67e22; }

.umr-table-scroll { overflow-x: auto; border-radius: 10px; border: 1px solid var(--border); margin-bottom: 14px; }
.umr-table {
  width: 100%; border-collapse: collapse; font-size: 0.83rem;
  white-space: nowrap;
}
.umr-table thead { background: var(--bg); }
.umr-table th {
  padding: 10px 8px; text-align: left;
  font-size: 0.72rem; font-weight: 700; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
}
.umr-table td { padding: 8px; border-bottom: 1px solid #f5f5f5; vertical-align: middle; }
.umr-row:hover { background: #fafafa; }
.umr-row-exists { opacity: 0.6; }
.umr-zh-cell { font-family: var(--font-zh); font-size: 1.1rem; font-weight: 700; }
.umr-trad-cell { font-family: var(--font-zh); color: var(--text-muted); font-size: 0.95rem; }
.umr-py-cell { color: var(--primary); font-weight: 600; }
.umr-en-cell { color: var(--text-muted); }
.umr-same { color: #ccc; }
.col-cb { width: 36px; }
.col-zh { min-width: 70px; }
.col-trad { min-width: 70px; }
.col-py { min-width: 100px; }
.col-vn { min-width: 120px; }
.col-en { min-width: 120px; }
.col-pos { min-width: 60px; }
.col-tag { min-width: 90px; }

/* Tags */
.umr-tag {
  display: inline-block; padding: 2px 8px; border-radius: 5px;
  font-size: 0.68rem; font-weight: 700;
}
.umr-tag-exists { background: #e8f4fd; color: #1a5276; }
.umr-tag-new { background: #fef9e7; color: #7d6608; }
.umr-tag-ai { background: #f4ecf7; color: #6c3483; }

.umr-footer {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 12px;
}
.umr-sel-count { font-size: 0.85rem; color: var(--text-muted); font-weight: 600; }
.um-btn-confirm {
  background: #27ae60; color: #fff;
  border: none; border-radius: 10px; padding: 12px 24px;
  font-size: 0.95rem; font-weight: 700; cursor: pointer;
  font-family: var(--font); transition: background var(--transition);
}
.um-btn-confirm:hover { background: #1e8449; }

/* Modal wider for upload */
.modal-content.modal-wide { max-width: 780px; }

/* Study screens fill the viewport, including on mobile. */
.modal-study .modal-overlay { pointer-events: none; }
.modal-content.modal-fullscreen {
  position: fixed; inset: 0;
  width: 100%; height: 100%;
  max-width: none; max-height: none;
  border-radius: 0; box-shadow: none;
  display: flex; flex-direction: column;
  overscroll-behavior: contain;
}
.modal-content.modal-fullscreen #modal-body {
  flex: 1; display: flex; flex-direction: column;
}
.modal-content.modal-fullscreen #modal-body > * {
  flex: 1; width: 100%;
}
.modal-content.modal-fullscreen .study-modal,
.modal-content.modal-fullscreen .flashcard-modal {
  padding: clamp(16px, 3vw, 40px);
  padding-bottom: max(16px, env(safe-area-inset-bottom));
}
.modal-content.modal-fullscreen .flashcard-modal {
  display: flex; flex-direction: column;
}
.modal-content.modal-fullscreen .flashcard {
  flex: 1; min-height: 280px;
  display: flex; flex-direction: column;
}
.modal-content.modal-fullscreen .fc-front,
.modal-content.modal-fullscreen .fc-back {
  flex: 1; min-height: 280px;
}
.modal-content.modal-fullscreen .fc-hanzi { font-size: 3.25rem; }
.modal-content.modal-fullscreen .fc-hanzi-sm { font-size: 2rem; }
@media (max-width: 780px) {
  .modal-content.modal-fullscreen .fc-hanzi { font-size: 2.75rem; }
  .modal-content.modal-fullscreen .fc-hanzi-sm { font-size: 1.75rem; }
}

/* ── STUDY MODE (Flashcard / Typing / Quiz) ── */
.study-modal { padding: 24px; }
.study-modal-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  margin-bottom: 18px; gap: 12px;
}
.study-modal-name { font-size: 1.1rem; font-weight: 800; color: var(--text); font-family: var(--font-zh); }
.study-modal-sub { font-size: 0.8rem; color: var(--text-muted); margin-top: 4px; }
.study-mode-cards { display: flex; flex-direction: column; gap: 12px; }
.study-mode-card {
  display: flex; align-items: center; gap: 14px;
  background: var(--bg); border: 1.5px solid var(--border); border-radius: 14px;
  padding: 16px 18px; text-align: left; cursor: pointer;
  font-family: var(--font); transition: var(--transition);
}
.study-mode-card:hover { border-color: #8e44ad; background: #f6effa; transform: translateY(-2px); }
[data-theme="dark"] .study-mode-card:hover { background: #2a1f33; }
.study-mode-icon { font-size: 1.8rem; flex-shrink: 0; }
.study-mode-title { font-size: 0.98rem; font-weight: 700; color: var(--text); margin-bottom: 2px; }
.study-mode-desc { font-size: 0.8rem; color: var(--text-muted); line-height: 1.4; }
.study-back-row { margin-top: 16px; display: flex; justify-content: center; }
.lesson-listening-controls { display: flex; flex-wrap: wrap; gap: 10px; margin: 12px 0; }
.ll-lesson-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.ll-lesson-head { flex-wrap: wrap; }
.lesson-listening-reveal { margin: 18px 0; padding: 16px; border: 1px solid var(--border); border-radius: 12px; background: var(--bg); }
.lesson-listening .ptv2-opt:disabled { cursor: default; }
.lesson-listening .ptv2-q-sentence { overflow-wrap: anywhere; }
.lesson-listening .ptv2-ri-content p { overflow-wrap: anywhere; }

.study-fcm-header { justify-content: space-between; }
.study-fcm-info { display: flex; align-items: center; gap: 10px; font-size: 0.88rem; }
.fcm-back {
  background: var(--bg); border: 1px solid var(--border); border-radius: 8px;
  padding: 5px 12px; font-size: 0.8rem; font-weight: 600; color: var(--text-muted);
  cursor: pointer; font-family: var(--font); transition: var(--transition);
}
.fcm-back:hover { border-color: #8e44ad; color: #8e44ad; }

/* Flashcard example sentence (back of card) */
.fc-example {
  margin-top: 10px; padding: 12px 14px; border-radius: 10px;
  background: rgba(142,68,173,0.06); border: 1px solid rgba(142,68,173,0.18);
  width: 100%; text-align: center;
}
.fc-ex-zh { font-family: var(--font-zh); font-size: 1rem; color: var(--text); margin-bottom: 4px; line-height: 1.5; }
.fc-ex-vn { font-size: 0.85rem; color: var(--text-muted); }
.fc-note-zh { font-family: var(--font-zh); font-size: 0.85rem; color: #8e44ad; margin-top: 6px; line-height: 1.5; }
[data-theme="dark"] .fc-example { background: rgba(142,68,173,0.12); border-color: rgba(142,68,173,0.3); }

/* Typing practice */
.typing-prompt-box {
  text-align: center; padding: 20px; margin: 12px 0;
  background: var(--bg); border-radius: 14px; border: 1.5px solid var(--border);
}
.typing-prompt-label { font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 8px; }
.typing-prompt { font-size: 1.4rem; font-weight: 700; color: var(--text); }
.typing-input {
  width: 100%; box-sizing: border-box; font-family: var(--font-zh);
  font-size: 1.6rem; text-align: center; padding: 12px;
  border: 2px solid var(--border); border-radius: 12px;
  background: var(--card); color: var(--text); margin-bottom: 12px;
  transition: border-color 0.15s;
}
.typing-input:focus { outline: none; border-color: #8e44ad; }
.typing-input:disabled { opacity: 0.7; }
.typing-feedback {
  text-align: center; font-weight: 800; font-size: 1.05rem;
  padding: 10px; border-radius: 10px; margin-bottom: 10px;
}
.typing-feedback-correct { background: #eafaf1; color: #1a7941; }
.typing-feedback-wrong { background: #fdecea; color: #922b21; }
[data-theme="dark"] .typing-feedback-correct { background: #1a2e1a; color: #6fcf97; }
[data-theme="dark"] .typing-feedback-wrong { background: #2e1a1a; color: #f1948a; }
.typing-reveal {
  text-align: center; padding: 14px; border-radius: 10px;
  background: var(--bg); border: 1px solid var(--border); margin-bottom: 12px;
}
.typing-reveal-hanzi { font-family: var(--font-zh); font-size: 1.6rem; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.typing-reveal-pinyin { font-size: 0.95rem; color: var(--primary); font-weight: 700; margin-bottom: 4px; }
.typing-reveal-vn { font-size: 0.88rem; color: var(--text-muted); }
.typing-actions { display: flex; justify-content: center; }
.typing-actions .btn-primary { width: 100%; }
.typing-progress { font-size: 0.85rem; font-weight: 700; color: var(--text-muted); }

/* Compact learning content inside the fullscreen study surface. */
.modal-content.modal-fullscreen #modal-body > .flashcard-modal,
.modal-content.modal-fullscreen #modal-body > .typing-modal {
  flex: 0 0 auto; max-width: 820px;
  margin: auto; padding: 24px;
  padding-bottom: max(24px, env(safe-area-inset-bottom));
}
.modal-content.modal-fullscreen #modal-body > .typing-modal { max-width: 720px; }
.modal-content.modal-fullscreen .flashcard {
  flex: 0 0 auto; min-height: 0; margin-bottom: 16px;
}
.modal-content.modal-fullscreen .fc-front,
.modal-content.modal-fullscreen .fc-back {
  min-height: clamp(220px, 36vh, 320px); padding: 20px;
}
.modal-content.modal-fullscreen .fc-hint { font-size: 0.72rem; margin-bottom: 10px; }
.modal-content.modal-fullscreen .fc-trad { font-size: 1rem; }
.modal-content.modal-fullscreen .fc-speak-standalone {
  width: 36px; height: 36px; font-size: 1rem; margin-top: 10px;
}
.modal-content.modal-fullscreen .fcm-actions { justify-content: center; }
.modal-content.modal-fullscreen .fc-btn {
  flex: 1; max-width: 180px; padding: 8px 12px;
  min-height: 40px; font-size: 0.82rem;
}
.modal-content.modal-fullscreen .typing-prompt-box { padding: 14px; margin: 10px 0; }
.modal-content.modal-fullscreen .typing-prompt { font-size: 1.2rem; }
.modal-content.modal-fullscreen .typing-input { font-size: 1.35rem; padding: 10px; }
.modal-content.modal-fullscreen .typing-feedback { font-size: 0.9rem; padding: 8px; }
.modal-content.modal-fullscreen .typing-reveal { padding: 10px; }
.modal-content.modal-fullscreen .typing-reveal-hanzi { font-size: 1.35rem; }
.modal-content.modal-fullscreen .typing-actions .btn-primary {
  width: auto; min-width: 160px; min-height: 40px;
  padding: 8px 24px; font-size: 0.85rem;
}
@media (max-width: 600px) {
  .modal-content.modal-fullscreen #modal-body > .flashcard-modal,
  .modal-content.modal-fullscreen #modal-body > .typing-modal { padding: 16px; padding-bottom: max(16px, env(safe-area-inset-bottom)); }
  .modal-content.modal-fullscreen .fc-btn { padding: 8px; min-height: 44px; }
  .modal-content.modal-fullscreen .typing-actions .btn-primary { min-height: 44px; }
}

/* Lesson quiz (reuses .ptv2-* test styles inside the modal) */
.lesson-quiz .ptv2-q-header { border-radius: 14px 14px 0 0; }
.lesson-quiz .ptv2-q-body { border-radius: 0 0 14px 14px; margin-bottom: 0; }
[data-theme="dark"] .lesson-quiz .ptv2-question { color: var(--text); }
.ptv2-q-sentence {
  font-family: var(--font-zh); font-size: 1.1rem; line-height: 1.8;
  background: var(--bg); border: 1px solid var(--border); border-radius: 10px;
  padding: 14px; margin: -10px 0 20px; color: var(--text);
}
.ptv2-q-sentence strong { color: #8e44ad; }

/* ── BOTTOM TAB BAR ── */
#bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 100;
  background: #fff; border-top: 1px solid #e8e8e8;
  display: flex; justify-content: space-around; align-items: center;
  height: 62px; padding: 0 4px;
  box-shadow: 0 -2px 12px rgba(0,0,0,0.07);
}
.bn-tab {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 3px; padding: 6px 4px;
  background: none; border: none; cursor: pointer;
  font-family: var(--font); transition: opacity 0.15s;
}
.bn-icon { font-size: 1.25rem; line-height: 1; }
.bn-label { font-size: 0.65rem; font-weight: 600; color: #aaa; }
.bn-tab.bn-active .bn-label { color: #1a1a2e; }
.bn-tab.bn-active .bn-icon { filter: none; }

/* ── SRS HOME DASHBOARD ── */
.page-home-srs { max-width: 1200px; margin: 0 auto; }

/* Filter tabs */
.srs-tabs {
  display: flex; align-items: center; gap: 6px;
  background: #fff; border-radius: 14px;
  padding: 8px 12px; margin-bottom: 16px;
  box-shadow: 0 1px 6px rgba(0,0,0,0.06); border: 1px solid #ebebeb;
  flex-wrap: wrap;
}
.srs-tab {
  background: #f2f2f5; border: none; border-radius: 20px;
  padding: 7px 16px; font-size: 0.83rem; font-weight: 600;
  color: #666; cursor: pointer; font-family: var(--font);
  transition: all 0.15s; display: flex; align-items: center; gap: 6px;
}
.srs-tab:hover { background: #e5e5e9; color: #333; }
.srs-tab-active { background: #1a1a2e !important; color: #fff !important; }
.srs-tab-cnt {
  background: rgba(255,255,255,0.25); border-radius: 10px;
  padding: 1px 7px; font-size: 0.72rem;
}
.srs-tab-active .srs-tab-cnt { background: rgba(255,255,255,0.2); }
.srs-tab-new.srs-tab-active { background: #2ecc71 !important; }
.srs-tab-learning.srs-tab-active { background: #e67e22 !important; }
.srs-tab-due.srs-tab-active { background: #e74c3c !important; }
.srs-tabs-right { margin-left: auto; display: flex; gap: 6px; }
.srs-icon-btn {
  background: #f2f2f5; border: none; border-radius: 10px;
  padding: 7px 12px; font-size: 1rem; cursor: pointer;
  transition: background 0.15s;
}
.srs-icon-btn:hover { background: #e0e0e5; }

/* Layout */
.srs-layout {
  display: grid; grid-template-columns: 1fr 380px; gap: 20px; align-items: start;
}

/* ── SRS CARD ── */
.srs-card-col { display: flex; flex-direction: column; }
.srs-card-wrap { display: flex; flex-direction: column; gap: 14px; }

.srs-nav-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
}
.srs-nav-arrow {
  background: #fff; border: 1.5px solid #e0e0e0;
  border-radius: 50%; width: 40px; height: 40px;
  font-size: 1.3rem; cursor: pointer; color: #555;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s; flex-shrink: 0;
}
.srs-nav-arrow:hover:not(:disabled) { background: #1a1a2e; color: #fff; border-color: #1a1a2e; }
.srs-nav-arrow:disabled { opacity: 0.3; cursor: default; }
.srs-nav-info { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.srs-nav-count { font-size: 0.78rem; color: #aaa; font-weight: 600; }
.srs-state-tag {
  padding: 3px 12px; border-radius: 12px;
  font-size: 0.72rem; font-weight: 700;
}
.srs-state-new { background: #d5f5e3; color: #1e8449; }
.srs-state-learning { background: #fdebd0; color: #ca6f1e; }
.srs-state-due { background: #fdecea; color: #c0392b; }
.srs-state-learned { background: #eaf2ff; color: #2471a3; }

.srs-card {
  background: #fff; border-radius: 20px;
  padding: 32px 28px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.1);
  text-align: center; min-height: 280px;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  border: 1px solid #f0f0f0;
  position: relative;
}
.srs-card-top {
  position: absolute; top: 16px; left: 16px; right: 16px;
  display: flex; align-items: center; justify-content: space-between;
}
.srs-card-badge {
  color: #fff; font-size: 0.68rem; font-weight: 800;
  padding: 3px 10px; border-radius: 8px; letter-spacing: 0.5px;
}
.srs-card-lesson { font-size: 0.72rem; color: #bbb; }
.srs-card-star {
  background: none; border: none; cursor: pointer;
  font-size: 1.1rem; color: #ddd; transition: color 0.15s;
}
.srs-card-star.starred { color: #f1c40f; }
.srs-card-star:hover { color: #f39c12; }

.srs-hanzi {
  font-family: var(--font-zh); font-size: clamp(3rem, 8vw, 5rem);
  font-weight: 700; color: #1a1a2e; line-height: 1; margin-top: 20px;
}
.srs-trad { font-family: var(--font-zh); font-size: 1rem; color: #bbb; }
.srs-pinyin { font-size: 1.2rem; color: var(--primary); font-weight: 700; }
.srs-front-hint { font-size: 0.78rem; color: #ccc; margin-top: 8px; }
.srs-answer {
  border-top: 1px dashed #eee; padding-top: 16px; width: 100%;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
}
.srs-vn { font-size: 1.2rem; font-weight: 700; color: #1a1a2e; }
.srs-en { font-size: 0.88rem; color: #888; }
.srs-pos { background: #f2f2f5; border-radius: 6px; padding: 2px 10px; font-size: 0.72rem; color: #666; font-weight: 700; }

.srs-show-btn {
  width: 100%; background: #1a1a2e; color: #fff;
  border: none; border-radius: 14px; padding: 14px;
  font-size: 1rem; font-weight: 700; cursor: pointer;
  font-family: var(--font); transition: background 0.18s;
}
.srs-show-btn:hover { background: #2c2c4e; }

.srs-rating-row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
.srs-rate {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 12px 8px; border-radius: 14px; border: none;
  cursor: pointer; font-family: var(--font); font-weight: 700;
  font-size: 0.85rem; transition: transform 0.15s, box-shadow 0.15s;
}
.srs-rate:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.15); }
.srs-rate-emoji { font-size: 1.4rem; }
.srs-hard { background: #fdecea; color: #c0392b; }
.srs-good { background: #eafaf1; color: #1a7941; }
.srs-easy { background: #eaf2ff; color: #1a5276; }

.srs-empty {
  background: #fff; border-radius: 20px; padding: 48px 28px;
  text-align: center; box-shadow: 0 2px 12px rgba(0,0,0,0.07);
  border: 1px solid #f0f0f0;
}
.srs-empty-zh { font-family: var(--font-zh); font-size: 4rem; color: #e0e0e0; margin-bottom: 12px; }
.srs-empty p { color: var(--text-muted); margin-bottom: 16px; }

/* ── RIGHT STATS ── */
.srs-stats-col { display: flex; flex-direction: column; gap: 14px; }
.srs-stat-card {
  background: #fff; border-radius: 16px; padding: 18px;
  box-shadow: 0 1px 8px rgba(0,0,0,0.06); border: 1px solid #ebebeb;
}
.srs-stat-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.srs-stat-title { font-size: 0.88rem; font-weight: 700; color: #333; }
.srs-stat-badge { font-size: 0.75rem; color: #888; background: #f2f2f5; padding: 3px 10px; border-radius: 10px; }

/* Progress Map */
.srs-map { display: flex; align-items: center; padding: 8px 0; gap: 0; }
.srs-map-node { display: flex; flex-direction: column; align-items: center; gap: 4px; flex-shrink: 0; }
.srs-map-dot {
  width: 36px; height: 36px; border-radius: 50%;
  background: #e0e0e0; color: #999;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.65rem; font-weight: 800; transition: all 0.3s;
  border: 2px solid transparent;
}
.srs-map-dot.done { background: var(--lc,#27ae60); color: #fff; border-color: transparent; }
.srs-map-dot.current {
  background: var(--lc,#1a1a2e); color: #fff;
  box-shadow: 0 0 0 4px rgba(26,26,46,0.15);
  transform: scale(1.15);
}
.srs-map-label { font-size: 0.62rem; font-weight: 700; color: #999; }
.srs-map-pct { font-size: 0.58rem; color: #bbb; }
.srs-map-line { flex: 1; height: 3px; background: #e8e8e8; border-radius: 2px; margin: 0 2px; align-self: center; margin-bottom: 22px; }

/* SRS Chart */
.srs-chart { display: flex; align-items: flex-end; gap: 8px; height: 90px; }
.srs-bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; height: 100%; }
.srs-bar-num { font-size: 0.65rem; font-weight: 700; color: #888; min-height: 14px; }
.srs-bar-track { flex: 1; width: 100%; background: #f2f2f5; border-radius: 6px 6px 0 0; display: flex; align-items: flex-end; overflow: hidden; }
.srs-bar-fill { width: 100%; background: linear-gradient(180deg,#3498db,#2980b9); border-radius: 6px 6px 0 0; min-height: 4px; transition: height 0.5s ease; }
.srs-bar-label { font-size: 0.55rem; color: #bbb; text-align: center; white-space: nowrap; }

/* Quick stats */
.srs-quick-stats {
  display: flex; gap: 0; background: #fff;
  border-radius: 14px; overflow: hidden;
  border: 1px solid #ebebeb; box-shadow: 0 1px 6px rgba(0,0,0,0.05);
}
.sqs-item { flex: 1; text-align: center; padding: 12px 8px; border-right: 1px solid #f0f0f0; }
.sqs-item:last-child { border-right: none; }
.sqs-num { display: block; font-size: 1.2rem; font-weight: 800; color: #1a1a2e; }
.sqs-lab { display: block; font-size: 0.65rem; color: #aaa; font-weight: 600; text-transform: uppercase; }

@media (max-width: 900px) {
  .srs-layout { grid-template-columns: 1fr; }
  .srs-stats-col { flex-direction: row; flex-wrap: wrap; }
  .srs-stat-card { flex: 1; min-width: 240px; }
}
@media (max-width: 600px) {
  .srs-stats-col { flex-direction: column; }
  .srs-stat-card { min-width: unset; }
  .srs-hanzi { font-size: 3.5rem; }
}

/* ── LIBRARY PAGE ── */
.page-library { max-width: 1100px; margin: 0 auto; }
.lib-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  flex-wrap: wrap; gap: 14px; margin-bottom: 20px;
  padding-bottom: 18px; border-bottom: 2px solid var(--border);
}
.lib-header h1 { font-size: 1.6rem; font-weight: 800; margin-bottom: 4px; }
.lib-header p { color: var(--text-muted); font-size: 0.88rem; }
.lib-add-btn { background: #1a1a2e; border-color: #1a1a2e; white-space: nowrap; }
.lib-add-btn:hover { background: #2c2c4e; }

.lib-controls {
  display: flex; gap: 10px; margin-bottom: 20px; flex-wrap: wrap;
}
.lib-search-wrap {
  flex: 1; min-width: 200px; display: flex; align-items: center; gap: 8px;
  background: #fff; border: 1.5px solid var(--border); border-radius: 10px;
  padding: 8px 14px;
}
.lib-search { flex: 1; border: none; outline: none; font-family: var(--font); font-size: 0.9rem; background: transparent; color: var(--text); }
.lib-sel { min-width: 140px; }

/* Empty */
.lib-empty { text-align: center; padding: 60px 20px; }
.lib-empty-icon { font-size: 3.5rem; margin-bottom: 16px; }
.lib-empty h2 { font-size: 1.2rem; font-weight: 800; margin-bottom: 8px; color: var(--text); }
.lib-empty p { color: var(--text-muted); line-height: 1.6; }

/* Material cards */
.lib-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px,1fr)); gap: 16px; }
.lib-card {
  background: #fff; border-radius: 16px; padding: 18px;
  border: 1px solid var(--border); box-shadow: 0 1px 8px rgba(0,0,0,0.06);
  display: flex; flex-direction: column; gap: 10px;
  transition: transform 0.15s, box-shadow 0.15s;
}
.lib-card:hover { transform: translateY(-3px); box-shadow: 0 6px 20px rgba(0,0,0,0.1); }
.lib-card-top { display: flex; align-items: flex-start; gap: 10px; }
.lib-card-type-icon {
  width: 44px; height: 44px; border-radius: 12px; font-size: 1.4rem;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.lib-card-badges { flex: 1; display: flex; gap: 6px; flex-wrap: wrap; }
.lib-badge-level { font-size: 0.65rem; font-weight: 800; color: #fff; padding: 2px 8px; border-radius: 6px; }
.lib-badge-cat { font-size: 0.65rem; font-weight: 700; color: #555; background: #f2f2f5; padding: 2px 8px; border-radius: 6px; }
.lib-card-actions { display: flex; gap: 4px; flex-shrink: 0; }

.lib-card-body { flex: 1; }
.lib-card-title { font-size: 0.95rem; font-weight: 800; color: var(--text); margin-bottom: 5px; line-height: 1.3; }
.lib-card-desc { font-size: 0.78rem; color: var(--text-muted); line-height: 1.5; margin-bottom: 8px; }
.lib-card-meta { display: flex; gap: 10px; flex-wrap: wrap; font-size: 0.7rem; color: #bbb; }
.lib-card-type-tag { font-weight: 700; }

.lib-download-btn {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  color: #fff; border-radius: 10px; padding: 11px 16px;
  text-decoration: none; font-weight: 700; font-size: 0.9rem;
  transition: opacity 0.18s; text-align: center;
}
.lib-download-btn:hover { opacity: 0.88; }
.lib-dl-count { font-size: 0.7rem; color: #bbb; text-align: center; }

.feature-card-library { border-top: 3px solid #1a1a2e; }
.lib-modal { }

[data-theme="dark"] .lib-card, [data-theme="dark"] .lib-search-wrap { background: var(--card); border-color: var(--border); }
[data-theme="dark"] .lib-search { color: var(--text); }
[data-theme="dark"] .lib-badge-cat { background: #2a2a44; color: var(--text-muted); }

/* ── DOWNLOAD MODAL ── */
.dl-modal { padding: 4px 2px; }
.dl-sub { font-size: 0.84rem; color: var(--text-muted); margin-bottom: 18px; line-height: 1.5; }
.dl-section { margin-bottom: 18px; }
.dl-level-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(180px,1fr));
  gap: 8px; margin-top: 8px;
}
.dl-level-opt {
  display: flex; align-items: center; gap: 8px;
  background: #f5f5f7; border: 1.5px solid #e8e8e8; border-radius: 10px;
  padding: 8px 12px; cursor: pointer; font-size: 0.82rem;
  transition: border-color 0.15s;
}
.dl-level-opt:hover { border-color: var(--primary); }
.dl-level-opt input[type="radio"] { accent-color: var(--primary); flex-shrink: 0; }
.dl-level-badge { font-size: 0.65rem; font-weight: 800; color: #fff; padding: 2px 7px; border-radius: 6px; flex-shrink: 0; }

.dl-format-row { display: flex; gap: 10px; margin-top: 8px; flex-wrap: wrap; }
.dl-format-opt { flex: 1; min-width: 130px; cursor: pointer; }
.dl-format-opt input { display: none; }
.dl-format-card {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  background: #f5f5f7; border: 2px solid #e8e8e8;
  border-radius: 12px; padding: 14px 10px; text-align: center;
  transition: all 0.15s;
}
.dl-format-opt input:checked + .dl-format-card { border-color: var(--primary); background: #fdf5f5; }
.dl-format-card:hover { border-color: #bbb; }
.dl-format-icon { font-size: 1.6rem; margin-bottom: 2px; }
.dl-format-card strong { font-size: 0.82rem; color: var(--text); }
.dl-format-card span { font-size: 0.7rem; color: var(--text-muted); line-height: 1.3; }

.dl-cols-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.dl-col-opt {
  display: flex; align-items: center; gap: 6px;
  background: #f5f5f7; border: 1.5px solid #e8e8e8; border-radius: 20px;
  padding: 5px 12px; font-size: 0.78rem; cursor: pointer;
  transition: border-color 0.15s;
}
.dl-col-opt:hover { border-color: var(--primary); }
.dl-col-opt input { accent-color: var(--primary); }

.dl-download-btn { gap: 6px; }
.feature-card-download { border-top: 3px solid #16a085; }
.fc-download-hint { margin-top: 8px; font-size: 0.72rem; color: #16a085; font-weight: 600; }

[data-theme="dark"] .dl-level-opt,
[data-theme="dark"] .dl-format-card,
[data-theme="dark"] .dl-col-opt { background: var(--input-bg); border-color: var(--border); color: var(--text); }

/* ── VIDEO PAGE v2 ── */
.page-video2 { max-width: 1400px; margin: 0 auto; }
.vp2-url-bar { display:flex; gap:10px; align-items:center; background:#fff; border-radius:14px; padding:10px 14px; margin-bottom:14px; border:1.5px solid var(--border); box-shadow:0 1px 8px rgba(0,0,0,.06); }
.vp2-url-inner { flex:1; display:flex; align-items:center; gap:8px; background:#f5f5f7; border-radius:10px; padding:6px 14px; }
.vp2-url-input { flex:1; border:none; background:transparent; font-family:var(--font); font-size:.9rem; color:var(--text); outline:none; }
.vp2-url-input::placeholder { color:#bbb; }
.vp2-clear { background:none; border:none; cursor:pointer; color:#bbb; font-size:.9rem; }
.vp2-main { display:grid; grid-template-columns:1fr 380px; gap:16px; align-items:start; }
.vp2-left { display:flex; flex-direction:column; gap:12px; }

/* Player */
.vp2-player-outer { position:relative; }
.vp-flashcard-overlay {
  position:absolute; left:50%; bottom:14px; transform:translateX(-50%);
  background:rgba(255,255,255,.97); border-radius:12px; padding:8px 20px; text-align:center;
  box-shadow:0 4px 18px rgba(0,0,0,.35); z-index:5; pointer-events:none; min-width:140px;
  animation:vpFcIn .2s ease;
}
.vp-flashcard-overlay.hidden { display:none; }
.vp-fc-zh { font-family:var(--font-zh); font-size:1.3rem; font-weight:800; color:#1a1a2e; line-height:1.2; }
.vp-fc-py { font-size:.8rem; color:#c0392b; font-weight:700; margin-top:2px; }
.vp-fc-vn { font-size:.78rem; color:#555; margin-top:2px; }
@keyframes vpFcIn { from { opacity:0; transform:translateX(-50%) translateY(8px); } to { opacity:1; transform:translateX(-50%) translateY(0); } }
[data-theme="dark"] .vp-flashcard-overlay { background:rgba(30,30,46,.97); }
[data-theme="dark"] .vp-fc-zh { color:#f0f0f5; }
[data-theme="dark"] .vp-fc-vn { color:#bbb; }

.vp2-player-wrap { position:relative; padding-bottom:56.25%; height:0; overflow:hidden; border-radius:16px; background:#111; box-shadow:0 4px 20px rgba(0,0,0,.25); }
.vp2-player-wrap iframe, .vp2-player-wrap #vp-yt { position:absolute; top:0; left:0; width:100%; height:100%; border:none; }
.vp-loading-ind { position:absolute; top:50%; left:50%; transform:translate(-50%,-50%); color:#aaa; font-size:.9rem; z-index:2; }
.vp-loading-ind.hidden { display:none; }
.vp-fallback-box { position:relative; width:100%; height:100%; display:flex; align-items:center; justify-content:center; }
.vp-fallback-content { position:absolute; text-align:center; display:flex; flex-direction:column; align-items:center; gap:12px; color:#fff; }
.vp-fallback-btn { background:var(--primary); color:#fff; border-radius:10px; padding:10px 22px; text-decoration:none; font-weight:700; }

.vp2-alt-btn { background:#2c3e50 !important; color:#f0e68c !important; border-color:#f0e68c !important; font-weight:600; }
.vp2-alt-btn:hover { background:#f0e68c !important; color:#1a1a2e !important; }

/* Video embed blocked — thumbnail + YouTube play button, click to watch */
.vp-popup-fallback {
  position:absolute; inset:0; cursor:pointer;
  border-radius:16px; overflow:hidden;
}
.vp-popup-thumb {
  position:absolute; inset:0; width:100%; height:100%;
  object-fit:cover; filter:brightness(0.75);
  transition:filter .2s;
}
.vp-popup-fallback:hover .vp-popup-thumb { filter:brightness(0.55); }
.vp-play-overlay {
  position:absolute; inset:0;
  display:flex; align-items:center; justify-content:center;
}
.vp-play-yt-btn { filter:drop-shadow(0 2px 8px rgba(0,0,0,.5)); transition:transform .15s; }
.vp-popup-fallback:hover .vp-play-yt-btn { transform:scale(1.12); }
.vp2-direct-link { font-size:.75rem; text-align:center; }
.vp2-direct-link a { color:var(--primary); text-decoration:none; font-weight:600; }

/* Subtitle loader */
.vp2-sub-loader { background:#fff; border-radius:12px; padding:14px 16px; border:1px solid var(--border); }
.vp2-sub-loader-title { font-size:.82rem; font-weight:700; color:var(--text-muted); margin-bottom:10px; }
.vp2-sub-methods { display:flex; gap:8px; flex-wrap:wrap; align-items:center; }
.vp2-method-btn { background:#f5f5f7; border:1.5px solid var(--border); border-radius:8px; padding:6px 14px; font-size:.8rem; font-weight:600; cursor:pointer; font-family:var(--font); color:var(--text); transition:all .15s; }
.vp2-method-btn:hover { border-color:#1a1a2e; background:#eee; }
.vp2-sub-loaded { font-size:.78rem; color:#27ae60; font-weight:700; }
.vp2-paste-ta { width:100%; border:1.5px solid var(--border); border-radius:8px; padding:10px 12px; font-family:var(--font); font-size:.85rem; color:var(--text); background:transparent; outline:none; resize:vertical; min-height:120px; margin-top:8px; }
.vp2-paste-ta:focus { border-color:var(--primary); }

/* Subtitle panel */
.vp2-right { background:#fff; border-radius:16px; border:1px solid var(--border); box-shadow:0 2px 12px rgba(0,0,0,.06); display:flex; flex-direction:column; max-height:80vh; min-height:400px; overflow:hidden; }
.vp2-sub-header { padding:12px 14px 8px; border-bottom:1px solid var(--border); display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:8px; }
.vp2-sub-title { font-size:.88rem; font-weight:700; }
.vp2-hsk-legend { display:flex; gap:4px; flex-wrap:wrap; }
.hsk-badge { font-size:.62rem; font-weight:700; padding:2px 7px; border-radius:10px; }
.hsk-badge-sm { font-size:.6rem; padding:1px 5px; border-radius:5px; font-weight:700; }

/* New subtitle panel header (sync + HSK/TOCFL toggle + download) */
.vp2-sub-header-new { padding:12px 14px 0; display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:8px; }
.vp2-sub-title-row { display:flex; align-items:center; gap:7px; }
.vp2-sub-live-dot { width:8px; height:8px; border-radius:50%; background:#27ae60; box-shadow:0 0 0 3px rgba(39,174,96,.2); flex-shrink:0; }
.vp2-sub-hint { font-size:.68rem; color:var(--text-muted); }
.vp2-sub-header-actions { display:flex; align-items:center; gap:8px; }
.vp2-mode-tabs { display:flex; gap:2px; background:#f2f2f5; border-radius:8px; padding:2px; }
.vp2-mode-tab { border:none; background:transparent; padding:4px 12px; border-radius:6px; font-size:.72rem; font-weight:700; cursor:pointer; color:var(--text-muted); font-family:var(--font); }
.vp2-mode-tab.active { background:#c0392b; color:#fff; }
.vp2-dl-btn { border:1.5px solid var(--border); background:transparent; border-radius:8px; padding:4px 12px; font-size:.72rem; font-weight:700; cursor:pointer; color:var(--text-muted); font-family:var(--font); }
.vp2-dl-btn:hover { border-color:var(--primary); color:var(--primary); }
.vp2-sync-row { display:flex; align-items:center; gap:6px; padding:8px 14px; border-bottom:1px solid var(--border); flex-wrap:wrap; }
.vp2-sync-label { font-size:.7rem; color:var(--text-muted); font-weight:600; margin-right:2px; }
.vp2-sync-btn { border:1.5px solid var(--border); background:transparent; border-radius:6px; padding:3px 8px; font-size:.68rem; font-weight:700; cursor:pointer; color:var(--text); font-family:var(--font); }
.vp2-sync-btn:hover { border-color:var(--primary); color:var(--primary); }
.vp2-sync-reset { font-size:.8rem; padding:3px 7px; }
.vp2-sync-val { font-size:.7rem; font-weight:700; color:#c0392b; margin-left:2px; }

.vp2-sub-list { flex:1; overflow-y:auto; padding:6px; }
.sub-line { border-radius:10px; padding:10px 12px; margin-bottom:6px; cursor:pointer; border:1.5px solid transparent; transition:all .15s; }
.sub-line:hover { background:#f8f9fa; border-color:#e0e0e0; }
.sub-line.sub-active { background:#c0392b; border-color:#c0392b; box-shadow:0 2px 10px rgba(192,57,43,.3); }
.sub-line-top { display:flex; align-items:center; gap:6px; margin-bottom:6px; }
.sub-time { font-size:.68rem; font-family:monospace; background:#f2f2f5; padding:2px 6px; border-radius:4px; color:#888; }
.sub-line.sub-active .sub-time { background:rgba(255,255,255,.2); color:#fff; }
.sub-chinese { font-family:var(--font-zh); font-size:1.1rem; font-weight:600; line-height:1.4; margin-bottom:4px; }
.sub-line.sub-active .sub-chinese { font-size:1.2rem; color:#fff; }
.sub-pinyin { font-size:.78rem; color:var(--primary); font-weight:600; margin-bottom:2px; }
.sub-line.sub-active .sub-pinyin { color:#ffd1cc; }
.sub-vn { font-size:.82rem; color:var(--text-muted); margin-bottom:4px; }
.sub-line.sub-active .sub-vn { color:#fff; }
.sub-hsk-words { font-size:.65rem; color:#aaa; border-top:1px solid #f0f0f0; padding-top:4px; margin-top:4px; line-height:1.6; }
.sub-line.sub-active .sub-hsk-words { opacity:1; border-top-color:rgba(255,255,255,.25); }
.sub-line.sub-active .sub-hsk-words span { color:#ffe8e6 !important; }
.vp2-sub-empty { flex:1; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:10px; color:var(--text-muted); text-align:center; padding:20px; }
.vp2-sub-empty div { font-size:2rem; }

/* Welcome */
.vp2-welcome { text-align:center; padding:60px 20px; }
.vp2-welcome-icon { font-size:3.5rem; margin-bottom:16px; }
.vp2-welcome h2 { font-size:1.4rem; font-weight:800; margin-bottom:8px; }
.vp2-welcome p { color:var(--text-muted); max-width:480px; margin:0 auto 20px; line-height:1.6; }
.feature-card-video2 { border-top:3px solid #e74c3c; }
.hsk-word { display:inline; }

/* ── Workflow Pipeline Bar ── */
#vp2-pipeline-wrap { display:none; }
.vp2-pipeline-bar { display:flex; align-items:center; gap:5px; margin-bottom:14px; padding:10px 14px; background:var(--card); border-radius:14px; border:1px solid var(--border); overflow-x:auto; scrollbar-width:none; }
.vp2-pipeline-bar::-webkit-scrollbar { display:none; }
.vp2-step-box { display:flex; flex-direction:column; align-items:center; justify-content:center; min-width:86px; padding:10px 8px 8px; border-radius:10px; background:#111827; border:1.5px solid #1f2937; gap:5px; position:relative; transition:all .2s; flex-shrink:0; }
.vp2-step-icon { font-size:1.05rem; line-height:1; font-weight:800; color:#6b7280; font-family:var(--font); }
.vp2-step-label { font-size:.65rem; font-weight:700; color:#6b7280; text-align:center; white-space:nowrap; }
.vp2-step-arrow { color:#374151; font-size:.8rem; flex-shrink:0; font-weight:700; }
.vp2-step-check { position:absolute; top:4px; right:5px; font-size:.55rem; color:#4ade80; font-weight:900; }
.vp2-step-box.vp2-step-done { border-color:#166534; background:#052e16; }
.vp2-step-box.vp2-step-done .vp2-step-icon,
.vp2-step-box.vp2-step-done .vp2-step-label { color:#4ade80; }
.vp2-step-box.vp2-step-active { border-color:#c0392b; background:#2d0a0a; }
.vp2-step-box.vp2-step-active .vp2-step-icon,
.vp2-step-box.vp2-step-active .vp2-step-label { color:#fb7185; }
.vp2-step-box.vp2-step-click { cursor:pointer; }
.vp2-step-box.vp2-step-click:hover { border-color:#4b5563; background:#1f2937; }

/* Step Panel (below video) */
.vp2-step-panel { background:var(--card); border-radius:12px; border:1px solid var(--border); padding:14px 16px; }
.vp2-step-panel-tabs { display:flex; gap:6px; margin-bottom:14px; border-bottom:1px solid var(--border); padding-bottom:10px; align-items:center; }
.vp2-tab { padding:6px 14px; border-radius:8px; font-size:.78rem; font-weight:700; cursor:pointer; border:1.5px solid var(--border); background:transparent; color:var(--text-muted); font-family:var(--font); transition:all .15s; }
.vp2-tab.active { background:var(--primary); color:#fff; border-color:var(--primary); }
.vp2-tab:hover:not(.active) { border-color:var(--primary); color:var(--primary); }
.vp2-whisper-drop { border:2px dashed var(--border); border-radius:10px; padding:20px 14px; text-align:center; cursor:pointer; transition:all .15s; display:block; }
.vp2-whisper-drop:hover { border-color:var(--primary); background:rgba(192,57,43,.05); }
.vp2-drop-icon { font-size:1.6rem; margin-bottom:6px; }
.vp2-drop-text { font-size:.8rem; color:var(--text-muted); line-height:1.7; }
.vp2-sub-status { display:flex; align-items:center; gap:10px; padding:10px 14px; background:rgba(39,174,96,.08); border:1px solid rgba(39,174,96,.3); border-radius:10px; flex-wrap:wrap; }
.vp2-server-btn { background:var(--card); border:1.5px solid var(--border); border-radius:8px; padding:5px 12px; font-size:.75rem; font-weight:600; color:var(--text-muted); cursor:pointer; font-family:var(--font); transition:all .15s; }
.vp2-server-btn:hover { border-color:var(--primary); color:var(--primary); }
.vp2-warn-box { background:rgba(234,179,8,.08); border:1px solid rgba(234,179,8,.3); border-radius:8px; padding:9px 12px; font-size:.78rem; margin-bottom:12px; line-height:1.5; }
@keyframes vp2-spin { to { transform: rotate(360deg); } }
.vp2-auto-progress { display:flex; align-items:flex-start; gap:12px; padding:14px 2px; }
.vp2-auto-spinner { width:20px; height:20px; border:2.5px solid var(--border); border-top-color:var(--primary); border-radius:50%; animation:vp2-spin .65s linear infinite; flex-shrink:0; margin-top:2px; }
.vp2-auto-step { font-size:.7rem; color:var(--text-muted); margin-top:3px; word-break:break-all; }
/* API key panel */
.vp2-api-toggle-btn { font-size:.7rem; padding:3px 9px; background:transparent; border:1.5px solid var(--border); border-radius:7px; cursor:pointer; color:var(--text-muted); font-weight:600; transition:all .15s; flex-shrink:0; }
.vp2-api-toggle-btn:hover { border-color:var(--primary); color:var(--primary); }
.vp2-api-panel { border:1px solid var(--border); border-radius:10px; padding:12px 14px; margin-bottom:12px; background:rgba(0,0,0,.12); display:flex; flex-direction:column; gap:10px; }
.vp2-api-row { display:flex; align-items:center; gap:10px; flex-wrap:wrap; }
.vp2-api-label { display:flex; flex-direction:column; min-width:110px; flex-shrink:0; }
.vp2-api-service { font-size:.78rem; font-weight:700; }
.vp2-api-hint { font-size:.66rem; color:var(--text-muted); }
.vp2-api-input-wrap { flex:1; min-width:0; display:flex; align-items:center; gap:6px; }
.vp2-api-input { flex:1; min-width:0; background:var(--input-bg,var(--bg)); border:1.5px solid var(--border); border-radius:8px; padding:6px 10px; font-size:.76rem; color:var(--text); font-family:monospace; }
.vp2-api-input:focus { outline:none; border-color:var(--primary); }
.vp2-api-masked { font-size:.71rem; color:#6ee7b7; font-family:monospace; background:rgba(39,174,96,.12); border:1px solid rgba(39,174,96,.28); border-radius:5px; padding:2px 7px; flex-shrink:0; white-space:nowrap; }
.vp2-api-del { background:none; border:none; cursor:pointer; color:var(--text-muted); font-size:.82rem; padding:2px 5px; border-radius:4px; flex-shrink:0; transition:color .15s; }
.vp2-api-del:hover { color:#e74c3c; }

/* Welcome screen */
.vp2-welcome { text-align:center; padding:60px 20px; }
.vp2-welcome-icon { font-size:3.5rem; margin-bottom:16px; }
.vp2-welcome h2 { font-size:1.4rem; font-weight:800; margin-bottom:8px; }
.vp2-welcome p { color:var(--text-muted); max-width:480px; margin:0 auto 20px; line-height:1.6; }

/* Stats bar + quiz trigger */
.vp2-stats-bar {
  display:flex; align-items:center; justify-content:space-between; gap:12px; flex-wrap:wrap;
  background:#111827; color:#d1d5db; border-radius:14px; padding:12px 18px; margin-top:14px;
}
.vp2-stats-items { display:flex; align-items:center; gap:8px; flex-wrap:wrap; font-size:.78rem; }
.vp2-stat strong { color:#fff; }
.vp2-stat-sep { color:#4b5563; }
.vp2-quiz-btn { background:#c0392b; color:#fff; border:none; border-radius:9px; padding:8px 18px; font-size:.8rem; font-weight:700; cursor:pointer; font-family:var(--font); white-space:nowrap; transition:background .15s; }
.vp2-quiz-btn:hover:not(:disabled) { background:#a5281c; }
.vp2-quiz-btn:disabled { opacity:.4; cursor:not-allowed; }

/* Quiz modal */
.vp2-quiz-modal { max-width:420px; }
.vp2-quiz-word { font-family:var(--font-zh); font-size:2rem; font-weight:800; text-align:center; margin:18px 0 4px; color:var(--text); }
.vp2-quiz-pinyin { text-align:center; font-size:.9rem; color:var(--primary); font-weight:600; margin-bottom:18px; }
.vp2-quiz-opts { display:flex; flex-direction:column; gap:8px; }
.vp2-quiz-opt { display:flex; align-items:center; gap:10px; text-align:left; padding:10px 14px; border-radius:10px; border:1.5px solid var(--border); background:var(--card); cursor:pointer; font-family:var(--font); font-size:.88rem; color:var(--text); transition:all .15s; }
.vp2-quiz-opt:hover:not(:disabled) { border-color:var(--primary); }
.vp2-quiz-opt-letter { width:22px; height:22px; border-radius:50%; background:var(--border); color:var(--text); font-size:.72rem; font-weight:800; display:flex; align-items:center; justify-content:center; flex-shrink:0; }
.vp2-quiz-opt-correct { background:rgba(39,174,96,.12); border-color:#27ae60; }
.vp2-quiz-opt-correct .vp2-quiz-opt-letter { background:#27ae60; color:#fff; }
.vp2-quiz-opt-wrong { background:rgba(192,57,43,.1); border-color:#c0392b; }
.vp2-quiz-opt-wrong .vp2-quiz-opt-letter { background:#c0392b; color:#fff; }
.vp2-quiz-result-score { text-align:center; font-size:2.6rem; font-weight:900; color:var(--primary); margin:20px 0 4px; }
.vp2-quiz-result-pct { text-align:center; font-size:.9rem; color:var(--text-muted); margin-bottom:8px; }

@media (max-width:900px) { .vp2-main { grid-template-columns:1fr; } .vp2-right { max-height:500px; } .vp2-step-box { min-width:72px; padding:8px 6px 6px; } .vp2-step-icon { font-size:.9rem; } .vp2-step-label { font-size:.6rem; } .vp2-stats-bar { flex-direction:column; align-items:stretch; } .vp2-quiz-btn { width:100%; } }
[data-theme="dark"] .vp2-url-bar, [data-theme="dark"] .vp2-step-panel, [data-theme="dark"] .vp2-right { background:var(--card); border-color:var(--border); }
[data-theme="dark"] .vp2-url-inner, [data-theme="dark"] .vp2-method-btn, [data-theme="dark"] .vp2-paste-ta { background:var(--input-bg); border-color:var(--border); color:var(--text); }
[data-theme="dark"] .sub-line:hover { background:#22223a; } [data-theme="dark"] .sub-line.sub-active { background:#2e1a1a; }
[data-theme="dark"] .vp2-pipeline-bar { background:var(--card); }
[data-theme="dark"] .vp2-mode-tabs { background:#1f2937; }
[data-theme="dark"] .sub-time { background:#1f2937; color:#9ca3af; }

/* ── TRANSLATE PAGE ── */
.page-translate { max-width: 1100px; margin: 0 auto; }
.tl-header { margin-bottom: 20px; }
.tl-title { font-size: 1.6rem; font-weight: 800; margin-bottom: 4px; color: #1a1a2e; }
.tl-sub { color: var(--text-muted); font-size: 0.9rem; }

.tl-engine-bar {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  background: #fff; border-radius: 12px; padding: 12px 18px;
  margin-bottom: 16px; border: 1px solid #ebebeb;
  font-size: 0.85rem;
}
.tl-engine-label { font-weight: 600; color: #555; }
.tl-engine-opt { display: flex; align-items: center; gap: 6px; cursor: pointer; color: var(--text); }
.tl-engine-opt input { accent-color: var(--primary); }
.tl-eng-tag { padding: 1px 8px; border-radius: 10px; font-size: 0.7rem; font-weight: 700; }
.tl-free { background: #eafaf1; color: #1a7941; }
.tl-ai { background: #f4ecf7; color: #6c3483; }
.tl-engine-hint { font-size: 0.8rem; color: var(--text-muted); }
.tl-engine-hint a { color: var(--primary); text-decoration: none; }

.tl-main {
  display: grid;
  grid-template-columns: 1fr 52px 1fr;
  gap: 0; align-items: stretch;
  background: #fff; border-radius: 18px;
  border: 1.5px solid #e5e5e5;
  overflow: hidden;
  box-shadow: 0 2px 20px rgba(0,0,0,0.07);
  min-height: 380px;
}
.tl-panel { display: flex; flex-direction: column; }
.tl-src { border-right: 1.5px solid #e5e5e5; }

.tl-panel-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px 10px; border-bottom: 1px solid #f0f0f0;
  min-height: 52px;
}
.tl-lang-tabs { display: flex; gap: 4px; }
.tl-ltab {
  background: none; border: none; cursor: pointer;
  font-family: var(--font); font-size: 0.88rem; font-weight: 600;
  color: #999; padding: 6px 14px; border-radius: 20px;
  transition: background 0.15s, color 0.15s;
}
.tl-ltab.active { background: #1a1a2e; color: #fff; }
.tl-ltab:not(.active):hover { background: #f2f2f5; color: #333; }
.tl-out-lang { font-size: 0.92rem; font-weight: 700; color: #333; }

.tl-clear, .tl-copy {
  background: none; border: none; cursor: pointer;
  font-size: 0.82rem; color: #aaa; padding: 5px 10px;
  border-radius: 8px; font-family: var(--font);
  transition: background 0.15s, color 0.15s;
}
.tl-clear:hover { background: #fdf0ef; color: var(--primary); }
.tl-copy { color: #555; font-weight: 600; }
.tl-copy:hover { background: #f0f7ff; color: #2980b9; }

.tl-textarea {
  flex: 1; border: none; outline: none; resize: none;
  padding: 18px; font-size: 1.05rem; font-family: var(--font);
  color: var(--text); line-height: 1.7;
  background: transparent; min-height: 260px;
}
.tl-textarea::placeholder { color: #ccc; }

.tl-output {
  flex: 1; padding: 18px; font-size: 1.05rem; line-height: 1.7;
  color: var(--text); overflow-y: auto; background: #fafafa;
}
.tl-placeholder { color: #ccc; }
.tl-result { color: #1a1a2e; white-space: pre-wrap; }
.tl-loading { color: #888; display: flex; align-items: center; gap: 8px; }
.tl-spin { animation: tlSpin 1s linear infinite; display: inline-block; }
@keyframes tlSpin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
.tl-error { color: #c0392b; }

.tl-panel-foot {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 18px; border-top: 1px solid #f0f0f0; gap: 10px;
}
.tl-foot-right { justify-content: flex-end; }
.tl-chars { font-size: 0.78rem; color: #bbb; }
.tl-powered { font-size: 0.75rem; color: var(--text-muted); }

.tl-do-btn {
  background: var(--primary); color: #fff;
  border: none; border-radius: 22px;
  padding: 9px 24px; font-weight: 700; font-size: 0.88rem;
  cursor: pointer; font-family: var(--font);
  transition: background 0.18s;
}
.tl-do-btn:hover { background: var(--primary-dark); }

.tl-swap-col {
  display: flex; align-items: center; justify-content: center;
  background: #f9f9f9; border-left: 1.5px solid #e5e5e5; border-right: 1.5px solid #e5e5e5;
}
.tl-swap {
  background: #fff; border: 1.5px solid #e0e0e0;
  border-radius: 50%; width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 1rem; color: #555;
  transition: background 0.15s, border-color 0.15s, transform 0.2s;
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}
.tl-swap:hover { background: #1a1a2e; color: #fff; border-color: #1a1a2e; transform: scale(1.1); }

.tl-tips {
  margin-top: 14px; padding: 10px 16px;
  background: #fff; border-radius: 10px; border: 1px solid #ebebeb;
  font-size: 0.8rem; color: var(--text-muted);
  display: flex; align-items: center; gap: 8px;
}
.tl-tips span { font-weight: 700; color: #555; }
.tl-tips kbd {
  background: #f2f2f5; border: 1px solid #ddd;
  border-radius: 4px; padding: 1px 6px; font-size: 0.75rem;
}

@media (max-width: 700px) {
  .tl-main { grid-template-columns: 1fr; grid-template-rows: auto 44px auto; }
  .tl-swap-col { border: none; border-top: 1.5px solid #e5e5e5; border-bottom: 1.5px solid #e5e5e5; height: 44px; }
  .tl-src { border-right: none; }
}

/* ── VIDEO PAGE ── */
.page-video { max-width: 1280px; margin: 0 auto; }

.vp-url-bar {
  display: flex; gap: 10px; align-items: center;
  background: #fff; border-radius: 16px; padding: 12px 16px;
  margin-bottom: 16px; border: 1.5px solid var(--border);
  box-shadow: 0 2px 10px rgba(0,0,0,0.06);
}
.vp-url-wrap {
  flex: 1; display: flex; align-items: center; gap: 8px;
  background: #f5f5f7; border-radius: 10px; padding: 6px 14px;
}
.vp-url-icon { font-size: 1.1rem; flex-shrink: 0; }
.vp-url-input {
  flex: 1; border: none; background: transparent; font-family: var(--font);
  font-size: 0.9rem; color: var(--text); outline: none;
}
.vp-url-input::placeholder { color: #bbb; }
.vp-url-clear {
  background: none; border: none; cursor: pointer; color: #bbb; font-size: 0.9rem; padding: 2px 4px;
}
.vp-url-clear:hover { color: var(--primary); }
.vp-load-btn { white-space: nowrap; padding: 10px 22px; font-size: 0.9rem; }

/* Empty state */
.vp-empty {
  text-align: center; padding: 60px 20px;
  background: #fff; border-radius: 20px;
  border: 1px solid var(--border);
}
.vp-empty-icon { font-size: 3.5rem; margin-bottom: 16px; }
.vp-empty h2 { font-size: 1.4rem; font-weight: 800; margin-bottom: 8px; color: #1a1a2e; }
.vp-empty p { color: var(--text-muted); margin-bottom: 18px; }
.vp-platform-chips { display: flex; justify-content: center; gap: 10px; margin-bottom: 28px; }
.vp-chip {
  background: #f2f2f5; border-radius: 20px; padding: 6px 18px;
  font-size: 0.85rem; font-weight: 600; color: #555;
}
.vp-howto { display: flex; flex-direction: column; gap: 10px; max-width: 380px; margin: 0 auto; }
.vp-step { display: flex; align-items: center; gap: 14px; text-align: left; }
.vp-step-num {
  width: 28px; height: 28px; background: #1a1a2e; color: #fff;
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 0.8rem; font-weight: 800; flex-shrink: 0;
}
.vp-step span { font-size: 0.88rem; color: #555; }

/* Main layout */
.vp-main {
  display: grid; grid-template-columns: 1fr 420px; gap: 16px; align-items: start;
}

/* Video */
.vp-video-col { }
/* ── YouTube Video Card ── */
.vp-yt-card {
  border-radius: 16px; overflow: hidden; background: #111;
  box-shadow: 0 6px 28px rgba(0,0,0,0.3);
}
.vp-yt-thumb-wrap {
  position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden; background: #000;
}
.vp-yt-thumb {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%;
  object-fit: cover; display: block;
}
.vp-yt-play-overlay {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  cursor: pointer; background: rgba(0,0,0,0.2); transition: background 0.2s; z-index: 2;
}
.vp-yt-play-overlay:hover { background: rgba(0,0,0,0.35); }
.vp-yt-play-circle {
  width: 76px; height: 76px; background: rgba(255,0,0,0.92); border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 24px rgba(0,0,0,0.5); transition: transform 0.18s;
}
.vp-yt-play-overlay:hover .vp-yt-play-circle { transform: scale(1.1); }
.vp-yt-play-icon { color: #fff; font-size: 1.7rem; margin-left: 6px; line-height: 1; }
.vp-yt-logo-badge {
  position: absolute; bottom: 10px; right: 12px; z-index: 3;
  background: rgba(0,0,0,0.8); color: #fff;
  font-size: 0.65rem; font-weight: 800; padding: 3px 9px; border-radius: 4px;
  letter-spacing: 0.5px;
}

.vp-yt-info { padding: 12px 16px 4px; background: #1a1a1a; }
.vp-yt-title { font-size: 0.92rem; font-weight: 700; color: #eee; line-height: 1.4; }
.vp-yt-author { font-size: 0.75rem; color: #888; margin-top: 4px; }
.vp-yt-loading { color: #666; font-style: italic; font-size: 0.82rem; }

.vp-yt-card-actions {
  display: flex; gap: 10px; padding: 12px 14px; background: #161616; flex-wrap: wrap;
}
.vp-mini-btn {
  flex: 1.5; background: #27ae60; color: #fff; border: none;
  border-radius: 10px; padding: 12px 16px;
  font-family: var(--font); font-size: 0.88rem; font-weight: 700;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  gap: 8px; transition: background 0.18s; white-space: nowrap;
}
.vp-mini-btn:hover { background: #1e8449; }
.vp-mini-hint { font-size: 0.7rem; opacity: 0.8; font-weight: 400; }
.vp-yt-open-btn {
  flex: 1; background: #ff0000; color: #fff;
  border-radius: 10px; padding: 12px 14px;
  text-decoration: none; font-weight: 700; font-size: 0.85rem;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.18s; white-space: nowrap;
}
.vp-yt-open-btn:hover { background: #cc0000; }

.vp-yt-guide {
  padding: 12px 16px; background: #111; border-top: 1px solid #222;
  display: flex; flex-direction: column; gap: 8px;
}
.vp-guide-step { display: flex; align-items: center; gap: 10px; }
.vp-gs-num {
  width: 22px; height: 22px; background: #333; color: #aaa;
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 0.7rem; font-weight: 800; flex-shrink: 0;
}
.vp-guide-step span { font-size: 0.75rem; color: #777; line-height: 1.4; }
.vp-guide-step strong { color: #aaa; }

/* Bilibili embed */
.vp-bili-wrap { border-radius: 16px; overflow: hidden; box-shadow: 0 4px 20px rgba(0,0,0,0.2); }
.vp-iframe-wrap-inner {
  position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden; background: #000;
}
.vp-iframe-wrap-inner iframe {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%; border: none; display: block;
}

.vp-video-hint { margin-top: 10px; font-size: 0.78rem; color: var(--text-muted); text-align: center; padding: 6px; }

/* Subtitle panel */
.vp-sub-col {
  background: #fff; border-radius: 16px;
  border: 1px solid var(--border);
  box-shadow: 0 2px 10px rgba(0,0,0,0.06);
  overflow: hidden; display: flex; flex-direction: column;
  min-height: 500px; max-height: 600px;
}
.vp-sub-tabs {
  display: flex; border-bottom: 1px solid var(--border);
  background: #fafafa;
}
.vp-stab {
  flex: 1; padding: 12px 10px; font-size: 0.82rem; font-weight: 600;
  color: #888; border: none; background: none; cursor: pointer;
  font-family: var(--font); border-bottom: 3px solid transparent;
  transition: all 0.15s;
}
.vp-stab.active { color: var(--primary); border-bottom-color: var(--primary); background: #fff; }
.vp-tab-pane { flex: 1; display: flex; flex-direction: column; padding: 14px; overflow-y: auto; }
.vp-tab-pane.hidden { display: none; }

.vp-input-hint { font-size: 0.78rem; color: var(--text-muted); margin-bottom: 10px; line-height: 1.5; }
.vp-textarea {
  flex: 1; border: 1.5px solid var(--border); border-radius: 10px;
  padding: 12px; font-size: 0.9rem; font-family: var(--font);
  color: var(--text); resize: none; outline: none; min-height: 200px;
  line-height: 1.7;
}
.vp-textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(192,57,43,0.1); }

.vp-input-actions {
  display: flex; gap: 8px; margin-top: 12px; align-items: center;
}
.vp-srt-label {
  flex: 1; background: #f5f5f7; border: 1.5px solid var(--border);
  border-radius: 8px; padding: 8px 14px; font-size: 0.8rem;
  font-weight: 600; color: #555; cursor: pointer; text-align: center;
  transition: var(--transition);
}
.vp-srt-label:hover { border-color: #3498db; color: #2980b9; background: #ebf5fb; }
.vp-process-btn { flex: 1; font-size: 0.88rem; padding: 9px 16px; }

/* Result */
.vp-result-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px; gap: 8px; flex-wrap: wrap;
}
.vp-result-info { font-size: 0.78rem; color: var(--text-muted); }
.vp-fill-ai-btn {
  background: #f4ecf7; border: 1px solid #d2b4de; color: #6c3483;
  border-radius: 8px; padding: 5px 12px; font-size: 0.75rem;
  font-weight: 700; cursor: pointer; font-family: var(--font);
}
.vp-fill-ai-btn:hover { background: #e8daef; }

.vp-annotated {
  line-height: 2.8; word-break: break-all;
  font-size: 0.92rem; color: var(--text);
}
.va-word, .va-unk {
  display: inline-flex; flex-direction: column; align-items: center;
  margin: 0 3px 8px; cursor: pointer; position: relative;
  vertical-align: bottom;
}
.va-word:hover .va-meaning, .va-unk:hover .va-meaning { opacity: 1; visibility: visible; }
.va-pinyin {
  font-size: 0.62rem; color: var(--primary); font-weight: 600;
  line-height: 1; white-space: nowrap; margin-bottom: 1px;
}
.va-unk-py { color: #e67e22; }
.va-hanzi {
  font-family: var(--font-zh); font-size: 1.1rem; font-weight: 700;
  color: #1a1a2e; padding: 0 1px;
}
.va-meaning {
  position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%);
  background: #1a1a2e; color: #fff; font-size: 0.65rem;
  padding: 4px 8px; border-radius: 6px; white-space: nowrap;
  opacity: 0; visibility: hidden; pointer-events: none;
  transition: opacity 0.15s; z-index: 10;
  margin-bottom: 4px;
}
.va-meaning::after {
  content: ''; position: absolute; top: 100%; left: 50%; transform: translateX(-50%);
  border: 4px solid transparent; border-top-color: #1a1a2e;
}
.va-unk .va-hanzi { border-bottom: 2px dashed #e67e22 !important; }
.va-other { color: var(--text-muted); font-size: 0.9rem; }

.vp-legend { display: flex; gap: 14px; margin-top: 14px; font-size: 0.72rem; color: var(--text-muted); }
.vp-legend-item { display: flex; align-items: center; gap: 5px; }
.vp-known { color: var(--primary); }
.vp-unk { color: #e67e22; }

.vp-result-empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; color: var(--text-muted); text-align: center; }
.vp-result-empty div { font-size: 2rem; }

@media (max-width: 900px) {
  .vp-main { grid-template-columns: 1fr; }
  .vp-sub-col { min-height: 400px; max-height: 500px; }
}

/* Feature card video */
.feature-card-video { border-top: 3px solid #e74c3c; }

/* ── LUYỆN NGHE (LISTEN) TAB ── */
.lv-listen { padding: 8px 0; }

.ll-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 12px;
  background: #fff; border-radius: 12px; padding: 14px 18px;
  margin-bottom: 20px; border: 1px solid var(--border);
  box-shadow: 0 1px 6px rgba(0,0,0,0.05);
}
.ll-toolbar-info { display: flex; flex-direction: column; gap: 3px; }
.ll-total { font-weight: 700; font-size: 0.9rem; color: var(--text); }
.ll-hint { font-size: 0.75rem; color: var(--text-muted); }
.ll-hint a { color: var(--primary); text-decoration: none; }
.ll-bulk-btn { font-size: 0.88rem; padding: 9px 20px; }

.ll-lessons { display: flex; flex-direction: column; gap: 14px; }
.ll-unassigned {
  margin-bottom: 20px; padding: 14px; border: 1px solid var(--border);
  border-radius: 12px; background: var(--card); color: var(--text);
}
.ll-unassigned summary { cursor: pointer; font-weight: 600; }
.ll-unassigned p { margin: 12px 0; font-size: 0.85rem; color: var(--text-muted); }
.ll-unassigned .ll-audio-item { margin-top: 8px; }
.ll-unassigned .btn-outline { padding: 7px 12px; font-size: 0.8rem; }

.ll-lesson-group {
  background: #fff; border-radius: 14px;
  border: 1px solid var(--border);
  overflow: hidden;
  box-shadow: 0 1px 6px rgba(0,0,0,0.05);
}
.ll-lesson-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; border-bottom: 1px solid #f5f5f5;
  background: #fafafa; gap: 10px;
}
.ll-lesson-left { display: flex; align-items: center; gap: 10px; }
.ll-lesson-name { font-size: 0.88rem; font-weight: 700; color: var(--text); }
.ll-lesson-badge {
  background: #e8f4fd; color: #1a5276;
  font-size: 0.68rem; font-weight: 700;
  padding: 2px 9px; border-radius: 10px;
}
.ll-add-btn {
  background: none; border: 1.5px solid var(--primary);
  color: var(--primary); border-radius: 8px;
  padding: 5px 12px; font-size: 0.78rem; font-weight: 700;
  cursor: pointer; font-family: var(--font);
  transition: var(--transition); white-space: nowrap;
}
.ll-add-btn:hover { background: var(--primary); color: #fff; }

.ll-empty-lesson {
  padding: 14px 18px;
  font-size: 0.82rem; color: #bbb;
  font-style: italic;
}

.ll-audio-list { padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; }

.ll-audio-item {
  display: flex; align-items: center; gap: 10px;
  background: #f8f9fa; border-radius: 10px;
  padding: 10px 12px; border: 1px solid #eee;
  flex-wrap: wrap;
}
.ll-audio-icon { font-size: 1.1rem; flex-shrink: 0; }
.ll-audio-info { flex: 1; min-width: 100px; }
.ll-audio-name {
  display: block; font-size: 0.82rem; font-weight: 600;
  color: var(--text); white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; max-width: 200px;
}
.ll-audio-meta { display: block; font-size: 0.7rem; color: var(--text-muted); }
.ll-player {
  flex: 1; min-width: 200px; height: 34px;
  accent-color: var(--primary);
}
.ll-del-btn { flex-shrink: 0; }
.ll-audio-missing { font-size: 0.75rem; color: #e67e22; font-style: italic; }

/* ── Audio Upload Modal ── */
.audio-upload-modal { padding: 6px 2px; }
.aum-dropzone {
  border: 2px dashed var(--border); border-radius: 14px;
  padding: 32px 20px; text-align: center; cursor: pointer;
  background: var(--bg); transition: all var(--transition);
  margin-bottom: 16px;
}
.aum-dropzone:hover, .aum-dz-over {
  border-color: var(--primary); background: #fdf5f5;
}
.aum-dz-icon { font-size: 2.4rem; margin-bottom: 10px; }
.aum-dz-text { font-size: 0.9rem; color: var(--text); margin-bottom: 4px; }
.aum-dz-sub { font-size: 0.75rem; color: var(--text-muted); }

.aum-list { max-height: 300px; overflow-y: auto; }
.aum-list-head { font-size: 0.82rem; font-weight: 700; color: var(--text-muted); padding: 8px 0 6px; }
.aum-rows { display: flex; flex-direction: column; gap: 6px; }
.aum-row {
  display: flex; align-items: center; gap: 8px;
  background: #f8f9fa; border-radius: 8px;
  padding: 8px 10px; border: 1px solid #eee; flex-wrap: wrap;
}
.aum-row-icon { font-size: 1rem; flex-shrink: 0; }
.aum-row-info { flex: 1; min-width: 80px; }
.aum-row-name { display: block; font-size: 0.8rem; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 180px; }
.aum-row-size { display: block; font-size: 0.68rem; color: var(--text-muted); }

@media (max-width: 600px) {
  .ll-player { min-width: 100%; }
  .ll-audio-item { gap: 8px; }
}

/* ── COLLECTIONS ── */
.mw-collections {
  background: #fff; border-radius: 16px;
  padding: 18px 20px; margin-bottom: 20px;
  border: 1px solid var(--border);
  box-shadow: 0 1px 8px rgba(0,0,0,0.05);
}
.mwc-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.mwc-title { font-size: 0.88rem; font-weight: 700; color: #555; text-transform: uppercase; letter-spacing: 0.5px; }
.mwc-create-btn {
  background: #1a1a2e; color: #fff; border: none; border-radius: 20px;
  padding: 6px 16px; font-size: 0.8rem; font-weight: 700;
  cursor: pointer; font-family: var(--font); transition: opacity 0.18s;
}
.mwc-create-btn:hover { opacity: 0.85; }

/* Filter chips */
.mwc-chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.mwc-chip {
  display: flex; align-items: center; gap: 6px;
  background: #f5f5f7; border: 1.5px solid #e8e8e8; border-radius: 22px;
  padding: 6px 14px; cursor: pointer; font-family: var(--font);
  font-size: 0.82rem; font-weight: 600; color: #555;
  transition: all 0.15s;
}
.mwc-chip:hover { border-color: #1a1a2e; color: #1a1a2e; }
.mwc-chip-active { background: #1a1a2e; color: #fff; border-color: #1a1a2e; }
.mwc-chip-icon { font-size: 1rem; line-height: 1; }
.mwc-chip-count { background: rgba(0,0,0,0.1); border-radius: 10px; padding: 1px 7px; font-size: 0.7rem; }
.mwc-chip-active .mwc-chip-count { background: rgba(255,255,255,0.2); }
.mwc-empty-hint { font-size: 0.78rem; color: #bbb; padding: 6px 4px; font-style: italic; }

/* Collection big grid */
.mwc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px,1fr)); gap: 16px; }
.mwc-big-card {
  background: #fff; border-radius: 16px; padding: 18px;
  cursor: pointer; border: 1px solid var(--border);
  box-shadow: 0 1px 8px rgba(0,0,0,0.06);
  transition: transform 0.15s, box-shadow 0.15s;
  display: flex; flex-direction: column; gap: 8px;
}
.mwc-big-card:hover { transform: translateY(-3px); box-shadow: 0 6px 20px rgba(0,0,0,0.1); }
.mwc-big-card-top { display: flex; align-items: flex-start; justify-content: space-between; }
.mwc-big-icon { width: 48px; height: 48px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 1.5rem; flex-shrink: 0; }
.mwc-big-name { font-size: 1rem; font-weight: 800; color: #1a1a2e; }
.mwc-big-desc { font-size: 0.75rem; color: var(--text-muted); line-height: 1.4; }
.mwc-big-preview { font-size: 0.78rem; color: #aaa; font-style: italic; flex: 1; }
.mwc-big-footer { display: flex; justify-content: space-between; align-items: center; margin-top: auto; padding-top: 10px; border-top: 1px solid #f0f0f0; }
.mwc-big-count { font-size: 0.85rem; font-weight: 700; }
.mwc-big-date { font-size: 0.68rem; color: #ccc; }

/* Add collection card */
.mwc-add-card {
  background: #f8f8fb; border-radius: 16px; padding: 18px;
  cursor: pointer; border: 2px dashed #ddd;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; min-height: 160px; transition: all 0.15s;
}
.mwc-add-card:hover { border-color: #1a1a2e; background: #f0f0f5; }
.mwc-add-icon { font-size: 2rem; color: #ccc; font-weight: 300; }
.mwc-add-text { font-size: 0.82rem; color: #aaa; font-weight: 600; }

/* Empty state */
.mwc-empty-state { text-align: center; padding: 60px 20px; }
.mwc-empty-icon { font-size: 4rem; margin-bottom: 16px; }
.mwc-empty-state h2 { font-size: 1.3rem; font-weight: 800; color: #1a1a2e; margin-bottom: 10px; }
.mwc-empty-state p { color: var(--text-muted); line-height: 1.6; }

/* Create big button */
.mwc-create-big-btn { background: #1a1a2e; border-color: #1a1a2e; }
.mwc-create-big-btn:hover { background: #2c2c4e; }

/* Collection cards (old, keep for compatibility) */
.mwc-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px,1fr)); gap: 12px; }
.mwc-card { background: #fafafa; border-radius: 12px; padding: 14px; cursor: pointer; border: 1px solid #eee; transition: transform 0.15s, box-shadow 0.15s; }
.mwc-card:hover { transform: translateY(-2px); box-shadow: 0 4px 16px rgba(0,0,0,0.1); }
.mwc-card-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.mwc-card-icon { width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 1.3rem; }
.mwc-card-actions { display: flex; gap: 4px; }
.mwc-card-name { font-size: 0.92rem; font-weight: 700; color: #1a1a2e; margin-bottom: 4px; }
.mwc-card-desc { font-size: 0.75rem; color: var(--text-muted); margin-bottom: 8px; line-height: 1.4; }
.mwc-card-stats { display: flex; justify-content: space-between; font-size: 0.72rem; color: #aaa; }

/* Active collection bar */
.mwc-active-header {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: #f5f5f7; border-radius: 10px; padding: 10px 14px;
}
.mwc-back-btn { background: none; border: none; cursor: pointer; color: var(--primary); font-size: 0.82rem; font-weight: 700; padding: 0; font-family: var(--font); }
.mwc-active-name { font-weight: 700; font-size: 0.92rem; flex: 1; }
.mwc-active-count { font-size: 0.75rem; color: var(--text-muted); }
.mwc-btn-sm { padding: 4px 10px; font-size: 0.75rem; }

/* Word card collection pin button */
.cvc-col { color: #e67e22 !important; }
.cvc-col:hover { border-color: #e67e22 !important; background: #fdebd0 !important; }
.cvc-col-badges { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 8px; }
.cvc-col-badge { font-size: 0.62rem; font-weight: 700; padding: 2px 7px; border-radius: 8px; white-space: nowrap; }

/* ── Create Collection Modal ── */
.col-modal { padding: 6px 2px; }
.col-icon-grid { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.col-icon-btn {
  width: 38px; height: 38px; border: 1.5px solid var(--border); border-radius: 8px;
  font-size: 1.2rem; cursor: pointer; background: #f5f5f7; transition: all 0.15s;
}
.col-icon-btn:hover { border-color: #1a1a2e; background: #e8e8ef; }
.col-icon-active { border-color: #1a1a2e; background: #1a1a2e; }
.col-color-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.col-color-btn {
  width: 32px; height: 32px; border-radius: 50%; border: 3px solid transparent;
  cursor: pointer; font-size: 0.85rem; color: #fff; display: flex; align-items: center; justify-content: center;
  transition: transform 0.15s;
}
.col-color-btn:hover { transform: scale(1.15); }

/* ── Backup & Restore Modal ── */
.backup-modal { max-width: 520px; }
.backup-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 18px;
  margin-bottom: 14px;
}
.backup-section-title {
  font-size: 0.82rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--text-muted); margin-bottom: 12px;
}
.backup-manual-row {
  display: flex; gap: 10px; flex-wrap: wrap;
}
.backup-export-btn, .backup-import-btn {
  flex: 1; min-width: 160px; padding: 10px 16px;
  font-size: 0.92rem; border-radius: 9px;
}
.backup-manual-hint {
  margin-top: 10px; font-size: 0.78rem;
  color: var(--text-muted); line-height: 1.5;
}
.backup-empty {
  text-align: center; padding: 18px 0;
  color: var(--text-muted); font-size: 0.87rem; line-height: 1.7;
}
.backup-list { display: flex; flex-direction: column; gap: 8px; }
.backup-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px; border-radius: 9px;
  background: var(--bg); border: 1px solid var(--border);
}
.backup-item-info {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.backup-item-label {
  font-size: 0.78rem; font-weight: 700; color: var(--primary);
}
.backup-item-time {
  font-size: 0.82rem; color: var(--text);
}
.backup-item-count {
  font-size: 0.78rem; color: var(--text-muted);
  background: var(--surface); padding: 2px 8px;
  border-radius: 20px; border: 1px solid var(--border);
}
.backup-restore-btn {
  flex-shrink: 0; font-size: 0.8rem; padding: 5px 12px;
}
.backup-nav-btn {
  font-size: 0.82rem; padding: 6px 12px;
  border-color: var(--border);
}
[data-theme="dark"] .backup-item { background: #12122a; }
[data-theme="dark"] .backup-section { background: #1a1a2e; }
.col-color-active { border-color: #1a1a2e; transform: scale(1.15); }

/* Pick collection modal */
.col-pick-modal { padding: 4px 2px; }
.col-pick-word { background: #f5f5f7; border-radius: 8px; padding: 10px 14px; font-weight: 700; font-size: 1rem; margin-bottom: 14px; }
.col-pick-list { display: flex; flex-direction: column; gap: 8px; max-height: 280px; overflow-y: auto; margin-bottom: 14px; }
.col-pick-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; background: #fafafa; border-radius: 10px; cursor: pointer; border: 1.5px solid #eee; transition: border-color 0.15s; }
.col-pick-item:hover { border-color: #1a1a2e; }
.col-pick-cb { width: 18px; height: 18px; accent-color: #1a1a2e; flex-shrink: 0; }
.col-pick-icon { width: 36px; height: 36px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 1.1rem; flex-shrink: 0; }
.col-pick-info { flex: 1; }
.col-pick-name { display: block; font-weight: 700; font-size: 0.88rem; }
.col-pick-count { display: block; font-size: 0.72rem; color: var(--text-muted); }

.mw-words-section { margin-top: 4px; }

/* ── MY WORDS PAGE ── */
.page-mywords { max-width: 1100px; margin: 0 auto; }

.mywords-header {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 16px;
  margin-bottom: 28px;
  padding-bottom: 20px;
  border-bottom: 2px solid var(--border);
}
.mywords-header h1 { font-size: 1.6rem; font-weight: 700; margin-bottom: 4px; }
.mywords-header p { color: var(--text-muted); font-size: 0.9rem; }
.mywords-header-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

.btn-add-word {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 1rem; font-weight: 700;
  padding: 10px 22px; border-radius: 10px;
}

.empty-mywords {
  text-align: center; padding: 60px 20px;
  color: var(--text-muted);
}
.empty-zh {
  font-family: var(--font-zh);
  font-size: 4rem; color: var(--border);
  margin-bottom: 16px; line-height: 1;
}
.empty-mywords p { font-size: 1rem; line-height: 1.7; }

/* Custom word card */
.custom-word-card { border-top: 3px solid #8e44ad; position: relative; }
.cvc-actions { display: flex; gap: 4px; }
.cvc-btn {
  background: none; border: 1px solid var(--border);
  border-radius: 6px; width: 26px; height: 26px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 0.8rem; color: var(--text-muted);
  transition: var(--transition);
}
.cvc-edit:hover { border-color: #3498db; color: #3498db; background: #ebf5fb; }
.cvc-del:hover { border-color: #e74c3c; color: #e74c3c; background: #fdf0ef; }

.custom-badge {
  background: #f4ecf7; color: #8e44ad;
  padding: 1px 6px; border-radius: 4px;
  font-size: 0.68rem; font-weight: 700;
}
.modified-badge {
  background: #fef9e7; color: #d68910;
  padding: 1px 6px; border-radius: 4px;
  font-size: 0.68rem; font-weight: 700;
  cursor: pointer; border: 1px solid #f39c12;
}
.modified-badge:hover { background: #fdf2c3; }
.word-modified { border-top: 2px solid #f39c12 !important; }

/* Collection selector inside add-word modal */
.aw-collections-row { border-top: 1px solid var(--border); padding-top: 12px; margin-top: 4px; }
.aw-col-auto-save {
  display: flex; align-items: center; gap: 10px;
  background: #f0faf4; border: 1.5px solid #a9dfbf;
  border-radius: 10px; padding: 10px 14px;
  font-size: 0.85rem; color: #1a7941;
}
.aw-col-auto-icon {
  width: 28px; height: 28px; border-radius: 7px;
  display: flex; align-items: center; justify-content: center; font-size: 1rem; flex-shrink: 0;
}
.aw-col-empty { font-size: 0.8rem; color: var(--text-muted); padding: 6px 0; }
.aw-col-empty a { color: var(--primary); text-decoration: none; font-weight: 700; }
.aw-col-checks {
  display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px;
}
.aw-col-check-item {
  display: flex; align-items: center; gap: 7px;
  background: #f5f5f7; border: 1.5px solid #e8e8e8;
  border-radius: 20px; padding: 6px 12px;
  cursor: pointer; transition: border-color 0.15s, background 0.15s;
}
.aw-col-check-item:hover { border-color: #1a1a2e; background: #eee; }
.aw-col-check-item input[type="checkbox"] {
  width: 15px; height: 15px; accent-color: #1a1a2e; flex-shrink: 0;
}
.aw-col-check-item input:checked ~ .aw-col-check-name { font-weight: 700; color: #1a1a2e; }
.aw-col-check-icon { font-size: 1rem; width: 24px; height: 24px; border-radius: 6px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.aw-col-check-name { font-size: 0.82rem; font-weight: 500; color: #555; }

.awm-builtin-note {
  background: #fef9e7; border: 1px solid #f1c40f;
  border-radius: 8px; padding: 8px 12px;
  font-size: 0.82rem; color: #7d6608;
  margin-bottom: 16px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.awm-reset-btn {
  background: none; border: 1px solid #e67e22;
  color: #e67e22; border-radius: 5px;
  padding: 3px 10px; font-size: 0.78rem;
  cursor: pointer; font-family: var(--font);
}
.awm-reset-btn:hover { background: #fdecea; }

.fc-custom-count {
  margin-top: 8px;
  font-size: 0.78rem;
  color: #8e44ad;
  font-weight: 600;
}

/* Feature card my words accent */
.feature-card-mywords { border-top: 3px solid #8e44ad; }
/* Feature card writing practice accent */
.feature-card-write { border-top: 3px solid #c0392b; }

/* ── ADD WORD MODAL ── */
.add-word-modal { padding: 8px 4px; }
.awm-title {
  font-size: 1.3rem; font-weight: 700;
  margin-bottom: 20px; color: var(--text);
}
.awm-form { display: flex; flex-direction: column; gap: 14px; }

.form-row { display: flex; flex-direction: column; gap: 5px; }
.form-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }

.form-label { font-size: 0.85rem; font-weight: 600; color: var(--text); }
.req { color: var(--primary); }

.form-input, .form-select {
  width: 100%; padding: 9px 12px;
  border: 1.5px solid var(--border); border-radius: 8px;
  font-size: 0.95rem; font-family: var(--font); color: var(--text);
  transition: border-color var(--transition);
  background: #fff;
}
.form-input:focus, .form-select:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(192,57,43,0.1);
}

.form-actions {
  display: flex; gap: 10px; justify-content: flex-end;
  padding-top: 8px;
}

.aw-opt-label { font-size: 0.72rem; color: var(--text-muted); font-weight: 400; margin-left: 4px; }
.aw-primary-input { font-family: var(--font-zh); font-size: 1.05rem; }

/* Exercise option editor */
.ae-opts { display: flex; flex-direction: column; gap: 8px; }
.ae-opt-row { display: flex; align-items: center; gap: 10px; }
.ae-opt-radio { width: 18px; height: 18px; flex-shrink: 0; accent-color: var(--primary); cursor: pointer; }
.ae-opt-row .form-input { flex: 1; }

.autofill-hint {
  font-size: 0.78rem; font-weight: 600;
  color: #27ae60;
  background: #eafaf1;
  border: 1px solid #a9dfbf;
  border-radius: 6px;
  padding: 5px 10px;
  margin-top: 2px;
}
.autofill-hint.hidden { display: none; }

@media (max-width: 600px) {
  .form-row-2, .form-row-3 { grid-template-columns: 1fr; }
  .mywords-header { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 600px) {
  .um-body { padding: 16px; }
  .umr-table { font-size: 0.75rem; }
  .um-btn-primary, .um-btn-secondary { min-width: unset; flex: unset; width: 100%; }
}

/* ── LUYỆN VIẾT CHỮ HÁN (HanziWriter) ── */
.page-write { max-width: 900px; margin: 0 auto; }
.write-header { margin-bottom: 20px; }
.write-title { font-size: 1.4rem; font-weight: 800; display: flex; align-items: center; gap: 8px; margin-bottom: 6px; color: var(--text); }
.write-subtitle { color: var(--text-muted); font-size: 0.88rem; margin-bottom: 14px; line-height: 1.5; }
.write-overall-progress { display: flex; align-items: center; gap: 12px; }
.wop-bar { flex: 1; height: 8px; background: var(--border); border-radius: 10px; overflow: hidden; }
.wop-fill { height: 100%; background: var(--primary); border-radius: 10px; transition: width 0.4s ease; }
.wop-label { font-size: 0.8rem; color: var(--text-muted); white-space: nowrap; font-weight: 600; }

.write-level-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.write-level-tab {
  padding: 8px 16px; border-radius: 8px; border: 1.5px solid var(--border);
  background: var(--card); color: var(--text); font-weight: 700; font-size: 0.85rem;
  cursor: pointer; transition: var(--transition); font-family: var(--font);
}
.write-level-tab:hover { border-color: var(--lc, var(--primary)); }
.write-level-tab.wlt-active { background: var(--lc, var(--primary)); color: #fff; border-color: var(--lc, var(--primary)); }

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

.write-word-list { display: flex; flex-direction: column; gap: 2px; padding: 6px; }
.write-word-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 8px; border-radius: 8px; flex-wrap: wrap;
}
.write-word-row:hover { background: var(--bg); }
.www-info { display: flex; align-items: baseline; gap: 10px; min-width: 160px; flex-wrap: wrap; }
.www-hanzi { font-family: var(--font-zh); font-size: 1.15rem; font-weight: 600; color: var(--text); }
.www-pinyin { font-size: 0.8rem; color: var(--text-muted); }
.www-vn { font-size: 0.82rem; color: var(--text-muted); }
.www-chars { display: flex; gap: 6px; flex-wrap: wrap; }

.write-char-chip {
  position: relative; width: 40px; height: 40px; border-radius: 8px;
  border: 1.5px solid var(--border); background: var(--card);
  font-family: var(--font-zh); font-size: 1.2rem; color: var(--text);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: var(--transition); padding: 0;
}
.write-char-chip:hover { border-color: var(--primary); color: var(--primary); transform: translateY(-1px); }
.write-char-chip.wchip-mastered { border-color: #27ae60; background: rgba(39,174,96,0.1); }
.wchip-check {
  position: absolute; top: -5px; right: -5px; width: 16px; height: 16px; border-radius: 50%;
  background: #27ae60; color: #fff; font-size: 0.6rem; display: flex; align-items: center; justify-content: center;
  font-weight: 700; line-height: 1;
}

/* Practice modal */
.hw-practice { padding: 22px; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.hw-practice-head { width: 100%; display: flex; align-items: center; justify-content: space-between; }
.hw-practice-char-label { font-family: var(--font-zh); font-size: 1.3rem; font-weight: 700; color: var(--text); }
.hw-stage-wrap { display: flex; justify-content: center; }
.hw-target {
  width: 280px; height: 280px; border-radius: 12px;
  background-color: var(--bg); border: 1.5px solid var(--border);
  background-image:
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 50% 50%;
  background-position: center;
}
.hw-status { font-size: 0.85rem; color: var(--text-muted); text-align: center; min-height: 1.2em; }
.hw-controls { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.hw-history { font-size: 0.78rem; color: var(--text-muted); text-align: center; }

@media (max-width: 600px) {
  .write-word-row { flex-direction: column; align-items: flex-start; }
  .hw-target { width: 240px; height: 240px; }
}

/* Search box on the writing-practice page */
.write-search-wrap {
  display: flex; align-items: center; gap: 8px;
  background: var(--input-bg); border-radius: 50px;
  border: 1.5px solid var(--border);
  padding: 4px 6px 4px 16px;
  margin-bottom: 14px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.write-search-wrap:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(192,57,43,0.1); }
.write-search-icon { font-size: 0.95rem; color: var(--text-muted); flex-shrink: 0; }
.write-search-input {
  flex: 1; border: none; background: transparent;
  font-size: 0.9rem; font-family: var(--font); color: var(--text);
  outline: none; padding: 8px 0;
}
.write-search-input::placeholder { color: var(--text-muted); }
.write-search-clear {
  background: var(--border); color: var(--text); border: none; border-radius: 50%;
  width: 26px; height: 26px; flex-shrink: 0; cursor: pointer; font-size: 0.75rem;
  display: flex; align-items: center; justify-content: center;
}
.write-search-summary { font-size: 0.82rem; color: var(--text-muted); padding: 6px 8px 12px; }
.www-level-badge {
  font-size: 0.68rem; font-weight: 700; color: #fff; border-radius: 5px;
  padding: 2px 7px; letter-spacing: 0.5px;
}

  .um-body { padding: 16px; }
  .umr-table { font-size: 0.75rem; }
  .um-btn-primary, .um-btn-secondary { min-width: unset; flex: unset; width: 100%; }
}

/* ── TRÒ CHUYỆN CÙNG AI ── */
.page-chat { max-width: 900px; margin: 0 auto; }
.chat-header { margin-bottom: 16px; }
.chat-title { font-size: 1.4rem; font-weight: 800; display: flex; align-items: center; gap: 8px; color: var(--text); margin-bottom: 6px; }
.chat-subtitle { color: var(--text-muted); font-size: 0.88rem; line-height: 1.5; margin-bottom: 14px; }

.chat-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.chat-toolbar .chat-level-tabs { margin-bottom: 0; }
.chat-autospeak-btn {
  flex-shrink: 0; padding: 7px 14px; border-radius: 20px; border: 1.5px solid var(--border);
  background: var(--card); color: var(--text-muted); font-weight: 700; font-size: 0.8rem;
  cursor: pointer; transition: var(--transition); font-family: var(--font); white-space: nowrap;
}
.chat-autospeak-btn:hover { border-color: var(--primary); }
.chat-autospeak-btn.casb-on { background: rgba(39,174,96,0.1); border-color: #27ae60; color: #27ae60; }

.chat-level-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.chat-level-tab {
  padding: 8px 16px; border-radius: 8px; border: 1.5px solid var(--border);
  background: var(--card); color: var(--text); font-weight: 700; font-size: 0.85rem;
  cursor: pointer; transition: var(--transition); font-family: var(--font);
}
.chat-level-tab:hover { border-color: var(--lc, var(--primary)); }
.chat-level-tab.clt-active { background: var(--lc, var(--primary)); color: #fff; border-color: var(--lc, var(--primary)); }

.chat-window {
  display: flex; flex-direction: column;
  background: var(--card); border: 1px solid var(--border); border-radius: 16px;
  overflow: hidden; box-shadow: var(--shadow);
}
.chat-messages {
  flex: 1; min-height: 420px; max-height: 60vh; overflow-y: auto;
  padding: 20px; display: flex; flex-direction: column; gap: 12px;
}
.chat-input-bar {
  display: flex; gap: 8px; align-items: center;
  padding: 12px 16px; border-top: 1px solid var(--border); background: var(--card);
}
.chat-input {
  flex: 1; border: 1.5px solid var(--border); border-radius: 24px;
  padding: 10px 18px; font-family: var(--font); font-size: 0.92rem;
  background: var(--input-bg); color: var(--text); outline: none;
  transition: border-color var(--transition);
}
.chat-input:focus { border-color: var(--primary); }
.chat-input:disabled { opacity: 0.6; }
.chat-send-btn, .chat-clear-btn, .chat-mic-btn {
  flex-shrink: 0; width: 42px; height: 42px; border-radius: 50%;
  cursor: pointer; font-size: 1.05rem; display: flex; align-items: center; justify-content: center;
  transition: var(--transition);
}
.chat-send-btn { background: var(--primary); color: #fff; border: none; }
.chat-send-btn:hover { background: var(--primary-dark); }
.chat-send-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.chat-clear-btn { background: transparent; border: 1.5px solid var(--border); color: var(--text-muted); }
.chat-clear-btn:hover { border-color: var(--primary); color: var(--primary); }
.chat-mic-btn { background: transparent; border: 1.5px solid var(--border); color: var(--text-muted); }
.chat-mic-btn:hover { border-color: var(--primary); color: var(--primary); }
.chat-mic-btn.chat-mic-listening {
  background: #fdecea; border-color: var(--primary); color: var(--primary);
  animation: himPulse 1s ease-in-out infinite alternate;
}

.chat-msg-speak-btn {
  float: right; margin: -2px -4px 4px 8px; background: transparent; border: none;
  color: var(--text-muted); cursor: pointer; font-size: 0.95rem; line-height: 1;
  padding: 2px; border-radius: 50%; transition: var(--transition);
}
.chat-msg-speak-btn:hover { color: var(--primary); background: rgba(0,0,0,0.05); }
.chat-msg-speak-btn.speak-active { color: #27ae60; animation: speakPulse 0.6s ease infinite alternate; }

.chat-empty, .chat-no-key {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 40px 20px; color: var(--text-muted); gap: 10px; height: 100%; flex: 1;
}
.chat-empty-icon, .chat-no-key-icon { font-size: 2.5rem; }
.chat-no-key { min-height: 300px; }
.chat-no-key .btn-primary { margin-top: 6px; }

.chat-msg { display: flex; }
.chat-msg-user { justify-content: flex-end; }
.chat-msg-ai, .chat-msg-error { justify-content: flex-start; }
.chat-bubble { max-width: 75%; padding: 10px 14px; border-radius: 16px; font-size: 0.92rem; line-height: 1.5; }
.chat-bubble-user { background: var(--primary); color: #fff; border-bottom-right-radius: 4px; white-space: pre-wrap; }
.chat-bubble-ai { background: var(--bg); color: var(--text); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.chat-bubble-error { background: rgba(192,57,43,0.08); color: var(--primary); border: 1px solid rgba(192,57,43,0.25); font-size: 0.85rem; }

.chat-line-zh { font-family: var(--font-zh); font-size: 1.1rem; font-weight: 600; }
.chat-line-py { font-size: 0.8rem; color: var(--text-muted); font-style: italic; margin-top: 1px; }
.chat-line-vi { font-size: 0.85rem; color: var(--text-muted); margin-top: 2px; }
.chat-line + .chat-line-zh { margin-top: 10px; }

.chat-typing { display: flex; gap: 4px; align-items: center; padding: 4px 2px; }
.chat-typing span {
  width: 6px; height: 6px; border-radius: 50%; background: var(--text-muted);
  animation: chatTypingBounce 1.2s infinite ease-in-out;
}
.chat-typing span:nth-child(2) { animation-delay: 0.15s; }
.chat-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes chatTypingBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-4px); opacity: 1; }
}

@media (max-width: 600px) {
  .chat-bubble { max-width: 88%; }
  .chat-messages { max-height: 55vh; min-height: 320px; padding: 14px; }
}

.vocab-more { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 16px; margin: 24px 0; color: var(--text-muted); }

/* PDF reading exams */
.exam-source { color:var(--text); font-family:inherit; }
.exam-source img { display:block; width:100%; max-width:780px; height:auto; margin:12px auto; background:white; border-radius:8px; }
.exam-part { font-family:inherit; font-size:15px; font-weight:600; line-height:1.6; }
.exam-source > p { font-family:var(--font-body, sans-serif); font-size:15px; line-height:1.6; }
.exam-zoom-scroll { max-height:75vh; overflow:auto; }
.exam-zoom-scroll img { width:960px; max-width:none; height:auto; background:#fff; }
.exam-source-note { font-size:12px; color:var(--text-muted); }
.exam-controls { display:flex; flex-wrap:wrap; gap:10px; margin:24px 0; }
.exam-controls button:disabled { opacity:.4; cursor:default; }
.ptv2-opt.ptv2-opt-selected { border:2px solid #2980b9; background:#eaf4ff; color:#153a59; }
.exam-question-map { display:grid; grid-template-columns:repeat(auto-fill,minmax(38px,1fr)); gap:7px; margin-top:20px; }
.exam-map-btn { min-height:38px; border:1px solid #aab5c2; border-radius:7px; background:var(--bg-card,#fff); color:var(--text,#222); cursor:pointer; }
.exam-map-btn.answered { background:#dcefe2; color:#174c2b; }
.exam-map-btn.current { outline:3px solid #2980b9; outline-offset:1px; }
.ptv2-ri-ans { display:flex; flex-direction:column; gap:6px; }
.ptv2-ri-exp { white-space:pre-line; line-height:1.7; }
.exam-native-question, .exam-passage, .exam-stimulus { font-family:"Noto Sans TC","Microsoft JhengHei","PingFang TC",sans-serif; font-size:22px; line-height:1.9; font-weight:400; text-align:left; }
.exam-native-question { margin:20px 0; white-space:pre-wrap; }
.exam-passage, .exam-stimulus { padding:20px; border:1px solid var(--border,#dce1e5); border-radius:12px; margin:16px 0; background:var(--bg-card,#fff); white-space:pre-wrap; overflow-wrap:anywhere; }
.exam-stimulus-title { font-size:24px; font-weight:700; margin:0 0 12px; }
.exam-stimulus { white-space:normal; }
.exam-stimulus-text { white-space:pre-line; }
.exam-answer-vi { margin-top:10px; padding:12px 14px; background:var(--bg-card,#f2f7fc); border-left:3px solid #2980b9; border-radius:6px; font-size:16px; line-height:1.8; font-weight:400; }
.page-test-q .ptv2-options:not(.exam-picture-options) .ptv2-opt-text { font-size:20px; line-height:1.8; }
.exam-blank { display:inline-block; padding:0 12px; border-bottom:2px solid currentColor; margin:0 5px; }
.exam-blank-current { background:#fff0b5; color:#5b3b00; border-radius:4px; font-weight:700; }
.exam-insertion-slot { display:inline-block; margin:0 8px; padding:0 12px; border:1px dashed #607d8b; border-radius:5px; color:#334f60; background:#edf4f8; font-weight:700; white-space:nowrap; }
.exam-table-scroll { width:100%; overflow-x:auto; margin:12px 0; white-space:normal; }
.exam-table { border-collapse:collapse; width:100%; font-size:20px; line-height:1.6; }
.exam-table td,.exam-table th { border:1px solid var(--border,#abb5c0); padding:10px 12px; text-align:center; min-width:72px; }
.exam-table th { font-weight:600; }
.exam-picture-options { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:12px; }
.exam-picture-options .ptv2-opt { flex-direction:column; align-items:stretch; padding:12px; }
.exam-picture-options .ptv2-opt-text { width:100%; }
.exam-option-image { display:block; width:100%; height:auto; background:white; }
.exam-review-pictures { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:8px; }
.exam-review-pictures figure { margin:0; }
.exam-review-pictures figcaption { font-size:18px; font-weight:700; }
.exam-source .exam-illustration { max-width:680px; width:auto; max-height:450px; object-fit:contain; }
.exam-source img { max-width:100%; }
@media(max-width:600px) {
 .exam-native-question,.exam-passage,.exam-stimulus { font-size:20px; line-height:1.9; }
 .exam-passage,.exam-stimulus { padding:14px; }
 .exam-table { font-size:18px; }
 .exam-picture-options { grid-template-columns:1fr; }
 .exam-option-image { max-width:300px; margin:auto; }
 .exam-source .exam-illustration { width:100%; height:auto; }
}
.exam-audio { display:block; width:100%; max-width:600px; margin:14px 0; }
.exam-transcript { margin:14px 0; }
.exam-transcript summary { cursor:pointer; font-weight:600; }
.exam-transcript div { white-space:pre-wrap; font-size:20px; line-height:1.9; margin-top:12px; }
.exam-audio-track-buttons { display:flex; flex-wrap:wrap; gap:8px; margin-top:12px; }
.exam-audio-track-buttons .exam-track-active { background:#dff2e6; border-color:#219653; color:#145a32; }
.exam-audio-sequence,.exam-listening-group { font-size:15px; line-height:1.6; margin:12px 0; }
.exam-review-question { font-size:20px; line-height:1.8; }

/* Context examples stay readable on both flashcard surfaces. */
.fc-ex-source { font-size: .75rem; color: #657080; margin-bottom: 8px; }
.fc-example { box-sizing: border-box; cursor: default; }
.fc-example .fc-ex-zh { color: #263442; line-height: 1.8; overflow-wrap: anywhere; }
.fc-ex-zh strong { color: #8e44ad; font-weight: 800; }
.fc-example .fc-ex-vn { color: #526171; line-height: 1.65; }
.fc-ex-py { color: #657080; font-size: .85rem; line-height: 1.6; margin: 6px 0; }

/* Lesson grammar: explanation, concise bilingual examples and scene illustration. */
.gc-body { min-width: 0; }
.gc-explanation { margin: 18px 0; line-height: 1.8; }
.gc-explanation h4, .gc-examples h4 { font-size: .92rem; margin: 0 0 10px; color: var(--text); }
.gc-explanation p { margin: 0 0 10px; white-space: pre-line; overflow-wrap: anywhere; }
.gc-extra-tip { border-left: 3px solid var(--primary); padding: 8px 12px; background: var(--bg); border-radius: 0 8px 8px 0; }
.gc-glossary { font-size: .85rem; line-height: 1.7; color: var(--text-muted); margin: 10px 0; }
.gc-glossary summary { cursor: pointer; color: var(--primary); font-weight: 600; }
.gc-glossary ul { padding-left: 20px; margin: 8px 0; }
.gc-examples ol { padding-left: 24px; margin: 0; }
.gc-examples .gc-example { padding: 14px 16px; margin-bottom: 12px; overflow-wrap: anywhere; }
.gc-examples li::marker { font-weight: 700; color: var(--primary); }
.gc-example-label { display: block; color: var(--text-muted); font-size: .74rem; margin: 5px 0; }
.gc-speak { background: none; border: 1px solid var(--border); border-radius: 50%; padding: 5px; cursor: pointer; vertical-align: middle; }
.gc-speak:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.gc-illustration { display: grid; grid-template-columns: minmax(140px, 240px) minmax(0, 1fr); align-items: center; gap: 18px; margin: 20px 0 0; padding: 14px; background: var(--bg); border-radius: 12px; }
.gc-scene { width: 100%; aspect-ratio: 1; border-radius: 10px; background-image: url('../icons/grammar/situations.png'); background-size: 400% 300%; background-repeat: no-repeat; }
.gc-pattern code { white-space: normal; overflow-wrap: anywhere; }
.gc-flow { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; margin: 12px 0; }
.gc-flow-part { max-width: 100%; overflow-wrap: anywhere; padding: 7px 10px; background: var(--bg); border: 1px solid var(--border); border-radius: 8px; font-size: .84rem; }
.gc-flow-arrow { color: var(--primary); font-weight: 700; }
.gc-more-examples summary { color: var(--primary); cursor: pointer; font-size: .85rem; margin: 12px 0; }

/* Grammar practice inside each lesson's Exercises tab. */
.gp-lesson { min-width: 0; padding: 8px 0; }
.gp-lesson h3, .gp-custom-title { font-size: 1rem; margin: 10px 0; color: var(--text); }
.gp-intro, .gp-empty, .gp-session-note { color: var(--text-muted); font-size: .86rem; line-height: 1.7; margin: 8px 0 14px; }
.gp-group { margin: 12px 0; border: 1px solid var(--border); border-radius: 12px; background: var(--card); overflow: hidden; }
.gp-group > summary { cursor: pointer; padding: 16px; color: var(--text); font-weight: 650; line-height: 1.65; overflow-wrap: anywhere; }
.gp-group > summary:focus-visible { outline: 2px solid var(--primary); outline-offset: -3px; }
.gp-group-label { display: block; color: var(--text-muted); font-size: .76rem; margin-left: 18px; font-weight: 400; }
.gp-group[open] > summary { border-bottom: 1px solid var(--border); background: var(--bg); }
.gp-group-body { padding: 0 16px; }
.gp-summary-group { border: 2px solid var(--primary); margin-top: 24px; }
.gp-summary-group > summary { color: var(--primary); }
.gp-session { padding: 12px 0; }
.gp-progress { padding: 10px 12px; background: var(--bg); border-radius: 8px; color: var(--primary); font-size: .86rem; font-weight: 650; }
.gp-question { padding: 18px 0; border-bottom: 1px solid var(--border); min-width: 0; }
.gp-question-heading { display: flex; flex-direction: column; gap: 5px; margin-bottom: 10px; }
.gp-question-heading > span { font-size: .8rem; color: var(--text-muted); }
.gp-pattern { background: var(--bg); padding: 8px 10px; border-radius: 8px; font-size: .82rem; line-height: 1.6; overflow-wrap: anywhere; }
.gp-question-instruction { font-size: .9rem; line-height: 1.65; margin: 12px 0 8px; }
.gp-sentence { font-family: var(--font-zh); font-size: 1.15rem; line-height: 1.9; margin: 8px 0; overflow-wrap: anywhere; }
.gp-translation { font-size: .88rem; color: var(--text-muted); line-height: 1.7; margin: 8px 0; }
.gp-answer-form > label { display: block; font-size: .8rem; color: var(--text-muted); margin: 12px 0 6px; }
.gp-input-row { display: flex; align-items: stretch; gap: 8px; }
.gp-input-row input { flex: 1; min-width: 0; width: auto; }
.gp-input-row button { flex-shrink: 0; }
.gp-selected, .gp-tile-bank { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; margin: 10px 0; }
.gp-selected { min-height: 64px; padding: 10px; background: var(--bg); border: 1px dashed var(--primary); border-radius: 10px; }
.gp-selected > span { font-size: .8rem; color: var(--text-muted); }
.gp-tile { padding: 9px 12px; min-height: 42px; border: 1px solid var(--border); border-radius: 8px; background: var(--card); color: var(--text); font-family: var(--font-zh); font-size: 1rem; cursor: pointer; overflow-wrap: anywhere; max-width: 100%; }
.gp-tile:disabled { opacity: .35; cursor: default; }
.gp-selected .gp-tile:disabled { opacity: 1; }
.gp-tile:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.gp-check { margin-top: 4px; }
.gp-validation { font-size: .84rem; color: var(--primary); margin-top: 8px; }
.gp-feedback { border-left: 3px solid; background: var(--bg); padding: 12px; border-radius: 0 8px 8px 0; line-height: 1.75; font-size: .87rem; overflow-wrap: anywhere; }
.gp-feedback p { margin: 8px 0; }
.gp-feedback:focus { outline: 2px solid var(--primary); outline-offset: 2px; }
.gp-correct { border-color: #21894e; }
.gp-wrong { border-color: #c0392b; }
.gp-result-box { padding: 18px 0 6px; line-height: 1.7; }
.gp-result-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.gp-result-actions > span { color: var(--primary); font-size: .9rem; }
@media (max-width: 600px) {
  .gp-group > summary { padding: 12px; }
  .gp-group-body { padding: 0 12px; }
  .gp-input-row { flex-direction: column; }
  .gp-tile { padding: 8px 10px; }
}
@media (max-width: 600px) {
  .gc-illustration { grid-template-columns: 1fr; gap: 10px; }
  .gc-scene { max-width: 300px; margin: 0 auto; }
  .gc-examples .gc-example { padding: 12px; }
}
.textbook-vocab-summary {
  margin: 0 0 12px;
  color: var(--text-muted, #666);
  font-size: 0.85rem;
  line-height: 1.6;
}
