/* ========================================================
   A2 Economics MCQ Practice - Main Stylesheet
   Dark mode, responsive, education-optimized typography
   ======================================================== */

/* ---------- CSS Variables (Light Mode Default) ---------- */
:root {
  --bg-primary: #f8fafc;
  --bg-secondary: #ffffff;
  --bg-sidebar: #1e293b;
  --bg-card: #ffffff;
  --bg-option: #f1f5f9;
  --bg-option-hover: #e2e8f0;
  --bg-correct: #dcfce7;
  --bg-correct-hover: #bbf7d0;
  --bg-wrong: #fee2e2;
  --bg-wrong-hover: #fecaca;
  --bg-disabled: #f8fafc;

  --text-primary: #1e293b;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --text-sidebar: #cbd5e1;
  --text-sidebar-active: #ffffff;
  --text-option: #334155;
  --text-correct: #166534;
  --text-wrong: #991b1b;

  --border-light: #e2e8f0;
  --border-sidebar: #334155;
  --border-correct: #22c55e;
  --border-wrong: #ef4444;

  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-light: #dbeafe;
  --accent-secondary: #0891b2;
  --accent-warn: #f59e0b;

  --shadow-sm: 0 1px 2px 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.04);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;

  --font-sans: 'Inter', 'SF Pro Display', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', 'Fira Code', monospace;

  --sidebar-width: 260px;
  --header-height: 56px;
  --transition: 180ms ease;
}

/* ---------- Dark Mode ---------- */
.dark {
  --bg-primary: #0f172a;
  --bg-secondary: #1e293b;
  --bg-sidebar: #0b1120;
  --bg-card: #1e293b;
  --bg-option: #334155;
  --bg-option-hover: #475569;
  --bg-correct: #14532d;
  --bg-correct-hover: #166534;
  --bg-wrong: #7f1d1d;
  --bg-wrong-hover: #991b1b;
  --bg-disabled: #1e293b;

  --text-primary: #f1f5f9;
  --text-secondary: #cbd5e1;
  --text-muted: #64748b;
  --text-sidebar: #94a3b8;
  --text-sidebar-active: #ffffff;
  --text-option: #e2e8f0;
  --text-correct: #bbf7d0;
  --text-wrong: #fecaca;

  --border-light: #334155;
  --border-sidebar: #1e293b;
  --border-correct: #22c55e;
  --border-wrong: #ef4444;

  --accent-light: #1e3a5f;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
}

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

html {
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

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

body.modal-open {
  overflow: hidden;
}

/* ---------- Layout ---------- */
.app-layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  color: var(--text-sidebar);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  overflow-y: auto;
  border-right: 1px solid var(--border-sidebar);
  transition: transform var(--transition);
}

/* Custom scrollbar for sidebar */
.sidebar::-webkit-scrollbar {
  width: 4px;
}
.sidebar::-webkit-scrollbar-track {
  background: transparent;
}
.sidebar::-webkit-scrollbar-thumb {
  background: var(--border-sidebar);
  border-radius: 4px;
}

/* ---------- Brand ---------- */
.sidebar-brand {
  padding: 22px 20px 18px;
  border-bottom: 1px solid var(--border-sidebar);
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-brand-icon {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: rgba(37, 99, 235, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
}

.sidebar-brand-icon svg {
  width: 20px;
  height: 20px;
  color: var(--accent);
}

.sidebar-brand-text h1 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-sidebar-active);
  letter-spacing: -0.01em;
  line-height: 1.3;
}

.sidebar-brand-text span {
  font-size: 0.72rem;
  color: var(--text-muted);
  display: block;
  margin-top: 1px;
  font-weight: 500;
}

/* ---------- Nav ---------- */
.sidebar-nav {
  flex: 1;
  padding: 8px 0;
}

.sidebar-section-label {
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 14px 20px 6px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 7px;
}

.sidebar-section-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--text-muted);
  opacity: 0.5;
  flex-shrink: 0;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 10px;
  padding: 8px 12px;
  font-size: 0.84rem;
  color: var(--text-sidebar);
  text-decoration: none;
  cursor: pointer;
  border: none;
  background: none;
  width: calc(100% - 20px);
  text-align: left;
  border-radius: var(--radius-sm);
  transition: all 180ms cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  font-weight: 500;
}

.sidebar-link:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-sidebar-active);
}

.sidebar-link:hover .icon svg {
  transform: translateX(2px);
}

.sidebar-link.active {
  background: rgba(37, 99, 235, 0.12);
  color: var(--accent);
  font-weight: 600;
  box-shadow: inset 3px 0 0 var(--accent);
}

.sidebar-link .icon {
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sidebar-link .icon svg {
  width: 18px;
  height: 18px;
  transition: transform 180ms cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-link .badge {
  margin-left: auto;
  background: var(--accent);
  color: #fff;
  font-size: 0.6rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  min-width: 20px;
  text-align: center;
  line-height: 1.4;
}

/* ---------- Footer ---------- */
.sidebar-footer {
  padding: 12px 14px 16px;
  border-top: 1px solid var(--border-sidebar);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sidebar-syllabus-switch {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-sidebar);
  border-radius: var(--radius-sm);
  color: var(--text-sidebar);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 180ms cubic-bezier(0.4, 0, 0.2, 1);
  font-family: inherit;
  width: 100%;
  justify-content: center;
}

.sidebar-syllabus-switch svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.sidebar-syllabus-switch:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-sidebar-active);
  border-color: rgba(255, 255, 255, 0.15);
}

.sidebar-footer-bottom {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sidebar-footer-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.sidebar-footer-actions button {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.75rem;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  transition: all 180ms cubic-bezier(0.4, 0, 0.2, 1);
  font-family: inherit;
  display: flex;
  align-items: center;
  gap: 5px;
}

.sidebar-footer-actions button.btn-icon-only {
  padding: 6px;
  width: 30px;
  height: 30px;
  justify-content: center;
}

.sidebar-footer-actions button.btn-icon-only svg {
  width: 16px;
  height: 16px;
}

.sidebar-footer-actions button:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-sidebar-active);
}

.sidebar-signature {
  font-size: 0.7rem;
  line-height: 1.45;
  color: var(--text-muted);
  opacity: 0.8;
}

.sidebar-signature strong {
  color: var(--text-sidebar);
  font-weight: 600;
}

.sidebar-version {
  display: block;
  font-size: 0.6rem;
  margin-top: 2px;
  opacity: 0.5;
  font-family: var(--font-mono);
  letter-spacing: 0.02em;
}

/* ---------- Badge coming soon ---------- */
.sidebar-link .badge-coming {
  background: var(--accent);
  color: #fff;
  font-size: 0.55rem;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ---------- Main Content ---------- */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  padding: 0;
  min-height: 100vh;
}

.content-wrapper {
  max-width: 960px;
  margin: 0 auto;
  padding: 28px 32px 48px;
}

/* ---------- Top Bar ---------- */
.top-bar {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-light);
  z-index: 90;
  align-items: center;
  padding: 0 16px;
  gap: 12px;
}

.top-bar .menu-toggle {
  background: none;
  border: none;
  font-size: 1.4rem;
  color: var(--text-primary);
  cursor: pointer;
  padding: 4px;
}

.top-bar .brand-sm {
  font-weight: 700;
  font-size: 0.95rem;
}

/* ---------- Mobile Sidebar Overlay ---------- */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 99;
}

.sidebar-open .sidebar-overlay { display: block; }

/* ---------- Page Header ---------- */
.page-header {
  margin-bottom: 24px;
}

.page-header h2 {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.page-header p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-top: 4px;
}

/* ---------- Cards ---------- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 20px;
  cursor: pointer;
  transition: all var(--transition);
  box-shadow: var(--shadow-sm);
}

.card-grid .card {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  padding: 22px 22px 20px;
}

.card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--accent);
  transform: translateY(-1px);
}

.card.card-disabled {
  cursor: default;
  opacity: 0.72;
}

.card.card-disabled:hover {
  box-shadow: var(--shadow-sm);
  border-color: var(--border-light);
  transform: none;
}

.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 10px;
}

.card-title {
  font-weight: 650;
  font-size: 1.05rem;
  line-height: 1.35;
}

.card-subtitle {
  color: var(--text-secondary);
  font-size: 0.825rem;
  margin-top: 4px;
  line-height: 1.5;
}

.card-stats {
  display: flex;
  gap: 16px;
  margin-top: 14px;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.card-grid .card .card-subtitle + .card-subtitle {
  margin-top: 10px;
}

.card-grid .card .card-subtitle + .card-stats {
  margin-top: 12px;
}

.card-grid .card .card-stats + .card-subtitle {
  margin-top: 10px;
}

.card-stat {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.card-stat strong {
  color: var(--text-primary);
  font-weight: 650;
}

.progress-bar {
  height: 4px;
  background: var(--bg-option);
  border-radius: 999px;
  margin-top: 12px;
  overflow: hidden;
}

.card-grid .card .progress-bar {
  margin-top: 16px;
}

.progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
  transition: width 400ms ease;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  font-size: 0.875rem;
  font-weight: 600;
  font-family: var(--font-sans);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
  background: var(--bg-card);
  color: var(--text-primary);
  text-decoration: none;
}

.btn:hover {
  background: var(--bg-option-hover);
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-outline {
  background: transparent;
  border-color: var(--accent);
  color: var(--accent);
}

.btn-outline:hover {
  background: var(--accent-light);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8rem;
  border-radius: var(--radius-sm);
}

.btn-icon {
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: var(--radius-sm);
}

.btn-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.card-grid .card .btn-group {
  margin-top: 18px;
  gap: 10px;
  align-items: center;
}

.card-grid .card .btn-group .btn {
  min-height: 40px;
  min-width: 112px;
}

.card-grid .card .btn-group .btn:only-child {
  min-width: 124px;
}

/* ---------- Practice Controls Bar ---------- */
.practice-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.progress-info {
  font-size: 0.875rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.progress-info strong {
  color: var(--text-primary);
}

.auto-save-status {
  color: var(--text-muted);
}

/* ---------- Question Card ---------- */
.question-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 28px 28px 24px;
  box-shadow: var(--shadow-md);
  margin-bottom: 4px;
}

.question-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  font-size: 0.8rem;
  color: var(--text-muted);
  flex-wrap: wrap;
}

.question-meta .chapter-tag {
  background: var(--accent-light);
  color: var(--accent);
  padding: 3px 8px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.72rem;
}

.question-stem {
  font-size: 1.05rem;
  line-height: 1.75;
  margin-bottom: 20px;
  color: var(--text-primary);
}

.question-stem p {
  margin-bottom: 8px;
}

.question-stem table, .question-stem .table-wrap {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0;
  font-size: 0.9rem;
}

.question-stem table th,
.question-stem table td {
  border: 1px solid var(--border-light);
  padding: 8px 12px;
  text-align: left;
}

.question-stem table th {
  background: var(--bg-option);
  font-weight: 600;
}

.question-stem img,
.stem-image {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-sm);
  margin: 16px 0;
  cursor: zoom-in;
  display: block;
  border: 1px solid var(--border-light);
}

.question-image-shell {
  position: relative;
  margin: 16px 0;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg-option);
  border: 1px solid var(--border-light);
  min-height: 220px;
}

.question-image-shell .stem-image {
  margin: 0;
  border: 0;
  width: 100%;
  background: transparent;
}

.progressive-image {
  opacity: 0;
  transition: opacity 180ms ease;
}

.progressive-image.is-loaded {
  opacity: 1;
}

.question-image-placeholder,
.question-image-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  text-align: center;
  font-size: 0.9rem;
  color: var(--text-secondary);
  background:
    linear-gradient(110deg, rgba(148, 163, 184, 0.08) 8%, rgba(148, 163, 184, 0.18) 18%, rgba(148, 163, 184, 0.08) 33%);
  background-size: 220% 100%;
  animation: questionImagePulse 1.4s ease-in-out infinite;
}

.question-image-placeholder[hidden],
.question-image-fallback[hidden] {
  display: none !important;
}

.question-image-shell.is-loaded .question-image-placeholder {
  display: none;
}

.question-image-shell.has-error .question-image-placeholder {
  display: none;
}

.question-image-shell.has-error .question-image-fallback {
  position: relative;
  animation: none;
  background: var(--bg-option);
}

.question-image-shell.has-error .stem-image {
  display: none;
}

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

/* ---------- Option Buttons ---------- */
.options-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.answer-choice-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(56px, 1fr));
  gap: 10px;
}

.option-btn {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 18px;
  background: var(--bg-option);
  border: 2px solid var(--border-light);
  border-radius: var(--radius-md);
  cursor: pointer;
  text-align: left;
  font-family: var(--font-sans);
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--text-option);
  transition: all var(--transition);
  width: 100%;
}

.option-btn-compact {
  align-items: center;
  justify-content: center;
  min-height: 52px;
  padding: 10px;
}

.option-btn:hover:not(.locked) {
  background: var(--bg-option-hover);
  border-color: var(--accent);
}

.option-btn .option-letter {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text-muted);
  min-width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--bg-secondary);
  border: 1.5px solid var(--border-light);
  flex-shrink: 0;
  transition: all var(--transition);
}

.option-btn-compact .option-letter {
  min-width: 34px;
  width: 34px;
  height: 34px;
  font-size: 1rem;
}

/* Locked state after answer */
.option-btn.locked {
  cursor: default;
  opacity: 0.7;
}

.option-btn.correct {
  background: var(--bg-correct);
  border-color: var(--border-correct);
  color: var(--text-correct);
  opacity: 1 !important;
}

.option-btn.correct .option-letter {
  background: var(--border-correct);
  color: #fff;
  border-color: var(--border-correct);
}

.option-btn.wrong {
  background: var(--bg-wrong);
  border-color: var(--border-wrong);
  color: var(--text-wrong);
  opacity: 1 !important;
}

.option-btn.wrong .option-letter {
  background: var(--border-wrong);
  color: #fff;
  border-color: var(--border-wrong);
}

/* ---------- Navigation ---------- */
.question-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 20px;
  gap: 12px;
}

.question-nav .btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ---------- Question Palette ---------- */
.palette-grid {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 6px;
  margin-top: 16px;
}

.palette-dot {
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border-light);
  background: var(--bg-option);
  cursor: pointer;
  transition: all var(--transition);
  font-size: 0.7rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  font-family: var(--font-sans);
}

.palette-dot:hover {
  border-color: var(--accent);
  background: var(--accent-light);
}

.palette-dot.current {
  border-color: var(--accent);
  border-width: 2px;
  background: var(--accent-light);
  color: var(--accent);
}

.palette-dot.answered {
  background: var(--bg-correct);
  border-color: var(--border-correct);
  color: var(--text-correct);
}

.palette-dot.wrong-answered {
  background: var(--bg-wrong);
  border-color: var(--border-wrong);
  color: var(--text-wrong);
}

/* ---------- Stats Page ---------- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 18px;
  text-align: center;
}

.stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--accent);
}

.stat-label {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 4px;
}

.chapter-stat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
}

.chapter-stat-row .name {
  font-weight: 600;
  font-size: 0.9rem;
}

.chapter-stat-row .acc {
  font-size: 0.875rem;
  color: var(--accent);
  font-weight: 600;
}

/* ---------- Wrong Book ---------- */
.wrong-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  gap: 12px;
}

.wrong-list-item .info {
  flex: 1;
  min-width: 0;
}

.wrong-list-item .q-text {
  font-size: 0.875rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wrong-list-item .q-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ---------- Search ---------- */
.search-input {
  width: 100%;
  padding: 10px 16px;
  font-size: 0.9rem;
  font-family: var(--font-sans);
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--text-primary);
  transition: border-color var(--transition);
}

.search-input:focus {
  outline: none;
  border-color: var(--accent);
}

/* ---------- Filter Row ---------- */
.filter-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  align-items: center;
}

.select-input {
  padding: 8px 12px;
  font-size: 0.85rem;
  font-family: var(--font-sans);
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--text-primary);
  cursor: pointer;
}

.select-input:focus {
  outline: none;
  border-color: var(--accent);
}

/* ---------- Timer ---------- */
.timer-display {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  font-family: var(--font-mono);
}

.timer-display.warning {
  color: var(--accent-warn);
}

.timer-display.danger {
  color: var(--border-wrong);
}

/* ---------- Image Lightbox ---------- */
.lightbox-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: zoom-out;
  animation: fadeIn 150ms ease;
}

.lightbox-overlay img {
  max-width: 92vw;
  max-height: 92vh;
  object-fit: contain;
  border-radius: var(--radius-md);
  box-shadow: 0 0 60px rgba(0, 0, 0, 0.5);
}

.update-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.72);
  backdrop-filter: blur(6px);
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}

.update-modal {
  position: relative;
  width: min(100%, 520px);
  max-height: min(88vh, 760px);
  overflow-y: auto;
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border-light);
  border-radius: 20px;
  box-shadow: var(--shadow-lg);
  padding: 24px 24px 20px;
}

.update-modal-kicker {
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--accent-light);
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.update-modal-version {
  margin-top: 14px;
  font-size: 1.45rem;
  line-height: 1.25;
  letter-spacing: -0.02em;
}

.update-modal-title {
  margin-top: 8px;
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.6;
}

.update-modal-body {
  margin-top: 18px;
  display: grid;
  gap: 14px;
}

.update-section {
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background: var(--bg-option);
  border: 1px solid var(--border-light);
}

.update-section-label {
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 8px;
}

.update-section-list {
  margin: 0;
  padding-left: 18px;
  color: var(--text-secondary);
}

.update-section-list li + li {
  margin-top: 6px;
}

.update-modal-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 12px;
  margin-top: 20px;
  flex-wrap: wrap;
}

.update-modal-actions .btn:first-child {
  margin-right: auto;
}

.update-modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border-light);
  background: var(--bg-secondary);
  color: var(--text-secondary);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  transition: all var(--transition);
}

.update-modal-close:hover {
  color: var(--text-primary);
  border-color: var(--accent);
  background: var(--accent-light);
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ---------- Empty State ---------- */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-secondary);
}

.empty-state .icon-big {
  font-size: 3rem;
  margin-bottom: 12px;
}

.empty-state h3 {
  font-size: 1.1rem;
  color: var(--text-primary);
  margin-bottom: 6px;
}

/* ---------- Bookmarks Toggle ---------- */
.bookmark-toggle {
  background: none;
  border: none;
  font-size: 1.3rem;
  cursor: pointer;
  padding: 4px;
  transition: transform var(--transition);
  color: var(--text-muted);
}

.bookmark-toggle:hover { transform: scale(1.2); }
.bookmark-toggle.active { color: var(--accent-warn); }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-sidebar);
  color: var(--text-sidebar-active);
  padding: 10px 24px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 500;
  z-index: 999;
  box-shadow: var(--shadow-lg);
  animation: slideUp 250ms ease;
}

.auto-save-indicator {
  position: fixed;
  right: 22px;
  bottom: 22px;
  background: var(--bg-card);
  color: var(--text-secondary);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-md);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 0.78rem;
  font-weight: 600;
  z-index: 998;
  animation: fadeSlideUp 220ms ease;
  pointer-events: none;
}

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

@keyframes slideUp {
  from { transform: translateX(-50%) translateY(20px); opacity: 0; }
  to { transform: translateX(-50%) translateY(0); opacity: 1; }
}

/* ---------- Separator ---------- */
.separator {
  border: none;
  border-top: 1px solid var(--border-light);
  margin: 20px 0;
}

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
  :root { --sidebar-width: 0px; }

  .sidebar {
    transform: translateX(-100%);
    width: 280px;
  }

  .sidebar-open .sidebar { transform: translateX(0); }

  .main-content { margin-left: 0; }

  .top-bar { display: flex; }

  .content-wrapper { padding: 20px 16px 40px; }

  .card-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .card-grid .card {
    padding: 18px 18px 16px;
  }

  .stats-grid { grid-template-columns: repeat(2, 1fr); }

  .question-card { padding: 18px 16px 16px; }

  .question-stem { font-size: 1rem; }

  .option-btn { padding: 12px 14px; font-size: 0.9rem; }

  .palette-grid { grid-template-columns: repeat(6, 1fr); }

  .practice-controls { flex-direction: column; align-items: flex-start; }

  .card-grid .card .btn-group {
    margin-top: 16px;
  }

  .card-grid .card .btn-group .btn {
    flex: 1 1 100%;
    width: 100%;
  }

  .update-modal-overlay {
    align-items: flex-end;
    padding: 12px;
  }

  .update-modal {
    width: 100%;
    max-height: 82vh;
    border-radius: 18px 18px 0 0;
    padding: 20px 18px 18px;
  }

  .update-modal-version {
    font-size: 1.2rem;
  }

  .update-modal-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .update-modal-actions .btn:first-child {
    margin-right: 0;
  }

  .sidebar-signature {
    max-width: none;
  }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .palette-grid { grid-template-columns: repeat(5, 1fr); }
  .btn-group { flex-direction: column; }

  .card-grid .card {
    padding: 16px;
  }

  .card-grid .card .card-stats {
    gap: 10px;
  }
}

/* iPad portrait */
@media (min-width: 769px) and (max-width: 1024px) {
  :root { --sidebar-width: 220px; }
  .card-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 18px;
  }

  .card-grid .card {
    padding: 20px 20px 18px;
  }

  .card-grid .card .btn-group .btn {
    flex: 1 1 calc(50% - 5px);
  }
}

/* ---------- Print ---------- */
@media print {
  .sidebar, .top-bar { display: none; }
  .main-content { margin-left: 0; }
  .question-card { break-inside: avoid; box-shadow: none; }
}

/* ---------- Utility ---------- */
.hidden { display: none !important; }
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-accent { color: var(--accent); }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-16 { margin-bottom: 16px; }

/* ---------- Dashboard Redesign ---------- */

/* Welcome */
.db-welcome {
  margin-bottom: 24px;
}
.db-welcome h2 {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}
.db-welcome p {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* Hero Progress Card */
.db-hero {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 28px;
  box-shadow: var(--shadow-sm);
}
.db-hero-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.db-hero-header h3 {
  font-size: 0.95rem;
  font-weight: 650;
  color: var(--text-primary);
}
.db-hero-badge {
  font-size: 0.72rem;
  font-weight: 600;
  background: var(--accent-light);
  color: var(--accent);
  padding: 4px 10px;
  border-radius: 999px;
}
.db-hero-progress {
  margin-bottom: 20px;
}
.db-hero-bar {
  height: 8px;
  background: var(--bg-option);
  border-radius: 4px;
  overflow: hidden;
}
.db-hero-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-secondary));
  border-radius: 4px;
  transition: width 600ms cubic-bezier(0.4, 0, 0.2, 1);
}
.db-hero-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}
.db-hero-stat {
  text-align: center;
  padding: 10px 4px;
  background: var(--bg-primary);
  border-radius: var(--radius-sm);
}
.db-hero-stat-value {
  display: block;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-primary);
  font-family: var(--font-mono);
  letter-spacing: -0.02em;
}
.db-hero-stat-label {
  display: block;
  font-size: 0.68rem;
  color: var(--text-muted);
  margin-top: 3px;
  font-weight: 500;
}

/* Section Label */
.db-section-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  margin-bottom: 12px;
  margin-top: 4px;
}

/* Quick Start Cards */
.db-quickstart {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 28px;
}
.db-quick-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 18px 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 14px;
  transition: all var(--transition);
  box-shadow: var(--shadow-sm);
}
.db-quick-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--accent);
  transform: translateY(-1px);
}
.db-quick-card-icon {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: var(--accent-light);
  display: flex;
  align-items: center;
  justify-content: center;
}
.db-quick-card-icon svg {
  width: 20px;
  height: 20px;
  color: var(--accent);
}
.db-quick-card-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.db-quick-card-title {
  font-size: 0.88rem;
  font-weight: 650;
  color: var(--text-primary);
}
.db-quick-card-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Learning Summary */
.db-summary {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}
.db-summary-item {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 14px 10px;
  text-align: center;
}
.db-summary-value {
  display: block;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
  font-family: var(--font-mono);
}
.db-summary-label {
  display: block;
  font-size: 0.65rem;
  color: var(--text-muted);
  margin-top: 4px;
  font-weight: 500;
}

/* Responsive: Dashboard */
@media (max-width: 768px) {
  .db-hero-stats {
    grid-template-columns: repeat(2, 1fr);
  }
  .db-quickstart {
    grid-template-columns: 1fr;
  }
  .db-summary {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 480px) {
  .db-hero-stats {
    grid-template-columns: repeat(2, 1fr);
  }
  .db-summary {
    grid-template-columns: repeat(2, 1fr);
  }
  .db-hero {
    padding: 18px 14px;
  }
}

.gap-8 { gap: 8px; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
/* ---------- Explanation Box ---------- */
.explanation-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  margin-top: 10px;
  font-size: 0.825rem;
  font-weight: 600;
  font-family: var(--font-sans);
  color: var(--accent);
  background: var(--accent-light);
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
}

.explanation-toggle:hover {
  background: var(--accent);
  color: #fff;
}

.explanation-toggle .arrow {
  font-size: 0.7rem;
  transition: transform var(--transition);
}

.explanation-toggle.open .arrow {
  transform: rotate(180deg);
}

.recorrect-action {
  margin-top: 10px;
  text-align: center;
}

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

.recorrect-btn:hover {
  background: var(--bg-option-hover);
  color: var(--text-primary);
}

.explanation-content {
  display: none;
  margin-top: 10px;
  padding: 14px 16px;
  background: var(--bg-option);
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 0.875rem;
  line-height: 1.7;
  color: var(--text-secondary);
}

.explanation-content.visible {
  display: block;
}

.explanation-content strong {
  color: var(--text-primary);
}

/* ---------- Empty State (AS placeholder) ---------- */
.empty-icon {
  font-size: 3.5rem;
  margin-bottom: 16px;
  opacity: 0.8;
}

.empty-title {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.empty-text {
  font-size: 0.9rem;
  color: var(--text-secondary);
  max-width: 400px;
  margin: 0 auto 20px;
  line-height: 1.5;
}

.empty-action {
  margin-top: 8px;
}

/* ========================================================
   Landing Page
   ======================================================== */
.landing-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 56px);
  padding: 40px 24px 32px;
}

.landing-hero {
  text-align: center;
  margin-bottom: 48px;
}

.landing-hero h1 {
  font-size: 2.2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.landing-subtitle {
  margin-top: 10px;
  color: var(--text-secondary);
  font-size: 0.95rem;
  max-width: 480px;
  line-height: 1.6;
}

.syllabus-cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 28px;
  max-width: 760px;
  width: 100%;
}

.syllabus-card {
  background: var(--bg-card);
  border: 2px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 36px 32px 28px;
  cursor: pointer;
  transition: all 200ms ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  box-shadow: var(--shadow-sm);
}

.syllabus-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.syllabus-card-icon {
  font-size: 2.6rem;
  margin-bottom: 14px;
}

.syllabus-card-title {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.syllabus-card-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 4px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.syllabus-card-desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 10px;
  line-height: 1.5;
}

.syllabus-card-action {
  margin-top: 22px;
  padding: 10px 24px;
  background: var(--accent);
  color: #fff;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 600;
  transition: background var(--transition);
}

.syllabus-card:hover .syllabus-card-action {
  background: var(--accent-hover);
}

.landing-footer {
  margin-top: 48px;
  text-align: center;
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* Hide sidebar on landing page */
.app-layout.landing .sidebar {
  display: none;
}

.app-layout.landing .main-content {
  margin-left: 0;
}

/* Responsive landing */
@media (max-width: 768px) {
  .landing-page {
    padding: 32px 16px 24px;
    min-height: calc(100vh - 56px);
  }

  .landing-hero h1 {
    font-size: 1.6rem;
  }

  .landing-subtitle {
    font-size: 0.85rem;
  }

  .syllabus-cards {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .syllabus-card {
    padding: 28px 24px 22px;
  }

  .syllabus-card-icon {
    font-size: 2.2rem;
  }

  .syllabus-card-title {
    font-size: 1.15rem;
  }

  .app-layout.landing .top-bar {
    display: flex;
  }

  .app-layout.landing .main-content {
    padding-top: var(--header-height);
  }
}

/* On landing page in desktop: hide top bar */
@media (min-width: 769px) {
  .app-layout.landing .top-bar {
    display: none;
  }
}

/* ========================================================
   Random Practice Dashboard
   ======================================================== */

.random-dashboard {
  max-width: 720px;
  margin: 0 auto;
}

.random-dashboard .page-header h2 {
  font-size: 1.65rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.random-dashboard .page-header p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-top: 6px;
}

/* ---------- Setup Card ---------- */
.setup-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 28px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}

.setup-card-label {
  display: block;
  font-weight: 650;
  font-size: 0.825rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 12px;
}

/* ---------- Count Options (segmented control style) ---------- */
.count-options {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.count-option {
  position: relative;
  flex: 1;
  min-width: 90px;
}

.count-option input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.count-option label {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 16px;
  font-size: 0.9rem;
  font-weight: 600;
  font-family: var(--font-sans);
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--text-primary);
  cursor: pointer;
  transition: all var(--transition);
  user-select: none;
  text-align: center;
  white-space: nowrap;
}

.count-option label:hover {
  border-color: var(--accent);
  background: var(--accent-light);
}

.count-option input:checked + label {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* ---------- Difficulty Options ---------- */
.difficulty-options {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.diff-option {
  position: relative;
  flex: 1;
  min-width: 80px;
}

.diff-option input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.diff-option label {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 14px;
  font-size: 0.875rem;
  font-weight: 600;
  font-family: var(--font-sans);
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--text-primary);
  cursor: pointer;
  transition: all var(--transition);
  user-select: none;
  text-align: center;
}

.diff-option label:hover {
  border-color: var(--accent);
  background: var(--accent-light);
}

.diff-option input:checked + label {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.diff-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
}

.diff-dot.easy { background: #22c55e; }
.diff-dot.medium { background: #f59e0b; }
.diff-dot.hard { background: #ef4444; }
.diff-dot.mixed {
  background: conic-gradient(#22c55e 0deg 120deg, #f59e0b 120deg 240deg, #ef4444 240deg 360deg);
}

/* ---------- Scope Options ---------- */
.scope-options {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.scope-option {
  position: relative;
  flex: 1;
  min-width: 140px;
}

.scope-option input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.scope-option label {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 14px 16px;
  font-family: var(--font-sans);
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  cursor: pointer;
  transition: all var(--transition);
  user-select: none;
  text-align: center;
}

.scope-option label:hover {
  border-color: var(--accent);
  background: var(--accent-light);
}

.scope-option input:checked + label {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.scope-option .scope-icon {
  font-size: 1.3rem;
  line-height: 1;
}

.scope-option .scope-title {
  font-weight: 650;
  font-size: 0.85rem;
}

.scope-option .scope-count {
  font-size: 0.7rem;
  opacity: 0.8;
}

/* ---------- Session Summary Card ---------- */
.summary-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 24px 28px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}

.summary-card-header {
  font-weight: 650;
  font-size: 0.825rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 18px;
}

.summary-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 16px;
}

.summary-stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.summary-stat-value {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.summary-stat-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ---------- Start Button ---------- */
.random-start-btn {
  width: 100%;
  padding: 18px 24px;
  font-size: 1.05rem;
  font-weight: 700;
  font-family: var(--font-sans);
  background: linear-gradient(135deg, #2563eb 0%, #7c3aed 50%, #db2777 100%);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 200ms ease;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.3);
  letter-spacing: -0.01em;
}

.random-start-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(37, 99, 235, 0.4);
}

.random-start-btn:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.25);
}

/* ---------- Random Session Info Bar ---------- */
.random-session-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 20px;
  margin-bottom: 20px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  flex-wrap: wrap;
}

.random-session-stat {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.random-session-stat strong {
  color: var(--text-primary);
  font-weight: 650;
}

.random-session-stat .stat-icon {
  font-size: 1.1rem;
  line-height: 1;
}

/* ---------- Completion Screen ---------- */
.completion-screen {
  max-width: 520px;
  margin: 40px auto;
  text-align: center;
}

.completion-icon {
  font-size: 3.5rem;
  margin-bottom: 16px;
  animation: scaleIn 500ms ease;
}

@keyframes scaleIn {
  0% { transform: scale(0); opacity: 0; }
  50% { transform: scale(1.15); }
  100% { transform: scale(1); opacity: 1; }
}

.completion-screen h2 {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}

.completion-screen .completion-subtitle {
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin-bottom: 28px;
  line-height: 1.5;
}

.completion-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.completion-stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 18px 16px;
  box-shadow: var(--shadow-sm);
}

.completion-stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.completion-stat-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: 4px;
}

.completion-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.completion-actions .btn {
  min-width: 140px;
}

/* ---------- Responsive ---------- */
@media (max-width: 480px) {
  .random-dashboard {
    padding: 0;
  }

  .setup-card {
    padding: 20px 16px;
  }

  .count-options {
    flex-direction: column;
  }

  .scope-options {
    flex-direction: column;
  }

  .difficulty-options {
    flex-direction: column;
  }

  .summary-stats-grid {
    grid-template-columns: 1fr 1fr;
  }

  .random-session-bar {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }

  .completion-stats {
    grid-template-columns: 1fr 1fr;
  }
}
