/* Sesión de juegos: control del profesor, pantalla del proyector y entrada del alumno. */

/* ---------- Profesor: lista ---------- */
.ses-intro { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; max-width: 900px; }
.ses-intro p { margin: 0; font-size: 13px; color: var(--gray-500); line-height: 1.5; }
.ses-lista { display: flex; flex-direction: column; gap: 8px; max-width: 900px; }
.ses-fila {
  display: flex; align-items: center; gap: 14px; padding: 12px 14px; background: var(--white);
  border: 1px solid var(--gray-100); border-radius: 12px; text-decoration: none; color: inherit;
}
.ses-fila:hover { border-color: var(--gray-200); }
.ses-fila.abierta { border-left: 3px solid var(--verde); }
.ses-fila-codigo { font-size: 15px; font-weight: 800; letter-spacing: 0.08em; color: var(--verde-dark); font-variant-numeric: tabular-nums; min-width: 78px; }
.ses-fila-texto { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ses-fila-titulo { font-size: 14px; font-weight: 600; color: var(--gray-900); }
.ses-fila-meta { font-size: 12px; color: var(--gray-400); }

/* ---------- Profesor: control ---------- */
.ses-control { display: flex; flex-direction: column; gap: 16px; max-width: 980px; }
.ses-cabeza {
  display: flex; flex-wrap: wrap; align-items: center; gap: 18px; padding: 16px; background: var(--white);
  border: 1px solid var(--gray-100); border-radius: 14px;
}
.ses-qr { background: #fff; padding: 6px; border-radius: 8px; border: 1px solid var(--gray-100); line-height: 0; }
.ses-qr img, .ses-qr canvas { display: block; }
.ses-cabeza-texto { flex: 1; min-width: 200px; }
.ses-codigo { font-size: 34px; font-weight: 800; letter-spacing: 0.1em; color: var(--gray-900); line-height: 1.1; font-variant-numeric: tabular-nums; }
.ses-url { font-size: 12px; color: var(--gray-400); margin-bottom: 8px; word-break: break-all; }
.ses-estado { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12.5px; color: var(--gray-500); }
.ses-estado b { color: var(--gray-900); font-variant-numeric: tabular-nums; }
.ses-conectados { font-size: 12px; color: var(--gray-400); margin-top: 6px; max-height: 38px; overflow: hidden; }
.ses-cabeza-acciones { display: flex; flex-direction: column; gap: 8px; }
.ses-cabeza-acciones .btn { justify-content: flex-start; }

.ses-pasos { background: var(--white); border: 1px solid var(--gray-100); border-radius: 14px; padding: 14px 16px; }
.ses-pasos-titulo { font-size: 13px; font-weight: 700; color: var(--cafe); margin-bottom: 10px; }
.ses-pasos-titulo span { color: var(--gray-400); font-weight: 600; margin-left: 4px; }
.ses-lista-pasos { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.ses-paso {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--gray-100); border-radius: 12px;
}
.ses-paso.en-curso { border-color: var(--verde); background: var(--verde-light); }
.ses-paso.hecho { opacity: 0.7; }
.ses-paso-num { width: 22px; font-size: 13px; font-weight: 700; color: var(--gray-400); text-align: center; font-variant-numeric: tabular-nums; }
.ses-paso-icono {
  width: 36px; height: 36px; border-radius: 10px; background: var(--arena-light); color: var(--verde-dark);
  display: inline-flex; align-items: center; justify-content: center; font-size: 19px; flex-shrink: 0;
}
.ses-paso-texto { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ses-paso-nombre { font-size: 14px; font-weight: 600; color: var(--gray-900); }
.ses-paso-detalle { font-size: 12px; color: var(--gray-500); }
.ses-paso-acciones { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.ses-icono {
  width: 30px; height: 30px; border: 0; border-radius: 8px; background: none; color: var(--gray-400);
  cursor: pointer; font-size: 16px; display: inline-flex; align-items: center; justify-content: center;
}
.ses-icono:hover { background: var(--gray-50); color: var(--gray-900); }
.ses-icono.peligro:hover { color: var(--error); }

.ses-agregar { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--gray-100); }
.ses-agregar-titulo { font-size: 13px; font-weight: 700; color: var(--gray-900); margin-bottom: 10px; }
.ses-tipos { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.ses-tipos label { cursor: pointer; }
.ses-tipos input { position: absolute; opacity: 0; width: 0; height: 0; }
.ses-tipos span {
  display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 14px; border-radius: 18px;
  border: 1px solid var(--gray-200); font-size: 13px; font-weight: 600; color: var(--gray-500);
}
.ses-tipos input:checked + span { border-color: var(--verde); background: var(--verde-light); color: var(--verde-dark); }
.ses-tipos input:focus-visible + span { outline: 2px solid var(--verde); outline-offset: 2px; }
.ses-campos { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px 14px; }
.ses-campos[hidden], .ses-campos [hidden] { display: none; }
.ses-campos .panel-campo-archivo { grid-column: 1 / -1; }
.ses-agregar-pie { display: flex; justify-content: flex-end; margin-top: 12px; }

@media (max-width: 700px) {
  .ses-intro { flex-direction: column; align-items: flex-start; }
  .ses-paso { flex-wrap: wrap; }
  .ses-paso-acciones { width: 100%; }
}

/* ---------- Proyector ---------- */
.sp-body { margin: 0; background: #14180f; color: #fff; font-family: var(--font); height: 100vh; overflow: hidden; }
.sp-espera { height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 28px; padding: 24px; box-sizing: border-box; }
.sp-titulo { font-size: clamp(22px, 3vw, 40px); font-weight: 800; text-align: center; }
.sp-centro { display: flex; align-items: center; gap: 48px; flex-wrap: wrap; justify-content: center; }
.sp-qr { background: #fff; padding: 16px; border-radius: 18px; line-height: 0; }
.sp-instrucciones { display: flex; flex-direction: column; gap: 10px; max-width: 460px; }
.sp-paso { font-size: clamp(18px, 2vw, 26px); font-weight: 700; }
.sp-o { font-size: 16px; opacity: 0.75; }
.sp-codigo { font-size: clamp(48px, 7vw, 96px); font-weight: 800; letter-spacing: 0.12em; color: #e6e6e6; line-height: 1; font-variant-numeric: tabular-nums; }
.sp-cuantos { font-size: 18px; opacity: 0.85; }
.sp-nombres { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; max-width: 1100px; max-height: 22vh; overflow: hidden; }
.sp-nombres span { background: rgba(255, 255, 255, 0.12); padding: 6px 12px; border-radius: 16px; font-size: 16px; font-weight: 600; animation: sp-entra 0.3s ease; }
@keyframes sp-entra { from { transform: scale(0.8); opacity: 0; } }
.sp-marco { position: fixed; inset: 0; width: 100%; height: 100%; border: 0; background: #14180f; }
.sp-esquina {
  position: fixed; left: 14px; top: 14px; z-index: 5; display: flex; align-items: center; gap: 10px;
  background: rgba(20, 24, 15, 0.88); padding: 8px 12px 8px 8px; border-radius: 14px;
}
.sp-qr-chico { background: #fff; padding: 4px; border-radius: 8px; line-height: 0; }
.sp-esquina span { display: block; font-size: 11px; opacity: 0.75; }
.sp-esquina b { font-size: 22px; letter-spacing: 0.1em; color: #e6e6e6; }
.sp-pantalla-completa {
  position: fixed; left: 12px; bottom: 12px; z-index: 6; width: 38px; height: 38px; border-radius: 10px; border: 0;
  background: rgba(255, 255, 255, 0.1); color: #fff; font-size: 18px; cursor: pointer; opacity: 0.4;
}
.sp-pantalla-completa:hover { opacity: 1; }
[hidden] { display: none !important; }

/* ---------- Alumno: entrada y espera ---------- */
.sj-body {
  margin: 0; min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px;
  box-sizing: border-box; background: linear-gradient(160deg, #14180f, #000000); font-family: var(--font);
}
.sj-tarjeta { width: 100%; max-width: 380px; background: #fff; border-radius: 22px; padding: 28px 22px; text-align: center; }
.sj-tarjeta h1 { font-size: 21px; margin: 10px 0 6px; color: var(--gray-900); }
.sj-tarjeta p { font-size: 14px; color: var(--gray-500); line-height: 1.5; margin: 0 0 16px; }
.sj-icono {
  width: 64px; height: 64px; margin: 0 auto; border-radius: 18px; background: var(--verde-light); color: var(--verde-dark);
  display: flex; align-items: center; justify-content: center; font-size: 32px;
}
.sj-latido { animation: sj-latido 1.6s ease-in-out infinite; }
@keyframes sj-latido { 50% { transform: scale(1.08); } }
.sj-form { display: flex; flex-direction: column; gap: 10px; }
.sj-input {
  height: 50px; border: 1.5px solid var(--gray-100); border-radius: 12px; padding: 0 14px; font-family: var(--font);
  font-size: 17px; text-align: center; outline: none;
}
.sj-input:focus { border-color: var(--verde); }
.sj-input-codigo { text-transform: uppercase; letter-spacing: 0.15em; font-weight: 700; }
.sj-boton {
  display: flex; align-items: center; justify-content: center; height: 50px; border: 0; border-radius: 12px;
  background: var(--verde); color: #fff; font-family: var(--font); font-size: 16px; font-weight: 700; cursor: pointer; text-decoration: none;
}
.sj-boton:disabled { opacity: 0.6; }
.sj-error { color: var(--error); font-size: 13px; margin-top: 10px; min-height: 18px; }
.sj-conectados { font-size: 12.5px; color: var(--gray-400); line-height: 1.5; }

/* ---------- Feedback: encuesta en el teléfono ---------- */
.sj-tarjeta.en-encuesta { max-width: 440px; text-align: left; }
.en-encuesta h1, .en-encuesta > p, .enc-gracias { text-align: center; }
.enc-form { display: flex; flex-direction: column; gap: 14px; }
.enc-form > p { margin-bottom: 0; }
.enc-pregunta { border: 0; margin: 0; padding: 0; }
.enc-pregunta legend { font-size: 14px; font-weight: 700; color: var(--gray-900); margin-bottom: 8px; }
.enc-caritas, .enc-escala { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.enc-escala.tres { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.enc-caritas input, .enc-escala input { position: absolute; opacity: 0; width: 0; height: 0; }
.enc-caritas span, .enc-escala span {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-height: 48px;
  border: 1.5px solid var(--gray-100); border-radius: 12px; cursor: pointer; font-size: 12px; font-weight: 600;
  color: var(--gray-500); text-align: center; padding: 6px 2px; line-height: 1.2;
}
.enc-caritas i { font-size: 28px; }
.enc-caritas small { font-size: 10px; }
.enc-caritas input:checked + span, .enc-escala input:checked + span { border-color: var(--verde); background: var(--verde-light); color: var(--verde-dark); }
.enc-caritas input:focus-visible + span, .enc-escala input:focus-visible + span { outline: 2px solid var(--verde); outline-offset: 2px; }
.enc-texto { display: flex; flex-direction: column; gap: 5px; font-size: 13px; font-weight: 600; color: var(--gray-500); }
.enc-texto textarea { border: 1.5px solid var(--gray-100); border-radius: 12px; padding: 10px 12px; font-family: var(--font); font-size: 14px; resize: vertical; outline: none; }
.enc-texto textarea:focus { border-color: var(--verde); }
.enc-corregir { border: 0; background: none; color: var(--verde); font-family: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }

/* ---------- Feedback: resultados en el proyector ---------- */
.es-pantalla { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; padding: 40px 24px; box-sizing: border-box; }
.es-titulo { font-size: clamp(28px, 4vw, 52px); font-weight: 800; text-align: center; }
.es-sub { font-size: 18px; opacity: 0.75; text-align: center; }
.es-total { display: flex; align-items: baseline; gap: 10px; }
.es-total b { font-size: clamp(56px, 8vw, 110px); color: #e6e6e6; line-height: 1; font-variant-numeric: tabular-nums; }
.es-total span { font-size: 22px; opacity: 0.8; }
.es-tarjetas { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; width: 100%; max-width: 1100px; }
.es-tarjeta { background: rgba(255, 255, 255, 0.07); border-radius: 18px; padding: 22px; display: flex; flex-direction: column; gap: 6px; }
.es-tarjeta > span { font-size: 18px; opacity: 0.8; }
.es-tarjeta > b { font-size: 56px; line-height: 1; font-variant-numeric: tabular-nums; }
.es-tarjeta > small { font-size: 14px; opacity: 0.6; }
.es-barra { height: 10px; border-radius: 5px; background: rgba(255, 255, 255, 0.12); overflow: hidden; flex: 1; }
.es-barra i { display: block; height: 100%; width: 0; background: #e6e6e6; border-radius: 5px; transition: width 0.6s ease; }
.es-ritmo-fila { display: flex; align-items: center; gap: 10px; font-size: 16px; }
.es-ritmo-fila em { font-style: normal; width: 88px; opacity: 0.85; }
.es-ritmo-fila b { width: 34px; text-align: right; font-variant-numeric: tabular-nums; }
@media (max-width: 800px) { .es-tarjetas { grid-template-columns: minmax(0, 1fr); } }
.ses-nota-campo { grid-column: 1 / -1; margin: 0; font-size: 12.5px; color: var(--gray-500); line-height: 1.45; }

/* ---------- Proyector con un paso en curso: franja superior propia ----------
   El juego va debajo de la franja y nada queda encima de sus botones. */
.sp-esquina {
  left: 0; right: 0; top: 0; height: 64px; border-radius: 0; padding: 0 64px 0 14px; gap: 12px;
  background: #0d100a; border-bottom: 1px solid rgba(255, 255, 255, 0.08); box-sizing: border-box;
}
.sp-esquina-texto { display: flex; align-items: baseline; gap: 10px; }
.sp-esquina-texto span { font-size: 14px; }
.sp-esquina-titulo { margin-left: auto; font-size: 15px; font-weight: 700; opacity: 0.75; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sp-esquina:not([hidden]) ~ .sp-pantalla-completa { top: 13px; bottom: auto; left: auto; right: 14px; opacity: 0.7; }
.sp-esquina:not([hidden]) ~ .sp-pantalla-completa,
.sp-esquina:not([hidden]) + .sp-pantalla-completa { top: 13px; bottom: auto; left: auto; right: 14px; }
.sp-marco { top: 64px; height: calc(100% - 64px); }

/* ---------- Proyector: espera entre pasos y X para terminar el paso ---------- */
.sp-estado {
  display: inline-flex; align-items: center; gap: 10px; margin-top: -12px; padding: 8px 16px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.07); font-size: clamp(15px, 1.4vw, 19px); font-weight: 600; color: rgba(242, 240, 233, 0.85);
}
.sp-punto { width: 10px; height: 10px; border-radius: 50%; background: #bdbdbd; animation: sp-punto 1.6s ease-in-out infinite; }
@keyframes sp-punto { 50% { opacity: 0.3; transform: scale(0.8); } }
.sp-salir {
  flex: none; width: 38px; height: 38px; border: 0; border-radius: 50%; margin-left: 4px; cursor: pointer;
  background: rgba(255, 255, 255, 0.08); color: #f2f0e9; font-size: 18px;
  display: inline-flex; align-items: center; justify-content: center;
}
.sp-salir:hover { background: rgba(224, 122, 95, 0.3); }

/* ---------- Teléfono del alumno: el mismo mundo oscuro de la trivia ----------
   Entrada a la sesión, espera entre pasos y encuesta de feedback. */
.sj-body { background: #f5f5f5; color: #111111; }
.sj-tarjeta { background: none; max-width: 460px; padding: 20px 6px; color: #111111; display: flex; flex-direction: column; gap: 4px; }
.sj-tarjeta h1 { font-size: 24px; font-weight: 800; line-height: 1.2; color: #111111; margin: 14px 0 4px; }
.sj-tarjeta p { font-size: 15px; color: rgba(17, 17, 17, 0.8); }
.sj-tarjeta p b { color: #111111; }
.sj-icono {
  width: 88px; height: 88px; border-radius: 50%; font-size: 40px;
  background: rgba(0, 0, 0, 0.16); color: #111111; border: 2px solid rgba(207, 207, 207, 0.4);
}
.sj-input { height: auto; padding: 16px; border: 2px solid rgba(0, 0, 0, 0.16); background: rgba(0, 0, 0, 0.06); color: #111111; }
.sj-input::placeholder { color: rgba(17, 17, 17, 0.4); }
.sj-input:focus { border-color: #111111; }
.sj-boton { height: auto; padding: 15px 30px; border-radius: 999px; background: #111111; color: #ffffff; }
.sj-boton:hover { background: #111111; }
.sj-boton:active { transform: scale(0.98); }
.sj-error { color: #9c4f3f; }
.sj-conectados { color: rgba(17, 17, 17, 0.55); }

.sj-tarjeta.en-encuesta { max-width: 480px; }
.enc-pregunta legend { color: #111111; font-size: 15px; }
.enc-caritas span, .enc-escala span {
  border: 1.5px solid rgba(0, 0, 0, 0.16); background: rgba(0, 0, 0, 0.05); color: rgba(17, 17, 17, 0.8);
  border-radius: 14px; min-height: 52px;
}
.enc-caritas input:checked + span, .enc-escala input:checked + span {
  border-color: #111111; background: rgba(0, 0, 0, 0.22); color: #111111; box-shadow: none;
}
.enc-caritas input:focus-visible + span, .enc-escala input:focus-visible + span { outline-color: #111111; }
.enc-texto { color: rgba(17, 17, 17, 0.75); }
.enc-texto textarea { border: 2px solid rgba(0, 0, 0, 0.16); background: rgba(0, 0, 0, 0.06); color: #111111; }
.enc-texto textarea:focus { border-color: #111111; }
.enc-gracias { display: flex; flex-direction: column; align-items: center; gap: 4px; padding-top: 10vh; }
.enc-gracias .sj-icono { background: rgba(232, 190, 78, 0.16); color: #8a5a00; border-color: rgba(232, 190, 78, 0.45); }
.enc-corregir { color: #111111; margin-top: 8px; }

/* Entrada con código sin cuenta: el enlace para iniciar sesión, discreto abajo. */
.sj-pie { margin-top: 18px; font-size: 13px !important; color: rgba(17, 17, 17, 0.55) !important; }
.sj-pie a { color: #111111; font-weight: 700; text-decoration: none; }
.sj-input-codigo { text-align: center; font-size: 24px; letter-spacing: 0.25em; }

/* Botones de la lista de sesiones: en el celular, Actividades y Nueva sesión en una fila y del mismo tamaño. */
.ses-intro-botones { display: flex; gap: 8px; flex-shrink: 0; }
.ses-volver-movil { display: none; }
@media (max-width: 767px) {
  .ses-intro-botones { width: 100%; }
  .ses-intro-botones .btn { flex: 1; justify-content: center; }
  .ses-volver-movil { display: inline-flex; }
}

/* ---------- Juega libre: lista de trivias públicas ---------- */
.sj-juegos { display: flex; flex-direction: column; gap: 10px; text-align: left; margin-top: 4px; }
.sj-juego {
  display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: 16px;
  background: rgba(0, 0, 0, 0.06); border: 1.5px solid rgba(0, 0, 0, 0.12);
}
.sj-juego-info { flex: 1; min-width: 0; }
.sj-juego-titulo { font-size: 15px; font-weight: 700; color: #111111; }
.sj-juego-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12px; color: rgba(17, 17, 17, 0.6); margin-top: 4px; }
.sj-juego-btn { flex: none; width: auto; height: 42px; padding: 0 18px; border-radius: 999px; }

/* Juega libre: la entrada con cuenta de alumno va arriba y bien visible. */
.sj-cuenta {
  display: flex; align-items: center; gap: 12px; width: 100%; margin: 4px 0 2px; padding: 14px 16px;
  border: 2px solid #111111; border-radius: 16px; background: rgba(0, 0, 0, 0.14);
  color: #111111; font-family: inherit; text-align: left; cursor: pointer; transition: background .15s ease, transform .1s ease;
}
.sj-cuenta:hover { background: rgba(0, 0, 0, 0.24); }
.sj-cuenta:active { transform: scale(0.98); }
.sj-cuenta > i:first-child { font-size: 28px; color: #111111; flex: none; }
.sj-cuenta > i:last-child { font-size: 18px; opacity: .6; flex: none; }
.sj-cuenta span { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.sj-cuenta b { font-size: 15px; }
.sj-cuenta small { font-size: 12.5px; color: rgba(17, 17, 17, 0.7); line-height: 1.35; }
.sj-separador { display: flex; align-items: center; gap: 10px; margin: 14px 0 10px; font-size: 12px; color: rgba(17, 17, 17, 0.5); }
.sj-separador::before, .sj-separador::after { content: ""; flex: 1; height: 1px; background: rgba(0, 0, 0, 0.14); }

/* Juega libre: portada proporcional en PC y celular. */
.sj-tarjeta.sj-libre { max-width: 820px; padding: 32px 20px; gap: 6px; }
.sj-libre .sj-icono { width: 108px; height: 108px; font-size: 52px; }
.sj-libre h1 { font-size: 36px; margin: 18px 0 6px; }
.sj-libre > p { font-size: 18px; }
.sj-libre .sj-juegos { gap: 14px; margin-top: 10px; }
.sj-libre .sj-juego { padding: 20px 22px; gap: 18px; border-radius: 20px; }
.sj-libre .sj-juego-titulo { font-size: 20px; }
.sj-libre .sj-juego-meta { font-size: 15px; gap: 6px 16px; margin-top: 6px; }
.sj-libre .sj-juego-btn { height: 52px; padding: 0 28px; font-size: 17px; }
@media (max-width: 767px) {
  .sj-tarjeta.sj-libre { max-width: 100%; padding: 16px 4px; }
  .sj-libre .sj-icono { width: 84px; height: 84px; font-size: 40px; }
  .sj-libre h1 { font-size: 28px; }
  .sj-libre > p { font-size: 16px; }
  .sj-libre .sj-juego { padding: 16px; gap: 12px; }
  .sj-libre .sj-juego-titulo { font-size: 17px; }
  .sj-libre .sj-juego-meta { font-size: 13px; }
  .sj-libre .sj-juego-btn { height: 46px; padding: 0 20px; font-size: 16px; }
}
