/* ==========================================================================
   Test de Nivel de Idiomas — Experience Prime
   CSS puro, sin dependencias. Mobile-first. ~7KB sin minificar.

   V3 (rendimiento): la tipografía (Cinzel/Montserrat) ya NO se carga con
   @import aquí — @import bloquea el render mientras el navegador descubre y
   descarga esa hoja de estilo en cascada, antes de poder pintar nada. Ahora
   se carga con un <link> normal en el <head> de index.html, que el navegador
   puede descubrir y empezar a descargar en paralelo con este mismo archivo.
   Si el sitio en Framer ya carga Cinzel/Montserrat globalmente, borra ese
   <link> de index.html y deja las variables --ep-font-* apuntando a las
   fuentes que Framer ya sirve (evita cargar la tipografía dos veces).
   ========================================================================== */

#ep-test-root {
  --ep-gold: #a58213;
  --ep-yellow: #f9ce0b;
  --ep-purple: #7800bc;
  --ep-purple-dark: #52007f;
  --ep-ink: #1c1024;
  --ep-bg: #ffffff;
  --ep-bg-soft: #faf7fd;
  --ep-border: #e8e1ef;
  --ep-success-bg: #f3ecfb;
  --ep-font-display: 'Cinzel', Georgia, serif;
  --ep-font-body: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --ep-radius: 18px;
  --ep-max-w: 640px;

  font-family: var(--ep-font-body);
  color: var(--ep-ink);
  box-sizing: border-box;
  max-width: var(--ep-max-w);
  margin: 0 auto;
  -webkit-font-smoothing: antialiased;
}
#ep-test-root *, #ep-test-root *::before, #ep-test-root *::after { box-sizing: inherit; }

#ep-test-root .ep-card {
  background: var(--ep-bg);
  border: 1px solid var(--ep-border);
  border-radius: var(--ep-radius);
  padding: 28px 22px;
  box-shadow: 0 8px 30px rgba(120, 0, 188, 0.07);
}

/* ---------- Tipografía ---------- */
#ep-test-root h1, #ep-test-root h2, #ep-test-root h3 {
  font-family: var(--ep-font-display);
  color: var(--ep-purple-dark);
  margin: 0 0 10px;
  line-height: 1.25;
}
#ep-test-root h1 { font-size: clamp(1.4rem, 5vw, 1.9rem); }
#ep-test-root h2 { font-size: clamp(1.2rem, 4.5vw, 1.5rem); }
#ep-test-root p { margin: 0 0 12px; line-height: 1.55; font-size: 0.98rem; }
#ep-test-root .ep-muted { color: #6b5f73; font-size: 0.9rem; }

/* ---------- Botones ---------- */
#ep-test-root button, #ep-test-root a.ep-btn-link {
  font-family: var(--ep-font-body);
  cursor: pointer;
  border: none;
  border-radius: 999px;
  transition: transform .12s ease, box-shadow .12s ease, background .15s ease;
  text-decoration: none;
  display: inline-block;
  text-align: center;
}
#ep-test-root button:active, #ep-test-root a.ep-btn-link:active { transform: scale(0.98); }
#ep-test-root button:focus-visible, #ep-test-root a.ep-btn-link:focus-visible { outline: 3px solid var(--ep-yellow); outline-offset: 2px; }

#ep-test-root .ep-btn-primary {
  background: linear-gradient(135deg, var(--ep-purple), var(--ep-purple-dark));
  color: #fff;
  font-weight: 700;
  font-size: 1rem;
  padding: 15px 28px;
  width: 100%;
  box-shadow: 0 8px 20px rgba(120,0,188,0.28);
}
#ep-test-root .ep-btn-primary:hover { box-shadow: 0 10px 24px rgba(120,0,188,0.38); }
#ep-test-root .ep-btn-primary:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }

#ep-test-root .ep-btn-secondary {
  background: #fff;
  color: var(--ep-purple-dark);
  font-weight: 600;
  font-size: 0.95rem;
  padding: 13px 24px;
  width: 100%;
  border: 2px solid var(--ep-purple);
}

#ep-test-root .ep-btn-ghost {
  background: transparent;
  color: #6b5f73;
  font-weight: 600;
  font-size: 0.85rem;
  padding: 8px 14px;
  text-decoration: underline;
}

/* ---------- Intro / selección de idioma ---------- */
#ep-test-root .ep-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 16px 0 20px;
}
#ep-test-root .ep-meta-chip {
  background: var(--ep-bg-soft);
  border: 1px solid var(--ep-border);
  border-radius: 999px;
  padding: 7px 13px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ep-purple-dark);
  white-space: nowrap;
}
#ep-test-root .ep-lang-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 6px 0 22px;
}
#ep-test-root .ep-lang-btn {
  background: var(--ep-bg-soft);
  border: 2px solid var(--ep-border);
  border-radius: 14px;
  padding: 14px 6px;
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--ep-ink);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
#ep-test-root .ep-lang-btn .ep-flag { font-size: 1.6rem; }
#ep-test-root .ep-lang-btn.is-active {
  border-color: var(--ep-purple);
  background: var(--ep-success-bg);
  box-shadow: 0 0 0 3px rgba(120,0,188,0.12);
}
#ep-test-root .ep-lang-btn .ep-badge-top {
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--ep-gold);
  font-weight: 800;
}
#ep-test-root .ep-lang-range {
  font-size: 0.68rem;
  font-weight: 600;
  color: #8a7d92;
}

/* ---------- Barra de progreso ---------- */
#ep-test-root .ep-progress-wrap { margin-bottom: 18px; }
#ep-test-root .ep-progress-label {
  display: flex; justify-content: space-between;
  font-size: 0.78rem; font-weight: 600; color: #6b5f73; margin-bottom: 6px;
}
#ep-test-root .ep-progress-track {
  height: 8px; background: var(--ep-border); border-radius: 999px; overflow: hidden;
}
#ep-test-root .ep-progress-fill {
  height: 100%; background: linear-gradient(90deg, var(--ep-purple), var(--ep-yellow));
  border-radius: 999px; transition: width .35s ease;
}

/* ---------- Pregunta ---------- */
#ep-test-root .ep-skill-tag {
  display: inline-block; font-size: 0.72rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .04em; color: #fff; background: var(--ep-purple);
  padding: 4px 10px; border-radius: 999px; margin-bottom: 12px;
}
#ep-test-root .ep-passage {
  background: var(--ep-bg-soft); border-left: 4px solid var(--ep-yellow);
  border-radius: 10px; padding: 14px 16px; margin-bottom: 14px; font-size: 0.95rem;
}
#ep-test-root .ep-listen-row {
  display: flex; align-items: center; gap: 10px; margin-bottom: 16px;
}
#ep-test-root .ep-listen-btn {
  background: var(--ep-purple); color: #fff; font-weight: 700; font-size: 0.9rem;
  padding: 11px 18px; border-radius: 999px; display: inline-flex; align-items: center; gap: 8px;
}
#ep-test-root .ep-transcript-toggle {
  background: none; color: #6b5f73; font-size: 0.8rem; text-decoration: underline; padding: 4px;
}
#ep-test-root .ep-transcript { display: none; font-style: italic; color: #6b5f73; margin: -6px 0 14px; font-size: 0.88rem; }
#ep-test-root .ep-transcript.is-visible { display: block; }
/* V3: estado del audio real ("✓ Audio reproducido") junto al botón Escuchar */
#ep-test-root .ep-listen-state { font-size: 0.78rem; font-weight: 700; color: #2e9e5b; }
/* V3: aclara que solo cuenta como evidencia si se reproduce el audio */
#ep-test-root .ep-listen-hint { font-size: 0.76rem; color: #948a9c; margin: -10px 0 14px; }

#ep-test-root .ep-question-text { font-size: 1.08rem; font-weight: 600; margin-bottom: 16px; color: var(--ep-ink); }

#ep-test-root .ep-options { display: flex; flex-direction: column; gap: 10px; }
#ep-test-root .ep-option {
  text-align: left;
  background: #fff;
  border: 2px solid var(--ep-border);
  border-radius: 14px;
  padding: 13px 16px;
  font-size: 0.96rem;
  font-weight: 500;
  color: var(--ep-ink);
  width: 100%;
  display: flex; align-items: center; gap: 10px;
}
#ep-test-root .ep-option:hover:not(:disabled) { border-color: var(--ep-purple); }
#ep-test-root .ep-option .ep-opt-letter {
  flex: 0 0 auto; width: 26px; height: 26px; border-radius: 50%;
  background: var(--ep-bg-soft); color: var(--ep-purple-dark); font-weight: 700; font-size: 0.8rem;
  display: flex; align-items: center; justify-content: center;
}
#ep-test-root .ep-option.is-correct { border-color: #2e9e5b; background: #edfaf1; }
#ep-test-root .ep-option.is-correct .ep-opt-letter { background: #2e9e5b; color: #fff; }
#ep-test-root .ep-option.is-wrong-selected { border-color: #c4436a; background: #fdeff2; }
#ep-test-root .ep-option:disabled { cursor: default; }

#ep-test-root .ep-feedback {
  margin-top: 16px; padding: 12px 14px; border-radius: 12px;
  background: var(--ep-success-bg); color: var(--ep-purple-dark);
  font-weight: 600; font-size: 0.92rem;
  display: flex; align-items: center; gap: 8px;
  opacity: 0; transform: translateY(4px);
  transition: opacity .25s ease, transform .25s ease;
}
#ep-test-root .ep-feedback.is-visible { opacity: 1; transform: translateY(0); }

/* ---------- Resultados ---------- */
#ep-test-root .ep-result-level {
  text-align: center; margin: 4px 0 6px;
}
#ep-test-root .ep-result-level .ep-level-code {
  font-family: var(--ep-font-display);
  font-size: 3.2rem; color: var(--ep-purple); line-height: 1;
  display: block;
}
#ep-test-root .ep-result-level .ep-level-name { font-weight: 700; color: var(--ep-ink); font-size: 1.05rem; }
#ep-test-root .ep-orientative {
  text-align: center; font-size: 0.78rem; color: #948a9c; margin-top: -2px; margin-bottom: 4px;
}
#ep-test-root .ep-scope-note {
  text-align: center; font-size: 0.76rem; color: #948a9c; margin: 0 0 18px; font-style: italic;
}
/* V3: indicador de confianza junto al nivel ("Confianza: media") */
#ep-test-root .ep-confidence-tag {
  display: inline-block; font-size: 0.72rem; font-weight: 700;
  padding: 3px 11px; border-radius: 999px;
  background: var(--ep-bg-soft); border: 1px solid var(--ep-border); color: var(--ep-purple-dark);
}
/* V3: nota breve de limitación (orientativo, no sustituye evaluación docente) */
#ep-test-root .ep-limit-note {
  text-align: center; font-size: 0.74rem; color: #948a9c; margin: 0 0 18px; line-height: 1.45;
}
#ep-test-root .ep-section-label {
  font-size: 0.8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .03em;
  color: #948a9c; margin: 22px 0 10px;
}

#ep-test-root .ep-skill-bar-row { margin-bottom: 12px; }
#ep-test-root .ep-skill-bar-label {
  display: flex; justify-content: space-between; font-size: 0.85rem; font-weight: 600; margin-bottom: 5px;
}
#ep-test-root .ep-skill-bar-track { height: 10px; background: var(--ep-border); border-radius: 999px; overflow: hidden; }
#ep-test-root .ep-skill-bar-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--ep-gold), var(--ep-yellow)); transition: width .6s ease; }
/* V3: pill neutro para "Sin evidencia suficiente" / "Pendiente de evaluación"
   (Listening sin audio reproducido, o Speaking — nunca medido en este test) */
#ep-test-root .ep-pending-tag {
  font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .02em;
  color: #948a9c; background: var(--ep-bg-soft); border: 1px dashed var(--ep-border);
  padding: 2px 9px; border-radius: 999px;
}

#ep-test-root .ep-insight-box {
  background: var(--ep-bg-soft); border-radius: 14px; padding: 16px; margin: 18px 0; font-size: 0.95rem;
}
#ep-test-root .ep-insight-box-primary {
  border-left: 4px solid var(--ep-gold);
  font-size: 1rem;
  font-weight: 500;
  line-height: 1.55;
}
#ep-test-root .ep-insight-cols { display: grid; grid-template-columns: 1fr; gap: 14px; margin: 18px 0; }
#ep-test-root .ep-insight-col h3 { font-size: 0.95rem; margin-bottom: 6px; }
#ep-test-root .ep-insight-col ul { margin: 0; padding-left: 18px; font-size: 0.9rem; line-height: 1.5; }

#ep-test-root .ep-badge-box {
  display: flex; align-items: center; gap: 12px; background: linear-gradient(135deg, var(--ep-purple), var(--ep-purple-dark));
  color: #fff; border-radius: 14px; padding: 14px 16px; margin: 18px 0;
}
#ep-test-root .ep-badge-box .ep-badge-icon { font-size: 1.8rem; }
#ep-test-root .ep-badge-box .ep-badge-label { font-weight: 700; font-size: 0.95rem; }
#ep-test-root .ep-badge-box .ep-badge-sub { font-size: 0.78rem; opacity: .85; }

#ep-test-root .ep-cta-box { margin-top: 22px; padding-top: 18px; border-top: 1px dashed var(--ep-border); }
#ep-test-root .ep-cta-box p { text-align: center; }
#ep-test-root .ep-cta-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }

#ep-test-root .ep-social-box {
  margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--ep-border); text-align: center;
}
#ep-test-root .ep-social-title { font-weight: 700; font-size: 0.9rem; margin-bottom: 2px; }
#ep-test-root .ep-social-links { display: flex; justify-content: center; gap: 10px; margin-top: 10px; flex-wrap: wrap; }
#ep-test-root .ep-social-link {
  font-size: 0.85rem; font-weight: 600; color: var(--ep-purple-dark);
  background: var(--ep-bg-soft); border: 1px solid var(--ep-border);
  border-radius: 999px; padding: 12px 20px; text-decoration: none; display: inline-block;
  min-height: 20px; line-height: 20px;
}

#ep-test-root .ep-restart-row { text-align: center; margin-top: 14px; }

/* ---------- V4: Language Profile (evidencia por habilidad) ---------- */
#ep-test-root .ep-profile-list { display: flex; flex-direction: column; gap: 12px; margin-bottom: 6px; }
#ep-test-root .ep-profile-row {
  background: var(--ep-bg-soft); border: 1px solid var(--ep-border); border-radius: 14px;
  padding: 14px 16px;
}
#ep-test-root .ep-profile-row-head {
  display: flex; align-items: center; gap: 8px; margin-bottom: 6px; flex-wrap: wrap;
}
#ep-test-root .ep-profile-icon { font-size: 1.15rem; }
#ep-test-root .ep-profile-skill { font-weight: 700; font-size: 0.95rem; color: var(--ep-ink); flex: 1 1 auto; }
#ep-test-root .ep-profile-line { font-size: 0.9rem; color: #4a3f52; line-height: 1.5; margin: 0; }

/* Pills de evidencia — una de exactamente 4 categorías, nunca un nivel CEFR */
#ep-test-root .ep-evidence-pill {
  font-size: 0.68rem; font-weight: 800; text-transform: uppercase; letter-spacing: .02em;
  padding: 3px 10px; border-radius: 999px; white-space: nowrap;
}
#ep-test-root .ep-evidence-pill--evidencia-sólida { background: #e5f7ea; color: #1d7a41; }
#ep-test-root .ep-evidence-pill--evidencia-en-desarrollo { background: #fff4d6; color: #916a05; }
#ep-test-root .ep-evidence-pill--evidencia-limitada { background: #fdeee0; color: #a1550f; }
#ep-test-root .ep-evidence-pill--evidencia-insuficiente { background: #f1eef4; color: #6b5f73; }
/* V5: nuevas categorías de evidencia agregada (conteo fijo /5). OJO: el
   label V5 "En desarrollo" genera el slug "en-desarrollo" (SIN el prefijo
   "evidencia-" que sí llevaba el label V4 "Evidencia en desarrollo") -- son
   dos clases DISTINTAS aunque visualmente equivalentes, así que "en-
   desarrollo" se define aparte y no puede reutilizar la regla V4 de arriba.
   "Evidencia limitada" sí coincide letra por letra entre V4 y V5, por eso
   esa sí se reutiliza sin necesidad de una regla nueva. */
#ep-test-root .ep-evidence-pill--fortaleza { background: #e5f7ea; color: #1d7a41; }
#ep-test-root .ep-evidence-pill--buen-desempeño { background: #eaf1fb; color: #1d5fa1; }
#ep-test-root .ep-evidence-pill--en-desarrollo { background: #fff4d6; color: #916a05; }

/* Referencia de desempeño por banda (agregada entre las 4 habilidades) */
#ep-test-root .ep-band-reference { display: flex; flex-direction: column; gap: 6px; margin-bottom: 6px; }
#ep-test-root .ep-band-row {
  display: flex; align-items: center; gap: 10px; padding: 8px 12px;
  border-radius: 10px; background: var(--ep-bg-soft); border: 1px solid var(--ep-border);
}
#ep-test-root .ep-band-dot { font-size: 0.9rem; line-height: 1; }
#ep-test-root .ep-band-code { font-weight: 800; font-family: var(--ep-font-display); color: var(--ep-purple-dark); min-width: 34px; }
#ep-test-root .ep-band-status { font-size: 0.85rem; color: #4a3f52; }
#ep-test-root .ep-band-row--solid { border-color: #bfe8cc; }
#ep-test-root .ep-band-row--developing { border-color: #f5deA0; }

#ep-test-root .ep-speaking-box {
  margin: 18px 0; padding: 14px 16px; border-radius: 14px;
  background: var(--ep-bg-soft); border: 1px dashed var(--ep-border);
}

/* ---------- V5: Terminar test (abandono manual, point 15) ---------- */
#ep-test-root .ep-abandon-row { text-align: right; margin: -8px 0 14px; }

/* ---------- V5: Referencia MCER (tareas por nivel de complejidad, agregada) ---------- */
#ep-test-root .ep-mcer-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 6px; }
#ep-test-root .ep-mcer-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 12px; border-radius: 10px; background: var(--ep-bg-soft);
  border: 1px solid var(--ep-border); font-size: 0.85rem;
}
#ep-test-root .ep-mcer-title { font-weight: 600; color: var(--ep-ink); }
#ep-test-root .ep-mcer-count { font-weight: 700; color: var(--ep-purple-dark); }

/* ---------- Utilidades ---------- */
#ep-test-root .ep-sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
#ep-test-root .ep-center { text-align: center; }
#ep-test-root .ep-fade-in { animation: ep-fade .25s ease both; }
@keyframes ep-fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

@media (min-width: 600px) {
  #ep-test-root .ep-card { padding: 36px 40px; }
  #ep-test-root .ep-insight-cols { grid-template-columns: 1fr 1fr; }
  #ep-test-root .ep-cta-actions { flex-direction: row; }
}

@media (prefers-reduced-motion: reduce) {
  #ep-test-root *, #ep-test-root *::before, #ep-test-root *::after { animation: none !important; transition: none !important; }
}
