/* --- Basic layout --- */
html,
body {
  margin: 0;
  padding: 0;
  font-family: Arial, sans-serif;
  overflow: hidden;
}

.container {
  background-color: #000;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  height: 100vh;
  width: 100%;
}

.background {
  position: relative;
  overflow: hidden;
  height: 100%;
  width: 100%;
  max-width: 550px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.background .bg {
  width: 100%;
  height: 100%;
  object-fit: cover;
  position: absolute;
  top: 0;
  left: 0;
  z-index: 0;
}

.content {
  position: absolute;
  top: 20%;
  left: 50%;
  width: 100%;
  max-width: 370px;
  transform: translate(-50%, -50%);
  z-index: 1;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 30px;
}

.content .logo {
  width: 100%;
  max-width: 200px;
  margin: 0 auto;
}

.content .text {
  width: 100%;
  max-width: 500px;
  margin: 0 auto;
}

/* --- Gift group positions (keeps your original HTML structure) --- */
/* --- Gift group positions (keeps your original HTML structure) --- */
.boxgif {
  position: absolute;
  top: 55%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  max-width: 500px;
  gap: 15px;
  z-index: 10;
}

/* Columns */
.pointer,
.pointer1 {
  position: relative;
  width: 40%;
  display: flex;
  flex-direction: column;
  gap: 15px;
  align-items: center;
  justify-content: center;
  top: auto;
  left: auto;
  right: auto;
}

/* Common image styles */
.pointer img,
.pointer1 img {
  width: 100%;
  max-width: 300px;
  display: block;
  transform-origin: center center;
  transition: all 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  will-change: transform;
  animation: colorfulGlow 4s ease-in-out infinite;
}

/* Active border animation during cycling */
.pointer img.active-border,
.pointer1 img.active-border {
  animation: activeBorderGlow 0.3s ease-in-out !important;
  border: 4px solid rgba(255, 215, 0, 1);
  border-radius: 20px;
  box-shadow:
    0 0 20px rgba(255, 215, 0, 1),
    0 0 40px rgba(255, 180, 0, 0.8),
    0 0 60px rgba(255, 140, 0, 0.6);
  filter: brightness(1.4);
  transform: scale(1.1);
  z-index: 100;
  position: relative;
}

/* Winner border - bright red/orange glow */
.pointer img.winner-border,
.pointer1 img.winner-border {
  animation: winnerBorderGlow 1.5s ease-in-out infinite !important;
  border: 4px solid rgba(255, 60, 60, 1);
  border-radius: 20px;
  box-shadow:
    0 0 20px rgba(255, 60, 60, 0.418),
    0 10px 50px rgba(255, 50, 50, 0.267),
    inset 0 0 25px rgba(255, 255, 255, 0.4);
  filter: brightness(1.35);
  transform: scale(1.08);
  z-index: 100;
  position: relative;
  transition: all 0.5s ease-out;
}

/* Start button */
.btn {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: 10%;
  z-index: 20;
  cursor: pointer;
  pointer-events: auto;
}

.btn img {
  width: 200px;
  display: block;
  animation: zoomInOut 2s ease-in-out infinite;
  transform-origin: center center;
  transition: transform 0.3s ease;
}

.footerimg {
  position: fixed;
  width: 100%;
  max-width: 100%;
  bottom: -5px;
  left: 50%;
  transform: translateX(-50%);
}

.footerimg img {
  width: 100%;
}

/* Colorful Glow effect animation for gift boxes */
@keyframes colorfulGlow {
  0% {
    filter: drop-shadow(0 0 10px rgba(255, 217, 0, 0.308))
      drop-shadow(0 0 30px rgba(255, 179, 0, 0.274)) brightness(1.05);
  }
  25% {
    filter: drop-shadow(0 0 15px rgba(255, 140, 0, 0.336))
      drop-shadow(0 0 45px rgba(255, 120, 0, 0.5)) brightness(1.1);
  }
  50% {
    filter: drop-shadow(0 0 20px rgba(255, 217, 0, 0.315))
      drop-shadow(0 0 60px rgba(255, 179, 0, 0.288)) brightness(1.15);
  }
  75% {
    filter: drop-shadow(0 0 15px rgba(255, 140, 0, 0.26))
      drop-shadow(0 0 45px rgba(255, 119, 0, 0.274)) brightness(1.1);
  }
  100% {
    filter: drop-shadow(0 0 10px rgba(255, 217, 0, 0.192))
      drop-shadow(0 0 30px rgba(255, 179, 0, 0.178)) brightness(1.05);
  }
}

/* Active border glow animation during cycling */
@keyframes activeBorderGlow {
  0% {
    border-color: rgba(255, 215, 0, 0.8);
    box-shadow:
      0 0 15px rgba(255, 215, 0, 0.8),
      0 0 30px rgba(255, 180, 0, 0.6);
  }
  100% {
    border-color: rgba(255, 215, 0, 1);
    box-shadow:
      0 0 20px rgba(255, 215, 0, 1),
      0 0 40px rgba(255, 180, 0, 0.8),
      0 0 60px rgba(255, 140, 0, 0.6);
  }
}

/* small accessibility: disabled look for button while running */
.btn.disabled {
  opacity: 0.6;
  pointer-events: none;
  transform: translateX(-50%) scale(0.98);
}

/* responsive scaling (optional) */
@media (min-width: 900px) {
  .background {
    transform: scale(1);
  }
}

/* --- Try Again Modal --- */
.try-again-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
  z-index: 1000;
}

.try-again-modal.show {
  opacity: 1;
  pointer-events: all;
}

.try-again-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 500px;
  position: relative;
  animation: popIn 0.5s ease forwards;
}

.try-again-body {
  width: 100%;
  position: relative;
  z-index: 10;
  margin-bottom: 5%;
}
.try-again-body img {
  width: 100%;
  max-width: 450px;
  display: block;
  margin: 0 auto;
}

.try-again-btn {
  width: 100%;
  position: relative;
  z-index: 30;
  cursor: pointer;
  transition: transform 0.2s;
}
.try-again-btn img {
  width: 100%;
  max-width: 200px;
  display: block;
  margin: 0 auto;
  animation: pulse 1.5s infinite;
}
.try-again-btn:hover {
  transform: scale(1.05);
}

/* --- Winner Modal Popup --- */
.winner-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
  z-index: 999;
}

.winner-modal.show {
  opacity: 1;
  pointer-events: all;
}

/* Container for the 3 visual elements: Header Text, Emblem, Button */
.winner-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 500px;
  position: relative;
  animation: popIn 0.5s ease forwards;
}

/* Top text image */
.winner-text {
  width: 100%;
  text-align: center;
  margin-bottom: 5%; /* Slight overlap into emblem if needed */
  z-index: 20;
  animation: bounce 2s ease-in-out infinite alternate;
}
.winner-text img {
  width: 100%;
  max-width: 300px;
  display: block;
  margin: 0 auto;
}

/* Middle emblem image */
.winner-body {
  width: 100%;
  position: relative;
  z-index: 10;
  margin-bottom: 5%; /* Slight overlap into button */
}
.winner-body img {
  width: 100%;
  max-width: 450px;
  display: block;
  margin: 0 auto;
}

/* Bottom button/claim image */
.winner-btn {
  width: 100%;
  position: relative;
  z-index: 30;
  cursor: pointer;
  transition: transform 0.2s;
}
.winner-btn img {
  width: 100%;
  max-width: 200px;
  display: block;
  margin: 0 auto;
  animation: pulse 1.5s infinite;
}
.winner-btn:hover {
  transform: scale(1.05);
}

@keyframes popIn {
  0% {
    transform: scale(0.6);
    opacity: 0;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes pulse {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
  100% {
    transform: scale(1);
  }
}

/* --- Zoom In & Out Animation --- */
@keyframes zoomInOut {
  0% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.08);
  }

  100% {
    transform: scale(1);
  }
}

/* --- Mobile Responsiveness --- */
@media (max-width: 440px) {
  .content {
    top: 20%;
  }
  .logo {
    width: 100%;
    max-width: 120px;
  }
  .text {
    width: 100%;
    max-width: 350px;
  }
  .btn {
    bottom: 15%;
  }

  .btn img {
    width: 160px;
  }
}
@media (max-width: 428px) {
  .content {
    width: 100%;
    max-width: 280px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
  }
  .content .logo {
    width: 100%;
    max-width: 130px;
  }
  .content .text {
    max-width: 380px;
  }
}

/* Devices ≤ 414px */
@media (max-width: 414px) {
  .content {
    text-align: center;
  }

  .content .text {
    max-width: 360px;
  }
}

/* Devices ≤ 360px */
@media (max-width: 360px) {
  .content {
    position: absolute;
    top: 15%;
    left: 50%;
    width: 100%;
    max-width: 200px;
    transform: translate(-50%, -50%);
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
  }
  .content .logo {
    width: 100%;
    max-width: 170px;
  }

  .content .text {
    width: 100%;
    max-width: 400px;
  }
}
