/* ============================================================
   Lucky Draw Spinning Wheel — Frontend CSS
   Inspired by Taobao/1688 gamification: bold gradients,
   neon glows, floating particles, kinetic energy, festive feel
   ============================================================ */

/* ── Imports & Variables ──────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;600;700;800;900&display=swap');

:root {
  /* Brand palette — Taobao-inspired warm orange/red + gold */
  --ldsw-red:      #ff3c00;
  --ldsw-orange:   #ff7300;
  --ldsw-gold:     #ffd700;
  --ldsw-gold-lt:  #ffe566;
  --ldsw-green:    #00c853;
  --ldsw-blue:     #1565c0;
  --ldsw-purple:   #7c3aed;
  --ldsw-white:    #ffffff;
  --ldsw-dark:     #1a0a00;

  /* Gradients */
  --grad-fire:   linear-gradient(135deg, #ff3c00 0%, #ff7300 50%, #ffd700 100%);
  --grad-gold:   linear-gradient(135deg, #f6d365 0%, #fda085 100%);
  --grad-festive:linear-gradient(160deg, #ff416c 0%, #ff4b2b 100%);
  --grad-btn:    linear-gradient(135deg, #ff6b35 0%, #ff3c00 50%, #e60000 100%);
  --grad-overlay:linear-gradient(160deg, rgba(20,0,40,.88) 0%, rgba(60,10,0,.92) 100%);

  /* Sizes */
  --ldsw-radius:    20px;
  --ldsw-radius-sm: 10px;
  --ldsw-popup-w:   500px;

  /* Shadows */
  --ldsw-glow-gold: 0 0 30px rgba(255,215,0,.6), 0 0 60px rgba(255,115,0,.3);
  --ldsw-glow-btn:  0 8px 32px rgba(255,60,0,.5), 0 2px 8px rgba(255,60,0,.3);
  --ldsw-shadow-popup: 0 32px 80px rgba(0,0,0,.5), 0 0 0 1px rgba(255,215,0,.2);
}

/* ── Overlay ──────────────────────────────────────────────── */
.ldsw-overlay {
  position:   fixed;
  inset:      0;
  z-index:    999999;
  display:    flex;
  align-items: center;
  justify-content: center;
  padding:    16px;
  background: var(--grad-overlay);
  backdrop-filter: blur(6px) saturate(1.4);
  animation:  ldsw-overlay-in .3s ease;
}

@keyframes ldsw-overlay-in {
  from { opacity:0; backdrop-filter:blur(0); }
  to   { opacity:1; backdrop-filter:blur(6px) saturate(1.4); }
}

/* Floating particle background */
.ldsw-overlay::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle at 20% 30%, rgba(255,215,0,.08) 0%, transparent 50%),
    radial-gradient(circle at 80% 70%, rgba(255,60,0,.06) 0%, transparent 50%),
    radial-gradient(circle at 50% 10%, rgba(124,58,237,.06) 0%, transparent 40%);
  pointer-events: none;
}

/* ── Popup ────────────────────────────────────────────────── */
.ldsw-popup {
  position:       relative;
  background:     linear-gradient(160deg, #1e0533 0%, #2d0a00 50%, #1a0015 100%);
  border:         2px solid rgba(255,215,0,.3);
  border-radius:  var(--ldsw-radius);
  box-shadow:     var(--ldsw-shadow-popup);
  width:          100%;
  max-width:      var(--ldsw-popup-w);
  max-height:     95vh;
  overflow-y:     auto;
  overflow-x:     hidden;
  padding:        24px 20px 28px;
  display:        flex;
  flex-direction: column;
  align-items:    center;
  gap:            16px;
  color:          var(--ldsw-white);
  font-family:    'Poppins', -apple-system, sans-serif;
  animation:      ldsw-popup-in .45s cubic-bezier(0.34,1.56,0.64,1);
}

/* Shimmering border animation */
.ldsw-popup::before {
  content:  '';
  position: absolute;
  inset:    -2px;
  border-radius: calc(var(--ldsw-radius) + 2px);
  background: linear-gradient(90deg, #ffd700,#ff7300,#ff3c00,#ff7300,#ffd700);
  background-size: 300% 100%;
  animation: ldsw-border-shimmer 3s linear infinite;
  z-index: -1;
}

@keyframes ldsw-border-shimmer {
  0%   { background-position: 0% 0%; }
  100% { background-position: 300% 0%; }
}

@keyframes ldsw-popup-in {
  from { transform: scale(0.7) translateY(60px); opacity: 0; }
  to   { transform: scale(1)   translateY(0);    opacity: 1; }
}

/* ── Decorative emojis ────────────────────────────────────── */
.ldsw-popup__deco {
  position:   absolute;
  font-size:  22px;
  pointer-events: none;
  animation:  ldsw-deco-float 3s ease-in-out infinite;
  filter:     drop-shadow(0 0 6px rgba(255,215,0,.6));
}
.ldsw-popup__deco--tl { top: 14px;  left:  16px; animation-delay: 0s;    }
.ldsw-popup__deco--tr { top: 14px;  right: 16px; animation-delay: 0.75s; }
.ldsw-popup__deco--bl { bottom:22px;left:  16px; animation-delay: 1.5s;  }
.ldsw-popup__deco--br { bottom:22px;right: 16px; animation-delay: 2.25s; }

@keyframes ldsw-deco-float {
  0%,100% { transform: translateY(0) rotate(-5deg); }
  50%     { transform: translateY(-8px) rotate(5deg); }
}

/* ── Close button ─────────────────────────────────────────── */
.ldsw-close {
  position:   absolute;
  top:        12px;
  right:      14px;
  width:      32px;
  height:     32px;
  border-radius: 50%;
  background: rgba(255,255,255,.1);
  border:     1px solid rgba(255,255,255,.2);
  color:      rgba(255,255,255,.7);
  font-size:  18px;
  cursor:     pointer;
  display:    flex;
  align-items:center;
  justify-content: center;
  line-height:1;
  transition: all .2s;
  z-index:    10;
}
.ldsw-close:hover {
  background: rgba(255,60,0,.5);
  color:      #fff;
  border-color: rgba(255,60,0,.8);
  transform:  rotate(90deg) scale(1.1);
}

/* ── Logo ─────────────────────────────────────────────────── */
.ldsw-logo { text-align: center; }
.ldsw-logo img { max-height: 44px; max-width: 180px; object-fit: contain; }

/* ── Headline ─────────────────────────────────────────────── */
.ldsw-headline { text-align: center; }
.ldsw-headline__title {
  font-size:   24px;
  font-weight: 900;
  background:  var(--grad-fire);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.5px;
  text-shadow:  none;
  margin-bottom: 4px;
  animation:   ldsw-title-pulse 2s ease-in-out infinite;
}

@keyframes ldsw-title-pulse {
  0%,100% { filter: brightness(1); }
  50%     { filter: brightness(1.3) drop-shadow(0 0 8px rgba(255,215,0,.5)); }
}

.ldsw-headline__sub {
  font-size:   13px;
  color:       rgba(255,255,255,.65);
  font-weight: 500;
}

/* ── Wheel wrap ───────────────────────────────────────────── */
.ldsw-wheel-wrap {
  position:   relative;
  display:    flex;
  flex-direction: column;
  align-items: center;
}

/* Glow ring behind wheel */
.ldsw-glow-ring {
  position:   absolute;
  top:        50%;
  left:       50%;
  transform:  translate(-50%, -50%);
  border-radius: 50%;
  background: transparent;
  animation:  ldsw-glow-pulse 2s ease-in-out infinite;
  pointer-events: none;
}

@keyframes ldsw-glow-pulse {
  0%,100% { box-shadow: 0 0 20px rgba(255,215,0,.3), 0 0 40px rgba(255,115,0,.2); }
  50%     { box-shadow: 0 0 40px rgba(255,215,0,.6), 0 0 80px rgba(255,115,0,.4), 0 0 120px rgba(255,60,0,.2); }
}

/* Pointer arrow */
.ldsw-pointer {
  font-size:   28px;
  line-height: 1;
  margin-bottom: -8px;
  z-index:     3;
  filter:      drop-shadow(0 0 8px currentColor);
  animation:   ldsw-pointer-bounce 1s ease-in-out infinite alternate;
}

@keyframes ldsw-pointer-bounce {
  from { transform: translateY(0) scale(1); }
  to   { transform: translateY(-5px) scale(1.1); }
}

/* Canvas */
.ldsw-canvas {
  display:      block;
  border-radius: 50%;
  box-shadow:   var(--ldsw-glow-gold);
  transition:   box-shadow .4s;
  max-width:    100%;
  height:       auto !important;
  position:     relative;
  z-index:      2;
}

.ldsw-canvas.is-spinning {
  box-shadow: 0 0 60px rgba(255,215,0,.8), 0 0 120px rgba(255,115,0,.5), 0 0 200px rgba(255,60,0,.3);
  animation:  ldsw-wheel-vibrate .08s linear infinite;
}

@keyframes ldsw-wheel-vibrate {
  0%,100% { transform: rotate(0); }
  25%     { transform: rotate(.3deg); }
  75%     { transform: rotate(-.3deg); }
}

/* ── Email form ───────────────────────────────────────────── */
.ldsw-email-form {
  width:    100%;
  display:  flex;
  flex-direction: column;
  gap:      10px;
}

.ldsw-input {
  width:        100%;
  padding:      12px 16px;
  background:   rgba(255,255,255,.1);
  border:       1.5px solid rgba(255,255,255,.2);
  border-radius: var(--ldsw-radius-sm);
  font-size:    14px;
  font-family:  inherit;
  color:        #fff;
  transition:   all .2s;
  box-sizing:   border-box;
  backdrop-filter: blur(4px);
}
.ldsw-input::placeholder { color: rgba(255,255,255,.45); }
.ldsw-input:focus {
  outline:      none;
  border-color: var(--ldsw-gold);
  background:   rgba(255,255,255,.15);
  box-shadow:   0 0 0 3px rgba(255,215,0,.2);
}
.ldsw-input.ldsw-shake {
  animation: ldsw-shake .4s ease;
  border-color: var(--ldsw-red);
}

@keyframes ldsw-shake {
  0%,100% { transform: translateX(0); }
  20%,60% { transform: translateX(-6px); }
  40%,80% { transform: translateX(6px); }
}

.ldsw-gdpr {
  display:     flex;
  align-items: flex-start;
  gap:         8px;
  cursor:      pointer;
}
.ldsw-gdpr input[type="checkbox"] { margin-top: 3px; flex-shrink: 0; accent-color: var(--ldsw-gold); }
.ldsw-gdpr__text { font-size: 11.5px; color: rgba(255,255,255,.55); line-height: 1.4; }

/* ── Spin button ──────────────────────────────────────────── */
.ldsw-spin-btn-wrap {
  position:   relative;
  display:    flex;
  flex-direction: column;
  align-items: center;
  gap:        8px;
}

.ldsw-spin-btn {
  position:   relative;
  display:    inline-flex;
  align-items: center;
  justify-content: center;
  gap:        8px;
  padding:    15px 48px;
  border:     none;
  border-radius: 50px;
  background: var(--btn-bg, var(--grad-btn));
  background: var(--grad-btn);
  color:      var(--btn-color, #fff);
  font-size:  18px;
  font-weight: 900;
  font-family: inherit;
  letter-spacing: 2px;
  text-transform: uppercase;
  cursor:     pointer;
  transition: all .2s;
  box-shadow: var(--ldsw-glow-btn);
  overflow:   hidden;
  min-width:  200px;
}

/* Shine sweep effect */
.ldsw-spin-btn__shine {
  position:   absolute;
  top:        0;
  left:       -100%;
  width:      60%;
  height:     100%;
  background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,.35) 50%, transparent 100%);
  transform:  skewX(-15deg);
  animation:  ldsw-btn-shine 2.5s ease-in-out infinite;
}
@keyframes ldsw-btn-shine {
  0%   { left: -100%; }
  60%  { left: 150%; }
  100% { left: 150%; }
}

.ldsw-spin-btn__icon { font-size: 20px; }

.ldsw-spin-btn:hover:not(:disabled) {
  transform:  translateY(-3px) scale(1.04);
  box-shadow: 0 12px 40px rgba(255,60,0,.65), 0 0 0 3px rgba(255,215,0,.4);
}
.ldsw-spin-btn:active:not(:disabled) {
  transform:  scale(.96);
}
.ldsw-spin-btn:disabled {
  opacity:    .55;
  cursor:     not-allowed;
  box-shadow: none;
}
.ldsw-spin-btn.is-spinning {
  animation:  ldsw-btn-pulse .6s ease-in-out infinite;
}
@keyframes ldsw-btn-pulse {
  0%,100% { box-shadow: var(--ldsw-glow-btn); transform: scale(1); }
  50%     { box-shadow: 0 0 50px rgba(255,60,0,.8); transform: scale(1.03); }
}

/* Spark particles around spin button */
.ldsw-spin-btn__sparks {
  position:   absolute;
  inset:      -20px;
  pointer-events: none;
}
.ldsw-spin-btn__sparks span {
  position:   absolute;
  width:      6px;
  height:     6px;
  border-radius: 50%;
  background: var(--ldsw-gold);
  opacity:    0;
}
.ldsw-spin-btn:hover .ldsw-spin-btn__sparks span:nth-child(1) { top:0;left:50%;animation:ldsw-spark 1s .0s infinite; }
.ldsw-spin-btn:hover .ldsw-spin-btn__sparks span:nth-child(2) { top:20%;right:0;animation:ldsw-spark 1s .2s infinite; }
.ldsw-spin-btn:hover .ldsw-spin-btn__sparks span:nth-child(3) { bottom:0;right:30%;animation:ldsw-spark 1s .4s infinite; }
.ldsw-spin-btn:hover .ldsw-spin-btn__sparks span:nth-child(4) { bottom:20%;left:0;animation:ldsw-spark 1s .6s infinite; }
.ldsw-spin-btn:hover .ldsw-spin-btn__sparks span:nth-child(5) { top:40%;left:0;animation:ldsw-spark 1s .1s infinite; }
.ldsw-spin-btn:hover .ldsw-spin-btn__sparks span:nth-child(6) { top:40%;right:0;animation:ldsw-spark 1s .3s infinite; }

@keyframes ldsw-spark {
  0%   { transform:scale(0); opacity:1; }
  60%  { transform:scale(1.5) translate(10px,-10px); opacity:.8; }
  100% { transform:scale(0) translate(20px,-20px); opacity:0; }
}

/* ── Countdown ────────────────────────────────────────────── */
.ldsw-countdown {
  display:    flex;
  align-items: center;
  gap:        8px;
  background: rgba(255,255,255,.07);
  border:     1px solid rgba(255,215,0,.2);
  border-radius: 50px;
  padding:    6px 16px;
  font-size:  13px;
  color:      rgba(255,255,255,.7);
}
.ldsw-countdown__timer {
  font-weight: 800;
  font-size:   18px;
  color:       var(--ldsw-gold);
  font-family: monospace;
  text-shadow: 0 0 10px rgba(255,215,0,.5);
  animation:   ldsw-timer-tick 1s step-end infinite;
}
@keyframes ldsw-timer-tick {
  0%,100% { opacity:1; }
  50%     { opacity:.7; }
}

/* ── Result panel ─────────────────────────────────────────── */
.ldsw-result {
  width:      100%;
  text-align: center;
  animation:  ldsw-popup-in .4s ease;
}

.ldsw-result__badge {
  font-size:  52px;
  line-height:1;
  margin-bottom: 8px;
  animation:  ldsw-badge-pop .5s cubic-bezier(0.34,1.56,0.64,1);
}
@keyframes ldsw-badge-pop {
  from { transform:scale(0) rotate(-20deg); opacity:0; }
  to   { transform:scale(1) rotate(0);      opacity:1; }
}

.ldsw-result__msg {
  font-size:   18px;
  font-weight: 700;
  color:       #fff;
  margin-bottom: 14px;
  line-height: 1.4;
}

/* Coupon box */
.ldsw-coupon-box {
  display:    flex;
  flex-direction: column;
  align-items: center;
  gap:        4px;
  background: linear-gradient(135deg, rgba(255,215,0,.15) 0%, rgba(255,115,0,.1) 100%);
  border:     2px dashed rgba(255,215,0,.6);
  border-radius: var(--ldsw-radius-sm);
  padding:    14px 20px;
  margin-bottom: 12px;
}
.ldsw-coupon-box__label {
  font-size:   11px;
  font-weight: 600;
  color:       rgba(255,215,0,.7);
  text-transform: uppercase;
  letter-spacing: 2px;
}
.ldsw-coupon-box__code {
  font-size:   28px;
  font-weight: 900;
  font-family: monospace;
  letter-spacing: 4px;
  background:  var(--grad-gold);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation:   ldsw-title-pulse 2s ease-in-out infinite;
}

.ldsw-result__actions {
  display:    flex;
  gap:        8px;
  justify-content: center;
  flex-wrap:  wrap;
  margin-bottom: 8px;
}

.ldsw-result__expiry {
  font-size:  11.5px;
  color:      rgba(255,255,255,.45);
  font-style: italic;
}

/* ── Buttons ──────────────────────────────────────────────── */
.ldsw-btn {
  display:     inline-flex;
  align-items: center;
  gap:         6px;
  padding:     9px 20px;
  border-radius: 50px;
  font-size:   13.5px;
  font-weight: 700;
  cursor:      pointer;
  border:      1.5px solid transparent;
  transition:  all .18s;
  font-family: inherit;
  text-decoration: none;
  white-space: nowrap;
}
.ldsw-btn--primary {
  background: var(--grad-btn);
  color:      #fff;
  box-shadow: 0 4px 16px rgba(255,60,0,.4);
}
.ldsw-btn--primary:hover {
  transform:   translateY(-2px);
  box-shadow:  0 8px 24px rgba(255,60,0,.5);
  color:       #fff;
  text-decoration: none;
}
.ldsw-btn--outline {
  background:  transparent;
  color:       var(--ldsw-gold);
  border-color: rgba(255,215,0,.5);
}
.ldsw-btn--outline:hover {
  background:  rgba(255,215,0,.1);
  border-color: var(--ldsw-gold);
  color:       var(--ldsw-gold);
}
.ldsw-btn--lg { padding: 13px 32px; font-size: 16px; }

/* ── Locked overlay ───────────────────────────────────────── */
.ldsw-locked {
  width:      100%;
  display:    flex;
  flex-direction: column;
  align-items: center;
  gap:        10px;
  padding:    24px;
  background: rgba(0,0,0,.4);
  border:     1px solid rgba(255,60,0,.3);
  border-radius: var(--ldsw-radius-sm);
  text-align: center;
}
.ldsw-locked__icon { font-size: 40px; }
.ldsw-locked__title {
  font-size:   20px;
  font-weight: 800;
  color:       #ff7070;
}
.ldsw-locked__sub {
  font-size:   13px;
  color:       rgba(255,255,255,.6);
  max-width:   280px;
}

/* ── Themes ───────────────────────────────────────────────── */
.ldsw-theme-festive .ldsw-popup {
  background: linear-gradient(160deg, #1e0533 0%, #2d0a00 50%, #1a0015 100%);
}
.ldsw-theme-halloween .ldsw-popup {
  background: linear-gradient(160deg, #0d0d0d 0%, #1a0a00 50%, #200820 100%);
}
.ldsw-theme-christmas .ldsw-popup {
  background: linear-gradient(160deg, #0a1a05 0%, #0d2e10 50%, #1a0505 100%);
}
.ldsw-theme-summer .ldsw-popup {
  background: linear-gradient(160deg, #003366 0%, #001a40 50%, #002244 100%);
}
.ldsw-theme-minimal .ldsw-popup {
  background: linear-gradient(160deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
}

/* ── Confetti canvas ──────────────────────────────────────── */
#ldsw-confetti-canvas {
  position:   fixed;
  inset:      0;
  pointer-events: none;
  z-index:    1000001;
}

/* ── Inline shortcode ─────────────────────────────────────── */
.ldsw-inline-wrap {
  display:    flex;
  flex-direction: column;
  align-items: center;
  gap:        16px;
  padding:    28px 20px;
  background: linear-gradient(160deg, #1e0533 0%, #2d0a00 100%);
  border-radius: var(--ldsw-radius);
  box-shadow:  0 4px 24px rgba(0,0,0,.3);
  color:       #fff;
  font-family: 'Poppins', sans-serif;
}

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 540px) {
  :root { --ldsw-popup-w: 100%; --ldsw-radius: 16px 16px 0 0; }
  .ldsw-overlay { align-items: flex-end; padding: 0; }
  .ldsw-popup { max-height: 92vh; border-radius: 16px 16px 0 0; padding: 20px 16px 24px; }
  .ldsw-spin-btn { padding: 13px 32px; font-size: 16px; min-width: 160px; }
  .ldsw-headline__title { font-size: 20px; }
  .ldsw-coupon-box__code { font-size: 22px; letter-spacing: 3px; }
}

/* ── Dark mode ────────────────────────────────────────────── */
@media (prefers-color-scheme: light) {
  /* Popup already has its own dark theme — no override needed */
}

/* ── Reduced motion ───────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .ldsw-popup,
  .ldsw-spin-btn,
  .ldsw-pointer,
  .ldsw-popup__deco,
  .ldsw-glow-ring,
  .ldsw-headline__title,
  .ldsw-result__badge { animation: none !important; }
  .ldsw-spin-btn__shine { display: none; }
}
