/* Renderizado por software, sin GPU: solo transform y opacity en las animaciones.
   Evitar blur, backdrop-filter y sombras grandes en movimiento. */

:root {
  --stage-w: 720px;
  --stage-h: 1280px;
  --ink: #ece7ff;
  --accent: #c9a7ff;
  --card-w: 150px;
  --card-h: 255px;
  /* Sprite, habla y videos idle: a la izquierda del centro, sin recortar. */
  --doll-shift-x: -96px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: transparent;
  font-family: "Georgia", "Times New Roman", serif;
  color: var(--ink);
}

#stage {
  position: absolute;
  top: 50%;
  left: 50%;
  width: var(--stage-w);
  height: var(--stage-h);
  transform-origin: center center;
  transform: translate(-50%, -50%);
  overflow: hidden;
}

#background {
  position: absolute;
  inset: 0;
  background-color: #0b0720;
  background-image:
    radial-gradient(1px 1px at 12% 18%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 78% 12%, #fff 50%, transparent 51%),
    radial-gradient(2px 2px at 55% 30%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 30% 62%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 88% 72%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 20% 88%, #fff 50%, transparent 51%),
    radial-gradient(circle at 50% 34%, rgba(150, 110, 220, 0.35), transparent 55%),
    linear-gradient(180deg, #150c33 0%, #0b0720 60%, #06040f 100%);
  background-size: cover;
}

#background.has-image {
  background-image: var(--bg-image);
  background-size: cover;
  background-position: center;
}

/* Donas PNG: color del clip original, encima de la biblioteca, detrás de la muñeca. */
#dona-fx {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background: transparent;
  z-index: 4;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.35s ease;
  object-fit: contain;
  image-rendering: auto;
  mix-blend-mode: normal;
}

#dona-fx.is-on {
  opacity: 1;
  visibility: visible;
}

/* Osito: misma caja que la muñeca, dentro del hueco del altar. */
#osito-fx {
  position: absolute;
  top: var(--doll-slot-top);
  left: calc(50% + var(--doll-shift-x));
  width: var(--doll-slot-w);
  height: var(--doll-slot-h);
  margin-left: calc(var(--doll-slot-w) / -2);
  background: transparent;
  z-index: 14;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.35s ease;
  image-rendering: auto;
  object-fit: contain;
}

#osito-fx.is-on {
  opacity: 1;
  visibility: visible;
}

#ghost.osito-fx-hidden,
#idle-video.osito-fx-hidden {
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none;
}

.hidden { opacity: 0; visibility: hidden; }

#queue-badge {
  position: absolute;
  top: 96px;
  right: 8px;
  max-width: 248px;
  max-height: 420px;
  overflow: hidden;
  padding: 8px 10px 8px 8px;
  font-size: 15px;
  letter-spacing: 0.3px;
  border: 1px solid rgba(201, 167, 255, 0.55);
  border-radius: 16px;
  background: rgba(12, 8, 32, 0.86);
  transition: opacity 0.4s;
  text-align: left;
  z-index: 20;
}

.queue-title {
  display: none;
}

#queue-names {
  margin-top: 0;
  font-size: 14px;
  line-height: 1.22;
  color: rgba(236, 231, 255, 0.78);
}

#queue-names .vip {
  color: #ffd27a;
}

#queue-names .now {
  color: #ffe08a;
  margin-bottom: 4px;
  font-weight: 700;
}

#queue-names .queue-turn {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin: 1px 0;
}

#queue-names .queue-n {
  flex: 0 0 1.4em;
  font-size: 13px;
  font-weight: 700;
  color: rgba(201, 167, 255, 0.9);
}

#queue-names .queue-skip {
  margin-left: auto;
  font-size: 11px;
  letter-spacing: 0.2px;
  text-transform: uppercase;
  color: #ffd27a;
}

#queue-names .queue-priority {
  font-size: 13px;
  color: #ffd27a;
  margin-bottom: 4px;
}

#free-badge {
  display: none !important;
  position: absolute;
  top: 118px;
  left: 12px;
  max-width: 220px;
  padding: 8px 12px;
  border: 1px solid rgba(160, 210, 255, 0.45);
  border-radius: 18px;
  background: rgba(20, 12, 45, 0.78);
  text-align: left;
  z-index: 3;
  transition: opacity 0.4s;
}

#free-badge.hidden {
  opacity: 0;
  visibility: hidden;
}

.free-title {
  font-size: 15px;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: rgba(180, 220, 255, 0.95);
}

#free-meta {
  margin-top: 4px;
  font-size: 16px;
  line-height: 1.3;
  color: rgba(236, 231, 255, 0.82);
}

/* CTA gratis: un poco más abajo para no tapar «Leyendo para». */
#promo-quiereme {
  position: absolute;
  top: 198px;
  left: calc(50% + var(--doll-shift-x));
  width: 560px;
  margin-left: -280px;
  padding: 0;
  border: none;
  background: transparent;
  z-index: 21;
  pointer-events: none;
  text-align: center;
}

#promo-quiereme-tag {
  margin: 0;
  font-family: system-ui, "Segoe UI", sans-serif;
  font-size: 38px;
  font-weight: 800;
  letter-spacing: 0.2px;
  line-height: 1.05;
  color: #ffe08a;
  text-shadow:
    0 0 10px rgba(0, 0, 0, 0.95),
    0 3px 8px rgba(0, 0, 0, 0.95);
}

#promo-quiereme-sub {
  margin-top: 6px;
  font-family: system-ui, "Segoe UI", sans-serif;
  font-size: 24px;
  font-weight: 800;
  letter-spacing: 0.2px;
  line-height: 1.15;
  color: #fff4d4;
  text-shadow:
    0 0 10px rgba(0, 0, 0, 0.95),
    0 3px 8px rgba(0, 0, 0, 0.95);
}

/* Columna derecha, encima de los subtítulos y debajo de la cola.
   Alto real: consejo 85px + menu 143px = 228px. Con top 400 termina en 628,
   por debajo de la cola (376) y sin llegar al caption (642). */
#gift-stack {
  position: absolute;
  top: 400px;
  right: 12px;
  width: 220px;
  padding: 0;
  border: none;
  background: transparent;
  z-index: 16;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  gap: 0;
}

#banner-consejo,
#gift-banner {
  position: relative;
  top: auto;
  right: auto;
  width: 100%;
  padding: 0;
  border: none;
  background: transparent;
}

#banner-consejo img,
#gift-banner img {
  display: block;
  width: 100%;
  height: auto;
}

#gift-toast {
  position: absolute;
  top: auto;
  bottom: 96px;
  left: 50%;
  width: 520px;
  margin-left: -260px;
  padding: 18px 22px;
  text-align: center;
  border-radius: 18px;
  border: 1px solid rgba(255, 210, 122, 0.55);
  background: rgba(40, 18, 60, 0.92);
  transition: none;
  z-index: 40;
  pointer-events: none;
}

#gift-toast.vip {
  border-color: rgba(255, 210, 122, 0.9);
  box-shadow: 0 0 0 1px rgba(255, 210, 122, 0.2);
}

#gift-toast.system {
  border-color: rgba(201, 167, 255, 0.55);
}

#gift-toast.warn {
  border-color: rgba(255, 170, 120, 0.7);
}

#gift-toast-label {
  font-size: 18px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: rgba(255, 210, 122, 0.9);
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.85);
}

#gift-toast-user {
  margin-top: 4px;
  font-size: 36px;
  color: var(--accent);
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.85);
}

#title-return {
  display: block;
  margin-top: 6px;
  font-size: 18px;
  letter-spacing: 1px;
  color: rgba(236, 231, 255, 0.65);
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.85);
}

/* Entre personaje y mesa: no tapa la carta. */
#title-question {
  position: absolute;
  top: 718px;
  left: 48px;
  right: 48px;
  z-index: 16;
  margin: 0;
  padding: 7px 16px;
  max-height: 2.8em;
  overflow: hidden;
  font-size: 18px;
  line-height: 1.35;
  font-style: italic;
  text-align: center;
  color: rgba(236, 231, 255, 0.9);
  background: rgba(9, 5, 24, 0.72);
  border-radius: 12px;
  pointer-events: none;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.85);
}

#title-return.hidden,
#title-question.hidden {
  display: none;
}

/* Si ya suena la respuesta, la pregunta no compite por el hueco bajo los pies. */
#stage:has(#caption:not(.hidden)) #title-question {
  display: none;
}

/*
  CTA a todo el ancho, solo un poco encima del personaje (#ghost / .sprite top:210px).
*/
#cta {
  display: none !important;
  position: absolute;
  top: 168px;
  left: 0;
  right: 0;
  width: 100%;
  margin: 0;
  padding: 10px 18px;
  box-sizing: border-box;
  text-align: center;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 0.4px;
  line-height: 1.2;
  color: #ffe08a;
  background: rgba(12, 8, 28, 0.78);
  border: none;
  border-top: 1px solid rgba(255, 224, 138, 0.4);
  border-bottom: 1px solid rgba(255, 224, 138, 0.4);
  border-radius: 0;
  text-shadow:
    0 0 10px rgba(0, 0, 0, 0.85),
    0 2px 6px rgba(0, 0, 0, 0.9);
  z-index: 50;
  pointer-events: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#cta.hidden {
  display: none;
  opacity: 0;
  visibility: hidden;
}

#reader-badge {
  position: absolute;
  bottom: 58px;
  left: 50%;
  width: 480px;
  margin-left: -240px;
  text-align: center;
  z-index: 3;
  pointer-events: none;
}

#reader-name {
  font-size: 28px;
  letter-spacing: 4px;
  text-transform: uppercase;
  color: var(--accent);
}

#reader-tagline {
  margin-top: 4px;
  font-size: 15px;
  letter-spacing: 1px;
  color: rgba(236, 231, 255, 0.58);
}

#rare-flash {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at 50% 42%, rgba(255, 220, 140, 0.35), transparent 55%);
  z-index: 4;
  transition: none;
}

.card.rare-glow .card-face {
  border-color: rgba(255, 210, 122, 0.95);
}

.card.rare-glow .card-front {
  background:
    radial-gradient(circle at 50% 40%, rgba(255, 210, 122, 0.28), transparent 60%),
    linear-gradient(170deg, #3a2468, #1a0f36);
}


#title-bar {
  position: absolute;
  top: 78px;
  left: 0;
  width: 100%;
  text-align: center;
  transition: opacity 0.5s;
  z-index: 18;
  pointer-events: none;
}

.title-label {
  display: block;
  font-size: 22px;
  letter-spacing: 5px;
  text-transform: uppercase;
  color: rgba(236, 231, 255, 0.65);
}

#title-user {
  display: block;
  margin-top: 6px;
  font-size: 52px;
  color: var(--accent);
  text-shadow:
    0 2px 10px rgba(0, 0, 0, 0.9),
    0 0 14px rgba(0, 0, 0, 0.55);
}

#ghost {
  position: absolute;
  top: 200px;
  left: calc(50% + var(--doll-shift-x));
  width: 210px;
  margin-left: -105px;
  z-index: 15;
  animation: float 5s ease-in-out infinite;
}

#ghost svg { width: 100%; height: auto; }

/* Sprite idle: misma escala que los loops (cartas 396x555, leyendo 421x587).
   Objetivo en escena: muneca 448x571, sombrero y=225, pies y=795. Sin recorte. */
#ghost.sprite {
  top: 110px;
  width: 641px;
  height: 801px;
  margin-left: -320px;
}

#ghost.sprite .ghost-layer {
  display: block;
  width: 100%;
  height: auto;
  transition: opacity 0.14s ease;
}

/* La capa idle define el alto; las demas se superponen sin recargar imagen */
#ghost.sprite .ghost-layer:not(.is-base) {
  position: absolute;
  left: 0;
  top: 0;
  opacity: 0;
  pointer-events: none;
}

#ghost.sprite .ghost-layer.is-base {
  opacity: 0;
}

#ghost.sprite .ghost-layer.is-active {
  opacity: 1;
}

/* Boca real: capa completa alineada con idle.png (misma escala que ghost-layer) */
#ghost.sprite .ghost-mouth-overlay {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: auto;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.08s ease;
}

#ghost.sprite .ghost-mouth-overlay.is-open {
  opacity: 1;
}

/* Legacy: sin visemas alineados, solo respiracion sutil al hablar. */
#ghost.sprite.talking:not(.ghost-new) .ghost-layer.is-active {
  animation: breatheTalk 0.9s ease-in-out infinite alternate;
}

/* ghost_new: rest siempre debajo; swaps instantaneos (sin fade = sin “desaparecer”). */
#ghost.sprite.ghost-new .ghost-layer {
  transition: none !important;
  will-change: auto;
  backface-visibility: hidden;
}

#ghost.sprite.ghost-new .ghost-layer.is-base {
  opacity: 1 !important;
}

#ghost.sprite.ghost-new .ghost-layer:not(.is-base) {
  opacity: 0;
}

#ghost.sprite.ghost-new .ghost-layer.is-active:not(.is-base) {
  opacity: 1;
}

#ghost.sprite.ghost-new .ghost-mouth-overlay {
  display: none;
}

/* Menos flotacion mientras habla: el swap de boca ya aporta movimiento. */
#ghost.sprite.ghost-new.talking {
  animation-duration: 8s;
}

@keyframes bob {
  from { transform: scale(1) translateY(0); }
  to   { transform: scale(1.01) translateY(-2px); }
}

@keyframes breatheTalk {
  from {
    transform: scale(1);
    opacity: 0.96;
  }
  to {
    transform: scale(1.012);
    opacity: 1;
  }
}

#ghost-mouth {
  transform-origin: 100px 124px;
  transition: transform 0.12s ease;
}

#ghost.talking #ghost-mouth { animation: talk 0.42s ease-in-out infinite alternate; }

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-18px); }
}

@keyframes talk {
  from { transform: scaleY(0.55) scaleX(0.95); }
  to   { transform: scaleY(1.05) scaleX(1.02); }
}

@keyframes miniGlow {
  0%, 100% { opacity: 0.1; }
  50%       { opacity: 0.65; }
}

#table {
  position: absolute;
  top: 790px;
  left: 0;
  width: 100%;
  height: 275px;
  z-index: 5;
  overflow: visible;
}

/* La mesa solo cruza el plano de la tarotista durante reparto o enfoque. */
#table.is-animating {
  z-index: 20;
}

#stage.ritual-galaxy #table {
  top: 775px;
  height: 300px;
}

#stage.ritual-galaxy #table::before {
  content: "";
  position: absolute;
  left: 50%;
  top: -20px;
  width: 560px;
  height: 350px;
  margin-left: -280px;
  background: radial-gradient(ellipse at center, rgba(140, 180, 255, 0.22), transparent 72%);
  pointer-events: none;
  z-index: 0;
}

#stage.ritual-vip #title-bar .title-label {
  color: rgba(255, 224, 138, 0.9);
}

#stage.ritual-galaxy #title-bar .title-label {
  color: rgba(200, 220, 255, 0.92);
  letter-spacing: 3px;
}

#stage.ritual-minimal #title-bar .title-label {
  color: rgba(236, 231, 255, 0.7);
  letter-spacing: 4px;
}

#stage.ritual-deep #title-bar .title-label {
  color: rgba(236, 231, 255, 0.82);
  letter-spacing: 2px;
}

#stage.ritual-deep #table::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 4px;
  width: 640px;
  height: 250px;
  margin-left: -320px;
  background: radial-gradient(ellipse at 50% 42%, rgba(255, 214, 150, 0.36), rgba(255, 196, 120, 0.1) 55%, transparent 74%);
  pointer-events: none;
  z-index: 1;
}

#stage.ritual-deep #cards.layout-3 .card {
  width: 140px;
  height: 210px;
  margin-left: -70px;
}

#cards.layout-1 .card-position {
  display: none;
}

#cards.layout-3 .card-position {
  top: -28px;
  bottom: auto;
}

#reading-badge.badge-deep {
  border-color: rgba(220, 200, 255, 0.45);
  color: rgba(236, 231, 255, 0.88);
}

#shuffle-fan.shuffle-deep {
  width: 260px;
  margin-left: -130px;
}

#shuffle-fan.shuffle-deep .mini::after {
  animation: none;
  opacity: 0;
}

#galaxy-map {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

#galaxy-map .gm-zone {
  position: absolute;
  left: 50%;
  width: 118px;
  margin-left: -59px;
  padding: 6px 0;
  text-align: center;
  font-size: 12px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: rgba(200, 220, 255, 0.78);
  border: 1px solid rgba(180, 210, 255, 0.28);
  border-radius: 10px;
  background: rgba(18, 28, 64, 0.28);
  opacity: 0;
}

/* Alineadas con los slots nuevos de la cruz en app.js (zone_top ~= slot.y + 24). */
#galaxy-map .gm-pregunta { top: 124px; }
#galaxy-map .gm-amor { top: 130px; margin-left: -195px; }
#galaxy-map .gm-dinero { top: 130px; margin-left: 77px; }
#galaxy-map .gm-sostiene { top: 234px; }
#galaxy-map .gm-paso { top: 14px; }

#galaxy-map .gm-zone.is-filled {
  border-color: transparent;
  background: transparent;
}

/* Especificidad reforzada (2 clases en #cards) para que estas reglas siempre
   ganen sobre #cards.layout-galaxy .card, sin depender del orden en el archivo.
   Cartas mas chicas: la cruz de 5 posiciones necesita que top/centro/abajo no
   se toquen verticalmente dentro del alto disponible de la mesa. */
#cards.layout-galaxy.layout-galaxy-cross .card {
  width: 62px;
  height: 100px;
  margin-left: -31px;
  top: 0;
}

#cards.layout-galaxy.layout-galaxy-cross .card-position {
  top: -20px;
  bottom: auto;
  width: 92px;
  margin-left: -46px;
  font-size: 10px;
  letter-spacing: 0.5px;
}

#cards.layout-vip .card.deal-impact::before {
  animation: vipImpact 0.28s ease-out;
}

@keyframes vipImpact {
  from { opacity: 0.4; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1.03); }
}

#queue-names .queue-jump {
  color: #ffd27a;
}

#queue-names .queue-priority {
  color: #ffd27a;
  font-size: 13px;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  margin-bottom: 4px;
  opacity: 0.95;
}

#share-card-seal {
  position: absolute;
  top: -14px;
  left: 50%;
  transform: translateX(-50%);
  padding: 6px 16px;
  border-radius: 999px;
  font-size: 14px;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: rgba(236, 231, 255, 0.92);
  border: 1px solid rgba(201, 167, 255, 0.45);
  background: rgba(20, 12, 45, 0.88);
  z-index: 2;
}

#share-card.share-vip #share-card-seal,
#share-card.share-vip #share-card-img {
  border-color: rgba(255, 210, 122, 0.7);
}

#share-card.share-vip #share-card-seal {
  color: #ffd27a;
}

#share-card.share-galaxy #share-card-seal,
#share-card.share-galaxy #share-card-img {
  border-color: rgba(180, 210, 255, 0.7);
}

#share-card.share-galaxy #share-card-seal {
  color: rgba(200, 220, 255, 0.95);
}

#share-card.share-minimal #share-card-seal {
  opacity: 0.8;
}

#share-card.share-deep #share-card-seal {
  border-color: rgba(220, 200, 255, 0.5);
}

#stage.ritual-galaxy #cards {
  z-index: 1;
}

#cards {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 26px;
  overflow: visible;
  z-index: 5;
}

#cards.layout-1 {
  gap: 0;
}

#cards.layout-1 .card {
  width: 168px;
  height: 252px;
}

#stage.ritual-minimal #cards.layout-1 .card {
  width: 168px;
  height: 252px;
}

#cards.layout-3 {
  display: block;
  position: absolute;
  inset: 0;
}

#cards.layout-3 .card {
  position: absolute;
  left: 50%;
  top: 28px;
  width: 140px;
  height: 210px;
  margin-left: -70px;
}

#cards.layout-3 .card .card-face {
  box-shadow: 0 0 18px rgba(255, 214, 150, 0.32);
}

#cards.layout-galaxy {
  display: block;
  position: absolute;
  inset: 0;
}

#cards.layout-galaxy .card {
  position: absolute;
  left: 50%;
  top: 48px;
  width: 112px;
  height: 190px;
  margin-left: -56px;
}

#cards.layout-galaxy .card-position {
  top: -26px;
  bottom: auto;
  width: 132px;
  margin-left: -66px;
  font-size: 11px;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: rgba(200, 220, 255, 0.92);
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.65);
  opacity: 0;
}

#cards.layout-galaxy .card-position.is-on {
  opacity: 1;
}

#cards.layout-vip .card::before {
  content: "";
  position: absolute;
  inset: -10px;
  border-radius: 16px;
  border: 1px solid rgba(255, 210, 122, 0.55);
  box-shadow: 0 0 18px rgba(255, 210, 122, 0.28);
  pointer-events: none;
  z-index: 0;
  opacity: 0.9;
}

#stage.ritual-galaxy #caption,
#stage.ritual-deep #caption,
#stage.ritual-vip #caption {
  top: 642px;
  max-height: 128px;
}


#stage.ritual-vip #reading-badge {
  animation: vipPulse 1.4s ease-in-out infinite;
}

@keyframes vipPulse {
  0%, 100% { opacity: 0.82; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.04); }
}

#ghost.shuffling-soft,
#ghost.shuffling.shuffling-soft {
  animation: float 5s ease-in-out infinite;
}

#deck {
  position: absolute;
  top: 30px;
  left: 50%;
  width: var(--card-w);
  height: var(--card-h);
  margin-left: calc(var(--card-w) / -2);
  border-radius: 12px;
  border: 2px solid rgba(201, 167, 255, 0.55);
  background:
    repeating-linear-gradient(45deg, rgba(201, 167, 255, 0.18) 0 8px, transparent 8px 16px),
    linear-gradient(160deg, #2a1a56, #150c33);
  opacity: 0;
}

#shuffle-fan {
  position: absolute;
  top: 40px;
  left: 50%;
  width: 340px;
  height: var(--card-h);
  margin-left: -170px;
  pointer-events: none;
}

#shuffle-fan .mini {
  position: absolute;
  top: 20px;
  left: 50%;
  width: 92px;
  height: 156px;
  margin-left: -46px;
  border-radius: 10px;
  border: 2px solid rgba(201, 167, 255, 0.55);
  background:
    repeating-linear-gradient(45deg, rgba(201, 167, 255, 0.18) 0 8px, transparent 8px 16px),
    linear-gradient(160deg, #2a1a56, #150c33);
  transform-origin: 50% 50%;
  will-change: transform;
  backface-visibility: hidden;
}

#shuffle-fan .mini::after {
  content: '';
  position: absolute;
  inset: -6px;
  border-radius: 14px;
  background: radial-gradient(ellipse at 50% 20%, rgba(201, 167, 255, 0.45), transparent 70%);
  opacity: 0;
  animation: miniGlow 1.15s ease-in-out infinite;
  pointer-events: none;
}

#shuffle-fan .mini:nth-child(odd)::after  { animation-delay: 0s; }
#shuffle-fan .mini:nth-child(even)::after { animation-delay: 0.57s; }

#shuffle-fan.shuffle-galaxy .mini {
  border-color: rgba(180, 210, 255, 0.65);
}

#shuffle-fan.shuffle-vip .mini {
  border-color: rgba(255, 210, 122, 0.7);
}

#shuffle-fan.shuffle-vip .mini::after {
  animation: none;
  opacity: 0;
}

#shuffle-fan.shuffle-minimal {
  width: 160px;
  margin-left: -80px;
}

.spark {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 8px;
  height: 8px;
  margin: -4px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(230, 210, 255, 1) 20%, rgba(201, 167, 255, 0.4) 65%, transparent 100%);
  pointer-events: none;
  opacity: 0;
}

#reading-badge {
  position: absolute;
  top: -8px;
  left: 50%;
  margin-left: -54px;
  width: 108px;
  padding: 6px 0;
  text-align: center;
  font-size: 14px;
  letter-spacing: 2px;
  border-radius: 999px;
  border: 1px solid rgba(255, 210, 122, 0.55);
  background: rgba(30, 16, 50, 0.88);
  color: #ffd27a;
  z-index: 2;
}

#reading-badge.badge-vip {
  width: 132px;
  margin-left: -66px;
  border-color: rgba(255, 210, 122, 0.85);
  color: #ffe08a;
  box-shadow: 0 0 14px rgba(255, 210, 122, 0.35);
}

#reading-badge.badge-galaxy {
  width: 150px;
  margin-left: -75px;
  border-color: rgba(180, 210, 255, 0.7);
  color: #d8e7ff;
  box-shadow: 0 0 16px rgba(140, 180, 255, 0.3);
}

#reading-badge.badge-minimal {
  border-color: rgba(201, 167, 255, 0.4);
  color: rgba(236, 231, 255, 0.85);
}

#ghost.shuffling {
  animation: float 5s ease-in-out infinite, bob 0.45s ease-in-out infinite alternate;
}

.card {
  width: var(--card-w);
  height: var(--card-h);
  perspective: 900px;
  opacity: 0;
  position: relative;
  z-index: 5;
}

.card.is-flying,
.card.focused {
  z-index: 25;
}

.card.focused::before {
  content: "";
  position: absolute;
  inset: -16px;
  border-radius: 18px;
  background: radial-gradient(ellipse at center, rgba(255, 224, 170, 0.55), transparent 70%);
  pointer-events: none;
  z-index: 0;
}

.card.focused .card-face {
  border-color: rgba(255, 230, 180, 0.95);
}

.card.dimmed {
  z-index: 4;
}

.card-position {
  position: absolute;
  left: 50%;
  bottom: -34px;
  width: 180px;
  margin-left: -90px;
  text-align: center;
  font-size: 14px;
  letter-spacing: 0.4px;
  color: rgba(236, 231, 255, 0.78);
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.45);
  pointer-events: none;
}

.card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
}

.card-face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  border-radius: 12px;
  border: 2px solid rgba(201, 167, 255, 0.55);
  overflow: hidden;
}

.card-back {
  background:
    repeating-linear-gradient(45deg, rgba(201, 167, 255, 0.18) 0 8px, transparent 8px 16px),
    linear-gradient(160deg, #2a1a56, #150c33);
}

.card-front {
  transform: rotateY(180deg);
  background:
    radial-gradient(1px 1px at 24% 20%, rgba(255,255,255,0.7) 50%, transparent 51%),
    radial-gradient(1px 1px at 72% 32%, rgba(255,255,255,0.5) 50%, transparent 51%),
    radial-gradient(1px 1px at 40% 76%, rgba(255,255,255,0.45) 50%, transparent 51%),
    radial-gradient(circle at 50% 42%, rgba(150, 110, 220, 0.28), transparent 62%),
    linear-gradient(170deg, #241650, #120a2b);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0;
  text-align: center;
}

/* Marco ornamental dibujado con CSS: la carta se ve intencional aunque no haya arte */
.card-front::before {
  content: "";
  position: absolute;
  inset: 5px;
  border: 1px solid rgba(201, 167, 255, 0.38);
  border-radius: 8px;
  pointer-events: none;
  z-index: 2;
}

.card-front::after {
  content: "";
  position: absolute;
  inset: 15px;
  border-top: 1px solid rgba(201, 167, 255, 0.18);
  border-bottom: 1px solid rgba(201, 167, 255, 0.18);
  pointer-events: none;
}

.card-front.has-art::after {
  display: none;
}

.card-front.has-art::before {
  inset: 3px;
}

.card-front img {
  position: absolute;
  inset: 4px;
  width: calc(100% - 8px);
  height: calc(100% - 8px);
  object-fit: cover;
  border-radius: 8px;
}

.card-front .placeholder {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
  padding: 12px;
  z-index: 1;
}

.card-front .roman {
  font-size: 42px;
  color: var(--accent);
  letter-spacing: 3px;
  line-height: 1;
}

.card-front .rule {
  width: 46px;
  height: 1px;
  background: rgba(201, 167, 255, 0.55);
  position: relative;
}

.card-front .rule::before {
  content: "";
  position: absolute;
  left: 50%;
  top: -2px;
  width: 5px;
  height: 5px;
  margin-left: -2.5px;
  background: var(--accent);
  transform: rotate(45deg);
}

.card-front .card-name {
  font-size: 19px;
  line-height: 1.25;
  letter-spacing: 0.5px;
}

.card.reversed .card-front .placeholder,
.card.reversed .card-front img { transform: rotate(180deg); }

.card-tag {
  position: absolute;
  bottom: 6px;
  width: 100%;
  text-align: center;
  font-size: 13px;
  letter-spacing: 1px;
  color: rgba(236, 231, 255, 0.7);
}

#caption {
  position: absolute;
  /* Pies de la muñeca ~638px (sprite 210+500). Encima de comentarios TikTok. */
  top: 642px;
  left: 48px;
  right: 48px;
  max-height: 128px;
  overflow: hidden;
  padding: 8px 16px;
  border-radius: 16px;
  background: rgba(9, 5, 24, 0.92);
  border: 1px solid rgba(201, 167, 255, 0.28);
  transition: opacity 0.5s;
  z-index: 30;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

#caption.hidden,
#caption-text.hidden,
#caption-karaoke.hidden {
  display: none !important;
}

#caption-text {
  font-size: 23px;
  line-height: 1.42;
  text-align: center;
  width: 100%;
  margin: 0 auto;
}

#caption-karaoke {
  font-size: 24px;
  line-height: 1.35;
  text-align: center;
  min-height: 2.4em;
  width: 100%;
  margin: 0 auto;
}

#caption-karaoke .kw {
  color: rgba(236, 231, 255, 0.45);
  margin: 0 3px;
}

#caption-karaoke .kw.spoken {
  color: rgba(236, 231, 255, 0.78);
}

#caption-karaoke .kw.active {
  color: #ffd27a;
}

#share-card {
  position: absolute;
  inset: 0;
  z-index: 20;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

#share-veil {
  position: absolute;
  inset: 0;
  background: rgba(4, 2, 14, 0.72);
}

#share-card-frame {
  position: relative;
  width: 580px;
  text-align: center;
  z-index: 1;
}

#share-card-img {
  width: 100%;
  height: auto;
  border-radius: 22px;
  border: 2px solid rgba(255, 210, 122, 0.55);
  box-shadow: 0 0 0 1px rgba(201, 167, 255, 0.25);
}

#share-card-cta {
  margin-top: 18px;
  font-size: 28px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: #ffd27a;
  text-shadow: 0 0 18px rgba(255, 210, 122, 0.35);
}

#share-card-label {
  margin-top: 8px;
  font-size: 20px;
  letter-spacing: 0.8px;
  color: rgba(236, 231, 255, 0.85);
}

#share-card.pulse #share-card-cta {
  animation: sharePulse 1.4s ease-in-out infinite;
}

@keyframes sharePulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.72; transform: scale(1.04); }
}

#idle {
  position: absolute;
  top: 830px;
  left: 60px;
  right: 60px;
  text-align: center;
  transition: opacity 0.6s;
}

#idle-text {
  font-size: 32px;
  line-height: 1.4;
  color: rgba(236, 231, 255, 0.88);
}

#idle.hidden { opacity: 0; visibility: hidden; }

/* Video idle con alpha (WebM VP9). Zoom: la muñeca llena el retrato, no el 16:9 lejano. */
#idle-video {
  position: absolute;
  top: 200px;
  left: calc(50% + var(--doll-shift-x));
  width: 1120px;
  height: 630px;
  margin-left: -560px;
  object-fit: contain;
  transform-origin: center top;
  transform-origin: center top;
  background: transparent;
  border: none;
  box-shadow: none;
  z-index: 14;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.12s ease;
}

#idle-video.is-on {
  opacity: 1;
  visibility: visible;
}

#idle-video.hidden {
  display: none;
}

#ghost.idle-video-hidden {
  opacity: 0 !important;
  visibility: hidden;
  pointer-events: none;
}

#disclaimer {
  position: absolute;
  bottom: 60px;
  left: 50%;
  width: 660px;
  margin-left: -330px;
  text-align: center;
  font-size: 15px;
  line-height: 1.35;
  letter-spacing: 0.2px;
  color: rgba(236, 231, 255, 0.8);
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.7);
}

#status-dot {
  position: absolute;
  left: 18px;
  bottom: 18px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #f06565;
}

#status-dot.online { background: #5fd48a; }

/* Leaderboard top gifters */
#leaderboard {
  position: absolute;
  bottom: 310px;
  left: 28px;
  width: 230px;
  padding: 12px 16px;
  border-radius: 18px;
  border: 1px solid rgba(255, 210, 122, 0.35);
  background: rgba(20, 12, 45, 0.82);
}

.lb-title {
  font-size: 14px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: rgba(255, 210, 122, 0.75);
  margin-bottom: 8px;
}

#lb-list {
  list-style: none;
  padding: 0;
}

#lb-list li {
  display: flex;
  justify-content: space-between;
  font-size: 15px;
  line-height: 1.55;
  color: rgba(236, 231, 255, 0.85);
}

#lb-list li .lb-gems {
  color: rgba(255, 210, 122, 0.85);
  font-size: 13px;
}

/* Aviso urgente de cupo bajo */
#quota-urgent {
  position: absolute;
  top: 118px;
  left: 28px;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 120, 80, 0.7);
  background: rgba(20, 6, 6, 0.82);
  font-size: 14px;
  letter-spacing: 0.5px;
  color: #ffb090;
  z-index: 4;
}

@keyframes quota-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.55; }
}

#quota-urgent.pulsing {
  animation: quota-pulse 1.2s ease-in-out infinite;
}


/* Modern Glassmorphic Gift Cards */
#gift-stack {
  position: absolute;
  top: 350px;
  right: 14px;
  width: 250px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 16;
  pointer-events: none;
}

.gift-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(30, 15, 48, 0.72);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(220, 195, 255, 0.28);
  border-radius: 16px;
  padding: 8px 14px 8px 10px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.5);
  transition: transform 0.2s ease;
}

.gift-card img.gift-img-heart {
  width: 44px;
  height: auto;
  filter: drop-shadow(0 2px 8px rgba(255, 100, 150, 0.6));
  flex-shrink: 0;
}

.gift-card img.gift-img {
  width: 42px;
  height: auto;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.65));
  flex-shrink: 0;
}

.gift-info {
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow: hidden;
}

.gift-name {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: 0.3px;
  line-height: 1.2;
  white-space: nowrap;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.9);
}

.gift-desc {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: #ffe194;
  letter-spacing: 0.2px;
  line-height: 1.2;
  margin-top: 2px;
  white-space: nowrap;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.9);
}

/* Video idle: 16:9 se mide por ALTO; 9:16 llena la misma caja que el sprite */
#idle-video-slot {
  position: absolute;
  top: var(--doll-slot-top);
  left: calc(50% + var(--doll-shift-x));
  width: var(--doll-slot-w);
  height: var(--doll-slot-h);
  margin-left: calc(var(--doll-slot-w) / -2);
  overflow: visible;
  z-index: 14;
  pointer-events: none;
  animation: float 5s ease-in-out infinite;
}

#idle-video {
  position: absolute;
  left: 50%;
  top: 48%;
  width: auto;
  height: var(--doll-video-h);
  margin: 0;
  object-fit: contain;
  object-position: center center;
  transform: translate(-50%, -50%);
  transform-origin: center center;
  background: transparent;
  border: none;
  box-shadow: none;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
}

#idle-video.is-portrait {
  height: 90%;
  width: auto;
}

#idle-video.is-landscape {
  height: var(--doll-video-h);
  width: auto;
}

#idle-video.is-tight-libro {
  height: 120%;
  width: auto;
}

#idle-video.is-tight-bola.is-portrait {
  height: 255%;
  width: auto;
}

#idle-video.is-tight-bola.is-landscape {
  height: 100%;
  width: auto;
}

#idle-video.is-on {
  opacity: 1;
  visibility: visible;
}

#theme-video,
#theme-loop {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
}

#theme-loop {
  z-index: 1;
}

#theme-video {
  z-index: 2;
}

#theme-video.is-on,
#theme-loop.is-on {
  opacity: 1;
  visibility: visible;
}

#previo-headline,
#previo-sub {
  position: absolute;
  left: 24px;
  right: 268px;
  z-index: 22;
  color: #f4ecff;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.85);
  pointer-events: none;
}

#previo-headline {
  top: 36px;
  font-size: 34px;
  font-weight: 700;
  line-height: 1.1;
}

#previo-sub {
  top: 78px;
  font-size: 18px;
  opacity: 0.92;
}

#collective {
  position: absolute;
  left: 50%;
  top: 430px;
  transform: translateX(-50%);
  display: flex;
  gap: 14px;
  z-index: 21;
}

#collective.hidden { display: none; }

.collective-card {
  width: 86px;
  height: 130px;
  border-radius: 10px;
  background: linear-gradient(180deg, #3b2060, #1a0d30);
  border: 2px solid #d7b4ff;
  color: #ffe9a8;
  font-size: 32px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.collective-card.spinning {
  animation: collective-spin 0.7s linear infinite;
}

.collective-card.winner {
  transform: scale(1.08);
  border-color: #ffe08a;
}

@keyframes collective-spin {
  from { transform: rotateY(0deg); }
  to { transform: rotateY(360deg); }
}

#queue-names .queue-lab {
  display: inline-block;
  min-width: 4.4em;
  font-size: 10px;
  letter-spacing: 0.5px;
  color: #cbb6ff;
  font-weight: 700;
}

#queue-names .queue-block {
  margin: 2px 0 4px;
}

#queue-names .queue-wait,
#queue-names .queue-consejo {
  margin-top: 4px;
  font-size: 12px;
}

#queue-names .queue-advice-title {
  margin: 6px 0 2px;
  font-size: 11px;
  letter-spacing: 0.4px;
  font-weight: 800;
  color: #ffe08a;
  text-transform: none;
}

#queue-names .queue-advice .queue-turn {
  font-size: 13px;
  color: #fff4d4;
}

