/* ---------- Cajas sorpresa ---------- */
.lootbox { --s: 1; position: relative; width: calc(120px * var(--s)); height: calc(108px * var(--s)); filter: drop-shadow(0 calc(10px * var(--s)) calc(18px * var(--s)) color-mix(in srgb, var(--c) 45%, transparent)); }
.lootbox .lid, .lootbox .body { position: absolute; background: linear-gradient(160deg, var(--c), var(--c2)); overflow: hidden; }
.lootbox .lid { top: 0; left: calc(-7px * var(--s)); right: calc(-7px * var(--s)); height: calc(32px * var(--s)); border-radius: calc(8px * var(--s)); z-index: 2; box-shadow: inset 0 calc(-4px * var(--s)) 0 rgba(0,0,0,.18), inset 0 calc(3px * var(--s)) 0 rgba(255,255,255,.25); }
.lootbox .body { top: calc(28px * var(--s)); left: 0; right: 0; bottom: 0; border-radius: calc(4px * var(--s)) calc(4px * var(--s)) calc(12px * var(--s)) calc(12px * var(--s)); box-shadow: inset 0 calc(-6px * var(--s)) 0 rgba(0,0,0,.15); }
.lootbox .lid::before, .lootbox .body::before { content: ""; position: absolute; left: 50%; top: 0; bottom: 0; width: calc(18px * var(--s)); margin-left: calc(-9px * var(--s)); background: rgba(255,255,255,.88); }
.lootbox .body::after { content: ""; position: absolute; inset: 0; background: linear-gradient(105deg, transparent 30%, rgba(255,255,255,.35) 45%, transparent 60%); transform: translateX(-120%); animation: boxShine 3.2s ease-in-out infinite; }
.lootbox .q { position: absolute; left: 50%; top: 58%; transform: translate(-50%, -50%); z-index: 3; width: calc(34px * var(--s)); height: calc(34px * var(--s)); border-radius: 50%; background: #fff; color: var(--c2); font-weight: 900; font-size: calc(20px * var(--s)); display: flex; align-items: center; justify-content: center; box-shadow: 0 2px 6px rgba(0,0,0,.2); }
@keyframes boxShine { 0%, 55% { transform: translateX(-120%) } 85%, 100% { transform: translateX(120%) } }
@keyframes float { 0%, 100% { transform: translateY(0) rotate(-1.5deg) } 50% { transform: translateY(-6px) rotate(1.5deg) } }

.box-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 16px; }
.box-tile { position: relative; border: 0; border-radius: 16px; padding: 22px 12px 14px; background: #fff; display: flex; flex-direction: column; align-items: center; gap: 12px; overflow: hidden; text-align: center; transition: transform .18s var(--ease-out); }
.box-tile::before { content: ""; position: absolute; inset: 0; background: radial-gradient(circle at 50% 35%, color-mix(in srgb, var(--c) 22%, transparent), transparent 65%); }
.box-tile > * { position: relative; }
.box-tile .lootbox { --s: .72; animation: float 3s ease-in-out infinite; }
.box-tile:nth-child(2n) .lootbox { animation-delay: -1.5s; }
.box-tile .rname { font-size: 11px; font-weight: 800; letter-spacing: 2px; color: var(--c2); }
.box-tile .open { height: 34px; padding: 0 16px; border-radius: 17px; background: var(--c2); color: #fff; font-size: 13px; font-weight: 800; display: flex; align-items: center; }
.box-tile:active { transform: scale(.97); }
.box-tile.r-legendaria { background: linear-gradient(160deg, #fff6dc, #fff); box-shadow: 0 0 0 2px #ffd97a inset; }
.box-tile.r-mitica { box-shadow: 0 0 0 2px #f7b4b4 inset; }
.enter .box-tile { animation: rise .55s var(--ease-out) both; animation-delay: calc(.12s + var(--i) * .06s); }
.rar-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--c); flex-shrink: 0; }
.odds-bar { display: flex; height: 10px; border-radius: 5px; overflow: hidden; margin-top: 8px; background: #eef0ec; }
.odds-bar span { height: 100%; }
.odds-legend { display: flex; flex-wrap: wrap; gap: 6px 12px; font-size: 11px; color: var(--muted); margin-top: 10px; }
.odds-legend i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 4px; }
.tier-0 { background: #cfd6cc; } .tier-1 { background: #8fcf6a; } .tier-2 { background: #4f8ff7; } .tier-3 { background: #b26cf7; } .tier-4 { background: #ffc93c; }
.home-boxes { display: flex; align-items: center; gap: 16px; background: linear-gradient(135deg, #2a1b5c, #0d1015); color: #fff; overflow: hidden; }
.home-boxes .lootbox { --s: .5; flex-shrink: 0; animation: float 3s ease-in-out infinite; }

/* Apertura */
.loot-overlay { position: absolute; inset: 0; z-index: 20; background: radial-gradient(circle at 50% 38%, color-mix(in srgb, var(--c) 35%, #0d1015), #05070a 72%); display: flex; flex-direction: column; align-items: center; justify-content: center; overflow: hidden; animation: fade .3s ease both; color: #fff; text-align: center; padding: 24px; }
.loot-overlay.closing { animation: fadeOut .25s ease both; }
.loot-rays { position: absolute; left: 50%; top: 38%; width: 900px; height: 900px; margin: -450px 0 0 -450px; background: repeating-conic-gradient(from 0deg, color-mix(in srgb, var(--c) 30%, transparent) 0 8deg, transparent 8deg 22deg); border-radius: 50%; -webkit-mask-image: radial-gradient(circle, #000 10%, transparent 60%); mask-image: radial-gradient(circle, #000 10%, transparent 60%); animation: ringSpin 18s linear infinite; opacity: .45; transition: opacity .6s; }
.phase-reveal .loot-rays { opacity: 1; animation-duration: 9s; }
.loot-stage { position: relative; height: 260px; width: 100%; display: flex; align-items: center; justify-content: center; }
.loot-overlay .lootbox { --s: 1.5; }
.phase-shake .lootbox { animation: charge 1.7s cubic-bezier(.5, 0, .9, .4) both; }
@keyframes charge {
  0% { transform: scale(.6); opacity: 0 } 12% { transform: scale(1.05); opacity: 1 } 18% { transform: scale(1) }
  25% { transform: rotate(-4deg) } 30% { transform: rotate(4deg) } 35% { transform: rotate(-5deg) } 40% { transform: rotate(5deg) }
  50% { transform: rotate(-7deg) scale(1.03) } 55% { transform: rotate(7deg) scale(1.05) } 60% { transform: rotate(-9deg) scale(1.07) }
  65% { transform: rotate(9deg) scale(1.09) } 70% { transform: rotate(-11deg) scale(1.11) } 75% { transform: rotate(11deg) scale(1.13) }
  80% { transform: rotate(-12deg) scale(1.15) } 85% { transform: rotate(12deg) scale(1.17) } 90% { transform: rotate(-6deg) scale(1.2) } 100% { transform: rotate(0) scale(1.24) }
}
.phase-reveal .lootbox { transform: scale(1.24); }
.phase-reveal .lootbox .lid { animation: lidOff .7s cubic-bezier(.2, .8, .3, 1) both; }
.phase-reveal .lootbox .body { animation: bodyDrop .6s ease-in .1s both; }
.phase-reveal .lootbox .q { display: none; }
@keyframes lidOff { to { transform: translate(40px, -220px) rotate(35deg); opacity: 0 } }
@keyframes bodyDrop { to { transform: translateY(60px) scale(.8); opacity: 0 } }
.flash { position: absolute; inset: 0; background: radial-gradient(circle at 50% 38%, #fff, color-mix(in srgb, var(--c) 60%, transparent) 30%, transparent 60%); animation: flash .9s ease-out both; pointer-events: none; z-index: 3; }
@keyframes flash { 0% { opacity: 0 } 15% { opacity: 1 } 100% { opacity: 0 } }
.particle { position: absolute; left: 50%; top: 50%; width: var(--z); height: var(--z); margin: calc(var(--z) / -2); border-radius: 2px; background: var(--pc); animation: burst var(--t) cubic-bezier(.15, .8, .3, 1) var(--dl) both; }
@keyframes burst { 0% { transform: rotate(var(--a)) translateY(0) scale(1); opacity: 1 } 100% { transform: rotate(var(--a)) translateY(calc(var(--d) * -1)) rotate(var(--sp)) scale(.3); opacity: 0 } }
.prize { position: absolute; display: flex; flex-direction: column; align-items: center; animation: prizeIn .8s var(--spring) .25s both; }
@keyframes prizeIn { 0% { transform: scale(.2) rotateY(180deg); opacity: 0 } 100% { transform: none; opacity: 1 } }
.prize-badge { width: 128px; height: 128px; border-radius: 28px; background: linear-gradient(160deg, var(--c), var(--c2)); display: flex; align-items: center; justify-content: center; font-size: 34px; font-weight: 900; color: #fff; box-shadow: 0 0 0 4px rgba(255,255,255,.9), 0 0 60px var(--c); letter-spacing: -1px; }
.loot-info { min-height: 170px; position: relative; z-index: 2; width: 100%; }
.loot-kicker { font-size: 12px; font-weight: 800; letter-spacing: 3px; color: var(--c); text-shadow: 0 0 20px var(--c); }
.loot-title { font-size: 34px; font-weight: 900; letter-spacing: -.8px; line-height: 1.05; margin-top: 8px; }
.loot-desc { font-size: 14px; color: #b9c0c8; margin-top: 8px; }
.phase-reveal .loot-info > * { animation: rise .5s var(--ease-out) both; }
.phase-reveal .loot-info > :nth-child(1) { animation-delay: .45s; } .phase-reveal .loot-info > :nth-child(2) { animation-delay: .55s; }
.phase-reveal .loot-info > :nth-child(3) { animation-delay: .65s; } .phase-reveal .loot-info > :nth-child(4) { animation-delay: .8s; }
.loot-actions { display: flex; flex-direction: column; gap: 10px; width: 100%; margin-top: 22px; }
.loot-actions .btn.ghost { border-color: rgba(255,255,255,.35); }
.loot-hint { font-size: 12px; font-weight: 800; letter-spacing: 3px; color: var(--c); animation: pulseTxt 1s ease-in-out infinite; }
@keyframes pulseTxt { 50% { opacity: .45 } }
.r-legendaria .prize-badge, .r-mitica .prize-badge { animation: legend 2s ease-in-out infinite; }
@keyframes legend { 50% { box-shadow: 0 0 0 4px #fff, 0 0 90px 12px var(--c) } }

/* ---------- Rangos: aro de progreso ---------- */
/* Barra de progreso hacia el siguiente nivel, con el color del nivel */
.rank-progress { margin-top: 14px; }
.rank-bar { height: 6px; border-radius: 3px; background: rgba(255,255,255,.12); overflow: hidden; }
.rank-bar > div { height: 100%; border-radius: 3px; background: linear-gradient(90deg, var(--rc2), var(--rc), var(--rc0)); box-shadow: 0 0 8px var(--rc); }
.rank-txt { display: flex; justify-content: space-between; font-size: 12px; color: #b9c0c8; margin-top: 7px; }
.rank-txt b { color: #fff; }

/* Aro de fondo de la cabecera: el mismo sitio y tamaño que el aro decorativo de antes */
.hero-bg { position: absolute; right: -90px; top: 20px; width: 260px; height: 260px; pointer-events: none; }
.hero-bg .rank-arc { opacity: .4; filter: none; }
.rank-ring-svg { display: block; overflow: visible; }
.rank-arc { filter: drop-shadow(0 0 4px var(--rc)); }

/* Nivel y lo que falta para el siguiente */
.rank-chip { display: inline-flex; align-items: center; gap: 7px; margin-top: 10px; height: 30px; padding: 0 12px 0 10px; border-radius: 15px; border: 1px solid color-mix(in srgb, var(--rc) 55%, transparent); background: color-mix(in srgb, var(--rc) 16%, transparent); color: #fff; font-size: 11px; font-weight: 800; letter-spacing: .5px; white-space: nowrap; transition: transform .18s var(--ease-out); }
.rank-chip b { color: var(--rc); font-weight: 900; }
.rank-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--rc); box-shadow: 0 0 8px var(--rc); }
.rank-chev { font-size: 16px; line-height: 1; opacity: .7; margin-left: 2px; }
.rank-chip:active { transform: scale(.96); }
.rank-arc.empty { opacity: 0; }
.ring-k, .ring-n, .ring-p { text-anchor: middle; fill: currentColor; font-family: 'Archivo', Arial, sans-serif; }
.ring-k { font-size: 9px; font-weight: 800; letter-spacing: 2px; fill-opacity: .6; }
.ring-n { font-size: 14px; font-weight: 900; letter-spacing: .5px; }
.ring-p { font-size: 11px; font-weight: 800; fill: var(--rc); }

/* En las hojas, el aro se llena al abrirse */
.sheet-badge { position: relative; display: flex; justify-content: center; color: var(--blue); animation: pop .6s var(--spring) .05s both; }
.sheet-badge .ring-p { fill: var(--rc2); }
.sheet .rank-arc, .rank-ladder .rank-arc { animation: arcIn 1.4s cubic-bezier(.22, 1, .36, 1) .35s both; }
@keyframes arcIn { from { stroke-dashoffset: 326.73 } }
.sheet-badge.up .rank-ring-svg { animation: rankIn 1s var(--spring) .1s both; }
@keyframes rankIn { 0% { transform: scale(.3) rotate(-90deg); opacity: 0 } 100% { transform: none; opacity: 1 } }
.badge-rays { position: absolute; left: 50%; top: 50%; width: 320px; height: 320px; margin: -160px 0 0 -160px; border-radius: 50%; background: repeating-conic-gradient(color-mix(in srgb, var(--rc, #5aae2e) 35%, transparent) 0 10deg, transparent 10deg 24deg); -webkit-mask-image: radial-gradient(circle, #000 15%, transparent 65%); mask-image: radial-gradient(circle, #000 15%, transparent 65%); animation: ringSpin 12s linear infinite, fade .6s ease both; }

/* Escalera de rangos */
.rank-ladder { margin-top: 18px; text-align: left; border-radius: 14px; background: #f6f8f5; overflow: hidden; }
.rank-row { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-top: 1px solid var(--line); animation: rise .45s var(--ease-out) both; animation-delay: calc(.25s + var(--i) * .05s); }
.rank-row:first-child { border-top: 0; }
.rank-row .grow { flex: 1; min-width: 0; }
.rank-row .t { font-size: 15px; font-weight: 800; color: var(--ink); }
.rank-row .s { font-size: 12px; color: var(--muted); }
.rank-row.current { background: #fff; box-shadow: inset 4px 0 0 var(--green); }
.rank-row.locked .rank-ring-svg { opacity: .45; }
.rank-row.locked .t { color: #8a918c; }
