/* ============================================================
   Giveaway Wheel — diggitybets
   Design canvas: 1920 x 540 (JS scales it to the browser source size).
   Recommended OBS Browser Source size: 1920 x 540.
   ============================================================ */

/* ---------- Local Typography (Chakra Petch) ---------- */
@font-face { font-family: "Chakra Petch"; src: url("libs/fonts/chakra-petch-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-style: normal; }
@font-face { font-family: "Chakra Petch"; src: url("libs/fonts/chakra-petch-latin-600-normal.woff2") format("woff2"); font-weight: 600; font-style: normal; }
@font-face { font-family: "Chakra Petch"; src: url("libs/fonts/chakra-petch-latin-700-normal.woff2") format("woff2"); font-weight: 700; font-style: normal; }

@property --ang { syntax: "<angle>"; inherits: false; initial-value: 0deg; }

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

html, body { width: 100%; height: 100%; }

body {
  background: transparent;
  overflow: hidden;
  font-family: "Chakra Petch", "Rajdhani", "Segoe UI", sans-serif;
  color: #fff;
  user-select: none;
}
/* Outside OBS a dark backdrop makes the transparent overlay visible */
body.preview {
  background:
    radial-gradient(1200px 500px at 50% 40%, #0f141f 0%, #07090e 70%),
    #07090e;
}

.oculto { display: none !important; }

/* ---------- Stage (fixed design canvas: 500x500) ---------- */
.stage {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 500px;
  height: 500px;
  transform-origin: center center;
  transform: translate(-50%, -50%) scale(1);
  overflow: hidden;
  opacity: 1;
  transition: opacity 0.5s ease;
}
/* Standby / Idle State: Always visible by default so the streamer can frame it in OBS */
.stage.idle { opacity: 1; }
body.autohide .stage.idle { opacity: 0; }

/* ---------- SOTA FX Canvas for 3D Coin Rain & Confetti Cannons ---------- */
.fx-canvas {
  position: absolute;
  inset: 0;
  width: 500px;
  height: 500px;
  z-index: 38;
  pointer-events: none;
}

/* ---------- Reel container (Square & Compact Diggity VIP Reel) ---------- */
.ruleta {
  position: absolute;
  left: 20px;
  top: 20px;
  width: 460px;
  height: 460px;
  z-index: 2;
  display: flex;
  justify-content: center;
  overflow: hidden;
  background: linear-gradient(180deg, #07090e 0%, #0f141f 100%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 18px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.75), 0 0 0 1px rgba(255, 255, 255, 0.04);
}

.reel-header {
  position: absolute;
  top: 12px;
  left: 14px;
  right: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 12;
  pointer-events: none;
}
.vip-badge {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  color: #ffd700;
  background: rgba(255, 215, 0, 0.10);
  border: 1px solid rgba(255, 215, 0, 0.22);
  padding: 3px 9px;
  border-radius: 6px;
  text-transform: uppercase;
}
.live-indicator {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.8px;
  color: #53fc18;
  background: rgba(83, 252, 24, 0.10);
  border: 1px solid rgba(83, 252, 24, 0.22);
  padding: 3px 9px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  gap: 5px;
}
.live-indicator::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #53fc18;
  box-shadow: 0 0 8px #53fc18;
  animation: livePulse 1.4s ease-in-out infinite;
}
@keyframes livePulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
}
.ruleta.shake { animation: shake 0.45s cubic-bezier(0.36, 0.07, 0.19, 0.97); }
@keyframes shake {
  10%, 90% { transform: translate3d(0, -2px, 0); }
  20%, 80% { transform: translate3d(2px, 5px, 0); }
  30%, 50%, 70% { transform: translate3d(-2px, -8px, 0); }
  40%, 60% { transform: translate3d(2px, 8px, 0); }
}

/* Gold horizontal center pointer + CS2 Elastic Peg Deflection */
.marcador {
  position: absolute;
  left: 0;
  top: 50%;
  width: 100%;
  height: 4px;
  margin-top: -2px;
  background: linear-gradient(90deg, rgba(255, 215, 0, 0.2) 0%, #ffd700 15%, #fff1a8 50%, #ffd700 85%, rgba(255, 215, 0, 0.2) 100%);
  box-shadow: 0 0 16px 4px rgba(255, 215, 0, 0.85), 0 0 30px rgba(255, 183, 0, 0.5);
  z-index: 15;
  pointer-events: none;
  transform-origin: center center;
  will-change: transform;
}
.marcador.needle-peg-deflect {
  animation: pegDeflect 95ms cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes pegDeflect {
  0%   { transform: translateY(0) scaleY(1); }
  35%  { transform: translateY(5px) scaleY(1.45); filter: brightness(1.35); }
  75%  { transform: translateY(-2px) scaleY(0.92); }
  100% { transform: translateY(0) scaleY(1); }
}
.marcador::before, .marcador::after {
  content: "";
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  border-top: 10px solid transparent;
  border-bottom: 10px solid transparent;
  transition: transform 0.08s ease;
}
.marcador.needle-peg-deflect::before {
  transform: translateY(-50%) rotate(14deg) scale(1.12);
}
.marcador.needle-peg-deflect::after {
  transform: translateY(-50%) rotate(-14deg) scale(1.12);
}
.marcador::before {
  left: 0;
  border-left: 16px solid #ffd700;
  filter: drop-shadow(2px 0 4px rgba(0, 0, 0, 0.8));
}
.marcador::after {
  right: 0;
  border-right: 16px solid #ffd700;
  filter: drop-shadow(-2px 0 4px rgba(0, 0, 0, 0.8));
}

/* Top & Bottom vignettes for smooth vertical fade */
.degradado {
  position: absolute;
  left: 0;
  width: 100%;
  height: 90px;
  z-index: 10;
  pointer-events: none;
}
.degradado.arr {
  top: 0;
  background: linear-gradient(180deg, rgba(7, 9, 15, 0.98) 0%, rgba(7, 9, 15, 0) 100%);
}
.degradado.aba {
  bottom: 0;
  background: linear-gradient(0deg, rgba(7, 9, 15, 0.98) 0%, rgba(7, 9, 15, 0) 100%);
}

/* ---------- Track (Vertical stack with CS2 Near-Miss Suspense Curve) ---------- */
.pista {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding-top: 150px;           /* card 0 centered: (460 - 160) / 2 = 150px */
  width: 100%;
  will-change: transform;
  transition: transform 6.5s cubic-bezier(0.12, 0.99, 0.24, 1);   /* CS2 high-tension near-miss deceleration */
}
.pista.sin-transicion { transition: none !important; }

/* ---------- Participant card (380 x 160 — CS2 Case Opening ItemCard Rarity Base) ---------- */
.tarjeta {
  position: relative;
  flex: 0 0 160px;
  width: 380px;
  height: 160px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 16px;
  background: linear-gradient(165deg, rgba(29, 34, 50, 0.95) 0%, rgba(13, 16, 26, 0.98) 78%, color-mix(in srgb, var(--rareza, #4b69ff) 28%, #0b0d14) 100%);
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-left: 5px solid var(--rareza, #4b69ff);
  border-right: 5px solid var(--rareza, #4b69ff);
  border-bottom: 5px solid var(--rareza, #4b69ff);
  border-radius: 14px;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.72), inset 0 -18px 28px -12px var(--rareza, #4b69ff);
  transition: transform 0.5s cubic-bezier(0.18, 0.89, 0.32, 1.28), filter 0.5s ease, box-shadow 0.4s ease;
  overflow: hidden;
}
.tarjeta::before {     /* CS2 CaseCard radial rarity bloom from bottom base */
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 12px;
  background:
    radial-gradient(ellipse at 50% 95%, var(--rareza, #4b69ff) 0%, transparent 68%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.05) 0%, transparent 40%);
  opacity: 0.34;
  pointer-events: none;
}

.tarjeta .avatar,
.tarjeta .avatar-iniciales {
  position: relative;
  width: 90px;
  height: 90px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.6);
  transition: border-color 0.4s ease, box-shadow 0.4s ease;
}
.tarjeta .avatar { object-fit: cover; background: #0b0d12; }
.tarjeta .avatar-iniciales {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 34px;
  font-weight: 700;
  color: #0b0d12;
  background: var(--rareza, #4b69ff);
}

.tarjeta .nombre {
  position: relative;
  max-width: 340px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 21px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-align: center;
  text-shadow: 0 2px 5px rgba(0, 0, 0, 0.9);
  transition: color 0.4s ease, text-shadow 0.4s ease;
  font-variant-numeric: tabular-nums;
}

/* DecryptedText cryptographic reveal effect (adapted from React-Bits DecryptedText) */
.decrypted-revealing {
  letter-spacing: 1.5px;
  color: #00e5ff !important;
  text-shadow: 0 0 14px rgba(0, 229, 255, 0.85), 0 0 28px rgba(255, 215, 0, 0.55) !important;
}

/* Reveal: dim others, spotlight the winner card right in the center */
.pista.revealed .tarjeta:not(.ganadora) { filter: brightness(0.35) saturate(0.5); }
.tarjeta.ganadora {
  z-index: 20;
  transform: scale(1.08);
  border-color: #ffd700;
  border-left-color: #ffd700;
  border-right-color: #ffd700;
  border-bottom-color: #ffd700;
  box-shadow: 0 0 45px 12px rgba(255, 215, 0, 0.8), inset 0 0 32px rgba(255, 215, 0, 0.3);
}
.tarjeta.ganadora::after {      /* rotating golden border */
  content: "";
  position: absolute;
  inset: -6px;
  border-radius: 18px;
  padding: 4px;
  background: conic-gradient(from var(--ang), #ffd700, #fff6b0, #ff8800, #ffd700, #fff6b0, #ff8800, #ffd700);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask-composite: exclude;
  animation: angSpin 1.8s linear infinite;
  pointer-events: none;
}
@keyframes angSpin { to { --ang: 360deg; } }

.tarjeta.ganadora .avatar,
.tarjeta.ganadora .avatar-iniciales {
  border-color: #ffd700;
  box-shadow: 0 0 20px rgba(255, 215, 0, 0.85);
}

.tarjeta.ganadora .nombre {
  color: #fff;
  text-shadow: 0 0 14px rgba(255, 215, 0, 0.9), 0 2px 6px rgba(0, 0, 0, 0.95);
}

/* ---------- Status badge + controls (never visible in OBS unless ?debug=1 / ?controls=1) ---------- */
.estado {
  position: fixed;
  left: 12px;
  bottom: 10px;
  z-index: 100;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.4px;
  color: #ffb700;
  background: rgba(10, 12, 18, 0.75);
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid rgba(255, 183, 0, 0.3);
}

.controls { position: fixed; right: 14px; top: 12px; z-index: 100; display: flex; gap: 10px; }
.btn {
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  border-radius: 8px;
  padding: 9px 18px;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.2s;
}
.btn:hover { transform: scale(1.05); }
.btn:active { transform: scale(0.96); }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn-gold { background: linear-gradient(135deg, #ffd700 0%, #ff8800 100%); color: #000; border: 1px solid #ffd700; box-shadow: 0 0 16px rgba(255, 215, 0, 0.4); }
.btn-ghost { background: rgba(255, 255, 255, 0.08); color: #fff; border: 1px solid rgba(255, 255, 255, 0.2); }

/* ---------- Synchronized Winner Result Modal ---------- */
.result-modal {
  position: absolute;
  inset: 20px;
  z-index: 45;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: radial-gradient(circle at 50% 40%, rgba(26, 20, 10, 0.94) 0%, rgba(7, 9, 15, 0.97) 100%);
  border: 2px solid #ffd700;
  border-radius: 20px;
  box-shadow: 0 0 60px 15px rgba(255, 215, 0, 0.5), inset 0 0 40px rgba(255, 215, 0, 0.2);
  backdrop-filter: blur(8px);
  padding: 24px;
  opacity: 1;
  transform: scale(1);
  transition: opacity 0.4s cubic-bezier(0.18, 0.89, 0.32, 1.28), transform 0.4s cubic-bezier(0.18, 0.89, 0.32, 1.28);
  pointer-events: none;
}
.result-modal.oculto {
  opacity: 0;
  transform: scale(0.85) translateY(15px);
  pointer-events: none;
}
.result-pill {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 2px;
  color: #ffd700;
  background: rgba(255, 215, 0, 0.15);
  border: 1px solid #ffd700;
  border-radius: 999px;
  padding: 4px 16px;
  box-shadow: 0 0 16px rgba(255, 215, 0, 0.4);
}
.result-avatar-wrap {
  position: relative;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  border: 3px solid #ffd700;
  box-shadow: 0 0 35px rgba(255, 215, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0b0d12;
  overflow: hidden;
}
.result-avatar {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.result-avatar-initials {
  font-size: 44px;
  font-weight: 800;
  color: #0b0d12;
  background: linear-gradient(135deg, #ffd700 0%, #ff8800 100%);
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.result-name {
  font-size: 32px;
  font-weight: 800;
  color: #ffffff;
  text-shadow: 0 0 20px rgba(255, 215, 0, 0.9), 0 2px 8px rgba(0, 0, 0, 0.95);
  letter-spacing: 1px;
  max-width: 420px;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.result-claim {
  font-size: 15px;
  font-weight: 700;
  color: #00e676;
  background: rgba(0, 230, 118, 0.12);
  border: 1px solid rgba(0, 230, 118, 0.4);
  border-radius: 8px;
  padding: 6px 14px;
  letter-spacing: 0.5px;
  box-shadow: 0 0 12px rgba(0, 230, 118, 0.3);
}
