/* Selector aleatorio (reel cinemático)
   (archivo: css/components/random-selector.css) */
/* ============================================================
   RANDOM SELECTOR — CINEMATIC REEL
   ============================================================ */
@keyframes rsmIn {
  0%   { opacity:0; transform:scale(0.82) translateY(28px) rotateX(6deg); }
  55%  { opacity:1; transform:scale(1.04) translateY(-4px) rotateX(0); }
  75%  { transform:scale(0.98) translateY(1px); }
  100% { transform:scale(1) translateY(0); }
}
@keyframes rsmOverlayIn {
  from { opacity:0; backdrop-filter:blur(0px); }
  to   { opacity:1; backdrop-filter:blur(6px); }
}
@keyframes rsmTitlePulse {
  0%,100% { text-shadow: 0 0 14px rgba(255,215,0,0.5), 0 0 30px rgba(255,215,0,0.2), 1px 1px 0 #000; }
  50%     { text-shadow: 0 0 28px rgba(255,215,0,0.9), 0 0 60px rgba(255,215,0,0.4), 1px 1px 0 #000; }
}
@keyframes rsmBorderGlow {
  0%,100% { box-shadow: 0 0 18px rgba(255,215,0,0.25), 0 24px 70px rgba(0,0,0,0.9); }
  50%     { box-shadow: 0 0 40px rgba(255,215,0,0.55), 0 24px 70px rgba(0,0,0,0.9); }
}
@keyframes rsmWinGlow {
  0%   { box-shadow: 0 0 0   rgba(255,215,0,0),   0 24px 70px rgba(0,0,0,0.9); border-color:#FFD700; }
  30%  { box-shadow: 0 0 80px rgba(255,215,0,0.8), 0 24px 70px rgba(0,0,0,0.9); border-color:#fff8c0; }
  100% { box-shadow: 0 0 32px rgba(255,215,0,0.4), 0 24px 70px rgba(0,0,0,0.9); border-color:#FFD700; }
}
@keyframes rsmWinName {
  0%   { opacity:0; transform:scale(0.7) translateY(10px); letter-spacing:12px; color:#fff; }
  50%  { opacity:1; transform:scale(1.08) translateY(-2px); letter-spacing:4px; color:#ffe066; }
  100% { opacity:1; transform:scale(1)   translateY(0);    letter-spacing:1.5px; }
}
@keyframes rsmConfettiDrop {
  0%   { transform: translateY(-10px) rotate(0deg); opacity:1; }
  80%  { opacity:1; }
  100% { transform: translateY(120px) rotate(var(--r,360deg)); opacity:0; }
}
@keyframes rsmScanline {
  0%   { transform: translateY(-100%); }
  100% { transform: translateY(100%); }
}
@keyframes rsmTickerBounce {
  0%,100% { transform: scaleY(1); }
  40%     { transform: scaleY(1.35); }
  60%     { transform: scaleY(0.85); }
}
@keyframes rsmReelFlash {
  0%,100% { opacity:0; }
  50%     { opacity:1; }
}
@keyframes rsmArrowBounce {
  0%,100% { transform: translateX(0); }
  50%     { transform: translateX(5px); }
}
@keyframes rsmArrowBounceL {
  0%,100% { transform: translateX(0); }
  50%     { transform: translateX(-5px); }
}

#random-selector-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 860;
  background: rgba(0,0,0,0.92);
  align-items: center;
  justify-content: center;
  animation: rsmOverlayIn .3s ease both;
}
#random-selector-overlay.open { display: flex; }

#random-selector-modal {
  width: min(580px, 94vw);
  background: #0c0c0c;
  border: 4px solid #FFD700;
  border-radius: 22px;
  overflow: hidden;
  position: relative;
  animation: rsmIn .5s cubic-bezier(.34,1.36,.64,1) both, rsmBorderGlow 2.2s ease-in-out 0.5s infinite;
  perspective: 600px;
}
#random-selector-modal.rsm-winning {
  animation: rsmWinGlow 0.8s ease-out both !important;
}

/* Top chrome stripe */
#random-selector-modal::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: linear-gradient(90deg,
    transparent 0%, #ffd700 20%, #fff8a0 50%, #ffd700 80%, transparent 100%
  );
  z-index: 20;
  pointer-events: none;
}

/* ── Header ── */
#random-selector-header {
  padding: 14px 20px 11px;
  background: linear-gradient(180deg, #111000 0%, #0c0c00 100%);
  border-bottom: 2px solid #2a2000;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  position: relative;
}
/* decorative side lines */
#random-selector-header::before,
#random-selector-header::after {
  content: '◆';
  position: absolute;
  top: 50%; transform: translateY(-50%);
  font-size: 0.65rem;
  color: rgba(255,215,0,0.4);
}
#random-selector-header::before { left: 16px; }
#random-selector-header::after  { right: 16px; }

#random-selector-title {
  font-family: 'Fredoka One', cursive;
  font-size: 1.3rem;
  color: #FFD700;
  letter-spacing: 3px;
  text-transform: uppercase;
  animation: rsmTitlePulse 2.4s ease-in-out infinite;
}
#random-selector-state {
  font-size: 0.8rem;
  color: #666;
  font-family: 'Fredoka', sans-serif;
  letter-spacing: 0.8px;
  min-height: 1.1em;
  transition: color .4s, text-shadow .4s;
}
#random-selector-modal.rsm-winning #random-selector-state {
  color: #39ff14;
  text-shadow: 0 0 14px rgba(57,255,20,0.6);
  letter-spacing: 1.5px;
}

/* ── Reel stage ── */
#random-selector-body {
  padding: 16px 16px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  background: #080808;
}

/* The main reel canvas wrapper */
#rsm-reel-wrap {
  width: 100%;
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  background: #000;
  border: 2px solid #222;
  aspect-ratio: 640 / 380;
}
#random-selector-modal.rsm-winning #rsm-reel-wrap {
  border-color: #FFD700;
  box-shadow: 0 0 0 2px #000, 0 0 30px rgba(255,215,0,0.6);
}

/* The canvas that draws the reel */
#rsm-canvas {
  display: block;
  width: 100%;
  height: 100%;
  position: absolute;
  inset: 0;
}

/* Scanline CRT overlay */
#rsm-scanlines {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    rgba(0,0,0,0) 0px, rgba(0,0,0,0) 2px,
    rgba(0,0,0,0.18) 2px, rgba(0,0,0,0.18) 4px
  );
  pointer-events: none;
  z-index: 4;
  mix-blend-mode: multiply;
}

/* Moving light sweep */
#rsm-sweep {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg,
    transparent 0%, rgba(255,255,255,0.04) 48%, rgba(255,255,255,0.08) 50%, rgba(255,255,255,0.04) 52%, transparent 100%
  );
  pointer-events: none;
  z-index: 5;
  animation: rsmScanline 2s linear infinite;
  opacity: 0;
}
#random-selector-modal.rsm-spinning #rsm-sweep { opacity: 1; }

/* Edge vignette */
#rsm-vignette {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, transparent 55%, rgba(0,0,0,0.7) 100%);
  pointer-events: none;
  z-index: 3;
}

/* Center crosshair / ticker */
#rsm-ticker {
  position: absolute;
  top: 50%; left: 0; right: 0;
  height: 3px;
  transform: translateY(-50%);
  pointer-events: none;
  z-index: 8;
  display: flex;
  align-items: center;
}
#rsm-ticker-line {
  flex: 1;
  height: 2px;
  background: linear-gradient(90deg,
    transparent 0%, rgba(255,215,0,0.5) 20%, rgba(255,215,0,0.9) 50%, rgba(255,215,0,0.5) 80%, transparent 100%
  );
  transition: opacity .3s;
}
#random-selector-modal.rsm-winning #rsm-ticker-line {
  background: linear-gradient(90deg,
    transparent 0%, rgba(57,255,20,0.6) 20%, rgba(57,255,20,1) 50%, rgba(57,255,20,0.6) 80%, transparent 100%
  );
}
/* Arrow pointers on sides */
#rsm-arrow-l, #rsm-arrow-r {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.1rem;
  color: rgba(255,215,0,0.8);
  pointer-events: none;
  z-index: 9;
  line-height: 1;
  text-shadow: 0 0 8px rgba(255,215,0,0.8);
}
#rsm-arrow-l { left: 6px;  animation: rsmArrowBounceL 0.8s ease-in-out infinite; }
#rsm-arrow-r { right: 6px; animation: rsmArrowBounce  0.8s ease-in-out infinite; }
#random-selector-modal:not(.rsm-spinning) #rsm-arrow-l,
#random-selector-modal:not(.rsm-spinning) #rsm-arrow-r { opacity: 0; }

/* Flash burst on each tick */
#rsm-flash {
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0);
  pointer-events: none;
  z-index: 10;
  border-radius: 10px;
  mix-blend-mode: screen;
  transition: background 0.04s ease;
}

/* Confetti canvas (full-overlay) */
#rsm-confetti {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 12;
  opacity: 0;
  transition: opacity .2s;
}
#rsm-confetti.visible { opacity: 1; }

/* Win stamp */
#rsm-win-stamp {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding-bottom: 14px;
  pointer-events: none;
  z-index: 11;
  opacity: 0;
  transition: opacity 0.3s ease 0.2s;
}
#random-selector-modal.rsm-winning #rsm-win-stamp { opacity: 1; }
#rsm-win-badge {
  background: linear-gradient(135deg, #FFD700 0%, #ff8c00 100%);
  color: #000;
  font-family: 'Fredoka One', cursive;
  font-size: 0.75rem;
  letter-spacing: 2px;
  padding: 5px 18px;
  border-radius: 30px;
  border: 2px solid #000;
  box-shadow: 0 3px 0 #000, 0 0 20px rgba(255,215,0,0.7);
  text-transform: uppercase;
}

/* ── Name plate ── */
#rsm-name-plate {
  width: 100%;
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 16px 6px;
  position: relative;
}
#random-selector-name {
  font-family: 'Fredoka One', cursive;
  font-size: 1.5rem;
  color: #bbb;
  text-align: center;
  text-shadow: 1px 1px 0 #000;
  letter-spacing: 1.5px;
  transition: color .15s, text-shadow .15s;
  line-height: 1.15;
}
#random-selector-modal.rsm-spinning #random-selector-name {
  color: #666;
  letter-spacing: 2.5px;
}
#random-selector-modal.rsm-winning #random-selector-name {
  color: #FFD700;
  text-shadow: 0 0 30px rgba(255,215,0,0.9), 0 0 10px rgba(255,215,0,0.5), 1px 1px 0 #000;
  animation: rsmWinName .6s cubic-bezier(.2,.8,.4,1) both;
}

/* ── Time remaining removed ── */

/* ── Actions ── */
#random-selector-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  padding: 4px 16px 16px;
  background: #0a0a0a;
  border-top: 1px solid #1a1a00;
}
#random-selector-actions button {
  font-family: 'Fredoka One', cursive;
  font-size: 0.92rem;
  border: 3px solid #000;
  border-radius: 12px;
  padding: 12px 8px;
  cursor: pointer;
  box-shadow: 0 4px 0 #000;
  transition: filter .12s, transform .1s, box-shadow .1s;
  letter-spacing: 0.4px;
}
#random-selector-actions button:hover  { filter: brightness(1.2); transform: translateY(-1px); }
#random-selector-actions button:active { transform: translateY(3px); box-shadow: 0 1px 0 #000; }
#btn-random-open   { background: linear-gradient(180deg, #ffe040 0%, #ffa500 100%); color: #111; }
#btn-random-cancel { background: #1a1a1a; color: #999; border-color: #333; }
#btn-random-reroll { background: linear-gradient(180deg, #1a3a1a 0%, #0d1f0d 100%); color: #5dff5d; border-color: #2a5a2a; }
#btn-random-skip   {
  background: linear-gradient(180deg, #ffe040 0%, #ffa500 100%);
  color: #111;
  border-color: #ffd700;
  font-weight: 700;
  box-shadow: 0 0 0 0 rgba(255,215,0,0.6);
  animation: rsmSkipPulse 1.4s ease-in-out infinite;
}
#btn-random-skip:hover {
  filter: brightness(1.15);
  transform: translateY(-1px) scale(1.04);
}
@keyframes rsmSkipPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255,215,0,0.55); }
  50%      { box-shadow: 0 0 0 8px rgba(255,215,0,0); }
}
#random-selector-modal.rsm-spinning #random-selector-actions {
  opacity: 0.35;
  pointer-events: none;
}
#random-selector-modal.rsm-spinning #btn-random-skip,
#random-selector-modal.rsm-spinning #btn-random-cancel {
  opacity: 1;
  pointer-events: auto;
}
#random-selector-modal.rsm-spinning #btn-random-cancel {
  background: #2a1414;
  color: #ff8c8c;
  border-color: #ff4444;
  box-shadow: 0 0 0 0 rgba(255,68,68,0.5);
  animation: rsmCancelPulse 1.4s ease-in-out infinite;
}
#random-selector-modal.rsm-spinning #btn-random-cancel:hover {
  filter: brightness(1.2);
  transform: translateY(-1px) scale(1.04);
}
@keyframes rsmCancelPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255,68,68,0.45); }
  50%      { box-shadow: 0 0 0 8px rgba(255,68,68,0); }
}
#random-selector-modal.rsm-winning #btn-random-skip,
#random-selector-modal:not(.rsm-spinning) #btn-random-skip {
  display: none !important;
}
#random-selector-modal.error #random-selector-state { color: #ff8c8c; }

