/* ==========================================================================
   Knowledge Review — Design System
   60-30-10 Rule: 60% bg-surface / 30% cards / 10% accent-primary
   Type Scale: Major Third (1.25)
   Spacing: 4px grid (--space-1 through --space-16)
   ========================================================================== */

/* ----- CSS Custom Properties ----- */
:root {
  /* Brand palette */
  --color-primary: #4f46e5;
  --color-primary-light: #6366f1;
  --color-primary-dark: #3730a3;
  --color-primary-glow: rgba(79, 70, 229, 0.15);
  --color-accent: #f59e0b;
  --color-accent-light: #fbbf24;

  /* Surfaces (60-30-10: 60% role) */
  --color-bg: #f1f5f9;
  --color-bg-card: #ffffff;
  --color-bg-elevated: #f8fafc;

  /* Text */
  --color-text: #0f172a;
  --color-text-secondary: #475569;
  --color-text-muted: #94a3b8;

  /* Borders */
  --color-border: #e2e8f0;
  --color-border-light: #f1f5f9;

  /* Functional */
  --color-success: #10b981;
  --color-success-bg: #ecfdf5;
  --color-warning: #f59e0b;
  --color-warning-bg: #fffbeb;
  --color-danger: #ef4444;
  --color-danger-bg: #fef2f2;
  --color-info: #3b82f6;
  --color-info-bg: #eff6ff;

  /* Typography — Major Third 1.25 */
  --font-sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  --font-mono: "SF Mono", "Fira Code", "Consolas", monospace;

  --text-xs: 0.75rem;    --leading-xs: 1rem;
  --text-sm: 0.875rem;   --leading-sm: 1.25rem;
  --text-base: 1rem;     --leading-base: 1.75rem;
  --text-lg: 1.125rem;   --leading-lg: 1.75rem;
  --text-xl: 1.25rem;    --leading-xl: 1.75rem;
  --text-2xl: 1.5rem;    --leading-2xl: 2rem;
  --text-3xl: 1.875rem;  --leading-3xl: 2.25rem;
  --text-4xl: 2.25rem;   --leading-4xl: 2.5rem;

  /* Spacing — 4px grid */
  --space-1: 0.25rem;   --space-2: 0.5rem;    --space-3: 0.75rem;
  --space-4: 1rem;      --space-5: 1.25rem;   --space-6: 1.5rem;
  --space-8: 2rem;      --space-10: 2.5rem;   --space-12: 3rem;
  --space-16: 4rem;

  /* Radii */
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --radius-2xl: 1.5rem;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0,0,0,0.05);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -2px rgba(0,0,0,0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -4px rgba(0,0,0,0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.1), 0 8px 10px -6px rgba(0,0,0,0.06);
  --shadow-card: 0 0 0 1px rgba(0,0,0,0.03), 0 2px 4px rgba(0,0,0,0.04), 0 6px 18px rgba(0,0,0,0.05);

  /* Motion */
  --duration-fast: 150ms;
  --duration-normal: 250ms;
  --duration-slow: 400ms;
  --ease-out: cubic-bezier(0, 0, 0.2, 1);
  --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);

  /* Layout */
  --sidebar-width: 240px;
  --sidebar-collapsed: 64px;
}

/* ----- Reset ----- */
*,*::before,*::after { box-sizing:border-box; margin:0; padding:0; }
html { font-size:16px; scroll-behavior:smooth; -webkit-font-smoothing:antialiased; }
body {
  font-family:var(--font-sans);
  background:var(--color-bg);
  color:var(--color-text);
  line-height:var(--leading-base);
  min-height:100vh;
  display:flex;
}
a { color:inherit; text-decoration:none; }
img { max-width:100%; display:block; }
button { font-family:inherit; cursor:pointer; }
input,textarea,select { font-family:inherit; font-size:inherit; }

/* ----- Sidebar ----- */
.sidebar {
  width:var(--sidebar-width);
  min-height:100vh;
  background:linear-gradient(180deg, #312e81 0%, #1e1b4b 100%);
  display:flex;
  flex-direction:column;
  position:fixed;
  top:0; left:0; bottom:0;
  z-index:100;
}
.sidebar::after {
  content:''; position:absolute; top:0; left:0; right:0; bottom:0;
  background:url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  pointer-events:none;
}
.sidebar-header {
  padding:var(--space-6) var(--space-5);
  position:relative; z-index:1;
}
.sidebar-header h2 {
  font-size:var(--text-lg);
  font-weight:700;
  color:#fff;
  display:flex;
  align-items:center;
  gap:var(--space-2);
}
.sidebar-header .logo-dot {
  width:8px; height:8px;
  background:var(--color-accent);
  border-radius:var(--radius-full);
  box-shadow:0 0 12px var(--color-accent);
}
.nav-section { padding:0 var(--space-3); position:relative; z-index:1; }
.nav-section-label {
  padding:var(--space-3) var(--space-3) var(--space-2);
  font-size:var(--text-xs);
  font-weight:600;
  color:rgba(255,255,255,0.35);
  text-transform:uppercase;
  letter-spacing:0.08em;
}
.nav-links {
  list-style:none;
  display:flex;
  flex-direction:column;
  gap:var(--space-1);
}
.nav-item {
  display:flex;
  align-items:center;
  gap:var(--space-3);
  padding:var(--space-2) var(--space-3);
  border-radius:var(--radius-md);
  font-size:var(--text-sm);
  font-weight:500;
  color:rgba(255,255,255,0.65);
  transition:all var(--duration-fast) var(--ease-out);
  position:relative;
}
.nav-item:hover {
  background:rgba(255,255,255,0.08);
  color:#fff;
}
.nav-item.active {
  background:rgba(255,255,255,0.12);
  color:#fff;
  font-weight:600;
}
.nav-item.active::before {
  content:'';
  position:absolute;
  left:0; top:50%; transform:translateY(-50%);
  width:3px; height:20px;
  background:var(--color-accent);
  border-radius:0 2px 2px 0;
}
.nav-icon { font-size:1.125rem; width:24px; text-align:center; flex-shrink:0; }
.nav-badge {
  margin-left:auto;
  background:var(--color-danger);
  color:#fff;
  font-size:0.6875rem;
  font-weight:700;
  padding:1px 6px;
  border-radius:var(--radius-full);
  min-width:18px;
  text-align:center;
  line-height:1.4;
}

/* Language switcher in sidebar */
.lang-switcher {
  width:100%;
  padding:var(--space-2) var(--space-3);
  margin:var(--space-1) 0 var(--space-3);
  background:rgba(255,255,255,0.08);
  border:1px solid rgba(255,255,255,0.12);
  border-radius:var(--radius-md);
  color:rgba(255,255,255,0.8);
  font-size:var(--text-sm);
  font-family:inherit;
  cursor:pointer;
  outline:none;
  transition:all var(--duration-fast);
}
.lang-switcher:hover { background:rgba(255,255,255,0.12); border-color:rgba(255,255,255,0.2); }
.lang-switcher:focus { border-color:var(--color-accent); box-shadow:0 0 0 2px rgba(245,158,11,0.2); }
.lang-switcher option { background:#1e1b4b; color:#fff; }
.sidebar-footer {
  padding:var(--space-4) var(--space-5);
  border-top:1px solid rgba(255,255,255,0.08);
  position:relative; z-index:1;
  margin-top:auto;
}
.sidebar-footer .user-info {
  display:flex;
  align-items:center;
  gap:var(--space-3);
  font-size:var(--text-sm);
  color:rgba(255,255,255,0.6);
}
.user-avatar {
  width:32px; height:32px;
  border-radius:var(--radius-full);
  background:linear-gradient(135deg, var(--color-primary-light), var(--color-accent));
  display:flex; align-items:center; justify-content:center;
  font-size:var(--text-sm); font-weight:600; color:#fff;
  flex-shrink:0;
}

/* ----- Main Content ----- */
.main-content {
  margin-left:var(--sidebar-width);
  flex:1;
  padding:var(--space-8);
  max-width:1160px;
  width:100%;
}

/* ----- Page Header ----- */
.page-header {
  display:flex;
  align-items:center;
  justify-content:space-between;
  flex-wrap:wrap;
  gap:var(--space-4);
  margin-bottom:var(--space-8);
}
.page-header h1 {
  font-size:var(--text-3xl);
  font-weight:800;
  letter-spacing:-0.02em;
  color:var(--color-text);
}
.page-header .breadcrumb {
  font-size:var(--text-sm);
  color:var(--color-text-muted);
  margin-bottom:var(--space-1);
}
.page-header .breadcrumb a { color:var(--color-text-secondary); }
.page-header .breadcrumb a:hover { color:var(--color-primary); }

/* ----- Buttons ----- */
.btn {
  display:inline-flex; align-items:center; justify-content:center; gap:var(--space-2);
  padding:var(--space-2) var(--space-4);
  border-radius:var(--radius-md);
  font-size:var(--text-sm); font-weight:600;
  border:1px solid transparent;
  cursor:pointer;
  transition:all var(--duration-fast) var(--ease-out);
  text-decoration:none;
  white-space:nowrap;
  line-height:1.5;
}
.btn:hover { transform:translateY(-1px); }
.btn:active { transform:translateY(0); }

.btn-primary {
  background:var(--color-primary);
  color:#fff;
  box-shadow:0 1px 2px rgba(79,70,229,0.3);
}
.btn-primary:hover {
  background:var(--color-primary-dark);
  box-shadow:0 4px 12px rgba(79,70,229,0.35);
  color:#fff;
}

.btn-secondary {
  background:var(--color-bg-card);
  color:var(--color-text);
  border-color:var(--color-border);
}
.btn-secondary:hover {
  background:var(--color-bg);
  border-color:var(--color-text-muted);
  color:var(--color-text);
}

.btn-success { background:var(--color-success); color:#fff; }
.btn-success:hover { background:#059669; color:#fff; }
.btn-danger { background:var(--color-danger); color:#fff; }
.btn-danger:hover { background:#dc2626; color:#fff; }
.btn-warning { background:var(--color-warning); color:#fff; }
.btn-warning:hover { background:#d97706; color:#fff; }

.btn-ghost {
  background:transparent;
  color:var(--color-text-secondary);
}
.btn-ghost:hover {
  background:var(--color-bg);
  color:var(--color-text);
}

.btn-sm { padding:var(--space-1) var(--space-3); font-size:var(--text-xs); border-radius:var(--radius-sm); }
.btn-lg { padding:var(--space-3) var(--space-6); font-size:var(--text-base); border-radius:var(--radius-lg); }
.btn-icon { padding:var(--space-2); width:36px; height:36px; }

/* ----- Cards ----- */
.card {
  background:var(--color-bg-card);
  border-radius:var(--radius-xl);
  padding:var(--space-6);
  box-shadow:var(--shadow-card);
  border:1px solid var(--color-border-light);
  transition:all var(--duration-normal) var(--ease-out);
  position:relative;
  overflow:hidden;
}
.card:hover {
  box-shadow:var(--shadow-lg);
  transform:translateY(-2px);
}
.card-header {
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:var(--space-4);
  margin-bottom:var(--space-4);
}
.card-title {
  font-size:var(--text-lg);
  font-weight:700;
  color:var(--color-text);
}
.card-subtitle {
  font-size:var(--text-sm);
  color:var(--color-text-secondary);
  margin-top:var(--space-1);
}

/* Decks grid */
.card-grid {
  display:grid;
  grid-template-columns:repeat(auto-fill, minmax(320px, 1fr));
  gap:var(--space-5);
}

/* ----- Stats Grid (Dashboard) ----- */
.stats-grid {
  display:grid;
  grid-template-columns:repeat(auto-fit, minmax(160px, 1fr));
  gap:var(--space-4);
  margin-bottom:var(--space-8);
}
.stat-card {
  background:var(--color-bg-card);
  border-radius:var(--radius-xl);
  padding:var(--space-5) var(--space-6);
  box-shadow:var(--shadow-card);
  border:1px solid var(--color-border-light);
  position:relative;
  overflow:hidden;
  transition:all var(--duration-normal) var(--ease-out);
}
.stat-card:hover {
  transform:translateY(-2px);
  box-shadow:var(--shadow-lg);
}
.stat-card::before {
  content:'';
  position:absolute;
  top:0; left:0; right:0;
  height:3px;
}
.stat-card:nth-child(1)::before { background:var(--color-primary); }
.stat-card:nth-child(2)::before { background:var(--color-info); }
.stat-card:nth-child(3)::before { background:var(--color-warning); }
.stat-card:nth-child(4)::before { background:var(--color-success); }
.stat-card:nth-child(5)::before { background:var(--color-danger); }
.stat-icon {
  width:40px; height:40px;
  border-radius:var(--radius-md);
  display:flex; align-items:center; justify-content:center;
  font-size:1.25rem;
  margin-bottom:var(--space-3);
}
.stat-value {
  font-size:var(--text-4xl);
  font-weight:800;
  color:var(--color-text);
  line-height:1;
  letter-spacing:-0.02em;
}
.stat-value.loading {
  width:60px; height:36px;
  background:linear-gradient(90deg, #e2e8f0 25%, #f1f5f9 50%, #e2e8f0 75%);
  background-size:200% 100%;
  animation:shimmer 1.5s infinite;
  border-radius:var(--radius-sm);
  color:transparent;
}
.stat-label {
  font-size:var(--text-sm);
  color:var(--color-text-secondary);
  margin-top:var(--space-2);
}
.stat-change {
  font-size:var(--text-xs);
  font-weight:600;
  margin-top:var(--space-2);
  display:flex; align-items:center; gap:2px;
}
.stat-change.up { color:var(--color-success); }
.stat-change.down { color:var(--color-danger); }

@keyframes shimmer {
  0% { background-position:200% 0; }
  100% { background-position:-200% 0; }
}

/* ----- Progress Bar ----- */
.progress-bar {
  width:100%; height:6px;
  background:var(--color-border-light);
  border-radius:var(--radius-full);
  overflow:hidden;
}
.progress-fill {
  height:100%;
  background:var(--color-primary);
  border-radius:var(--radius-full);
  transition:width 0.6s var(--ease-spring);
}
.progress-fill.success { background:var(--color-success); }
.progress-fill.warning { background:var(--color-warning); }
.progress-fill.danger { background:var(--color-danger); }

/* ----- Forms ----- */
.form-group { margin-bottom:var(--space-5); }
.form-label {
  display:block;
  margin-bottom:var(--space-2);
  font-weight:600;
  font-size:var(--text-sm);
  color:var(--color-text);
}
.form-input,
.form-textarea,
.form-select {
  width:100%;
  padding:var(--space-3) var(--space-4);
  border:1px solid var(--color-border);
  border-radius:var(--radius-md);
  font-size:var(--text-sm);
  color:var(--color-text);
  background:var(--color-bg-card);
  transition:all var(--duration-fast) var(--ease-out);
  outline:none;
}
.form-input:hover,
.form-textarea:hover,
.form-select:hover { border-color:var(--color-text-muted); }
.form-input:focus,
.form-textarea:focus,
.form-select:focus {
  border-color:var(--color-primary);
  box-shadow:0 0 0 3px var(--color-primary-glow);
}
.form-textarea { min-height:100px; resize:vertical; }
.form-help {
  font-size:var(--text-xs);
  color:var(--color-text-muted);
  margin-top:var(--space-1);
}
.form-inline { display:flex; gap:var(--space-3); align-items:end; }

/* ----- Tables ----- */
.table-container { overflow-x:auto; border-radius:var(--radius-lg); }
table {
  width:100%;
  border-collapse:collapse;
}
th, td {
  padding:var(--space-3) var(--space-4);
  text-align:left;
  border-bottom:1px solid var(--color-border-light);
}
th {
  font-size:var(--text-xs);
  font-weight:700;
  color:var(--color-text-muted);
  text-transform:uppercase;
  letter-spacing:0.05em;
  background:var(--color-bg-elevated);
}
tr:last-child td { border-bottom:none; }
tr:hover td { background:var(--color-info-bg); }

/* ----- Tags ----- */
.tag {
  display:inline-flex;
  align-items:center;
  padding:2px 10px;
  background:var(--color-primary-glow);
  color:var(--color-primary);
  border-radius:var(--radius-full);
  font-size:var(--text-xs);
  font-weight:600;
  line-height:1.6;
}

/* ----- Flashcard — 3D Flip ----- */
.review-container {
  max-width:640px;
  margin:0 auto;
  perspective:1200px;
}
.flashcard {
  width:100%;
  min-height:300px;
  position:relative;
  transform-style:preserve-3d;
  transition:transform 0.5s var(--ease-in-out);
  cursor:pointer;
  user-select:none;
}
.flashcard.flipped {
  transform:rotateY(180deg);
}
.flashcard-face {
  position:absolute;
  inset:0;
  backface-visibility:hidden;
  -webkit-backface-visibility:hidden;
  border-radius:var(--radius-2xl);
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  padding:var(--space-8);
  text-align:center;
  box-shadow:var(--shadow-xl);
  border:1px solid var(--color-border-light);
}
.flashcard-front {
  background:linear-gradient(135deg, #eef2ff 0%, #e0e7ff 100%);
  z-index:2;
}
.flashcard-back {
  background:linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  transform:rotateY(180deg);
}
.flashcard-front .card-front-text {
  font-size:var(--text-4xl);
  font-weight:800;
  color:var(--color-text);
  line-height:1.2;
}
.flashcard-back .card-back-text {
  font-size:var(--text-3xl);
  font-weight:700;
  color:var(--color-text);
}
.flashcard-hint {
  position:absolute;
  bottom:var(--space-4);
  font-size:var(--text-xs);
  color:var(--color-text-muted);
}
.flashcard .card-tags {
  display:flex;
  gap:var(--space-1);
  flex-wrap:wrap;
  margin-top:var(--space-4);
  justify-content:center;
}

/* Rating buttons */
.rating-buttons {
  display:flex;
  gap:var(--space-2);
  justify-content:center;
  margin-top:var(--space-6);
  flex-wrap:wrap;
}
.rating-btn {
  padding:var(--space-3) var(--space-5);
  border-radius:var(--radius-lg);
  border:2px solid var(--color-border);
  background:var(--color-bg-card);
  cursor:pointer;
  font-size:var(--text-sm);
  font-weight:600;
  text-align:center;
  transition:all var(--duration-fast) var(--ease-out);
  min-width:100px;
}
.rating-btn:hover { transform:translateY(-2px); }
.rating-btn:active { transform:scale(0.97); }
.rating-btn small { display:block; font-weight:400; font-size:var(--text-xs); color:var(--color-text-muted); margin-top:2px; }

.rating-again { border-color:#fca5a5; color:#dc2626; }
.rating-again:hover { background:#fef2f2; box-shadow:0 4px 12px rgba(220,38,38,0.15); }
.rating-hard { border-color:#fdba74; color:#ea580c; }
.rating-hard:hover { background:#fff7ed; box-shadow:0 4px 12px rgba(234,88,12,0.15); }
.rating-good { border-color:#86efac; color:#16a34a; }
.rating-good:hover { background:#f0fdf4; box-shadow:0 4px 12px rgba(22,163,74,0.15); }
.rating-easy { border-color:#67e8f9; color:#0891b2; }
.rating-easy:hover { background:#ecfeff; box-shadow:0 4px 12px rgba(8,145,178,0.15); }

/* ----- Vocabulary Mode ----- */
.vocab-container { max-width:660px; margin:0 auto; }
.vocab-word-card {
  background:linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
  border-radius:var(--radius-2xl);
  padding:var(--space-10) var(--space-8);
  text-align:center;
  color:#fff;
  margin-bottom:var(--space-6);
  box-shadow:0 8px 32px var(--color-primary-glow);
}
.vocab-word-card .word {
  font-size:3.5rem;
  font-weight:800;
  letter-spacing:-0.02em;
  margin-bottom:var(--space-2);
}
.vocab-word-card .meaning {
  font-size:var(--text-lg);
  opacity:0.85;
  font-weight:400;
}
.sentence-input-area { margin-bottom:var(--space-5); }
.sentence-input-area textarea {
  width:100%;
  padding:var(--space-5);
  border:2px solid var(--color-border);
  border-radius:var(--radius-lg);
  font-size:var(--text-lg);
  font-family:var(--font-sans);
  resize:vertical;
  min-height:90px;
  background:var(--color-bg-card);
  transition:all var(--duration-fast) var(--ease-out);
}
.sentence-input-area textarea:focus {
  outline:none;
  border-color:var(--color-primary);
  box-shadow:0 0 0 4px var(--color-primary-glow);
}

/* Judgment result */
.judgment-result {
  padding:var(--space-5);
  border-radius:var(--radius-lg);
  margin-top:var(--space-4);
  display:none;
  font-size:var(--text-sm);
  line-height:var(--leading-base);
  white-space:pre-line;
  animation:fadeSlideIn var(--duration-slow) var(--ease-out);
}
.judgment-result.show { display:block; }
.judgment-result.correct { background:var(--color-success-bg); border:1px solid #86efac; color:#166534; }
.judgment-result.incorrect { background:var(--color-danger-bg); border:1px solid #fca5a5; color:#991b1b; }
.judgment-result.needs-improvement { background:var(--color-warning-bg); border:1px solid #fcd34d; color:#92400e; }

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

/* ----- Modal ----- */
.modal-overlay {
  display:none;
  position:fixed;
  inset:0;
  background:rgba(15,23,42,0.5);
  backdrop-filter:blur(4px);
  -webkit-backdrop-filter:blur(4px);
  z-index:200;
  align-items:center;
  justify-content:center;
  animation:fadeIn var(--duration-fast) var(--ease-out);
}
.modal-overlay.active { display:flex; }
.modal {
  background:var(--color-bg-card);
  border-radius:var(--radius-2xl);
  padding:var(--space-8);
  max-width:520px;
  width:92%;
  max-height:85vh;
  overflow-y:auto;
  box-shadow:var(--shadow-xl), 0 0 0 1px rgba(0,0,0,0.05);
  animation:modalSlideIn var(--duration-slow) var(--ease-spring);
}
.modal-header {
  display:flex;
  align-items:center;
  justify-content:space-between;
  margin-bottom:var(--space-6);
}
.modal-header h3 { font-size:var(--text-xl); font-weight:700; }
.modal-close {
  background:none; border:none;
  font-size:1.5rem; color:var(--color-text-muted);
  padding:var(--space-1); border-radius:var(--radius-sm);
  transition:all var(--duration-fast);
  line-height:1;
}
.modal-close:hover { background:var(--color-bg); color:var(--color-text); }

@keyframes modalSlideIn {
  from { opacity:0; transform:translateY(24px) scale(0.96); }
  to { opacity:1; transform:translateY(0) scale(1); }
}
@keyframes fadeIn {
  from { opacity:0; }
  to { opacity:1; }
}

/* ----- Flash Messages / Toast ----- */
.flash-messages { margin-bottom:var(--space-6); }
.flash {
  padding:var(--space-4) var(--space-5);
  border-radius:var(--radius-lg);
  font-size:var(--text-sm);
  font-weight:500;
  margin-bottom:var(--space-3);
  animation:fadeSlideIn var(--duration-slow) var(--ease-out);
  display:flex;
  align-items:center;
  gap:var(--space-3);
}
.flash-success { background:var(--color-success-bg); color:#166534; border:1px solid #86efac; }
.flash-error { background:var(--color-danger-bg); color:#991b1b; border:1px solid #fca5a5; }
.flash-info { background:var(--color-info-bg); color:#1e40af; border:1px solid #93c5fd; }

/* ----- Empty State ----- */
.empty-state {
  text-align:center;
  padding:var(--space-16) var(--space-6);
  color:var(--color-text-secondary);
}
.empty-state .empty-icon {
  width:80px; height:80px;
  margin:0 auto var(--space-6);
  background:var(--color-bg);
  border-radius:var(--radius-2xl);
  display:flex; align-items:center; justify-content:center;
  font-size:2.5rem;
}
.empty-state h3 {
  font-size:var(--text-xl);
  font-weight:700;
  color:var(--color-text);
  margin-bottom:var(--space-2);
}
.empty-state p {
  font-size:var(--text-sm);
  color:var(--color-text-secondary);
  max-width:360px;
  margin:0 auto var(--space-6);
}

/* ----- Import Preview ----- */
.import-preview {
  background:var(--color-bg);
  border:2px dashed var(--color-border);
  border-radius:var(--radius-lg);
  padding:var(--space-4);
  max-height:320px;
  overflow-y:auto;
  margin-top:var(--space-4);
}
.import-preview table { font-size:var(--text-sm); }

/* ----- Utility ----- */
.text-center { text-align:center; }
.text-right { text-align:right; }
.text-muted { color:var(--color-text-muted); }
.mt-1 { margin-top:var(--space-1); }
.mt-2 { margin-top:var(--space-2); }
.mt-3 { margin-top:var(--space-4); }
.mb-1 { margin-bottom:var(--space-1); }
.mb-2 { margin-bottom:var(--space-2); }
.mb-3 { margin-bottom:var(--space-4); }
.flex { display:flex; }
.flex-center { display:flex; align-items:center; justify-content:center; }
.flex-between { display:flex; align-items:center; justify-content:space-between; }
.flex-col { display:flex; flex-direction:column; }
.gap-1 { gap:var(--space-2); }
.gap-2 { gap:var(--space-4); }
.gap-3 { gap:var(--space-6); }
.flex-wrap { flex-wrap:wrap; }
.hidden { display:none !important; }
.truncate { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }

/* ----- Responsive ----- */
@media (max-width: 1024px) {
  .card-grid { grid-template-columns:repeat(auto-fill, minmax(280px, 1fr)); }
  .stats-grid { grid-template-columns:repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .sidebar {
    width:var(--sidebar-collapsed);
  }
  .sidebar-header h2,
  .nav-section-label,
  .nav-item span:not(.nav-icon),
  .nav-badge,
  .sidebar-footer .user-info span,
  .sidebar-footer .user-info { display:none; }
  .nav-item { justify-content:center; padding:var(--space-3); }
  .nav-item.active::before { display:none; }
  .sidebar-footer { padding:var(--space-4) var(--space-2); }
  .sidebar-footer .user-avatar { margin:0 auto; }
  .main-content {
    margin-left:var(--sidebar-collapsed);
    padding:var(--space-4);
  }
  .page-header { flex-direction:column; align-items:flex-start; }
  .page-header h1 { font-size:var(--text-2xl); }
  .card-grid { grid-template-columns:1fr; }
  .stats-grid { grid-template-columns:repeat(2, 1fr); }
  .stat-value { font-size:var(--text-3xl); }
  .flashcard-front .card-front-text { font-size:var(--text-2xl); }
  .flashcard-back .card-back-text { font-size:var(--text-xl); }
  .flashcard { min-height:240px; }
  .vocab-word-card .word { font-size:2.5rem; }
  .rating-buttons { gap:var(--space-1); }
  .rating-btn { padding:var(--space-2) var(--space-3); min-width:70px; font-size:var(--text-xs); }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns:1fr; }
}
