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

:root {
  --bg: #f0f2f7;
  --bg2: #e4e8f0;
  --card: #ffffff;
  --card-hover: #f8faff;
  --text: #1a1d2e;
  --text2: #4a5568;
  --text3: #718096;
  --border: #dde3f0;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #eff6ff;
  --success: #22c55e;
  --success-light: #f0fdf4;
  --danger: #ef4444;
  --danger-light: #fef2f2;
  --warning: #f59e0b;
  --warning-light: #fffbeb;
  --accent: #8b5cf6;
  --shadow: 0 2px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.12);
  --radius: 16px;
  --radius-sm: 10px;
  --transition: 0.2s ease;
  --font: 'Inter', system-ui, -apple-system, sans-serif;
}

.dark {
  --bg: #0f1117;
  --bg2: #1a1d2e;
  --card: #1e2235;
  --card-hover: #252a40;
  --text: #f0f4ff;
  --text2: #a0aec0;
  --text3: #718096;
  --border: #2d3454;
  --primary: #3b82f6;
  --primary-dark: #2563eb;
  --primary-light: #1e3a6e;
  --success-light: #052e16;
  --danger-light: #2d0d0d;
  --warning-light: #2d1d00;
  --shadow: 0 2px 12px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.5);
}

/* ─── Base ───────────────────────────────────────────────────────────────────── */
html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
  transition: background var(--transition), color var(--transition);
}

/* ─── Layout ─────────────────────────────────────────────────────────────────── */
.app-wrapper {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 1rem 4rem;
}

/* ─── Topbar ─────────────────────────────────────────────────────────────────── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--primary);
  cursor: pointer;
  text-decoration: none;
}

.topbar-logo {
  height: 36px;
  width: auto;
  object-fit: contain;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.15));
}

.topbar-actions { display: flex; gap: 0.5rem; }

.btn-icon {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.4rem 0.75rem;
  font-size: 0.85rem;
  cursor: pointer;
  color: var(--text2);
  transition: all var(--transition);
  white-space: nowrap;
}
.btn-icon:hover { background: var(--primary-light); color: var(--primary); border-color: var(--primary); }

/* ─── Cards ──────────────────────────────────────────────────────────────────── */
.card {
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 1.75rem;
  box-shadow: var(--shadow);
  transition: background var(--transition), box-shadow var(--transition);
}

/* ─── Animations ─────────────────────────────────────────────────────────────── */
@keyframes fadeIn { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideIn { from { opacity: 0; transform: translateX(-20px); } to { opacity: 1; transform: translateX(0); } }
@keyframes pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.05); } }
@keyframes shake { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }

.fade-in { animation: fadeIn 0.4s ease forwards; }

/* ─── Home ───────────────────────────────────────────────────────────────────── */
.home-screen { display: flex; flex-direction: column; gap: 1.5rem; padding-top: 1.5rem; }

.hero {
  text-align: center;
  padding: 2.5rem 1.5rem;
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  border-radius: var(--radius);
  color: white;
  box-shadow: var(--shadow-lg);
}

.hero-logo {
  height: 100px;
  width: auto;
  object-fit: contain;
  margin-bottom: 0.75rem;
  filter: drop-shadow(0 4px 12px rgba(0,0,0,0.25));
  animation: fadeIn 0.6s ease;
}

.hero h1 {
  font-size: clamp(1.4rem, 4vw, 2rem);
  font-weight: 800;
  margin-bottom: 0.75rem;
  line-height: 1.2;
}

.hero .subtitle { font-size: 1rem; opacity: 0.9; margin-bottom: 1.5rem; }

.stats-bar {
  display: flex;
  justify-content: center;
  gap: 2rem;
  margin-top: 1rem;
}

.stat { display: flex; flex-direction: column; align-items: center; }
.stat-num { font-size: 1.75rem; font-weight: 800; }
.stat-label { font-size: 0.8rem; opacity: 0.8; }

/* ─── Filters ────────────────────────────────────────────────────────────────── */
.filters h3 { font-size: 1rem; font-weight: 700; margin-bottom: 1rem; }
.filter-row { display: flex; gap: 1rem; flex-wrap: wrap; }
.filter-group { flex: 1; min-width: 160px; display: flex; flex-direction: column; gap: 0.35rem; }
.filter-group label { font-size: 0.8rem; font-weight: 600; color: var(--text2); text-transform: uppercase; letter-spacing: 0.05em; }

select {
  padding: 0.6rem 0.9rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 0.9rem;
  cursor: pointer;
  transition: border-color var(--transition);
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.9rem center;
  padding-right: 2.5rem;
}
select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,0.15); }

/* ─── Mode cards ─────────────────────────────────────────────────────────────── */
.modes-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1.25rem; }

.mode-card {
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  position: relative;
  overflow: hidden;
}
.mode-card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 4px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  opacity: 0;
  transition: opacity var(--transition);
}
.mode-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); background: var(--card-hover); }
.mode-card:hover::before { opacity: 1; }
.mode-card:hover button { background: var(--primary-dark); }

.mode-icon { font-size: 2.75rem; }
.mode-card h2 { font-size: 1.15rem; font-weight: 700; }
.mode-card p { font-size: 0.88rem; color: var(--text2); line-height: 1.5; }
.mode-meta { font-size: 0.78rem; color: var(--text3); font-style: italic; }

/* ─── Buttons ────────────────────────────────────────────────────────────────── */
.btn-primary {
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 10px;
  padding: 0.7rem 1.5rem;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  width: 100%;
}
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); box-shadow: 0 4px 14px rgba(37,99,235,0.4); }
.btn-primary:active { transform: translateY(0); }

.btn-secondary {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.7rem 1.5rem;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}
.btn-secondary:hover { background: var(--primary-light); border-color: var(--primary); color: var(--primary); }

.btn-back {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.4rem 0.9rem;
  font-size: 0.85rem;
  cursor: pointer;
  color: var(--text2);
  transition: all var(--transition);
}
.btn-back:hover { background: var(--bg); }

/* ─── Category tags ──────────────────────────────────────────────────────────── */
.category-grid h3 { font-weight: 700; margin-bottom: 1rem; }
.cat-tags { display: flex; flex-wrap: wrap; gap: 0.6rem; }

.cat-tag {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 50px;
  padding: 0.45rem 1rem;
  cursor: pointer;
  font-size: 0.85rem;
  transition: all var(--transition);
}
.cat-tag:hover { background: var(--primary); color: white; border-color: var(--primary); transform: translateY(-1px); }
.cat-tag:hover .cat-count { background: rgba(255,255,255,0.25); color: white; }

.cat-name { font-weight: 500; }
.cat-count { background: var(--primary-light); color: var(--primary); border-radius: 50px; padding: 0.1rem 0.5rem; font-size: 0.75rem; font-weight: 700; }

/* ─── Quiz screen ────────────────────────────────────────────────────────────── */
.quiz-screen { padding-top: 1.25rem; display: flex; flex-direction: column; gap: 1rem; }

.quiz-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.mode-badge {
  background: var(--primary-light);
  color: var(--primary);
  border-radius: 50px;
  padding: 0.3rem 0.9rem;
  font-size: 0.8rem;
  font-weight: 700;
}

.progress-text { margin-left: auto; font-size: 0.85rem; color: var(--text3); font-weight: 600; }
.score-live { margin-left: auto; font-size: 0.85rem; font-weight: 700; color: var(--success); }

.timer {
  background: var(--primary-light);
  color: var(--primary);
  border-radius: 8px;
  padding: 0.35rem 0.8rem;
  font-size: 0.9rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.timer-urgent { background: var(--danger-light); color: var(--danger); animation: pulse 1s infinite; }

/* ─── Progress bar ───────────────────────────────────────────────────────────── */
.progress-bar-wrap {
  height: 6px;
  background: var(--bg2);
  border-radius: 50px;
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: 50px;
  transition: width 0.5s ease;
}

/* ─── Question card ──────────────────────────────────────────────────────────── */
.question-card { display: flex; flex-direction: column; gap: 1.25rem; }

.q-meta { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }

.cat-badge {
  background: var(--primary-light);
  color: var(--primary);
  border-radius: 50px;
  padding: 0.25rem 0.8rem;
  font-size: 0.78rem;
  font-weight: 600;
}
.diff-badge {
  border-radius: 50px;
  padding: 0.25rem 0.8rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: white;
}
.q-num { margin-left: auto; font-size: 0.8rem; color: var(--text3); font-weight: 600; }

.question-text { font-size: clamp(1rem, 2.5vw, 1.2rem); font-weight: 700; line-height: 1.5; }

/* ─── Answer buttons ─────────────────────────────────────────────────────────── */
.answers-grid { display: flex; flex-direction: column; gap: 0.6rem; }

.answer-btn {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.85rem 1.1rem;
  cursor: pointer;
  text-align: left;
  font-size: 0.95rem;
  color: var(--text);
  font-family: var(--font);
  transition: all var(--transition);
  width: 100%;
}
.answer-btn:not(:disabled):hover { border-color: var(--primary); background: var(--primary-light); transform: translateX(4px); }
.answer-btn:disabled { cursor: default; }

.ans-letter {
  min-width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--border);
  color: var(--text2);
  font-size: 0.8rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all var(--transition);
}
.answer-btn:not(:disabled):hover .ans-letter { background: var(--primary); color: white; }

.answer-btn.correct { border-color: var(--success); background: var(--success-light); animation: slideIn 0.3s ease; }
.answer-btn.correct .ans-letter { background: var(--success); color: white; }
.answer-btn.wrong { border-color: var(--danger); background: var(--danger-light); animation: shake 0.4s ease; }
.answer-btn.wrong .ans-letter { background: var(--danger); color: white; }
.answer-btn.dimmed { opacity: 0.4; }

/* ─── Feedback ───────────────────────────────────────────────────────────────── */
.feedback-box {
  display: flex;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  border-radius: var(--radius-sm);
  border-left: 4px solid;
  animation: fadeIn 0.3s ease;
}
.feedback-correct { border-color: var(--success); background: var(--success-light); }
.feedback-wrong { border-color: var(--danger); background: var(--danger-light); }
.feedback-icon { font-size: 1.3rem; flex-shrink: 0; }
.feedback-content { display: flex; flex-direction: column; gap: 0.35rem; }
.feedback-content strong { font-weight: 700; font-size: 0.95rem; }
.correct-ans { font-size: 0.88rem; font-weight: 600; color: var(--success); }
.explanation-text { font-size: 0.88rem; color: var(--text2); line-height: 1.6; }

.btn-next { margin-top: 0.25rem; }

/* ─── Oral mode ──────────────────────────────────────────────────────────────── */
.oral-card { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 1rem; }
.oral-icon { font-size: 3rem; }
.oral-question { font-size: clamp(1.1rem, 3vw, 1.4rem); font-weight: 700; line-height: 1.5; max-width: 600px; }
.oral-hint { font-size: 0.88rem; color: var(--text3); font-style: italic; }
.btn-reveal { max-width: 280px; }
.oral-answer { width: 100%; text-align: left; }
.oral-answer-box {
  background: var(--success-light);
  border: 2px solid var(--success);
  border-radius: var(--radius-sm);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  font-size: 0.95rem;
  animation: fadeIn 0.3s ease;
}
.oral-nav { width: 100%; display: flex; justify-content: center; }
.oral-nav button { max-width: 260px; }

/* ─── Results ────────────────────────────────────────────────────────────────── */
.results-screen { display: flex; flex-direction: column; gap: 1.5rem; padding-top: 1.5rem; }

.results-hero { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 0.75rem; }
.results-emoji { font-size: 4rem; }
.results-title { font-size: 1.3rem; font-weight: 700; }
.results-score-big { font-size: 4rem; font-weight: 900; }

.mention-excellent { color: #16a34a; }
.mention-good { color: #2563eb; }
.mention-ok { color: #d97706; }
.mention-warn { color: #f59e0b; }
.mention-fail { color: #ef4444; }

.mention { font-size: 1.3rem; font-weight: 700; }
.results-detail { display: flex; gap: 1.5rem; font-size: 0.95rem; flex-wrap: wrap; justify-content: center; }
.progress-bar-result { transition: width 1s ease; }

.results-actions { display: flex; gap: 0.75rem; flex-wrap: wrap; }
.results-actions button { flex: 1; min-width: 140px; }

.global-stats { }
.global-stats h3 { font-weight: 700; margin-bottom: 1rem; }
.stats-row { display: flex; gap: 1rem; }
.stat-box { flex: 1; text-align: center; background: var(--bg); border-radius: var(--radius-sm); padding: 1rem; }
.stat-val { font-size: 1.75rem; font-weight: 800; color: var(--primary); }

/* ─── Leaderboard ────────────────────────────────────────────────────────────── */
.leaderboard h3 { font-weight: 700; margin-bottom: 1rem; }
.lb-list { display: flex; flex-direction: column; gap: 0.5rem; }
.lb-entry {
  display: flex; align-items: center; gap: 0.75rem;
  background: var(--bg); border-radius: 8px; padding: 0.65rem 1rem;
  font-size: 0.88rem;
}
.lb-rank { font-weight: 800; color: var(--primary); min-width: 30px; }
.lb-name { font-weight: 600; flex: 1; }
.lb-mode { color: var(--text3); font-size: 0.8rem; flex: 1; }
.lb-score { font-weight: 800; color: var(--success); min-width: 40px; text-align: right; }
.lb-date { color: var(--text3); font-size: 0.78rem; min-width: 80px; text-align: right; }

/* ─── Utilities ──────────────────────────────────────────────────────────────── */
.hidden { display: none !important; }

/* ─── Responsive ─────────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .topbar { padding: 0.6rem 1rem; }
  .card { padding: 1.25rem; }
  .modes-grid { grid-template-columns: 1fr; }
  .stats-bar { gap: 1.25rem; }
  .stats-row { flex-direction: column; }
  .quiz-header { gap: 0.5rem; }
  .results-detail { gap: 0.75rem; font-size: 0.85rem; }
  .lb-mode, .lb-date { display: none; }
  .filter-row { flex-direction: column; }
}

/* ─── Stats page ─────────────────────────────────────────────────────────────── */
.stats-page { display: flex; flex-direction: column; gap: 1.5rem; padding-top: 1.25rem; }

.stats-header {
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
}
.stats-title { font-size: 1.4rem; font-weight: 800; flex: 1; }

.btn-danger-sm {
  background: var(--danger-light); color: var(--danger); border: 1px solid var(--danger);
  border-radius: 8px; padding: 0.4rem 0.9rem; font-size: 0.82rem; font-weight: 600;
  cursor: pointer; transition: all var(--transition);
}
.btn-danger-sm:hover { background: var(--danger); color: white; }

/* KPI grid */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; }
.kpi-card {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  gap: 0.4rem; padding: 1.5rem 1rem;
}
.kpi-icon { font-size: 2rem; }
.kpi-val { font-size: 2.2rem; font-weight: 900; color: var(--primary); }
.kpi-label { font-size: 0.82rem; font-weight: 600; color: var(--text2); text-transform: uppercase; letter-spacing: 0.04em; }
.kpi-sub { font-size: 0.78rem; color: var(--text3); }
.kpi-bar-wrap { width: 100%; height: 6px; background: var(--bg2); border-radius: 50px; overflow: hidden; margin-top: 0.25rem; }
.kpi-bar { height: 100%; border-radius: 50px; transition: width 1s ease; }

.kpi-grid-sm { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }
.kpi-card-sm {
  background: var(--bg); border-radius: var(--radius-sm); padding: 1rem 0.75rem;
  text-align: center; font-size: 0.8rem; color: var(--text2);
}
.kpi-val-sm { font-size: 1.6rem; font-weight: 800; color: var(--primary); }

/* Section title */
.section-title { font-size: 1rem; font-weight: 700; margin-bottom: 1.1rem; }

/* Difficulty rings */
.diff-rings { display: flex; justify-content: center; gap: 2rem; flex-wrap: wrap; }
.diff-ring-card { display: flex; flex-direction: column; align-items: center; gap: 0.4rem; }
.ring-svg { overflow: visible; }
.diff-ring-label { font-size: 0.88rem; font-weight: 700; }
.diff-ring-sub { font-size: 0.78rem; color: var(--text3); }

/* Progression chart */
.progress-chart {
  display: flex; align-items: flex-end; gap: 0.5rem;
  height: 120px; padding: 0 0.5rem;
}
.prog-bar-col { display: flex; flex-direction: column; align-items: center; gap: 0.25rem; flex: 1; }
.prog-bar-val { font-size: 0.7rem; font-weight: 700; }
.prog-bar-outer {
  width: 100%; flex: 1; background: var(--bg2); border-radius: 6px 6px 0 0;
  display: flex; align-items: flex-end; overflow: hidden;
}
.prog-bar-inner { width: 100%; border-radius: 6px 6px 0 0; transition: height 1s ease; min-height: 4px; }
.prog-bar-label { font-size: 0.68rem; color: var(--text3); }

/* Category stat bars */
.cat-stats-list { display: flex; flex-direction: column; gap: 0.85rem; }
.cat-stat-row { display: flex; align-items: center; gap: 0.75rem; }
.cat-stat-info { min-width: 0; flex: 0 0 200px; }
.cat-stat-name { font-size: 0.88rem; font-weight: 600; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cat-stat-detail { font-size: 0.73rem; color: var(--text3); }
.cat-stat-bar-wrap { flex: 1; height: 10px; background: var(--bg2); border-radius: 50px; overflow: hidden; }
.cat-stat-bar { height: 100%; border-radius: 50px; transition: width 1s ease; min-width: 2px; }
.cat-stat-pct { font-size: 0.82rem; font-weight: 700; min-width: 38px; text-align: right; }

/* Results category breakdown */
.res-cat-list { display: flex; flex-direction: column; gap: 0.75rem; }
.res-cat-row { display: flex; align-items: center; gap: 0.75rem; }
.res-cat-name { flex: 0 0 170px; font-size: 0.85rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.res-cat-bar-wrap { flex: 1; height: 10px; background: var(--bg2); border-radius: 50px; overflow: hidden; }
.res-cat-bar { height: 100%; border-radius: 50px; transition: width 1s ease; }
.res-cat-pct { font-size: 0.8rem; font-weight: 700; min-width: 80px; text-align: right; }

/* Most missed */
.missed-list { display: flex; flex-direction: column; gap: 0.6rem; }
.missed-row {
  display: flex; align-items: flex-start; gap: 0.75rem;
  background: var(--bg); border-radius: 8px; padding: 0.75rem 1rem;
}
.missed-pct {
  min-width: 68px; font-size: 0.8rem; font-weight: 800; color: var(--danger);
  background: var(--danger-light); border-radius: 6px; padding: 0.15rem 0.45rem; text-align: center;
}
.missed-q { flex: 1; font-size: 0.85rem; line-height: 1.45; }
.missed-cat { font-size: 0.75rem; color: var(--text3); min-width: 90px; text-align: right; }

/* History */
.history-list { display: flex; flex-direction: column; gap: 0.5rem; }
.hist-row {
  display: flex; align-items: center; gap: 0.6rem;
  background: var(--bg); border-radius: 8px; padding: 0.65rem 1rem;
  font-size: 0.85rem;
}
.hist-icon { font-size: 1rem; flex-shrink: 0; }
.hist-mode { flex: 1; font-weight: 500; }
.hist-score { font-weight: 800; min-width: 42px; }
.hist-detail { color: var(--text3); font-size: 0.78rem; min-width: 50px; }
.hist-time { color: var(--text3); font-size: 0.78rem; min-width: 58px; }
.hist-date { color: var(--text3); font-size: 0.75rem; min-width: 100px; text-align: right; }

/* Streak badge in feedback */
.streak-badge {
  display: inline-block;
  background: linear-gradient(135deg, #f59e0b, #ef4444);
  color: white; border-radius: 50px; padding: 0.15rem 0.65rem;
  font-size: 0.78rem; font-weight: 700; margin-top: 0.1rem;
}

/* No data placeholder */
.no-data { color: var(--text3); font-size: 0.88rem; font-style: italic; padding: 0.5rem 0; }

/* ─── Stats auth modal ───────────────────────────────────────────────────────── */
#stats-modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  z-index: 999;
  opacity: 0; transition: opacity 0.25s ease;
}
#stats-modal-overlay.visible { opacity: 1; }

.stats-modal {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 2.25rem 2rem;
  width: min(420px, 92vw);
  box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; align-items: center; gap: 0.9rem;
  text-align: center;
  transform: translateY(20px); transition: transform 0.25s ease;
}
#stats-modal-overlay.visible .stats-modal { transform: translateY(0); }

.stats-modal-icon { font-size: 3rem; }
.stats-modal-title { font-size: 1.3rem; font-weight: 800; }
.stats-modal-sub { font-size: 0.88rem; color: var(--text2); }

.stats-modal-input-wrap {
  position: relative; width: 100%;
}
.stats-modal-input {
  width: 100%;
  padding: 0.75rem 3rem 0.75rem 1rem;
  border-radius: 10px;
  border: 2px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 1rem;
  font-family: var(--font);
  letter-spacing: 0.1em;
  transition: border-color var(--transition);
  text-align: center;
}
.stats-modal-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,0.15); }
.stats-modal-input.shake-input { animation: shake 0.4s ease; border-color: var(--danger); }

.stats-modal-eye {
  position: absolute; right: 0.75rem; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer; font-size: 1.1rem;
  opacity: 0.6; transition: opacity var(--transition);
}
.stats-modal-eye:hover { opacity: 1; }

.stats-modal-error {
  font-size: 0.85rem; font-weight: 600; color: var(--danger);
  background: var(--danger-light); border-radius: 8px; padding: 0.4rem 1rem;
  width: 100%;
}

.stats-modal-actions { display: flex; gap: 0.75rem; width: 100%; }
.stats-modal-actions .btn-primary,
.stats-modal-actions .btn-secondary { flex: 1; }

/* ─── Scrollbar ──────────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 50px; }
::-webkit-scrollbar-thumb:hover { background: var(--primary); }
