/* =============================
   RESET & BASE
   ============================= */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  width: 100%;
  height: 100%;
  overflow-x: hidden;
  font-family: 'Roboto', sans-serif;
}

/* =============================
   BACKGROUND
   ============================= */
.bg-image {
  position: fixed;
  inset: 0;
  z-index: -3;
  background-color: #0a0a1a;
  background-image:
    url('uploads/bg.webp'),
    radial-gradient(ellipse at 20% 30%, rgba(155, 89, 182, 0.4) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 70%, rgba(231, 76, 60, 0.4) 0%, transparent 50%),
    linear-gradient(135deg, #0d0d2b 0%, #1a0a2e 50%, #0d1a2b 100%);
  background-size: cover;
  background-position: center;
  transition: opacity 0.8s ease;
}

.bg-image.fade-out {
  opacity: 0;
}

.bg-video {
  position: fixed;
  inset: 0;
  z-index: -2;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.bg-overlay {
  position: fixed;
  inset: 0;
  z-index: -1;
  background: rgba(0, 0, 0, 0.52);
}

/* =============================
   CONFETTI CANVAS
   ============================= */
#confetti-canvas {
  position: fixed;
  inset: 0;
  z-index: 999;
  pointer-events: none;
  width: 100%;
  height: 100%;
}

/* =============================
   LAYOUT
   ============================= */
body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding-top: 80px;
  /* tránh bị top-header che */
}

.main-container {
  position: relative;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
  max-width: 580px;
  width: 92%;
  padding: 28px 24px 32px;
  background: rgba(0, 0, 0, 0.38);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow:
    0 25px 60px rgba(0, 0, 0, 0.6),
    0 0 40px rgba(255, 215, 0, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

/* =============================
   TOP HEADER BAR (ngoài box)
   ============================= */
.top-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 200;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 12px 20px;
  background: transparent;
}

#headerLogo {
  max-height: 60px;
  max-width: 220px;
  width: auto;
  height: auto;
  object-fit: contain;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.6));
}

/* =============================
   HEADER TEXT
   ============================= */
.header-text {
  text-align: center;
}

.header-text h1 {
  font-size: 3rem;
  font-weight: 900;
  color: #ffd700;
  text-shadow:
    3px 3px 10px rgba(0, 0, 0, 0.9),
    0 0 25px rgba(255, 215, 0, 0.5);
  line-height: 1.1;
}

.header-text p {
  margin-top: 10px;
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
  text-shadow: 2px 2px 6px rgba(0, 0, 0, 0.8);
  letter-spacing: 1.5px;
}

/* =============================
   WHEEL
   ============================= */
.wheel-container {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 460px;
  height: 460px;
}

#wheel {
  display: block;
  border-radius: 50%;
  box-shadow:
    0 0 0 7px #ffd700,
    0 0 0 12px rgba(255, 215, 0, 0.25),
    0 0 35px rgba(255, 215, 0, 0.45),
    0 12px 40px rgba(0, 0, 0, 0.65);
  transition: transform 4500ms cubic-bezier(0.15, 0.65, 0.12, 1);
}

#centerCanvas {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  cursor: pointer;
  box-shadow:
    0 0 0 5px #ffd700,
    0 0 22px rgba(255, 215, 0, 0.55),
    0 5px 15px rgba(0, 0, 0, 0.55);
  transition: transform 0.15s ease;
  z-index: 5;
}

#centerCanvas:hover {
  transform: translate(-50%, -50%) scale(1.07);
}

/* Pointer */
.pointer {
  position: absolute;
  top: -8px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  width: 0;
  height: 0;
  border-left: 20px solid transparent;
  border-right: 20px solid transparent;
  border-top: 48px solid #ffd700;
  filter:
    drop-shadow(0 3px 8px rgba(0, 0, 0, 0.8)) drop-shadow(0 0 8px rgba(255, 215, 0, 0.6));
}

/* =============================
   SPINS LEFT DISPLAY
   ============================= */
.spins-left-container {
  font-family: 'Roboto', sans-serif;
  font-size: 1.15rem;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.6);
  margin-bottom: 18px;
  background: rgba(0, 0, 0, 0.5);
  padding: 8px 24px;
  border-radius: 20px;
  border: 1.5px solid rgba(255, 215, 0, 0.45);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
  display: inline-block;
  animation: pulseGold 2s infinite alternate;
}

.spins-left-container span {
  color: #ffd700;
  font-size: 1.35rem;
  font-weight: 900;
  padding: 0 4px;
}

@keyframes pulseGold {
  from {
    border-color: rgba(255, 215, 0, 0.45);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
  }
  to {
    border-color: rgba(255, 215, 0, 0.8);
    box-shadow: 0 4px 15px rgba(255, 215, 0, 0.25);
  }
}

/* =============================
   SPIN BUTTON
   ============================= */
.spin-btn {
  display: block;
  width: 220px;
  padding: 16px 30px;
  font-family: 'Roboto', sans-serif;
  font-size: 1.55rem;
  font-weight: 900;
  color: #4a2c00;
  background: linear-gradient(135deg, #fff3a0 0%, #ffd700 40%, #ffb300 100%);
  border: none;
  border-radius: 50px;
  cursor: pointer;
  letter-spacing: 1px;
  box-shadow:
    0 6px 20px rgba(255, 215, 0, 0.5),
    0 4px 0 #a07000,
    inset 0 1px 0 rgba(255, 255, 255, 0.5);
  transition: all 0.15s ease;
  text-shadow: 0 1px 2px rgba(255, 255, 255, 0.3);
}

.spin-btn:hover:not(:disabled) {
  transform: translateY(-3px);
  box-shadow:
    0 10px 28px rgba(255, 215, 0, 0.65),
    0 5px 0 #a07000,
    inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.spin-btn:active:not(:disabled) {
  transform: translateY(1px);
  box-shadow: 0 2px 8px rgba(255, 215, 0, 0.4), 0 1px 0 #a07000;
}

.spin-btn:disabled {
  background: linear-gradient(135deg, #888, #777);
  color: #aaa;
  cursor: not-allowed;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.3);
  transform: none;
}

/* =============================
   VIEW PRIZE BUTTON
   ============================= */
.view-prize-btn {
  display: none;
  width: 220px;
  padding: 12px 24px;
  margin-top: 14px;
  font-family: 'Roboto', sans-serif;
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, #27ae60 0%, #2ecc71 100%);
  border: 2px solid #ffcc00;
  border-radius: 50px;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(46, 204, 113, 0.4);
  transition: all 0.2s ease;
  letter-spacing: 0.5px;
}

.view-prize-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(46, 204, 113, 0.6);
}

.view-prize-btn:active {
  transform: translateY(1px);
}




/* =============================
   POPUP OVERLAY
   ============================= */
.popup-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.85);
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}

.popup-overlay.active {
  display: flex;
  animation: fadeInOverlay 0.3s ease forwards;
}

@keyframes fadeInOverlay {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

/* =============================
   POPUP BOX
   ============================= */
.popup-box {
  position: relative;
  width: 90%;
  max-width: 400px;
  border-radius: 20px;
  overflow: hidden;
  background:
    radial-gradient(circle at center, rgba(255, 215, 0, 0.12) 0%, transparent 65%),
    radial-gradient(circle at center, #8a0c02 0%, #300000 100%);
  border: 3.5px solid #ffcc00;
  box-shadow:
    0 20px 50px rgba(0, 0, 0, 0.95),
    0 0 35px rgba(255, 204, 0, 0.4),
    inset 0 0 30px rgba(0, 0, 0, 0.75);
  animation: popIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  display: flex;
  flex-direction: column;
  align-items: center;
}

@keyframes popIn {
  from {
    transform: scale(0.7);
    opacity: 0;
  }

  to {
    transform: scale(1);
    opacity: 1;
  }
}

/* Close button */
.popup-close {
  position: absolute;
  top: 15px;
  right: 15px;
  z-index: 20;
  background: rgba(0, 0, 0, 0.45);
  border: 1.5px solid rgba(255, 255, 255, 0.35);
  color: #fff;
  font-size: 1.1rem;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.popup-close:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: scale(1.1);
}

/* Sunburst background */
.sunburst {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 220%;
  height: 220%;
  background: repeating-conic-gradient(from 0deg,
      rgba(255, 223, 0, 0.32) 0deg 15deg,
      transparent 15deg 30deg);
  transform: translate(-50%, -50%);
  z-index: 1;
  pointer-events: none;
  animation: sunburst-rotate 20s linear infinite;
}

@keyframes sunburst-rotate {
  from {
    transform: translate(-50%, -50%) rotate(0deg);
  }

  to {
    transform: translate(-50%, -50%) rotate(360deg);
  }
}

/* Falling coins container & individual coins */
.falling-coins-container {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
  overflow: hidden;
}

.coin {
  position: absolute;
  background: radial-gradient(circle at 35% 35%, #fff6cc 0%, #ffcc00 40%, #cc8800 85%, #8a5a00 100%);
  border-radius: 50%;
  box-shadow:
    0 4px 8px rgba(0, 0, 0, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.6);
  border: 1.5px solid #d4ac0d;
}

.coin::after {
  content: '';
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  border: 1px dashed rgba(255, 255, 255, 0.45);
}

/* Specific floating coins */
.coin-1 {
  top: 15%;
  left: 15%;
  width: 28px;
  height: 28px;
  animation: floatCoin1 5s ease-in-out infinite;
}

.coin-2 {
  top: 32%;
  left: 8%;
  width: 20px;
  height: 20px;
  animation: floatCoin2 6s ease-in-out infinite;
}

.coin-3 {
  top: 62%;
  left: 12%;
  width: 34px;
  height: 34px;
  animation: floatCoin3 7s ease-in-out infinite;
}

.coin-4 {
  top: 22%;
  right: 10%;
  width: 24px;
  height: 24px;
  animation: floatCoin1 4.5s ease-in-out infinite;
}

.coin-5 {
  top: 42%;
  right: 15%;
  width: 30px;
  height: 30px;
  animation: floatCoin2 5.5s ease-in-out infinite;
}

.coin-6 {
  top: 72%;
  right: 8%;
  width: 26px;
  height: 26px;
  animation: floatCoin3 4.8s ease-in-out infinite;
}

@keyframes floatCoin1 {

  0%,
  100% {
    transform: translateY(0) rotate(15deg);
  }

  50% {
    transform: translateY(-10px) rotate(35deg);
  }
}

@keyframes floatCoin2 {

  0%,
  100% {
    transform: translateY(0) rotate(-20deg);
  }

  50% {
    transform: translateY(8px) rotate(-5deg);
  }
}

@keyframes floatCoin3 {

  0%,
  100% {
    transform: translateY(0) rotate(40deg);
  }

  50% {
    transform: translateY(-12px) rotate(20deg);
  }
}

/* =============================
   POPUP CONTENT
   ============================= */
.popup-content {
  position: relative;
  z-index: 3;
  width: 100%;
  padding: 45px 30px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  box-sizing: border-box;
}

.popup-title {
  color: #fff;
  font-size: 1.45rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 1px;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.7);
  margin-bottom: 25px;
}

/* Image wrapper (for iPhone or generic image prize) */
.prize-image-wrapper {
  width: 160px;
  height: 160px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 215, 0, 0.1);
  border-radius: 15px;
  border: 1.5px solid rgba(255, 215, 0, 0.3);
  overflow: hidden;
  margin-bottom: 20px;
  box-shadow: 0 0 20px rgba(255, 215, 0, 0.2);
}

.prize-image-wrapper img {
  max-width: 90%;
  max-height: 90%;
  object-fit: contain;
}

/* Prize Amount Text (3D text like the image) */
.prize-amount {
  font-family: 'Arial Black', 'Impact', 'Roboto', sans-serif;
  font-weight: 900;
  font-size: 3.2rem;
  color: #ffe600;
  -webkit-text-stroke: 1.5px #7e0c05;
  text-shadow:
    -2px -2px 0 #7e0c05,
    2px -2px 0 #7e0c05,
    -2px 2px 0 #7e0c05,
    2px 2px 0 #7e0c05,
    0px 5px 0px #7e0c05,
    0px 7px 0px #400000,
    0px 12px 18px rgba(0, 0, 0, 0.85);
  letter-spacing: -1.5px;
  margin-bottom: 30px;
  text-align: center;
  line-height: 1.1;
  width: 100%;
}

.prize-sub {
  font-size: 1rem;
  color: #eee;
  margin-bottom: 20px;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
}

.code-box {
  margin: 10px 0 25px 0;
  padding: 12px 24px;
  background: rgba(255, 255, 255, 0.1);
  border: 2px dashed #ffcc00;
  border-radius: 8px;
  color: #fff;
  font-family: 'Roboto', sans-serif;
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: 1px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
  box-shadow: 0 0 15px rgba(255, 204, 0, 0.2);
  display: none; /* Hiển thị bằng Javascript */
}

.code-box span {
  color: #ffe600;
  font-size: 1.5rem;
  font-weight: 900;
  margin-left: 5px;
  background: rgba(0, 0, 0, 0.3);
  padding: 2px 10px;
  border-radius: 4px;
  border: 1px solid rgba(255, 204, 0, 0.3);
  display: inline-block;
}

/* =============================
   CLAIM BUTTON (RED-GOLD PILL)
   ============================= */
.claim-btn {
  display: inline-block;
  font-family: 'Roboto', sans-serif;
  text-decoration: none;
  text-align: center;
  box-sizing: border-box;
}

.claim-btn--red-gold {
  background: linear-gradient(to bottom, #ff0808 0%, #c40202 100%);
  color: #fff;
  border: 3px solid #ffcc00;
  border-radius: 50px;
  font-weight: 900;
  font-size: 1.4rem;
  padding: 14px 36px;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.6);
  box-shadow:
    0 6px 15px rgba(227, 10, 10, 0.45),
    0 4px 0 #610000,
    inset 0 1px 0 rgba(255, 255, 255, 0.35);
  transition: all 0.15s ease;
  width: 100%;
  max-width: 320px;
}

.claim-btn--red-gold:hover {
  transform: translateY(-2px);
  box-shadow:
    0 8px 22px rgba(227, 10, 10, 0.55),
    0 5px 0 #610000;
}

.claim-btn--red-gold:active {
  transform: translateY(2px);
  box-shadow:
    0 2px 5px rgba(227, 10, 10, 0.35),
    0 1px 0 #610000;
}

/* =============================
   RESPONSIVE — MOBILE
   ============================= */
@media (max-width: 600px) {
  .main-container {
    max-width: 380px;
    padding: 28px 16px 30px;
    margin-bottom: 90px;
    gap: 16px;
  }

  .header-text h1 {
    font-size: 2.1rem;
  }

  .header-text p {
    font-size: 0.95rem;
  }

  .wheel-container {
    width: 320px;
    height: 320px;
  }

  #wheel {
    width: 310px !important;
    height: 310px !important;
  }

  #centerCanvas {
    width: 80px !important;
    height: 80px !important;
  }

  .spin-btn {
    width: 190px;
    font-size: 1.3rem;
    padding: 14px 22px;
  }



  .popup-box {
    border-radius: 18px;
    max-width: 320px;
  }

  .popup-title {
    font-size: 1.15rem;
    margin-bottom: 18px;
  }

  .prize-amount {
    font-size: 2.5rem;
    margin-bottom: 25px;
  }

  .prize-image-wrapper {
    width: 130px;
    height: 130px;
  }

  .claim-btn--red-gold {
    font-size: 1.1rem;
    padding: 10px 20px;
  }
}