/* armario — pantalla (v3) + hoja de recompensa (.rw-*). Dueño: agente ARMARIO.
   .wd-* solo en body[data-screen="wardrobe"]; .rw-* y comunes (.lens-ico, .item-ph, .ojito-ph) globales:
   la hoja de recompensa se abre desde niveles, resultado, etc. */

/* --- comunes ------------------------------------------------------------------ */
.lens-ico { display: inline-block; flex: none; vertical-align: middle; filter: drop-shadow(0 2px 6px rgba(124, 92, 255, 0.45)); }

.item-ph { display: grid; place-items: center; width: 100%; height: 100%; color: var(--ink-3); }
.item-ph svg { width: 46%; height: 46%; }

.ojito-ph { display: block; width: 100%; height: 100%; }
.ojito-ph svg { width: 100%; height: 100%; display: block; }

/* chip de rareza (colores del catálogo) */
.wd-rar,
.rw-rar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 20px;
  padding: 0 8px;
  border-radius: var(--radius-pill);
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  line-height: 1;
  white-space: nowrap;
  background: #2E2C45;
  color: #CFCBE8;
}
:is(.wd-rar, .rw-rar)[data-rar="raro"] { background: #1C3A66; color: #A9D0FF; }
:is(.wd-rar, .rw-rar)[data-rar="epico"] { background: #44237A; color: #DCC8FF; }
:is(.wd-rar, .rw-rar)[data-rar="legend"] { background: linear-gradient(135deg, #FFCF5A, #FF7A9C); color: #3A1330; }

/* --- pantalla --------------------------------------------------------------------- */
body[data-screen="wardrobe"] .wd {
  display: grid;
  gap: 16px;
  padding-bottom: 96px; /* hueco para la barra de probar */
}

.wd-stage-col,
.wd-closet-col { display: grid; gap: 14px; align-content: start; min-width: 0; }

/* escenario */
.wd-stage {
  --wd-c1: #9C8CFF;
  --wd-c2: #5B47D6;
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: grid;
  justify-items: center;
  padding: 14px 14px 18px;
  min-height: 360px;
  border-radius: var(--radius-2xl);
  background:
    radial-gradient(120% 80% at 50% 0%, color-mix(in srgb, var(--wd-c1) 26%, transparent), transparent 70%),
    var(--glass);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(160%);
  backdrop-filter: blur(var(--blur)) saturate(160%);
  box-shadow: var(--shadow-1), inset 0 1px 0 var(--glass-hi), inset 0 0 0 1px var(--glass-border);
  transition: background 500ms var(--ease-out);
}
.wd-skel { min-height: 360px; }

.wd-halo {
  position: absolute;
  z-index: -1;
  left: 50%;
  top: 46%;
  width: 320px;
  height: 320px;
  translate: -50% -50%;
  border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--wd-c1) 70%, transparent) 0%, color-mix(in srgb, var(--wd-c2) 40%, transparent) 40%, transparent 70%);
  filter: blur(18px);
  opacity: 0.75;
  animation: wd-halo 6s ease-in-out infinite alternate;
  transition: background 500ms var(--ease-out);
}
@keyframes wd-halo { from { scale: 0.92; opacity: 0.6; } to { scale: 1.06; opacity: 0.85; } }

.wd-stage-top {
  justify-self: stretch;
  display: flex;
  align-items: center;
  justify-content: flex-end; /* a la izquierda flota el botón atrás del shell */
  gap: 8px;
  min-height: 34px;
}
.wd-balance {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 0 14px 0 10px;
  border-radius: var(--radius-pill);
  background: var(--glass-strong);
  box-shadow: inset 0 0 0 1px var(--glass-border), 0 6px 18px rgba(124, 92, 255, 0.22);
  font-size: 16px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.wd-balance.is-bump { animation: wd-bump 520ms var(--ease-spring); }
@keyframes wd-bump { 0% { scale: 1; } 35% { scale: 1.14; } 100% { scale: 1; } }

.wd-trying {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  padding: 0 11px;
  border-radius: var(--radius-pill);
  background: var(--grad-brand-deep);
  color: #FFFFFF;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  box-shadow: var(--glow-brand);
  animation: anim-pop 420ms var(--ease-spring) backwards;
}
.wd-trying[hidden] { display: none; }
.wd-ico { display: inline-grid; place-items: center; flex: none; line-height: 0; }
.wd-ico svg { display: block; }

.wd-oj-btn {
  position: relative;
  z-index: 2;
  width: min(250px, 68vw);
  aspect-ratio: 200 / 220;
  margin-top: 4px;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  border-radius: 40%;
}
.wd-oj-btn:focus-visible { outline: 3px solid var(--brand-2); outline-offset: 4px; }
.wd-oj { width: 100%; height: 100%; display: grid; place-items: center; filter: drop-shadow(0 18px 22px rgba(0, 0, 0, 0.35)); }
.wd-oj > * { width: 100%; height: 100%; }
.wd-oj svg { width: 100%; height: 100%; display: block; }
.wd-oj-btn.is-jump .wd-oj { animation: wd-jump 560ms var(--ease-out-expo); }
.wd-oj-btn.is-spin .wd-oj { animation: wd-spin 720ms var(--ease-out-expo); }
@keyframes wd-jump {
  0% { transform: translateY(0) scale(1, 1); }
  18% { transform: translateY(2px) scale(1.08, 0.9); }
  45% { transform: translateY(-26px) scale(0.95, 1.06); }
  75% { transform: translateY(0) scale(1.05, 0.95); }
  100% { transform: translateY(0) scale(1, 1); }
}
@keyframes wd-spin {
  0% { transform: rotateY(0) translateY(0); }
  50% { transform: rotateY(180deg) translateY(-18px); }
  100% { transform: rotateY(360deg) translateY(0); }
}
.wd-stage.is-trying .wd-oj { filter: drop-shadow(0 18px 22px rgba(0, 0, 0, 0.35)) drop-shadow(0 0 18px color-mix(in srgb, var(--brand-2) 55%, transparent)); }

.wd-pedestal {
  position: relative;
  z-index: 1;
  width: min(230px, 62vw);
  height: 38px;
  margin-top: -30px;
}
.wd-pedestal-top {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background:
    radial-gradient(ellipse at 50% 35%, rgba(255, 255, 255, 0.5), transparent 60%),
    linear-gradient(180deg, color-mix(in srgb, var(--wd-c1) 60%, #FFFFFF 10%), color-mix(in srgb, var(--wd-c2) 80%, #000000 20%));
  box-shadow: 0 10px 0 -2px color-mix(in srgb, var(--wd-c2) 60%, #000000 40%), 0 18px 30px rgba(0, 0, 0, 0.4);
}
.wd-pedestal-glow {
  position: absolute;
  left: 10%;
  right: 10%;
  bottom: 100%;
  height: 140px;
  background: linear-gradient(0deg, color-mix(in srgb, var(--wd-c1) 35%, transparent), transparent);
  clip-path: polygon(8% 100%, 92% 100%, 70% 0, 30% 0);
  opacity: 0.55;
  pointer-events: none;
}

.wd-rank { margin-top: 18px; text-align: center; }
.wd-rank-name {
  margin: 0;
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 900;
  letter-spacing: -0.03em;
  background: var(--grad-text);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.wd-rank-lvl { margin: 2px 0 0; color: var(--ink-2); font-size: 13px; font-weight: 700; }
.wd-rank-name:empty, .wd-rank-lvl:empty { display: none; }

/* colores */
.wd-colors-wrap { padding: 12px 14px; border-radius: var(--radius-xl); display: grid; gap: 8px; }
.wd-label { margin: 0; color: var(--ink-2); font-size: 12px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; }
.wd-colors { display: flex; gap: 10px; justify-content: space-between; }
.wd-color {
  position: relative;
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: inset 0 -4px 8px rgba(0, 0, 0, 0.25), inset 0 3px 6px rgba(255, 255, 255, 0.35), 0 4px 10px rgba(0, 0, 0, 0.25);
  transition: transform 420ms var(--ease-spring);
  touch-action: manipulation;
}
.wd-color:active { transform: scale(0.9); transition-duration: 90ms; }
.wd-color[aria-checked="true"] { transform: scale(1.06); }
.wd-color[aria-checked="true"]::after {
  content: "";
  position: absolute;
  inset: -5px;
  border-radius: 50%;
  border: 2.5px solid var(--ink);
  animation: anim-pop 380ms var(--ease-spring) backwards;
}
.wd-color:focus-visible { outline: 3px solid var(--brand-2); outline-offset: 6px; }

.wd-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.wd-act { min-height: 44px; }

/* pestañas por hueco */
.wd-tabs-wrap { position: sticky; top: calc(var(--topbar-h) + var(--sat) + 60px); z-index: 5; } /* bajo el botón atrás flotante */
.wd-tabs { padding: 4px; }
.wd-tab {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 52px;
  padding: 4px 2px;
  font-size: 11px;
  overflow: visible;
}
.wd-tab .wd-slot-ico { width: 20px; height: 20px; }
.wd-tab-label { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.wd-newdot {
  position: absolute;
  top: 6px;
  right: calc(50% - 16px);
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--brand-3);
  box-shadow: 0 0 0 2px var(--bg), 0 0 10px var(--brand-3);
  animation: wd-dot 1.6s ease-in-out infinite;
}
@keyframes wd-dot { 50% { scale: 1.25; } }

/* rejilla */
.wd-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); /* 3 columnas ya a 360 px */
  gap: 10px;
}
.wd-grid-empty { grid-column: 1 / -1; color: var(--ink-2); text-align: center; padding: 24px 0; margin: 0; }
.wd-card {
  position: relative;
  display: grid;
  justify-items: center;
  align-content: start;
  gap: 5px;
  min-width: 0;
  padding: 8px 8px 10px;
  border: 0;
  border-radius: 20px;
  background: var(--glass);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  box-shadow: inset 0 1px 0 var(--glass-hi), inset 0 0 0 1px var(--glass-border);
  color: var(--ink);
  font: inherit;
  text-align: center;
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 420ms var(--ease-spring), box-shadow 250ms var(--ease-out), background-color 250ms;
}
.wd-card:active { transform: scale(0.96); transition-duration: 90ms; }
.wd-card:focus-visible { outline: 3px solid var(--brand-2); outline-offset: 2px; }
@media (hover: hover) { .wd-card:hover { transform: translateY(-2px); background: var(--glass-hover); } }
.wd-card[data-state="equipped"] { box-shadow: inset 0 0 0 2px var(--brand-1), 0 8px 24px rgba(124, 92, 255, 0.35); }
.wd-card.is-preview { box-shadow: inset 0 0 0 2px var(--brand-3), 0 8px 24px rgba(255, 94, 138, 0.35); }
/* halo claro detrás del accesorio: los oscuros (gafas, sol, chistera, birrete) se ven sobre él */
.wd-card { --wd-tint: rgba(190, 178, 255, 0.34); }
.wd-card[data-rar="raro"] { --wd-tint: rgba(150, 200, 255, 0.38); }
.wd-card[data-rar="epico"] { --wd-tint: rgba(214, 160, 255, 0.4); }
.wd-card[data-rar="legend"] { --wd-tint: rgba(255, 214, 120, 0.44); }

.wd-thumb {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: radial-gradient(circle at 50% 46%, rgba(255, 255, 255, 0.42) 0%, var(--wd-tint, rgba(190, 178, 255, 0.34)) 38%, transparent 72%);
}
.wd-thumb > :first-child { width: 84%; height: 84%; display: grid; place-items: center; }
.wd-thumb svg { width: 100%; height: 100%; display: block; }
.wd-card[data-state="locked"] .wd-thumb > :first-child { filter: grayscale(0.7) brightness(0.7); opacity: 0.7; }
.wd-lock,
.wd-check {
  position: absolute;
  top: 4px;
  right: 4px;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--glass-strong);
  color: var(--ink-2);
  box-shadow: inset 0 0 0 1px var(--glass-border);
}
.wd-check { background: var(--grad-brand-deep); color: #FFFFFF; box-shadow: var(--glow-brand); }
.wd-newdot-card { top: 6px; left: 6px; right: auto; }

/* Hueco fijo de 2 líneas (texto centrado): rareza y precio quedan a la misma altura en toda la rejilla */
.wd-card-name {
  margin: 0;
  width: 100%;
  min-height: 2.4em;
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.01em;
}
.wd-card-name > span {
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow-wrap: anywhere;
}
.wd-card-foot { min-height: 20px; display: flex; justify-content: center; width: 100%; }
.wd-state { display: inline-flex; align-items: center; gap: 4px; color: var(--ink-2); font-size: 12px; font-weight: 700; min-width: 0; }
.wd-state > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wd-state-on { color: var(--accent-text); }
.wd-state-lock { font-size: 11px; line-height: 1.2; }
.wd-state-lock > span:last-child { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.wd-price { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 800; color: var(--gold-text); }
.wd-price[data-short="1"] { color: var(--ink-2); }

.wd-empty { padding: 32px 20px; }
.wd-empty .wd-ico { color: var(--accent-text); }

/* barra inferior "probar antes de comprar" */
.wd-trybar {
  position: fixed;
  z-index: 60;
  left: 0;
  right: 0;
  bottom: calc(var(--tabbar-h) + var(--tabbar-gap) + var(--sab) + 10px);
  display: flex;
  justify-content: center;
  padding: 0 12px;
  pointer-events: none;
}
.wd-trybar[hidden] { display: none; }
.wd-try-inner {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  max-width: 560px;
  padding: 8px 8px 8px 10px;
  border-radius: 24px;
  background: var(--glass-strong);
  -webkit-backdrop-filter: blur(30px) saturate(180%);
  backdrop-filter: blur(30px) saturate(180%);
  box-shadow: var(--shadow-2), inset 0 0 0 1px var(--glass-border);
  animation: wd-bar-in 460ms var(--ease-spring) backwards;
}
@keyframes wd-bar-in { from { transform: translateY(24px); opacity: 0; } }
.wd-try-thumb { flex: none; width: 44px; height: 44px; display: grid; place-items: center; border-radius: 12px; background: radial-gradient(circle at 50% 46%, rgba(255, 255, 255, 0.45), rgba(190, 178, 255, 0.3) 45%, transparent 75%); }
.wd-try-thumb > * { width: 86% !important; height: 86% !important; }
.wd-try-thumb > * { width: 100%; height: 100%; }
.wd-try-thumb svg { width: 100%; height: 100%; }
.wd-try-text { flex: 1 1 auto; min-width: 88px; }
.wd-try-name { margin: 0; font-weight: 800; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wd-try-sub { margin: 1px 0 0; color: var(--ink-2); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wd-try-cta { flex: 0 1 auto; min-height: 44px; padding: 0 14px; font-size: 14px; }
/* Móvil estrecho: dos filas (accesorio + cerrar arriba, botón a todo el ancho abajo): nombre y precio sin recortes */
@media (max-width: 420px) {
  .wd-try-inner {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) 44px;
    grid-template-areas: "thumb text x" "cta cta cta";
    gap: 8px 10px;
    padding: 8px;
  }
  .wd-try-thumb { grid-area: thumb; }
  .wd-try-text { grid-area: text; min-width: 0; align-self: center; }
  .wd-try-x { grid-area: x; }
  .wd-try-cta { grid-area: cta; width: 100%; justify-content: center; }
  body[data-screen="wardrobe"] .wd { padding-bottom: 150px; }
}
.wd-try-cta[data-short="1"] { filter: saturate(0.6); }
.wd-try-x {
  flex: none;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: var(--track-off);
  color: var(--ink-2);
  cursor: pointer;
}

/* hojas del armario (confirmar compra / cómo conseguirlo) */
.wd-sheet { display: grid; justify-items: center; gap: 10px; text-align: center; padding-top: 4px; }
.wd-sheet-pair { display: flex; align-items: center; justify-content: center; gap: 12px; }
.wd-sheet-oj { width: 130px; aspect-ratio: 200 / 220; }
.wd-sheet-oj > *, .wd-sheet-oj svg { width: 100%; height: 100%; display: block; }
.wd-sheet-thumb {
  width: 96px;
  height: 96px;
  display: grid;
  place-items: center;
  border-radius: 22px;
  background: radial-gradient(circle at 50% 46%, rgba(255, 255, 255, 0.42) 0%, rgba(190, 178, 255, 0.34) 40%, transparent 74%), var(--glass);
  box-shadow: inset 0 0 0 1px var(--glass-border);
}
.wd-sheet-thumb[data-rar="legend"] { background: radial-gradient(circle at 50% 46%, rgba(255, 255, 255, 0.45) 0%, rgba(255, 214, 120, 0.44) 40%, transparent 74%), var(--glass); }
.wd-sheet-thumb > * { width: 80%; height: 80%; }
.wd-sheet-thumb svg { width: 100%; height: 100%; }
.wd-sheet-name { margin: 4px 0 0; font-family: var(--font-display); font-size: 22px; font-weight: 900; letter-spacing: -0.03em; }
.wd-sheet-src { display: inline-flex; align-items: center; gap: 6px; margin: 4px 0 0; color: var(--ink); font-weight: 700; }
.wd-sheet-note { margin: 0; color: var(--ink-2); font-size: 14px; max-width: 36ch; }
.wd-sheet-bal { display: grid; gap: 2px; justify-items: center; margin-top: 4px; }
.wd-sheet-balrow { display: inline-flex; align-items: center; gap: 6px; font-weight: 800; font-size: 17px; }
.wd-sheet-after { color: var(--good-text); font-weight: 700; font-size: 14px; }
.wd-sheet-after[data-short="1"] { color: var(--bad-text); }
.wd-sheet-actions { display: grid; gap: 8px; width: 100%; max-width: 360px; margin-top: 8px; }
.wd-sheet-btn { width: 100%; }

/* escritorio: personaje fijo a la izquierda, armario a la derecha */
@media (min-width: 1024px) {
  body[data-screen="wardrobe"] .wd {
    grid-template-columns: minmax(340px, 420px) minmax(0, 1fr);
    gap: 28px;
    align-items: start;
  }
  .wd-stage-col { position: sticky; top: calc(var(--topbar-h) + var(--sat) + 16px); }
  .wd-tabs-wrap { top: calc(var(--topbar-h) + var(--sat) + 12px); }
  .wd-stage { min-height: 440px; }
  .wd-oj-btn { width: 280px; }
  .wd-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 14px; }
  .wd-tab { flex-direction: row; gap: 6px; font-size: 13px; min-height: 44px; }
  .wd-newdot { top: 4px; right: 6px; }
}

/* --- hoja de recompensa ----------------------------------------------------------- */
.rw { display: grid; justify-items: center; gap: 10px; text-align: center; padding-bottom: 4px; }
.rw-stage {
  position: relative;
  isolation: isolate;
  width: 100%;
  height: 210px;
  display: grid;
  place-items: center;
}
.rw-rays {
  position: absolute;
  z-index: -1;
  left: 50%;
  top: 50%;
  width: 320px;
  height: 320px;
  translate: -50% -50%;
  border-radius: 50%;
  background: repeating-conic-gradient(from 0deg, rgba(255, 226, 122, 0.28) 0 10deg, transparent 10deg 24deg);
  -webkit-mask: radial-gradient(circle, #000 20%, transparent 68%);
  mask: radial-gradient(circle, #000 20%, transparent 68%);
  opacity: 0;
  scale: 0.4;
  transition: opacity 500ms var(--ease-out), scale 700ms var(--ease-out-expo);
}
.rw[data-phase="open"] .rw-rays { opacity: 1; scale: 1; animation: rw-spin 14s linear infinite; }
.rw[data-rar="epico"] .rw-rays { background: repeating-conic-gradient(from 0deg, rgba(193, 85, 255, 0.3) 0 10deg, transparent 10deg 24deg); }
.rw[data-rar="raro"] .rw-rays { background: repeating-conic-gradient(from 0deg, rgba(111, 183, 255, 0.3) 0 10deg, transparent 10deg 24deg); }
@keyframes rw-spin { to { rotate: 360deg; } }

.rw-flash {
  position: absolute;
  z-index: 3;
  left: 50%;
  top: 58%;
  width: 60px;
  height: 60px;
  translate: -50% -50%;
  border-radius: 50%;
  background: radial-gradient(circle, #FFFFFF, rgba(255, 226, 122, 0.8) 35%, transparent 70%);
  opacity: 0;
  pointer-events: none;
}
.rw[data-phase="open"] .rw-flash { animation: rw-flash 700ms var(--ease-out) both; }
@keyframes rw-flash { 0% { opacity: 0; scale: 0.4; } 25% { opacity: 1; scale: 3; } 100% { opacity: 0; scale: 5; } }

.rw-chest {
  position: absolute;
  z-index: 1;
  left: 50%;
  bottom: 0;
  width: 150px;
  translate: -50% 0;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  transition: opacity 400ms var(--ease-out), translate 600ms var(--ease-out-expo), scale 600ms var(--ease-out-expo);
}
.rw-chest:disabled { cursor: default; }
.rw-chest-svg { width: 100%; height: auto; display: block; overflow: visible; filter: drop-shadow(0 10px 20px rgba(0, 0, 0, 0.35)); }
.rw-chest-lid { transform-box: fill-box; transform-origin: 8% 100%; transition: transform 520ms var(--ease-spring); }
.rw[data-phase="closed"] .rw-chest { animation: rw-idle 1.6s ease-in-out infinite; }
.rw[data-phase="shake"] .rw-chest { animation: rw-shake 900ms ease-in-out both; }
.rw[data-phase="open"] .rw-chest-lid { transform: translate(-2px, -12px) rotate(-24deg); }
.rw[data-phase="open"] .rw-chest { scale: 0.78; translate: -50% 26px; opacity: 0.9; }
@keyframes rw-idle { 50% { transform: translateY(-4px); } }
@keyframes rw-shake {
  0%, 100% { transform: rotate(0) scale(1); }
  10% { transform: rotate(-4deg) scale(1.02); }
  20% { transform: rotate(4deg); }
  30% { transform: rotate(-6deg) scale(1.04); }
  40% { transform: rotate(6deg); }
  50% { transform: rotate(-8deg) scale(1.06); }
  60% { transform: rotate(8deg); }
  70% { transform: rotate(-9deg) scale(1.08, 0.94); }
  80% { transform: rotate(9deg) scale(1.08, 0.94); }
  90% { transform: rotate(0) scale(0.94, 1.08); }
}

.rw-item {
  position: absolute;
  z-index: 2;
  left: 50%;
  top: 8px;
  width: 128px;
  height: 128px;
  translate: -50% 0;
  display: grid;
  place-items: center;
  opacity: 0;
  pointer-events: none;
  filter: drop-shadow(0 10px 18px rgba(0, 0, 0, 0.35)) drop-shadow(0 0 14px rgba(255, 226, 122, 0.5));
}
.rw-item::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: -14%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.55) 0%, rgba(255, 236, 180, 0.35) 35%, transparent 70%);
}
.rw[data-rar="raro"] .rw-item::before { background: radial-gradient(circle, rgba(255, 255, 255, 0.55) 0%, rgba(160, 205, 255, 0.38) 35%, transparent 70%); }
.rw[data-rar="epico"] .rw-item::before { background: radial-gradient(circle, rgba(255, 255, 255, 0.55) 0%, rgba(214, 160, 255, 0.4) 35%, transparent 70%); }
.rw-item > * { width: 100%; height: 100%; }
.rw-item svg { width: 100%; height: 100%; display: block; }
.rw-item.is-out { animation: rw-out 820ms var(--ease-spring) both, rw-float 3s ease-in-out 900ms infinite; }
@keyframes rw-out {
  0% { opacity: 0; transform: translateY(90px) scale(0.2) rotate(-20deg); }
  60% { opacity: 1; }
  100% { opacity: 1; transform: translateY(0) scale(1) rotate(0); }
}
@keyframes rw-float { 0%, 100% { opacity: 1; transform: translateY(0); } 50% { opacity: 1; transform: translateY(-6px); } }

.rw-info { display: grid; justify-items: center; gap: 4px; min-height: 64px; opacity: 0; }
.rw[data-phase="open"] .rw-info { animation: anim-in 520ms var(--ease-out-expo) 200ms both; }
.rw-rarwrap { min-height: 20px; }
.rw-name { margin: 2px 0 0; font-family: var(--font-display); font-size: 26px; font-weight: 900; letter-spacing: -0.03em; line-height: 1.1; }
.rw[data-rar="legend"] .rw-name { background: var(--grad-gold); -webkit-background-clip: text; background-clip: text; color: transparent; }
.rw-src { margin: 0; color: var(--ink-2); font-size: 14px; }
.rw-src[hidden] { display: none; }

.rw-preview { display: flex; align-items: center; gap: 10px; padding: 6px 14px 6px 6px; border-radius: var(--radius-pill); background: var(--glass); box-shadow: inset 0 0 0 1px var(--glass-border); opacity: 0; }
.rw-preview.is-in { animation: anim-pop 560ms var(--ease-spring) 380ms both; }
.rw-preview-oj { width: 58px; aspect-ratio: 200 / 220; }
.rw-preview-oj > *, .rw-preview-oj svg { width: 100%; height: 100%; display: block; }
.rw-preview-label { font-size: 13px; font-weight: 700; color: var(--ink-2); }

.rw-coins { display: inline-flex; align-items: center; gap: 6px; font-weight: 900; font-size: 26px; letter-spacing: -0.02em; opacity: 0; }
.rw-coins.is-in { animation: anim-pop 560ms var(--ease-spring) 250ms both; }
.rw-coins-plus, .rw-coins-num { background: var(--grad-gold); -webkit-background-clip: text; background-clip: text; color: transparent; }
.rw-coins-unit { font-size: 14px; font-weight: 700; color: var(--ink-2); margin-left: 2px; }

.rw-dots { display: flex; gap: 6px; }
.rw-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--track-off); transition: background 300ms, scale 300ms var(--ease-spring); }
.rw-dot.is-on { background: var(--brand-2); scale: 1.2; }
.rw-count { margin: -4px 0 0; color: var(--ink-3); font-size: 12px; font-weight: 700; }

.rw-actions { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 10px; width: 100%; max-width: 420px; margin-top: 6px; }
.rw-actions > [hidden] { display: none; }
.rw-actions .btn { width: 100%; min-height: 48px; }

/* movimiento reducido: estado final directo */
@media (prefers-reduced-motion: reduce) {
  .wd-halo, .wd-newdot, .wd-oj-btn.is-jump .wd-oj, .wd-oj-btn.is-spin .wd-oj, .wd-balance.is-bump, .wd-try-inner, .wd-trying { animation: none !important; }
  .rw *, .rw { animation: none !important; transition: none !important; }
}
.rw.rw-reduced .rw-info, .rw.rw-reduced .rw-preview, .rw.rw-reduced .rw-coins, .rw.rw-reduced .rw-item { opacity: 1; animation: none; }
.rw.rw-reduced .rw-rays { opacity: 1; scale: 1; animation: none; }
.rw.rw-reduced .rw-flash { display: none; }
@media (prefers-reduced-motion: reduce) {
  .rw .rw-info, .rw .rw-preview.is-in, .rw .rw-coins.is-in, .rw .rw-item.is-out { opacity: 1; }
}
