/* Juegos: la tarjeta, los controles y cada modo. La pantalla de juego ocupa justo el alto visible. */
.vista.juego {
  max-width: 46rem; min-height: 100dvh; display: flex; flex-direction: column; gap: 1rem;
  padding-bottom: max(1rem, env(safe-area-inset-bottom)); overflow-x: clip;
}
.barra-juego { display: flex; align-items: center; gap: .875rem; }
.barra-juego .barra { flex: 1; }
.marcador { min-width: 3.25rem; padding: .375rem .625rem; border-radius: 1rem; background: var(--aviso); color: var(--aviso-texto); border: var(--grosor) solid var(--linea); text-align: center; font: var(--peso-titulo) 1.25rem/1.2 var(--f-titulo); font-variant-numeric: tabular-nums; }
.mesa { flex: 1; position: relative; display: grid; min-height: 18rem; perspective: 1400px; }

/* ---------- Tarjeta ---------- */
.carta {
  --dx: 0; --fuerza: 0; position: relative; z-index: 1; display: grid; width: 100%; max-width: 34rem; max-height: 38rem; margin: auto; height: 100%;
  transform: translateX(calc(var(--dx) * 1px)) rotate(calc(var(--dx) * .05deg));
  transition: transform .4s var(--rebote); touch-action: pan-y; cursor: grab; user-select: none; -webkit-user-select: none;
}
.carta.arrastrando { transition: none; cursor: grabbing; }
.carta.entra { animation: reparte .4s var(--rebote); }
.carta-fondo { position: absolute; inset: .75rem 0 -.5rem; width: 92%; max-width: 31rem; max-height: 38rem; margin: auto; border-radius: calc(var(--radio) * 1.4); background: var(--carta-fondo); border: var(--grosor) solid var(--linea); transform: rotate(2.5deg); }
.giro { display: grid; min-height: 0; transform-style: preserve-3d; transition: transform .55s cubic-bezier(.3, 1.3, .5, 1); }
.volteada .giro { transform: rotateY(180deg); }
.cara {
  grid-area: 1 / 1; position: relative; min-width: 0; min-height: 0; display: flex; flex-direction: column; align-items: center; gap: .75rem; padding: 1.5rem;
  border: var(--grosor) solid var(--linea); border-radius: calc(var(--radio) * 1.4); overflow: hidden;
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
}
.dorso { transform: rotateY(180deg); }
.cara-centro { position: relative; z-index: 1; flex: 1; width: 100%; min-height: 0; display: flex; flex-direction: column; overflow-y: auto; text-align: center; }
.cara-centro > :first-child { margin-top: auto; }
.cara-centro > :last-child { margin-bottom: auto; }
.cara-centro p, .pregunta p { font-family: var(--f-titulo); font-weight: var(--peso-titulo); line-height: 1.18; overflow-wrap: anywhere; text-wrap: balance; white-space: pre-line; }
.talla-xl { font-size: clamp(2rem, 9vw, 3.25rem); } .talla-l { font-size: clamp(1.5rem, 6.5vw, 2.25rem); }
.talla-m { font-size: clamp(1.25rem, 5vw, 1.625rem); } .talla-s { font-size: 1.125rem; }
.carta-img { max-width: 100%; max-height: 45%; margin-inline: auto; margin-bottom: 1rem; object-fit: contain; border-radius: .75rem; pointer-events: none; }
.pista { position: relative; z-index: 1; display: inline-flex; align-items: center; gap: .375rem; min-height: 2.75rem; padding: .375rem 1rem; border-radius: 2rem; background: var(--pista); color: var(--pista-texto); font-weight: 800; }
.pista.abierta { cursor: default; }
.sello {
  position: absolute; z-index: 3; top: 12%; padding: .25rem .75rem; border: 5px solid currentColor; border-radius: .625rem; pointer-events: none;
  background: var(--sello-fondo); font: var(--peso-titulo) clamp(1.5rem, 7vw, 2.25rem)/1.1 var(--f-titulo); opacity: 0;
}
.sello.si { left: 7%; color: var(--si-texto); transform: rotate(-14deg) scale(calc(1.5 - var(--fuerza) * .5)); opacity: clamp(0, var(--fuerza), 1); }
.sello.no { right: 7%; color: var(--no-texto); transform: rotate(14deg) scale(calc(1.5 + var(--fuerza) * .5)); opacity: clamp(0, calc(var(--fuerza) * -1), 1); }
.carta.sale-si { animation: sale-si .34s ease-in both; --fuerza: 1 !important; }
.carta.sale-no { animation: sale-no .34s ease-in both; --fuerza: -1 !important; }
.carta.sale-medio { animation: sale-medio .34s ease-in both; }
@keyframes reparte { from { transform: translateY(-3rem) rotate(-5deg) scale(.92); } }
@keyframes sale-si { to { transform: translate(120vw, -4rem) rotate(28deg); } }
@keyframes sale-no { to { transform: translate(-120vw, 4rem) rotate(-28deg); } }
@keyframes sale-medio { to { transform: translateY(60vh) scale(.6); opacity: 0; } }

.cara-centro .porque { margin-top: 1rem; font: 500 1.0625rem/1.4 var(--f-texto); text-wrap: pretty; }
.veredicto .porque { color: var(--tenue); line-height: 1.35; }
.arena-panel > .porque { padding: .75rem 1rem; background: var(--papel); color: var(--tinta); border: var(--grosor) solid var(--linea); border-radius: var(--radio-boton); line-height: 1.35; }

/* ---------- Controles ---------- */
.controles { display: grid; gap: .625rem; width: 100%; max-width: 34rem; margin-inline: auto; }
.notas { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: .625rem; }
.notas.dos { grid-template-columns: 1fr 1fr; }
.nota {
  display: grid; justify-items: center; align-content: center; gap: .125rem; min-height: 4.25rem; padding: .5rem; border-radius: var(--radio);
  border: var(--grosor) solid var(--linea); font-weight: 800; box-shadow: 0 var(--alto) 0 var(--sombra-boton); transition: transform .1s, box-shadow .1s;
}
.nota > b { font-size: 1.75rem; line-height: 1.5rem; }
.nota.si { background: var(--si); color: var(--sobre-si); --sombra-boton: var(--si-sombra); }
.nota.no { background: var(--no); color: #fff; --sombra-boton: var(--no-sombra); }
.nota.medio { background: var(--medio); color: var(--sobre-medio); --sombra-boton: var(--medio-sombra); }
.ayuda-teclas { display: none; text-align: center; font-size: .875rem; color: var(--sobre-fondo); }
@media (hover: hover) and (min-width: 900px) { .ayuda-teclas { display: block; } }

/* ---------- Escribir ---------- */
.mesa-escribir { align-content: start; gap: 1.25rem; min-height: 0; }
.pregunta { position: relative; display: grid; place-items: center; min-height: 9rem; padding: 1.25rem; text-align: center; background: var(--papel); border: var(--grosor) solid var(--linea); border-radius: var(--radio); }
.respuesta { display: grid; gap: .875rem; }
.respuesta .campo > span, .pista-texto, .turno { color: var(--sobre-fondo); }
.respuesta .campo input { font-size: 1.25rem; font-weight: 700; }
.respuesta .fila .principal { flex: 1; }
.pista-texto:empty { display: none; }
.pista-texto { font-weight: 700; }
.veredicto { display: flex; align-items: center; gap: 1rem; padding: 1rem; background: var(--papel); border: 4px solid var(--no); border-radius: var(--radio); animation: reparte .4s var(--rebote); }
.veredicto.bien { border-color: var(--si); }
.veredicto .chigui { width: 6rem; flex: none; }
.veredicto div { min-width: 0; display: grid; gap: .25rem; overflow-wrap: anywhere; }
.veredicto h2 { font-size: 1.25rem; color: var(--no-texto); }
.veredicto.bien h2 { color: var(--si-texto); }
.veredicto .talla-m { font-weight: 800; }
.escribiste { color: var(--tenue); }

/* ---------- Duelo ---------- */
.vidas { display: flex; gap: .125rem; }
.vidas .ico { width: 1.875rem; height: 1.875rem; transition: .4s var(--rebote); }
.vidas .gastado { filter: grayscale(1); opacity: .35; transform: scale(.8); }
.arena { flex: 1; display: grid; grid-template-rows: auto 1fr; gap: 1rem; }
.arena-jefe { position: relative; overflow: hidden; display: grid; justify-items: center; gap: .25rem; padding: .75rem 1rem 1rem; border: var(--grosor) solid var(--linea); border-radius: calc(var(--radio) * 1.2); background: var(--arena); }
.jefe { width: min(62%, 17rem); animation: flota 2.6s ease-in-out infinite; }
.jefe svg { display: block; width: 100%; max-height: 27vh; overflow: visible; }
.jefe.golpeado { animation: golpeado .55s; }
.jefe.ataca { animation: ataca .6s; }
.t1, .t2, .t3, .t4 { transform-box: fill-box; animation: tentaculo 2.2s ease-in-out infinite alternate; }
.t1, .t3 { transform-origin: 100% 100%; } .t2, .t4 { transform-origin: 0 100%; animation-delay: -1.1s; }
.jefe-vida { position: relative; width: min(100%, 22rem); display: grid; gap: .25rem; text-align: center; color: var(--arena-texto); }
.jefe-vida b { font: var(--peso-titulo) 1.25rem/1 var(--f-titulo); }
.peligro-barra i { background: var(--no); }
.arena-panel { display: grid; gap: .75rem; align-content: start; }
.arena-panel .pregunta { min-height: 5.5rem; padding: .875rem 1rem; }
.arena-panel .pregunta .talla-xl { font-size: clamp(1.5rem, 6.5vw, 2rem); } .arena-panel .pregunta .talla-l { font-size: clamp(1.1875rem, 5vw, 1.5rem); }
.turno { text-align: center; font-weight: 800; }
.opciones { display: grid; gap: .625rem; }
.opcion {
  display: flex; align-items: center; gap: .75rem; min-height: 3.375rem; padding: .5rem 1rem; text-align: left; font-weight: 700; line-height: 1.25; background: var(--papel); overflow-wrap: anywhere;
  border: var(--grosor-opcion) solid var(--linea-opcion); border-radius: var(--radio-boton); box-shadow: 0 var(--alto) 0 var(--sombra-boton); transition: transform .1s, box-shadow .1s;
}
.opcion span { min-width: 0; }
.opcion kbd { display: none; }
.opcion:disabled { color: var(--tinta); cursor: default; }
.opcion:disabled:not(.correcta, .errada) { opacity: .55; }
.opcion.correcta { background: var(--si); color: var(--sobre-si); animation: pum .4s; }
.opcion.errada { background: var(--no); color: #fff; }
@keyframes flota { 50% { transform: translateY(-.5rem) rotate(1deg); } }
@keyframes golpeado { 15% { transform: scale(1.2, .72) translateY(1rem); filter: brightness(1.9); } 45% { transform: translateX(1rem) rotate(8deg) scale(.95, 1.06); } 70% { transform: translateX(-.6rem) rotate(-5deg); } }
@keyframes ataca { 25% { transform: translateY(-1rem) scale(.92); } 55% { transform: translateY(2rem) scale(1.4); } }
@keyframes tentaculo { from { transform: rotate(-4deg); } to { transform: rotate(5deg); } }

/* ---------- Relámpago ---------- */
.cuenta { margin: auto; display: grid; justify-items: center; gap: 1rem; text-align: center; font-weight: 800; color: var(--sobre-fondo); }
.cuenta b { font: var(--peso-titulo) 9rem/1 var(--f-titulo); }
.carta.rayo .cara { padding: 1.25rem; }
.carta.rayo hr { width: 4rem; margin: 1.25rem auto; border: 0; border-top: 6px dotted var(--no); flex: none; }
.carta.rayo .propuesta { color: var(--propuesta); }
.carta.corrige .propuesta { color: var(--si-texto); animation: pum .4s; }
.carta.corrige .propuesta::before { content: 'Es: '; }
.reloj-texto { text-align: center; color: var(--sobre-fondo); font: var(--peso-titulo) 1.25rem/1 var(--f-titulo); font-variant-numeric: tabular-nums; }
.apuro .reloj-texto { animation: pum 1s infinite; }
.apuro .barra-juego .barra i { background: var(--no); }

/* ---------- Parejas ---------- */
.tablero-parejas { flex: 1; display: grid; grid-template-columns: repeat(3, 1fr); grid-auto-rows: minmax(6rem, 1fr); gap: .625rem; max-height: 46rem; }
.tablero-parejas.anchas { grid-template-columns: 1fr 1fr; grid-auto-rows: minmax(5.25rem, 1fr); }
.pieza {
  min-width: 0; display: grid; place-items: center; padding: .5rem; font-size: clamp(.875rem, 3.7vw, 1.125rem); font-weight: 800; line-height: 1.18; overflow-wrap: anywhere; hyphens: auto;
  border: var(--grosor-opcion) solid var(--linea-opcion); border-radius: var(--radio); transition: transform .25s var(--rebote), opacity .3s, background .2s; animation: reparte .4s calc(var(--i) * 30ms) var(--rebote) backwards;
}
.pieza span { min-width: 0; max-width: 100%; }
.lado-p { background: var(--papel); } .lado-r { background: var(--pieza-r); color: var(--pieza-r-texto); }
.pieza.elegida { transform: scale(1.05) rotate(-2deg); outline: 5px solid var(--foco); outline-offset: -1px; }
.pieza.unida { opacity: 0; transform: scale(.4) rotate(14deg); transition-duration: .45s; }

/* ---------- Final ---------- */
.final { margin: auto; width: min(100%, 32rem); display: grid; justify-items: center; gap: 1.125rem; text-align: center; padding-block: 1rem; color: var(--sobre-fondo); }
.final h1 { font-size: clamp(2.25rem, 10vw, 3.5rem); }
.final-arte { width: min(64vw, 17rem); }
.final-arte svg { display: block; width: 100%; overflow: visible; }
.derrota .final-arte { width: 10rem; }
.final-datos { width: 100%; display: grid; grid-template-columns: repeat(3, 1fr); gap: .625rem; color: var(--tinta); }
.final-datos li { display: grid; gap: .125rem; padding: .875rem .25rem; background: var(--papel); border: var(--grosor) solid var(--linea); border-radius: var(--radio); animation: reparte .5s .2s var(--rebote) backwards; }
.final-datos li:nth-child(2) { animation-delay: .32s; } .final-datos li:nth-child(3) { animation-delay: .44s; }
.final-datos b { font: var(--peso-titulo) clamp(1.375rem, 6.5vw, 2rem)/1.1 var(--f-titulo); font-variant-numeric: tabular-nums; }
.final-datos small { color: var(--tenue); }
.final .lista-tarjetas { width: 100%; color: var(--tinta); }
.final-botones { width: 100%; display: grid; gap: .875rem; }

@media (min-width: 700px) {
  .opciones { grid-template-columns: 1fr 1fr; }
  .opcion kbd { display: grid; place-items: center; flex: none; width: 1.75rem; height: 1.75rem; border-radius: .5rem; background: var(--riel); color: var(--tinta); font: 800 .9375rem/1 var(--f-texto); }
  .tablero-parejas { grid-template-columns: repeat(4, 1fr); }
  .tablero-parejas.anchas { grid-template-columns: repeat(3, 1fr); }
}
@media (max-height: 640px) {
  .jefe svg { max-height: 19vh; }
  .arena-panel .pregunta { min-height: 4rem; }
  .opcion { min-height: 2.875rem; }
  .mesa { min-height: 13rem; }
}
