/* TuaLua 17 — home (seleccion_personajes.html). Propuesta Claude Code.
   Se carga después del <style> de la plantilla: solo usa clases tl-* nuevas y
   unos pocos ajustes a secciones existentes (conv-franja, sit-seccion). */

body {
  font-family: var(--fuente);
  background: var(--bg);
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
}

/* ---------- Barra superior ---------- */
.tl-barra {
  position: sticky;
  top: 0;
  z-index: 50;
  width: 100%;
  max-width: 760px;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 auto;
  padding: calc(10px + var(--seguro-arriba)) 16px 10px;
  background: rgba(14, 20, 21, 0.92);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}
.tl-marca { display: block; line-height: 0; border-radius: var(--radio-s); }
.tl-logo { width: 116px; height: auto; }
.tl-accesos { display: flex; align-items: center; gap: 4px; }
.tl-icono {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.tl-icono:hover { color: var(--text); background: var(--bg2); }
.tl-bandera {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 0 0 2px var(--bg3);
}
.tl-avatar { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; }
.tl-plumas {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  margin-left: 4px;
  padding: 0 14px 0 10px;
  border-radius: 999px;
  border: 1px solid rgba(245, 200, 66, 0.45);
  background: rgba(245, 200, 66, 0.08);
  color: var(--gold);
  font-weight: 600;
  font-size: 1rem;
  text-decoration: none;
  font-variant-numeric: tabular-nums;
  box-sizing: border-box;
}
.tl-plumas img { width: 20px; height: 20px; }

/* ---------- Franja de progreso de plumas ---------- */
.tl-progreso {
  width: calc(100% - 32px);
  max-width: 728px;
  box-sizing: border-box;
  margin: 8px auto 24px;
  padding: 14px 16px;
  border-radius: var(--radio-m);
  background:
    radial-gradient(120% 140% at 0% 0%, rgba(245, 200, 66, 0.10), transparent 55%),
    var(--bg2);
  border: 1px solid var(--linea);
  text-align: left;
}
/* Cabecera: pluma, total y enlace al ranking. Debajo va el camino a las 30 plumas. */
.tl-progreso-cab {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
}
.tl-progreso-pluma { width: 34px; height: 34px; }
.tl-progreso-total { margin: 0; font-size: 0.95rem; color: var(--text); }
.tl-progreso-total strong {
  font-family: var(--fuente-titulo);
  font-size: 1.35rem;
  color: var(--gold);
  margin-right: 2px;
  font-variant-numeric: tabular-nums;
}
.tl-progreso-meta { margin: 0; font-size: 0.8rem; color: var(--muted); line-height: 1.35; }
.tl-progreso-enlace {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 4px;
  color: var(--teal);
  font-weight: 600;
  font-size: 0.875rem;
  text-decoration: none;
}

/* ---------- Camino a las 30 plumas ---------- */
.tl-camino { margin-top: 10px; }
/* La pista deja margen a la izquierda (marcador en 0) y a la derecha (meta + etiqueta). */
.tl-camino-pista {
  position: relative;
  height: 96px;
  margin: 0 40px 0 14px;
}
.tl-camino-riel {
  position: absolute;
  left: 0;
  right: 0;
  top: 34px;
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.09);
}
.tl-camino-relleno {
  display: block;
  height: 100%;
  min-width: 8px;
  border-radius: inherit;
  background: linear-gradient(90deg, #d9a92a, var(--gold));
}
/* Marcador "tú estás aquí": gota dorada sobre el riel. */
.tl-camino-aqui {
  position: absolute;
  top: 12px;
  width: 14px;
  height: 14px;
  margin-left: -7px;
  border-radius: 50% 50% 50% 0;
  background: var(--gold);
  border: 2px solid var(--bg);
  box-shadow: 0 0 0 1px var(--gold);
  transform: rotate(-45deg);
  z-index: 5;
  pointer-events: none; /* con 28-29 plumas queda sobre la meta sin robarle el toque */
}
/* Parada: punto exacto en el riel y, debajo, la ficha del personaje en dos filas alternas
   (así dos umbrales cercanos, como 1 y 2, no se solapan en pantallas angostas). */
.tl-parada {
  position: absolute;
  top: 34px;
  width: 0;
  height: 8px;
  z-index: 2;
}
.tl-parada-punto {
  position: absolute;
  left: -5px;
  top: -1px;
  width: 10px;
  height: 10px;
  box-sizing: border-box;
  border-radius: 50%;
  background: var(--bg2);
  border: 2px solid rgba(255, 255, 255, 0.35);
}
.tl-parada-ok .tl-parada-punto { background: var(--gold); border-color: var(--gold); }
.tl-parada-ficha {
  position: absolute;
  left: 0;
  transform: translateX(-50%);
  display: flex;
  gap: 2px;
}
.tl-parada-fila-0 .tl-parada-ficha { top: 12px; }
.tl-parada-fila-1 .tl-parada-ficha { top: 38px; }
.tl-parada-ficha img,
.tl-parada-ficha b {
  display: block;
  width: 22px;
  height: 22px;
  box-sizing: border-box;
  border-radius: 50%;
  object-fit: cover;
  background: var(--bg3);
  border: 2px solid var(--gold);
  font: 700 0.7rem/18px var(--fuente);
  text-align: center;
  color: var(--gold);
}
.tl-parada-pend .tl-parada-ficha img,
.tl-parada-pend .tl-parada-ficha b {
  border-color: rgba(255, 255, 255, 0.25);
  filter: grayscale(1);
  opacity: 0.55;
}
.tl-parada-candado {
  position: absolute;
  right: -5px;
  bottom: -3px;
  fill: var(--muted);
  stroke: var(--muted);
}
/* Meta: el diploma, en el 100 % del riel. */
.tl-camino-meta {
  position: absolute;
  left: 100%;
  top: 11px;
  width: 44px;
  margin-left: -22px;
  height: 56px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--muted);
  font-family: var(--fuente);
  cursor: pointer;
  z-index: 4;
}
.tl-camino-meta img {
  position: absolute;
  left: 5px;
  top: 0;
  width: 34px;
  height: 34px;
  padding: 4px;
  box-sizing: border-box;
  border-radius: 50%;
  background: var(--bg3);
  border: 2px solid rgba(255, 255, 255, 0.25);
  filter: grayscale(1);
  opacity: 0.8;
}
.tl-camino-meta-texto {
  position: absolute;
  right: -12px;
  top: 38px;
  white-space: nowrap;
  font-size: 0.7rem;
  font-weight: 600;
}
.tl-camino-meta-ganada img { filter: none; opacity: 1; border-color: var(--gold); background: rgba(245, 200, 66, 0.15); }
.tl-camino-meta-ganada .tl-camino-meta-texto { color: var(--gold); }
.tl-camino-meta:focus-visible { outline: 2px solid var(--teal); outline-offset: 6px; border-radius: 8px; }
.tl-camino-textos { margin-top: 2px; }
.tl-camino-textos p { margin: 0; }
.tl-camino-faltan,
.tl-camino-ganado { font-size: 0.9rem; font-weight: 600; color: var(--text); line-height: 1.35; }
.tl-camino-ganado { color: var(--gold); }
.tl-camino-textos .tl-progreso-meta { margin-top: 2px; }
.tl-camino-nota {
  display: inline-block;
  margin-top: 8px;
  font-size: 0.78rem;
  line-height: 1.4;
  color: var(--muted);
  text-decoration: underline;
  text-decoration-color: rgba(124, 168, 173, 0.45);
  text-underline-offset: 2px;
}
@media (max-width: 380px) {
  .tl-camino-pista { margin-right: 36px; }
  .tl-camino-meta-texto { right: -8px; }
}

/* ---------- Hoja con la muestra del diploma ---------- */
.tl-hoja {
  position: fixed;
  inset: 0;
  z-index: 400;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(5, 9, 10, 0.72);
}
.tl-hoja[hidden] { display: none; }
.tl-hoja-caja {
  width: min(600px, 100%);
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  box-sizing: border-box;
  padding: 20px 16px 16px;
  border-radius: var(--radio-l);
  background: var(--bg2);
  border: 1px solid var(--linea-fuerte);
  box-shadow: var(--sombra-flotante);
  text-align: center;
}
.tl-hoja-titulo {
  margin: 0 0 14px;
  font-family: var(--fuente-titulo);
  font-weight: 600;
  font-size: 1.35rem;
  color: var(--gold);
}
.tl-hoja-texto { margin: 14px 0 16px; font-size: 0.9rem; line-height: 1.5; color: var(--muted); }
.tl-hoja-cerrar {
  display: block;
  width: 100%;
  min-height: 48px;
  border: 0;
  border-radius: var(--radio-m);
  background: var(--teal);
  color: var(--bg);
  font: 600 1rem var(--fuente);
  cursor: pointer;
}

/* ---------- Acceso al panel del profesor (solo profesores) ---------- */
.tl-profe {
  width: calc(100% - 32px);
  max-width: 728px;
  box-sizing: border-box;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  margin: 8px auto 0;
  padding: 10px 16px;
  min-height: 56px;
  border-radius: var(--radio-m);
  border: 1px solid rgba(130, 211, 214, 0.28);
  background: var(--bg2);
  color: var(--text);
  text-decoration: none;
  text-align: left;
}
.tl-profe:hover { border-color: rgba(130, 211, 214, 0.55); background: var(--bg3); }
.tl-profe + .tl-progreso { margin-top: 10px; }
.tl-profe-icono {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(130, 211, 214, 0.12);
  color: var(--teal);
}
.tl-profe-texto { display: flex; flex-direction: column; min-width: 0; }
.tl-profe-titulo { font-size: 0.95rem; font-weight: 600; line-height: 1.3; }
.tl-profe-meta { font-size: 0.8rem; color: var(--muted); line-height: 1.35; }
.tl-profe-accion { color: var(--teal); font-weight: 600; font-size: 0.875rem; white-space: nowrap; }

/* ---------- Secciones existentes: mismo ritmo vertical ---------- */
.conv-franja { margin-bottom: 28px; }
.conv-franja-titulo,
.sit-titulo,
.tl-seccion-titulo {
  margin: 0;
  font-family: var(--fuente);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
}
.conv-franja-titulo { margin-bottom: 10px; }
.sit-carril { padding-left: 16px; padding-right: 16px; scroll-padding-left: 16px; }
.sit-carril > li { scroll-snap-align: start; }

/* ---------- Personajes ---------- */
.tl-personajes {
  width: 100%;
  max-width: 760px;
  box-sizing: border-box;
  margin: 0 auto 8px;
  padding: 0 16px;
  text-align: left;
}
.tl-seccion-sub { margin: 2px 0 14px; font-size: 0.875rem; color: var(--muted); }
.tl-grilla {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.tl-ficha button {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 2px;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 8px 8px 12px;
  border: 1px solid var(--linea);
  border-radius: var(--radio-m);
  background: var(--bg2);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.tl-ficha button:hover { border-color: rgba(130, 211, 214, 0.5); }
.tl-ficha button:active { transform: scale(0.98); }
.tl-ficha-imagen {
  position: relative;
  display: block;
  aspect-ratio: 1 / 1;
  margin-bottom: 8px;
  border-radius: var(--radio-s);
  overflow: hidden;
  background: #85e0cf;
}
.tl-ficha-imagen > img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.tl-ficha-nombre { padding: 0 4px; font-size: 0.95rem; font-weight: 600; line-height: 1.25; }
.tl-ficha-pista { padding: 0 4px; font-size: 0.8rem; color: var(--muted); line-height: 1.3; }

/* "Elige tu personaje" abre el catálogo de series: se distingue con borde teal */
.tl-ficha-elige button { border-color: rgba(130, 211, 214, 0.35); }

/* Bloqueado: imagen apagada + chip dorado con lo que pide */
.tl-ficha-bloqueada .tl-ficha-imagen > img { filter: grayscale(1) brightness(0.55); }
.tl-ficha-bloqueada .tl-ficha-imagen { background: #3a4446; }
.tl-ficha-bloqueada .tl-ficha-nombre { color: #c9d9db; }
.tl-ficha-candado {
  position: absolute;
  left: 8px;
  bottom: 8px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px 3px 7px;
  border-radius: 999px;
  background: rgba(14, 20, 21, 0.86);
  color: var(--gold);
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.4;
}
.tl-ficha-candado img { width: 14px; height: 14px; }

/* ---------- Pie ---------- */
.tl-pie {
  width: 100%;
  max-width: 760px;
  box-sizing: border-box;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 20px;
  margin: 36px auto 0;
  padding: 20px 16px calc(24px + var(--seguro-abajo));
  border-top: 1px solid var(--linea);
  font-size: 0.8rem;
  color: var(--muted);
}
.tl-pie a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--muted);
  text-decoration: none;
}
.tl-pie a:hover { color: var(--text); }
.tl-pie span { display: inline-flex; align-items: center; min-height: 44px; }

/* ---------- Foco y movimiento ---------- */
.tl-barra a:focus-visible,
.tl-barra button:focus-visible,
.tl-progreso-enlace:focus-visible,
.tl-profe:focus-visible,
.tl-ficha button:focus-visible,
.tl-pie a:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 2px;
}
@media (prefers-reduced-motion: reduce) {
  .tl-ficha button { transition: none; }
  .tl-ficha button:active { transform: none; }
}

/* ---------- Escritorio ---------- */
@media (min-width: 720px) {
  .tl-logo { width: 140px; }
  .tl-grilla { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
  .tl-barra { padding-top: calc(16px + var(--seguro-arriba)); padding-bottom: 16px; }
}

/* Envoltorio heredado (ancla de los tests): sin estilos propios */
.tl-personajes > .grid-container {
  display: block;
  width: auto;
  max-width: none;
  margin: 0;
  padding: 0;
  gap: 0;
  text-align: left;
}
