/* ========== CSS Variables / Theme ========== */
:root {
  --primary: #C8102E;
  --primary-light: #e8354d;
  --primary-dark: #a00d24;
  --secondary: #1E3A5F;
  --secondary-light: #2a5080;
  --accent: #F59E0B;
  --success: #10B981;
  --warning: #F59E0B;
  --danger: #EF4444;
  --info: #3B82F6;

  --bg: #f5f7fa;
  --bg-card: #ffffff;
  --bg-card-hover: #f8fafc;
  --bg-nav: rgba(255,255,255,0.92);
  --bg-code: #f1f5f9;
  --text: #1e293b;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;
  --border: #e2e8f0;
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 25px rgba(0,0,0,0.1);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-xs: 4px;
  --transition: 0.25s ease;
}

[data-theme="dark"] {
  --bg: #0f172a;
  --bg-card: #1e293b;
  --bg-card-hover: #263348;
  --bg-nav: rgba(15,23,42,0.95);
  --bg-code: #334155;
  --text: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --border: #334155;
  --shadow: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.3);
  --shadow-lg: 0 10px 25px rgba(0,0,0,0.4);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans SC", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  transition: background var(--transition), color var(--transition);
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

button {
  cursor: pointer;
  border: none;
  background: none;
  font-family: inherit;
  font-size: inherit;
}

/* ========== Navbar ========== */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  height: 60px;
  background: var(--bg-nav);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  flex-shrink: 0;
}

.nav-logo { font-size: 24px; }
.nav-title { font-weight: 700; font-size: 16px; color: var(--text); white-space: nowrap; }

.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav-link {
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all var(--transition);
  text-decoration: none;
  white-space: nowrap;
}

.nav-link:hover {
  color: var(--primary);
  background: rgba(200,16,46,0.06);
  text-decoration: none;
}

.nav-link.active {
  color: var(--primary);
  background: rgba(200,16,46,0.1);
  font-weight: 600;
}

.nav-actions { display: flex; align-items: center; gap: 8px; }

.theme-toggle {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 18px;
  transition: background var(--transition);
}
.theme-toggle:hover { background: rgba(0,0,0,0.06); }

.nav-hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  padding: 8px;
}
.nav-hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: all var(--transition);
}

/* ========== Main Content ========== */
.main-content {
  max-width: 1100px;
  margin: 0 auto;
  padding: 80px 20px 40px;
  min-height: calc(100vh - 60px);
}

/* ========== Footer ========== */
.footer {
  text-align: center;
  padding: 24px;
  color: var(--text-muted);
  font-size: 13px;
  border-top: 1px solid var(--border);
}

/* ========== Timer Widget ========== */
.timer-widget {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 50px;
  box-shadow: var(--shadow-md);
  z-index: 999;
  transition: all var(--transition);
}

.timer-display {
  display: flex;
  align-items: center;
  gap: 6px;
}
.timer-icon { font-size: 16px; }
.timer-time { font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--text); min-width: 64px; }

.timer-btn {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 14px;
  color: var(--text-secondary);
  transition: all var(--transition);
}
.timer-btn:hover { background: rgba(0,0,0,0.06); color: var(--primary); }

/* ========== Cards ========== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  transition: all var(--transition);
}
.card:hover { box-shadow: var(--shadow-md); }

.card-clickable { cursor: pointer; }
.card-clickable:hover { transform: translateY(-2px); border-color: var(--primary); }

/* ========== Section Headers ========== */
.section-header {
  margin-bottom: 28px;
}
.section-header h1 {
  font-size: 28px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 6px;
}
.section-header p {
  color: var(--text-secondary);
  font-size: 15px;
}

/* ========== Badge / Tag ========== */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 50px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.4;
}
.badge-easy { background: rgba(16,185,129,0.12); color: #059669; }
.badge-medium { background: rgba(245,158,11,0.12); color: #d97706; }
.badge-hard { background: rgba(239,68,68,0.12); color: #dc2626; }
.badge-info { background: rgba(59,130,246,0.12); color: #2563eb; }

/* ========== Progress Ring ========== */
.progress-ring-container {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.progress-ring-container .progress-text {
  position: absolute;
  font-size: 20px;
  font-weight: 800;
  color: var(--text);
}
.progress-ring { transform: rotate(-90deg); }
.progress-ring-bg { fill: none; stroke: var(--border); }
.progress-ring-fill {
  fill: none;
  stroke: var(--primary);
  stroke-linecap: round;
  transition: stroke-dashoffset 0.8s ease;
}

/* ========== Grid Layouts ========== */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid-5 { display: grid; grid-template-columns: repeat(5, 1fr); gap: 16px; }

/* ========== Home Page ========== */
.home-hero {
  text-align: center;
  padding: 40px 0 32px;
}
.home-hero h1 {
  font-size: 36px;
  font-weight: 900;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 8px;
}
.home-hero .subtitle { color: var(--text-secondary); font-size: 16px; }

.countdown-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 20px 0;
  padding: 14px 24px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border-radius: var(--radius);
  color: #fff;
}
.countdown-bar .countdown-num {
  font-size: 32px;
  font-weight: 900;
  line-height: 1;
}
.countdown-bar .countdown-label { font-size: 14px; opacity: 0.9; }

.stats-row {
  display: flex;
  justify-content: center;
  gap: 40px;
  margin: 24px 0;
}
.stat-item { text-align: center; }
.stat-value { font-size: 28px; font-weight: 800; color: var(--primary); }
.stat-label { font-size: 13px; color: var(--text-muted); margin-top: 2px; }

.type-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 20px;
}
.type-card-icon { font-size: 36px; }
.type-card-title { font-size: 16px; font-weight: 700; }
.type-card-desc { font-size: 13px; color: var(--text-secondary); line-height: 1.5; }
.type-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
}
.type-card-progress {
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  flex: 1;
  margin-right: 8px;
  overflow: hidden;
}
.type-card-progress-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 2px;
  transition: width 0.5s ease;
}
.type-card-pct { font-size: 12px; font-weight: 600; color: var(--text-muted); }

/* Day plan cards */
.day-cards { display: grid; grid-template-columns: repeat(7, 1fr); gap: 10px; margin: 24px 0; }
.day-card {
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 10px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
}
.day-card:hover { border-color: var(--primary); transform: translateY(-2px); }
.day-card.active { border-color: var(--primary); background: rgba(200,16,46,0.04); }
.day-card.completed { border-color: var(--success); }
.day-card .day-num { font-size: 13px; font-weight: 700; color: var(--primary); }
.day-card .day-label { font-size: 11px; color: var(--text-muted); margin-top: 4px; }
.day-card .day-status { font-size: 18px; margin-top: 6px; }

/* ========== Module Pages (shared) ========== */
.module-page { animation: fadeIn 0.3s ease; }

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

.module-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 24px;
  border-bottom: 2px solid var(--border);
  padding-bottom: 0;
}
.module-tab {
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all var(--transition);
  cursor: pointer;
}
.module-tab:hover { color: var(--text); }
.module-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.module-content { animation: fadeIn 0.25s ease; }

/* ========== Knowledge / Tips Cards ========== */
.tip-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
}
.tip-card h3 {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.tip-card ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.tip-card li {
  padding-left: 20px;
  position: relative;
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
}
.tip-card li::before {
  content: "▸";
  position: absolute;
  left: 0;
  color: var(--primary);
  font-weight: 700;
}

/* ========== Question / Practice ========== */
.question-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
  transition: all var(--transition);
}
.question-card.answered-correct { border-color: var(--success); }
.question-card.answered-wrong { border-color: var(--danger); }

.question-num {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.question-stem {
  font-size: 15px;
  line-height: 1.7;
  margin-bottom: 16px;
  color: var(--text);
}
.question-stem .blank {
  display: inline-block;
  min-width: 80px;
  border-bottom: 2px solid var(--primary);
  margin: 0 4px;
}

.options-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.option-btn {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  text-align: left;
  transition: all var(--transition);
  cursor: pointer;
}
.option-btn:hover:not(.disabled) {
  border-color: var(--primary);
  background: rgba(200,16,46,0.03);
}

.option-label {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--bg-code);
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
}

.option-btn.selected { border-color: var(--primary); background: rgba(200,16,46,0.06); }
.option-btn.selected .option-label { background: var(--primary); color: #fff; }
.option-btn.correct { border-color: var(--success); background: rgba(16,185,129,0.06); }
.option-btn.correct .option-label { background: var(--success); color: #fff; }
.option-btn.wrong { border-color: var(--danger); background: rgba(239,68,68,0.06); }
.option-btn.wrong .option-label { background: var(--danger); color: #fff; }
.option-btn.disabled { pointer-events: none; opacity: 0.85; }
.option-btn.show-correct { border-color: var(--success); }
.option-btn.show-correct .option-label { background: var(--success); color: #fff; }

.explanation {
  margin-top: 14px;
  padding: 14px 16px;
  background: var(--bg-code);
  border-radius: var(--radius-sm);
  font-size: 13px;
  line-height: 1.7;
  color: var(--text-secondary);
  animation: fadeIn 0.3s ease;
}
.explanation strong { color: var(--text); }

/* ========== Practice Summary ========== */
.practice-summary {
  background: var(--bg-card);
  border: 2px solid var(--primary);
  border-radius: var(--radius);
  padding: 32px;
  text-align: center;
  animation: fadeIn 0.4s ease;
}
.practice-summary h2 { font-size: 24px; margin-bottom: 16px; }
.practice-summary .score {
  font-size: 48px;
  font-weight: 900;
  color: var(--primary);
}
.practice-summary .score-label { font-size: 14px; color: var(--text-muted); }

/* ========== Translation Practice ========== */
.translation-input {
  width: 100%;
  min-height: 100px;
  padding: 14px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 14px;
  line-height: 1.7;
  color: var(--text);
  background: var(--bg-card);
  resize: vertical;
  transition: border-color var(--transition);
}
.translation-input:focus { outline: none; border-color: var(--primary); }

.reference-answer {
  margin-top: 16px;
  padding: 16px;
  background: rgba(16,185,129,0.06);
  border: 1px solid rgba(16,185,129,0.2);
  border-radius: var(--radius-sm);
  animation: fadeIn 0.3s ease;
}
.reference-answer h4 {
  font-size: 13px;
  font-weight: 700;
  color: var(--success);
  margin-bottom: 8px;
}
.reference-answer p {
  font-size: 14px;
  line-height: 1.7;
}

.key-points {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.key-point {
  padding: 3px 10px;
  background: rgba(59,130,246,0.1);
  color: var(--info);
  border-radius: 50px;
  font-size: 12px;
  font-weight: 600;
}

/* ========== Writing Practice ========== */
.writing-area {
  width: 100%;
  min-height: 220px;
  padding: 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 14px;
  line-height: 1.8;
  color: var(--text);
  background: var(--bg-card);
  resize: vertical;
  transition: border-color var(--transition);
}
.writing-area:focus { outline: none; border-color: var(--primary); }

.word-count {
  text-align: right;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 6px;
}

.model-essay {
  margin-top: 16px;
  padding: 20px;
  background: var(--bg-code);
  border-radius: var(--radius-sm);
  font-size: 14px;
  line-height: 1.9;
}
.model-essay h4 {
  font-size: 14px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 10px;
}

/* ========== Reading Passage ========== */
.reading-passage {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
  font-size: 15px;
  line-height: 1.9;
}
.reading-passage h3 {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--primary);
}
.reading-passage p { margin-bottom: 12px; color: var(--text); }

/* ========== Cloze Passage ========== */
.cloze-passage {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
  font-size: 15px;
  line-height: 2.2;
}
.cloze-blank {
  display: inline-block;
  min-width: 90px;
  text-align: center;
  border-bottom: 2px solid var(--primary);
  margin: 0 2px;
  font-weight: 700;
  color: var(--primary);
  cursor: pointer;
  transition: all var(--transition);
}
.cloze-blank:hover { background: rgba(200,16,46,0.06); }
.cloze-blank.filled { color: var(--secondary); }
.cloze-blank.correct-fill { color: var(--success); border-color: var(--success); }
.cloze-blank.wrong-fill { color: var(--danger); border-color: var(--danger); }

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

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

.btn-secondary {
  background: var(--secondary);
  color: #fff;
}
.btn-secondary:hover { background: var(--secondary-light); }

.btn-outline {
  background: transparent;
  color: var(--primary);
  border: 2px solid var(--primary);
}
.btn-outline:hover { background: rgba(200,16,46,0.06); }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}
.btn-ghost:hover { background: rgba(0,0,0,0.04); color: var(--text); }

.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn-lg { padding: 14px 32px; font-size: 16px; }

.btn-group {
  display: flex;
  gap: 10px;
  margin-top: 20px;
  flex-wrap: wrap;
}

/* ========== Review / Wrong Answers ========== */
.review-empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
.review-empty .review-empty-icon { font-size: 48px; margin-bottom: 16px; }

.review-filters {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.filter-btn {
  padding: 6px 16px;
  border: 1px solid var(--border);
  border-radius: 50px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--bg-card);
  cursor: pointer;
  transition: all var(--transition);
}
.filter-btn:hover { border-color: var(--primary); color: var(--primary); }
.filter-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ========== Vocabulary List ========== */
.vocab-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}
.vocab-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  transition: all var(--transition);
}
.vocab-item:hover { border-color: var(--primary); }
.vocab-word { font-size: 16px; font-weight: 700; color: var(--primary); }
.vocab-speak-btn {
  width: 26px; height: 26px; display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%; font-size: 14px; cursor: pointer; border: 1px solid var(--border);
  background: var(--bg-code); transition: all var(--transition); flex-shrink: 0; padding: 0;
}
.vocab-speak-btn:hover { background: var(--primary); border-color: var(--primary); transform: scale(1.1); }
.vocab-phonetic { font-size: 12px; color: var(--text-muted); }
.vocab-meaning { font-size: 13px; color: var(--text-secondary); margin-top: 4px; }
.vocab-example { font-size: 12px; color: var(--text-muted); margin-top: 6px; font-style: italic; }

/* ========== Grammar Cards ========== */
.grammar-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 14px;
}
.grammar-card h4 {
  font-size: 15px;
  font-weight: 700;
  color: var(--secondary);
  margin-bottom: 10px;
}
.grammar-card .grammar-rule {
  padding: 10px 14px;
  background: var(--bg-code);
  border-radius: var(--radius-xs);
  font-size: 14px;
  line-height: 1.6;
  margin-bottom: 8px;
}
.grammar-card .grammar-plain {
  padding: 12px 14px;
  margin-bottom: 10px;
  background: rgba(245,158,11,0.06);
  border-radius: var(--radius-xs);
  font-size: 14px;
  line-height: 1.8;
  color: var(--text);
  border-left: 3px solid var(--accent);
}
.grammar-card .grammar-examples {
  font-size: 13px;
  color: var(--text-secondary);
}
.grammar-card .grammar-examples span {
  color: var(--primary);
  font-weight: 600;
}

/* ========== Template Section ========== */
.template-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 14px;
}
.template-card h4 {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--secondary);
}
.template-content {
  padding: 14px;
  background: var(--bg-code);
  border-radius: var(--radius-xs);
  font-size: 14px;
  line-height: 1.8;
  white-space: pre-line;
}
.template-content .highlight {
  background: rgba(245,158,11,0.15);
  padding: 1px 4px;
  border-radius: 3px;
  font-weight: 600;
}

/* ========== Pagination / Navigation ========== */
.practice-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}
.practice-progress-text {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 600;
}

/* ========== Responsive ========== */
@media (max-width: 768px) {
  .nav-links { 
    display: none;
    position: absolute;
    top: 60px;
    left: 0;
    right: 0;
    flex-direction: column;
    background: var(--bg-nav);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    padding: 8px;
  }
  .nav-links.open { display: flex; }
  .nav-hamburger { display: flex; }

  .home-hero h1 { font-size: 26px; }
  .day-cards { grid-template-columns: repeat(4, 1fr); }
  .grid-2, .grid-3, .grid-5 { grid-template-columns: 1fr; }
  .stats-row { gap: 24px; }
  .stat-value { font-size: 22px; }

  .main-content { padding: 70px 14px 30px; }
  .countdown-bar .countdown-num { font-size: 24px; }

  .module-tabs { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .module-tab { white-space: nowrap; }

  .timer-widget { bottom: 14px; right: 14px; }
}

@media (max-width: 480px) {
  .day-cards { grid-template-columns: repeat(3, 1fr); }
  .nav-title { font-size: 14px; }
}

/* ========== Scrollbar ========== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--text-muted); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-secondary); }

/* ========== Selection ========== */
::selection {
  background: rgba(200,16,46,0.15);
  color: var(--text);
}

/* ========== Summary Page ========== */
.summary-page { animation: fadeIn 0.4s ease; }

.summary-header {
  text-align: center;
  padding: 32px 0 24px;
}
.summary-emoji { font-size: 56px; margin-bottom: 12px; }
.summary-header h2 { font-size: 24px; font-weight: 800; }
.summary-subtitle { color: var(--text-secondary); font-size: 15px; margin-top: 8px; max-width: 480px; margin-left: auto; margin-right: auto; line-height: 1.6; }

.summary-score-card {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 48px;
  padding: 28px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 28px;
}
.summary-score-details {
  display: flex;
  gap: 32px;
}
.summary-stat { text-align: center; }
.summary-stat-num { display: block; font-size: 32px; font-weight: 900; }
.summary-stat-label { font-size: 13px; color: var(--text-muted); margin-top: 2px; }

.summary-section { margin-bottom: 28px; }
.summary-section h3 { font-size: 18px; font-weight: 800; margin-bottom: 8px; }
.summary-intro { color: var(--text-secondary); font-size: 14px; margin-bottom: 16px; line-height: 1.6; }

.summary-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}

/* Weak point cards */
.weak-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 4px solid var(--danger);
  border-radius: var(--radius-sm);
  padding: 18px;
  margin-bottom: 12px;
  transition: all var(--transition);
}
.weak-card:hover { box-shadow: var(--shadow-md); }

.weak-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.weak-card-icon { font-size: 24px; }
.weak-card-title { flex: 1; }
.weak-card-title strong { font-size: 15px; display: block; }
.weak-card-count { font-size: 12px; color: var(--danger); font-weight: 600; }

.weak-card-desc {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 10px;
}
.weak-card-tip {
  font-size: 13px;
  color: var(--text);
  line-height: 1.7;
  padding: 10px 14px;
  background: rgba(245,158,11,0.06);
  border-radius: var(--radius-xs);
}

/* Note cards (collapsible) */
.note-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
  overflow: hidden;
}
.note-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: background var(--transition);
}
.note-card-header:hover { background: var(--bg-card-hover); }
.note-card-toggle {
  font-size: 12px;
  color: var(--text-muted);
  transition: transform var(--transition);
}
.note-card.open .note-card-toggle { transform: rotate(180deg); }

.note-card-body {
  display: none;
  padding: 0 18px 18px;
}
.note-card.open .note-card-body { display: block; animation: fadeIn 0.3s ease; }

.note-content {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans SC", monospace;
  font-size: 13px;
  line-height: 1.8;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text);
  background: var(--bg-code);
  padding: 16px;
  border-radius: var(--radius-xs);
  overflow-x: auto;
}

/* ========== Notebook Page ========== */
.notebook-empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
.notebook-empty-icon { font-size: 48px; margin-bottom: 16px; }

.notebook-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 14px;
  overflow: hidden;
  transition: all var(--transition);
}
.notebook-item:hover { box-shadow: var(--shadow-md); }

.notebook-item-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  cursor: pointer;
  transition: background var(--transition);
}
.notebook-item-header:hover { background: var(--bg-card-hover); }

.notebook-item-icon { font-size: 28px; }
.notebook-item-info { flex: 1; }
.notebook-item-name { font-size: 16px; font-weight: 700; }
.notebook-item-module { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.notebook-item-desc { font-size: 13px; color: var(--text-secondary); margin-top: 4px; line-height: 1.5; }

.notebook-item-actions {
  display: flex;
  gap: 6px;
}
.notebook-item-toggle {
  font-size: 12px;
  color: var(--text-muted);
  padding: 4px 8px;
}

.notebook-item-body {
  display: none;
  padding: 0 20px 20px;
  border-top: 1px solid var(--border);
}
.notebook-item.open .notebook-item-body { display: block; animation: fadeIn 0.3s ease; }

.notebook-item-tip {
  padding: 12px 16px;
  background: rgba(245,158,11,0.06);
  border-radius: var(--radius-xs);
  font-size: 13px;
  line-height: 1.7;
  margin-bottom: 12px;
  color: var(--text);
}

@media (max-width: 768px) {
  .summary-score-card { flex-direction: column; gap: 20px; }
  .summary-score-details { gap: 24px; }
  .summary-stat-num { font-size: 24px; }
  .weak-card-header { flex-wrap: wrap; }
}

/* ========== Wordbook Page ========== */
.wb-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.wb-search { position: relative; flex: 1; max-width: 400px; }
.wb-search-input {
  width: 100%;
  padding: 10px 36px 10px 14px;
  border: 2px solid var(--border);
  border-radius: 50px;
  font-size: 14px;
  background: var(--bg-card);
  color: var(--text);
  transition: border-color var(--transition);
  font-family: inherit;
}
.wb-search-input:focus { outline: none; border-color: var(--primary); }
.wb-search-input::placeholder { color: var(--text-muted); }
.wb-search-clear {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 22px; height: 22px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px;
  color: var(--text-muted);
  background: var(--bg-code);
  cursor: pointer; border: none;
}
.wb-count { font-size: 13px; color: var(--text-muted); white-space: nowrap; }

.wb-letter-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 20px;
  padding: 12px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  position: sticky;
  top: 60px;
  z-index: 50;
}
.wb-letter-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px; height: 32px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-secondary);
  text-decoration: none;
  transition: all var(--transition);
}
.wb-letter-link:hover { background: rgba(200,16,46,0.08); color: var(--primary); text-decoration: none; }
.wb-letter-link.active { background: var(--primary); color: #fff; }

.wb-group { margin-bottom: 24px; }
.wb-group-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--primary);
}
.wb-group-letter {
  font-size: 28px;
  font-weight: 900;
  color: var(--primary);
  line-height: 1;
}
.wb-group-count { font-size: 12px; color: var(--text-muted); }

.wb-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  overflow: hidden;
  transition: all var(--transition);
}
.wb-card:hover { border-color: var(--primary); box-shadow: var(--shadow); }
.wb-card.expanded { border-color: var(--primary); box-shadow: var(--shadow-md); }

.wb-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  cursor: pointer;
  transition: background var(--transition);
}
.wb-card-header:hover { background: var(--bg-card-hover); }

.wb-card-main {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  min-width: 200px;
}
.wb-word { font-size: 16px; font-weight: 700; color: var(--primary); }
.wb-phonetic { font-size: 12px; color: var(--text-muted); }
.wb-meaning { flex: 1; font-size: 13px; color: var(--text-secondary); }
.wb-card-arrow { font-size: 12px; color: var(--text-muted); flex-shrink: 0; }

.wb-card-body {
  padding: 0 16px 16px;
  border-top: 1px solid var(--border);
  animation: fadeIn 0.25s ease;
}

.wb-section { margin-top: 14px; }
.wb-section-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.wb-example-en {
  font-size: 14px;
  color: var(--text);
  line-height: 1.6;
  font-style: italic;
}
.wb-example-zh {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.wb-collocations {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.wb-collocation-tag {
  display: inline-block;
  padding: 4px 12px;
  background: rgba(59,130,246,0.08);
  color: var(--info);
  border-radius: 50px;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.4;
}

.wb-memory {
  font-size: 14px;
  line-height: 1.7;
  color: var(--text);
  padding: 10px 14px;
  background: rgba(245,158,11,0.06);
  border-radius: var(--radius-xs);
  border-left: 3px solid var(--accent);
}

@media (max-width: 768px) {
  .wb-card-header { flex-wrap: wrap; }
  .wb-card-main { min-width: unset; }
  .wb-meaning { width: 100%; margin-top: 4px; }
  .wb-toolbar { flex-direction: column; align-items: stretch; }
  .wb-search { max-width: 100%; }
  .wb-letter-link { width: 28px; height: 28px; font-size: 12px; }
}

/* ========== Print-friendly ========== */
@media print {
  .navbar, .footer, .timer-widget { display: none !important; }
  .main-content { padding-top: 0; }
}
