/* =====================================================================
   Pantallas previas de la Carrera y la Batalla (menú y resultado).
   Mismo estilo que el memorama: usa los colores y botones de base.css.
   Mientras se juega (#hud visible) todo esto se oculta y queda el video.
   ===================================================================== */

/* Fuera del juego: página clara con scroll; jugando: pantalla completa */
html:has(#hud.oculto), html:has(#hud.oculto) body { overflow: auto; height: auto; min-height: 100vh; background: var(--cielo); }
body:has(#hud.oculto) { background: var(--cielo); color: var(--tinta); }
body:has(#hud.oculto) #lienzo { display: none; }
body:has(#hud:not(.oculto)) .previa { display: none; }
#hud { color: #f5f1e8; font-family: system-ui, "Segoe UI", Roboto, sans-serif; }

.previa main { max-width: 1240px; margin: 0 auto; padding: clamp(1.5rem, 4vw, 3rem) clamp(1rem, 3vw, 2rem) 3rem; outline: none; }

/* Menú (igual que el del memorama) */
.menu { max-width: 760px; margin: 0 auto; }
.menu h1 { font-size: clamp(2.4rem, 6vw, 3.6rem); letter-spacing: -0.02em; margin: 0; }
.menu h1 span { color: inherit; }
.menu h2 { font-size: clamp(1.9rem, 5vw, 2.6rem); margin: 0; }
.menu .entrada { font-size: 1.2rem; color: var(--tinta-2); margin: .75rem 0 1.75rem; }

.niveles { border: 0; padding: 0; margin: 0 0 1.75rem; display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 1rem; }
.niveles legend { font-weight: 700; font-size: 1.25rem; margin-bottom: .75rem; padding: 0; }
.nivel { position: relative; cursor: pointer; }
.nivel input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.nivel span { display: flex; flex-direction: column; gap: .15rem; height: 100%; padding: 1rem 1.1rem; border-radius: 16px;
  background: var(--papel); border: 3px solid var(--borde); color: var(--tinta-2); }
.nivel strong { color: var(--tinta); font-size: 1.3rem; }
.nivel input:checked + span { background: var(--color-juego); color: var(--sobre-color); box-shadow: 4px 4px 0 var(--sombra); }
.nivel input:checked + span strong { color: var(--sobre-color); }
.nivel input:checked + span strong::before { content: "✓ "; }        /* no depende solo del color */
.nivel input:focus-visible + span { outline: 3px solid var(--tinta); outline-offset: 3px; box-shadow: 0 0 0 7px var(--foco); }

/* Casillas grandes */
.casillas { display: grid; gap: .75rem; margin: 0 0 1.75rem; }
.interruptor { display: flex; align-items: center; gap: .8rem; padding: .8rem 1rem; border-radius: 16px; cursor: pointer;
  background: var(--papel); border: 3px solid var(--borde); font-weight: 700; }
.interruptor input { width: 26px; height: 26px; flex: none; accent-color: var(--color-juego); cursor: pointer; }
.interruptor small { display: block; font-weight: 400; color: var(--tinta-2); }
.interruptor:has(input:disabled) { opacity: .6; cursor: not-allowed; }

/* Nombres de jugadores (batalla) */
.nombres { border: 0; padding: 0; margin: 0 0 1.75rem; display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.nombres legend { font-weight: 700; font-size: 1.25rem; margin-bottom: .75rem; padding: 0; }
.nombres label { display: grid; gap: .35rem; font-weight: 700; }
.nombres input { font: inherit; padding: .7rem .9rem; border-radius: 12px; border: 3px solid var(--borde);
  background: var(--papel); color: var(--tinta); min-height: 52px; }
.nombres .lado-izq input { border-left: 12px solid #0B4AA8; }
.nombres .lado-der input { border-right: 12px solid #A8124E; }

.menu .acciones { display: flex; flex-wrap: wrap; gap: 1rem; }
.menu .boton:not(.contorno) { background: var(--color-juego); }
.menu .mensaje { margin-top: 1.25rem; font-weight: 700; color: var(--tinta); min-height: 0; }
.menu .mensaje:empty { display: none; }
.menu .nota { margin-top: 1.25rem; font-size: 1rem; color: var(--tinta-2); opacity: 1; }

/* Resultado */
.resultado { text-align: center; background: var(--papel); border: 3px solid var(--borde); border-radius: 22px;
  padding: 2rem; box-shadow: 8px 8px 0 var(--sombra); }
.resultado .tiempo-final { font-size: clamp(3rem, 10vw, 4.5rem); font-weight: 700; margin: .5rem 0 0; color: var(--color-juego);
  font-variant-numeric: tabular-nums; }
.resultado .acciones { justify-content: center; margin-top: 1.5rem; }

/* Color de cada juego */
.previa.carrera { --color-juego: var(--talavera); }
.previa.batalla { --color-juego: var(--jade); }

@media (max-width: 560px) { .nombres { grid-template-columns: 1fr; } }

/* =====================================================================
   Tamaños más compactos para estas pantallas.
   Todo se reduce en proporción; A+ y A++ siguen agrandando el texto.
   Los botones conservan al menos 44 px de alto (fáciles de tocar).
   ===================================================================== */

.previa main { padding-top: clamp(1.25rem, 3vw, 2rem); }
.menu { max-width: 680px; }
.menu h1 { font-size: clamp(1.9rem, 4.5vw, 2.6rem); }
.menu h2 { font-size: clamp(1.6rem, 4vw, 2.1rem); }
.menu .entrada { font-size: 1.05rem; margin: .5rem 0 1.25rem; }
.niveles { gap: .75rem; margin-bottom: 1.25rem; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.niveles legend, .nombres legend { font-size: 1.05rem; margin-bottom: .5rem; }
.nivel span { padding: .6rem .85rem; border-radius: 12px; font-size: .95rem; line-height: 1.4; }
.nivel strong { font-size: 1.1rem; }
.nivel input:checked + span { box-shadow: 3px 3px 0 var(--sombra); }
.casillas { gap: .6rem; }
.interruptor { padding: .55rem .85rem; border-radius: 12px; gap: .65rem; font-size: 1rem; }
.interruptor input { width: 22px; height: 22px; }
.interruptor small { font-size: .9rem; }
.nombres { gap: .75rem; margin-bottom: 1.25rem; }
.nombres input { min-height: 44px; padding: .5rem .75rem; border-radius: 10px; }
.menu .boton { min-height: 46px; padding: .5rem 1.2rem; font-size: 1.05rem; border-radius: 12px; box-shadow: 3px 3px 0 var(--sombra); }
.menu .nota, .menu .mensaje { font-size: .95rem; }
.resultado { padding: 1.5rem; box-shadow: 6px 6px 0 var(--sombra); }
.resultado .tiempo-final { font-size: clamp(2.4rem, 8vw, 3.4rem); }

/* Encabezado un poco más compacto */
.previa .encabezado { padding-top: .6rem; padding-bottom: .6rem; }
.previa .opcion { min-width: 44px; min-height: 44px; }
