/* Modo juego — capas sobre /live. Hereda tokens de brand.css */

#lp-game {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 20px;
  background: radial-gradient(1100px 560px at 50% -8%, rgba(255, 26, 26, 0.16) 0%, var(--bg) 60%), var(--bg);
  overflow-y: auto;
}
/* La tarjeta se centra cuando cabe; si es más alta que la pantalla, los márgenes
   auto se colapsan y se puede scrollear desde ARRIBA. Evita que el top de la
   tarjeta (la paleta de "añadir bloques") quede recortado e inaccesible al
   acumular muchos bloques en "Ordenar la estructura". */
#lp-game > * {
  margin: auto;
}
#lp-game[hidden] {
  display: none;
}

/* Chip flotante para cambiar el nombre (siempre accesible, discreto). */
#lp-namebtn {
  position: fixed;
  left: max(12px, env(safe-area-inset-left));
  bottom: max(12px, env(safe-area-inset-bottom));
  z-index: 40;
  max-width: 55vw;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 7px 13px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(20, 20, 27, 0.72);
  backdrop-filter: blur(6px);
  color: var(--text, #fff);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  opacity: 0.75;
  cursor: pointer;
}
#lp-namebtn:hover {
  opacity: 1;
}
#lp-namebtn[hidden] {
  display: none;
}

.lp-card {
  width: 100%;
  max-width: 30rem;
  text-align: center;
}
.lp-card .brand-logo {
  width: min(300px, 64vw);
  margin: 0 auto 22px;
}
.lp-eyebrow {
  font-size: 0.78rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--amber);
  font-weight: 600;
  margin-bottom: 10px;
}
.lp-card h2 {
  font-size: clamp(1.5rem, 5vw, 2.1rem);
  line-height: 1.1;
  margin: 0 0 6px;
}
.lp-card p.lp-sub {
  color: var(--muted);
  margin: 0 0 20px;
}

/* Formulario de nombre */
.lp-form {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}
.lp-input {
  flex: 1;
  font: inherit;
  font-family: var(--body);
  padding: 13px 14px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
}
.lp-input:focus {
  outline: none;
  border-color: var(--amber);
}

/* Opciones de respuesta */
.lp-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 22px;
}
.lp-opt {
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.05rem;
  padding: 18px 14px;
  border-radius: var(--radius-card);
  border: 1.5px solid var(--line);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: transform 0.1s, border-color 0.1s, background 0.1s;
}
.lp-opt:hover {
  border-color: var(--amber);
  transform: translateY(-1px);
}
.lp-opt:disabled {
  cursor: default;
  opacity: 0.55;
}
.lp-opt.mine {
  border-color: var(--amber);
  background: color-mix(in srgb, var(--amber) 18%, var(--surface));
}
.lp-opt.correct {
  border-color: var(--one);
  background: color-mix(in srgb, var(--one) 22%, var(--surface));
  color: #1a1326;
  opacity: 1;
}
.lp-opt.wrong {
  border-color: var(--corte);
  background: color-mix(in srgb, var(--corte) 18%, var(--surface));
  opacity: 1;
}

.lp-progress {
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 16px;
}
.lp-feedback {
  font-family: var(--display);
  font-weight: 800;
  font-size: 1.3rem;
  margin-top: 16px;
}
.lp-feedback.ok {
  color: var(--one);
}
.lp-feedback.no {
  color: var(--corte);
}

/* Ranking / resultados */
.lp-rank {
  list-style: none;
  margin: 18px 0 0;
  padding: 0;
  text-align: left;
}
.lp-rank li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: var(--surface);
  margin-bottom: 8px;
}
.lp-rank li.me {
  border-color: var(--amber);
  background: color-mix(in srgb, var(--amber) 14%, var(--surface));
}
.lp-rank .pos {
  font-family: var(--display);
  font-weight: 800;
  color: var(--muted);
  min-width: 1.6em;
}
.lp-rank .nm {
  flex: 1;
  font-weight: 600;
}
.lp-rank .sc {
  font-variant-numeric: tabular-nums;
  color: var(--one);
  font-weight: 700;
}
.lp-rank li:nth-child(1) .pos { color: var(--one); }
.lp-rank li:nth-child(2) .pos { color: var(--qz); }
.lp-rank li:nth-child(3) .pos { color: var(--derecho); }

.lp-score-big {
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(2.6rem, 10vw, 4rem);
  color: var(--one);
  line-height: 1;
  margin: 8px 0;
}

.lp-spinner {
  width: 38px;
  height: 38px;
  margin: 14px auto 0;
  border: 4px solid rgba(255, 255, 255, 0.12);
  border-top-color: var(--amber);
  border-radius: 50%;
  animation: lp-spin 0.9s linear infinite;
}
@keyframes lp-spin {
  to { transform: rotate(360deg); }
}

/* ---------- Juego "pulsar a tiempo" ---------- */
.lp-tapcard {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.lp-countdown {
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(3rem, 16vw, 5.5rem);
  color: var(--one);
  line-height: 1;
  height: 1.1em;
  margin: 4px 0;
}
.lp-countdown.show {
  animation: lp-pop 0.4s ease;
}
@keyframes lp-pop {
  from { transform: scale(1.4); opacity: 0.4; }
  to { transform: scale(1); opacity: 1; }
}
.lp-tapbtn {
  position: relative;
  width: min(74vw, 18rem);
  height: min(74vw, 18rem);
  border-radius: 50%;
  border: 3px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  cursor: not-allowed;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 10px auto;
  transition: transform 0.06s ease, background 0.12s, border-color 0.12s, color 0.12s;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}
/* Confirmación neutra al tocar: pop del botón + anillo verde + "¡tap!" */
.lp-tapbtn.hit {
  animation: lp-hit 0.16s ease;
}
@keyframes lp-hit {
  0% { transform: scale(0.86); }
  55% { transform: scale(1.05); }
  100% { transform: scale(1); }
}
.lp-ripple {
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  border: 4px solid var(--mambo);
  pointer-events: none;
  animation: lp-rip 0.48s ease-out forwards;
}
@keyframes lp-rip {
  from { transform: scale(1); opacity: 0.9; }
  to { transform: scale(1.55); opacity: 0; }
}
.lp-taptag {
  position: absolute;
  left: 50%;
  top: 50%;
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(1.4rem, 7vw, 2.4rem);
  color: #0c0c10;
  background: var(--mambo);
  padding: 0.08em 0.5em;
  border-radius: var(--radius-pill);
  pointer-events: none;
  animation: lp-taptag 0.48s ease-out forwards;
}
@keyframes lp-taptag {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.5); }
  35% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -90%) scale(1); }
}
.lp-tapbtn .lp-tap-emoji {
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(3rem, 18vw, 6rem);
}
.lp-tapbtn.live {
  --glow: var(--one); /* dorado = el "1"; el punteo lo cambia a rosa */
  cursor: pointer;
  color: #1a1326;
  border-color: var(--glow);
  background: radial-gradient(circle at 50% 38%, color-mix(in srgb, var(--glow) 92%, #fff) 0%, var(--glow) 70%);
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--glow) 60%, transparent);
  animation: lp-pulse 1.4s ease-out infinite;
}
/* Reto del punteo (4 y 8) = rosa, el color del TAP en la metodología */
.lp-tapbtn.live.cat-tap {
  --glow: var(--tap);
}
@keyframes lp-pulse {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--glow) 55%, transparent); }
  100% { box-shadow: 0 0 0 26px transparent; }
}
.lp-tapcount {
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  font-weight: 600;
  min-height: 1.2em;
}
.lp-grades {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
  margin: 8px 0 4px;
}
.lp-grades .grade {
  font-size: 0.85rem;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--line);
}
.lp-grades .grade.perfect { color: var(--one); border-color: color-mix(in srgb, var(--one) 50%, var(--line)); }
.lp-grades .grade.good { color: var(--mambo); border-color: color-mix(in srgb, var(--mambo) 45%, var(--line)); }
.lp-grades .grade.wrong { color: var(--amber, #f4b740); border-color: color-mix(in srgb, var(--amber, #f4b740) 45%, var(--line)); }
.lp-grades .grade.miss { color: var(--corte); border-color: color-mix(in srgb, var(--corte) 45%, var(--line)); }

/* Punteo avanzado: dos dianas (8 a la izquierda, 4 a la derecha) */
.lp-tapdual {
  display: flex;
  gap: min(6vw, 22px);
  justify-content: center;
  align-items: center;
  margin: 10px 0;
}
.lp-tapbtn.dual {
  width: min(40vw, 9.5rem);
  height: min(40vw, 9.5rem);
  margin: 0;
}
.lp-tapbtn.dual .lp-tap-emoji {
  font-size: clamp(2.4rem, 13vw, 4.2rem);
}

/* ---------- Juego "Ordenar la estructura" ---------- */
.lp-ordercard { text-align: left; }
.lp-ordercard h2,
.lp-ordercard .lp-eyebrow { text-align: center; }
.lp-ordercard .lp-sub { text-align: center; }

.lp-palette {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin: 6px 0 14px;
}
.lp-block {
  --c: var(--qz);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--display);
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text);
  background: color-mix(in srgb, var(--c) 20%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--c) 55%, var(--line));
  border-radius: var(--radius-pill);
  padding: 10px 14px;
  cursor: pointer;
}
.lp-block .lp-add { color: var(--c); font-weight: 800; }

.lp-seqwrap {
  min-height: 64px;
  border: 1.5px dashed var(--line);
  border-radius: var(--radius-card);
  padding: 8px;
  background: rgba(0, 0, 0, 0.18);
}
.lp-seq { display: flex; flex-direction: column; gap: 6px; }
.lp-seq-empty { color: var(--muted); text-align: center; padding: 14px 6px; margin: 0; }
.lp-seqitem {
  --c: var(--qz);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--c) 16%, var(--surface));
  border-left: 6px solid var(--c);
}
.lp-seqn {
  font-family: var(--display);
  font-weight: 800;
  color: var(--muted);
  min-width: 1.4em;
  text-align: center;
}
.lp-seqname { flex: 1; font-weight: 700; }
.lp-seqctl { display: flex; gap: 4px; }
.lp-mini {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface2);
  color: var(--text);
  font-size: 0.9rem;
  cursor: pointer;
}
.lp-mini:disabled { opacity: 0.35; cursor: default; }
.lp-mini.lp-del { color: var(--corte); }

.lp-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--c);
  flex: 0 0 auto;
}
.lp-judged.ok {
  border-left-color: var(--mambo);
  background: color-mix(in srgb, var(--mambo) 15%, var(--surface));
}
.lp-judged.ko {
  border-left-color: var(--corte);
  background: color-mix(in srgb, var(--corte) 13%, var(--surface));
}
.lp-judge {
  font-family: var(--display);
  font-weight: 800;
  font-size: 0.92rem;
}
.lp-judge.ok { color: var(--mambo); }
.lp-judge.ko { color: var(--corte); font-weight: 700; }
.lp-miss {
  color: var(--muted);
  font-size: 0.85rem;
  text-align: center;
  margin: 8px 0 0;
}

.lp-correct { margin-top: 18px; }
.lp-correct-h {
  font-size: 0.78rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  text-align: center;
  margin-bottom: 8px;
}
.lp-seq-static .lp-seqitem { opacity: 0.95; }

@media (max-width: 380px) {
  .lp-options { grid-template-columns: 1fr; }
}
