:root {
  --bg-primary: #0a0f1d;
  --bg-secondary: #121a2f;
  --bg-card: rgba(23, 32, 54, 0.7);
  --bg-card-hover: rgba(30, 42, 72, 0.85);
  --border-color: rgba(255, 255, 255, 0.08);
  --border-active: #6366f1;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --accent-primary: #6366f1;
  --accent-secondary: #06b6d4;
  --accent-gradient: linear-gradient(135deg, #6366f1 0%, #3b82f6 50%, #06b6d4 100%);
  --success: #10b981;
  --success-bg: rgba(16, 185, 129, 0.15);
  --danger: #ef4444;
  --danger-bg: rgba(239, 68, 68, 0.15);
  --warning: #f59e0b;
  --warning-bg: rgba(245, 158, 11, 0.15);
  --font-family: 'Outfit', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-pill: 9999px;
  --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 10px 25px -5px rgba(0, 0, 0, 0.35);
  --shadow-glow: 0 0 25px rgba(99, 102, 241, 0.25);
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-family);
  background: radial-gradient(circle at 10% 20%, #171d33 0%, #0a0f1d 90%);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

/* ============================================================ */
/* UNIFIED HEADER & NAVIGATION PILLS                            */
/* ============================================================ */
header {
  background: rgba(18, 26, 47, 0.92);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
}

.header-main {
  padding: 0.85rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.logo-badge {
  background: var(--accent-gradient);
  color: #fff;
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius-sm);
  font-weight: 800;
  font-size: 1.1rem;
  letter-spacing: -0.5px;
  box-shadow: 0 0 15px rgba(99, 102, 241, 0.4);
}

.title-container h1 {
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.3px;
}

.title-container p {
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* Nav Pills (Top Level View Navigation) */
.nav-pills-group {
  display: flex;
  background: rgba(10, 15, 29, 0.8);
  padding: 4px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-color);
  gap: 4px;
}

.nav-pill-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 7px 18px;
  border-radius: var(--radius-pill);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: var(--transition);
}

.nav-pill-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.05);
}

.nav-pill-btn.active {
  background: var(--accent-primary);
  color: #fff;
  box-shadow: 0 2px 12px rgba(99, 102, 241, 0.4);
}

.nav-pill-counter {
  background: var(--danger);
  color: #fff;
  font-size: 0.75rem;
  padding: 1px 7px;
  border-radius: var(--radius-pill);
  font-weight: 800;
}

.header-right-controls {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.timer-box {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid var(--border-color);
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  font-family: monospace;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--accent-secondary);
}

.timer-box.warning {
  color: var(--warning);
  border-color: var(--warning);
  animation: pulse 1.5s infinite;
}

.timer-box.danger {
  color: var(--danger);
  border-color: var(--danger);
  animation: pulse 0.75s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.8; transform: scale(1.02); }
}

.btn-icon {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.btn-icon:hover {
  color: var(--text-main);
}

/* Secondary Subbar (Dataset & Mode Switcher) */
.header-subbar {
  padding: 0.6rem 2rem;
  background: rgba(10, 15, 29, 0.45);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.subbar-segment {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.subbar-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Unified Segmented Pills */
.pill-segmented {
  display: flex;
  background: rgba(18, 26, 47, 0.85);
  padding: 3px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-color);
  gap: 3px;
}

.seg-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 5px 14px;
  border-radius: var(--radius-pill);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.seg-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.05);
}

.seg-btn.active {
  background: var(--bg-card-hover);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.seg-btn.active.primary {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  box-shadow: 0 2px 10px rgba(99, 102, 241, 0.35);
}

/* ============================================================ */
/* LAYOUTS & CONTAINERS                                         */
/* ============================================================ */
.app-container {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 1.5rem;
  max-width: 1440px;
  width: 100%;
  margin: 0 auto;
  padding: 1.5rem 2rem;
  flex: 1;
}

/* Filter bar */
.filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  gap: 1rem;
  flex-wrap: wrap;
}

.category-select-wrapper {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.select-custom {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 8px 14px;
  border-radius: var(--radius-pill);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  outline: none;
  transition: var(--transition);
}

.select-custom:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.quick-actions {
  display: flex;
  gap: 0.75rem;
}

/* Common Buttons */
.btn-primary {
  background: var(--accent-gradient);
  color: #fff;
  border: none;
  padding: 10px 20px;
  border-radius: var(--radius-pill);
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.35);
  transition: var(--transition);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.5);
}

.btn-secondary {
  background: rgba(18, 26, 47, 0.85);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  padding: 8px 16px;
  border-radius: var(--radius-pill);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  transition: var(--transition);
}

.btn-secondary:hover {
  background: var(--bg-card-hover);
  border-color: rgba(255, 255, 255, 0.2);
}

.btn-danger {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid var(--danger);
  padding: 8px 16px;
  border-radius: var(--radius-pill);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  transition: var(--transition);
}

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

.btn-accent-fire {
  background: linear-gradient(135deg, #f97316 0%, #ef4444 100%);
  color: #fff;
  border: none;
  padding: 10px 20px;
  border-radius: var(--radius-pill);
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  box-shadow: 0 4px 15px rgba(239, 68, 68, 0.35);
  transition: var(--transition);
}

.btn-accent-fire:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(239, 68, 68, 0.5);
}

.topic-btn-train {
  background: rgba(99, 102, 241, 0.12);
  color: var(--accent-secondary);
  border: 1px solid rgba(99, 102, 241, 0.3);
  padding: 9px 16px;
  border-radius: var(--radius-pill);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: var(--transition);
  margin-top: auto;
}

.topic-btn-train:hover {
  background: var(--accent-primary);
  color: #fff;
  border-color: var(--accent-primary);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
}

.btn-primary:disabled,
.btn-secondary:disabled,
.btn-accent-fire:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

/* ============================================================ */
/* QUESTION CARD & OPTIONS                                      */
/* ============================================================ */
.main-stage {
  display: flex;
  flex-direction: column;
}

.question-card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow-md);
  margin-bottom: 1.5rem;
  position: relative;
  transition: var(--transition);
}

.question-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
}

.q-badge {
  background: rgba(99, 102, 241, 0.15);
  color: var(--accent-primary);
  font-weight: 700;
  font-size: 0.8rem;
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.q-badge.reserve {
  background: rgba(245, 158, 11, 0.15);
  color: var(--warning);
}

.flag-btn {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  border-radius: var(--radius-pill);
  padding: 4px 12px;
  font-size: 0.8rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: var(--transition);
}

.flag-btn.flagged {
  background: var(--warning-bg);
  border-color: var(--warning);
  color: var(--warning);
}

.question-title {
  font-size: 1.25rem;
  line-height: 1.55;
  font-weight: 600;
  color: #fff;
  margin-bottom: 1.75rem;
}

.options-list {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  margin-bottom: 1.5rem;
}

.option-item {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  background: rgba(18, 26, 47, 0.6);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.1rem 1.25rem;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  user-select: none;
}

.option-item:hover {
  background: var(--bg-card-hover);
  border-color: rgba(99, 102, 241, 0.4);
  transform: translateY(-1px);
}

.option-letter {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  font-weight: 700;
  font-size: 0.9rem;
  flex-shrink: 0;
  transition: var(--transition);
}

.option-text {
  font-size: 1rem;
  line-height: 1.5;
  flex: 1;
}

.option-item.selected {
  background: rgba(99, 102, 241, 0.2);
  border-color: var(--accent-primary);
  box-shadow: 0 0 15px rgba(99, 102, 241, 0.2);
}

.option-item.selected .option-letter {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: #fff;
}

.option-item.correct-reveal {
  background: var(--success-bg) !important;
  border-color: var(--success) !important;
}

.option-item.correct-reveal .option-letter {
  background: var(--success) !important;
  border-color: var(--success) !important;
  color: #fff !important;
}

.option-item.wrong-reveal {
  background: var(--danger-bg) !important;
  border-color: var(--danger) !important;
}

.option-item.wrong-reveal .option-letter {
  background: var(--danger) !important;
  border-color: var(--danger) !important;
  color: #fff !important;
}

/* Explanation Box */
.explanation-box {
  background: rgba(10, 15, 29, 0.85);
  border-left: 4px solid var(--accent-secondary);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  padding: 1.25rem 1.5rem;
  margin-top: 1rem;
  animation: fadeIn 0.3s ease-in-out;
}

.explanation-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  color: var(--accent-secondary);
  font-size: 0.95rem;
  margin-bottom: 0.5rem;
}

.explanation-law {
  font-size: 0.85rem;
  color: var(--warning);
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.explanation-body {
  font-size: 0.92rem;
  line-height: 1.6;
  color: #cbd5e1;
}

/* Navigation controls */
.nav-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-top: auto;
}

/* ============================================================ */
/* SIDEBAR / ANSWER SHEET                                       */
/* ============================================================ */
.sidebar {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  height: fit-content;
  position: sticky;
  top: 140px;
}

.sheet-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.75rem;
}

.sheet-title {
  font-size: 1rem;
  font-weight: 700;
}

.sheet-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  background: rgba(10, 15, 29, 0.5);
  padding: 0.75rem;
  border-radius: var(--radius-sm);
  text-align: center;
}

.stat-num {
  font-size: 1.15rem;
  font-weight: 800;
  display: block;
}

.stat-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
}

.question-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  max-height: 380px;
  overflow-y: auto;
  padding-right: 4px;
}

.grid-cell {
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(18, 26, 47, 0.7);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
}

.grid-cell:hover {
  border-color: var(--accent-primary);
  background: var(--bg-card-hover);
}

.grid-cell.current {
  border-color: #fff;
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.4);
}

.grid-cell.answered {
  background: rgba(99, 102, 241, 0.3);
  border-color: var(--accent-primary);
  color: #fff;
}

.grid-cell.flagged::after {
  content: '';
  position: absolute;
  top: 3px;
  right: 3px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--warning);
}

.grid-cell.correct {
  background: var(--success-bg) !important;
  border-color: var(--success) !important;
  color: var(--success) !important;
}

.grid-cell.wrong {
  background: var(--danger-bg) !important;
  border-color: var(--danger) !important;
  color: var(--danger) !important;
}

.btn-finish {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #fff;
  border: none;
  padding: 12px;
  border-radius: var(--radius-pill);
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(16, 185, 129, 0.35);
  transition: var(--transition);
}

.btn-finish:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.5);
}

/* ============================================================ */
/* DASHBOARD VIEW STYLES                                        */
/* ============================================================ */
.dashboard-container {
  max-width: 1440px;
  width: 100%;
  margin: 0 auto;
  padding: 1.5rem 2rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.dashboard-hero {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.25rem;
}

.hero-stat-card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

.hero-stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--accent-gradient);
}

.hero-stat-icon {
  font-size: 1.5rem;
}

.hero-stat-value {
  font-size: 2rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.5px;
}

.hero-stat-title {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 600;
}

/* Quiz Generator Actions Section */
.quiz-generator-box {
  background: linear-gradient(135deg, rgba(30, 42, 72, 0.7) 0%, rgba(18, 26, 47, 0.9) 100%);
  border: 1px solid rgba(99, 102, 241, 0.3);
  border-radius: var(--radius-lg);
  padding: 1.75rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 2rem;
  box-shadow: var(--shadow-glow);
}

.quiz-gen-text h2 {
  font-size: 1.35rem;
  font-weight: 700;
  margin-bottom: 0.4rem;
  color: #fff;
}

.quiz-gen-text p {
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

.quiz-gen-buttons {
  display: flex;
  gap: 1rem;
  flex-shrink: 0;
}

/* Topics Grid */
.dashboard-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.dashboard-section-header h2 {
  font-size: 1.25rem;
  font-weight: 700;
  color: #fff;
}

.topics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 1.25rem;
}

.topic-card {
  background: var(--bg-card);
  backdrop-filter: blur(14px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.4rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  transition: var(--transition);
}

.topic-card:hover {
  border-color: rgba(99, 102, 241, 0.35);
  background: var(--bg-card-hover);
  transform: translateY(-2px);
}

.topic-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}

.topic-card-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: #fff;
}

.topic-status-badge {
  font-size: 0.75rem;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.topic-status-badge.mastered {
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid var(--success);
}

.topic-status-badge.progress {
  background: var(--warning-bg);
  color: var(--warning);
  border: 1px solid var(--warning);
}

.topic-status-badge.reinforce {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid var(--danger);
}

.topic-stats-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.topic-stats-row strong {
  color: #fff;
}

/* History Table */
.history-card {
  background: var(--bg-card);
  backdrop-filter: blur(14px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  overflow-x: auto;
}

.history-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.9rem;
}

.history-table th {
  padding: 10px 14px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-color);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.history-table td {
  padding: 12px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.history-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

/* ============================================================ */
/* BANCO DE FALLOS SPECIAL PANEL                                */
/* ============================================================ */
.mistakes-container {
  max-width: 1440px;
  width: 100%;
  margin: 0 auto;
  padding: 1.5rem 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.mistakes-hero-box {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  text-align: center;
  box-shadow: var(--shadow-md);
}

.mistakes-hero-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  display: block;
}

.mistakes-hero-box h2 {
  font-size: 1.6rem;
  font-weight: 800;
  color: #fff;
  margin-bottom: 0.5rem;
}

.mistakes-hero-box p {
  color: var(--text-muted);
  max-width: 650px;
  margin: 0 auto 1.5rem;
  line-height: 1.6;
}

.mistakes-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.mistake-item-card {
  background: var(--bg-card);
  backdrop-filter: blur(14px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  transition: var(--transition);
}

.mistake-item-card:hover {
  border-color: rgba(239, 68, 68, 0.4);
  background: var(--bg-card-hover);
}

.mistake-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.mistake-item-text {
  font-size: 0.95rem;
  line-height: 1.5;
  color: #fff;
}

.mistake-item-law {
  font-size: 0.85rem;
  color: var(--accent-secondary);
  background: rgba(56, 189, 248, 0.08);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--accent-secondary);
}

/* Modal for Results */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
  padding: 1.5rem;
  animation: fadeIn 0.3s ease;
}

.modal-content {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  max-width: 680px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 2.5rem;
  box-shadow: var(--shadow-glow);
  position: relative;
  text-align: center;
}

.score-circle {
  width: 130px;
  height: 130px;
  border-radius: 50%;
  margin: 1rem auto 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(10, 15, 29, 0.9);
  border: 4px solid var(--accent-primary);
  box-shadow: 0 0 25px rgba(99, 102, 241, 0.4);
}

.score-number {
  font-size: 2.2rem;
  font-weight: 800;
  color: #fff;
}

.score-total {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.verdict-tag {
  display: inline-block;
  padding: 6px 18px;
  border-radius: var(--radius-pill);
  font-weight: 800;
  font-size: 0.95rem;
  letter-spacing: 0.5px;
  margin-bottom: 1.5rem;
}

.verdict-tag.pass {
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid var(--success);
}

.verdict-tag.fail {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid var(--danger);
}

.results-metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 2rem;
}

.metric-card {
  background: rgba(10, 15, 29, 0.6);
  padding: 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}

.metric-val {
  font-size: 1.4rem;
  font-weight: 800;
  margin-bottom: 4px;
}

.topic-breakdown {
  text-align: left;
  margin-bottom: 2rem;
}

.topic-breakdown h3 {
  font-size: 1rem;
  margin-bottom: 1rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.topic-bar-row {
  margin-bottom: 0.85rem;
}

.topic-bar-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 4px;
}

.progress-track {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-pill);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--accent-gradient);
  border-radius: var(--radius-pill);
  transition: width 0.6s ease;
}

.progress-fill.fill-success {
  background: var(--success);
}

.progress-fill.fill-warning {
  background: var(--warning);
}

.progress-fill.fill-danger {
  background: var(--danger);
}

.modal-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

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

/* Responsive */
@media (max-width: 992px) {
  .app-container {
    grid-template-columns: 1fr;
  }
  .sidebar {
    position: static;
  }
  .question-grid {
    grid-template-columns: repeat(10, 1fr);
  }
  .dashboard-hero {
    grid-template-columns: repeat(2, 1fr);
  }
  .quiz-generator-box {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 768px) {
  .header-main {
    flex-direction: column;
    align-items: flex-start;
    padding: 1rem;
  }
  .nav-pills-group {
    width: 100%;
    justify-content: space-between;
  }
  .header-subbar {
    padding: 0.75rem 1rem;
  }
  .app-container {
    padding: 1rem;
  }
  .dashboard-container {
    padding: 1rem;
  }
  .dashboard-hero {
    grid-template-columns: 1fr;
  }
  .topics-grid {
    grid-template-columns: 1fr;
  }
  .results-metrics {
    grid-template-columns: repeat(2, 1fr);
  }
  .question-grid {
    grid-template-columns: repeat(6, 1fr);
  }
}
