/*
 * SUME DOCBLOCK
 * Nombre: Estilos de la pantalla de test
 * Tipo: Salida (presentación)
 * Entradas: data-tema="claro|oscuro|verde" en #pantallaTest
 * Acciones: colores por tema (variables), maquetación escritorio + móvil
 * Salidas: el aspecto aprobado en el diseño "NeuroRecall – Pantalla de test"
 */
#pantallaTest, #pantallaElegir {
  --bg: #F4F6F9; --surface: #FFFFFF; --surface2: #EEF2F7; --border: #D9E0E8; --ink: #0F172A; --muted: #556070;
  --accent: #1D4ED8; --accentSoft: #E6EDFF; --accentInk: #1E3A8A; --onAccent: #FFFFFF;
  --ok: #047857; --okSoft: #E6F6EF; --okInk: #065F46; --bad: #B42318; --badSoft: #FDEDEB; --badInk: #912018;
  --warn: #B45309; --warnSoft: #FDF3E4; --warnInk: #8A3C04; --mark: #7C3AED; --markSoft: #F1EAFE; --markInk: #5B21B6; --onStrong: #FFFFFF;
  position: fixed; inset: 0; z-index: 9000; overflow-y: auto; background: var(--bg); color: var(--ink);
  font-family: Inter, system-ui, sans-serif; -webkit-font-smoothing: antialiased;
}
#pantallaTest[data-tema="oscuro"], #pantallaElegir[data-tema="oscuro"] {
  --bg: #0B0F14; --surface: #131A22; --surface2: #1C2530; --border: #2A3644; --ink: #E6EDF5; --muted: #9AA7B6;
  --accent: #6B9BFF; --accentSoft: #18263F; --accentInk: #B7CCFF; --onAccent: #0B0F14;
  --ok: #34D399; --okSoft: #0E2A21; --okInk: #86EFC5; --bad: #F87171; --badSoft: #351616; --badInk: #FCA5A5;
  --warn: #FBBF24; --warnSoft: #2E240B; --warnInk: #FCD872; --mark: #C4B5FD; --markSoft: #241E3D; --markInk: #D9CEFF; --onStrong: #0B0F14;
}
#pantallaTest[data-tema="verde"], #pantallaElegir[data-tema="verde"] {
  --bg: #F1F4F1; --surface: #FFFFFF; --surface2: #E8EEE9; --border: #D3DDD5; --ink: #14211B; --muted: #53625A;
  --accent: #1F6B4F; --accentSoft: #E1F0E8; --accentInk: #174F3B; --onAccent: #FFFFFF;
  --ok: #15803D; --okSoft: #E7F6EA; --okInk: #14532D;
}
body.en-test #fab-tutor { display: none !important; }
body.en-test { overflow: hidden; }

#pantallaTest *, #pantallaElegir * { box-sizing: border-box; }
#pantallaTest button, #pantallaElegir button, #pantallaElegir input { font-family: inherit; }
#pantallaTest h1, #pantallaTest h2, #pantallaTest p, #pantallaElegir h1, #pantallaElegir h2, #pantallaElegir p { margin: 0; }
#pantallaTest svg, #pantallaElegir svg { flex-shrink: 0; }
#pantallaTest :focus-visible, #pantallaElegir :focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.pt-header { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 16px; padding: 12px 24px; background: var(--surface); border-bottom: 1px solid var(--border); }
.pt-titulo { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.pt-titulo-fila { display: flex; align-items: baseline; gap: 12px; min-width: 0; }
.pt-titulo-fila strong { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pt-titulo-fila span { font-size: 13px; color: var(--muted); white-space: nowrap; }
.pt-barra { height: 8px; max-width: 420px; background: var(--surface2); border-radius: 999px; overflow: hidden; }
.pt-barra > div { height: 100%; background: var(--accent); border-radius: 999px; transition: width .25s ease; }
.pt-reloj { font-size: 13px; font-weight: 600; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.pt-chips-movil { display: none; }

.pt-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--ink); font-size: 14px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.pt-btn:hover { border-color: var(--accent); }
.pt-btn.primario { background: var(--accent); border-color: var(--accent); color: var(--onAccent); }
.pt-btn.suave { background: var(--accentSoft); border-color: transparent; color: var(--accentInk); }
.pt-btn:disabled { opacity: .5; cursor: not-allowed; }

.pt-seg { display: flex; gap: 2px; padding: 3px; background: var(--surface2); border-radius: 10px; }
.pt-seg button { flex: 1; min-height: 36px; padding: 0 12px; border: 0; background: transparent; border-radius: 8px; font-size: 13px; font-weight: 600; color: var(--muted); cursor: pointer; }
.pt-seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.15); }

.pt-cuerpo { display: flex; gap: 24px; padding: 24px; max-width: 1360px; margin: 0 auto; align-items: flex-start; }
.pt-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.pt-aside { width: 360px; flex-shrink: 0; display: flex; flex-direction: column; gap: 16px; position: sticky; top: 96px; }
.pt-card { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.pt-card h2 { font-size: 15px; font-weight: 700; }
.pt-pregunta { padding: 28px; gap: 20px; }

.pt-aviso { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: 12px; background: var(--accentSoft); color: var(--accentInk); font-size: 14px; font-weight: 600; }
.pt-aviso span { flex: 1; }

.pt-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.pt-chip { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 12px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.pt-chip.azul { background: var(--accentSoft); color: var(--accentInk); }
.pt-chip.rojo { background: var(--badSoft); color: var(--badInk); }
.pt-chip.ambar { background: var(--warnSoft); color: var(--warnInk); }
.pt-chip.morado { background: var(--markSoft); color: var(--markInk); }

.pt-enunciado { font-size: 23px; line-height: 1.45; font-weight: 700; white-space: pre-line; }
.pt-opciones { display: flex; flex-direction: column; gap: 10px; }
.pt-opcion { display: flex; align-items: center; gap: 14px; width: 100%; min-height: 60px; padding: 12px 16px; border-radius: 12px; border: 1.5px solid var(--border); background: var(--surface); color: var(--ink); font-size: 16px; line-height: 1.4; text-align: left; cursor: pointer; }
.pt-opcion:hover:not(:disabled) { border-color: var(--accent); }
.pt-opcion:disabled { cursor: default; }
.pt-letra { width: 32px; height: 32px; border-radius: 8px; display: flex; align-items: center; justify-content: center; background: var(--surface2); font-weight: 700; font-size: 14px; flex-shrink: 0; }
.pt-opcion .pt-texto { flex: 1; }
.pt-opcion.ok { border-color: var(--ok); background: var(--okSoft); }
.pt-opcion.ok .pt-letra { background: var(--ok); color: var(--onStrong); }
.pt-opcion.bad { border-color: var(--bad); background: var(--badSoft); }
.pt-opcion.bad .pt-letra { background: var(--bad); color: var(--onStrong); }
.pt-opcion.dim { opacity: .55; }
.pt-opcion.enviando { border-color: var(--accent); background: var(--accentSoft); }
.pt-etiqueta { font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 999px; white-space: nowrap; }
.pt-etiqueta.ok { background: var(--ok); color: var(--onStrong); }
.pt-etiqueta.bad { background: var(--bad); color: var(--onStrong); }

.pt-feedback { padding: 16px 18px; border-radius: 12px; background: var(--surface2); display: flex; flex-direction: column; gap: 10px; }
.pt-feedback-titulo { display: flex; align-items: center; gap: 8px; font-size: 16px; font-weight: 700; }
.pt-feedback-titulo.ok { color: var(--okInk); }
.pt-feedback-titulo.bad { color: var(--badInk); }
.pt-feedback p { font-size: 14px; line-height: 1.6; }
.pt-feedback .pt-nota { font-size: 13px; color: var(--muted); }
.pt-feedback-botones { display: flex; flex-wrap: wrap; gap: 8px; }
.pt-detalle { border-left: 4px solid var(--accent); padding: 12px 14px; background: var(--surface); border-radius: 8px; font-size: 14px; line-height: 1.6; }

.pt-acciones { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; border-top: 1px solid var(--border); padding-top: 16px; }
.pt-acciones .pt-hueco { flex: 1; }
.pt-atajos { font-size: 12px; color: var(--muted); }

.pt-contadores { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.pt-contador { padding: 10px 12px; border-radius: 10px; }
.pt-contador div:first-child { font-size: 12px; font-weight: 600; }
.pt-contador div:last-child { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; }
.pt-contador.ok { background: var(--okSoft); color: var(--okInk); }
.pt-contador.bad { background: var(--badSoft); color: var(--badInk); }
.pt-contador.neutro { background: var(--surface2); color: var(--ink); }
.pt-contador.neutro div:first-child { color: var(--muted); }
.pt-contador.ambar { background: var(--warnSoft); color: var(--warnInk); }

.pt-grande { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 50px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); color: var(--ink); font-size: 14px; font-weight: 600; cursor: pointer; text-align: left; }
.pt-grande:hover { border-color: var(--accent); }
.pt-grande[aria-pressed="true"] { border-color: var(--accent); background: var(--accentSoft); }
.pt-punto { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.pt-numero { margin-left: auto; min-width: 28px; height: 24px; padding: 0 8px; border-radius: 999px; font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center; }

.pt-mapa { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 6px; max-height: 260px; overflow-y: auto; padding: 2px; }
.pt-celda { height: 34px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--muted); font-size: 12px; font-weight: 600; display: flex; align-items: center; justify-content: center; position: relative; cursor: pointer; padding: 0; }
.pt-celda.correcta { background: var(--okSoft); border-color: var(--ok); color: var(--okInk); }
.pt-celda.fallada { background: var(--badSoft); border-color: var(--bad); color: var(--badInk); }
.pt-celda.actual { background: var(--accent); border-color: var(--accent); color: var(--onAccent); }
.pt-celda .pt-marca { position: absolute; top: 3px; right: 3px; width: 7px; height: 7px; border-radius: 50%; background: var(--mark); }
.pt-leyenda { display: flex; flex-wrap: wrap; gap: 12px; font-size: 12px; color: var(--muted); }
.pt-leyenda span { display: inline-flex; align-items: center; gap: 6px; }
.pt-leyenda i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

.pt-check { display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 600; cursor: pointer; min-height: 32px; }
.pt-check input { width: 18px; height: 18px; accent-color: var(--accent); }
.pt-ayuda { font-size: 12px; color: var(--muted); }

.pt-resumen { padding: 32px; align-items: center; text-align: center; gap: 16px; }
.pt-resumen h1 { font-size: 26px; font-weight: 700; }
.pt-resumen .pt-contadores { width: 100%; max-width: 520px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.pt-resumen-botones { display: flex; flex-direction: column; gap: 8px; width: 100%; max-width: 420px; }

.pt-solo-movil { display: none !important; }
.pt-barra-movil { display: none; }

@media (max-width: 960px) {
  .pt-header { flex-wrap: wrap; padding: 10px 12px; gap: 10px; }
  .pt-solo-escritorio { display: none !important; }
  .pt-solo-movil { display: flex !important; }
  .pt-chips-movil { display: flex; gap: 6px; width: 100%; }
  .pt-titulo-fila span { display: none; } /* en móvil los contadores van en la fila de colores */
  .pt-header .pt-reloj { font-size: 12px; }
  .pt-chips-movil span { flex: 1; padding: 6px 0; text-align: center; border-radius: 8px; font-size: 12px; font-weight: 700; }
  .pt-cuerpo { flex-direction: column; padding: 12px; padding-bottom: 104px; gap: 12px; }
  .pt-aside { width: 100%; position: static; }
  .pt-pregunta { padding: 18px; gap: 16px; }
  .pt-enunciado { font-size: 18px; }
  .pt-opcion { font-size: 15px; min-height: 52px; padding: 8px 12px; }
  .pt-barra-movil { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; position: fixed; left: 0; right: 0; bottom: 0; z-index: 3; padding: 10px 12px calc(12px + env(safe-area-inset-bottom)); background: var(--surface); border-top: 1px solid var(--border); }
  .pt-barra-movil button { min-height: 56px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); color: var(--ink); font-size: 11px; font-weight: 600; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; cursor: pointer; }
  .pt-barra-movil button.fallos { border-color: var(--bad); background: var(--badSoft); color: var(--badInk); }
  .pt-barra-movil button.fallos strong { font-size: 16px; }
  .pt-barra-movil button.primario { border: 0; background: var(--accent); color: var(--onAccent); }
}

/* ── Elegir qué estudiar (#pantallaElegir) ─────────────────────── */
.pe-seguir { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: 14px; background: var(--accentSoft); color: var(--accentInk); }
.pe-seguir div { flex: 1; min-width: 0; }
.pe-seguir strong { display: block; font-size: 15px; }
.pe-seguir span { font-size: 13px; }
.pe-modos { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.pe-modo { display: flex; flex-direction: column; gap: 6px; min-height: 112px; padding: 16px; border-radius: 14px; border: 1.5px solid var(--border); background: var(--surface); color: var(--ink); text-align: left; cursor: pointer; }
.pe-modo:hover { border-color: var(--accent); }
.pe-modo[aria-pressed="true"] { border-color: var(--accent); background: var(--accentSoft); box-shadow: 0 0 0 1px var(--accent) inset; }
.pe-modo strong { font-size: 16px; }
.pe-modo span { font-size: 13px; line-height: 1.5; color: var(--muted); }
.pe-cabecera-temas { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.pe-cabecera-temas h2 { flex: 1; min-width: 180px; }
.pe-cabecera-temas h2 small { font-weight: 500; color: var(--muted); font-size: 14px; }
.pe-buscar { min-height: 40px; width: 240px; max-width: 100%; padding: 0 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--ink); font-size: 14px; }
.pe-mini { min-height: 40px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--ink); font-size: 13px; font-weight: 600; cursor: pointer; }
.pe-mini:hover { border-color: var(--accent); }
.pe-lista { display: flex; flex-direction: column; gap: 10px; }
.pe-bloque { display: flex; flex-direction: column; gap: 2px; border-top: 1px solid var(--border); padding-top: 8px; }
.pe-bloque:first-child { border-top: 0; padding-top: 0; }
.pe-bloque-cabecera { display: flex; align-items: center; gap: 8px; min-height: 44px; }
.pe-plegar { display: inline-flex; align-items: center; gap: 8px; flex: 1; min-height: 44px; padding: 0 8px; border: 0; background: transparent; color: var(--muted); font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; cursor: pointer; text-align: left; border-radius: 8px; }
.pe-plegar:hover { background: var(--surface2); }
.pe-plegar svg { transition: transform .15s ease; }
.pe-plegar[aria-expanded="false"] svg { transform: rotate(-90deg); }
.pe-fila { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 8px 12px; border-radius: 10px; cursor: pointer; }
.pe-fila:hover { background: var(--surface2); }
.pe-fila input, .pe-bloque-cabecera input { width: 18px; height: 18px; accent-color: var(--accent); flex-shrink: 0; }
.pe-fila .pe-nombre { flex: 1; min-width: 0; font-size: 15px; font-weight: 500; }
.pe-chips { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.pe-chip { font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 999px; white-space: nowrap; background: var(--surface2); color: var(--muted); }
.pe-chip.on { background: var(--accentSoft); color: var(--accentInk); }
.pe-chip.rojo { background: var(--badSoft); color: var(--badInk); }
.pe-vacio { padding: 16px; color: var(--muted); font-size: 14px; }
.pe-orden { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 44px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--ink); font-size: 14px; font-weight: 600; cursor: pointer; text-align: left; }
.pe-orden[aria-pressed="true"] { border-color: var(--accent); background: var(--accentSoft); }
.pe-orden small { margin-left: auto; font-weight: 500; color: var(--muted); font-size: 12px; }
.pe-aviso { padding: 12px 14px; border-radius: 12px; background: var(--warnSoft); color: var(--warnInk); font-size: 13px; line-height: 1.5; display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.pe-empezar { width: 100%; min-height: 52px; border: 0; border-radius: 12px; background: var(--accent); color: var(--onAccent); font-size: 16px; font-weight: 700; cursor: pointer; }
.pe-empezar:disabled { background: var(--surface2); color: var(--muted); cursor: not-allowed; }
.pe-barra-movil { display: none; }
.sr-solo { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); border: 0; }
@media (max-width: 960px) {
  .pe-modos { grid-template-columns: minmax(0, 1fr); }
  .pe-modo { min-height: 0; }
  .pe-fila { flex-wrap: wrap; }
  .pe-chips { width: 100%; justify-content: flex-start; padding-left: 30px; }
  .pe-buscar { width: 100%; }
  .pe-barra-movil { display: block; position: fixed; left: 0; right: 0; bottom: 0; z-index: 3; padding: 10px 12px calc(12px + env(safe-area-inset-bottom)); background: var(--surface); border-top: 1px solid var(--border); }
  #pantallaElegir .pt-cuerpo { padding-bottom: 96px; }
}
