/* Eco · sistema visual v2. Papel y tinta, un solo acento, tipografía firme.
   Todo sale de estas variables: cambiar la identidad es cambiar este bloque. */
@font-face {
  font-family: 'Sora';
  src: url('./fuentes/sora.woff2') format('woff2');
  font-weight: 300 800;
  font-display: swap;
}

:root {
  --papel: #f6f5f1;
  --papel-2: #ecebe5;
  --hoja: #ffffff;
  --tinta: #111113;
  --tinta-2: #3a3a40;
  --gris: #64636b;
  --linea: #dedcd5;
  --acento: #2b4cff;
  --acento-suave: #e6eaff;
  --sobre-acento: #ffffff;
  --exito: #087747;
  --exito-suave: #dcf3e8;
  --alerta: #925400;
  --alerta-suave: #fbeed8;
  --error: #bf2941;
  --error-suave: #fbe3e6;
  --radio: 18px;
  --radio-chico: 12px;
  --sombra: 0 1px 0 rgba(17, 17, 19, 0.04), 0 8px 24px -12px rgba(17, 17, 19, 0.18);
  --fuente: 'Sora', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --rapida: cubic-bezier(0.2, 0.8, 0.2, 1);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --papel: #0e0e10;
    --papel-2: #18181b;
    --hoja: #161618;
    --tinta: #f4f3ee;
    --tinta-2: #cfcec8;
    --gris: #8d8c93;
    --linea: #2a2a2e;
    --acento: #405ee8;
    --acento-suave: #1b2140;
    --exito: #2ed38c;
    --exito-suave: #0f2a1f;
    --alerta: #f0a63a;
    --alerta-suave: #2d2210;
    --error: #ff5d70;
    --error-suave: #2e1418;
    --sombra: 0 1px 0 rgba(255, 255, 255, 0.03), 0 10px 30px -14px rgba(0, 0, 0, 0.7);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--fuente);
  background: var(--papel);
  color: var(--tinta);
  font-size: 16px;
  line-height: 1.45;
  letter-spacing: -0.012em;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
button, input, select { font: inherit; color: inherit; }
button { border: 0; background: none; cursor: pointer; padding: 0; }
a { color: inherit; text-decoration: none; }
svg { display: block; }
.oculto { display: none !important; }
:focus-visible { outline: 2px solid var(--acento); outline-offset: 3px; border-radius: 6px; }

/* ---------- Estructura ---------- */
.app { min-height: 100dvh; display: flex; flex-direction: column; padding-bottom: calc(88px + env(safe-area-inset-bottom)); }
.app.sin-nav { padding-bottom: env(safe-area-inset-bottom); }
.contenido { width: 100%; max-width: 640px; margin: 0 auto; padding: 8px 20px 28px; flex: 1; }
.encabezado { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: calc(14px + env(safe-area-inset-top)) 20px 10px; max-width: 640px; width: 100%; margin: 0 auto; }
.marca { display: inline-flex; align-items: center; gap: 9px; font-weight: 800; font-size: 21px; letter-spacing: -0.05em; }
.marca svg { width: 28px; height: 28px; color: var(--acento); }
.volver { display: inline-flex; align-items: center; gap: 6px; color: var(--gris); font-weight: 600; font-size: 15px; height: 40px; }
.volver svg { width: 18px; height: 18px; transform: rotate(180deg); }

h1, .titulo { font-size: clamp(30px, 8vw, 40px); font-weight: 750; letter-spacing: -0.055em; line-height: 1.02; margin: 10px 0 6px; }
.subtitulo { color: var(--gris); margin: 0 0 22px; font-size: 16px; }
.seccion { font-size: 13px; font-weight: 700; letter-spacing: 0.02em; color: var(--gris); margin: 28px 2px 10px; display: flex; justify-content: space-between; align-items: baseline; }
.seccion a, .seccion button { color: var(--acento); font-weight: 650; font-size: 14px; }

/* ---------- Superficies ---------- */
.bloque { background: var(--hoja); border: 1px solid var(--linea); border-radius: var(--radio); padding: 18px; box-shadow: none; }
.bloque + .bloque { margin-top: 12px; }
.bloque-acento { background: var(--acento); color: var(--sobre-acento); border-color: transparent; }
.bloque-acento .gris { color: color-mix(in srgb, var(--sobre-acento) 75%, transparent); }
.gris { color: var(--gris); }
.cifras { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 10px; }
.cifra { background: var(--hoja); border: 1px solid var(--linea); border-radius: var(--radio); padding: 16px; }
.cifra b { display: block; font-size: clamp(24px, 7vw, 30px); font-weight: 750; letter-spacing: -0.05em; line-height: 1.1; }
.cifra span { font-size: 13px; color: var(--gris); font-weight: 600; }

/* ---------- Botones ---------- */
.boton { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 54px; padding: 0 22px; border-radius: 14px; font-weight: 650; font-size: 16px; background: var(--hoja); border: 1px solid var(--linea); transition: transform 0.15s var(--rapida), background 0.2s, opacity 0.2s; }
.boton:active { transform: scale(0.98); }
.boton:disabled { opacity: 0.5; }
.boton-primario { background: var(--tinta); color: var(--papel); border-color: transparent; }
.boton-acento { background: var(--acento); color: var(--sobre-acento); border-color: transparent; }
.boton-ancho { width: 100%; }
.boton-chico { min-height: 40px; padding: 0 14px; font-size: 14px; border-radius: 11px; }
.boton svg { width: 20px; height: 20px; }

/* ---------- Formularios ---------- */
.campo { display: grid; gap: 7px; margin-bottom: 14px; }
.campo > span { font-size: 14px; font-weight: 650; color: var(--tinta-2); }
.entrada { position: relative; }
.entrada input, .entrada select, .campo > input, .campo > select {
  width: 100%; height: 56px; padding: 0 16px; border-radius: 14px; border: 1px solid var(--linea);
  background: var(--hoja); font-size: 17px; transition: border-color 0.2s, box-shadow 0.2s;
}
.entrada input:focus, .campo > input:focus, .campo > select:focus { outline: none; border-color: var(--acento); box-shadow: 0 0 0 4px var(--acento-suave); }
.entrada .ojo { position: absolute; right: 6px; top: 6px; height: 44px; width: 44px; display: grid; place-items: center; color: var(--gris); border-radius: 10px; }
.entrada .ojo svg { width: 20px; height: 20px; }
.error-formulario { color: var(--error); font-weight: 600; font-size: 14px; margin: -2px 2px 12px; min-height: 20px; }
.sacude { animation: sacudir 0.4s; }
@keyframes sacudir { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
input[type="range"] { width: 100%; accent-color: var(--acento); }
.buscar { height: 48px !important; font-size: 16px !important; }

/* ---------- Etiquetas, avatares, barras ---------- */
.etiqueta { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border-radius: 8px; font-size: 13px; font-weight: 650; background: var(--papel-2); color: var(--tinta-2); white-space: nowrap; }
.etiqueta svg { width: 14px; height: 14px; }
.etiqueta.ok { background: var(--exito-suave); color: var(--exito); }
.etiqueta.alerta { background: var(--alerta-suave); color: var(--alerta); }
.etiqueta.error { background: var(--error-suave); color: var(--error); }
.etiqueta.acento { background: var(--acento-suave); color: var(--acento); }
.etiqueta.vivo::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; animation: latido 1.4s ease-in-out infinite; }
@keyframes latido { 50% { opacity: 0.3; } }

.avatar { --lado: 42px; width: var(--lado); height: var(--lado); flex: none; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: calc(var(--lado) * 0.36); letter-spacing: -0.02em; background: var(--papel-2); color: var(--tinta-2); border: 1px solid var(--linea); }
.avatar.acento { background: var(--acento); color: var(--sobre-acento); border-color: transparent; }
.avatar svg { width: 46%; height: 46%; }

.barra { height: 6px; border-radius: 6px; background: var(--papel-2); overflow: hidden; }
.barra i { display: block; height: 100%; border-radius: inherit; background: var(--acento); transition: width 0.6s var(--rapida); }
.barra.baja i { background: var(--error); } .barra.media i { background: var(--alerta); } .barra.alta i { background: var(--exito); }

/* ---------- Listas ---------- */
.lista { list-style: none; margin: 0; padding: 0; background: var(--hoja); border: 1px solid var(--linea); border-radius: var(--radio); overflow: hidden; box-shadow: none; }
.lista > li + li { border-top: 1px solid var(--linea); }
.fila { display: flex; align-items: center; gap: 14px; padding: 14px 16px; width: 100%; text-align: left; min-height: 68px; }
button.fila, a.fila { transition: background 0.15s; }
button.fila:active, a.fila:active { background: var(--papel-2); }
.fila .texto { flex: 1; min-width: 0; }
.fila .nombre { font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fila .detalle { font-size: 13px; color: var(--gris); }
.fila .lado { display: flex; align-items: center; gap: 10px; flex: none; }
.fila .chevron { width: 18px; height: 18px; color: var(--gris); }
.vacio { padding: 26px 18px; text-align: center; color: var(--gris); }
.cargando { height: 68px; background: var(--papel-2); animation: brillar 1.3s ease-in-out infinite alternate; }
@keyframes brillar { to { opacity: 0.45; } }

/* Interruptor presente/ausente. */
.interruptor { display: inline-flex; border: 1px solid var(--linea); border-radius: 11px; overflow: hidden; }
.interruptor button { height: 44px; min-width: 44px; padding: 0 12px; font-size: 13px; font-weight: 650; color: var(--gris); }
.interruptor button.si { background: var(--exito); color: #fff; }
.interruptor button.no { background: var(--error); color: #fff; }

/* Control segmentado. */
.segmentos { display: flex; padding: 4px; gap: 4px; background: var(--papel-2); border-radius: 13px; margin: 6px 0 14px; }
.segmentos button { flex: 1; height: 40px; border-radius: 10px; font-weight: 650; font-size: 14px; color: var(--gris); transition: background 0.2s, color 0.2s; }
.segmentos button[aria-selected="true"] { background: var(--hoja); color: var(--tinta); box-shadow: var(--sombra); }

/* ---------- Navegación inferior ---------- */
.nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex; justify-content: center; gap: 4px; padding: 8px 12px calc(8px + env(safe-area-inset-bottom)); background: var(--papel); border-top: 1px solid var(--linea); }
.nav a { flex: 1; max-width: 120px; display: grid; justify-items: center; gap: 3px; padding: 6px 0; border-radius: 12px; color: var(--gris); font-size: 12px; font-weight: 650; }
.nav a svg { width: 24px; height: 24px; }
.nav a.activo { color: var(--tinta); }
.nav a.activo svg { color: var(--acento); }

/* ---------- Ingreso a pantalla completa ---------- */
.ingreso { min-height: 100dvh; display: grid; grid-template-rows: 1fr auto; background: var(--tinta); color: var(--papel); }
.ingreso-portada { position: relative; overflow: hidden; display: grid; align-content: end; padding: calc(28px + env(safe-area-inset-top)) 26px 34px; }
.ingreso-portada .anillos { position: absolute; right: -28vmin; top: -18vmin; width: 95vmin; height: 95vmin; color: var(--acento); opacity: 0.9; pointer-events: none; }
.ingreso-portada .anillos circle { transform-origin: center; animation: anillo 5.5s var(--rapida) infinite; }
.ingreso-portada .anillos circle:nth-child(2) { animation-delay: 1.1s; } .ingreso-portada .anillos circle:nth-child(3) { animation-delay: 2.2s; } .ingreso-portada .anillos circle:nth-child(4) { animation-delay: 3.3s; }
@keyframes anillo { 0% { transform: scale(0.35); opacity: 0; } 25% { opacity: 1; } 100% { transform: scale(1); opacity: 0; } }
.ingreso-portada .marca { position: absolute; top: calc(24px + env(safe-area-inset-top)); left: 26px; color: var(--papel); }
.ingreso-portada .marca svg { color: var(--acento); }
.ingreso-portada h1 { font-size: clamp(44px, 13vw, 76px); letter-spacing: -0.07em; line-height: 0.92; margin: 0; position: relative; }
.ingreso-portada h1 em { font-style: normal; color: var(--acento); }
.ingreso-portada p { position: relative; color: color-mix(in srgb, var(--papel) 70%, transparent); margin: 14px 0 0; font-size: 17px; max-width: 30ch; }
.ingreso-hoja { background: var(--papel); color: var(--tinta); border-radius: 28px 28px 0 0; padding: 28px 22px calc(24px + env(safe-area-inset-bottom)); width: 100%; max-width: 640px; margin: 0 auto; animation: subir 0.6s var(--rapida) both; }
@keyframes subir { from { transform: translateY(40px); opacity: 0; } }
.ingreso-hoja h2 { margin: 0 0 18px; font-size: 24px; letter-spacing: -0.04em; }
.ingreso-pie { text-align: center; color: var(--gris); font-size: 13px; margin: 16px 0 0; }
@media (min-width: 900px) {
  .ingreso { grid-template-rows: none; grid-template-columns: 1.2fr 1fr; }
  .ingreso-portada { padding: 56px; }
  .ingreso-hoja { border-radius: 0; max-width: none; display: grid; align-content: center; padding: 56px max(56px, 8vw); }
}

/* ---------- Marcar (estudiante) ---------- */
.escenario { position: relative; display: grid; place-items: center; height: min(76vw, 320px); margin: 6px 0 4px; }
.onda { position: absolute; width: 176px; height: 176px; border-radius: 50%; border: 1.5px solid var(--acento); opacity: 0; pointer-events: none; }
.escenario.escucha .onda:nth-child(1) { animation: onda 1.8s var(--rapida) infinite; }
.escenario.escucha .onda:nth-child(2) { animation: onda 1.8s var(--rapida) 0.6s infinite; }
.escenario.escucha .onda:nth-child(3) { animation: onda 1.8s var(--rapida) 1.2s infinite; }
@keyframes onda { 0% { transform: scale(1); opacity: 0.7; } 100% { transform: scale(1.9); opacity: 0; } }
.marcar { position: relative; z-index: 2; width: 176px; height: 176px; border-radius: 50%; background: var(--acento); color: var(--sobre-acento); display: grid; place-items: center; box-shadow: 0 18px 40px -14px color-mix(in srgb, var(--acento) 80%, transparent); transition: transform 0.25s var(--rapida), background 0.3s; }
/* En reposo, una onda lenta invita a tocar: el botón "respira". */
.escenario:not(.escucha):not(.exito):not(.fallo) .onda:nth-child(1) { animation: onda 3.6s var(--rapida) infinite; }
.escenario:not(.escucha):not(.exito):not(.fallo) .onda:nth-child(2) { animation: onda 3.6s var(--rapida) 1.8s infinite; }
.marcar:active { transform: scale(0.95); }
.marcar .interior { display: grid; gap: 6px; justify-items: center; font-weight: 700; font-size: 17px; letter-spacing: -0.02em; }
.marcar svg { width: 42px; height: 42px; }
.escenario.exito .marcar { background: var(--exito); box-shadow: 0 18px 40px -14px color-mix(in srgb, var(--exito) 80%, transparent); animation: rebote 0.5s var(--rapida); }
.escenario.fallo .marcar { background: var(--error); box-shadow: 0 18px 40px -14px color-mix(in srgb, var(--error) 80%, transparent); animation: sacudir 0.4s; }
@keyframes rebote { 0% { transform: scale(0.85); } 60% { transform: scale(1.06); } 100% { transform: scale(1); } }
/* Al confirmar, una onda verde sale del botón: el salón te reconoció. */
.escenario.exito .onda { border-color: var(--exito); }
.escenario.exito .onda:nth-child(1) { animation: onda 0.9s var(--rapida) 1 both; }
.escenario.exito .onda:nth-child(2) { animation: onda 0.9s var(--rapida) 0.15s 1 both; }
.trazo { stroke-dasharray: 60; stroke-dashoffset: 60; animation: trazar 0.5s 0.1s var(--rapida) forwards; }
@keyframes trazar { to { stroke-dashoffset: 0; } }
.lecturas { display: flex; gap: 8px; justify-content: center; margin: 2px 0; }
.lecturas i { width: 28px; height: 5px; border-radius: 5px; background: var(--linea); transition: background 0.3s; }
.lecturas i.llena { background: var(--acento); }
.estado-marcar { text-align: center; min-height: 74px; }
.estado-marcar h2 { margin: 10px 0 4px; font-size: 22px; letter-spacing: -0.04em; }
.estado-marcar p { margin: 0; color: var(--gris); }
.chips { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 12px; }
.privacidad { display: flex; gap: 10px; align-items: flex-start; color: var(--gris); font-size: 13px; margin-top: 26px; }
.privacidad svg { width: 18px; height: 18px; flex: none; margin-top: 1px; }

/* ---------- Clase en vivo (profesor) ---------- */
.marcador { display: flex; align-items: baseline; gap: 8px; }
.marcador b { font-size: 56px; font-weight: 800; letter-spacing: -0.07em; line-height: 1; }
.marcador span { font-weight: 650; }

/* ---------- Aviso ---------- */
.aviso { position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom)); transform: translate(-50%, 30px); opacity: 0; z-index: 60; max-width: calc(100% - 32px); padding: 13px 18px; border-radius: 14px; background: var(--tinta); color: var(--papel); font-weight: 600; font-size: 15px; transition: transform 0.35s var(--rapida), opacity 0.35s; pointer-events: none; }
.aviso.visible { transform: translate(-50%, 0); opacity: 1; }
.aviso.error { background: var(--error); color: #fff; }

/* ---------- Hoja modal ---------- */
.velo { position: fixed; inset: 0; z-index: 40; background: rgba(0, 0, 0, 0.45); display: grid; align-items: end; animation: aparecer 0.2s; }
.velo .hoja { background: var(--papel); border-radius: 24px 24px 0 0; padding: 22px 20px calc(22px + env(safe-area-inset-bottom)); max-height: 88dvh; overflow: auto; width: 100%; max-width: 640px; margin: 0 auto; animation: subir 0.35s var(--rapida); }
.velo .hoja h2 { margin: 0 0 14px; letter-spacing: -0.04em; }
@keyframes aparecer { from { opacity: 0; } }

.entra { animation: entrar 0.45s var(--rapida) both; }
.entra-2 { animation-delay: 0.05s; } .entra-3 { animation-delay: 0.1s; } .entra-4 { animation-delay: 0.15s; }
@keyframes entrar { from { opacity: 0; transform: translateY(8px); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
.chevron svg { width: 100%; height: 100%; }

/* Pulido v2.1: la señal es la firma; las superficies dejan respirar el contenido. */
:root {
  --espacio-1: 4px; --espacio-2: 8px; --espacio-3: 12px;
  --espacio-4: 16px; --espacio-5: 24px; --espacio-6: 32px;
  --espacio-7: 48px; --espacio-8: 64px;
  --salida: cubic-bezier(.2,.8,.2,1);
  --transicion: cubic-bezier(.4,0,.2,1);
}
.cifra b, .marcador b, .fila b { font-variant-numeric: tabular-nums; }
.entrada input[type="password"], .entrada input:has(+ .ojo) { padding-right: 58px; }
.interruptor button.si { background: var(--exito-suave); color: var(--exito); box-shadow: inset 0 -3px var(--exito); }
.interruptor button.no { background: var(--error-suave); color: var(--error); box-shadow: inset 0 -3px var(--error); }
.nav a { min-height: 52px; }
.nav a.activo { background: var(--acento-suave); }
.nav a.activo svg { color: var(--tinta); }
.boton:disabled { cursor: default; }
.ingreso-portada { min-height: 360px; }
.ingreso-portada h1 { font-size: clamp(42px, 11vw, 76px); }
.marcar { transition: transform 120ms var(--salida), background 200ms var(--transicion); }
.marcar:active { transform: scale(.97); }
.escenario.exito .marcar { color: var(--papel); }
@media (prefers-color-scheme: dark) {
  .escenario.exito .marcar { color: #0e0e10; }
  .escenario.fallo .marcar { color: #0e0e10; }
  .etiqueta.acento, .seccion a, .seccion button { color: #a5b3ff; }
}
