/* ============================================
   TCAE Quiz App — Design System
   OrganizaTuOpo · 2026
   ============================================ */

/* --- CSS Variables --- */
:root {
  /* Colors — Premium Light palette (Default) */
  --bg-primary: #f8fafc;
  --bg-secondary: #ffffff;
  --bg-card: #ffffff;
  --bg-glass: rgba(255, 255, 255, 0.6);
  --bg-glass-hover: rgba(255, 255, 255, 0.95);

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;

  --accent-primary: #7c3aed;
  --accent-primary-glow: rgba(124, 58, 237, 0.15);
  --accent-secondary: #c084fc;
  --accent-gradient: linear-gradient(135deg, #7c3aed, #a78bfa, #c084fc);

  --success: #10b981;
  --success-bg: #f0fdf4;
  --success-border: #bbf7d0;

  --error: #ef4444;
  --error-bg: #fef2f2;
  --error-border: #fecaca;

  --warning: #f59e0b;
  --warning-bg: rgba(245, 158, 11, 0.1);

  --border-subtle: #f1f5f9;
  --border-default: #e2e8f0;
  --border-hover: #cbd5e1;

  /* Typography */
  --font-primary: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-display: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  /* Spacing */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;
  --space-3xl: 4rem;

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

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
  --shadow-premium: 0 20px 40px -15px rgba(124, 58, 237, 0.07), 0 10px 20px -10px rgba(0, 0, 0, 0.03);
  --shadow-glow: 0 0 25px var(--accent-primary-glow);

  /* Transitions */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* Colors — Premium Dark palette overrides */
body.dark-theme {
  --bg-primary: #0b0f19;
  --bg-secondary: #111827;
  --bg-card: rgba(17, 24, 39, 0.8);
  --bg-glass: rgba(255, 255, 255, 0.03);
  --bg-glass-hover: rgba(255, 255, 255, 0.06);

  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --accent-primary: #8b5cf6;
  --accent-primary-glow: rgba(139, 92, 246, 0.25);
  --accent-secondary: #c084fc;
  --accent-gradient: linear-gradient(135deg, #8b5cf6, #a78bfa, #c084fc);

  --success: #10b981;
  --success-bg: rgba(16, 185, 129, 0.12);
  --success-border: rgba(16, 185, 129, 0.3);

  --error: #ef4444;
  --error-bg: rgba(239, 68, 68, 0.12);
  --error-border: rgba(239, 68, 68, 0.3);

  --border-subtle: rgba(255, 255, 255, 0.05);
  --border-default: rgba(255, 255, 255, 0.1);
  --border-hover: rgba(255, 255, 255, 0.15);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.4);
  --shadow-premium: 0 20px 40px -15px rgba(0, 0, 0, 0.6);
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

/* Animated background gradient */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background:
    radial-gradient(ellipse at 15% 10%, rgba(124, 58, 237, 0.05) 0%, transparent 50%),
    radial-gradient(ellipse at 85% 90%, rgba(96, 165, 250, 0.06) 0%, transparent 55%),
    radial-gradient(ellipse at 50% 50%, rgba(124, 58, 237, 0.02) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

body.dark-theme::before {
  background:
    radial-gradient(ellipse at 15% 10%, rgba(139, 92, 246, 0.09) 0%, transparent 50%),
    radial-gradient(ellipse at 85% 90%, rgba(59, 130, 246, 0.07) 0%, transparent 55%),
    radial-gradient(ellipse at 50% 50%, rgba(139, 92, 246, 0.03) 0%, transparent 70%);
}

/* --- Layout --- */
.app-container {
  position: relative;
  z-index: 1;
  max-width: 800px;
  margin: 0 auto;
  padding: var(--space-lg);
  min-height: 100vh;
}

/* --- Header --- */
.app-header {
  text-align: center;
  padding: var(--space-2xl) 0 var(--space-xl);
}

.app-logo {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: var(--space-md);
}

.app-logo-icon {
  font-size: 1.2rem;
}

.app-title {
  font-size: 2.2rem;
  font-weight: 800;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.02em;
  margin-bottom: var(--space-sm);
}

.app-subtitle {
  color: var(--text-secondary);
  font-size: 1rem;
  font-weight: 400;
}

/* --- Cards --- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: all var(--transition-base);
}

.card:hover {
  border-color: var(--border-hover);
  background: var(--bg-glass-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.card-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-lg);
  margin-top: var(--space-xl);
}

.card-action {
  cursor: pointer;
  text-align: center;
  position: relative;
  overflow: hidden;
}

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

.card-action:hover::before {
  opacity: 1;
}

.card-icon {
  font-size: 2.5rem;
  margin-bottom: var(--space-md);
  display: block;
}

.card-title {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: var(--space-sm);
  color: var(--text-primary);
}

.card-desc {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* --- Screens (views) --- */
.screen {
  display: none;
  animation: fadeSlideIn 0.35s ease-out;
}

.screen.active {
  display: block;
}

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

/* --- Select / Dropdown --- */
.select-group {
  margin-bottom: var(--space-lg);
}

.select-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: var(--space-sm);
}

.select-input {
  width: 100%;
  padding: var(--space-md) var(--space-lg);
  background: var(--bg-glass);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-primary);
  font-size: 0.95rem;
  cursor: pointer;
  transition: all var(--transition-fast);
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none'%3E%3Cpath d='M1 1.5l5 5 5-5' stroke='%2394a3b8' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
}

.select-input:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--accent-primary-glow);
}

.select-input option {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

.select-input optgroup {
  font-weight: 700;
  color: var(--accent-primary);
  background: var(--bg-secondary);
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-xl);
  font-family: var(--font-primary);
  font-size: 0.95rem;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
}

.btn-primary {
  background: var(--accent-gradient);
  color: white;
  box-shadow: var(--shadow-sm), 0 0 20px var(--accent-primary-glow);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md), 0 0 30px var(--accent-primary-glow);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-primary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-secondary {
  background: var(--bg-glass);
  color: var(--text-primary);
  border: 1px solid var(--border-default);
}

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

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  padding: var(--space-sm) var(--space-md);
}

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

.btn-block {
  width: 100%;
}

/* --- Back button --- */
.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px 9px 12px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-full);
  color: var(--text-secondary);
  font-family: var(--font-primary);
  font-size: 0.88rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: all var(--transition-fast);
  box-shadow: var(--shadow-sm);
  margin-bottom: var(--space-lg);
}

.back-btn:hover {
  background: var(--accent-primary-glow);
  border-color: var(--accent-primary);
  color: var(--accent-primary);
  transform: translateX(-3px);
  box-shadow: var(--shadow-sm), 0 0 0 3px var(--accent-primary-glow);
}

/* Back button inside quiz top bar keeps its compact style */
.quiz-top-bar .back-btn {
  margin-bottom: 0;
  padding: 7px 14px 7px 10px;
  font-size: 0.85rem;
}

/* ============================================
   TCAE Quiz App — Modern Overhaul Cabecera & Quiz
   ============================================ */

/* Quiz Top Bar */
.quiz-top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-sm) 0 var(--space-md);
  margin-bottom: var(--space-md);
  border-bottom: 1px solid var(--border-subtle);
  position: relative;
  z-index: 5;
}

.quiz-top-bar-left {
  display: flex;
  align-items: center;
}

.quiz-top-bar-center {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  min-width: 0;
  flex: 1 1 auto;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--text-primary);
  max-width: 50%;
}

.quiz-top-title {
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.quiz-top-icon {
  font-size: 1.2rem;
}

.quiz-top-bar-right {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.icon-btn {
  background: var(--bg-glass);
  border: 1px solid var(--border-default);
  width: 38px;
  height: 38px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.icon-btn:hover {
  background: var(--bg-glass-hover);
  border-color: var(--border-hover);
  color: var(--text-primary);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.icon-btn:active, .icon-btn.active {
  background: var(--accent-primary-glow);
  color: var(--accent-primary);
  border-color: var(--accent-primary);
}

/* Quiz Progress Container */
.quiz-progress-container {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: var(--space-lg);
  background: var(--bg-secondary);
  padding: var(--space-md) var(--space-xl);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-subtle);
  margin-bottom: var(--space-xl);
}

.quiz-progress-counter-group {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}

.quiz-progress-counter-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 700;
  letter-spacing: 0.05em;
}

.quiz-progress-counter-num {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text-primary);
}

#quiz-counter-current {
  color: var(--accent-primary);
}

.quiz-counter-sep {
  color: var(--text-muted);
  font-weight: 400;
  font-size: 1.1rem;
}

#quiz-counter-total {
  color: var(--text-secondary);
  font-size: 1.1rem;
  font-weight: 500;
}

.quiz-progress-bar-wrapper {
  width: 100%;
}

.quiz-progress-bar {
  width: 100%;
  height: 8px;
  background: var(--border-subtle);
  border-radius: var(--radius-full);
  overflow: hidden;
  position: relative;
}

.quiz-progress-fill {
  height: 100%;
  background: var(--accent-gradient);
  border-radius: var(--radius-full);
  transition: width var(--transition-slow);
}

.quiz-progress-score-wrapper {
  display: flex;
  align-items: center;
}

.quiz-progress-score-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: 6px 12px;
  background: var(--success-bg);
  border: 1px solid var(--success-border);
  color: var(--success);
  font-weight: 600;
  font-size: 0.82rem;
  border-radius: var(--radius-full);
  box-shadow: 0 2px 4px rgba(16, 185, 129, 0.05);
}

.score-badge-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: var(--radius-full);
  background: var(--success);
  color: white;
}

/* Question card */
.question-card {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: var(--space-xl);
  box-shadow: var(--shadow-premium);
  margin-bottom: var(--space-lg);
  overflow: hidden;
}

.question-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-lg);
  position: relative;
  z-index: 2;
}

.question-badge {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  background: var(--accent-primary-glow);
  border-radius: var(--radius-full);
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--accent-primary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.question-badge.badge-incorrect {
  background: var(--warning-bg);
  color: var(--warning);
}

.favorite-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
  padding: var(--space-xs);
  display: flex;
  align-items: center;
  justify-content: center;
}

.favorite-btn:hover {
  color: #eab308;
  transform: scale(1.1);
}

.favorite-btn.active .star-icon {
  fill: #eab308;
  stroke: #eab308;
}

/* Clipboard Vector Illustration */
.question-illustration {
  position: absolute;
  top: -6px;
  right: -6px;
  opacity: 0.9;
  pointer-events: none;
  z-index: 1;
  transition: transform var(--transition-slow);
}

.question-card:hover .question-illustration {
  transform: rotate(2deg) scale(1.02);
}

.question-text {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.55;
  color: var(--text-primary);
  word-break: break-word;
  position: relative;
  z-index: 2;
  margin-bottom: var(--space-md);
  max-width: calc(100% - 90px);
}

.question-underline {
  width: 44px;
  height: 4px;
  background: var(--accent-primary);
  border-radius: var(--radius-full);
  margin-bottom: var(--space-xl);
}

/* Answer options */
.answers-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  margin-bottom: var(--space-sm);
  position: relative;
  z-index: 2;
}

.answer-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  width: 100%;
  padding: var(--space-md) var(--space-lg);
  background: var(--bg-secondary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-primary);
  font-size: 0.95rem;
  text-align: left;
  cursor: pointer;
  transition: all var(--transition-fast);
  box-shadow: var(--shadow-sm);
}

.answer-btn:hover:not(:disabled) {
  border-color: var(--accent-primary);
  background: var(--bg-glass-hover);
  transform: translateX(4px);
  box-shadow: var(--shadow-md);
}

.answer-btn:disabled {
  cursor: default;
}

.answer-letter {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  background: var(--border-subtle);
  border: 1px solid var(--border-default);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--accent-primary);
  transition: all var(--transition-fast);
}

.answer-text {
  flex-grow: 1;
  font-weight: 500;
  word-break: break-word;
  line-height: 1.45;
}

.answer-indicator {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border-radius: var(--radius-full);
  border: 2px solid var(--border-default);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

/* Answer states styling */
.answer-btn.correct {
  border-color: var(--success) !important;
  background: var(--success-bg) !important;
}

.answer-btn.correct .answer-letter {
  background: var(--success) !important;
  border-color: var(--success) !important;
  color: white !important;
}

.answer-btn.correct .answer-indicator {
  border-color: var(--success) !important;
  background: var(--success) !important;
  color: white !important;
}

.answer-btn.incorrect {
  border-color: var(--error) !important;
  background: var(--error-bg) !important;
}

.answer-btn.incorrect .answer-letter {
  background: var(--error) !important;
  border-color: var(--error) !important;
  color: white !important;
}

.answer-btn.incorrect .answer-indicator {
  border-color: var(--error) !important;
  background: var(--error) !important;
  color: white !important;
}

.answer-btn.dimmed {
  opacity: 0.55;
  box-shadow: none;
}

/* Indicator icons inside indicator circle */
.indicator-icon {
  display: block;
}

/* Recuerda Card (Explanation Box) */
.recuerda-section {
  display: flex;
  gap: var(--space-md);
  background: #faf5ff;
  border: 1px solid #f3e8ff;
  border-radius: var(--radius-md);
  padding: var(--space-md) var(--space-lg);
  margin-top: var(--space-xl);
  animation: fadeSlideIn var(--transition-base);
  position: relative;
  overflow: hidden;
}

body.dark-theme .recuerda-section {
  background: rgba(124, 58, 237, 0.08);
  border-color: rgba(124, 58, 237, 0.18);
}

.recuerda-left {
  flex-shrink: 0;
}

.recuerda-icon-wrapper {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  background: var(--accent-primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 10px var(--accent-primary-glow);
}

.recuerda-content {
  flex-grow: 1;
  position: relative;
  z-index: 2;
}

.recuerda-title {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--accent-primary);
  margin-bottom: var(--space-xs);
}

.recuerda-text {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.recuerda-text strong {
  color: var(--accent-primary);
}

.recuerda-right {
  flex-shrink: 0;
  display: flex;
  align-items: center;
}

.recuerda-brain {
  transform: translateY(-2px);
  opacity: 0.9;
}

/* Quiz Navigation Footer */
.quiz-footer-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: var(--space-xl);
  gap: var(--space-md);
}

.btn-nav-prev, .btn-nav-review, .btn-nav-next {
  border-radius: var(--radius-full);
  padding: 12px 22px;
  font-size: 0.9rem;
}

.btn-nav-prev, .btn-nav-review {
  background: var(--bg-secondary);
  color: var(--text-secondary);
  border: 1px solid var(--border-default);
  box-shadow: var(--shadow-sm);
}

.btn-nav-prev:hover:not(:disabled) {
  background: var(--bg-glass-hover);
  border-color: var(--accent-primary);
  color: var(--accent-primary);
  transform: translateX(-2px);
  box-shadow: var(--shadow-md);
}

.btn-nav-review:hover {
  background: var(--bg-glass-hover);
  border-color: var(--border-hover);
  color: var(--text-primary);
}

.btn-nav-review.active {
  background: var(--accent-primary-glow);
  color: var(--accent-primary);
  border-color: var(--accent-primary);
}

.btn-nav-prev:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  transform: none !important;
}

.btn-nav-next {
  background: var(--accent-gradient);
  color: white;
  box-shadow: 0 4px 15px var(--accent-primary-glow);
  border: none;
}

.btn-nav-next:hover:not(:disabled) {
  box-shadow: 0 6px 25px var(--accent-primary-glow);
  transform: translateY(-2px) translateX(2px);
}

.btn-nav-next:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none;
}

/* --- Generator: Theme checkboxes --- */
.themes-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-xs);
  margin-bottom: var(--space-xl);
  max-height: 400px;
  overflow-y: auto;
  padding-right: var(--space-sm);
}

.themes-grid::-webkit-scrollbar {
  width: 4px;
}

.themes-grid::-webkit-scrollbar-track {
  background: transparent;
}

.themes-grid::-webkit-scrollbar-thumb {
  background: var(--border-default);
  border-radius: var(--radius-full);
}

.theme-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition-fast);
  user-select: none;
}

.theme-item:hover {
  background: var(--bg-glass);
}

.theme-checkbox {
  appearance: none;
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border: 2px solid var(--border-default);
  border-radius: 4px;
  cursor: pointer;
  position: relative;
  flex-shrink: 0;
  transition: all var(--transition-fast);
}

.theme-checkbox:checked {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
}

.theme-checkbox:checked::after {
  content: '✓';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: white;
  font-size: 12px;
  font-weight: 700;
}

.theme-label {
  font-size: 0.9rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: color var(--transition-fast);
}

.theme-item:hover .theme-label {
  color: var(--text-primary);
}

.theme-num {
  font-weight: 700;
  color: var(--accent-primary);
  min-width: 28px;
}

/* Quick select buttons */
.theme-actions {
  display: flex;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
}

/* Question count selector */
.count-selector {
  display: flex;
  gap: var(--space-sm);
  flex-wrap: wrap;
  margin-bottom: var(--space-xl);
}

.count-btn {
  padding: var(--space-sm) var(--space-lg);
  background: var(--bg-glass);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-full);
  color: var(--text-secondary);
  font-family: var(--font-primary);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.count-btn:hover {
  border-color: var(--border-hover);
  color: var(--text-primary);
}

.count-btn.active {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: white;
  box-shadow: 0 0 12px var(--accent-primary-glow);
}

.count-custom {
  width: 80px;
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-glass);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-full);
  color: var(--text-primary);
  font-family: var(--font-primary);
  font-size: 0.9rem;
  font-weight: 600;
  text-align: center;
  transition: all var(--transition-fast);
}

.count-custom:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--accent-primary-glow);
}

/* --- Results screen --- */
.results-header {
  text-align: center;
  padding: var(--space-2xl) 0;
}

.results-score {
  font-size: 4rem;
  font-weight: 800;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.results-label {
  font-size: 1rem;
  color: var(--text-secondary);
  margin-top: var(--space-xs);
}

.results-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-md);
  margin-bottom: var(--space-xl);
}

.stat-card {
  background: var(--bg-glass);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  text-align: center;
}

.stat-value {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--text-primary);
}

.stat-value.stat-correct {
  color: var(--success);
}

.stat-value.stat-wrong {
  color: var(--error);
}

.stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: var(--space-xs);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Mistakes list */
.mistakes-section {
  margin-top: var(--space-xl);
}

.mistakes-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: var(--space-lg);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.mistake-item {
  background: var(--bg-glass);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  margin-bottom: var(--space-md);
}

.mistake-question {
  font-size: 0.95rem;
  color: var(--text-primary);
  margin-bottom: var(--space-md);
  line-height: 1.6;
}

.mistake-answer {
  font-size: 0.85rem;
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-sm);
  margin-bottom: var(--space-xs);
}

.mistake-answer.your-answer {
  background: var(--error-bg);
  border: 1px solid var(--error-border);
  color: var(--error);
}

.mistake-answer.correct-answer {
  background: var(--success-bg);
  border: 1px solid var(--success-border);
  color: var(--success);
}

/* --- Loading spinner --- */
.loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-3xl);
  color: var(--text-muted);
}

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border-default);
  border-top-color: var(--accent-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: var(--space-md);
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* --- Empty state --- */
.empty-state {
  text-align: center;
  padding: var(--space-3xl) var(--space-xl);
  color: var(--text-muted);
}

.empty-state-icon {
  font-size: 3rem;
  margin-bottom: var(--space-md);
  opacity: 0.5;
}

/* --- Error state --- */
.error-box {
  background: var(--error-bg);
  border: 1px solid var(--error-border);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  color: var(--error);
  font-size: 0.9rem;
  margin-bottom: var(--space-lg);
}

/* --- Section titles --- */
.section-title {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: var(--space-lg);
}

.section-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: calc(var(--space-xs) * -1);
  margin-bottom: var(--space-lg);
}

/* --- Exam count badge --- */
.exam-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 24px;
  padding: 0 var(--space-sm);
  background: var(--accent-primary-glow);
  color: var(--accent-primary);
  font-size: 0.75rem;
  font-weight: 700;
  border-radius: var(--radius-full);
  margin-left: var(--space-sm);
}

/* --- Responsive --- */
@media (max-width: 640px) {
  .app-container {
    padding: var(--space-md);
  }

  .app-title {
    font-size: 1.6rem;
  }

  /* Barra superior del test: evitar que se apelotonen iconos y cronómetro */
  .quiz-top-bar {
    gap: var(--space-sm);
  }

  .quiz-top-bar .back-btn {
    padding: 7px 10px;
    font-size: 0.8rem;
  }

  .quiz-top-bar-center {
    font-size: 0.9rem;
    max-width: none;
  }

  .quiz-top-icon {
    font-size: 1rem;
  }

  .quiz-top-bar-right {
    gap: var(--space-xs);
    flex-shrink: 0;
  }

  .quiz-top-bar-right .icon-btn {
    width: 34px;
    height: 34px;
  }

  .quiz-top-bar-right .icon-btn svg {
    width: 18px;
    height: 18px;
  }

  .quiz-timer {
    padding: 5px 9px;
    font-size: 0.8rem;
  }
}

/* Pantallas muy estrechas: el título del examen estorba, se oculta */
@media (max-width: 430px) {
  .quiz-top-bar-center {
    display: none;
  }
}

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

  .card {
    padding: var(--space-lg);
  }

  .question-card {
    padding: var(--space-lg);
  }

  .question-illustration {
    display: none !important;
  }

  .question-text {
    max-width: 100%;
  }

  .quiz-progress-container {
    grid-template-columns: 1fr;
    gap: var(--space-md);
    padding: var(--space-md);
    text-align: center;
  }

  .quiz-progress-counter-group {
    align-items: center;
  }

  .quiz-progress-score-wrapper {
    justify-content: center;
  }

  .recuerda-section {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .recuerda-brain {
    display: none;
  }

  .quiz-footer-nav {
    flex-direction: column;
    gap: var(--space-sm);
  }

  .quiz-footer-nav button {
    width: 100%;
    justify-content: center;
  }

  .results-stats {
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-sm);
  }

  .stat-card {
    padding: var(--space-md);
  }

  .stat-value {
    font-size: 1.4rem;
  }

  .results-score {
    font-size: 3rem;
  }

  .count-selector {
    justify-content: center;
  }
}

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

/* --- Utility --- */
.hidden {
  display: none !important;
}

.text-center {
  text-align: center;
}

.mt-lg {
  margin-top: var(--space-lg);
}

.mt-xl {
  margin-top: var(--space-xl);
}

.mb-lg {
  margin-bottom: var(--space-lg);
}

/* Exam info pill in quiz */
.quiz-exam-info {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-xs) var(--space-md);
  background: var(--bg-glass);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: var(--space-lg);
}

/* Results buttons */
.results-actions {
  display: flex;
  gap: var(--space-md);
  justify-content: center;
  margin-top: var(--space-xl);
  flex-wrap: wrap;
}

/* Score ring animation */
@keyframes scoreReveal {
  from {
    opacity: 0;
    transform: scale(0.8);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.results-header {
  animation: scoreReveal 0.5s ease-out;
}

/* Confetti-like dots for good scores */
.results-header.excellent::before {
  content: '🎉';
  font-size: 2rem;
  display: block;
  margin-bottom: var(--space-sm);
}

.results-header.good::before {
  content: '💪';
  font-size: 2rem;
  display: block;
  margin-bottom: var(--space-sm);
}

.results-header.needs-work::before {
  content: '📚';
  font-size: 2rem;
  display: block;
  margin-bottom: var(--space-sm);
}

/* ============================================
   v2 — Dashboard, modes, stats, settings
   ============================================ */

/* Home settings gear */
.home-settings {
  position: absolute;
  top: var(--space-lg);
  right: var(--space-lg);
  z-index: 6;
}

#screen-home { position: relative; }

/* Home stats strip */
.home-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
}

.home-stat {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-md);
  text-align: center;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.home-stat-value {
  display: block;
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.2;
}

.home-stat-label {
  display: block;
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: var(--space-xs);
}

/* Resume banner */
.resume-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  flex-wrap: wrap;
  background: var(--accent-primary-glow);
  border: 1px solid var(--accent-primary);
  border-radius: var(--radius-lg);
  padding: var(--space-md) var(--space-lg);
  margin-bottom: var(--space-lg);
}

.resume-banner-text { display: flex; flex-direction: column; }
.resume-banner-title { font-weight: 700; color: var(--accent-primary); font-size: 0.95rem; }
.resume-banner-info { font-size: 0.82rem; color: var(--text-secondary); }
.resume-banner-actions { display: flex; gap: var(--space-sm); }

.btn-sm { padding: var(--space-xs) var(--space-md); font-size: 0.82rem; }

/* Card badges (counts on home cards) */
.card-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  background: var(--accent-primary);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  border-radius: var(--radius-full);
  vertical-align: middle;
  margin-left: 4px;
}

/* Quiz timer */
.quiz-timer {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  background: var(--warning-bg);
  border: 1px solid var(--warning);
  color: var(--warning);
  border-radius: var(--radius-full);
  font-family: var(--font-mono, monospace);
  font-weight: 700;
  font-size: 0.85rem;
}

/* Simulacro selected answer (no correctness shown) */
.answer-btn.selected {
  border-color: var(--accent-primary) !important;
  background: var(--accent-primary-glow) !important;
}
.answer-btn.selected .answer-letter {
  background: var(--accent-primary) !important;
  border-color: var(--accent-primary) !important;
  color: #fff !important;
}

/* Info callout */
.info-callout {
  display: flex;
  gap: var(--space-sm);
  align-items: flex-start;
  background: var(--warning-bg);
  border: 1px solid var(--warning);
  border-radius: var(--radius-md);
  padding: var(--space-md) var(--space-lg);
  margin-bottom: var(--space-lg);
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.5;
}
.info-callout-icon { flex-shrink: 0; }

/* Simulacro result block */
.sim-result {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  margin-bottom: var(--space-lg);
  text-align: center;
}
.sim-result-main { margin-bottom: var(--space-md); }
.sim-result-net {
  display: block;
  font-family: var(--font-display);
  font-size: 2.8rem;
  font-weight: 800;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.sim-result-net-label { font-size: 0.8rem; color: var(--text-muted); }
.sim-result-meta {
  display: flex;
  justify-content: center;
  gap: var(--space-xl);
  font-size: 0.9rem;
  color: var(--text-secondary);
}

/* Retry-wrong button accent */
.btn-retry-wrong {
  border-color: var(--accent-primary) !important;
  color: var(--accent-primary) !important;
}

/* Favorites list */
.fav-list { display: flex; flex-direction: column; gap: var(--space-sm); }
.fav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  background: var(--bg-glass);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-md);
}
.fav-item-text { font-size: 0.9rem; color: var(--text-primary); line-height: 1.45; }
.fav-remove {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-default);
  background: var(--bg-secondary);
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
}
.fav-remove:hover { color: var(--error); border-color: var(--error); }

/* Subsection title */
.subsection-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: var(--space-xl) 0 var(--space-md);
}

/* Stats — per-theme bars */
.stats-themes { display: flex; flex-direction: column; gap: var(--space-md); }
.theme-stat-row { display: flex; flex-direction: column; gap: 6px; }
.theme-stat-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--space-md);
}
.theme-stat-name { font-size: 0.85rem; color: var(--text-secondary); }
.theme-stat-pct { font-size: 0.85rem; font-weight: 700; color: var(--text-primary); white-space: nowrap; }
.theme-stat-frac { font-weight: 400; color: var(--text-muted); font-size: 0.78rem; }
.theme-stat-bar {
  height: 8px;
  background: var(--border-subtle);
  border-radius: var(--radius-full);
  overflow: hidden;
}
.theme-stat-fill { height: 100%; border-radius: var(--radius-full); transition: width var(--transition-slow); }
.bar-good { background: var(--success); }
.bar-mid { background: var(--warning); }
.bar-bad { background: var(--error); }

/* Stats — history */
.stats-history { display: flex; flex-direction: column; gap: var(--space-xs); }
.history-row {
  display: flex;
  justify-content: space-between;
  gap: var(--space-md);
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-glass);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
}
.history-name { color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history-meta { color: var(--text-primary); font-weight: 600; white-space: nowrap; }
.empty-hint { font-size: 0.85rem; color: var(--text-muted); padding: var(--space-md) 0; }

/* Settings modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-lg);
  animation: fadeSlideIn 0.2s ease-out;
}
.modal {
  width: 100%;
  max-width: 440px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  padding: var(--space-xl);
  box-shadow: var(--shadow-lg);
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-lg);
}
.modal-title { font-family: var(--font-display); font-size: 1.2rem; font-weight: 700; color: var(--text-primary); }
.modal-close {
  background: none;
  border: none;
  font-size: 1.1rem;
  color: var(--text-muted);
  cursor: pointer;
  padding: var(--space-xs);
}
.modal-close:hover { color: var(--text-primary); }

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  padding: var(--space-md) 0;
  border-bottom: 1px solid var(--border-subtle);
  cursor: pointer;
}
.setting-text { display: flex; flex-direction: column; }
.setting-name { font-size: 0.95rem; font-weight: 600; color: var(--text-primary); }
.setting-desc { font-size: 0.8rem; color: var(--text-muted); }

/* Toggle switch */
.switch {
  appearance: none;
  -webkit-appearance: none;
  width: 46px;
  height: 26px;
  border-radius: var(--radius-full);
  background: var(--border-default);
  position: relative;
  cursor: pointer;
  flex-shrink: 0;
  transition: background var(--transition-fast);
}
.switch::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  transition: transform var(--transition-fast);
  box-shadow: var(--shadow-sm);
}
.switch:checked { background: var(--accent-primary); }
.switch:checked::after { transform: translateX(20px); }

/* Three-or-more cards: keep two columns on desktop */
@media (max-width: 640px) {
  .home-stats { gap: var(--space-sm); }
  .home-stat-value { font-size: 1.2rem; }
  .sim-result-meta { gap: var(--space-md); }
}

/* ============================================
   Login / Registro
   ============================================ */
.auth-wrap {
  max-width: 420px;
  margin: 0 auto;
  padding-top: var(--space-lg);
}

.auth-header { padding: var(--space-xl) 0 var(--space-lg); }

.auth-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: var(--space-xl);
  box-shadow: var(--shadow-premium);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

/* Segmented tabs */
.auth-tabs {
  display: flex;
  gap: 4px;
  background: var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 4px;
  margin-bottom: var(--space-lg);
}
.auth-tab {
  flex: 1;
  padding: var(--space-sm) var(--space-md);
  border: none;
  background: transparent;
  border-radius: calc(var(--radius-md) - 3px);
  font-family: var(--font-primary);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
}
.auth-tab.active {
  background: var(--bg-secondary);
  color: var(--accent-primary);
  box-shadow: var(--shadow-sm);
}

.auth-field { margin-bottom: var(--space-md); }

.auth-input {
  width: 100%;
  padding: var(--space-md) var(--space-lg);
  background: var(--bg-glass);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-primary);
  font-size: 0.95rem;
  transition: all var(--transition-fast);
}
.auth-input::placeholder { color: var(--text-muted); }
.auth-input:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--accent-primary-glow);
}

.auth-forgot {
  display: block;
  text-align: right;
  font-size: 0.82rem;
  color: var(--accent-primary);
  cursor: pointer;
  margin-bottom: var(--space-lg);
}
.auth-forgot:hover { text-decoration: underline; }

.auth-note {
  font-size: 0.78rem;
  color: var(--text-muted);
  text-align: center;
  margin-top: var(--space-md);
  line-height: 1.5;
}
.auth-note-warn { color: var(--error); font-weight: 600; }

/* Tiers comparison */
.auth-tiers {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-md);
  margin-top: var(--space-lg);
}
.tier-card {
  position: relative;
  background: var(--bg-glass);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  text-align: center;
}
.tier-card-premium {
  border-color: var(--accent-primary);
  background: var(--accent-primary-glow);
}
.tier-badge-premium {
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--accent-gradient);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 3px 10px;
  border-radius: var(--radius-full);
}
.tier-name {
  display: block;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1rem;
  color: var(--text-primary);
}
.tier-price {
  display: block;
  font-size: 0.82rem;
  color: var(--accent-primary);
  font-weight: 600;
  margin: 2px 0 var(--space-md);
}
.tier-feats {
  list-style: none;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.tier-feats li {
  font-size: 0.78rem;
  color: var(--text-secondary);
  line-height: 1.4;
}
.tier-feats .tier-off { color: var(--text-muted); opacity: 0.7; }
.tier-included {
  font-size: 0.72rem;
  color: var(--text-secondary);
  line-height: 1.35;
  margin-top: var(--space-md);
  padding-top: var(--space-sm);
  border-top: 1px solid var(--border-subtle);
}
.tier-cta {
  display: block;
  margin-top: var(--space-sm);
  padding: 8px 12px;
  background: var(--accent-gradient);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
  border-radius: var(--radius-full);
  transition: all var(--transition-fast);
}
.tier-cta:hover {
  filter: brightness(1.05);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

/* --- Guide screen --- */
.guide-section {
  margin-bottom: var(--space-2xl);
}

.guide-section-title {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-md);
  padding-bottom: var(--space-sm);
  border-bottom: 2px solid var(--accent-primary);
  display: inline-block;
}

.guide-card {
  display: flex;
  gap: var(--space-md);
  padding: var(--space-md) var(--space-lg);
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-sm);
  box-shadow: var(--shadow-sm);
  transition: border-color var(--transition-fast);
}

.guide-card:hover {
  border-color: var(--accent-primary);
}

.guide-card-icon {
  font-size: 1.6rem;
  line-height: 1;
  flex-shrink: 0;
  padding-top: 2px;
}

.guide-card-body {
  flex: 1;
}

.guide-card-title {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.guide-card-desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.55;
}

.guide-tip {
  display: flex;
  gap: var(--space-md);
  align-items: flex-start;
  padding: var(--space-md);
  background: var(--bg-glass);
  border-left: 3px solid var(--accent-primary);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  margin-bottom: var(--space-sm);
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.55;
}

.guide-tip-icon {
  font-size: 1.1rem;
  flex-shrink: 0;
  margin-top: 1px;
}

/* --- Home secondary shortcuts --- */
.home-secondary-row {
  margin-top: var(--space-xl);
  padding-top: var(--space-lg);
  border-top: 1px solid var(--border-subtle);
}

.home-section-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: var(--space-md);
}

.home-quick-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
}

.home-quick-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: var(--bg-glass);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-full);
  color: var(--text-secondary);
  font-family: var(--font-primary);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.home-quick-btn:hover {
  background: var(--bg-glass-hover);
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

.quick-badge {
  background: var(--accent-primary);
  color: white;
  border-radius: var(--radius-full);
  padding: 1px 7px;
  font-size: 0.75rem;
  font-weight: 700;
  min-width: 20px;
  text-align: center;
}

/* --- Countdown timer danger state --- */
.quiz-timer.timer-danger {
  color: var(--error);
  animation: timer-pulse 1s ease-in-out infinite;
}

.quiz-timer.timer-danger svg {
  stroke: var(--error);
}

@keyframes timer-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

/* ─── "¿Cómo funciona esta aplicación?" card ─── */
.how-it-works-card {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  width: 100%;
  text-align: left;
  padding: var(--space-md) var(--space-lg);
  margin-bottom: var(--space-lg);
  background: var(--bg-card);
  border: 1px solid var(--accent-primary);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  font-family: var(--font-primary);
  cursor: pointer;
  transition: all var(--transition-fast);
}
.how-it-works-card:hover {
  background: var(--accent-primary-glow);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}
.hiw-icon {
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  background: var(--accent-primary-glow);
  color: var(--accent-primary);
  display: flex;
  align-items: center;
  justify-content: center;
}
.hiw-title {
  flex: 1;
  min-width: 0;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
}
.hiw-chevron {
  flex: none;
  color: var(--accent-primary);
}

@media (max-width: 640px) {
  .how-it-works-card {
    padding: var(--space-md);
    gap: var(--space-sm);
  }
  .hiw-icon { width: 34px; height: 34px; }
  .hiw-icon svg { width: 19px; height: 19px; }
  .hiw-title { font-size: 0.88rem; }
}

/* ─── Evolution chart ──────────────────────────── */
.chart-container {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-md);
  margin-bottom: var(--space-lg);
}
.chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-sm);
}
.chart-subtitle { font-size: 0.78rem; color: var(--text-muted); }
.chart-svg { width: 100%; height: auto; display: block; }
.chart-legend {
  display: flex;
  gap: 10px;
  align-items: center;
  font-size: 0.72rem;
  color: var(--text-muted);
}
.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 2px;
}

/* ─── History rows (improved) ──────────────────── */
.history-row {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  margin-bottom: 6px;
  transition: border-color var(--transition-fast);
}
.history-row:hover { border-color: var(--border-hover); }
.history-mode-icon { font-size: 1rem; flex-shrink: 0; }
.history-row-info { flex: 1; min-width: 0; }
.history-name {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.history-date { font-size: 0.72rem; color: var(--text-muted); }
.history-meta { font-size: 0.85rem; color: var(--text-secondary); flex-shrink: 0; }
.pct-good { color: var(--success); }
.pct-mid  { color: var(--warning); }
.pct-bad  { color: var(--error); }

/* --- Feedback mode modal buttons --- */
.fm-btn {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  width: 100%;
  padding: var(--space-lg);
  background: var(--bg-glass);
  border: 1.5px solid var(--border-default);
  border-radius: var(--radius-lg);
  cursor: pointer;
  text-align: left;
  font-family: var(--font-primary);
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}
.fm-btn:hover,
.fm-btn.active {
  border-color: var(--accent-primary);
  background: var(--accent-primary-glow);
  box-shadow: 0 0 0 3px var(--accent-primary-glow);
}
.fm-icon { font-size: 1.5rem; flex-shrink: 0; }
.fm-body { display: flex; flex-direction: column; gap: 2px; }
.fm-name { font-size: 1rem; font-weight: 700; color: var(--text-primary); }
.fm-desc { font-size: 0.82rem; color: var(--text-muted); }

/* --- Marked for review section --- */
.marked-section {
  margin-bottom: var(--space-xl);
}

/* ===========================================
   AVISOS DE PREGUNTAS (reportes)
   =========================================== */

/* --- Enlace para avisar, dentro del test y en resultados --- */
.report-row {
  display: flex;
  justify-content: center;
  margin: calc(-1 * var(--space-sm)) 0 var(--space-md);
}
.report-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  padding: var(--space-xs) var(--space-sm);
  font-family: var(--font-primary);
  font-size: 0.82rem;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: color 0.15s ease, background 0.15s ease;
}
.report-link:hover { color: var(--warning); background: var(--warning-bg); }
.report-link.reported { color: var(--success); }
.report-link.reported:hover { background: transparent; cursor: default; }
.report-link-sm {
  margin-top: 6px;
  padding: 2px 0;
  font-size: 0.76rem;
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* --- Modal de aviso --- */
.report-preview {
  font-size: 0.86rem;
  color: var(--text-secondary);
  background: var(--bg-subtle, var(--border-subtle));
  border-radius: var(--radius-md);
  padding: var(--space-md);
  margin-bottom: var(--space-lg);
  max-height: 6.5em;
  overflow-y: auto;
}
.report-label {
  display: block;
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: var(--space-md) 0 var(--space-sm);
}
.report-types {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
}
.report-type-btn { flex: 1 1 auto; }
.report-textarea,
.report-input {
  width: 100%;
  padding: var(--space-sm) var(--space-md);
  font-family: var(--font-primary);
  font-size: 0.9rem;
  color: var(--text-primary);
  background: var(--bg-glass);
  border: 1.5px solid var(--border-default);
  border-radius: var(--radius-md);
  resize: vertical;
}
.report-textarea:focus,
.report-input:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--accent-primary-glow);
}
.report-hint {
  font-size: 0.76rem;
  color: var(--text-muted);
  margin-top: 6px;
}
.error-text {
  font-size: 0.82rem;
  color: var(--error);
  background: var(--error-bg);
  border-radius: var(--radius-sm);
  padding: var(--space-sm) var(--space-md);
  margin-top: var(--space-md);
}

/* --- Aviso flotante de confirmación --- */
.app-toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translate(-50%, 16px);
  z-index: 999;
  padding: var(--space-sm) var(--space-lg);
  border-radius: var(--radius-lg);
  background: var(--text-primary);
  color: var(--bg-primary, #fff);
  font-size: 0.86rem;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.app-toast.visible { opacity: 1; transform: translate(-50%, 0); }

/* --- Pantalla de avisos recibidos --- */
.rep-filters {
  display: flex;
  gap: var(--space-sm);
  margin: var(--space-lg) 0;
}
.rep-card {
  background: var(--bg-glass);
  border: 1.5px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  margin-bottom: var(--space-md);
}
.rep-card-pend { border-color: var(--warning); }
.rep-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  margin-bottom: var(--space-sm);
}
.rep-count {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
}
.rep-pill {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--border-subtle);
  color: var(--text-muted);
}
.rep-pill-new { background: var(--warning-bg); color: var(--warning); }
.rep-source {
  font-size: 0.76rem;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.rep-question {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-sm);
}
.rep-line {
  font-size: 0.84rem;
  color: var(--text-secondary);
  margin-bottom: 4px;
}
.rep-comments {
  margin-top: var(--space-sm);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.rep-comment {
  font-size: 0.84rem;
  color: var(--text-secondary);
  font-style: italic;
  border-left: 3px solid var(--border-hover);
  padding-left: var(--space-sm);
}
.rep-author { font-style: normal; font-weight: 600; color: var(--text-muted); }
.rep-id {
  margin-top: var(--space-sm);
  font-family: monospace;
  font-size: 0.7rem;
  color: var(--text-muted);
}
.rep-done-btn { margin-top: var(--space-md); }

/* ── Cuenta (Ajustes): email + plan + CTA premium ── */
.account-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  padding: var(--space-md) var(--space-lg);
  background: var(--bg-glass);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-lg);
}
.account-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.account-email {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.account-tier {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}
.account-tier.is-premium { color: var(--accent-primary); }
.account-cta {
  flex-shrink: 0;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--accent-primary);
  text-decoration: none;
  padding: var(--space-sm) var(--space-md);
  border: 1px solid var(--accent-primary);
  border-radius: var(--radius-md);
  white-space: nowrap;
}
.account-cta:hover { background: var(--accent-primary-glow); }
