/* ===== La Gran Rifa: estilos ===== */
:root {
  --bg1: #020b24; --bg2: #0b2f73; --gold: #ffcf4a; --gold2: #d99a00; --navy: #0a2259;
  --accent: #2f7cf6; --text: #fff; --muted: #b9c8ea; --card: rgba(255,255,255,.07);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: Poppins, system-ui, sans-serif; color: var(--text);
  background: radial-gradient(circle at 50% 30%, var(--bg2), var(--bg1) 70%);
  background-color: var(--bg1); overflow-x: hidden;
}
body::before { /* destellos de fondo */
  content: ""; position: fixed; inset: 0; pointer-events: none; opacity: .35;
  background-image:
    radial-gradient(2px 2px at 10% 20%, #fff, transparent), radial-gradient(2px 2px at 80% 10%, #fff, transparent),
    radial-gradient(2px 2px at 30% 80%, #fff, transparent), radial-gradient(2px 2px at 70% 60%, #fff, transparent),
    radial-gradient(2px 2px at 50% 40%, #fff, transparent), radial-gradient(2px 2px at 90% 85%, #fff, transparent);
  animation: twinkle 3s ease-in-out infinite alternate;
}
@keyframes twinkle { to { opacity: .1; } }

/* huellitas 🐾 por toda la pantalla */
#paws { position: fixed; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; }
#paws svg { position: absolute; width: var(--s); height: var(--s); transform: translate(-50%, -50%) rotate(var(--r)); }
#paws .deco { color: var(--c); opacity: .1; animation: pawGlow 7s ease-in-out infinite; }
#paws .step { color: var(--gold); opacity: 0; animation: step 5.5s ease-out forwards; }
@keyframes pawGlow { 50% { opacity: .2; } }
@keyframes step {
  0% { opacity: 0; transform: translate(-50%, -50%) rotate(var(--r)) scale(.4); }
  8% { opacity: .32; transform: translate(-50%, -50%) rotate(var(--r)) scale(1); }
  65% { opacity: .22; transform: translate(-50%, -50%) rotate(var(--r)) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -50%) rotate(var(--r)) scale(1); }
}
.card { position: relative; }
.card::after { content: "🐾"; position: absolute; right: 12px; bottom: 8px; font-size: 34px; opacity: .14; transform: rotate(-20deg); pointer-events: none; }

header { text-align: center; padding: 14px 16px 0; }
h1 {
  font-family: Bungee, Poppins, sans-serif; margin: 0; letter-spacing: 2px;
  font-size: clamp(28px, 4.5vw, 56px);
  background: linear-gradient(90deg, var(--gold), #fff6d6, #7fb6ff, var(--gold));
  background-size: 300% 100%; -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: shine 6s linear infinite; filter: drop-shadow(0 4px 0 rgba(0,0,0,.35));
}
@keyframes shine { to { background-position: 300% 0; } }
.subtitle { color: var(--gold); margin: 4px 0 0; font-size: 18px; font-weight: 800; letter-spacing: 1px; }
.prize-row { margin-top: 8px; display: flex; gap: 8px; justify-content: center; align-items: center; flex-wrap: wrap; }
.prize-row input {
  background: var(--card); border: 2px solid rgba(255,209,102,.5); color: #fff; border-radius: 999px;
  padding: 8px 16px; font: 600 16px Poppins, sans-serif; width: min(360px, 80vw); text-align: center;
}
.prize-row input::placeholder { color: var(--muted); }

main {
  display: grid; grid-template-columns: 300px 1fr 300px; gap: 20px;
  padding: 16px 20px 24px; align-items: start; max-width: 1600px; margin: 0 auto;
}
.card { background: var(--card); border: 1px solid rgba(255,255,255,.12); border-radius: 20px; padding: 16px; backdrop-filter: blur(6px); }

/* ===== Doctor ===== */
.mascot { text-align: center; position: sticky; top: 12px; }
.bubble {
  position: relative; background: #fff; color: var(--navy); font-weight: 800; border-radius: 18px;
  padding: 12px 14px; min-height: 64px; display: flex; align-items: center; justify-content: center;
  font-size: 16px; line-height: 1.25; margin-bottom: 14px; box-shadow: 0 6px 0 rgba(0,0,0,.25);
}
.bubble::after {
  content: ""; position: absolute; bottom: -12px; left: 50%; transform: translateX(-50%);
  border: 12px solid transparent; border-top-color: #fff; border-bottom: 0;
}
.doc-stage { height: 250px; display: flex; align-items: flex-end; justify-content: center; gap: 4px; }
.doc-stage img { max-width: 100%; max-height: 250px; border-radius: 16px; }
/* mascotas: poses dibujadas que se intercambian con un "pop" (como cambiar de dibujo) */
.doc { width: 52%; max-width: 200px; overflow: visible; transform-origin: 50% 100%; animation: breathe 3.2s ease-in-out infinite; }
.doc + .doc { animation-delay: -1.3s; }
.doc .pose { opacity: 0; transition: opacity .16s; transform-box: view-box; transform-origin: 120px 232px; }
.doc .pose.on { opacity: 1; animation: poseIn .42s cubic-bezier(.3, 1.5, .5, 1); }
.doc .eyes { transform-box: fill-box; transform-origin: center; animation: blink 4.5s infinite; }
.doc + .doc .eyes { animation-delay: -2s; }
.doc.spinning { animation: hop .55s ease-in-out infinite; }
.doc.spinning + .doc.spinning { animation-delay: -.27s; }
.doc.win { animation: pounce .9s cubic-bezier(.3, 0, .3, 1) infinite; }
.doc.win + .doc.win { animation-delay: -.45s; }
/* partes que se mueven solas (solo en la pose visible, para no gastar en las ocultas) */
.doc .cola, .doc .saludo { transform-box: view-box; }
.doc .pose.on .cola { animation: colita 2.6s ease-in-out infinite; }
.doc.spinning .pose.on .cola { animation-duration: .6s; }
.doc.win .pose.on .cola { animation: colitaFeliz .4s ease-in-out infinite; }
.doc + .doc .pose.on .cola { animation-delay: -1.1s; }
.doc .oreja { transform-box: fill-box; transform-origin: 50% 100%; }
.doc .pose.on .oreja.izq { animation: orejaIzq 5.2s ease-in-out infinite; }
.doc .pose.on .oreja.der { animation: orejaDer 6.8s ease-in-out infinite 1.4s; }
.doc.win .pose.on .oreja { animation-duration: 1.6s; }
.doc .cabeza { transform-box: fill-box; transform-origin: 50% 90%; }
.doc .pose.on .cabeza { animation: cabecea 4.2s ease-in-out infinite; }
.doc + .doc .pose.on .cabeza { animation-delay: -2.1s; }
.doc.spinning .pose.on .cabeza { animation: siguelaRuleta 1.1s ease-in-out infinite; }
.doc .bigotes { transform-box: fill-box; transform-origin: center; }
.doc .pose.on .bigotes { animation: bigotes 3.4s ease-in-out infinite; }
.doc .pose.on .saludo { animation: saluda .7s ease-in-out infinite; }
.doc .destello { opacity: 0; }
.doc .pose.on .destello { animation: destello 3.8s ease-in-out infinite; }
.doc .corazones path { opacity: 0; transform-box: fill-box; transform-origin: center; }
.doc .pose.on .corazones path { animation: flota 2.4s ease-out infinite; }
.doc .pose.on .corazones path:nth-child(2) { animation-delay: .8s; }
.doc .pose.on .corazones path:nth-child(3) { animation-delay: 1.6s; }
@keyframes colita { 0%, 100% { transform: rotate(0); } 50% { transform: rotate(-8deg); } }
@keyframes colitaFeliz { 0%, 100% { transform: rotate(5deg); } 50% { transform: rotate(-14deg); } }
@keyframes orejaIzq { 0%, 86%, 100% { transform: rotate(0); } 89% { transform: rotate(-16deg); } 93% { transform: rotate(5deg); } 96% { transform: rotate(-6deg); } }
@keyframes orejaDer { 0%, 86%, 100% { transform: rotate(0); } 89% { transform: rotate(16deg); } 93% { transform: rotate(-5deg); } 96% { transform: rotate(6deg); } }
@keyframes cabecea { 0%, 100% { transform: rotate(0); } 30% { transform: rotate(3deg); } 70% { transform: rotate(-3deg); } }
@keyframes siguelaRuleta { 0%, 100% { transform: rotate(-6deg) translateX(-2px); } 50% { transform: rotate(6deg) translateX(2px); } }
@keyframes bigotes { 0%, 78%, 100% { transform: scale(1); } 82% { transform: scale(1.04, 1.18) rotate(2deg); } 86% { transform: scale(1); } 90% { transform: scale(1.03, 1.12) rotate(-2deg); } }
@keyframes saluda { 0%, 100% { transform: rotate(0); } 50% { transform: rotate(-16deg); } }
@keyframes destello { 0%, 70%, 100% { opacity: 0; } 78% { opacity: .9; } 86% { opacity: 0; } }
@keyframes flota {
  0% { opacity: 0; transform: translateY(6px) scale(.5); }
  20% { opacity: 1; transform: translateY(0) scale(1); }
  100% { opacity: 0; transform: translateY(-26px) scale(.8) rotate(12deg); }
}
@media (prefers-reduced-motion: reduce) {
  .doc, .doc * { animation: none !important; }
}
@keyframes breathe { 50% { transform: scale(1.012, 1.025); } }
@keyframes poseIn { from { transform: scale(.88, 1.1) translateY(4px); } 60% { transform: scale(1.04, .97); } to { transform: none; } }
@keyframes hop { 0%, 100% { transform: scale(1.03, .97); } 50% { transform: translateY(-6px) scale(.99, 1.02); } }
@keyframes pounce {
  0%, 100% { transform: scale(1.08, .9); }
  35% { transform: translateY(-30px) scale(.95, 1.06); }
  55% { transform: translateY(-32px) scale(1, 1); }
  85% { transform: translateY(0) scale(1.02, .98); }
}
@keyframes blink { 0%, 93%, 100% { transform: scaleY(1); } 96% { transform: scaleY(.1); } }
.logos { display: inline-flex; gap: 10px; align-items: center; justify-content: center; }
.logos img { width: clamp(44px, 5vw, 70px); aspect-ratio: 1; object-fit: cover; border-radius: 50%; border: 3px solid var(--gold); background: #fff; box-shadow: 0 4px 14px rgba(0,0,0,.4); }
.logos img.logo-contain { object-fit: contain; padding: clamp(7px, 1vw, 12px); }

.btns { display: grid; gap: 8px; margin-top: 16px; }
button {
  font: 800 15px Poppins, sans-serif; border: 0; border-radius: 14px; padding: 11px 14px; cursor: pointer;
  background: rgba(255,255,255,.12); color: #fff; transition: transform .1s, background .2s;
}
button:hover { background: rgba(255,255,255,.2); }
button:active { transform: scale(.97); }
button:disabled { opacity: .5; cursor: not-allowed; }
.toggle { display: flex; gap: 8px; align-items: center; justify-content: center; color: var(--muted); font-size: 14px; margin-top: 10px; cursor: pointer; }
.toggle input { width: 18px; height: 18px; accent-color: var(--gold); }

/* ===== Ruleta ===== */
.wheel-col { display: flex; flex-direction: column; align-items: center; }
.ticker {
  font-family: Bungee, Poppins, sans-serif; font-size: clamp(18px, 2.4vw, 30px); min-height: 1.5em;
  color: var(--gold); text-align: center; margin-bottom: 6px; text-shadow: 0 3px 0 rgba(0,0,0,.4);
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.wheel-wrap { position: relative; width: min(72vh, 100%); aspect-ratio: 1; }
.wheel-wrap::before { /* resplandor */
  content: ""; position: absolute; inset: -4%; border-radius: 50%;
  background: radial-gradient(circle, rgba(255,207,74,.35), rgba(47,124,246,.18) 55%, transparent 70%); filter: blur(12px);
  animation: glow 3s ease-in-out infinite alternate; will-change: opacity;
}
@keyframes glow { to { opacity: .6; } }   /* solo opacidad: no obliga a redibujar el desenfoque */
#wheel { position: relative; width: 100%; height: 100%; display: block; border-radius: 50%; box-shadow: 0 20px 60px rgba(0,0,0,.6), 0 0 0 4px rgba(255,207,74,.35); will-change: transform; }
.gloss { /* brillo fijo encima de la ruleta (no gira) */
  position: absolute; inset: 0; border-radius: 50%; pointer-events: none; z-index: 1;
  background: radial-gradient(circle at 32% 22%, rgba(255,255,255,.28), rgba(255,255,255,.06) 32%, transparent 55%),
              radial-gradient(circle, transparent 62%, rgba(0,10,40,.25) 100%);
}
.pointer {
  position: absolute; top: -3.2%; left: 50%; width: 9%; transform: translateX(-50%); transform-origin: 50% 20%;
  z-index: 3; filter: drop-shadow(0 4px 3px rgba(0,0,0,.5));
}
.pointer.flick { animation: flick .12s ease-out; }
@keyframes flick { 40% { transform: translateX(-50%) rotate(-22deg); } }
.hub {
  position: absolute; top: 50%; left: 50%; width: 22%; aspect-ratio: 1; transform: translate(-50%, -50%);
  border-radius: 50%; z-index: 2; padding: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1;
  background: radial-gradient(circle at 35% 30%, #fff6d6, var(--gold) 45%, var(--gold2));
  border: 7px solid var(--navy); color: var(--navy); font-family: Bungee, Poppins, sans-serif; font-size: clamp(14px, 2.2vw, 28px);
  box-shadow: 0 0 0 4px var(--gold), 0 8px 0 4px #8a6100, 0 14px 30px rgba(0,0,0,.5); animation: pulse 1.4s ease-in-out infinite;
}
/* huella del botón: grabada en azul con un filo claro abajo, como estampada en el oro */
.hub .hub-paw {
  width: 40%; height: auto; margin-bottom: 5%; color: var(--navy);
  transform: rotate(-12deg); transition: transform .2s;
  filter: drop-shadow(0 2px 0 rgba(255,255,255,.6));
}
.hub:hover:not(:disabled) .hub-paw { transform: rotate(-12deg) scale(1.12); }
.hub:hover { background: radial-gradient(circle at 35% 30%, #fff, var(--gold) 45%, var(--gold2)); }
.hub:active { transform: translate(-50%, -46%); }
.hub:disabled { animation: none; opacity: 1; }
@keyframes pulse { 50% { box-shadow: 0 0 0 4px var(--gold), 0 8px 0 4px #8a6100, 0 0 0 18px rgba(255,207,74,.22), 0 14px 30px rgba(0,0,0,.5); } }
.hint { color: var(--muted); font-size: 13px; margin-top: 12px; text-align: center; }

/* ===== Ganadores ===== */
.side h2 { font-family: Bungee, Poppins, sans-serif; font-size: 20px; margin: 0 0 4px; color: var(--gold); }
.count { color: var(--muted); font-size: 14px; margin-bottom: 12px; }
.count b { color: #fff; font-size: 22px; }
ol.winners { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; max-height: 55vh; overflow-y: auto; overflow-x: hidden; }
ol.winners li {
  background: linear-gradient(90deg, rgba(255,207,74,.22), rgba(47,124,246,.15)); border-radius: 12px; border-left: 4px solid var(--gold);
  padding: 8px 10px; display: grid; grid-template-columns: 34px 1fr; gap: 8px; align-items: center;
  animation: slideIn .5s ease-out;
}
ol.winners .n { font-family: Bungee, sans-serif; color: var(--gold); font-size: 18px; text-align: center; }
ol.winners .nm { font-weight: 800; font-size: 14px; line-height: 1.2; }
ol.winners .pr { color: var(--muted); font-size: 12px; }
.empty { color: var(--muted); font-size: 14px; text-align: center; padding: 18px 0; }
@keyframes slideIn { from { opacity: 0; transform: translateX(30px); } }

/* ===== Modales ===== */
.modal { position: fixed; inset: 0; background: rgba(2,8,30,.8); display: none; align-items: center; justify-content: center; z-index: 50; padding: 16px; }
.modal.open { display: flex; }
.modal .box {
  background: linear-gradient(160deg, #13489e, #061a45); border: 4px solid var(--gold); border-radius: 28px;
  padding: 28px 24px; text-align: center; width: min(640px, 100%); max-height: 92vh; overflow: auto;
  box-shadow: 0 0 0 6px rgba(255,207,74,.25), 0 0 90px rgba(255,207,74,.45); animation: popIn .6s cubic-bezier(.2,1.6,.4,1);
}
#winModal .box { position: relative; overflow: hidden; }
#winModal .box::before { /* rayos de luz girando detrás del ganador */
  content: ""; position: absolute; inset: -60%; z-index: 0; pointer-events: none;
  background: repeating-conic-gradient(from 0deg, rgba(255,207,74,.13) 0 10deg, transparent 10deg 20deg);
  animation: rays 14s linear infinite;
}
#winModal .box > * { position: relative; z-index: 1; }
@keyframes rays { to { transform: rotate(360deg); } }
@keyframes popIn { from { transform: scale(.3) rotate(-10deg); opacity: 0; } }
.win-label { font-family: Bungee, sans-serif; color: var(--gold); font-size: clamp(22px, 4vw, 34px); margin: 0; }
.win-name {
  font-family: Bungee, Poppins, sans-serif; font-size: clamp(26px, 5.5vw, 52px); line-height: 1.1; margin: 14px 0 6px;
  color: #fff; text-shadow: 0 4px 0 #1756b8, 0 0 30px rgba(255,207,74,.7); animation: zoom 1.2s ease-in-out infinite alternate;
}
@keyframes zoom { to { transform: scale(1.05); } }
.win-prize { color: var(--muted); font-size: 18px; margin-bottom: 8px; }
.win-media { display: flex; justify-content: center; margin: 8px 0 14px; }
.win-media img { max-height: 240px; max-width: 100%; border-radius: 16px; }
.win-media .doc { width: 150px; }
.win-media { gap: 6px; }
.modal .actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.primary { background: linear-gradient(180deg, #ffdb6e, var(--gold2)); color: var(--navy); box-shadow: 0 5px 0 #8a6100; }
.primary:hover { background: linear-gradient(180deg, #ffe596, #e8a800); }
textarea {
  width: 100%; height: 50vh; border-radius: 14px; border: 2px solid rgba(255,255,255,.2); background: rgba(0,0,0,.3);
  color: #fff; font: 14px/1.5 Poppins, sans-serif; padding: 12px; margin: 12px 0; resize: vertical;
}
#confetti { position: fixed; inset: 0; pointer-events: none; z-index: 60; width: 100%; height: 100%; }

@media (max-width: 1100px) {
  main { grid-template-columns: 1fr; }
  .wheel-col { order: -1; }
  .mascot { position: static; }
  .wheel-wrap { width: min(92vw, 70vh); }
}

/* ===== Zarpazo al girar ===== */
.claw-layer { position: absolute; inset: -6%; z-index: 4; pointer-events: none; }
.claw-paw {
  position: absolute; width: 40%; left: 50%; top: 50%;
  filter: drop-shadow(0 12px 16px rgba(0,0,0,.55));
  animation: swipe .5s cubic-bezier(.5, 0, .75, .4) forwards;
}
@keyframes swipe {
  0%   { transform: translate(40%, -160%) rotate(-135deg) scale(.85); opacity: 0; }
  15%  { opacity: 1; }
  80%  { opacity: 1; }
  100% { transform: translate(-170%, 70%) rotate(-135deg) scale(1.05); opacity: 0; }
}
/* rasguños: cada uno es un corte oscuro con filo dorado y brillo blanco */
.slashes { overflow: visible; }
.slashes .tear { fill: #04102b; stroke: var(--gold); stroke-width: .7; stroke-linejoin: round; }
.slashes .shine { fill: none; stroke: #fff6d6; stroke-width: .35; stroke-linecap: round; opacity: .9; }
.slashes .slash { transform-box: view-box; transform: scale(0); animation: slash .22s ease-out forwards; }
.slashes .slash:nth-of-type(2) { animation-delay: .06s; }
.slashes .slash:nth-of-type(3) { animation-delay: .12s; }
@keyframes slash { to { transform: scale(1); } }
.claw-marks {
  position: absolute; left: 8%; top: 8%; width: 84%; height: 84%;
  filter: drop-shadow(0 0 6px rgba(255,207,74,.85)); animation: marksOut 2.4s ease-in forwards;
}
.claw-marks .slash { animation-delay: .15s; }
.claw-marks .slash:nth-of-type(2) { animation-delay: .21s; }
.claw-marks .slash:nth-of-type(3) { animation-delay: .27s; }
@keyframes marksOut { 0%, 55% { opacity: 1; } 100% { opacity: 0; } }
.wheel-wrap.shake { animation: shake .45s ease-out; }
@keyframes shake {
  15% { transform: translate(-8px, 6px) rotate(-1deg); }
  30% { transform: translate(7px, -5px) rotate(1deg); }
  45% { transform: translate(-5px, 4px); }
  60% { transform: translate(4px, -2px); }
  80% { transform: translate(-2px, 1px); }
}
/* rasguños dorados en la esquina de la ventana del ganador */
#winModal .box > .win-claws {
  position: absolute; left: 10px; bottom: 10px; width: 150px; height: 150px; z-index: 0; opacity: .9;
  filter: drop-shadow(0 0 5px rgba(255,207,74,.7));
}
.win-claws .tear { stroke-width: 1.6; }
.win-claws .slash { animation-delay: .5s; }
.win-claws .slash:nth-of-type(2) { animation-delay: .56s; }
.win-claws .slash:nth-of-type(3) { animation-delay: .62s; }

/* ===== Latido de suspenso ===== */
.hub.beat { animation: hubBeat .4s ease-out; }
@keyframes hubBeat {
  0%   { transform: translate(-50%, -50%) scale(1); }
  15%  { transform: translate(-50%, -50%) scale(1.12); }
  30%  { transform: translate(-50%, -50%) scale(1.02); }
  45%  { transform: translate(-50%, -50%) scale(1.08); }
  100% { transform: translate(-50%, -50%) scale(1); }
}
#heartGlow {
  position: fixed; inset: 0; z-index: 5; pointer-events: none; opacity: 0;
  background: radial-gradient(ellipse at center, transparent 55%, rgba(220, 20, 60, .38) 100%);
}
#heartGlow.beat { animation: heartGlow .5s ease-out; }
@keyframes heartGlow { 0% { opacity: 0; } 15% { opacity: 1; } 35% { opacity: .4; } 50% { opacity: .8; } 100% { opacity: 0; } }

/* ===== Selector de sonido del ganador ===== */
.sound-pick { margin-top: 12px; text-align: left; }
.sound-pick label { display: block; color: var(--muted); font-size: 13px; margin-bottom: 6px; }
.sound-row { display: flex; gap: 6px; }
.sound-row select {
  flex: 1; min-width: 0; font: 600 14px Poppins, sans-serif; color: #fff; cursor: pointer;
  background: rgba(255,255,255,.1); border: 2px solid rgba(255,207,74,.45); border-radius: 12px; padding: 8px 10px;
}
.sound-row select option { background: var(--navy); color: #fff; }
.sound-row button { padding: 8px 14px; background: var(--gold); color: var(--navy); }
.sound-row button:hover { background: #ffe08a; }

/* ===== Pantera asomándose sobre el panel de ganadores ===== */
.side { padding-top: 28px; }
.side .peek {
  position: absolute; left: 50%; bottom: calc(100% - 16px); width: 220px; z-index: 2; pointer-events: none;
  transform: translateX(-50%); transform-origin: 50% 100%;
  filter: drop-shadow(0 10px 14px rgba(0,0,0,.5));
  animation: peekBreath 3.5s ease-in-out infinite;
}
@keyframes peekBreath { 50% { transform: translateX(-50%) translateY(-4px) scale(1.02); } }
/* mientras gira la ruleta se emociona */
body.is-spinning .side .peek { animation: peekHype .45s ease-in-out infinite alternate; }
@keyframes peekHype {
  from { transform: translateX(-50%) translateY(0) rotate(-2deg); }
  to   { transform: translateX(-50%) translateY(-12px) rotate(2deg); }
}
@media (max-width: 1100px) { .side { margin-top: 150px; } }

/* =====================================================================
   Animaciones generales: fondo, encabezado, ruleta y ganadores
   ===================================================================== */

/* ---- fondo: auroras que se mueven despacio y chispas que suben ---- */
body::after {
  content: ""; position: fixed; inset: -20%; z-index: -2; pointer-events: none;
  background:
    radial-gradient(35% 30% at 25% 30%, rgba(47,124,246,.28), transparent 70%),
    radial-gradient(30% 28% at 75% 70%, rgba(255,207,74,.16), transparent 70%),
    radial-gradient(28% 25% at 70% 20%, rgba(127,182,255,.16), transparent 70%);
  animation: aurora 26s ease-in-out infinite alternate; will-change: transform;
}
@keyframes aurora {
  0% { transform: translate(0, 0) rotate(0deg) scale(1); }
  50% { transform: translate(4%, -3%) rotate(8deg) scale(1.08); }
  100% { transform: translate(-4%, 3%) rotate(-6deg) scale(1.02); }
}
#chispas { position: fixed; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; }
#chispas span {
  position: absolute; bottom: -10px; width: var(--t); height: var(--t); border-radius: 50%;
  box-shadow: 0 0 8px currentColor; opacity: 0; animation: sube var(--d) linear infinite;
}
@keyframes sube {
  0% { transform: translate(0, 0); opacity: 0; }
  10% { opacity: .8; }
  80% { opacity: .5; }
  100% { transform: translate(var(--x), -105vh); opacity: 0; }
}
body.is-spinning #chispas span { animation-duration: calc(var(--d) / 3); }
#paws .deco { animation: pawGlow 7s ease-in-out infinite, pawFlota 9s ease-in-out infinite; }
@keyframes pawFlota { 50% { margin-top: -8px; } }

/* ---- encabezado: logos que flotan y subtítulo que late ---- */
.logos img { animation: logoFlota 4s ease-in-out infinite; }
.logos img:last-child { animation-delay: -2s; }
@keyframes logoFlota { 0%, 100% { transform: translateY(0) rotate(-4deg); } 50% { transform: translateY(-6px) rotate(4deg); } }
.subtitle { animation: late 2.2s ease-in-out infinite; }
@keyframes late { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.06); } }

/* ---- botón principal con un brillo que lo cruza ---- */
.primary { position: relative; overflow: hidden; }
.primary::after {
  content: ""; position: absolute; top: 0; bottom: 0; left: -60%; width: 40%; pointer-events: none;
  background: linear-gradient(100deg, transparent, rgba(255,255,255,.65), transparent);
  transform: skewX(-20deg); animation: barrido 3.2s ease-in-out infinite;
}
.primary:disabled::after { animation: none; }
@keyframes barrido { 0%, 55% { left: -60%; } 100% { left: 130%; } }

/* ---- ruleta: focos de feria, destello del cristal y puntero inquieto ---- */
.focos { position: absolute; inset: 0; pointer-events: none; z-index: 2; }
.focos span {
  position: absolute; width: 2.1%; aspect-ratio: 1; border-radius: 50%; transform: translate(-50%, -50%);
  background: #fff6d6; box-shadow: 0 0 6px 2px rgba(255,207,74,.8);
  animation: foco 1.2s steps(1) infinite;
}
.focos span.par { animation-delay: -.6s; }
@keyframes foco { 0% { background: #fff6d6; box-shadow: 0 0 8px 3px rgba(255,207,74,.9); } 50% { background: #8a6a1c; box-shadow: none; } }
body.is-spinning .focos span { animation-duration: .24s; }
body.is-spinning .focos span.par { animation-delay: -.12s; }
body.celebrando .focos span { animation: focoFiesta .5s steps(1) infinite; }
body.celebrando .focos span.par { animation-delay: -.25s; }
@keyframes focoFiesta {
  0% { background: #ffcf4a; box-shadow: 0 0 12px 4px rgba(255,207,74,.95); }
  33% { background: #7fb6ff; box-shadow: 0 0 12px 4px rgba(127,182,255,.95); }
  66% { background: #ff7aa2; box-shadow: 0 0 12px 4px rgba(255,122,162,.95); }
}
.gloss { overflow: hidden; }
.gloss::after {
  content: ""; position: absolute; top: -20%; bottom: -20%; left: -40%; width: 30%;
  background: linear-gradient(100deg, transparent, rgba(255,255,255,.22), transparent);
  transform: rotate(20deg); animation: cristal 7s ease-in-out infinite;
}
@keyframes cristal { 0%, 70% { left: -40%; } 100% { left: 120%; } }
body.is-spinning .wheel-wrap::before { animation-duration: .45s; }
body:not(.is-spinning) .pointer { animation: punteroInquieto 2.6s ease-in-out infinite; }
@keyframes punteroInquieto { 0%, 100% { transform: translateX(-50%) rotate(0); } 50% { transform: translateX(-50%) rotate(-6deg) translateY(-2px); } }
body.celebrando .ticker { animation: zoom .6s ease-in-out infinite alternate; }

/* ---- ganadores: trofeo inquieto, entradas en cascada y brillo al nuevo ---- */
.trofeo { display: inline-block; transform-origin: 50% 90%; animation: trofeo 3s ease-in-out infinite; }
@keyframes trofeo { 0%, 70%, 100% { transform: rotate(0) scale(1); } 76% { transform: rotate(-16deg) scale(1.2); } 84% { transform: rotate(14deg) scale(1.2); } 92% { transform: rotate(-6deg) scale(1.05); } }
body.celebrando .trofeo { animation-duration: .9s; }
ol.winners li { animation-fill-mode: backwards; transition: transform .2s, box-shadow .2s; position: relative; overflow: hidden; }
ol.winners li:hover { transform: translateX(-4px); box-shadow: 0 6px 16px rgba(0,0,0,.3); }
ol.winners li.nuevo {
  animation: slideIn .5s ease-out backwards, nuevoBrillo 1.1s ease-in-out .5s 4;
  border-left-color: #fff;
}
ol.winners li.nuevo::after {
  content: ""; position: absolute; top: 0; bottom: 0; left: -50%; width: 40%; pointer-events: none;
  background: linear-gradient(100deg, transparent, rgba(255,255,255,.55), transparent);
  animation: barrido 1.6s ease-in-out .5s 3 both;
}
ol.winners li.nuevo .n { animation: numeroSalta .6s ease-out .5s 3; display: inline-block; }
@keyframes nuevoBrillo { 50% { box-shadow: 0 0 0 2px var(--gold), 0 0 22px rgba(255,207,74,.75); } }
@keyframes numeroSalta { 40% { transform: translateY(-6px) scale(1.3); } }

/* quien prefiera menos movimiento ve todo quieto */
@media (prefers-reduced-motion: reduce) {
  body::after, #chispas, .focos span, .gloss::after, .primary::after, .logos img, .subtitle,
  .pointer, .trofeo, ol.winners li, ol.winners li::after, ol.winners .n, #paws .deco { animation: none !important; }
  #chispas { display: none; }
}

/* =====================================================================
   Día del Médico: listón, electrocardiograma y detalles de la ventana del ganador
   ===================================================================== */
.dia-medico {
  display: table; margin: 0 auto 8px; padding: 5px 18px; border-radius: 999px;
  font: 800 13px Poppins, sans-serif; letter-spacing: 1.5px; text-transform: uppercase; color: var(--navy);
  background: linear-gradient(90deg, #ffe596, var(--gold), #ffe596); background-size: 200% 100%;
  box-shadow: 0 4px 0 #8a6100, 0 0 18px rgba(255,207,74,.35);
  animation: liston 4s linear infinite, late 2.2s ease-in-out infinite;
}
@keyframes liston { to { background-position: 200% 0; } }
.ekg { display: block; width: min(560px, 86vw); height: 34px; margin: 2px auto 0; overflow: visible; }
.ekg path { fill: none; stroke-linejoin: round; stroke-linecap: round; }
.ekg-base { stroke: rgba(127,182,255,.25); stroke-width: 2; }
.ekg-pulso {
  stroke: #7fffd4; stroke-width: 3; filter: drop-shadow(0 0 4px #7fffd4);
  stroke-dasharray: 140 1100; animation: ekg 2.4s linear infinite;
}
@keyframes ekg { from { stroke-dashoffset: 1240; } to { stroke-dashoffset: 0; } }
body.is-spinning .ekg-pulso { animation-duration: .9s; }
body.celebrando .ekg-pulso { stroke: var(--gold); filter: drop-shadow(0 0 5px var(--gold)); animation-duration: .6s; }
#paws .deco.cruz, #paws .deco.corazon { opacity: .13; }
#paws .deco.corazon { animation: pawGlow 7s ease-in-out infinite, latido 1.3s ease-in-out infinite; }
@keyframes latido { 0%, 100% { scale: 1; } 15% { scale: 1.18; } 30% { scale: 1; } 45% { scale: 1.12; } }
.win-felicidad {
  margin-top: 6px; font-weight: 800; font-size: clamp(14px, 1.8vw, 18px); color: #fff6d6;
  text-shadow: 0 2px 0 rgba(0,0,0,.35); animation: late 1.6s ease-in-out infinite;
}
@media (prefers-reduced-motion: reduce) {
  .dia-medico, .ekg-pulso, #paws .deco.corazon, .win-felicidad { animation: none !important; }
}

/* =====================================================================
   Ventana de reiniciar la rifa
   ===================================================================== */
.modal .reset-box { position: relative; overflow: hidden; width: min(520px, 100%); }
.reset-box::before { /* rayos rojizos girando, como en la del ganador pero de advertencia */
  content: ""; position: absolute; inset: -60%; z-index: 0; pointer-events: none;
  background: repeating-conic-gradient(from 0deg, rgba(255,122,122,.09) 0 10deg, transparent 10deg 20deg);
  animation: rays 22s linear infinite reverse;
}
.reset-box > * { position: relative; z-index: 1; }
.reset-icono {
  display: grid; place-items: center; width: 70px; height: 70px; margin: 0 auto 8px; border-radius: 50%;
  font-size: 38px; background: radial-gradient(circle at 35% 30%, #fff6d6, var(--gold) 55%, var(--gold2));
  box-shadow: 0 0 0 5px var(--navy), 0 0 0 9px var(--gold), 0 0 30px rgba(255,207,74,.6);
  animation: reciclar 2.4s ease-in-out infinite;
}
@keyframes reciclar { 0% { transform: rotate(0); } 60%, 100% { transform: rotate(360deg); } }
.reset-mascotas .doc { width: 120px; }
.reset-datos { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 4px 0 10px; }
.reset-dato {
  padding: 12px 10px; border-radius: 16px; background: rgba(255,255,255,.08); border: 2px solid rgba(255,207,74,.45);
  display: flex; flex-direction: column; align-items: center; gap: 2px;
}
.reset-dato b { font-family: Bungee, Poppins, sans-serif; font-size: 32px; color: var(--gold); line-height: 1; }
.reset-dato span { font-size: 13px; color: var(--muted); font-weight: 600; }
.reset-dato.peligro { border-color: rgba(255,122,122,.6); background: rgba(255,90,90,.10); }
.reset-dato.peligro b { color: #ff8a8a; }
.reset-aviso { margin: 0 0 14px; font-size: 13px; color: #ffb3b3; font-weight: 600; }
.peligro-btn {
  background: linear-gradient(180deg, #ff8a8a, #d93a3a); color: #fff; box-shadow: 0 5px 0 #8f1f1f;
}
.peligro-btn:hover { background: linear-gradient(180deg, #ffa3a3, #e84a4a); }
.modal button:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }
@media (max-width: 480px) { .reset-datos { grid-template-columns: 1fr; } }
@media (prefers-reduced-motion: reduce) { .reset-box::before, .reset-icono { animation: none !important; } }
