/* ============================================================
   CNL Learning Theme — Design System
   Palette: Đỏ chủ đạo #E53935, Tím accent #7B61FF, Xanh xám nền
   Font: Be Vietnam Pro (UI) + Noto Sans SC (chữ Hán)
   ============================================================ */

/* ── CSS Variables ─────────────────────────────────────────── */
:root {
  /* Brand */
  --cnl-red:       #E53935;
  --cnl-red-light: #FFEBEE;
  --cnl-red-dark:  #C62828;
  --cnl-purple:    #7B61FF;
  --cnl-purple-light: #EDE9FF;

  /* HSK level colors */
  --hsk1: #4CAF50;
  --hsk2: #2196F3;
  --hsk3: #9C27B0;
  --hsk4: #FF9800;
  --hsk5: #F44336;
  --hsk6: #212121;

  /* Neutrals */
  --cnl-gray-50:  #F8F9FA;
  --cnl-gray-100: #F1F3F4;
  --cnl-gray-200: #E8EAED;
  --cnl-gray-300: #DADCE0;
  --cnl-gray-400: #BDC1C6;
  --cnl-gray-500: #9AA0A6;
  --cnl-gray-600: #80868B;
  --cnl-gray-700: #5F6368;
  --cnl-gray-800: #3C4043;
  --cnl-gray-900: #202124;

  /* Typography */
  --font-ui:   'Be Vietnam Pro', sans-serif;
  --font-zh:   'Noto Sans SC', sans-serif;

  /* Spacing */
  --space-xs:  4px;
  --space-sm:  8px;
  --space-md:  16px;
  --space-lg:  24px;
  --space-xl:  40px;
  --space-2xl: 64px;

  /* Radius */
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  /* Shadow */
  --shadow-sm: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,.08), 0 2px 4px rgba(0,0,0,.05);
  --shadow-lg: 0 8px 24px rgba(0,0,0,.10), 0 4px 8px rgba(0,0,0,.06);

  /* Header */
  --header-h: 64px;
}

/* ── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.6;
  color: var(--cnl-gray-900);
  background: #fff;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
input, textarea, select { font-family: inherit; }

/* ── Layout helpers ─────────────────────────────────────────── */
.container {
  width: min(1200px, 100% - 2rem);
  margin-inline: auto;
}
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-lg); }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-lg); }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-md); }
.flex    { display: flex; }
.flex-center { display: flex; align-items: center; gap: var(--space-sm); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }

/* ── Buttons ────────────────────────────────────────────────── */
.cnl-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: var(--radius-full);
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
  transition: all .2s ease;
  white-space: nowrap;
}
.cnl-btn--primary {
  background: var(--cnl-red);
  color: #fff;
}
.cnl-btn--primary:hover { background: var(--cnl-red-dark); }
.cnl-btn--purple {
  background: var(--cnl-purple);
  color: #fff;
}
.cnl-btn--purple:hover { filter: brightness(1.1); }
.cnl-btn--ghost {
  background: transparent;
  color: var(--cnl-gray-700);
  border: 1.5px solid var(--cnl-gray-300);
}
.cnl-btn--ghost:hover { border-color: var(--cnl-red); color: var(--cnl-red); }
.cnl-btn--outline-primary {
  background: transparent;
  color: var(--cnl-red);
  border: 1.5px solid var(--cnl-red);
}
.cnl-btn--outline-primary:hover { background: var(--cnl-red); color: #fff; }
.cnl-btn--sm { padding: 7px 14px; font-size: 13px; }
.cnl-btn--lg { padding: 14px 28px; font-size: 16px; }
.cnl-btn--icon-only { padding: 10px; }
.cnl-btn--block { width: 100%; }

/* ── Header ─────────────────────────────────────────────────── */
.cnl-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: #fff;
  border-bottom: 1px solid var(--cnl-gray-200);
  height: var(--header-h);
}
.cnl-header__inner {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
  height: 100%;
}

/* Logo */
.cnl-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  flex-shrink: 0;
}
.cnl-logo__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: var(--cnl-red);
  color: #fff;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 700;
  font-family: var(--font-zh);
}
.cnl-logo__text strong { display: block; font-size: 15px; color: var(--cnl-gray-900); }
.cnl-logo__text small  { display: block; font-size: 11px; color: var(--cnl-gray-500); }

/* Nav */
.cnl-nav { flex: 1; }
.cnl-nav__list {
  display: flex;
  align-items: center;
  gap: 2px;
}
.cnl-nav__link {
  display: block;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  color: var(--cnl-gray-700);
  transition: all .15s;
  position: relative;
}
.cnl-nav__link:hover,
.cnl-nav__link.active {
  color: var(--cnl-red);
}
.cnl-nav__link.active::after {
  content: '';
  position: absolute;
  bottom: -17px;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  height: 2px;
  background: var(--cnl-red);
}

/* Header actions */
.cnl-header__actions {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex-shrink: 0;
}
.cnl-header__icon-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  color: var(--cnl-gray-700);
  transition: background .15s;
  font-size: 18px;
}
.cnl-header__icon-btn:hover { background: var(--cnl-gray-100); }
.cnl-badge {
  position: absolute;
  top: 0; right: 0;
  width: 16px; height: 16px;
  background: var(--cnl-red);
  color: #fff;
  border-radius: var(--radius-full);
  font-size: 10px;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}

/* User menu */
.cnl-user-menu { position: relative; }
.cnl-user-menu__trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px 4px 4px;
  border-radius: var(--radius-full);
  border: 1.5px solid var(--cnl-gray-200);
  font-size: 13px;
  font-weight: 500;
  transition: border-color .15s;
}
.cnl-user-menu__trigger:hover { border-color: var(--cnl-red); }
.cnl-user-menu__avatar { border-radius: 50%; object-fit: cover; }
.cnl-user-menu__dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 220px;
  background: #fff;
  border: 1px solid var(--cnl-gray-200);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 6px;
  display: none;
  z-index: 100;
}
.cnl-user-menu:hover .cnl-user-menu__dropdown { display: block; }
.cnl-user-menu__dropdown li a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--cnl-gray-700);
  transition: background .15s;
}
.cnl-user-menu__dropdown li a:hover { background: var(--cnl-gray-50); color: var(--cnl-red); }
.cnl-user-menu__dropdown .divider { border-top: 1px solid var(--cnl-gray-200); margin: 4px 0; }

/* Hamburger */
.cnl-hamburger { display: none; flex-direction: column; gap: 5px; width: 24px; padding: 4px 0; }
.cnl-hamburger span { display: block; height: 2px; background: var(--cnl-gray-700); border-radius: 2px; transition: all .2s; }

/* Search overlay */
.cnl-search-overlay {
  position: absolute;
  top: var(--header-h);
  left: 0; right: 0;
  background: #fff;
  border-bottom: 1px solid var(--cnl-gray-200);
  padding: var(--space-md) 0;
  box-shadow: var(--shadow-md);
}
.cnl-search-form { display: flex; gap: var(--space-sm); }
.cnl-search-form__input {
  flex: 1;
  padding: 12px 16px;
  border: 1.5px solid var(--cnl-gray-300);
  border-radius: var(--radius-full);
  font-size: 15px;
  outline: none;
  transition: border-color .15s;
}
.cnl-search-form__input:focus { border-color: var(--cnl-red); }

/* ── Breadcrumb ─────────────────────────────────────────────── */
.cnl-breadcrumb {
  padding: 12px 0;
  font-size: 13px;
  color: var(--cnl-gray-500);
}
.cnl-breadcrumb ol { display: flex; gap: 8px; flex-wrap: wrap; }
.cnl-breadcrumb a { color: var(--cnl-gray-600); }
.cnl-breadcrumb a:hover { color: var(--cnl-red); }
.cnl-breadcrumb li::before { content: '>'; margin-right: 8px; }
.cnl-breadcrumb li:first-child::before { display: none; }

/* ── Section headings ───────────────────────────────────────── */
.cnl-section { padding: var(--space-2xl) 0; }
.cnl-section--gray { background: var(--cnl-gray-50); }
.cnl-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-xl);
}
.cnl-section-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--cnl-gray-900);
}
.cnl-section-title::after {
  content: '';
  display: block;
  width: 40px;
  height: 3px;
  background: var(--cnl-red);
  border-radius: 2px;
  margin-top: 6px;
}
.cnl-section-link {
  font-size: 14px;
  font-weight: 600;
  color: var(--cnl-red);
  display: flex;
  align-items: center;
  gap: 4px;
}
.cnl-section-link:hover { text-decoration: underline; }

/* ── Cards ──────────────────────────────────────────────────── */
.cnl-card {
  background: #fff;
  border: 1px solid var(--cnl-gray-200);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: box-shadow .2s, transform .2s;
}
.cnl-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.cnl-card__thumb { aspect-ratio: 16/9; overflow: hidden; }
.cnl-card__thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s; }
.cnl-card:hover .cnl-card__thumb img { transform: scale(1.04); }
.cnl-card__body { padding: var(--space-md); }
.cnl-card__title { font-size: 16px; font-weight: 600; margin-bottom: 6px; }
.cnl-card__meta  { font-size: 12px; color: var(--cnl-gray-500); margin-bottom: var(--space-sm); }

/* Progress bar */
.cnl-progress {
  height: 6px;
  background: var(--cnl-gray-200);
  border-radius: var(--radius-full);
  overflow: hidden;
}
.cnl-progress__fill {
  height: 100%;
  background: var(--cnl-purple);
  border-radius: var(--radius-full);
  transition: width .4s ease;
}
.cnl-progress--red .cnl-progress__fill  { background: var(--cnl-red); }
.cnl-progress--green .cnl-progress__fill { background: #4CAF50; }

/* Tags / Badges */
.cnl-tag {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.cnl-tag--hsk1 { background: #E8F5E9; color: var(--hsk1); }
.cnl-tag--hsk2 { background: #E3F2FD; color: var(--hsk2); }
.cnl-tag--hsk3 { background: #F3E5F5; color: var(--hsk3); }
.cnl-tag--hsk4 { background: #FFF3E0; color: var(--hsk4); }
.cnl-tag--hsk5 { background: #FFEBEE; color: var(--hsk5); }
.cnl-tag--hsk6 { background: var(--cnl-gray-200); color: var(--hsk6); }
.cnl-tag--level-so  { background: #E3F2FD; color: #1565C0; }
.cnl-tag--level-tb  { background: #FFF3E0; color: #E65100; }
.cnl-tag--level-cao { background: #FFEBEE; color: #B71C1C; }

/* ── Hanzi display ──────────────────────────────────────────── */
.cnl-hanzi {
  font-family: var(--font-zh);
  line-height: 1.2;
}
.cnl-hanzi--xl  { font-size: clamp(48px, 8vw, 96px); }
.cnl-hanzi--lg  { font-size: 36px; }
.cnl-hanzi--md  { font-size: 24px; }
.cnl-hanzi--sm  { font-size: 18px; }
.cnl-pinyin     { font-size: 14px; color: var(--cnl-purple); font-weight: 500; }

/* ── Hero banner ────────────────────────────────────────────── */
.cnl-hero {
  position: relative;
  min-height: 480px;
  display: flex;
  align-items: center;
  overflow: hidden;
  background: linear-gradient(135deg, #FFF5F5 0%, #FFF0F0 40%, #F5F0FF 100%);
}
.cnl-hero--dark { background: linear-gradient(135deg, #1a1a2e, #16213e); color: #fff; }
.cnl-hero__content { position: relative; z-index: 2; padding: var(--space-2xl) 0; }
.cnl-hero__eyebrow { font-size: 13px; font-weight: 600; color: var(--cnl-red); text-transform: uppercase; letter-spacing: .08em; margin-bottom: 12px; }
.cnl-hero__title   { font-size: clamp(32px, 5vw, 54px); font-weight: 800; line-height: 1.15; margin-bottom: var(--space-md); }
.cnl-hero__title em { color: var(--cnl-red); font-style: normal; }
.cnl-hero__sub     { font-size: 17px; color: var(--cnl-gray-700); margin-bottom: var(--space-xl); max-width: 540px; }
.cnl-hero__image   { position: absolute; right: 0; bottom: 0; top: 0; width: 42%; object-fit: cover; pointer-events: none; }

/* ── Stats row ──────────────────────────────────────────────── */
.cnl-stats {
  background: var(--cnl-red);
  color: #fff;
  padding: var(--space-xl) 0;
}
.cnl-stats__grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-md);
  text-align: center;
}
.cnl-stats__num  { font-size: 32px; font-weight: 800; }
.cnl-stats__label{ font-size: 14px; opacity: .85; margin-top: 4px; }

/* ── Vocabulary list item ───────────────────────────────────── */
.cnl-vocab-item {
  display: grid;
  grid-template-columns: 80px 1fr 1fr auto;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md);
  border: 1px solid var(--cnl-gray-200);
  border-radius: var(--radius-md);
  background: #fff;
  transition: box-shadow .15s;
}
.cnl-vocab-item:hover { box-shadow: var(--shadow-sm); }
.cnl-vocab-item__thumb { width: 80px; height: 60px; object-fit: cover; border-radius: var(--radius-sm); }
.cnl-vocab-item__char  { font-family: var(--font-zh); font-size: 28px; font-weight: 700; }
.cnl-vocab-item__pinyin{ font-size: 13px; color: var(--cnl-purple); margin-top: 2px; }
.cnl-vocab-item__mean  { font-size: 14px; color: var(--cnl-gray-600); }
.cnl-vocab-item__example { font-size: 13px; color: var(--cnl-gray-500); }
.cnl-vocab-item__actions { display: flex; gap: 8px; color: var(--cnl-gray-400); font-size: 18px; }
.cnl-vocab-item__actions button:hover { color: var(--cnl-red); }
.cnl-vocab-item__status-check { color: #4CAF50; font-size: 13px; font-weight: 600; }

/* ── Flashcard ──────────────────────────────────────────────── */
.cnl-flashcard-wrap {
  perspective: 1200px;
  cursor: pointer;
}
.cnl-flashcard {
  position: relative;
  width: 100%;
  aspect-ratio: 3/2;
  transform-style: preserve-3d;
  transition: transform .5s cubic-bezier(.4,0,.2,1);
}
.cnl-flashcard.flipped { transform: rotateY(180deg); }
.cnl-flashcard__face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  background: #fff;
  border: 1px solid var(--cnl-gray-200);
  border-radius: var(--radius-xl);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-xl);
  box-shadow: var(--shadow-lg);
}
.cnl-flashcard__back { transform: rotateY(180deg); }
.cnl-flashcard__char {
  font-family: var(--font-zh);
  font-size: 80px;
  line-height: 1;
  margin-bottom: var(--space-md);
}
.cnl-flashcard__pinyin  { font-size: 22px; color: var(--cnl-purple); margin-bottom: 8px; }
.cnl-flashcard__meaning { font-size: 18px; color: var(--cnl-gray-700); }

/* Flashcard rating buttons */
.cnl-fc-actions { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: var(--space-sm); }
.cnl-fc-btn {
  padding: var(--space-md);
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 600;
  border: 2px solid;
  transition: all .15s;
}
.cnl-fc-btn--skip   { border-color: var(--cnl-gray-300); color: var(--cnl-gray-600); background: var(--cnl-gray-50); }
.cnl-fc-btn--fail   { border-color: #EF5350; color: #EF5350; background: #FFEBEE; }
.cnl-fc-btn--fail:hover { background: #EF5350; color: #fff; }
.cnl-fc-btn--pass   { border-color: #4CAF50; color: #4CAF50; background: #E8F5E9; }
.cnl-fc-btn--pass:hover { background: #4CAF50; color: #fff; }

/* ── Writing canvas ─────────────────────────────────────────── */
.cnl-writing-area {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  border: 2px solid var(--cnl-gray-300);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: #fff;
  /* grid background */
  background-image:
    linear-gradient(var(--cnl-gray-200) 1px, transparent 1px),
    linear-gradient(90deg, var(--cnl-gray-200) 1px, transparent 1px),
    linear-gradient(var(--cnl-gray-100) 1px, transparent 1px),
    linear-gradient(90deg, var(--cnl-gray-100) 1px, transparent 1px);
  background-size: 50% 50%, 50% 50%, 25% 25%, 25% 25%;
}
.cnl-writing-area canvas { position: absolute; inset: 0; width: 100% !important; height: 100% !important; }

/* ── Dashboard layout ───────────────────────────────────────── */
.cnl-dashboard {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: var(--space-xl);
  padding: var(--space-xl) 0;
}
.cnl-sidebar {
  position: sticky;
  top: calc(var(--header-h) + var(--space-md));
  align-self: start;
}
.cnl-sidebar__nav { list-style: none; }
.cnl-sidebar__nav li a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 500;
  color: var(--cnl-gray-700);
  transition: all .15s;
}
.cnl-sidebar__nav li a:hover,
.cnl-sidebar__nav li a.active {
  background: var(--cnl-red-light);
  color: var(--cnl-red);
}
.cnl-sidebar__nav li a i { font-size: 18px; width: 20px; }
.cnl-sidebar__section { font-size: 11px; font-weight: 700; color: var(--cnl-gray-400); text-transform: uppercase; letter-spacing: .08em; padding: 16px 14px 6px; }

/* Dashboard stats cards */
.cnl-stat-card {
  background: #fff;
  border: 1px solid var(--cnl-gray-200);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  text-align: center;
}
.cnl-stat-card__icon { font-size: 28px; margin-bottom: 8px; color: var(--cnl-purple); }
.cnl-stat-card__num  { font-size: 32px; font-weight: 800; line-height: 1; }
.cnl-stat-card__label{ font-size: 13px; color: var(--cnl-gray-500); margin-top: 4px; }

/* Skill progress */
.cnl-skill-row {
  display: grid;
  grid-template-columns: 120px 1fr 48px;
  align-items: center;
  gap: var(--space-md);
  margin-bottom: var(--space-md);
}
.cnl-skill-name { font-size: 14px; font-weight: 500; display: flex; align-items: center; gap: 6px; }
.cnl-skill-pct  { font-size: 13px; font-weight: 600; color: var(--cnl-gray-700); text-align: right; }

/* ── Streak calendar ────────────────────────────────────────── */
.cnl-streak-calendar {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}
.cnl-streak-calendar__day {
  aspect-ratio: 1;
  border-radius: 50%;
  border: 2px solid var(--cnl-gray-200);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--cnl-gray-400);
}
.cnl-streak-calendar__day.done    { background: var(--cnl-purple); border-color: var(--cnl-purple); color: #fff; }
.cnl-streak-calendar__day.today   { border-color: var(--cnl-red); color: var(--cnl-red); }

/* ── Listening player ───────────────────────────────────────── */
.cnl-player {
  background: #fff;
  border: 1px solid var(--cnl-gray-200);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
}
.cnl-player__controls {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  justify-content: center;
  margin: var(--space-md) 0;
}
.cnl-player__btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px; height: 40px;
  border-radius: 50%;
  color: var(--cnl-gray-600);
  font-size: 20px;
  transition: all .15s;
}
.cnl-player__btn:hover { background: var(--cnl-gray-100); color: var(--cnl-gray-900); }
.cnl-player__btn--primary {
  width: 52px; height: 52px;
  background: var(--cnl-purple);
  color: #fff;
  font-size: 24px;
}
.cnl-player__btn--primary:hover { filter: brightness(1.1); background: var(--cnl-purple); }
.cnl-player__progress {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: 13px;
  color: var(--cnl-gray-500);
}
.cnl-player__progress input[type=range] {
  flex: 1;
  accent-color: var(--cnl-purple);
}

/* Transcript lines */
.cnl-transcript__line {
  display: flex;
  gap: var(--space-md);
  padding: var(--space-sm) 0;
  border-bottom: 1px solid var(--cnl-gray-100);
}
.cnl-transcript__speaker { color: var(--cnl-purple); font-size: 13px; }
.cnl-transcript__text    { flex: 1; }
.cnl-transcript__zh      { font-family: var(--font-zh); font-size: 15px; }
.cnl-transcript__pinyin  { font-size: 12px; color: var(--cnl-purple); }
.cnl-transcript__vi      { font-size: 13px; color: var(--cnl-gray-500); }

/* ── HSK level card ─────────────────────────────────────────── */
.cnl-hsk-card {
  padding: var(--space-md);
  border-radius: var(--radius-lg);
  border: 1px solid var(--cnl-gray-200);
  background: #fff;
  transition: box-shadow .15s;
}
.cnl-hsk-card:hover { box-shadow: var(--shadow-md); }
.cnl-hsk-card__level { font-size: 13px; font-weight: 700; }
.cnl-hsk-card__num   { font-size: 22px; font-weight: 800; margin: 4px 0; }
.cnl-hsk-card__vocab { font-size: 12px; color: var(--cnl-gray-500); }

/* ── Filter sidebar ─────────────────────────────────────────── */
.cnl-filter-group { margin-bottom: var(--space-lg); }
.cnl-filter-group__title {
  font-size: 13px;
  font-weight: 700;
  color: var(--cnl-gray-900);
  margin-bottom: var(--space-sm);
  text-transform: uppercase;
  letter-spacing: .05em;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.cnl-filter-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  color: var(--cnl-gray-700);
  transition: all .12s;
  margin-bottom: 2px;
}
.cnl-filter-btn:hover { background: var(--cnl-gray-100); }
.cnl-filter-btn.active { background: var(--cnl-red-light); color: var(--cnl-red); font-weight: 600; }
.cnl-filter-btn__count { font-size: 12px; color: var(--cnl-gray-400); }

/* ── Pinyin table ───────────────────────────────────────────── */
.cnl-pinyin-table {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
  gap: var(--space-sm);
}
.cnl-pinyin-cell {
  padding: 10px 6px;
  background: #fff;
  border: 1px solid var(--cnl-gray-200);
  border-radius: var(--radius-sm);
  text-align: center;
  cursor: pointer;
  transition: all .15s;
}
.cnl-pinyin-cell:hover { background: var(--cnl-purple-light); border-color: var(--cnl-purple); }
.cnl-pinyin-cell__char { font-size: 18px; font-weight: 700; color: var(--cnl-gray-900); }
.cnl-pinyin-cell__romanization { font-size: 11px; color: var(--cnl-gray-500); margin-top: 2px; }
.cnl-pinyin-cell__audio { font-size: 14px; color: var(--cnl-gray-400); margin-top: 4px; }

/* ── Donut chart (CSS only) ─────────────────────────────────── */
.cnl-donut {
  position: relative;
  width: 120px; height: 120px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.cnl-donut__pct {
  position: absolute;
  font-size: 22px;
  font-weight: 800;
  color: var(--cnl-gray-900);
}
.cnl-donut__label {
  position: absolute;
  bottom: -4px;
  font-size: 11px;
  color: var(--cnl-gray-500);
}

/* ── Leaderboard ────────────────────────────────────────────── */
.cnl-leaderboard__row {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: 12px;
  border-radius: var(--radius-md);
  transition: background .12s;
}
.cnl-leaderboard__row:hover { background: var(--cnl-gray-50); }
.cnl-leaderboard__rank { width: 28px; font-size: 14px; font-weight: 700; color: var(--cnl-gray-500); text-align: center; }
.cnl-leaderboard__rank--1 { color: #FFB300; }
.cnl-leaderboard__rank--2 { color: var(--cnl-gray-400); }
.cnl-leaderboard__rank--3 { color: #BF8970; }
.cnl-leaderboard__avatar { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; }
.cnl-leaderboard__name  { flex: 1; font-size: 14px; font-weight: 500; }
.cnl-leaderboard__score { font-size: 14px; font-weight: 700; color: var(--cnl-red); }

/* ── Upgrade CTA card ───────────────────────────────────────── */
.cnl-upgrade-card {
  background: linear-gradient(135deg, var(--cnl-purple), #5B3FFF);
  color: #fff;
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  text-align: center;
}
.cnl-upgrade-card__icon { font-size: 32px; margin-bottom: var(--space-sm); }
.cnl-upgrade-card__title { font-size: 15px; font-weight: 700; margin-bottom: 6px; }
.cnl-upgrade-card__desc  { font-size: 13px; opacity: .85; margin-bottom: var(--space-md); }

/* ── Footer ─────────────────────────────────────────────────── */
.cnl-footer { background: var(--cnl-gray-50); border-top: 1px solid var(--cnl-gray-200); }
.cnl-footer__main {
  display: grid;
  grid-template-columns: 260px 1fr 1fr 1fr 220px;
  gap: var(--space-xl);
  padding: var(--space-2xl) 0 var(--space-xl);
}
.cnl-footer__tagline { font-size: 13px; color: var(--cnl-gray-500); margin: var(--space-sm) 0; line-height: 1.6; }
.cnl-footer__social  { display: flex; gap: var(--space-sm); margin-top: var(--space-md); }
.cnl-footer__social a {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--cnl-gray-200);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  color: var(--cnl-gray-700);
  transition: all .15s;
}
.cnl-footer__social a:hover { background: var(--cnl-red); color: #fff; }
.cnl-footer__heading { font-size: 13px; font-weight: 700; color: var(--cnl-gray-900); margin-bottom: var(--space-md); }
.cnl-footer__col ul li a {
  font-size: 13px;
  color: var(--cnl-gray-600);
  display: block;
  padding: 4px 0;
  transition: color .12s;
}
.cnl-footer__col ul li a:hover { color: var(--cnl-red); }
.cnl-newsletter-form { display: flex; gap: 8px; margin-top: var(--space-sm); }
.cnl-newsletter-form__input {
  flex: 1;
  padding: 10px 14px;
  border: 1.5px solid var(--cnl-gray-300);
  border-radius: var(--radius-full);
  font-size: 13px;
  outline: none;
}
.cnl-newsletter-form__input:focus { border-color: var(--cnl-red); }
.cnl-footer__bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-md) 0;
  border-top: 1px solid var(--cnl-gray-200);
  font-size: 13px;
  color: var(--cnl-gray-500);
}
.cnl-footer__bottom-links { display: flex; gap: var(--space-md); }
.cnl-footer__bottom-links a:hover { color: var(--cnl-red); }

/* ── Utility classes ─────────────────────────────────────────── */
.text-red    { color: var(--cnl-red); }
.text-purple { color: var(--cnl-purple); }
.text-gray   { color: var(--cnl-gray-500); }
.text-sm     { font-size: 13px; }
.text-xs     { font-size: 11px; }
.text-center { text-align: center; }
.fw-700      { font-weight: 700; }
.fw-600      { font-weight: 600; }
.mt-sm       { margin-top: var(--space-sm); }
.mt-md       { margin-top: var(--space-md); }
.mt-lg       { margin-top: var(--space-lg); }
.mb-md       { margin-bottom: var(--space-md); }
.gap-sm      { gap: var(--space-sm); }
.gap-md      { gap: var(--space-md); }

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .cnl-footer__main { grid-template-columns: 1fr 1fr 1fr; }
  .cnl-footer__brand { grid-column: 1 / -1; }
  .cnl-footer__newsletter { grid-column: 1 / -1; }
  .cnl-stats__grid { grid-template-columns: repeat(2, 1fr); }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .cnl-nav { display: none; }
  .cnl-nav.open {
    display: block;
    position: fixed;
    inset: 0;
    top: var(--header-h);
    background: #fff;
    z-index: 999;
    padding: var(--space-lg);
    overflow-y: auto;
  }
  .cnl-nav.open .cnl-nav__list { flex-direction: column; gap: 0; }
  .cnl-nav.open .cnl-nav__link { font-size: 16px; padding: 14px 0; border-bottom: 1px solid var(--cnl-gray-100); }
  .cnl-nav.open .cnl-nav__link.active::after { display: none; }
  .cnl-hamburger { display: flex; }
  .cnl-hero { min-height: auto; }
  .cnl-hero__image { display: none; }
  .cnl-dashboard { grid-template-columns: 1fr; }
  .cnl-sidebar { display: none; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .cnl-vocab-item { grid-template-columns: 60px 1fr; }
  .cnl-vocab-item__example { display: none; }
  .cnl-footer__main { grid-template-columns: 1fr; gap: var(--space-lg); }
  .cnl-stats__grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 480px) {
  .cnl-hero__title { font-size: 28px; }
  .cnl-stats__grid { grid-template-columns: 1fr 1fr; }
  .cnl-stats__num  { font-size: 24px; }
}

/* ── Print ──────────────────────────────────────────────────── */
@media print {
  .cnl-header, .cnl-footer, .cnl-sidebar { display: none; }
  .cnl-dashboard { grid-template-columns: 1fr; }
}
