/* Aula LAP — la app del alumno. Móvil primero; la paleta es la de la academia (la del ágora). */
:root {
  --papel: #f8f4ec; --superficie: #fffdf9; --superficie-2: #f2ece1;
  --tinta: #221d17; --suave: #6b6153; --linea: #e4dacb;
  --acento: #8c3a26; --acento-fuerte: #6e2c1c; --acento-suave: #f6e7df; --sobre-acento: #fff;
  --exito: #3d6b34; --exito-suave: #e3efdc; --peligro: #a3261b; --peligro-suave: #fbe7e4;
  --burbuja-mia: #f3ddd2; --burbuja-otra: #fffdf9; --visto: #2f6fb0;
  --sombra: 0 1px 2px rgba(60, 40, 20, .08), 0 4px 14px rgba(60, 40, 20, .08);
  --serif: "Noto Serif", Georgia, "Times New Roman", serif;
  --ui: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --barra-alto: env(safe-area-inset-top, 0px);
}
/* un deslizamiento a lo ancho que nadie consume no se convierte en «atrás» del navegador */
html, body { overscroll-behavior-x: none; }
video, audio { touch-action: pan-y pinch-zoom; }   /* el reproductor no pasa los toques a la página */
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--papel); color: var(--tinta); font: 400 16px/1.45 var(--ui); -webkit-tap-highlight-color: transparent; }
body { overscroll-behavior-y: none; }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; }
a { color: var(--acento); }
:focus-visible { outline: 3px solid var(--acento); outline-offset: 2px; }
.app { height: 100%; }
.pantalla { height: 100%; display: flex; flex-direction: column; }

/* ---------------------------------------------------------------- botones */
.boton { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; min-height: 48px; padding: .7rem 1.2rem;
  border-radius: 999px; border: 2px solid transparent; font-weight: 650; font-size: 1rem; text-decoration: none; }
.boton-lleno { background: var(--acento); color: var(--sobre-acento); }
.boton-lleno:active { background: var(--acento-fuerte); }
.boton-borde { background: transparent; border-color: var(--acento); color: var(--acento); }
.boton-claro { background: var(--superficie-2); color: var(--tinta); }
.boton-chico { min-height: 36px; padding: .35rem .9rem; font-size: .9rem; }
.boton[disabled] { opacity: .55; cursor: default; }
.icono-btn { width: 44px; height: 44px; display: grid; place-items: center; border: 0; background: transparent; border-radius: 50%; color: inherit; flex: none; }
.icono-btn svg { width: 24px; height: 24px; fill: currentColor; }
.icono-btn:active { background: rgba(255, 255, 255, .15); }

/* ---------------------------------------------------------------- carga y entrar */
.carga { align-items: center; justify-content: center; gap: 1rem; background: var(--acento-fuerte); color: #fff; }
.carga-logo { width: 96px; height: 96px; border-radius: 24px; animation: latido 1.4s ease-in-out infinite; }
.carga-nombre { font: 600 1.4rem var(--serif); margin: 0; letter-spacing: .02em; }
@keyframes latido { 50% { transform: scale(1.06); } }
.entrar { overflow-y: auto; background: linear-gradient(180deg, var(--acento-fuerte) 0 34%, var(--papel) 34%); }
.entrar-caja { width: min(420px, 100%); margin: 0 auto; padding: calc(28px + var(--barra-alto)) 20px 32px; }
.entrar-logo { display: block; width: 88px; height: 88px; border-radius: 22px; margin: 0 auto .6rem; box-shadow: 0 6px 24px rgba(0, 0, 0, .25); }
.entrar h1 { font: 600 1.9rem var(--serif); text-align: center; color: #fff; margin: 0; }
.entrar-lema { text-align: center; color: #f6e7df; margin: .1rem 0 1.4rem; }
#entrar-form { background: var(--superficie); border-radius: 18px; padding: 22px 18px; box-shadow: var(--sombra); display: flex; flex-direction: column; gap: .35rem; }
#entrar-form label { font-weight: 600; font-size: .92rem; color: var(--suave); margin-top: .5rem; }
#entrar-form input { width: 100%; min-height: 50px; padding: .7rem .9rem; border: 1.5px solid var(--linea); border-radius: 12px; background: #fff; font-size: 1.05rem; color: var(--tinta); }
#entrar-form input:focus { border-color: var(--acento); outline: none; }
.clave { position: relative; }
.clave input { padding-right: 4rem !important; }
.clave-ver { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; background: transparent; color: var(--acento); font-weight: 650; padding: .5rem; }
#entrar-form .boton { margin-top: .9rem; width: 100%; }
.aviso { margin: .6rem 0 0; padding: .65rem .8rem; border-radius: 10px; background: var(--peligro-suave); color: var(--peligro); font-size: .95rem; }
.instalar { width: 100%; margin-top: 1rem; }
.aviso.aviso-pago { background: var(--superficie-2); color: var(--tinta); }
.boton-whatsapp { background: #0f7a43; color: #fff; text-decoration: none; }
.boton-whatsapp:active { background: #0b5e33; }
/* sesión de la web sin pago: solo el aviso y el botón, sin el formulario de la clave */
#entrar-form.solo-aviso > :not(#entrar-aviso):not(#entrar-whatsapp):not(#entrar-otra) { display: none !important; }
.entrar-pie { text-align: center; color: var(--suave); font-size: .88rem; margin-top: 1.2rem; }

/* ---------------------------------------------------------------- barra (cabecera fija) */
.barra { flex: none; background: var(--acento-fuerte); color: #fff; padding-top: var(--barra-alto); box-shadow: 0 2px 8px rgba(0, 0, 0, .18); z-index: 5; }
.barra-fila { display: flex; align-items: center; gap: .6rem; padding: .5rem .5rem .35rem .8rem; min-height: 56px; }
.barra-logo { width: 38px; height: 38px; border-radius: 10px; flex: none; box-shadow: 0 0 0 1.5px rgba(255, 255, 255, .35); }
.barra-texto { flex: 1; min-width: 0; }
.barra-titulo { font: 650 1.08rem/1.2 var(--ui); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.barra-sub { font-size: .86rem; opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.progreso { position: relative; height: 6px; margin: 0 .8rem; background: rgba(255, 255, 255, .22); border-radius: 99px; overflow: hidden; }
.progreso-relleno { height: 100%; width: 0; background: #ffd9c8; border-radius: 99px; transition: width .6s ease; }
.progreso.listo .progreso-relleno { background: #b9e3a8; }
.progreso-texto { font-size: .78rem; opacity: .9; padding: .25rem .8rem 0; min-height: 1.2em; }
.pestanas { position: relative; display: flex; margin-top: .2rem; }
.pestana { flex: 1; border: 0; background: transparent; color: rgba(255, 255, 255, .72); font-weight: 700; font-size: .92rem; letter-spacing: .06em;
  text-transform: uppercase; padding: .7rem 0 .75rem; display: inline-flex; align-items: center; justify-content: center; gap: .4rem; }
.pestana[aria-selected="true"] { color: #fff; }
.pestanas-raya { position: absolute; left: 0; bottom: 0; height: 3px; width: 33.333%; background: #fff; border-radius: 3px 3px 0 0; transition: transform .25s ease; }
.insignia { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px; background: #fff; color: var(--acento-fuerte); font-size: .74rem; font-weight: 800; display: inline-grid; place-items: center; letter-spacing: 0; }

/* ---------------------------------------------------------------- carril de paneles (deslizar) */
/* sin scroll del usuario a lo ancho: el panel lo cambia app.js (pestaña o gesto con su regla),
   nunca un scroll encadenado desde dentro, el foco ni el teclado del móvil */
.carril { flex: 1; min-height: 0; display: flex; overflow-x: hidden; overflow-y: hidden;
  scrollbar-width: none; overscroll-behavior-x: contain; }
.carril::-webkit-scrollbar { display: none; }
.panel { flex: 0 0 100%; width: 100%; height: 100%; overflow-y: auto; position: relative; display: flex; flex-direction: column; }
.panel-solo { flex: 1; min-height: 0; }

/* ---------------------------------------------------------------- chat */
.chat { flex: 1; min-height: 0; display: flex; flex-direction: column;
  background-color: #efe7da; background-image: radial-gradient(rgba(140, 58, 38, .06) 1px, transparent 1.4px); background-size: 18px 18px; }
.chat-lista { flex: 1; overflow-y: auto; padding: .8rem .7rem 1rem; display: flex; flex-direction: column; gap: .25rem; }
.chat-vacio { margin: auto; max-width: 300px; text-align: center; color: var(--suave); background: rgba(255, 253, 249, .9); border-radius: 14px; padding: 1rem 1.1rem; box-shadow: var(--sombra); }
.chat-vacio strong { color: var(--tinta); display: block; margin-bottom: .3rem; font-family: var(--serif); font-size: 1.05rem; }
.chat-dia { align-self: center; margin: .6rem 0 .3rem; background: rgba(255, 253, 249, .92); color: var(--suave); font-size: .78rem; font-weight: 650; padding: .2rem .7rem; border-radius: 8px; box-shadow: 0 1px 1px rgba(0, 0, 0, .06); }
.burbuja { max-width: 82%; padding: .45rem .6rem .3rem; border-radius: 12px; box-shadow: 0 1px 1px rgba(60, 40, 20, .12); position: relative; word-wrap: break-word; overflow-wrap: anywhere; white-space: pre-wrap; }
.burbuja.otra { align-self: flex-start; background: var(--burbuja-otra); border-top-left-radius: 4px; }
.burbuja.mia { align-self: flex-end; background: var(--burbuja-mia); border-top-right-radius: 4px; }
.burbuja.sigue { margin-top: -1px; }
.burbuja.enviando { opacity: .65; }
.burbuja.fallida { outline: 2px solid var(--peligro); }
.burbuja-foto { display: block; margin: -.2rem -.35rem .3rem; border-radius: 9px; overflow: hidden; background: var(--superficie-2); min-width: 160px; min-height: 120px; }
.burbuja-foto img { display: block; width: 100%; max-height: 340px; object-fit: cover; }
.burbuja-pie { float: right; margin: .35rem 0 0 .6rem; font-size: .7rem; color: var(--suave); display: inline-flex; gap: .25rem; align-items: center; line-height: 1; }
.visto { width: 16px; height: 11px; fill: none; stroke: #8a8174; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.visto.leido { stroke: var(--visto); }
.redactor { flex: none; display: flex; align-items: flex-end; gap: .4rem; padding: .45rem .5rem calc(.5rem + env(safe-area-inset-bottom, 0px)); background: transparent; }
.redactor-caja { flex: 1; display: flex; align-items: flex-end; background: #fff; border-radius: 24px; box-shadow: 0 1px 2px rgba(60, 40, 20, .15); padding: 0 .2rem; min-height: 48px; }
.redactor-caja textarea { flex: 1; border: 0; resize: none; background: transparent; font: 400 1rem/1.35 var(--ui); padding: .8rem .4rem; max-height: 140px; color: var(--tinta); }
.redactor-caja textarea:focus { outline: none; }
.redactor .icono-btn { color: var(--suave); width: 42px; height: 46px; }
.redactor .icono-btn svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.enviar { width: 48px; height: 48px; border-radius: 50%; border: 0; background: var(--acento); color: #fff; display: grid; place-items: center; flex: none; box-shadow: 0 1px 3px rgba(0, 0, 0, .2); }
.enviar svg { width: 22px; height: 22px; fill: currentColor; }
.enviar:disabled { background: #b8a99b; }
.previa { display: flex; align-items: center; gap: .6rem; margin: 0 .6rem .2rem; padding: .4rem; background: #fff; border-radius: 12px; box-shadow: var(--sombra); }
.previa img { width: 56px; height: 56px; object-fit: cover; border-radius: 8px; }
.previa span { flex: 1; font-size: .9rem; color: var(--suave); }

/* ---------------------------------------------------------------- aula */
.aula-sub { flex: none; display: flex; gap: .45rem; overflow-x: auto; padding: .6rem .7rem; background: var(--superficie); border-bottom: 1px solid var(--linea); scrollbar-width: none; }
.aula-sub::-webkit-scrollbar { display: none; }
.ficha { flex: none; display: inline-flex; align-items: center; gap: .35rem; border: 1.5px solid var(--linea); background: #fff; border-radius: 99px; padding: .35rem .75rem; font-size: .88rem; font-weight: 600; color: var(--suave); white-space: nowrap; }
.ficha.actual { border-color: var(--acento); color: var(--acento); }
.ficha[aria-pressed="true"] { background: var(--acento); color: #fff; border-color: var(--acento); }
.ficha .marca { font-size: .8rem; }
.motor-caja { flex: 1; min-height: 0; position: relative; display: flex; flex-direction: column; }
.motor { flex: 1; width: 100%; border: 0; background: var(--papel); }
.motor-aviso { margin: auto; padding: 1.5rem; text-align: center; color: var(--suave); }
.lectura-aviso { flex: none; margin: 0; padding: .45rem .8rem; background: var(--acento-suave); color: var(--acento-fuerte); font-size: .86rem; }

/* ---------------------------------------------------------------- examen */
.examen-portada { padding: 1rem .9rem 2rem; }
.tarjeta { background: var(--superficie); border-radius: 18px; box-shadow: var(--sombra); padding: 1.2rem 1.1rem; margin-bottom: .9rem; }
.tarjeta h2 { font: 600 1.25rem/1.3 var(--serif); margin: .2rem 0 .5rem; }
.tarjeta .eti { font-size: .78rem; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; color: var(--acento); }
.tarjeta p { margin: .4rem 0; color: var(--suave); }
.reglas { list-style: none; padding: 0; margin: .8rem 0 1rem; display: grid; gap: .5rem; }
.reglas li { display: flex; gap: .6rem; align-items: flex-start; }
.reglas b { color: var(--tinta); }
.reglas .num { flex: none; width: 28px; height: 28px; border-radius: 50%; background: var(--acento-suave); color: var(--acento-fuerte); display: grid; place-items: center; font-weight: 800; font-size: .85rem; }
.tarjeta .boton { width: 100%; }
.intentos { list-style: none; margin: .4rem 0 0; padding: 0; }
.intentos li { display: flex; justify-content: space-between; padding: .45rem 0; border-top: 1px solid var(--linea); font-size: .92rem; }
.intentos .ok { color: var(--exito); font-weight: 700; }
.intentos .ko { color: var(--peligro); font-weight: 700; }
.examen-curso { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.examen-marcador { flex: none; display: flex; align-items: center; gap: .6rem; padding: .55rem .8rem; background: var(--superficie); border-bottom: 1px solid var(--linea); }
.examen-cuenta { font-weight: 700; font-size: .95rem; white-space: nowrap; }
/* los círculos caben siempre en UNA fila: encogen antes que partirse en dos */
.examen-puntos { flex: 1; min-width: 0; display: flex; align-items: center; gap: 3px; flex-wrap: nowrap; }
.examen-puntos i { flex: 0 1 12px; min-width: 7px; aspect-ratio: 1; border-radius: 50%; background: var(--linea); }
.examen-puntos i.bien { background: var(--exito); }
.examen-puntos i.mal { background: var(--peligro); }
.examen-puntos i.ahora { box-shadow: 0 0 0 2px var(--acento); background: #fff; }
.examen-ayuda { flex: none; margin: 0; padding: .45rem .8rem; font-size: .88rem; font-weight: 600; text-align: center; color: var(--acento-fuerte); background: var(--acento-suave); }
/* el corte por fallos: el aviso se pone en rojo y el marcador se vacía círculo a círculo
   (el retraso de cada uno lo pone app.js) antes de que arranque el examen nuevo */
.examen-ayuda.corte { color: #fff; background: var(--peligro); animation: aviso-corte .45s ease-out both; }
@keyframes aviso-corte { 0% { transform: scale(.97); opacity: .4; } 60% { transform: scale(1.02); opacity: 1; } 100% { transform: none; } }
.examen-puntos i { transition: transform .3s ease-in, opacity .3s ease-in; }
.examen-puntos.borrando i { transform: scale(0); opacity: 0; }
@media (prefers-reduced-motion: reduce) { .examen-ayuda.corte, .examen-puntos i { animation: none; transition: none; } }

/* ---------------------------------------------------------------- profesor */
.lista-alumnos { flex: 1; overflow-y: auto; background: var(--superficie); }
.alumno-fila { width: 100%; display: flex; align-items: center; gap: .75rem; padding: .75rem .9rem; border: 0; border-bottom: 1px solid var(--linea); background: transparent; text-align: left; }
.alumno-fila:active { background: var(--superficie-2); }
.avatar { flex: none; width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; font-weight: 750; color: #fff; background: var(--acento); letter-spacing: .02em; }
.barra .avatar { width: 38px; height: 38px; font-size: .9rem; box-shadow: 0 0 0 1.5px rgba(255, 255, 255, .4); }
.alumno-centro { flex: 1; min-width: 0; }
.alumno-nombre { font-weight: 650; display: flex; justify-content: space-between; gap: .5rem; }
.alumno-nombre time { font-weight: 400; font-size: .78rem; color: var(--suave); flex: none; }
.alumno-nombre time.nuevo { color: var(--acento); font-weight: 700; }
.alumno-nivel { font-size: .84rem; color: var(--acento-fuerte); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.alumno-ultimo { font-size: .88rem; color: var(--suave); display: flex; justify-content: space-between; gap: .5rem; }
.alumno-ultimo span:first-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.alumno-ultimo .insignia { background: var(--acento); color: #fff; flex: none; }
.lista-vacia { padding: 2rem 1.2rem; text-align: center; color: var(--suave); }

/* ---------------------------------------------------------------- profesor: portada tipo WhatsApp */
.profesor .lista-alumnos { background: var(--superficie); }
.p-pestanas .pestanas-raya { width: 50%; }
.buscador { flex: none; display: flex; align-items: center; gap: .5rem; margin: .55rem .7rem .35rem; padding: 0 .8rem; min-height: 42px;
  background: var(--superficie-2); border-radius: 21px; color: var(--suave); }
.buscador svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; flex: none; }
.buscador input { flex: 1; min-width: 0; border: 0; background: transparent; font: inherit; color: var(--tinta); padding: .55rem 0; }
.buscador input:focus { outline: none; }
.avatar { position: relative; overflow: hidden; }
.avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.avatar-caja { display: inline-flex; flex: none; }
.alumno-fila { min-height: 72px; }
.alumno-centro, .alumno-nombre, .alumno-ultimo { display: flex; }
.alumno-centro { flex-direction: column; gap: .15rem; }
.alumno-nombre-txt { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.alumno-ultimo { align-items: center; gap: .45rem; }
.alumno-prev { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.alumno-obj { flex: none; font-size: .74rem; font-weight: 700; color: var(--acento-fuerte); background: var(--acento-suave); border-radius: 99px; padding: .08rem .45rem; }
.alumno-nombre time.nuevo { color: #1f9e57; }
.globo { flex: none; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 99px; background: #1f9e57; color: #fff; font-size: .76rem; font-weight: 800;
  display: inline-grid; place-items: center; }
.con-nuevos .alumno-prev { color: var(--tinta); font-weight: 600; }
.bandeja-fila.nuevo .alumno-prev { color: var(--tinta); font-weight: 650; }
.bandeja-fila.es-examen.aprobado .alumno-prev { color: var(--exito); }
.bandeja-fila.es-examen.suspendido .alumno-prev { color: var(--peligro); }
.punto-nuevo { flex: none; width: 10px; height: 10px; border-radius: 50%; background: #1f9e57; }
.avisos-tarjeta { flex: none; display: flex; flex-wrap: wrap; align-items: center; gap: .3rem .6rem; margin: .55rem .7rem 0; padding: .65rem .8rem;
  background: var(--acento-suave); color: var(--acento-fuerte); border-radius: 14px; }
.avisos-tarjeta p { flex: 1; min-width: 180px; margin: 0; font-size: .9rem; }
.avisos-icono { font-size: 1.3rem; }
.avisos-botones { display: flex; gap: .5rem; margin-left: auto; }
.panel-chat > .avisos-tarjeta { margin-bottom: .2rem; }

/* ---------------------------------------------------------------- hilo: tocar el nombre abre la ficha */
.barra-quien { flex: 1; min-width: 0; display: flex; align-items: center; gap: .6rem; border: 0; background: transparent; color: inherit; text-align: left; padding: .2rem; border-radius: 10px; }
.barra-quien:active { background: rgba(255, 255, 255, .12); }
.barra-quien .barra-texto { display: flex; flex-direction: column; }

/* ---------------------------------------------------------------- ficha del alumno */
.ficha-alumno .ficha-cuerpo { flex: 1; overflow-y: auto; padding: .8rem .7rem 2rem; background: var(--papel); }
.ficha-sec h2 { font: 650 1.05rem/1.3 var(--serif); margin: 0 0 .5rem; }
.ficha-sec h3 { font-size: .9rem; margin: .8rem 0 .2rem; color: var(--suave); }
.ficha-sec.privada { border: 1.5px dashed var(--acento); }
.ficha-grande { color: var(--tinta) !important; font-weight: 650; font-size: 1.05rem; }
.ficha-suave { color: var(--suave); font-size: .86rem; }
.ficha-barra { height: 8px; background: var(--superficie-2); border-radius: 99px; overflow: hidden; margin: .4rem 0; }
.ficha-barra i { display: block; height: 100%; background: var(--exito); border-radius: 99px; }
.ficha-botones { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .6rem; }
.ficha-botones .boton { width: auto !important; flex: 1 1 auto; }
.ficha-lista { list-style: none; margin: .3rem 0 0; padding: 0; }
.ficha-lista li { display: flex; justify-content: space-between; gap: .6rem; padding: .45rem 0; border-top: 1px solid var(--linea); font-size: .92rem; }
.ficha-lista li > span:last-child { text-align: right; flex: none; max-width: 55%; }
.ficha-lista .ok { color: var(--exito); font-weight: 700; }
.ficha-lista .ko { color: var(--peligro); font-weight: 700; }
.ficha-et { display: block; font-size: .86rem; font-weight: 600; color: var(--suave); margin: .2rem 0 .3rem; }
.ficha-sec select, .ficha-sec textarea, .dialogo textarea { width: 100%; font: inherit; color: var(--tinta); background: #fff; border: 1.5px solid var(--linea);
  border-radius: 12px; padding: .6rem .7rem; margin-top: .35rem; }
.ficha-sec select:focus, .ficha-sec textarea:focus, .dialogo textarea:focus { outline: none; border-color: var(--acento); }
.dialogo textarea { margin: 0 0 1rem; resize: vertical; }
.ficha-notas { list-style: none; margin: .6rem 0 0; padding: 0; }
.ficha-notas li { padding: .5rem 0; border-top: 1px solid var(--linea); }
.ficha-notas p { margin: 0 0 .15rem; color: var(--tinta); white-space: pre-wrap; }
.enlace-btn { border: 0; background: transparent; color: var(--peligro); font-size: .84rem; font-weight: 650; padding: .2rem .4rem; margin-left: .4rem; }

/* ---------------------------------------------------------------- reacciones (como en WhatsApp) */
.burbuja.reaccionable { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.burbuja.reaccionable img { -webkit-touch-callout: none; -webkit-user-drag: none; }
.burbuja.con-reac { margin-bottom: 1rem; }
.burbuja.reaccionando { box-shadow: 0 0 0 3px rgba(140, 58, 38, .35); }
.reac { position: absolute; bottom: -.95rem; display: inline-flex; gap: 1px; background: var(--superficie); border-radius: 99px; padding: .05rem .3rem;
  box-shadow: 0 1px 3px rgba(60, 40, 20, .25); font-size: .92rem; line-height: 1.35; white-space: nowrap; }
.burbuja.otra .reac { left: .5rem; }
.burbuja.mia .reac { right: .5rem; }
.reac .mia { filter: none; }
.reac-barra { position: fixed; z-index: 48; display: flex; gap: .15rem; background: var(--superficie); border-radius: 99px; padding: .3rem .4rem;
  box-shadow: 0 6px 24px rgba(0, 0, 0, .28); animation: sube-barra .14s ease-out both; }
.reac-barra button { width: 42px; height: 42px; border: 0; border-radius: 50%; background: transparent; font-size: 1.45rem; line-height: 1; display: grid; place-items: center; }
.reac-barra button:active { transform: scale(1.2); }
.reac-barra button.elegida { background: var(--acento-suave); }
@keyframes sube-barra { from { transform: translateY(6px) scale(.92); opacity: 0; } }

/* ---------------------------------------------------------------- material: tarjeta de teoría en el chat */
.teoria-tarjeta { display: flex; align-items: center; gap: .6rem; width: 100%; margin: 0 0 .35rem; padding: .55rem .6rem; border: 1px solid var(--linea);
  border-radius: 10px; background: var(--superficie-2); color: var(--tinta); text-align: left; font: inherit; white-space: normal; }
.teoria-icono { font-size: 1.5rem; flex: none; }
.teoria-texto { flex: 1; min-width: 0; display: flex; flex-direction: column; font-size: .9rem; }
.teoria-texto strong { color: var(--acento-fuerte); }
.teoria-abrir { flex: none; font-weight: 700; color: var(--acento); font-size: .88rem; }

/* ---------------------------------------------------------------- menú, visor, diálogo, fiesta, tostada */
.menu { position: fixed; top: calc(8px + var(--barra-alto)); right: 8px; min-width: 220px; background: var(--superficie); border-radius: 12px; box-shadow: 0 8px 30px rgba(0, 0, 0, .25); padding: .35rem 0; z-index: 30; }
.menu button { display: block; width: 100%; text-align: left; border: 0; background: transparent; padding: .8rem 1.1rem; font-size: 1rem; }
.menu button:active { background: var(--superficie-2); }
.visor { position: fixed; inset: 0; background: rgba(10, 8, 6, .94); z-index: 40; display: grid; place-items: center; }
.visor img { max-width: 100%; max-height: 100%; object-fit: contain; }
.visor-cerrar { position: absolute; top: calc(8px + var(--barra-alto)); right: 10px; width: 48px; height: 48px; border: 0; border-radius: 50%; background: rgba(255, 255, 255, .15); color: #fff; font-size: 2rem; line-height: 1; }
.dialogo-fondo { position: fixed; inset: 0; background: rgba(20, 14, 10, .5); z-index: 35; display: grid; place-items: center; padding: 1rem; }
.dialogo { background: var(--superficie); border-radius: 18px; padding: 1.3rem 1.2rem 1rem; width: min(380px, 100%); box-shadow: 0 10px 40px rgba(0, 0, 0, .3); }
.dialogo h2 { font: 600 1.2rem var(--serif); margin: 0 0 .5rem; }
.dialogo p { color: var(--suave); margin: 0 0 1rem; }
.dialogo-botones { display: flex; gap: .6rem; justify-content: flex-end; }
.fiesta { position: fixed; inset: 0; z-index: 45; display: grid; place-items: center; padding: 1.2rem; background: radial-gradient(circle at 50% 40%, rgba(140, 58, 38, .92), rgba(60, 22, 14, .96)); overflow: hidden; }
.fiesta.suspenso { background: rgba(34, 29, 23, .9); }
.fiesta-caja { position: relative; text-align: center; color: #fff; max-width: 360px; animation: sube .5s cubic-bezier(.2, 1.4, .4, 1) both; }
.fiesta-phi { font: 400 6rem/1 var(--serif); margin-bottom: .2rem; text-shadow: 0 6px 30px rgba(0, 0, 0, .35); animation: gira 1.2s ease-out both; }
.fiesta h2 { font: 650 2rem/1.15 var(--serif); margin: .2rem 0 .6rem; }
.fiesta p { font-size: 1.05rem; opacity: .95; margin: 0 0 1.4rem; }
.fiesta .boton-lleno { background: #fff; color: var(--acento-fuerte); min-width: 200px; }
.fiesta-confeti i { position: absolute; top: -12px; width: 9px; height: 14px; border-radius: 2px; opacity: .9; animation: cae linear forwards; }
@keyframes sube { from { transform: translateY(30px) scale(.9); opacity: 0; } }
@keyframes gira { from { transform: rotateY(180deg) scale(.4); opacity: 0; } }
@keyframes cae { to { transform: translateY(110vh) rotate(720deg); } }
.tostada { position: fixed; left: 50%; bottom: calc(84px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); background: #2b2520; color: #fff; padding: .65rem 1rem; border-radius: 10px; z-index: 50; font-size: .92rem; max-width: 90vw; box-shadow: 0 6px 20px rgba(0, 0, 0, .3); }

@media (min-width: 760px) {
  .app { max-width: 760px; margin: 0 auto; box-shadow: 0 0 40px rgba(60, 40, 20, .12); }
}
/* ---------------------------------------------------------------- notas de voz */
.chat-mensajes, .chat-cola { display: flex; flex-direction: column; gap: .25rem; }
.chat-mensajes { flex: 1 0 auto; }
.redactor { position: relative; }
.micro { width: 48px; height: 48px; border-radius: 50%; border: 0; background: var(--acento); color: #fff; display: none; place-items: center; flex: none;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .2); touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.micro svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.redactor:not(.escribiendo):not(.sin-voz) .enviar:not(.grab-enviar) { display: none; }
.redactor:not(.escribiendo):not(.sin-voz) .micro { display: grid; }
.redactor.grabando .redactor-caja { display: none; }
.redactor.grabando .micro { display: grid; transform: scale(1.35); background: var(--peligro); transition: transform .12s; }
.redactor.grabando .enviar:not(.grab-enviar) { display: none; }
.grabacion { flex: 1; display: flex; align-items: center; gap: .5rem; min-height: 48px; padding: 0 .4rem 0 .9rem; background: #fff; border-radius: 24px;
  box-shadow: 0 1px 2px rgba(60, 40, 20, .15); overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none; }
.grab-punto { width: 10px; height: 10px; border-radius: 50%; background: var(--peligro); flex: none; animation: grab-late 1s infinite; }
@keyframes grab-late { 50% { opacity: .25; } }
.grab-tiempo { font-variant-numeric: tabular-nums; font-weight: 650; min-width: 3.2em; color: var(--tinta); flex: none; }
.grab-onda { flex: 1; height: 28px; display: flex; align-items: center; gap: 2px; min-width: 40px; }
.grab-onda i { flex: 1; max-width: 4px; height: 12%; border-radius: 2px; background: var(--acento); }
.grab-pista { color: var(--suave); font-size: .86rem; white-space: nowrap; flex: none; transition: opacity .1s; }
.grab-papelera, .grab-enviar { display: none !important; }
.grabacion.bloqueada .grab-papelera { display: grid !important; color: var(--peligro); }
.grabacion.bloqueada .grab-enviar { display: grid !important; }
.grabacion.bloqueada .grab-pista { display: none; }
.redactor.grabando.bloqueada .micro { display: none; }
.grab-candado { position: absolute; right: .5rem; bottom: calc(100% + 6px); width: 48px; padding: .5rem 0 .3rem; border-radius: 24px; background: #fff;
  box-shadow: var(--sombra); display: flex; flex-direction: column; align-items: center; color: var(--suave); pointer-events: none; }
.grab-candado svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.grab-flecha { font-size: .9rem; line-height: 1; animation: grab-sube 1.2s infinite; }
@keyframes grab-sube { 50% { transform: translateY(-4px); } }
.voz { display: flex; align-items: center; gap: .45rem; min-width: 230px; max-width: 100%; padding: .15rem 0; white-space: normal; }
.voz-play { width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--acento); color: #fff; display: grid; place-items: center; flex: none; }
.voz-play svg { width: 20px; height: 20px; fill: currentColor; }
.voz-barra { flex: 1; min-width: 80px; height: 28px; margin: 0; background: transparent; -webkit-appearance: none; appearance: none; touch-action: none; --p: 0%; }
.voz-barra::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; background: linear-gradient(90deg, var(--acento) var(--p), var(--linea) var(--p)); }
.voz-barra::-moz-range-track { height: 4px; border-radius: 2px; background: var(--linea); }
.voz-barra::-moz-range-progress { height: 4px; border-radius: 2px; background: var(--acento); }
.voz-barra::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; margin-top: -6px; border-radius: 50%; background: var(--acento); border: 0; }
.voz-barra::-moz-range-thumb { width: 16px; height: 16px; border-radius: 50%; background: var(--acento); border: 0; }
.voz-tiempo { font-size: .78rem; color: var(--suave); font-variant-numeric: tabular-nums; min-width: 2.6em; text-align: right; }
.voz-vel { border: 0; border-radius: 99px; background: var(--superficie-2); color: var(--tinta); font-size: .76rem; font-weight: 750; min-width: 42px; height: 30px; padding: 0 .45rem; }
.voz.voz-error .voz-play { background: #b8a99b; }
.burbuja.con-voz { min-width: 250px; }
.burbuja-borrado { color: var(--suave); font-size: .9rem; }
.nota-local { opacity: .92; }
.nota-local[data-estado="pendiente"], .nota-local[data-estado="pendiente-subiendo"] { outline: 1.5px dashed var(--suave); }
.nota-local.rechazada { outline: 2px solid var(--peligro); }
.nota-estado { display: block; font-size: .78rem; color: var(--suave); margin-top: .15rem; }
.nota-local.rechazada .nota-estado { color: var(--peligro); }
.nota-acciones { display: flex; justify-content: flex-end; gap: .2rem; }
.nota-acciones .enlace-btn { color: var(--acento); }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* ---------------------------------------------------------------- visor: «Corregir» y la cita de una corrección */
.visor-pie { position: absolute; left: 0; right: 0; bottom: 0; display: flex; justify-content: center; padding: .8rem 1rem calc(1rem + env(safe-area-inset-bottom, 0px)); pointer-events: none; }
.visor-corregir { pointer-events: auto; min-width: 180px; box-shadow: 0 6px 20px rgba(0, 0, 0, .35); }
.burbuja-cita { display: flex; align-items: center; gap: .35rem; width: 100%; margin: -.1rem 0 .35rem; padding: .35rem .5rem; border: 0; border-left: 3px solid var(--acento);
  border-radius: 6px; background: rgba(140, 58, 38, .08); color: var(--acento-fuerte); font-size: .85rem; font-weight: 600; text-align: left; white-space: normal; }
.burbuja-cita em { font-weight: 400; color: var(--suave); }
.burbuja-borrador { display: block; margin: .3rem 0 .1rem; padding: .3rem .55rem; border: 1px dashed var(--acento); border-radius: 8px; background: var(--acento-suave);
  color: var(--acento-fuerte); font-size: .82rem; font-weight: 600; white-space: normal; }
.burbuja.destello { animation: destello 1.4s ease-out; }
@keyframes destello { 0%, 30% { box-shadow: 0 0 0 4px rgba(140, 58, 38, .55); } 100% { box-shadow: 0 1px 1px rgba(60, 40, 20, .12); } }

/* ---------------------------------------------------------------- PIZARRA: corregir una foto a pantalla completa */
body.con-pizarra { overflow: hidden; }
.pizarra { position: fixed; inset: 0; z-index: 42; display: flex; flex-direction: column; background: #1a1612; color: #fff;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; touch-action: none; --pz-color: #e0241b; }
.pz-arriba { flex: none; display: flex; align-items: center; gap: .15rem; padding: calc(4px + var(--barra-alto)) .35rem 4px; background: #2a231d; }
.pz-titulo { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.15; padding: 0 .25rem; }
.pz-titulo strong { font-size: 1rem; }
.pz-titulo span { font-size: .75rem; opacity: .75; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pz-btn { flex: none; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-width: 44px; height: 46px; padding: 0 .2rem;
  border: 0; border-radius: 10px; background: transparent; color: #fff; touch-action: manipulation; }
.pz-btn svg, .pz-enviar svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.pz-btn span { font-size: .66rem; line-height: 1; opacity: .9; }
.pz-btn[disabled] { opacity: .35; }
.pz-btn[aria-pressed="true"] { background: rgba(255, 255, 255, .92); color: #1a1612; }
.pz-btn.pz-mover[aria-pressed="true"] { background: #ffd54a; color: #1a1612; }
.pz-enviar { flex: none; display: inline-flex; align-items: center; gap: .35rem; height: 40px; margin-left: .2rem; padding: 0 .9rem; border: 0; border-radius: 99px;
  background: #2e8b47; color: #fff; font-weight: 700; touch-action: manipulation; }
.pz-enviar[disabled] { opacity: .45; }
.pz-escenario { position: relative; flex: 1; min-height: 0; overflow: hidden; touch-action: none; }
.pizarra[data-modo="dibujar"] .pz-escenario { box-shadow: inset 0 0 0 3px var(--pz-color); }
.pizarra[data-modo="mover"] .pz-escenario { box-shadow: inset 0 0 0 3px #ffd54a; }
.pz-lienzo { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: crosshair; }
.pizarra[data-modo="mover"] .pz-lienzo { cursor: grab; }
.pz-pista { position: absolute; left: 50%; top: 10px; transform: translateX(-50%); max-width: calc(100% - 20px); padding: .45rem .75rem; border-radius: 10px;
  background: rgba(0, 0, 0, .72); font-size: .84rem; line-height: 1.3; text-align: center; pointer-events: none; opacity: 0; transition: opacity .25s; }
.pz-pista.visible { opacity: 1; }
.pz-cargando { position: absolute; inset: 0; display: grid; place-items: center; font-size: .95rem; opacity: .8; }
.pz-abajo { flex: none; background: #2a231d; padding: 2px .3rem calc(4px + env(safe-area-inset-bottom, 0px)); }
.pz-fila { display: flex; align-items: center; justify-content: center; gap: .1rem; padding: 2px 0; }
.pz-separa { flex: none; width: 1px; height: 28px; margin: 0 .25rem; background: rgba(255, 255, 255, .25); }
.pz-color { flex: none; width: 38px; height: 38px; margin: 0 1px; border-radius: 50%; border: 3px solid transparent; background: var(--c); box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .55); touch-action: manipulation; }
.pz-color[aria-pressed="true"] { border-color: #fff; transform: scale(1.08); }
.pz-grosor { flex: none; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; width: 48px; height: 44px; border: 0; border-radius: 10px;
  background: transparent; color: #fff; font-size: .66rem; touch-action: manipulation; }
.pz-grosor i { display: block; width: 24px; border-radius: 4px; background: var(--pz-color); }
.pz-grosor.fino i { height: 3px; }
.pz-grosor.grueso i { height: 8px; }
.pz-grosor[aria-pressed="true"] { background: rgba(255, 255, 255, .18); outline: 2px solid rgba(255, 255, 255, .8); }
.pz-dialogo-fondo { position: absolute; inset: 0; z-index: 2; display: grid; place-items: center; padding: 1rem; background: rgba(0, 0, 0, .55); }
.pz-dialogo { width: min(380px, 100%); padding: 1.2rem 1.1rem 1rem; border-radius: 16px; background: var(--superficie); color: var(--tinta); box-shadow: 0 10px 40px rgba(0, 0, 0, .4); }
.pz-dialogo h2 { margin: 0 0 .5rem; font: 600 1.15rem var(--serif); }
.pz-dialogo p { margin: 0 0 .8rem; color: var(--suave); }
.pz-dialogo textarea { width: 100%; margin-bottom: .8rem; padding: .6rem; border: 1px solid var(--linea); border-radius: 10px; font: inherit; resize: vertical; -webkit-user-select: text; user-select: text; }
.pz-dialogo-botones { display: flex; justify-content: flex-end; gap: .6rem; }
@media (max-width: 380px) { .pz-btn { min-width: 40px; } .pz-color { width: 34px; height: 34px; } .pz-grosor { width: 42px; } }

/* ---------------------------------------------------------------- VÍDEOS: en la burbuja, el grabador y «preparando» */
.burbuja.con-video { min-width: 240px; }
.vcaja { position: relative; margin: -.2rem -.35rem .3rem; border-radius: 9px; overflow: hidden; background: #111; }
.vcaja-video { display: block; width: 100%; max-height: 380px; background: #111; object-fit: contain; }
.vcaja-pantalla { position: absolute; top: 6px; right: 6px; width: 36px; height: 36px; display: grid; place-items: center; border: 0; border-radius: 50%;
  background: rgba(0, 0, 0, .55); color: #fff; touch-action: manipulation; }
.vcaja-pantalla svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.vcaja-dura { position: absolute; top: 10px; left: 8px; padding: .05rem .4rem; border-radius: 6px; background: rgba(0, 0, 0, .55); color: #fff; font-size: .75rem; pointer-events: none; }
.vcaja-proceso, .vcaja-error { display: flex; align-items: center; gap: .55rem; min-height: 90px; padding: .8rem; color: #f3ede6; font-size: .92rem; }
.vcaja[data-estado="fallido"] { background: #5a1d17; }
.vcaja-rueda { flex: none; width: 22px; height: 22px; border-radius: 50%; border: 3px solid rgba(255, 255, 255, .3); border-top-color: #fff; animation: vgira 1s linear infinite; }
@keyframes vgira { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .vcaja-rueda { animation-duration: 3s; } }
.nota-texto { display: block; margin: .1rem 0 .2rem; white-space: pre-wrap; }
.previa video { width: 56px; height: 56px; object-fit: cover; border-radius: 8px; background: #111; }
body.con-video { overflow: hidden; }
.vgrab { position: fixed; inset: 0; z-index: 43; display: flex; flex-direction: column; background: #000; color: #fff; touch-action: none;
  -webkit-user-select: none; user-select: none; }
.vg-arriba { flex: none; display: flex; align-items: center; gap: .5rem; padding: calc(6px + var(--barra-alto, 0px)) .5rem 6px; }
.vg-tiempo { font: 600 1rem/1 system-ui, sans-serif; font-variant-numeric: tabular-nums; }
.vg-punto { width: 10px; height: 10px; border-radius: 50%; background: transparent; }
.vgrab[data-estado="grabando"] .vg-punto { background: #e0241b; animation: vlate 1s steps(2) infinite; }
@keyframes vlate { 50% { opacity: .2; } }
.vg-escenario { position: relative; flex: 1; min-height: 0; display: grid; place-items: center; }
.vg-vista { width: 100%; height: 100%; object-fit: contain; background: #000; }
.vg-vista.espejo { transform: scaleX(-1); }
.vg-aviso { position: absolute; inset: 0; display: grid; place-items: center; font-size: .95rem; opacity: .85; }
.vg-abajo { flex: none; display: flex; align-items: center; justify-content: space-around; gap: .5rem; padding: 10px .5rem calc(14px + env(safe-area-inset-bottom, 0px)); }
.vg-btn { width: 48px; height: 48px; display: grid; place-items: center; border: 0; border-radius: 50%; background: rgba(255, 255, 255, .14); color: #fff; touch-action: manipulation; }
.vg-btn svg, .vg-accion svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.vg-hueco { width: 48px; }
.vg-disparo { width: 74px; height: 74px; display: grid; place-items: center; border: 4px solid #fff; border-radius: 50%; background: transparent; touch-action: manipulation; }
.vg-disparo i { display: block; width: 54px; height: 54px; border-radius: 50%; background: #e0241b; transition: all .15s; }
.vgrab[data-estado="grabando"] .vg-disparo i { width: 28px; height: 28px; border-radius: 6px; }
.vgrab[data-estado="pidiendo"] .vg-disparo { opacity: .4; }
.vg-accion { display: inline-flex; align-items: center; gap: .4rem; height: 46px; padding: 0 1.1rem; border: 0; border-radius: 99px; background: rgba(255, 255, 255, .16);
  color: #fff; font-weight: 600; touch-action: manipulation; }
.vg-enviar { background: #2e8b47; }
.vprep { position: fixed; inset: 0; z-index: 43; display: grid; place-items: center; padding: 1rem; background: rgba(0, 0, 0, .6); }
.vp-caja { width: min(380px, 100%); display: flex; flex-direction: column; gap: .6rem; padding: 1.2rem 1.1rem 1rem; border-radius: 16px; background: var(--superficie, #fff);
  color: var(--tinta, #222); box-shadow: 0 10px 40px rgba(0, 0, 0, .4); }
.vp-caja p { margin: 0; color: var(--suave, #666); font-size: .9rem; }
.vp-barra { width: 100%; height: 10px; }
.vp-texto { font-variant-numeric: tabular-nums; font-size: .9rem; }
.vp-fuente { position: fixed; left: 0; top: 0; width: 2px; height: 2px; opacity: 0; pointer-events: none; }

/* ---------------------------------------------------------------- citas de la teoría: en el redactor, en la burbuja y el visor del profesor */
.cita-previa { display: flex; align-items: flex-start; gap: .4rem; margin: 0 .6rem .25rem; padding: .35rem .35rem .35rem 0; background: var(--superficie); border-radius: 12px; box-shadow: var(--sombra); }
.cita-previa .cita-teoria { flex: 1; margin: 0; }
.cita-quitar { flex: none; font-size: 1.4rem; line-height: 1; }
.cita-teoria { display: flex; align-items: flex-start; gap: .45rem; width: 100%; margin: -.1rem 0 .4rem; padding: .4rem .55rem; border: 0; border-left: 3px solid var(--acento);
  border-radius: 6px; background: rgba(140, 58, 38, .08); color: var(--tinta); font: inherit; font-size: .86rem; text-align: left; white-space: normal; }
button.cita-teoria { cursor: pointer; }
button.cita-teoria:active { background: rgba(140, 58, 38, .16); }
.cita-icono { flex: none; line-height: 1.35; }
.cita-cuerpo { display: flex; flex-direction: column; min-width: 0; }
.cita-cuerpo strong { color: var(--acento-fuerte); font-size: .8rem; font-weight: 700; }
.cita-texto { overflow-wrap: anywhere; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 4; line-clamp: 4; overflow: hidden; }
.cita-previa .cita-texto { -webkit-line-clamp: 2; line-clamp: 2; }
.teoria-visor { position: fixed; inset: 0; z-index: 30; background: var(--papel); }
