/**
 * Estilos del Test de Coeficiente Intelectual (CI)
 * fijate.com - Diseño premium, paleta HSL, temas claro/oscuro y renderizado SVG de alta precisión
 */

:root {
  /* Paleta base en modo oscuro por defecto */
  --bg-body: #0a0d14;
  --bg-card: #111726;
  --bg-card-hover: #161f33;
  --bg-card-subtle: #192238;
  --bg-input: #0e1422;
  
  --border-color: rgba(255, 255, 255, 0.08);
  --border-hover: rgba(255, 255, 255, 0.18);
  --border-active: #3b82f6;

  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  --accent: #3b82f6;
  --accent-rgb: 59, 130, 246;
  --accent-hover: #2563eb;
  --accent-light: rgba(59, 130, 246, 0.15);
  
  --purple: #8b5cf6;
  --pink: #ec4899;
  --green: #10b981;
  --amber: #f59e0b;
  --red: #ef4444;

  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 20px rgba(59, 130, 246, 0.3);

  --font-main: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-heading: 'Outfit', var(--font-main);
  --font-mono: 'JetBrains Mono', 'Courier New', monospace;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;
}

/* Modo claro unificado */
[data-theme="light"] {
  --bg-body: #f8fafc;
  --bg-card: #ffffff;
  --bg-card-hover: #f1f5f9;
  --bg-card-subtle: #e2e8f0;
  --bg-input: #ffffff;

  --border-color: #e2e8f0;
  --border-hover: #cbd5e1;
  --border-active: #2563eb;

  --text-main: #0f172a;
  --text-muted: #475569;
  --text-dim: #64748b;

  --accent: #2563eb;
  --accent-rgb: 37, 99, 235;
  --accent-hover: #1d4ed8;
  --accent-light: rgba(37, 99, 235, 0.1);

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.1);
  --shadow-glow: 0 0 15px rgba(37, 99, 235, 0.2);
}

/* ==========================================
   RESET & ESTILOS BASE
   ========================================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-main);
  background-color: var(--bg-body);
  color: var(--text-main);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body.modal-open {
  overflow: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

.hidden {
  display: none !important;
}

/* ==========================================
   CABECERA DE LA APLICACIÓN
   ========================================== */
.app-header {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
}

.header-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0.75rem 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.btn-back-tools {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  padding: 0.4rem 0.8rem;
  border-radius: var(--radius-sm);
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  transition: all 0.2s ease;
}

.btn-back-tools:hover {
  color: var(--text-main);
  border-color: var(--border-hover);
  transform: translateX(-2px);
}

.brand-area {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand-logo-box {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--accent), var(--purple));
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-glow);
}

.brand-title {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.2;
}

.brand-badge {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

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

.theme-toggle-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-card-subtle);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.theme-toggle-btn:hover {
  color: var(--text-main);
  border-color: var(--border-hover);
}

/* ==========================================
   CONTENEDOR PRINCIPAL
   ========================================== */
.main-wrapper {
  flex: 1;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 2rem 1.25rem 3.5rem;
}

/* ==========================================
   VISTA 1: LANDING & ONBOARDING
   ========================================== */
.hero-section {
  text-align: center;
  max-width: 840px;
  margin: 0 auto 3rem;
}

.hero-pill-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.9rem;
  border-radius: 999px;
  background: var(--accent-light);
  border: 1px solid rgba(59, 130, 246, 0.3);
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 700;
  margin-bottom: 1.25rem;
}

.hero-title {
  font-family: var(--font-heading);
  font-size: clamp(2rem, 4.5vw, 3.2rem);
  font-weight: 800;
  line-height: 1.15;
  color: var(--text-main);
  margin-bottom: 1rem;
  letter-spacing: -0.02em;
}

.hero-title-gradient {
  background: linear-gradient(135deg, var(--accent) 0%, var(--purple) 50%, var(--pink) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-desc {
  font-size: 1.1rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 2rem;
}

/* Botones de acción principal */
.hero-actions {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 2rem;
}

.btn-primary-glow {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.85rem 1.75rem;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--accent), var(--purple));
  color: #ffffff;
  font-weight: 700;
  font-size: 1rem;
  box-shadow: 0 4px 20px rgba(59, 130, 246, 0.4);
  transition: all 0.25s ease;
}

.btn-primary-glow:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 25px rgba(59, 130, 246, 0.6);
}

.btn-secondary-glow {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.85rem 1.75rem;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  font-weight: 600;
  font-size: 1rem;
  transition: all 0.25s ease;
}

.btn-secondary-glow:hover {
  border-color: var(--border-hover);
  background: var(--bg-card-hover);
  transform: translateY(-2px);
}

/* Badges de rigor y privacidad */
.hero-features-bar {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 1.5rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.hero-feature-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.hero-feature-item svg {
  color: var(--green);
}

/* Bento Grid de Dominios Cognitivos */
.bento-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.25rem;
  margin-bottom: 3.5rem;
}

.bento-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  transition: all 0.25s ease;
  position: relative;
  overflow: hidden;
}

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

.bento-icon-box {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
}

.bento-title {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.5rem;
}

.bento-desc {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* Sección Explicativa / Baremos */
.info-box-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2rem;
  margin-bottom: 2rem;
}

.info-heading {
  font-family: var(--font-heading);
  font-size: 1.35rem;
  font-weight: 700;
  margin-bottom: 1.25rem;
  color: var(--text-main);
}

.wechsler-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
  font-size: 0.9rem;
}

.wechsler-table th, .wechsler-table td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

.wechsler-table th {
  color: var(--text-muted);
  font-weight: 600;
  background: var(--bg-card-subtle);
}

.wechsler-table tr:hover td {
  background: var(--bg-card-hover);
}

/* ==========================================
   VISTA 2: EXAMEN & TEST RUNNER
   ========================================== */
.exam-header-bar {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.exam-top-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1rem;
}

.exam-meta-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.badge-tag {
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge-category {
  background: var(--accent-light);
  color: var(--accent);
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.badge-difficulty {
  background: rgba(245, 158, 11, 0.15);
  color: var(--amber);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.exam-timer-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-main);
}

.exam-timer-pill.timer-warning {
  background: rgba(239, 68, 68, 0.15);
  border-color: var(--red);
  color: var(--red);
  animation: pulseWarning 1.5s infinite;
}

@keyframes pulseWarning {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

/* Barra de progreso */
.progress-track {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: var(--bg-card-subtle);
  overflow: hidden;
  position: relative;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--purple));
  border-radius: 999px;
  transition: width 0.3s ease;
}

.progress-stats-row {
  display: flex;
  justify-content: space-between;
  margin-top: 0.4rem;
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* Rejilla de Navegación de preguntas (Pills 1-24) */
.q-nav-box {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
  margin-bottom: 1.5rem;
}

.q-nav-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(36px, 1fr));
  gap: 0.45rem;
}

.q-pill {
  height: 36px;
  border-radius: var(--radius-sm);
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: all 0.15s ease;
}

.q-pill:hover {
  border-color: var(--border-hover);
  color: var(--text-main);
}

.q-pill.active {
  border-color: var(--accent);
  background: var(--accent-light);
  color: var(--accent);
  font-weight: 800;
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.3);
}

.q-pill.answered {
  background: rgba(16, 185, 129, 0.15);
  border-color: rgba(16, 185, 129, 0.4);
  color: var(--green);
}

.q-pill.answered.active {
  border-color: var(--accent);
}

.q-pill-flag-icon {
  display: none;
  position: absolute;
  top: -3px;
  right: 1px;
  font-size: 0.65rem;
  color: var(--amber);
}

.q-pill.flagged .q-pill-flag-icon {
  display: block;
}

/* ==========================================
   ÁREA DE LA PREGUNTA & MATRIZ SVG
   ========================================== */
.question-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 2rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-md);
}

.q-title-header {
  margin-bottom: 1.5rem;
}

.q-number-label {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 0.25rem;
}

.q-main-title {
  font-family: var(--font-heading);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.4rem;
}

.q-instruction {
  font-size: 0.95rem;
  color: var(--text-muted);
}

/* Contenedor de la Matriz Central */
.matrix-display-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 1.5rem;
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  margin-bottom: 2rem;
}

.matrix-svg {
  max-width: 320px;
  width: 100%;
  height: auto;
  display: block;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.2));
}

/* ==========================================
   ESTILOS DE GRAFISMOS SVG MATEMÁTICOS
   ========================================== */
.cell-bg {
  fill: var(--bg-card);
  stroke: var(--border-color);
  stroke-width: 1.5;
}

.target-cell {
  fill: var(--accent-light);
  stroke: var(--accent);
  stroke-width: 2;
  stroke-dasharray: 4 4;
}

.shape-outline {
  fill: none;
  stroke: var(--text-main);
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.shape-vector {
  stroke: var(--text-main);
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.shape-fill {
  fill: var(--text-main);
}

.shape-fill-subtle {
  fill: rgba(59, 130, 246, 0.2);
  stroke: var(--accent);
  stroke-width: 1.5;
}

.shape-fill-accent {
  fill: rgba(59, 130, 246, 0.35);
}

.shape-accent-poly {
  fill: var(--accent);
  stroke: var(--text-main);
  stroke-width: 1.5;
}

.shape-accent-dot {
  fill: var(--accent);
}

.shape-center-dot {
  fill: var(--text-main);
}

.shape-accent-circle {
  fill: var(--accent-light);
  stroke: var(--accent);
  stroke-width: 1.5;
}

.shape-subtle-line {
  stroke: var(--border-hover);
  stroke-width: 1;
}

.matrix-query {
  font-family: var(--font-heading);
  font-size: 38px;
  font-weight: 800;
  fill: var(--accent);
}

.matrix-query-sm {
  font-family: var(--font-heading);
  font-size: 26px;
  font-weight: 800;
  fill: var(--accent);
}

.math-num {
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 700;
  fill: var(--text-main);
}

.math-accent-num {
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 700;
  fill: var(--accent);
}

.math-operator {
  font-family: var(--font-heading);
  font-size: 28px;
  font-weight: 700;
  fill: var(--text-muted);
}

.math-operator-big {
  font-family: var(--font-heading);
  font-size: 34px;
  font-weight: 700;
  fill: var(--accent);
}

.math-sub-label {
  font-family: var(--font-main);
  font-size: 12px;
  font-weight: 600;
  fill: var(--text-muted);
}

.math-center-label {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 700;
  fill: var(--accent);
}

.node-bg {
  fill: var(--bg-card);
  stroke: var(--border-color);
  stroke-width: 1.5;
}

.node-target-bg {
  fill: var(--accent-light);
  stroke: var(--accent);
  stroke-width: 2;
}

.cube-face-top {
  fill: #2563eb;
  stroke: #ffffff;
  stroke-width: 1.5;
}

.cube-face-left {
  fill: #1e40af;
  stroke: #ffffff;
  stroke-width: 1.5;
}

.cube-face-right {
  fill: #1d4ed8;
  stroke: #ffffff;
  stroke-width: 1.5;
}

.net-face {
  fill: var(--bg-card);
  stroke: var(--border-color);
  stroke-width: 1.5;
}

/* ==========================================
   REJILLA DE OPCIONES (A, B, C, D, E, F)
   ========================================== */
.options-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.option-card {
  background: var(--bg-card-subtle);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  user-select: none;
}

.option-card:hover {
  border-color: var(--border-hover);
  background: var(--bg-card-hover);
  transform: translateY(-2px);
}

.option-card.selected {
  border-color: var(--accent);
  background: var(--accent-light);
  box-shadow: 0 0 15px rgba(59, 130, 246, 0.35);
}

.option-header {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.option-letter {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--text-muted);
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--bg-card);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-color);
}

.option-card.selected .option-letter {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
}

.option-check-icon {
  font-size: 0.85rem;
  color: var(--accent);
  opacity: 0;
  transform: scale(0.5);
  transition: all 0.2s ease;
}

.option-card.selected .option-check-icon {
  opacity: 1;
  transform: scale(1);
}

.option-svg-wrapper {
  width: 100%;
  max-width: 90px;
  height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.option-svg-wrapper svg {
  width: 100%;
  height: 100%;
  display: block;
}

.option-num {
  font-family: var(--font-mono);
  font-size: 26px;
  font-weight: 700;
  fill: var(--text-main);
}

/* Barra de controles del examen */
.exam-controls-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border-color);
}

.controls-left, .controls-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.btn-ctrl {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 1.25rem;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.9rem;
  transition: all 0.2s ease;
}

.btn-ctrl-prev {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-main);
}

.btn-ctrl-prev:hover:not(:disabled) {
  background: var(--bg-card-hover);
  border-color: var(--border-hover);
}

.btn-ctrl-prev:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-ctrl-next {
  background: var(--accent);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.35);
}

.btn-ctrl-next:hover {
  background: var(--accent-hover);
  transform: translateX(2px);
}

.btn-ctrl-flag {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
}

.btn-ctrl-flag:hover {
  color: var(--amber);
  border-color: rgba(245, 158, 11, 0.4);
}

.btn-ctrl-flag.active-flag {
  background: rgba(245, 158, 11, 0.15);
  border-color: var(--amber);
  color: var(--amber);
}

.btn-ctrl-finish {
  background: linear-gradient(135deg, var(--green), #059669);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

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

/* ==========================================
   VISTA 3: RESULTADOS E INFORME PSICOMÉTRICO
   ========================================== */
.results-hero-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 2.5rem 2rem;
  margin-bottom: 2rem;
  box-shadow: var(--shadow-lg);
  text-align: center;
  position: relative;
  overflow: hidden;
}

.results-hero-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 300px;
  height: 120px;
  background: radial-gradient(circle, rgba(59, 130, 246, 0.25) 0%, transparent 70%);
  pointer-events: none;
}

.results-top-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.9rem;
  border-radius: 999px;
  background: var(--accent-light);
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 1rem;
}

.iq-score-display {
  font-family: var(--font-heading);
  font-size: clamp(3.5rem, 8vw, 5.5rem);
  font-weight: 800;
  line-height: 1;
  color: var(--text-main);
  margin-bottom: 0.5rem;
  text-shadow: 0 0 30px rgba(59, 130, 246, 0.4);
}

.iq-scale-label {
  font-size: 0.95rem;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 1.25rem;
}

.result-badge {
  display: inline-block;
  padding: 0.5rem 1.25rem;
  border-radius: var(--radius-md);
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
}

.badge-mensa {
  background: linear-gradient(135deg, rgba(236, 72, 153, 0.2), rgba(139, 92, 246, 0.2));
  color: #f472b6;
  border: 1px solid rgba(236, 72, 153, 0.4);
}

.badge-superior {
  background: rgba(139, 92, 246, 0.15);
  color: var(--purple);
  border: 1px solid rgba(139, 92, 246, 0.4);
}

.badge-bright {
  background: rgba(59, 130, 246, 0.15);
  color: var(--accent);
  border: 1px solid rgba(59, 130, 246, 0.4);
}

.badge-average {
  background: rgba(16, 185, 129, 0.15);
  color: var(--green);
  border: 1px solid rgba(16, 185, 129, 0.4);
}

.badge-low {
  background: rgba(245, 158, 11, 0.15);
  color: var(--amber);
  border: 1px solid rgba(245, 158, 11, 0.4);
}

.badge-alert {
  background: rgba(239, 68, 68, 0.15);
  color: var(--red);
  border: 1px solid rgba(239, 68, 68, 0.4);
}

/* Rejilla de métricas secundarias */
.results-metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-top: 1.5rem;
}

.metric-box {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem;
  text-align: center;
}

.metric-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.04em;
  margin-bottom: 0.35rem;
}

.metric-value {
  font-family: var(--font-heading);
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text-main);
}

/* Gráficos de Resultados (Gauss & Radar) */
.charts-split-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2.5rem;
}

.chart-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
}

.chart-header {
  margin-bottom: 1rem;
}

.chart-title {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
}

.chart-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.chart-svg-container {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  flex: 1;
  padding: 0.5rem 0;
}

/* Estilos de la Campana de Gauss SVG */
.gauss-svg {
  width: 100%;
  height: auto;
  max-height: 240px;
}

.gauss-axis {
  stroke: var(--border-hover);
  stroke-width: 1.5;
}

.gauss-curve {
  stroke: var(--text-main);
}

.gauss-grid-line {
  stroke: var(--border-color);
  stroke-width: 1;
}

.gauss-label {
  font-family: var(--font-mono);
  font-size: 11px;
  fill: var(--text-dim);
}

.gauss-pill-bg {
  fill: var(--accent);
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.4));
}

.gauss-pill-text {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  fill: #ffffff;
}

/* Estilos del Gráfico Radar SVG */
.radar-svg {
  width: 100%;
  max-width: 320px;
  height: auto;
}

.radar-grid {
  fill: none;
  stroke: var(--border-color);
  stroke-width: 1;
}

.radar-axis {
  stroke: var(--border-hover);
  stroke-width: 1;
  stroke-dasharray: 2 2;
}

.radar-label {
  font-family: var(--font-main);
  font-size: 11px;
  font-weight: 600;
  fill: var(--text-muted);
}

/* Solucionario detallado */
.solutions-section {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 2rem;
  margin-bottom: 2rem;
}

.solutions-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.filter-tabs {
  display: flex;
  gap: 0.5rem;
  background: var(--bg-card-subtle);
  padding: 0.3rem;
  border-radius: var(--radius-md);
}

.filter-tab-btn {
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  transition: all 0.2s ease;
}

.filter-tab-btn.active {
  background: var(--bg-card);
  color: var(--text-main);
  box-shadow: var(--shadow-sm);
}

.solutions-list {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.sol-card {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  transition: all 0.2s ease;
}

.sol-card.sol-correct {
  border-left: 4px solid var(--green);
}

.sol-card.sol-error {
  border-left: 4px solid var(--red);
}

.sol-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.sol-title-wrap {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.sol-idx {
  font-family: var(--font-mono);
  font-weight: 800;
  color: var(--accent);
}

.sol-cat-badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
}

.sol-title {
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 700;
}

.sol-status-badge {
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-sm);
}

.badge-sol-ok {
  background: rgba(16, 185, 129, 0.15);
  color: var(--green);
}

.badge-sol-ko {
  background: rgba(239, 68, 68, 0.15);
  color: var(--red);
}

.sol-body {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 1.25rem;
}

@media (max-width: 768px) {
  .sol-body {
    grid-template-columns: 1fr;
  }
}

.sol-matrix-preview {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sol-matrix-preview svg {
  width: 100%;
  max-width: 200px;
  height: auto;
}

.sol-answers-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}

.sol-answer-box {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.75rem;
}

.sol-answer-box.box-ok {
  border-color: rgba(16, 185, 129, 0.4);
}

.sol-answer-box.box-ko {
  border-color: rgba(239, 68, 68, 0.4);
}

.sol-ans-tag {
  font-size: 0.72rem;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--text-muted);
  display: block;
  margin-bottom: 0.25rem;
}

.sol-ans-content {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.sol-thumb-svg {
  width: 44px;
  height: 44px;
}

.sol-thumb-svg svg {
  width: 100%;
  height: 100%;
}

.sol-explanation-box {
  grid-column: 1 / -1;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
}

.sol-exp-heading {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 0.35rem;
}

.sol-exp-text {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* Acciones finales de resultados */
.results-actions-bar {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 1rem;
}

/* ==========================================
   MODALES PERSONALIZADOS
   ========================================== */
.app-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
}

.app-modal.active {
  display: flex;
  animation: modalFadeIn 0.2s ease-out;
}

@keyframes modalFadeIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.modal-dialog {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  max-width: 460px;
  width: 100%;
  padding: 2rem;
  box-shadow: var(--shadow-lg);
  text-align: center;
}

.modal-icon-wrap {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--accent-light);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.25rem;
}

.modal-title {
  font-family: var(--font-heading);
  font-size: 1.35rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
}

.modal-text {
  font-size: 0.95rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

.modal-warning-box {
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.3);
  color: var(--amber);
  padding: 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  margin-bottom: 1.5rem;
}

.modal-success-box {
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: var(--green);
  padding: 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  margin-bottom: 1.5rem;
}

.modal-btn-row {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
}

.btn-modal-cancel {
  padding: 0.65rem 1.25rem;
  border-radius: var(--radius-md);
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  font-weight: 600;
  color: var(--text-muted);
}

.btn-modal-cancel:hover {
  background: var(--bg-card-hover);
  color: var(--text-main);
}

.btn-modal-confirm {
  padding: 0.65rem 1.5rem;
  border-radius: var(--radius-md);
  background: var(--accent);
  color: #ffffff;
  font-weight: 700;
}

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

/* Toast */
.app-toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: var(--bg-card);
  border: 1px solid var(--accent);
  color: var(--text-main);
  padding: 0.85rem 1.5rem;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  font-size: 0.9rem;
  font-weight: 600;
  z-index: 2000;
  display: none;
}

.app-toast.active {
  display: block;
  animation: toastSlideUp 0.3s ease-out;
}

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

/* ==========================================
   HOJA DE ESTILOS DE IMPRESIÓN (@media print)
   ========================================== */
@media print {
  body {
    background: #ffffff !important;
    color: #000000 !important;
  }

  .app-header,
  .btn-back-tools,
  .theme-toggle-btn,
  .hero-section,
  .exam-header-bar,
  .q-nav-box,
  .results-actions-bar,
  .filter-tabs,
  .fijate-footer,
  .app-modal,
  .app-toast,
  .ads-container {
    display: none !important;
  }

  .main-wrapper {
    padding: 0 !important;
    max-width: 100% !important;
  }

  .results-hero-card {
    border: 2px solid #000000 !important;
    box-shadow: none !important;
    page-break-after: avoid;
  }

  .iq-score-display {
    color: #000000 !important;
    text-shadow: none !important;
  }

  .chart-card, .solutions-section, .sol-card {
    border: 1px solid #cccccc !important;
    box-shadow: none !important;
    page-break-inside: avoid;
  }

  .gauss-svg, .radar-svg {
    max-height: 200px !important;
  }
}
