/* ============================================================
   ESTILOS GLOBALES DEL TEST — MODO OSCURO
   Parte A: base, botones, intro, avisos, progreso,
            preguntas, opciones, resultados.
   ============================================================ */

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

:root {
  --bg: #0f1220;
  --card: #1a1e2f;
  --card-2: #232842;
  --accent: #6c8cff;
  --accent-2: #8f6cff;
  --text: #e8ecff;
  --muted: #a0a8c8;
  --good: #4cd97b;
  --warn: #ffb84c;
  --bad: #ff6b6b;
  --border: #2c3350;
}

html, body { width: 100%; overflow-x: hidden; }

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: linear-gradient(135deg, #0f1220 0%, #1a1e2f 100%);
  color: var(--text);
  min-height: 100vh;
  padding: 16px;
  line-height: 1.5;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 0.5s ease, color 0.5s ease;
}

.container { max-width: 940px; margin: 0 auto; width: 100%; }

header { text-align: center; margin-bottom: 24px; }

header h1 {
  font-size: 1.9rem;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 8px;
  line-height: 1.2;
}

header p { color: var(--muted); font-size: 0.92rem; }

.card {
  background: var(--card);
  border-radius: 16px;
  padding: 22px;
  border: 1px solid var(--border);
  box-shadow: 0 8px 30px rgba(0,0,0,0.35);
  margin-bottom: 18px;
  transition: background-color 0.5s ease, border-color 0.5s ease, color 0.5s ease, box-shadow 0.5s ease;
}

.intro ul { list-style: none; margin-top: 12px; }

.intro ul li {
  padding: 2px 0 6px 24px;
  position: relative;
  color: var(--muted);
  font-size: 0.92rem;
}

.intro ul li::before {
  content: "▸";
  position: absolute;
  left: 6px;
  color: var(--accent);
}

/* ============================================================
   NAVEGACIÓN Y BOTONES
   ============================================================ */
.nav-volver {
  margin-bottom: 16px;
  display: flex;
  justify-content: flex-start;
}

.nav-volver .btn {
  text-decoration: none;
  font-size: 0.88rem;
  padding: 10px 18px;
}

#intro .actions .btn {
  text-decoration: none;
  display: inline-block;
}

.btn {
  display: inline-block;
  padding: 13px 24px;
  border-radius: 12px;
  border: none;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  font-family: inherit;
  touch-action: manipulation;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: white;
  box-shadow: 0 6px 20px rgba(108,140,255,0.35);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 28px rgba(108,140,255,0.5);
}

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

.btn-secondary {
  background: var(--card-2);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover { background: #2a3050; }

.btn-success {
  background: linear-gradient(135deg, #4cd97b, #2ba85a);
  color: white;
}

.btn-success:hover { transform: translateY(-2px); }

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

/* ============================================================
   INTRO LARGA
   ============================================================ */
.intro-titulo {
  font-size: 1.25rem;
  color: var(--accent);
  margin-bottom: 14px;
  line-height: 1.3;
}

.intro-sub {
  font-size: 1rem;
  color: var(--accent);
  margin: 22px 0 10px;
  line-height: 1.35;
}

.intro-lead {
  font-size: 0.95rem;
  color: var(--text);
  margin-bottom: 10px;
}

#intro p {
  font-size: 0.92rem;
  color: var(--text);
  margin-bottom: 10px;
  line-height: 1.6;
}

#intro p strong,
#intro li strong { color: var(--accent); }

.intro-lista {
  list-style: none;
  counter-reset: intro;
  margin: 6px 0 12px;
  padding: 0;
}

.intro-lista li {
  counter-increment: intro;
  position: relative;
  padding: 8px 0 8px 34px;
  font-size: 0.9rem;
  color: var(--text);
  border-bottom: 1px dashed rgba(160,168,200,0.15);
  line-height: 1.5;
}

.intro-lista li:last-child { border-bottom: none; }

.intro-lista li::before {
  content: counter(intro);
  position: absolute;
  left: 0;
  top: 8px;
  width: 22px;
  height: 22px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.72rem;
  color: #fff;
}

.intro-lista-puntos {
  list-style: none;
  margin: 6px 0 12px;
  padding: 0;
}

.intro-lista-puntos li {
  padding: 6px 0 6px 24px;
  position: relative;
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--text);
}

.intro-lista-puntos li::before {
  content: "▸";
  position: absolute;
  left: 6px;
  top: 6px;
  color: var(--accent);
  font-weight: 700;
  font-size: 0.9rem;
}

.intro-idea-final {
  margin-top: 22px;
  padding: 20px 22px 16px;
  background: linear-gradient(135deg,
    rgba(46, 158, 77, 0.22) 0%,
    rgba(76, 217, 123, 0.14) 100%
  );
  border: 1px solid rgba(76, 217, 123, 0.55);
  border-left: 4px solid #4cd97b;
  border-radius: 14px;
  box-shadow:
    0 0 24px rgba(76, 217, 123, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  position: relative;
}

.intro-idea-final .intro-sub {
  margin-top: 0;
  border-left: none;
  padding-left: 0;
  color: #8fe9ac;
  font-weight: 700;
  text-shadow: 0 0 10px rgba(76, 217, 123, 0.35);
}

.intro-idea-final p {
  font-size: 0.94rem;
  line-height: 1.65;
  color: #e8f7ed;
  margin-bottom: 10px;
}

.intro-idea-final p:last-child { margin-bottom: 0; }

.intro-idea-final strong { color: #b8f5c8; font-weight: 700; }

.intro-sep {
  border: none;
  border-top: 1px solid var(--border);
  margin: 28px 0 22px;
}

/* ============================================================
   INSTRUCCIONES Y AVISOS
   ============================================================ */
.instrucciones-box {
  background: rgba(108,140,255,0.08);
  border: 1px solid rgba(108,140,255,0.3);
  border-radius: 10px;
  padding: 14px 16px;
  margin: 14px 0;
  font-size: 0.88rem;
  color: var(--text);
  line-height: 1.5;
}

.instrucciones-box strong { color: var(--accent); }

.aviso-atencion {
  background: rgba(255,184,76,0.10);
  border: 1px solid rgba(255,184,76,0.45);
  border-left: 4px solid var(--warn);
  border-radius: 10px;
  padding: 14px 16px;
  margin: 14px 0;
  font-size: 0.88rem;
  color: #ffe0a8;
  line-height: 1.55;
}

.aviso-atencion strong { color: #ffcc70; }

.aviso-atencion .titulo {
  display: block;
  font-weight: 700;
  color: var(--warn);
  margin-bottom: 6px;
  font-size: 0.95rem;
}

.aviso-recordatorio {
  background: rgba(255,184,76,0.08);
  border: 1px dashed rgba(255,184,76,0.4);
  border-radius: 10px;
  padding: 12px 16px;
  margin-bottom: 16px;
  font-size: 0.85rem;
  color: #ffe0a8;
  line-height: 1.5;
  text-align: center;
}

.aviso-recordatorio strong { color: var(--warn); }

.aviso-cierre {
  background: rgba(108,140,255,0.08);
  border: 1px solid rgba(108,140,255,0.3);
  border-radius: 10px;
  padding: 12px 16px;
  margin: 16px 0 0;
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.5;
  text-align: center;
}

.aviso-cierre strong { color: var(--accent); }

/* ============================================================
   PROGRESO
   ============================================================ */
.progress-wrap {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(15,18,32,0.94);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding: 10px 0;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.progress-info {
  display: flex;
  justify-content: space-between;
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 6px;
}

.progress-bar {
  height: 8px;
  background: var(--card-2);
  border-radius: 4px;
  overflow: hidden;
}

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

/* ============================================================
   PREGUNTAS
   ============================================================ */
.question {
  background: var(--card);
  border-radius: 14px;
  padding: 18px;
  margin-bottom: 12px;
  border: 1px solid var(--border);
  transition: border-color 0.2s;
}

.question.answered { border-color: var(--accent); }

.question h3 {
  font-size: 0.98rem;
  font-weight: 600;
  margin-bottom: 12px;
  display: flex;
  gap: 8px;
  line-height: 1.35;
}

.q-num { color: var(--accent); font-weight: 700; min-width: 28px; flex-shrink: 0; }

.options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 6px;
}

.options label {
  background: var(--card-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 6px;
  cursor: pointer;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 54px;
  transition: all 0.15s;
  user-select: none;
  line-height: 1.15;
}

.opt-principal {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text);
}

.opt-secundaria {
  font-size: 0.72rem;
  font-weight: 400;
  color: var(--muted);
  line-height: 1.15;
}

.options label:hover {
  background: #2a3050;
  border-color: var(--accent);
}

.options input[type="radio"] { display: none; }

.options label:has(input:checked) {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-color: transparent;
  box-shadow: 0 4px 12px rgba(108,140,255,0.35);
}

.options label:has(input:checked) .opt-principal,
.options label:has(input:checked) .opt-secundaria {
  color: white;
}

@media (min-width: 700px) {
  .options { grid-template-columns: repeat(5, 1fr); }
  .opt-principal { font-size: 0.9rem; }
  .opt-secundaria { font-size: 0.73rem; }
}

@media (max-width: 480px) {
  .options {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }
  .options label {
    min-height: 58px;
    padding: 10px 5px;
  }
  .opt-principal { font-size: 0.88rem; }
  .opt-secundaria { font-size: 0.68rem; }
  .options label:last-child:nth-child(odd) {
    grid-column: 1 / -1;
  }
}

/* ============================================================
   RESULTADOS
   ============================================================ */
.result-score { text-align: center; padding: 24px 16px; }

.score-circle {
  width: 170px;
  height: 170px;
  border-radius: 50%;
  margin: 0 auto 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  background: var(--card-2);
}

.score-circle svg {
  position: absolute;
  top: 0; left: 0;
  transform: rotate(-90deg);
  width: 100%;
  height: 100%;
}

.score-circle .score-value {
  font-size: 2.5rem;
  font-weight: 700;
  line-height: 1;
  color: var(--accent);
}

.score-circle .score-label {
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 4px;
}

.result-level {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--accent);
}

.result-desc {
  color: var(--muted);
  font-size: 0.92rem;
  max-width: 640px;
  margin: 0 auto;
}

.aviso-psicometrico {
  background: rgba(255,184,76,0.08);
  border: 1px solid rgba(255,184,76,0.35);
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 18px;
  font-size: 0.85rem;
  color: var(--warn);
  line-height: 1.55;
}

.aviso-psicometrico strong { color: #ffcc70; }

.nota-g {
  background: rgba(76,217,123,0.06);
  border: 1px solid rgba(76,217,123,0.3);
  border-radius: 10px;
  padding: 12px 16px;
  margin-bottom: 18px;
  font-size: 0.84rem;
  color: #8fe9ac;
  line-height: 1.5;
}

.nota-g strong { color: #4cd97b; }

.resumen-interpretativo {
  background: linear-gradient(135deg, rgba(108,140,255,0.10) 0%, rgba(143,108,255,0.10) 100%);
  border: 1px solid rgba(108,140,255,0.35);
  border-radius: 14px;
  padding: 20px 22px;
  margin-bottom: 18px;
  line-height: 1.6;
}

.resumen-interpretativo h3 {
  color: var(--accent);
  font-size: 1.05rem;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.resumen-interpretativo p {
  font-size: 0.92rem;
  color: var(--text);
  margin-bottom: 10px;
}

.resumen-interpretativo p:last-child { margin-bottom: 0; }

.resumen-interpretativo .destacado-dificultad { color: #ff9b4c; font-weight: 700; }
.resumen-interpretativo .destacado-recurso-bajo { color: #ffb84c; font-weight: 700; }
.resumen-interpretativo .destacado-fortaleza { color: #4cd97b; font-weight: 700; }
.resumen-interpretativo .destacado-global { color: var(--accent); font-weight: 700; }

/* ============================================================
   ESTILOS GLOBALES DEL TEST — MODO OSCURO
   Parte B: gráficas, recomendaciones, leyendas, archivos,
            footer, modales legales, responsive, impresión,
            switch, transiciones.
   ============================================================ */

/* ============================================================
   GRÁFICAS
   ============================================================ */
.chart-section { margin-top: 8px; }
.chart-section h3 { font-size: 1rem; margin-bottom: 6px; color: var(--accent); }
.chart-section .chart-desc { font-size: 0.83rem; color: var(--muted); margin-bottom: 14px; }

.chart-wrap {
  position: relative;
  width: 100%;
  display: flex;
  justify-content: center;
  padding: 6px 0;
  overflow-x: auto;
}

canvas { max-width: 100%; height: auto; display: block; margin: 0 auto; }

.signs-table { width: 100%; border-collapse: collapse; margin-top: 12px; font-size: 0.82rem; }

.signs-table th, .signs-table td {
  padding: 8px 8px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.signs-table th {
  color: var(--accent);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.signs-table .val { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

.pill {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 600;
  color: white;
  white-space: nowrap;
}

.bar-item { margin-bottom: 10px; }

.bar-item .label {
  display: flex;
  justify-content: space-between;
  font-size: 0.83rem;
  margin-bottom: 4px;
  color: var(--muted);
  gap: 8px;
}

.bar-track { height: 8px; background: var(--card-2); border-radius: 4px; overflow: hidden; }

.bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.6s ease;
  background: var(--accent);
}

/* ============================================================
   RECOMENDACIONES
   ============================================================ */
.recommendations { margin-top: 20px; }
.recommendations h3 { font-size: 0.98rem; margin-bottom: 12px; color: var(--accent); }

.rec-item {
  background: var(--card-2);
  border-left: 3px solid var(--accent);
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 8px;
  font-size: 0.88rem;
  color: var(--text);
}

.rec-item.specific {
  border-left-color: #ff9b4c;
  padding: 14px 16px;
}

.rec-signo {
  font-size: 0.83rem;
  color: #ff9b4c;
  display: block;
  margin-bottom: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.rec-list {
  list-style: none;
  counter-reset: rec;
  margin: 0;
  padding: 0;
}

.rec-list li {
  counter-increment: rec;
  position: relative;
  padding: 8px 0 8px 34px;
  font-size: 0.86rem;
  color: var(--text);
  border-bottom: 1px dashed rgba(160,168,200,0.15);
  line-height: 1.45;
}

.rec-list li:last-child { border-bottom: none; }

.rec-list li::before {
  content: counter(rec);
  position: absolute;
  left: 0;
  top: 8px;
  width: 22px;
  height: 22px;
  background: linear-gradient(135deg, #ff9b4c, #ff6b6b);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.72rem;
  color: white;
}

.rec-list li:nth-child(1)::before { background: linear-gradient(135deg, #4cd97b, #2ba85a); }
.rec-list li:nth-child(2)::before { background: linear-gradient(135deg, #6c8cff, #4a6adf); }
.rec-list li:nth-child(3)::before { background: linear-gradient(135deg, #8f6cff, #6a4adf); }

.disclaimer {
  margin-top: 20px;
  padding: 14px 16px;
  background: rgba(255,184,76,0.08);
  border: 1px solid rgba(255,184,76,0.3);
  border-radius: 10px;
  font-size: 0.83rem;
  color: var(--warn);
  line-height: 1.5;
}

/* ============================================================
   LEYENDAS
   ============================================================ */
.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  justify-content: center;
  margin-top: 10px;
  font-size: 0.78rem;
  color: var(--muted);
}

.legend-item { display: flex; align-items: center; gap: 6px; }

.legend-dot {
  width: 11px;
  height: 11px;
  border-radius: 3px;
  display: inline-block;
  flex-shrink: 0;
}

.legend-bloques {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 6px 14px;
  margin-top: 12px;
  padding: 12px 14px;
  background: var(--card-2);
  border-radius: 10px;
  font-size: 0.8rem;
  color: var(--muted);
}

.legend-bloques .item { display: flex; gap: 8px; align-items: flex-start; }

.legend-bloques .cod {
  font-weight: 700;
  color: var(--accent);
  min-width: 18px;
}

.hidden { display: none; }

/* ============================================================
   CARGA / ARCHIVOS
   ============================================================ */
.loader-section {
  margin-top: 16px;
  padding: 16px;
  background: var(--card-2);
  border-radius: 12px;
  border: 1px dashed var(--border);
}

.loader-section h4 { font-size: 0.92rem; margin-bottom: 8px; color: var(--accent); }

.loader-section p { font-size: 0.8rem; color: var(--muted); margin-bottom: 12px; }

.aviso-carga {
  background: rgba(108,140,255,0.08);
  border-left: 3px solid var(--accent);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 0.83rem;
  color: var(--text);
  margin-bottom: 14px;
  line-height: 1.45;
}

.aviso-carga strong { color: var(--accent); }

.file-input-wrap { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

input[type="file"] {
  padding: 10px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.82rem;
  cursor: pointer;
  max-width: 100%;
}

textarea {
  width: 100%;
  padding: 12px 14px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.9rem;
  font-family: inherit;
  resize: vertical;
  min-height: 60px;
}

textarea:focus { outline: none; border-color: var(--accent); }

.loaded-files { margin-top: 12px; font-size: 0.8rem; color: var(--muted); }

.file-tag {
  display: inline-block;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 8px;
  margin: 3px 3px 0 0;
  font-size: 0.73rem;
  max-width: 100%;
  word-break: break-word;
}

.stat-card {
  background: var(--card-2);
  border-radius: 10px;
  padding: 12px;
  text-align: center;
  border: 1px solid var(--border);
}

.stat-label {
  font-size: 0.7rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 4px;
}

.stat-value { font-size: 1.6rem; font-weight: 700; line-height: 1.1; color: var(--accent); }

.stat-sub { font-size: 0.7rem; color: var(--muted); margin-top: 4px; }

.nota-box {
  background: rgba(108,140,255,0.06);
  border: 1px solid rgba(108,140,255,0.25);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 0.84rem;
  color: var(--text);
  margin-top: 12px;
  word-break: break-word;
}

.nota-box strong { color: var(--accent); }

.comparando-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  align-items: center;
  background: rgba(108,140,255,0.08);
  border: 1px solid rgba(108,140,255,0.3);
  border-radius: 10px;
  padding: 12px 16px;
  margin-bottom: 14px;
  font-size: 0.85rem;
  color: var(--text);
  line-height: 1.5;
}

.comparando-bar .chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--card-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
}

.comparando-bar .chip.actual { border-color: #4cd97b; color: #4cd97b; }
.comparando-bar .chip.base { border-color: #4cd97b; color: #4cd97b; }
.comparando-bar .chip.anteriores { border-color: #6c8cff; color: #6c8cff; }

.instrucciones-carpeta {
  background: rgba(76,217,123,0.06);
  border: 1px solid rgba(76,217,123,0.25);
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 14px;
  font-size: 0.86rem;
  color: var(--text);
}

.instrucciones-carpeta h5 {
  color: #4cd97b;
  font-size: 0.92rem;
  margin-bottom: 8px;
  font-weight: 700;
}

.instrucciones-carpeta ol { margin-left: 20px; margin-top: 6px; }
.instrucciones-carpeta ol li { margin-bottom: 4px; font-size: 0.82rem; color: var(--muted); }

.instrucciones-carpeta code {
  background: var(--card-2);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: 'Courier New', monospace;
  font-size: 0.82rem;
  color: #4cd97b;
  border: 1px solid var(--border);
}

.toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(-120%);
  background: var(--card);
  border: 1px solid var(--accent);
  color: var(--text);
  padding: 14px 20px;
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.5);
  font-size: 0.88rem;
  max-width: 92%;
  width: max-content;
  z-index: 9999;
  opacity: 0;
  transition: transform 0.35s ease, opacity 0.35s ease;
  text-align: center;
  line-height: 1.4;
}

.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }
.toast strong { color: var(--accent); }

.delta-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border-radius: 999px;
  font-weight: 700;
  background: var(--card);
  border: 1px solid var(--border);
}

/* ============================================================
   FOOTER DEL TEST
   ============================================================ */
.site-footer {
  margin-top: 30px;
  padding: 22px 16px 18px;
  border-top: 1px solid var(--border);
  text-align: center;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.6;
}

.site-footer .footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 18px;
  margin-bottom: 10px;
}

.site-footer .footer-links a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
  cursor: pointer;
  border-bottom: 1px dotted transparent;
  transition: border-color 0.15s;
}

.site-footer .footer-links a:hover { border-bottom-color: var(--accent); }

.site-footer .footer-disclaimer {
  max-width: 640px;
  margin: 8px auto 0;
  font-size: 0.76rem;
  color: var(--muted);
}

.site-footer .footer-copy {
  margin-top: 10px;
  font-size: 0.72rem;
  color: #6a7396;
}

/* ============================================================
   MODALES LEGALES
   ============================================================ */
.legal-modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 30px 16px;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  overflow-y: auto;
}

.legal-modal.open { display: flex; }

.legal-modal .legal-box {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  max-width: 780px;
  width: 100%;
  padding: 26px 28px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
  color: var(--text);
  line-height: 1.65;
  font-size: 0.9rem;
  position: relative;
}

.legal-modal .legal-close {
  position: absolute;
  top: 12px;
  right: 14px;
  background: var(--card-2);
  border: 1px solid var(--border);
  color: var(--text);
  width: 34px;
  height: 34px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}

.legal-modal .legal-close:hover { background: #2a3050; }

.legal-modal h2 { font-size: 1.25rem; margin-bottom: 6px; color: var(--accent); padding-right: 40px; }
.legal-modal h3 { font-size: 0.98rem; margin: 18px 0 8px; color: var(--accent); }
.legal-modal p { margin-bottom: 10px; }
.legal-modal ul { margin: 8px 0 12px 22px; }
.legal-modal ul li { margin-bottom: 5px; }

.legal-modal .legal-meta {
  font-size: 0.76rem;
  color: var(--muted);
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.legal-modal .legal-highlight {
  background: rgba(76,217,123,0.08);
  border-left: 3px solid #4cd97b;
  border-radius: 8px;
  padding: 12px 14px;
  margin: 14px 0;
  font-size: 0.86rem;
  color: #c8f5d8;
}

.legal-modal .legal-warn {
  background: rgba(255,184,76,0.08);
  border-left: 3px solid var(--warn);
  border-radius: 8px;
  padding: 12px 14px;
  margin: 14px 0;
  font-size: 0.86rem;
  color: #ffe0a8;
}

.legal-modal code {
  background: var(--card-2);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.82rem;
  color: #4cd97b;
  border: 1px solid var(--border);
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 720px) {
  body { padding: 12px; }
  header h1 { font-size: 1.55rem; }
  header p { font-size: 0.85rem; }
  .card { padding: 16px; border-radius: 12px; margin-bottom: 14px; }
  .question { padding: 14px; }
  .question h3 { font-size: 0.94rem; }
  .actions { flex-direction: column; }
  .actions .btn { width: 100%; }
  .score-circle { width: 150px; height: 150px; }
  .score-circle .score-value { font-size: 2.2rem; }
  .result-level { font-size: 1.15rem; }
  .signs-table { font-size: 0.76rem; }
  .signs-table th, .signs-table td { padding: 6px 5px; }
  .signs-table th { font-size: 0.68rem; }
  .stat-card { padding: 10px; }
  .stat-value { font-size: 1.45rem; }
  .file-input-wrap { flex-direction: column; align-items: stretch; }
  input[type="file"] { width: 100%; }
  .loader-section { padding: 12px; }
  .instrucciones-carpeta { padding: 12px; }
  .instrucciones-carpeta ol { margin-left: 16px; }
  .rec-item.specific { padding: 12px 13px; }
  .rec-list li { padding-left: 30px; font-size: 0.83rem; }
  .rec-list li::before { width: 20px; height: 20px; font-size: 0.68rem; }
  .toast { font-size: 0.82rem; padding: 12px 16px; }
  .comparando-bar { padding: 10px 12px; font-size: 0.82rem; }
  .comparando-bar .chip { font-size: 0.72rem; padding: 4px 10px; }
  .resumen-interpretativo { padding: 16px 14px; }

  .intro-titulo { font-size: 1.12rem; }
  .intro-sub { font-size: 0.95rem; margin: 18px 0 8px; }
  #intro p { font-size: 0.88rem; }
  .intro-lista li,
  .intro-lista-puntos li { font-size: 0.86rem; }
  .intro-idea-final { padding: 14px 14px 8px; }
  .nav-volver .btn { font-size: 0.84rem; padding: 9px 16px; }
}

@media (max-width: 600px) {
  .legal-modal { padding: 14px 10px; }
  .legal-modal .legal-box { padding: 20px 16px; border-radius: 12px; }
  .legal-modal h2 { font-size: 1.08rem; }
}

@media (max-width: 400px) {
  header h1 { font-size: 1.35rem; }
  .card { padding: 14px; }
  .question { padding: 12px; }
  .question h3 { font-size: 0.9rem; }
  .opt-principal { font-size: 0.85rem; }
  .opt-secundaria { font-size: 0.66rem; }
  .signs-table { font-size: 0.72rem; }
  .signs-table th, .signs-table td { padding: 5px 4px; }
}

/* ============================================================
   IMPRESIÓN
   ============================================================ */
@media print {
  .solo-pantalla,
  #comparisonResult,
  .loader-section,
  input[type="file"],
  .actions,
  .toast,
  #toast,
  button,
  .btn,
  .progress-wrap,
  #intro,
  #test,
  .instrucciones-carpeta,
  .aviso-carga,
  .comparando-bar,
  .aviso-recordatorio,
  .aviso-atencion,
  .aviso-cierre,
  .site-footer,
  .legal-modal,
  .nav-volver {
    display: none !important;
  }

  html, body {
    background: #ffffff !important;
    color: #1a1a1a !important;
    padding: 0 !important;
    font-size: 11pt;
  }

  .container { max-width: 100%; margin: 0; }

  .card {
    background: #ffffff !important;
    color: #1a1a1a !important;
    border: 1px solid #d0d0d0 !important;
    box-shadow: none !important;
    margin-bottom: 12px !important;
    padding: 14px !important;
    page-break-inside: avoid;
    border-radius: 8px;
  }

  .aviso-psicometrico { background: #fff8e6 !important; color: #7a5a00 !important; border-color: #e0c070 !important; }
  .aviso-psicometrico strong { color: #7a5a00 !important; }
  .nota-g { background: #eefaf0 !important; color: #1a5c2a !important; border-color: #a8d8b5 !important; }
  .nota-g strong { color: #1a5c2a !important; }
  .resumen-interpretativo { background: #eef2ff !important; color: #1a1a1a !important; border-color: #a8b8e8 !important; }
  .resumen-interpretativo h3 { color: #1a3a8a !important; }
  .resumen-interpretativo .destacado-dificultad { color: #b35a00 !important; }
  .resumen-interpretativo .destacado-recurso-bajo { color: #8a6200 !important; }
  .resumen-interpretativo .destacado-fortaleza { color: #1a5c2a !important; }
  .resumen-interpretativo .destacado-global { color: #1a3a8a !important; }

  header { margin-bottom: 16px; }
  header h1 {
    color: #1a3a8a !important;
    -webkit-text-fill-color: #1a3a8a !important;
    background: none !important;
    font-size: 20pt;
  }
  header p { color: #444 !important; font-size: 10pt; }

  .result-level { color: #1a3a8a !important; font-size: 16pt; }
  .result-desc { color: #333 !important; font-size: 10.5pt; }
  .score-circle { background: #f5f5f5 !important; }
  .score-circle .score-value { color: #1a3a8a !important; }
  .score-circle .score-label { color: #444 !important; }

  .chart-section h3 { color: #1a3a8a !important; font-size: 13pt; }
  .chart-section .chart-desc { color: #444 !important; font-size: 9.5pt; }
  .recommendations h3 { color: #1a3a8a !important; font-size: 13pt; }

  .signs-table { font-size: 10pt; }
  .signs-table th { color: #1a3a8a !important; border-bottom: 1px solid #999 !important; }
  .signs-table td { color: #1a1a1a !important; border-bottom: 1px solid #e0e0e0 !important; }

  .bar-item .label { color: #333 !important; }
  .bar-item .label span { color: #333 !important; }
  .bar-track { background: #e8e8e8 !important; }

  .rec-item {
    background: #f8f8f8 !important;
    color: #1a1a1a !important;
    border-left: 3px solid #6c8cff !important;
  }
  .rec-item.specific { border-left-color: #ff9b4c !important; }
  .rec-signo { color: #b35a00 !important; }
  .rec-list li { color: #1a1a1a !important; border-bottom: 1px dashed #ddd !important; }
  .rec-list li::before { color: #ffffff !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .pill { color: #ffffff !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }

  .legend-bloques { background: #f5f5f5 !important; color: #333 !important; }
  .legend-bloques .cod { color: #1a3a8a !important; }

  canvas { background: #ffffff !important; }
  .chart-wrap { overflow: visible !important; }

  @page { margin: 12mm; }
}

/* ============================================================
   INTERRUPTOR DE TEMA (SWITCH)
   ============================================================ */
.btn-tema-switch {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  -webkit-tap-highlight-color: transparent;
}

.switch-track {
  position: relative;
  display: inline-flex;
  align-items: center;
  width: 54px;
  height: 30px;
  background-color: #f0f0f0;
  border-radius: 30px;
  border: 1px solid #dcdcdc;
  transition: background-color 0.3s ease, border-color 0.3s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.switch-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 24px;
  height: 24px;
  background-color: #ffffff;
  border-radius: 50%;
  box-shadow: 0 2px 5px rgba(0,0,0,0.15);
  transition: transform 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
  z-index: 2;
}

.switch-icon-sun,
.switch-icon-moon {
  position: absolute;
  font-size: 14px;
  z-index: 1;
  transition: opacity 0.3s ease;
}

.switch-icon-sun { left: 8px; color: #a0a0a0; }
.switch-icon-moon { right: 8px; color: #a0a0a0; }

[data-tema="oscuro"] .switch-track {
  background-color: #1a1a1a;
  border-color: #333;
}

[data-tema="oscuro"] .switch-thumb {
  transform: translateX(24px);
  background-color: #2c2c2c;
  box-shadow: 0 2px 5px rgba(0,0,0,0.5);
}

[data-tema="oscuro"] .switch-icon-moon { color: #ffffff; }
[data-tema="oscuro"] .switch-icon-sun { color: #555; }

@media (max-width: 720px) {
  .btn-tema-switch {
    top: 15px;
    right: 15px;
    transform: scale(0.9);
  }
}

/* ============================================================
   TRANSICIONES SUAVES ENTRE TEMAS
   ============================================================ */
.bloque-texto,
.card,
.pantalla-inicio,
.pantalla-categorias,
.test-card,
.cat-bloque,
.modal-caja,
.question,
.options label {
  transition: background-color 0.5s ease, border-color 0.5s ease, color 0.5s ease, box-shadow 0.5s ease;
}
/* ============================================================
   BOTÓN PULSADOR DE TEMA (☀ / ☾)
   ============================================================ */
.btn-tema-switch {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 9999;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--card, #ffffff);
  border: 1px solid var(--border, #e6e5df);
  color: var(--text, #343832);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.2s ease, border-color 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

.btn-tema-switch:hover {
  transform: translateY(-1px) scale(1.05);
  border-color: var(--accent, #667760);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
}

.btn-tema-switch:active {
  transform: scale(0.95);
}

.btn-tema-switch:focus-visible {
  outline: 2px solid var(--accent, #667760);
  outline-offset: 2px;
}

@media (max-width: 720px) {
  .btn-tema-switch {
    top: 12px;
    right: 12px;
    width: 30px;
    height: 30px;
    font-size: 15px;
  }
}
/* ============================================================
   MODAL GENÉRICO — Ficha metodológica y ventanas flotantes
   ============================================================ */
#modal-metodologia {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(15, 18, 32, 0.75);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  box-sizing: border-box;
}

#modal-metodologia[style*="display: flex"],
#modal-metodologia.open {
  display: flex !important;
}

#modal-metodologia .modal-caja {
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 24px 28px;
  position: relative;
  width: 100%;
  max-width: 720px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
  text-align: left;
  box-sizing: border-box;
  line-height: 1.6;
  font-size: 0.92rem;
}

#modal-metodologia .modal-cerrar {
  position: absolute;
  top: 14px;
  right: 16px;
  background: var(--card-2);
  border: 1px solid var(--border);
  color: var(--text);
  width: 34px;
  height: 34px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
  padding: 0;
}

#modal-metodologia .modal-cerrar:hover {
  background: var(--border);
}

#modal-metodologia h2 {
  color: var(--accent);
  font-size: 1.25rem;
  margin: 0 0 14px;
  padding-right: 40px;
}

#modal-metodologia h3 {
  color: var(--accent);
  font-size: 0.98rem;
  margin: 18px 0 8px;
}

#modal-metodologia p {
  margin-bottom: 10px;
  color: var(--text);
}

#modal-metodologia ul {
  margin: 8px 0 12px 22px;
  padding-left: 0;
}

#modal-metodologia ul li {
  margin-bottom: 5px;
  color: var(--text);
  font-size: 0.9rem;
}

#modal-metodologia strong {
  color: var(--accent);
}

#modal-metodologia details summary {
  cursor: pointer;
  color: var(--accent);
  font-weight: 600;
}

#modal-metodologia code {
  background: var(--card-2);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.85rem;
  color: var(--accent);
  border: 1px solid var(--border);
}