/* draw-reveal.css — Secret Draw "Reveal Board" animation component
   Game-show style: all names face-down, flip one by one, winner last.
   window.DrawReveal.show(names, onComplete)
   v1 */

/* ── Overlay — theme-isolated, all colours hardcoded ── */
.drev-overlay {
  all: initial;             /* reset any inherited theme styles */
  position: fixed !important;
  inset: 0;
  background: #000 !important;
  color: #fff !important;
  color-scheme: dark;       /* prevent browser auto light-mode */
  z-index: 9600;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 16px 32px;
  box-sizing: border-box;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif !important;
  opacity: 0;
  transition: opacity 0.4s ease;
  overflow: hidden;
}
.drev-overlay.drev-visible {
  opacity: 1;
}

/* ── Spotlight sweep behind board ── */
.drev-spotlight {
  position: absolute;
  top: -20%;
  left: 50%;
  transform: translateX(-50%);
  width: 600px;
  height: 600px;
  border-radius: 50%;
  background: radial-gradient(ellipse at center,
    rgba(250, 204, 21, 0.12) 0%,
    rgba(250, 204, 21, 0.04) 40%,
    transparent 70%);
  pointer-events: none;
  animation: drev-spotlight-drift 4s ease-in-out infinite alternate;
}
@keyframes drev-spotlight-drift {
  from { transform: translateX(-55%) scaleX(0.9); }
  to   { transform: translateX(-45%) scaleX(1.1); }
}

/* ── Title / status ── */
.drev-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: #fb923c;
  letter-spacing: 0.02em;
  margin-bottom: 20px;
  position: relative;
  text-align: center;
  min-height: 1.4em;
}

.drev-status {
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  text-align: center;
  min-height: 28px;
  margin-bottom: 20px;
  letter-spacing: 0.01em;
  transition: opacity 0.3s ease;
  position: relative;
}

/* ── Card board grid ── */
.drev-board {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  align-items: center;
  max-width: 420px;
  margin-bottom: 24px;
}

/* ── Individual card (3D flip container) ── */
.drev-card-wrap {
  perspective: 600px;
  width: 90px;
  height: 64px;
  flex-shrink: 0;
}

/* Compact on mobile for many names */
@media (max-width: 380px) {
  .drev-card-wrap { width: 74px; height: 54px; }
}

.drev-card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.6s cubic-bezier(0.4, 0.0, 0.2, 1);
}
.drev-card-wrap.drev-flipped .drev-card-inner {
  transform: rotateY(180deg);
}

/* Shared face styles */
.drev-card-front,
.drev-card-back {
  position: absolute;
  inset: 0;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

/* Face-down — mystery card */
.drev-card-front {
  background: linear-gradient(135deg, #1e1b4b, #312e81);
  border: 1px solid rgba(129, 140, 248, 0.3);
  box-shadow: 0 4px 16px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.06);
}
.drev-card-front::after {
  content: '🎲';
  font-size: 1.4rem;
  opacity: 0.6;
}

/* Face-up — name revealed */
.drev-card-back {
  background: linear-gradient(135deg, #2d1066, #6C3CE1);
  border: 1px solid rgba(139, 92, 246, 0.4);
  box-shadow: 0 4px 20px rgba(108, 60, 225, 0.35);
  transform: rotateY(180deg);
  padding: 4px 8px;
  text-align: center;
}
.drev-card-back-name {
  font-size: 0.78rem;
  font-weight: 700;
  color: #fff;
  word-break: break-word;
  line-height: 1.2;
  max-width: 80px;
}

/* ── Winner card — special treatment ── */
.drev-card-wrap.drev-winner .drev-card-front {
  background: linear-gradient(135deg, #713f12, #92400e);
  border-color: rgba(245, 158, 11, 0.5);
}
.drev-card-wrap.drev-winner .drev-card-front::after {
  content: '⭐';
}
.drev-card-wrap.drev-winner .drev-card-back {
  background: linear-gradient(135deg, #78350f, #b45309);
  border: 2px solid #fbbf24;
  box-shadow: 0 0 30px rgba(251, 191, 36, 0.6), 0 4px 20px rgba(0,0,0,0.4);
}
.drev-card-wrap.drev-winner .drev-card-back-name {
  font-size: 0.88rem;
  background: linear-gradient(135deg, #fde68a, #fbbf24);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Winner glow pulse after flip */
.drev-card-wrap.drev-winner.drev-flipped .drev-card-inner {
  animation: drev-winner-glow 0.8s ease-out forwards;
}
@keyframes drev-winner-glow {
  0%   { filter: brightness(1); }
  40%  { filter: brightness(1.8) drop-shadow(0 0 12px rgba(251,191,36,0.9)); }
  100% { filter: brightness(1.2) drop-shadow(0 0 6px rgba(251,191,36,0.5)); }
}

/* ── Confetti canvas ── */
.drev-confetti {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 10;
}

/* ── Big winner reveal text ── */
.drev-winner-reveal {
  text-align: center;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.5s ease, transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  margin-bottom: 20px;
  min-height: 40px;
}
.drev-winner-reveal.drev-wr-visible {
  opacity: 1;
  transform: translateY(0);
}
.drev-winner-reveal-label {
  font-size: 0.74rem;
  color: rgba(255,255,255,0.4);
  text-transform: uppercase;
  letter-spacing: 0.18em;
  margin-bottom: 4px;
}
.drev-winner-reveal-name {
  font-size: 2rem;
  font-weight: 900;
  color: #fb923c;
  letter-spacing: -0.02em;
}

/* ── CTA ── */
.drev-btn {
  background: linear-gradient(135deg, #f59e0b, #ef4444);
  color: #fff;
  border: none;
  padding: 11px 28px;
  border-radius: 10px;
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(245, 158, 11, 0.4);
  display: none;
  transition: opacity 0.2s ease, transform 0.15s ease;
  letter-spacing: 0.02em;
}
.drev-btn:hover { opacity: 0.9; transform: translateY(-1px); }
.drev-btn:active { transform: translateY(0); }
.drev-btn.drev-btn-visible { display: inline-block; }

/* ── Skip ── */
.drev-skip {
  position: absolute;
  top: 14px;
  right: 16px;
  background: none;
  border: none;
  color: rgba(255,255,255,0.22);
  font-size: 0.75rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: color 0.2s ease;
  letter-spacing: 0.04em;
}
.drev-skip:hover { color: rgba(255,255,255,0.6); }

/* ── Spotlight glow states (bouncing selection phase) ── */
.drev-card-wrap.drev-spot-lo .drev-card-front {
  border-color: rgba(250, 204, 21, 0.5);
  box-shadow: 0 0 16px rgba(250, 204, 21, 0.3), 0 4px 16px rgba(0,0,0,0.5);
  transition: box-shadow 0.12s ease, border-color 0.12s ease;
}
.drev-card-wrap.drev-spot-hi .drev-card-front {
  border-color: rgba(250, 204, 21, 0.9);
  box-shadow: 0 0 40px rgba(250, 204, 21, 0.7), 0 0 80px rgba(250, 204, 21, 0.3), 0 4px 20px rgba(0,0,0,0.6);
  animation: drev-spot-pulse 0.5s ease-in-out infinite alternate;
}
.drev-card-wrap.drev-spot-hi .drev-card-front::after {
  content: '⭐';
  opacity: 0.9;
}
@keyframes drev-spot-pulse {
  from { box-shadow: 0 0 30px rgba(250,204,21,0.6), 0 0 60px rgba(250,204,21,0.2); }
  to   { box-shadow: 0 0 50px rgba(250,204,21,0.9), 0 0 100px rgba(250,204,21,0.4); }
}

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
  .drev-overlay,
  .drev-card-inner,
  .drev-winner-reveal,
  .drev-spotlight { animation: none !important; transition: none !important; }
  .drev-overlay { opacity: 1; }
  .drev-card-wrap.drev-flipped .drev-card-inner { transform: rotateY(180deg); }
  .drev-winner-reveal { opacity: 1; transform: none; }
}
