/* Sorpify Arena: coliseo al anochecer. Paneles de noche sobre la arena 3D; verde = tu equipo, rojo = rival,
   amarillo solo para lo salvaje y el botín. */
:root {
  --noche: #13233b;
  --noche-2: #1c3152;
  --piedra: #efe6d2;
  --piedra-2: #bfb39a;
  --verde: #22c55e;
  --verde-hondo: #166534;
  --rojo: #e4572e;
  --amarillo: #facc15;
  --fuego: #f97316;
  --agua: #38bdf8;
  --planta: #84cc16;
  --neutro: #cbd5e1;
  --radio: 14px;
  --sombra-talla: 0 2px 0 #0a1424, 0 4px 14px rgba(5, 10, 20, .55);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #0d1a2e; color: var(--piedra);
  font: 400 15px/1.45 Poppins, system-ui, sans-serif; -webkit-tap-highlight-color: transparent; }
#escena { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
button { font: inherit; color: inherit; cursor: pointer; }
button:focus-visible, a:focus-visible { outline: 3px solid var(--amarillo); outline-offset: 2px; }
a { color: var(--amarillo); }
[hidden] { display: none !important; }

/* ---------- Pantallas de menú */
.pantalla { position: fixed; inset: 0; overflow-y: auto; padding: max(16px, env(safe-area-inset-top)) 16px 24px;
  background: linear-gradient(180deg, rgba(13, 26, 46, .25), rgba(13, 26, 46, .82) 55%); }
.panel { max-width: 720px; margin: 0 auto; }
button.volver { background: none; border: 0; padding: 0; }
.volver { display: inline-flex; gap: 8px; align-items: center; color: var(--piedra-2); text-decoration: none; font-weight: 600; }
.titulo { margin: 18px 0 4px; font-weight: 800; font-size: clamp(40px, 11vw, 76px); line-height: .95; letter-spacing: -.02em;
  color: var(--piedra); text-shadow: var(--sombra-talla); }
.titulo small { display: block; font-size: .36em; font-weight: 700; color: var(--verde); letter-spacing: 0; }
.lema { margin: 8px 0 18px; max-width: 46ch; color: var(--piedra-2); }
h2 { margin: 26px 0 10px; font-size: 19px; font-weight: 700; }
.cuenta { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; padding: 12px 14px; border-radius: var(--radio);
  background: var(--noche); }
.cuenta p { margin: 0; flex: 1 1 220px; }
.premios-hoy b { color: var(--amarillo); }

.boton { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 22px;
  border: 0; border-radius: 999px; font-weight: 700; text-decoration: none; transition: transform .12s, filter .12s; }
.boton:active { transform: scale(.97); }
.boton-amarillo { background: var(--amarillo); color: #3a2a00; }
.boton-verde { background: var(--verde); color: #05250f; }
.boton-claro { background: var(--noche-2); color: var(--piedra); }
.boton:disabled { filter: grayscale(1) brightness(.7); cursor: not-allowed; }
.fila-botones { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }

/* Desafíos: un camino (sí es una secuencia: se desbloquean en orden) */
.camino { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.desafio { width: 100%; display: grid; grid-template-columns: 40px 1fr auto; gap: 12px; align-items: center; text-align: left;
  padding: 10px 14px; border: 2px solid transparent; border-radius: var(--radio); background: var(--noche); }
.desafio .paso { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-weight: 800;
  background: var(--noche-2); color: var(--piedra-2); }
.desafio.hecho .paso { background: var(--verde-hondo); color: var(--piedra); }
.desafio.jefe .paso { background: var(--rojo); color: #fff; }
.desafio[aria-pressed="true"] { border-color: var(--amarillo); }
.desafio:disabled { opacity: .45; cursor: not-allowed; }
.desafio b { display: block; font-weight: 600; }
.desafio small { color: var(--piedra-2); }
.desafio .premio { font-weight: 700; color: var(--amarillo); white-space: nowrap; }

/* ---------- Equipo */
.rejilla { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.criatura { position: relative; display: grid; gap: 4px; padding: 12px; text-align: left; border-radius: var(--radio);
  border: 2px solid transparent; background: var(--noche); }
.criatura[aria-pressed="true"] { border-color: var(--verde); background: #173a2c; }
.criatura .puesto { position: absolute; top: 8px; right: 10px; width: 24px; height: 24px; border-radius: 50%; display: grid;
  place-items: center; background: var(--verde); color: #05250f; font-weight: 800; font-size: 13px; }
.criatura b { font-weight: 700; font-size: 16px; }
.criatura .detalle { font-size: 13px; color: var(--piedra-2); }
.chapa { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; padding: 2px 8px;
  border-radius: 999px; background: var(--noche-2); width: fit-content; }
.el-fuego { color: var(--fuego); } .el-agua { color: var(--agua); } .el-planta { color: var(--planta); } .el-ninguno { color: var(--neutro); }
.ficha { margin-top: 14px; padding: 14px; border-radius: var(--radio); background: var(--noche); }
.ficha h3 { margin: 0 0 6px; font-size: 18px; }
.ficha dl { margin: 10px 0 0; }
.ficha dt { font-weight: 700; margin-top: 10px; }
.ficha dd { margin: 2px 0 0; color: var(--piedra-2); max-width: 60ch; }
.ficha dd.salvaje-txt { color: var(--amarillo); }
.medidas { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 8px; font-size: 12px; color: var(--piedra-2); }
.medidas span i { display: block; height: 6px; margin-top: 3px; border-radius: 3px; background: var(--verde); }
.aviso { margin: 12px 0 0; padding: 10px 14px; border-radius: var(--radio); background: #3b2a10; color: #ffe7a3; }
.rivales-vista { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- Combate */
#hud { position: fixed; inset: 0; pointer-events: none; display: flex; flex-direction: column; justify-content: space-between;
  padding: max(10px, env(safe-area-inset-top)) 10px max(10px, env(safe-area-inset-bottom)); }
#hud > * { pointer-events: auto; }
.barra-sup { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.ronda { font-weight: 800; font-size: 15px; padding: 6px 14px; border-radius: 999px; background: rgba(19, 35, 59, .85); }
.redondo { width: 42px; height: 42px; border-radius: 50%; border: 0; background: rgba(19, 35, 59, .85); }
.equipo-hud { display: flex; justify-content: center; gap: 6px; max-width: 560px; width: 100%; margin: 8px auto 0; }
.tarjeta { position: relative; flex: 0 1 calc((100% - 12px) / 3); padding: 7px 9px 8px; border-radius: 12px; background: rgba(19, 35, 59, .9); border: 2px solid transparent;
  text-align: left; min-width: 0; }
.tarjeta .nombre { display: flex; justify-content: space-between; gap: 4px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.tarjeta .nombre span:first-child { overflow: hidden; text-overflow: ellipsis; }
.tarjeta .vida { position: relative; display: block; height: 9px; margin-top: 5px; border-radius: 5px; background: #0b1627; overflow: hidden; }
.tarjeta .vida i { position: absolute; inset: 0 auto 0 0; background: var(--verde); transition: width .35s ease-out; }
.tarjeta.rival .vida i { background: var(--rojo); }
.tarjeta .vida s { position: absolute; inset: 0 auto 0 0; background: rgba(239, 230, 210, .6); text-decoration: none; transition: width .35s; }
.tarjeta .salvaje { display: block; height: 4px; margin-top: 4px; border-radius: 2px; background: #0b1627; overflow: hidden; }
.tarjeta .salvaje i { display: block; height: 100%; background: var(--amarillo); transition: width .35s; }
.tarjeta .estados { display: flex; gap: 4px; min-height: 16px; margin-top: 3px; font-size: 11px; }
.tarjeta.activa { border-color: var(--verde); }
.tarjeta.caida { opacity: .4; }
.tarjeta.objetivo { border-color: var(--rojo); animation: latidoRojo 1s infinite; cursor: pointer; }
.tarjeta.objetivo-aliado { border-color: var(--verde); animation: latidoVerdeArena 1s infinite; cursor: pointer; }
@keyframes latidoRojo { 50% { box-shadow: 0 0 0 4px rgba(228, 87, 46, .35); } }
@keyframes latidoVerdeArena { 50% { box-shadow: 0 0 0 4px rgba(34, 197, 94, .35); } }
.acciones { max-width: 560px; width: 100%; margin: 8px auto 0; padding: 10px; border-radius: 16px; background: rgba(19, 35, 59, .94); }
@keyframes brilloSalvaje { 50% { box-shadow: 0 0 0 3px rgba(250, 204, 21, .5); } }
.registro { min-height: 22px; margin: 6px auto 0; text-align: center; font-weight: 600; font-size: 14px; text-shadow: 0 1px 3px #000; }
.numero { position: fixed; z-index: 5; pointer-events: none; font-weight: 800; font-size: 22px; text-shadow: 0 2px 0 #0a1424, 0 0 8px rgba(0,0,0,.6);
  transform: translate(-50%, -50%); animation: subir 1s ease-out forwards; }
.numero.cura { color: var(--verde); } .numero.dano { color: #fff; } .numero.fuerte { color: var(--amarillo); font-size: 26px; }
.numero.flojo { color: var(--piedra-2); font-size: 18px; } .numero.escudo { color: var(--agua); }
@keyframes subir { to { transform: translate(-50%, -160%); opacity: 0; } }
.destello { position: fixed; inset: 0; pointer-events: none; background: radial-gradient(circle, rgba(250, 204, 21, .65), rgba(250, 204, 21, 0) 70%);
  opacity: 0; transition: opacity .2s; }
.destello.on { opacity: 1; }
.cartel { position: fixed; left: 50%; top: 38%; transform: translate(-50%, -50%); font-weight: 800; font-size: clamp(30px, 9vw, 56px);
  text-shadow: var(--sombra-talla); pointer-events: none; animation: cartel 1.1s ease-out forwards; white-space: nowrap; }
@keyframes cartel { 0% { opacity: 0; transform: translate(-50%, -40%) scale(.9); } 20%, 75% { opacity: 1; transform: translate(-50%, -50%) scale(1); } 100% { opacity: 0; } }

/* ---------- Resultado */
.resultado { text-align: center; padding-top: 12vh; }
.resultado .titulo { font-size: clamp(44px, 13vw, 84px); }
.resultado.perdida .titulo { color: var(--piedra-2); }
.botin { display: flex; justify-content: center; flex-wrap: wrap; gap: 10px; margin: 18px 0; }
.botin span { min-width: 104px; padding: 12px 16px; border-radius: var(--radio); background: var(--noche); }
.botin b { display: block; font-size: 26px; font-weight: 800; color: var(--amarillo); }
.resultado .fila-botones { justify-content: center; }

@media (min-width: 900px) {
  .equipo-hud, .acciones { max-width: 640px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ---------- Cuenta atrás */
.marcador { display: flex; gap: 8px; align-items: center; min-width: 0; }
.tiempo { position: relative; width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center;
  background: conic-gradient(var(--verde) calc(var(--queda, 1) * 360deg), rgba(19, 35, 59, .85) 0); }
.tiempo::before { content: ""; position: absolute; inset: 4px; border-radius: 50%; background: var(--noche); }
.tiempo b { position: relative; font-size: 17px; font-weight: 800; font-variant-numeric: tabular-nums; }
.tiempo.poco { background: conic-gradient(var(--rojo) calc(var(--queda, 1) * 360deg), rgba(19, 35, 59, .85) 0); }
.tiempo.poco b { color: #ffb4a0; animation: latePoco .5s infinite alternate; }
@keyframes latePoco { to { transform: scale(1.15); } }

/* ---------- Cartas (estilo carta coleccionable: marco, cabecera, ilustración, cifra y pie) */
.acciones-quien { display: flex; justify-content: space-between; gap: 8px; margin: 0 0 8px; font-weight: 600; font-size: 14px; }
.acciones-quien small { color: var(--piedra-2); font-weight: 400; }
.hay-combo { color: #c4b5fd; animation: latePoco .6s infinite alternate; }
.mano { display: flex; gap: 8px; padding: 6px 2px 4px; overflow-x: auto; scroll-snap-type: x proximity; justify-content: safe center;
  scrollbar-width: none; }
.mano::-webkit-scrollbar { display: none; }
/* La carta (la misma en la mano y en la tienda: --w marca el tamaño). Marco del color del tipo, rareza, ilustración,
   nombre, cifra dentro de su forma (estallido = daño, escudo, gota = cura) y pie con el efecto y a quién va. */
.carta { --w: 112px; --c1: #ef4444; --c2: #7f1d1d; --c3: #fecaca; --brillo: rgba(239, 68, 68, .4); --el: #e2e8f0; --arte: 60px;
  position: relative; flex: 0 0 var(--w); width: var(--w); scroll-snap-align: center; padding: 3px; border: 0; color: #fff; text-align: center;
  border-radius: 11px; font-size: calc(var(--w) * .085); background: linear-gradient(145deg, var(--c3), var(--c1) 22%, var(--c2) 55%, var(--c1) 80%, var(--c3));
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .6), 0 6px 14px rgba(0, 0, 0, .5), 0 0 12px var(--brillo);
  animation: repartir .34s cubic-bezier(.2, .9, .3, 1.2) both; animation-delay: calc(var(--i) * 65ms); transition: transform .15s, box-shadow .15s; }
.carta:hover:not(:disabled), .carta:focus-visible, .carta[aria-pressed="true"] { transform: translateY(-9px); box-shadow: 0 0 0 2px #fff, 0 14px 22px rgba(0, 0, 0, .55), 0 0 18px var(--brillo); }
@keyframes repartir { from { opacity: 0; transform: translateY(70px) rotate(calc((var(--i) - 2) * 7deg)) scale(.8); } }
.carta:disabled { filter: grayscale(.85) brightness(.55); cursor: not-allowed; }
.k-cara { position: relative; display: flex; flex-direction: column; height: 100%; border-radius: 8px; overflow: hidden;
  background: linear-gradient(180deg, #13233b, #0a1424); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .3); }
.k-cabeza { display: flex; justify-content: space-between; align-items: center; gap: 2px; padding: .25em .45em; background: linear-gradient(90deg, var(--c2), transparent); }
.k-tipo { font-weight: 900; font-size: .78em; letter-spacing: .06em; text-transform: uppercase; color: var(--c3); white-space: nowrap; }
.k-tipo i { margin-right: .3em; }
.k-rareza { font-size: .66em; color: #facc15; white-space: nowrap; }
.k-arte { position: relative; height: var(--arte); margin: 0 .35em; border-radius: 6px; overflow: hidden; flex: none;
  box-shadow: 0 0 0 1px var(--c1); background: radial-gradient(circle at 50% 60%, var(--c1), var(--c2) 75%); }
.k-arte img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.k-arte img.k-mascota { object-fit: cover; transform: scale(1.5); transform-origin: 50% 45%; filter: drop-shadow(0 3px 4px rgba(0, 0, 0, .6)); }
.k-elemento { position: absolute; left: .3em; bottom: .3em; z-index: 1; width: 1.7em; height: 1.7em; border-radius: 50%; display: grid; place-items: center;
  font-size: .78em; background: #0a1424; box-shadow: 0 0 0 .14em var(--el); color: var(--el); }
.k-sello { position: absolute; right: .3em; top: .3em; z-index: 1; font-size: .7em; font-weight: 800; padding: .1em .5em; border-radius: 999px; background: #7c3aed; }
.carta .carta-nombre { position: relative; z-index: 1; margin: -.5em .55em 0; padding: .2em .3em; font-size: .98em; line-height: 1.12; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 800;
  border-radius: 5px; background: linear-gradient(180deg, var(--c1), var(--c2)); box-shadow: 0 2px 5px rgba(0, 0, 0, .6); text-shadow: 0 1px 2px rgba(0, 0, 0, .8); }
.carta .k-receta { font-size: .68em; color: #e9d5ff; line-height: 1.1; padding-top: .2em; }
.k-cifras { flex: 1; display: flex; align-items: center; justify-content: center; gap: .5em; padding: .35em .2em 0; }
.k-cifra { position: relative; isolation: isolate; display: grid; place-items: center; width: 3.1em; height: 3.1em; }
.k-cifra::before { content: ""; position: absolute; inset: 0; z-index: -1; }
.carta .k-cifra b { font-size: 1.25em; font-weight: 900; line-height: 1; text-shadow: 0 2px 3px rgba(0, 0, 0, .85); white-space: nowrap; }
.carta .k-cifra b.k-palabra { font-size: .78em; }
.carta .k-cifra small { position: absolute; top: 100%; font-size: .62em; font-weight: 700; color: #d6cfbd; white-space: nowrap; line-height: 1.2; }
.k-dano::before { background: radial-gradient(#fca5a5, #dc2626 60%, #7f1d1d);
  clip-path: polygon(50% 0, 61% 30%, 95% 18%, 72% 47%, 100% 62%, 66% 66%, 72% 100%, 50% 75%, 28% 100%, 34% 66%, 0 62%, 28% 47%, 5% 18%, 39% 30%); }
.k-escudo::before { background: linear-gradient(#bae6fd, #2563eb 70%, #1e3a8a); clip-path: polygon(50% 0, 96% 14%, 90% 58%, 50% 100%, 10% 58%, 4% 14%); }
.k-cura::before { background: radial-gradient(#bbf7d0, #16a34a 65%, #14532d); border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%; }
.k-poder::before { background: radial-gradient(#fef08a, #ca8a04 65%, #713f12); clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%); }
.k-pie { padding: 1.05em .3em .45em; font-size: .62em; color: #bfb39a; line-height: 1.3; }
.k-efecto { display: inline-flex; align-items: center; gap: .3em; font-weight: 800; color: #fff; padding: .1em .55em; border-radius: 999px; background: rgba(10, 20, 36, .85);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .2); }
.k-objetivo { display: block; }
.carta .recarga { position: absolute; inset: 0; z-index: 3; display: grid; place-items: center; border-radius: 11px; background: rgba(10, 20, 36, .55); font-weight: 800; font-size: 13px; }
/* Reflejo holográfico: en las especiales, combos y salvaje se mueve solo */
.k-holo { position: absolute; inset: 0; z-index: 2; border-radius: inherit; pointer-events: none; mix-blend-mode: color-dodge; opacity: 0;
  background: linear-gradient(115deg, transparent 40%, rgba(255, 0, 150, .3) 46%, rgba(0, 255, 255, .3) 50%, rgba(255, 255, 0, .3) 54%, transparent 60%); background-size: 250% 250%; }
.carta.tipo-especial .k-holo, .carta.combo .k-holo, .carta.salvaje .k-holo { opacity: .4; animation: holo 4s linear infinite; }
@keyframes holo { from { background-position: 0% 0%; } to { background-position: 100% 100%; } }
@media (prefers-reduced-motion: reduce) { .k-holo { animation: none !important; } }
/* Colores por tipo y por elemento */
.carta.tipo-defensa { --c1: #3b82f6; --c2: #1e3a8a; --c3: #bfdbfe; --brillo: rgba(59, 130, 246, .4); }
.carta.tipo-especial { --c1: #eab308; --c2: #713f12; --c3: #fef08a; --brillo: rgba(250, 204, 21, .55); }
.carta.combo { --c1: #a855f7; --c2: #3b0764; --c3: #e9d5ff; --brillo: rgba(168, 85, 247, .55); }
.carta.salvaje { --c1: #f97316; --c2: #78350f; --c3: #fde047; --brillo: rgba(250, 204, 21, .55); }
.carta.combo:not(:disabled) { animation: repartir .34s cubic-bezier(.2, .9, .3, 1.2) both, brilloCombo 1.2s .4s infinite; animation-delay: calc(var(--i) * 65ms), .4s; }
@keyframes brilloCombo { 50% { box-shadow: 0 0 0 1px rgba(0, 0, 0, .6), 0 0 24px rgba(168, 85, 247, .95); } }
.carta.salvaje:not(:disabled) { animation: repartir .34s cubic-bezier(.2, .9, .3, 1.2) both, brilloCarta 1.3s .4s infinite; animation-delay: calc(var(--i) * 65ms), .4s; }
@keyframes brilloCarta { 50% { box-shadow: 0 0 0 1px rgba(0, 0, 0, .6), 0 0 22px rgba(250, 204, 21, .9); } }
.k-fuego { --el: #fb923c; } .k-agua { --el: #38bdf8; } .k-planta { --el: #a3e635; } .k-ninguno { --el: #e2e8f0; }
@media (min-width: 700px) { .carta { --w: 124px; --arte: 70px; } }
/* Tienda: la carta grande */
.articulo-carta .carta { --w: 176px; --arte: 104px; animation: none; cursor: default; }
.articulo-carta .carta:hover { transform: none; }
.baraja { display: flex; flex-wrap: wrap; gap: 5px; }
.baraja .chapa svg { width: 13px; height: auto; vertical-align: -2px; }
.combo-chapa { background: #3b1a5e; }

.resumen-ronda { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.resumen-lista { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; flex: 1 1 240px; }
.resumen-lista button { border: 0; border-radius: 999px; padding: 6px 12px; background: var(--noche-2); font-size: 13px; }
.resumen-lista button b { color: var(--amarillo); font-weight: 600; }
#boton-listo { flex: 0 0 auto; min-height: 54px; font-size: 17px; padding: 0 28px; }
.tarjeta.cambiable { cursor: pointer; }

/* ---------- Duelos */
.duelos { margin-top: 8px; }
.salas { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 10px; }
.sala { display: grid; gap: 4px; justify-items: start; text-align: left; padding: 14px; border: 2px solid var(--verde-hondo);
  border-radius: var(--radio); background: var(--noche); }
.sala i { font-size: 22px; color: var(--verde); }
.sala b { font-size: 16px; }
.sala small { color: var(--piedra-2); }
.sala.gloria { border-color: #a37c00; background: linear-gradient(160deg, #2b2208, var(--noche) 70%); }
.sala.gloria i { color: var(--amarillo); }
.sala:disabled { opacity: .5; cursor: not-allowed; }
.invitaciones { list-style: none; margin: 0 0 10px; padding: 0; display: grid; gap: 8px; }
.invitaciones li, .duelo-activo { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; justify-content: space-between;
  padding: 10px 14px; border-radius: var(--radio); background: #1d3a2b; border: 2px solid var(--verde); }
.invitaciones .boton, .duelo-activo .boton { min-height: 40px; padding: 0 16px; }
.compartir { margin: 10px auto; padding: 14px; max-width: 420px; border-radius: var(--radio); background: var(--noche); }
.compartir b { font-size: 26px; letter-spacing: .12em; color: var(--amarillo); }
.dialogo { width: min(520px, calc(100% - 32px)); border: 0; border-radius: 18px; padding: 18px; background: var(--noche); color: var(--piedra); }
.dialogo::backdrop { background: rgba(5, 10, 20, .7); }
.dialogo h2 { margin-top: 0; }
.dialogo input { accent-color: var(--verde); }
.lista-amigos { list-style: none; margin: 12px 0; padding: 0; display: grid; gap: 6px; max-height: 40vh; overflow-y: auto; }
.lista-amigos li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 12px; background: var(--noche-2); }
.lista-amigos small { display: block; color: var(--verde); }
.lista-amigos .boton { min-height: 38px; padding: 0 14px; }
.ronda { white-space: nowrap; }
.rival-estado { min-width: 0; max-width: 46vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; font-weight: 600; padding: 6px 12px; border-radius: 999px; background: rgba(19, 35, 59, .85); }
.rival-estado.listo { background: var(--verde-hondo); color: #dcfce7; }
@media (max-width: 420px) { .salas { grid-template-columns: 1fr; } }

/* ---------- Tarjetas del combate con la foto de cada mascota */
.tarjeta { display: flex; align-items: center; gap: 7px; }
.tarjeta-foto { flex: 0 0 auto; width: 38px; height: 38px; border-radius: 50%; object-fit: cover; background: #0b1627;
  box-shadow: 0 0 0 2px rgba(34, 197, 94, .7); }
.tarjeta.rival .tarjeta-foto { box-shadow: 0 0 0 2px rgba(228, 87, 46, .8); }
.icono-rival { display: grid; place-items: center; color: #ffb38f; font-size: 17px; }
.tarjeta-datos { flex: 1; min-width: 0; display: block; }
.tarjeta-datos > span { display: block; }
.tarjeta-datos .nombre { display: flex; }
.tarjeta-datos .estados { display: flex; }
.tarjeta-especie { display: block; font-size: 10px; color: var(--piedra-2); margin-top: -1px; }
.tarjeta.caida .tarjeta-foto { filter: grayscale(1); }
.acciones-objetivo { margin: -2px 0 6px; font-size: 12.5px; color: #ffcbb8; }
.acciones-objetivo b { color: #fff; }
.criatura-foto { width: 52px; height: 52px; margin-bottom: 4px; }

/* ---------- Guía */
.botones-hud { display: flex; gap: 8px; }
.guia { max-height: calc(100vh - 32px); overflow-y: auto; }
.guia h3 { margin: 16px 0 8px; font-size: 16px; }
.guia-pasos, .guia-cartas { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.guia-pasos li, .guia-cartas li { display: grid; grid-template-columns: 38px 1fr; gap: 10px; align-items: start; }
.guia-pasos li > i { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 50%; background: var(--verde-hondo); color: #dcfce7; }
.guia b { display: block; }
.guia-pasos div, .guia-cartas div { color: var(--piedra-2); font-size: 14px; }
.guia-pasos div b, .guia-cartas div b { color: var(--piedra); }
.mini-carta { width: 32px; height: 44px; border-radius: 6px; display: grid; place-items: center; color: #fff; border: 2px solid var(--verde); }
.mini-carta.ataque { background: linear-gradient(160deg, #fb923c, #7c2d12); }
.mini-carta.defensa { background: linear-gradient(160deg, #7dd3fc, #1e3a5f); border-color: #60a5fa; }
.mini-carta.combo { background: linear-gradient(160deg, #a855f7, #3b0764); border-color: #a78bfa; }
.mini-carta.salvaje { background: linear-gradient(160deg, #fde047, #78350f); border-color: #facc15; }
.guia-elementos span { font-weight: 700; white-space: nowrap; }

/* ---------- Móvil: cartas más bajas y tarjetas que se reparten el ancho (que no tapen a las mascotas) */
.equipo-hud .tarjeta { flex: 1 1 0; max-width: 230px; }
@media (max-width: 480px) {
  .carta { --w: 98px; --arte: 44px; }
  .k-objetivo { display: none; }
  .k-pie { padding-bottom: .55em; }
  .tarjeta { padding: 5px 7px 6px; gap: 5px; }
  .tarjeta-foto { width: 30px; height: 30px; }
  .acciones { padding: 8px; }
  .acciones-quien { margin-bottom: 4px; }
}
@media (min-width: 760px) { .acciones { max-width: 780px; } .equipo-hud { max-width: 780px; } }

/* Frases rápidas del duelo */
.frases { position: absolute; top: 56px; right: 12px; z-index: 6; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 10px;
          width: min(300px, calc(100vw - 24px)); border-radius: 16px; background: rgba(19, 35, 59, .96); box-shadow: 0 10px 30px rgba(0, 0, 0, .45); }
.frases[hidden] { display: none; }
.frases button { min-height: 44px; padding: 6px 8px; border: 1px solid rgba(255, 255, 255, .14); border-radius: 12px; background: rgba(255, 255, 255, .08);
                 color: #fff; font: 600 14px Poppins, sans-serif; cursor: pointer; }
.frases button:hover, .frases button:focus-visible { background: var(--verde-hondo); }
.bocadillo-duelo { justify-self: center; width: fit-content; max-width: 80vw; margin: 6px auto; padding: 8px 14px; border-radius: 16px; font-weight: 700; font-size: 15px;
                   background: #fff; color: #13233b; box-shadow: 0 6px 18px rgba(0, 0, 0, .4); }
.bocadillo-duelo[hidden] { display: none; }
.bocadillo-duelo.mio { background: #facc15; }
.bocadillo-duelo.sale { animation: bocadillo-sale .25s ease-out; }
@keyframes bocadillo-sale { from { transform: scale(.7); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .bocadillo-duelo.sale { animation: none; } }
.frases .frases-escribir { grid-column: 1 / -1; background: var(--verde-hondo); }

/* ---------- Tienda */
.tienda-saldo b { color: var(--amarillo); }
.pestanas { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0; }
.pestanas button { min-height: 44px; padding: 0 16px; border: 0; border-radius: 999px; background: var(--noche); color: var(--piedra-2); font-weight: 600; }
.pestanas button[aria-selected="true"] { background: var(--verde-hondo); color: #fff; }
#tienda .panel { max-width: 980px; }
.tienda-rejilla { grid-template-columns: repeat(4, 1fr); }  /* 4 por fila; 3 y 2 en pantallas más estrechas */
@media (max-width: 860px) { .tienda-rejilla { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 600px) { .tienda-rejilla { grid-template-columns: repeat(2, 1fr); } }
.articulo { display: grid; justify-items: center; gap: 4px; padding: 14px 10px; border-radius: var(--radio); background: var(--noche); text-align: center; }
.articulo img { width: 96px; height: 96px; object-fit: contain; }
.articulo b { font-weight: 700; }
.articulo small { color: var(--piedra-2); font-size: 13px; }
.articulo .boton { min-height: 40px; padding: 0 16px; margin-top: 6px; }
.articulo.tuyo { outline: 2px solid var(--verde-hondo); }
.tienda-tuyo { margin-top: 10px; font-weight: 700; color: var(--verde); }
.tienda-falta { margin-top: 10px; font-size: 13px; font-weight: 600; color: var(--piedra-2); }
.tienda-mas { margin-top: 18px; }

/* Menú también arriba, y cartas especiales (doradas) */
.menu-arriba { margin: 26px 0 18px; }  /* separado de «Desafiar a un amigo» */
.mini-carta.especial { background: linear-gradient(160deg, #a16207, #facc15); color: #3a2a00; }
.articulo { grid-template-rows: auto auto 1fr auto auto; align-content: start; }
.tienda-precio { font-weight: 700; color: var(--amarillo); }
.tienda-desc { font-size: 13px; line-height: 1.4; }
.tienda-boton { width: 100%; min-height: 42px !important; padding: 0 10px !important; font-size: 14px; }
.tienda-boton:disabled { filter: none; opacity: 1; background: rgba(255, 255, 255, .06); color: var(--piedra-2); }


/* Desafíos de hoy (3 al día, 20 IMP cada uno) */
.diarios { margin: 14px 0 0; padding: 12px 14px; border-radius: var(--radio); background: var(--noche); }
.diarios h2 { margin: 0 0 8px; font-size: 16px; }
.diarios h2 .fas { color: #facc15; margin-right: 6px; }
.diarios ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.diarios li { display: flex; align-items: center; gap: 12px; justify-content: space-between; }
.diarios li > span:first-child { flex: 1; min-width: 0; display: grid; gap: 5px; font-size: 14px; }
.diario-barra { display: block; height: 7px; border-radius: 4px; background: rgba(255, 255, 255, .12); overflow: hidden; }
.diario-barra i { display: block; height: 100%; background: #22c55e; border-radius: 4px; }
.diario-premio { flex: none; font-size: 13px; color: var(--piedra-2); }
.diarios li.hecho b { color: var(--piedra-2); }
.diarios li.hecho .diario-premio { color: #4ade80; font-weight: 700; }

/* Adornos de la tienda */
  background: radial-gradient(circle, color-mix(in srgb, var(--c) 35%, transparent), transparent 70%); box-shadow: 0 0 0 2px color-mix(in srgb, var(--c) 60%, transparent); }

/* Marcos de las tarjetas del combate (cosmético «marco») */
.tarjeta.marco-marco_oro { border-color: #facc15; box-shadow: 0 0 10px rgba(250, 204, 21, .45); }
.tarjeta.marco-marco_esmeralda { border-color: #10b981; box-shadow: 0 0 10px rgba(16, 185, 129, .45); }
.tarjeta.marco-marco_fuego { border-color: #f97316; box-shadow: 0 0 12px rgba(249, 115, 22, .6), inset 0 0 8px rgba(249, 115, 22, .3); }
.tarjeta.marco-marco_diamante { border-color: #e0f2fe; box-shadow: 0 0 12px rgba(186, 230, 253, .7); }
@media (prefers-reduced-motion: no-preference) {
  .tarjeta.marco-marco_fuego { animation: marco-latir 1.6s ease-in-out infinite; }
  .tarjeta.marco-marco_diamante { animation: marco-brillo 2.4s ease-in-out infinite; }
}
@keyframes marco-latir { 50% { box-shadow: 0 0 18px rgba(249, 115, 22, .85), inset 0 0 10px rgba(249, 115, 22, .45); } }
@keyframes marco-brillo { 50% { box-shadow: 0 0 20px rgba(255, 255, 255, .9); border-color: #fff; } }
@media (max-width: 420px) { .articulo-carta .carta { --w: 150px; --arte: 88px; } }
.articulo .k-arte img { width: 100%; height: 100%; object-fit: cover; }  /* que no le afecte el tamaño de las fotos de la tienda */
.articulo .k-arte img.k-mascota { object-fit: cover; }
.carta .carta-nombre.k-largo { font-size: .8em; padding: .32em .3em; }  /* nombres largos: una sola línea, así todas las cartas miden lo mismo */

/* Marcos (adorno «marco»): el borde de tus cartas de la mano y de tus tarjetas de vida */
.carta.marco-marco_oro { background: linear-gradient(145deg, #fff7c2, #facc15 25%, #a16207 55%, #facc15 80%, #fff7c2); box-shadow: 0 0 0 1px rgba(0, 0, 0, .6), 0 6px 14px rgba(0, 0, 0, .5), 0 0 16px rgba(250, 204, 21, .75); }
.carta.marco-marco_esmeralda { background: linear-gradient(145deg, #d1fae5, #10b981 25%, #065f46 55%, #10b981 80%, #d1fae5); box-shadow: 0 0 0 1px rgba(0, 0, 0, .6), 0 6px 14px rgba(0, 0, 0, .5), 0 0 16px rgba(16, 185, 129, .75); }
.carta.marco-marco_fuego { background: linear-gradient(145deg, #fde68a, #f97316 25%, #7c2d12 55%, #ef4444 80%, #fde68a); background-size: 200% 200%; box-shadow: 0 0 0 1px rgba(0, 0, 0, .6), 0 0 18px rgba(249, 115, 22, .85); }
.carta.marco-marco_oro, .carta.marco-marco_esmeralda, .carta.marco-marco_fuego, .carta.marco-marco_diamante { padding: 4px; }
.carta.marco-marco_diamante { background: linear-gradient(145deg, #ffffff, #bae6fd 22%, #7dd3fc 42%, #f0f9ff 58%, #38bdf8 78%, #ffffff); background-size: 200% 200%; box-shadow: 0 0 0 1px rgba(0, 0, 0, .6), 0 0 18px rgba(186, 230, 253, .9); }
.carta.marco-marco_diamante::after { content: ""; position: absolute; inset: 0; z-index: 4; pointer-events: none; border-radius: inherit;
  background: radial-gradient(circle at 12% 8%, #fff 0 1.5px, transparent 2.5px), radial-gradient(circle at 90% 22%, #fff 0 1.5px, transparent 2.5px),
    radial-gradient(circle at 8% 70%, #fff 0 1px, transparent 2px), radial-gradient(circle at 94% 88%, #fff 0 1.5px, transparent 2.5px), radial-gradient(circle at 50% 2%, #fff 0 1px, transparent 2px); }
@media (prefers-reduced-motion: no-preference) {
  .carta.marco-marco_fuego, .carta.marco-marco_diamante { animation: repartir .34s cubic-bezier(.2, .9, .3, 1.2) both, marco-brillo-carta 2.2s .4s ease-in-out infinite; animation-delay: calc(var(--i) * 65ms), .4s; }
  .carta.marco-marco_diamante::after { animation: destellos 1.6s ease-in-out infinite; }
}
@keyframes marco-brillo-carta { 50% { background-position: 100% 100%; } }
@keyframes destellos { 50% { opacity: .2; } }

/* Adornos en la tienda: cada uno se ve en acción (aura girando, golpe de color, celebración, carta con el marco) */
.prev { position: relative; display: block; width: 100%; height: 128px; margin-bottom: 8px; border-radius: 12px; overflow: hidden;
  background: radial-gradient(ellipse at 50% 70%, #24406a, #0a1424 75%); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .08); }
.prev-mascota { position: absolute; left: 50%; bottom: 14px; width: 92px; height: 92px; transform: translateX(-50%); object-fit: contain; z-index: 2;
  filter: drop-shadow(0 6px 6px rgba(0, 0, 0, .6)); }
.prev-aura .anillo { position: absolute; left: 50%; bottom: 4px; width: 128px; height: 40px; transform: translateX(-50%); z-index: 1; border-radius: 50%;
  background: radial-gradient(closest-side, transparent 45%, var(--c) 62%, transparent 75%); box-shadow: 0 0 22px var(--c); opacity: .95; }
.prev-aura .anillo::before { content: ""; position: absolute; inset: 0; border-radius: 50%;
  background: repeating-conic-gradient(from 0deg, rgba(255, 255, 255, .85) 0 8deg, transparent 8deg 60deg); mask: radial-gradient(closest-side, transparent 52%, #000 58%, transparent 70%); }
.prev-aura .luz { position: absolute; left: 50%; bottom: 10px; width: 90px; height: 110px; transform: translateX(-50%); background: radial-gradient(ellipse at 50% 100%, color-mix(in srgb, var(--c) 45%, transparent), transparent 70%); }
.prev-ataque .zarpa { position: absolute; top: 20px; left: calc(50% + 4px); z-index: 3; width: 10px; height: 86px; border-radius: 9px; background: linear-gradient(#fff, var(--c)); box-shadow: 0 0 12px var(--c);
  transform: rotate(28deg); transform-origin: top; }
.prev-ataque .zarpa:nth-child(3) { left: calc(50% - 16px); top: 26px; }
.prev-ataque .zarpa:nth-child(4) { left: calc(50% - 36px); top: 32px; }
.prev-ataque .golpe { position: absolute; top: 26px; left: calc(50% - 45px); z-index: 3; width: 90px; height: 90px; border-radius: 50%; background: radial-gradient(#fff 0 12%, var(--c) 30%, transparent 70%); opacity: 0; }
.prev-ataque.arcoiris { --c: #f43f5e; }
.prev-victoria i { position: absolute; top: -20px; z-index: 3; display: grid; place-items: center; font-style: normal; }
.prev-victoria .moneda { width: 26px; height: 26px; border-radius: 50%; font: 900 8px Poppins, sans-serif; color: #b77905;
  background: radial-gradient(circle at 35% 30%, #fff6b0, #facc15 45%, #c88a04 85%); box-shadow: inset 0 0 0 2px #a86d00, 0 2px 4px rgba(0, 0, 0, .4); }
.prev-victoria .papel { width: 8px; height: 13px; border-radius: 2px; }
.prev-victoria .fuego { top: 0; width: 0; height: 0; }  /* centro del estallido; las chispas son sus hijas */
.prev-victoria .fuego b { position: absolute; left: -3px; top: -3px; width: 6px; height: 6px; border-radius: 50%; background: var(--f); box-shadow: 0 0 8px var(--f);
  transform: rotate(var(--a)) translateX(0); opacity: 0; }
.prev-marco { display: grid; place-items: center; }
.prev-marco .carta { --w: 82px; --arte: 44px; animation: none; }
.prev-marco .k-objetivo, .prev-marco .k-pie { display: none; }
@media (prefers-reduced-motion: no-preference) {
  .prev-aura .anillo::before { animation: girar-aura 3s linear infinite; }
  .prev-aura.rapida .anillo::before { animation-duration: 1s; }
  .prev-aura .anillo { animation: latir-aura 1.8s ease-in-out infinite; }
  .prev-ataque .zarpa { animation: zarpazo 1.6s ease-in infinite; }
  .prev-ataque .zarpa:nth-child(3) { animation-delay: .06s; }
  .prev-ataque .zarpa:nth-child(4) { animation-delay: .12s; }
  .prev-ataque .golpe { animation: golpe-prev 1.6s ease-out infinite; }
  .prev-ataque.arcoiris .zarpa, .prev-ataque.arcoiris .golpe { animation-name: zarpazo, arcoiris-prev; animation-duration: 1.6s, 3.2s; animation-timing-function: ease-in, linear; }
  .prev-ataque.arcoiris .golpe { animation-name: golpe-prev, arcoiris-prev; }
  .prev-victoria .moneda, .prev-victoria .papel { animation: caer-prev 2.2s linear infinite; animation-delay: var(--d); }
  .prev-victoria .fuego b { animation: chispa-prev 1.8s ease-out infinite; animation-delay: var(--d); }
}
@keyframes girar-aura { to { transform: rotate(360deg); } }
@keyframes latir-aura { 50% { opacity: .6; } }
@keyframes zarpazo { 0%, 45% { transform: rotate(28deg) scaleY(0); opacity: 1; } 60% { transform: rotate(28deg) scaleY(1); opacity: 1; } 85%, 100% { transform: rotate(28deg) scaleY(1); opacity: 0; } }
@keyframes golpe-prev { 0%, 55% { opacity: 0; transform: scale(.4); } 65% { opacity: 1; transform: scale(1); } 100% { opacity: 0; transform: scale(1.4); } }
@keyframes arcoiris-prev { to { filter: hue-rotate(360deg); } }
@keyframes caer-prev { from { transform: translateY(0) rotate(0); } to { transform: translateY(170px) rotate(540deg); } }
@keyframes chispa-prev { 0% { opacity: 0; transform: rotate(var(--a)) translateX(0); } 10% { opacity: 1; } 100% { opacity: 0; transform: rotate(var(--a)) translateX(30px) translateY(8px); } }
.articulo-adorno .tienda-precio { margin-top: 2px; }

/* Combo legendario: marco dorado y morado que brilla (y 5 estrellas) */
.carta.legendario { --c1: #a855f7; --c2: #3b0764; --c3: #fde68a; --brillo: rgba(250, 204, 21, .7);
  background: linear-gradient(145deg, #fff7c2, #facc15 18%, #a855f7 45%, #3b0764 60%, #facc15 82%, #fff7c2); background-size: 200% 200%; }
.carta.legendario .k-rareza { color: #fde047; text-shadow: 0 0 6px rgba(250, 204, 21, .9); }
.carta.legendario .k-holo { opacity: .55; }
@media (prefers-reduced-motion: no-preference) {
  .carta.legendario { animation: repartir .34s cubic-bezier(.2, .9, .3, 1.2) both, legendario-brillo 2.4s .4s ease-in-out infinite; animation-delay: calc(var(--i) * 65ms), .4s; }
  .articulo-carta .carta.legendario { animation: legendario-brillo 2.4s ease-in-out infinite; }
}
@keyframes legendario-brillo { 50% { background-position: 100% 100%; box-shadow: 0 0 0 1px rgba(0, 0, 0, .6), 0 0 26px rgba(250, 204, 21, .85); } }
.tienda-sub { display: flex; align-items: center; gap: 8px; margin: 26px 0 4px; font-size: 18px; }
.tienda-sub .fas { color: var(--amarillo); }

/* ---------- Pantallas bajas en horizontal (móvil tumbado): rivales en la barra de arriba, tu equipo en una columna a la
   izquierda y la mano de cartas a la derecha, para que las cartas entren enteras */
@media (orientation: landscape) and (max-height: 560px) {
  #hud { padding: max(6px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right)) max(6px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left)); }
  #hud > div:first-child { position: relative; }
  .redondo { width: 36px; height: 36px; }
  .ronda { font-size: 13px; padding: 5px 11px; }
  .tiempo { width: 38px; height: 38px; }
  .tiempo b { font-size: 15px; }
  #hud-rivales.equipo-hud { position: absolute; top: 0; left: 50%; transform: translateX(-50%); width: min(480px, calc(100vw - 340px)); max-width: none; margin: 0; }
  .tarjeta { padding: 4px 7px 5px; gap: 5px; border-radius: 10px; }
  .tarjeta-foto { width: 26px; height: 26px; }
  .tarjeta .nombre { font-size: 11px; }
  .tarjeta .vida { height: 7px; margin-top: 3px; }
  .tarjeta .salvaje { height: 3px; margin-top: 3px; }
  .tarjeta .estados { min-height: 0; margin-top: 2px; }
  .tarjeta-especie { display: none; }
  #hud > div:last-child { display: grid; grid-template-columns: clamp(130px, 21vw, 200px) minmax(0, 1fr); align-items: end; gap: 8px; }
  #hud > div:last-child > :not(#hud-aliados):not(#acciones) { grid-column: 1 / -1; }
  #hud-aliados.equipo-hud { flex-direction: column; gap: 5px; width: auto; max-width: none; margin: 0; }
  #hud-aliados .tarjeta { flex: none; max-width: none; }
  #acciones.acciones { grid-column: 2; max-width: none; margin: 0; padding: 6px 8px; }
  #acciones[hidden] { display: none !important; }
  .acciones-quien { margin: 0 0 2px; font-size: 13px; }
  .acciones-objetivo { margin: 0 0 2px; font-size: 12px; }
  .carta { --w: clamp(78px, 11.2vw, 96px); --arte: 32px; }
  .mano { gap: 6px; }
  .k-objetivo { display: none; }
  .k-pie { padding-bottom: .5em; }
  .mano { padding-top: 10px; }
  #boton-listo { min-height: 46px; font-size: 15px; padding: 0 20px; }
  .registro { min-height: 18px; margin: 0; font-size: 13px; }
  .cartel { top: 30%; }
}
