/* ═══════════════════════════════════════════════════════════════════════
   Pantalla de inicio: accesos, personaje, liga + JUGAR y ranuras de sobres.
   Apaisado: tres columnas + fila de sobres. Vertical: columna con scroll.
   ═══════════════════════════════════════════════════════════════════════ */

.home {
  flex: 1; min-height: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) minmax(16rem, 31%);
  grid-template-rows: minmax(0, 1fr) auto;
  grid-template-areas: "tiles hero play" "packs packs packs";
  gap: .7rem 1.2rem;
  padding: .75rem var(--gutter) .6rem;
}

/* ── Accesos laterales ── */
.home-tiles {
  grid-area: tiles; align-self: center;
  display: grid; grid-template-columns: repeat(2, 6.3rem); grid-auto-rows: minmax(3.6rem, 6.4rem);
  gap: .55rem; max-height: 100%;
}
.tile {   /* botón cuadrado de dos tonos del kit con el icono a color y el nombre */
  --hi: #52c4ff; --lo: #1a8df2; --lip: #0b5fc0; --bink: #06224d;
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .1rem;
  min-height: 44px; padding: .3rem .2rem .5rem; border-radius: 16px; border: 2.5px solid var(--ink);
  background: linear-gradient(180deg, var(--hi) 0%, var(--hi) 49%, var(--lo) 51%, var(--lo) 100%);
  box-shadow: inset 0 1.5px 0 rgba(255,255,255,.7), inset 0 -5px 0 var(--lip), 0 4px 0 var(--ink), 0 8px 14px rgba(0,0,0,.3);
  transition: transform .07s; animation: rise-in .45s cubic-bezier(.2,1.2,.4,1) backwards; animation-delay: calc(var(--i) * 45ms);
}
.tile::before { content: ''; position: absolute; right: .5rem; top: .35rem; width: .6rem; height: .36rem; border-radius: 50%; background: rgba(255,255,255,.9); transform: rotate(32deg); pointer-events: none; }
.tile:active { transform: translateY(4px); box-shadow: inset 0 1.5px 0 rgba(255,255,255,.55), inset 0 -2px 0 var(--lip), 0 0 0 var(--ink); }
.tile-ico { width: 2.9rem; height: 2.9rem; filter: drop-shadow(0 2px 0 rgba(0,0,0,.3)); transition: transform .2s; }
.tile-ico .ico { width: 100%; height: 100%; }
.tile:hover .tile-ico { transform: scale(1.1) rotate(-4deg); }
.tile-label {
  font-family: var(--font-title); font-size: .86rem; line-height: 1.05; text-align: center; color: #fff;
  -webkit-text-stroke: .2em var(--bink); paint-order: stroke fill; text-shadow: 0 .07em 0 var(--bink);
}
.t-orange { --hi: #ffb14a; --lo: #ff7417; --lip: #c24a06; --bink: #4f1700; }
.t-blue   { --hi: #52c4ff; --lo: #1a8df2; --lip: #0b5fc0; --bink: #06224d; }
.t-green  { --hi: #c3fb0e; --lo: #63dc05; --lip: #3aa000; --bink: #173f00; }
.t-purple { --hi: #e785ff; --lo: #b334ec; --lip: #7a16b4; --bink: #2e0550; }
.t-teal   { --hi: #5fe0f2; --lo: #10abd0; --lip: #067ea1; --bink: #05303f; }
.t-red    { --hi: #ff7666; --lo: #ef3b2f; --lip: #b01d14; --bink: #4a0603; }

/* ── Personaje: la ficha completa sobre el foco dorado (ver .spot en ui.css) ── */
.home-hero {
  grid-area: hero; position: relative; min-height: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
}
.hero-stage { flex: 1 1 auto; width: 100%; min-height: 0; cursor: pointer; }
/* El lienzo sube un poco por encima del foco; la bota se apoya en la peana. */
.hero-canvas { position: absolute; left: 0; top: -5cqh; width: 100%; height: 100cqh; transform-origin: 50% 95%; }
.hero-stage.hop .hero-canvas { animation: hero-hop .55s cubic-bezier(.3,1.4,.5,1); }
@keyframes hero-hop { 0% { transform: none; } 30% { transform: translateY(-9%) scale(1.03, .98); } 60% { transform: scale(1.05, .95); } 100% { transform: none; } }

/* Placa del nombre: estrella del nivel a la izquierda, nombre grande en amarillo y, debajo, poder y
   potencia, sobre una placa de pizarra. */
.hero-plate {
  position: relative; z-index: 2; margin-top: -1.3rem; max-width: 100%;
  display: flex; align-items: center; gap: .55rem;
  padding: .3rem 1.1rem .4rem .45rem; border-radius: 16px;
  background: rgba(22, 18, 17, .78); border: 1.5px solid var(--ink);
  box-shadow: inset 0 0 0 1.5px rgba(255,255,255,.2), 0 .3rem .7rem rgba(0,0,0,.35);
}
.hero-plate::after { content: ''; position: absolute; right: .5rem; top: .35rem; width: .55rem; height: .3rem; border-radius: 50%; background: rgba(255,255,255,.55); transform: rotate(35deg); pointer-events: none; }
.hero-lvl { flex: none; margin: -.5rem 0 -.5rem -.2rem; }
.hero-lvl .level-badge.lvl-lg { width: 3.3rem; height: 3.3rem; }
.hero-plate-txt { display: flex; flex-direction: column; align-items: flex-start; gap: .15rem; min-width: 0; }
.hero-name { font-size: 1.9rem; line-height: 1.05; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; padding-right: .1em; }
.hero-meta { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.hero-rating { display: inline-flex; align-items: center; gap: .15rem; padding: .05rem .6rem .08rem .2rem; border-radius: 999px; white-space: nowrap;
  background: var(--well); border: 1.5px solid var(--ink); box-shadow: inset 0 0 0 1.5px rgba(255,255,255,.14); }
.hero-rating .ico { width: 1.35rem; height: 1.35rem; }
.hero-rating b { font-size: 1.05rem; }
.hero-change { position: absolute; top: .2rem; right: 0; z-index: 2; }
.hero-change .ico { width: 1.4em; height: 1.4em; }
/* Invitación a elegir apodo y bandera tras el primer partido (no bloquea nada). */
.hero-nudge {
  position: absolute; top: .2rem; left: 0; z-index: 2; display: inline-flex; align-items: center; gap: .35rem;
  min-height: 44px; max-width: 58%; padding: .25rem .8rem .35rem .45rem; border-radius: 14px;
  font-family: var(--font-title); font-size: max(12px, .92rem); line-height: 1.05; color: #fff; text-align: left;
  background: linear-gradient(180deg, #ffb14a 0 50%, #ff7417 50% 100%); border: 2.5px solid var(--ink);
  box-shadow: inset 0 1.5px 0 rgba(255,255,255,.7), inset 0 -4px 0 #c24a06, 0 3px 0 var(--ink);
  -webkit-text-stroke: .2em #4f1700; paint-order: stroke fill;
  animation: pop-in .5s .6s cubic-bezier(.2,1.5,.4,1) both, wiggle 1.2s ease-in-out 1.4s 2;
}
.hero-nudge .ico { width: 1.3em; height: 1.3em; flex: none; }

/* ── Liga + JUGAR ── */
.home-play { grid-area: play; display: flex; flex-direction: column; justify-content: center; gap: .9rem; min-height: 0; }
.league { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: .4rem; padding: .55rem .45rem; }
.lg-arrow { width: 44px; height: 44px; }
.lg-arrow[disabled] { opacity: .35; filter: grayscale(1); }
.lg-arrow::after { content: ''; position: absolute; inset: -4px -6px; }  /* área táctil ≥ 44 px */
.lg-view { position: relative; display: flex; flex-direction: column; gap: .35rem; min-width: 0; cursor: pointer; }
.lg-view.slide-l { animation: lg-slide-l .3s cubic-bezier(.2,1.2,.4,1); }
.lg-view.slide-r { animation: lg-slide-r .3s cubic-bezier(.2,1.2,.4,1); }
@keyframes lg-slide-l { from { opacity: 0; transform: translateX(26px); } to { opacity: 1; transform: none; } }
@keyframes lg-slide-r { from { opacity: 0; transform: translateX(-26px); } to { opacity: 1; transform: none; } }
.lg-stadium { width: 100%; aspect-ratio: 16 / 7; border-radius: 12px; border: 2.5px solid var(--ink); box-shadow: inset 0 0 0 1.5px rgba(255,255,255,.2), 0 3px 0 rgba(0,0,0,.35); }
.lg-info { display: flex; flex-direction: column; align-items: center; gap: .15rem; }
.lg-tier { font-weight: 800; font-size: max(11px, .76rem); letter-spacing: .08em; text-transform: uppercase; color: var(--accent); text-shadow: 0 1px 0 rgba(0,0,0,.6); }
.lg-name { font-size: 1.5rem; line-height: 1.05; text-align: center; color: var(--title); --sc: var(--title-ink); --sw: .2em; }
.lg-meta { display: flex; gap: .4rem; flex-wrap: wrap; justify-content: center; }
.lg-chip { display: inline-flex; align-items: center; gap: .3rem; padding: .08rem .55rem; border-radius: 999px; background: var(--well); border: 1.5px solid var(--ink); box-shadow: inset 0 0 0 1.5px rgba(255,255,255,.12); font-weight: 800; font-size: max(11px, .82rem); color: var(--text-dim); }
.lg-chip .amount { color: #fff; font-size: .95rem; -webkit-text-stroke: .2em var(--ink); paint-order: stroke fill; }
.lg-locked {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .15rem;
  border-radius: 12px; background: rgba(10,8,7,.72); backdrop-filter: grayscale(1);
  font-family: var(--font-title); font-size: 1.2rem;
}
.lg-locked .lg-lock-ico { width: 2.6rem; height: 2.6rem; filter: drop-shadow(0 3px 0 rgba(0,0,0,.4)); }
.lg-locked small { font-family: var(--font-body); font-weight: 700; font-size: .78rem; color: var(--text-dim); }

.play-wrap { position: relative; isolation: isolate; }
.play-btn { width: 100%; flex-direction: column; gap: 0; padding: .3em .6em .5em; font-size: 2.7rem; letter-spacing: .06em; }
.play-btn .play-label { line-height: 1; }
.play-btn .play-sub { display: inline-flex; align-items: center; gap: .25em; font-size: max(11px, .36em); letter-spacing: .02em; }
.play-btn .play-sub .ico { width: 1.25em; height: 1.25em; }
/* Latido de JUGAR: solo transform y opacidad (compuestos en la GPU). El resplandor verde es una
   capa aparte con la sombra fija que aparece y desaparece; animar box-shadow repintaba el botón
   en cada fotograma. */
.play-btn.pulse { animation: pulse 1.4s ease-in-out infinite; }
.play-btn.pulse:active { animation: none; }
.play-btn.is-disabled { filter: grayscale(.9) brightness(.8); }
.play-btn.is-disabled::after { display: none; }
.play-glow {
  position: absolute; inset: 0 0 6px; z-index: -1; border-radius: 22px; pointer-events: none;
  box-shadow: 0 0 34px 4px rgba(130,255,90,.6); opacity: 0;
}
.play-wrap.is-live .play-glow { animation: play-glow 1.4s ease-in-out infinite; }
@keyframes play-glow { 0%, 100% { opacity: 0; transform: scale(1); } 50% { opacity: 1; transform: scale(1.045); } }

/* ── Sobres ── */
.home-packs { grid-area: packs; display: flex; justify-content: center; align-items: stretch; gap: .6rem; height: 7.6rem; }
.slots { display: flex; gap: .6rem; }
.slot, .free-pack {   /* tarjeta turquesa como las de la tira, con el cristal arriba */
  position: relative; width: 7.4rem; height: 100%; padding: 1.3rem .3rem .4rem;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
  border-radius: 16px; border: 2.5px solid var(--ink);
  background: linear-gradient(180deg, var(--card-top) 0%, var(--card-bot) 100%);
  box-shadow: inset 0 0 0 1.5px rgba(255,255,255,.08), inset 0 -4px 0 rgba(0,0,0,.28), 0 3px 0 var(--ink), 0 8px 14px rgba(0,0,0,.3);
  transition: transform .07s;
}
.slot::before, .free-pack::before {   /* cristal de la mitad de arriba */
  content: ''; position: absolute; left: .32rem; right: .32rem; top: .3rem; height: 44%; border-radius: .6rem;
  background: rgba(172, 206, 220, .22); pointer-events: none;
}
.slot:active, .free-pack:active { transform: translateY(3px); }
.slot-pack { position: relative; flex: 1 1 auto; min-height: 0; display: flex; align-items: center; justify-content: center; width: 100%; }
.slot-pack .pack-art { height: 100%; max-height: 5rem; width: auto; filter: drop-shadow(0 4px 0 rgba(0,0,0,.35)); }
.slot-tag {
  position: absolute; top: .3rem; left: 0; right: 0; margin-inline: auto; width: fit-content; z-index: 2;
  display: inline-flex; align-items: center; gap: .2rem; padding: .08rem .5rem .1rem; border-radius: 999px; white-space: nowrap;
  font-family: var(--font-title); font-size: max(11px, .84rem); background: var(--well); border: 1.5px solid var(--ink); box-shadow: inset 0 0 0 1.5px rgba(255,255,255,.14);
  -webkit-text-stroke: .2em var(--ink); paint-order: stroke fill;
}
.slot-tag .ico { width: 1.1em; height: 1.1em; }
.slot-tag b { font-weight: 400; }
.slot-tag-time { background: linear-gradient(180deg, #ffb14a 0 50%, #ff7417 50% 100%); box-shadow: inset 0 1.5px 0 rgba(255,255,255,.6); }
.slot-tag-ready { background: linear-gradient(180deg, #c3fb0e 0 50%, #63dc05 50% 100%); box-shadow: inset 0 1.5px 0 rgba(255,255,255,.6); font-size: .95rem; -webkit-text-stroke-color: #173f00; animation: pulse 1s ease-in-out infinite; }
.slot-open, .slot-gems { position: relative; font-family: var(--font-title); font-size: .95rem; line-height: 1; margin-top: .15rem;
  -webkit-text-stroke: .2em var(--ink); paint-order: stroke fill; }
.slot-gems { display: inline-flex; align-items: center; gap: .2rem; padding: .05rem .5rem .08rem; border-radius: 999px; background: linear-gradient(180deg, #e785ff 0 50%, #b334ec 50% 100%); border: 1.5px solid var(--ink); font-size: .88rem; -webkit-text-stroke-color: #2e0550; }
.slot-gems .ico { width: 1.1em; height: 1.1em; }
.slot-empty { background: rgba(10,8,7,.32); box-shadow: inset 0 3px 8px rgba(0,0,0,.5); border-style: dashed; border-color: rgba(190,232,242,.4); justify-content: center; padding-top: .35rem; }
.slot-empty::before { display: none; }
.slot-empty-ico { width: 2rem; height: 2rem; opacity: .55; }
.slot-empty-ico .ico { width: 100%; height: 100%; }
.slot-hint { font-size: max(11px, .76rem); font-weight: 800; color: var(--text-dim); text-align: center; line-height: 1.1; }
.slot-unlocking::after { content: ''; position: absolute; inset: 3px; border-radius: 12px; border: 2px solid rgba(255,170,70,.8); box-shadow: 0 0 14px rgba(255,160,50,.55); animation: slot-glow 1.6s ease-in-out infinite; pointer-events: none; }
@keyframes slot-glow { 0%, 100% { opacity: .45; } 50% { opacity: 1; } }
.slot-ready { border-color: var(--ink); background: radial-gradient(circle at 50% 60%, color-mix(in srgb, var(--pk) 55%, #fff) 0%, #0f86a8 55%, #0b4d62 100%); box-shadow: 0 0 0 1.5px var(--ink), 0 0 .9rem rgba(45, 227, 245, .6), inset 0 0 0 2px rgba(45, 227, 245, .55), 0 3px 0 var(--ink); }
.slot-ready .slot-pack { animation: pack-bob 1.1s ease-in-out infinite; }
.slot-ready::before {
  inset: 0; left: 0; right: 0; top: 0; height: auto; border-radius: 13px; overflow: hidden;
  background: repeating-conic-gradient(from 0deg at 50% 60%, rgba(255,255,255,.22) 0 12deg, transparent 12deg 30deg);
  -webkit-mask-image: radial-gradient(circle at 50% 60%, #000 20%, transparent 70%); mask-image: radial-gradient(circle at 50% 60%, #000 20%, transparent 70%);
  animation: spin 9s linear infinite;
}
@keyframes pack-bob { 0%, 100% { transform: translateY(0) rotate(-3deg); } 50% { transform: translateY(-5px) rotate(3deg); } }

.free-pack { background: linear-gradient(180deg, #2f9a3c 0%, #1b6427 100%); padding-top: .35rem; }
.free-pack .fp-label { position: relative; font-size: .9rem; line-height: 1; white-space: nowrap; margin-top: .1rem; }
.free-pack .fp-time { position: relative; display: inline-flex; align-items: center; gap: .2rem; font-family: var(--font-title); font-size: max(11px, .82rem); color: #e2ffd6; min-height: 1em; -webkit-text-stroke: .2em var(--ink); paint-order: stroke fill; }
.free-pack .fp-time .ico { width: 1.1em; height: 1.1em; }
.free-pack.is-ready { background: radial-gradient(circle at 50% 45%, #d8ff6a 0%, #63dc05 55%, #2f7a05 100%); box-shadow: 0 0 0 1.5px var(--ink), 0 0 .9rem rgba(190, 255, 90, .6), 0 3px 0 var(--ink); }
.free-pack.is-ready .slot-pack { animation: pack-bob 1.1s ease-in-out infinite; }
.free-pack.is-ready .fp-label { font-size: 1.08rem; animation: pulse 1s ease-in-out infinite; -webkit-text-stroke-color: #173f00; }

/* ── Móvil apaisado (poca altura) ── */
@media (max-height: 500px) and (orientation: landscape) {
  .home { gap: .45rem .8rem; padding: .45rem var(--gutter) .45rem; grid-template-columns: auto minmax(0, 1fr) minmax(14.5rem, 33%); }
  .home-tiles { grid-template-columns: repeat(2, 5.6rem); grid-auto-rows: minmax(0, 1fr); gap: .4rem; align-self: stretch; }
  .tile { border-radius: 13px; padding: .15rem .15rem .35rem; }
  .tile-ico { width: 1.75rem; height: 1.75rem; }
  .tile-label { font-size: max(11px, .72rem); }
  .hero-name { font-size: 1.2rem; }
  .hero-plate { padding: .15rem .7rem .2rem .3rem; gap: .35rem; margin-top: -.7rem; }
  .hero-lvl .level-badge.lvl-lg { width: 2.4rem; height: 2.4rem; }
  .hero-lvl .level-badge.lvl-lg b { font-size: 1rem; }
  .hero-meta .hero-rating { display: none; }
  .power-chip { font-size: max(11px, .75rem); }
  .hero-change { padding: .2em .6em .35em; font-size: .85rem; }
  .league { padding: .35rem .3rem; }
  .lg-stadium { aspect-ratio: 16 / 5.2; }
  .lg-name { font-size: 1.05rem; }
  .lg-tier { display: none; }
  .lg-arrow { width: 38px; height: 38px; }
  .home-play { gap: .55rem; }
  .play-btn { font-size: 2rem; }
  .home-packs { height: 5.3rem; gap: .45rem; }
  .slots { gap: .45rem; }
  .slot, .free-pack { width: 6.4rem; padding-top: 1.15rem; }
  .free-pack { padding-top: .25rem; }
  .slot-pack .pack-art { max-height: 3.3rem; }
  .slot-tag { font-size: max(11px, .72rem); top: .2rem; }
}

/* ── Vertical (menús en el móvil) ── */
@media (orientation: portrait) {
  .home {
    grid-template-columns: minmax(0, 1fr); grid-template-rows: repeat(4, max-content);
    grid-template-areas: "hero" "play" "packs" "tiles";
    align-content: start; overflow-y: auto; overflow-x: hidden; gap: .8rem;
  }
  .home-hero { height: 19.5rem; }
  .home-play { gap: .7rem; }
  .play-btn { font-size: 2.4rem; }
  .home-packs { height: auto; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: .4rem; }
  .slots { display: contents; }
  .slot, .free-pack { width: auto; height: 6.4rem; padding: 1.15rem .15rem .3rem; }
  .free-pack { padding-top: .3rem; }
  .slot-pack .pack-art { max-height: 3.6rem; }
  .slot-tag { font-size: max(11px, .66rem); padding: .05rem .35rem; }
  .slot-hint { display: none; }
  .free-pack .fp-label { font-size: max(11px, .72rem); white-space: normal; text-align: center; }
  .home-tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); grid-auto-rows: 5.2rem; align-self: stretch; }
}
