body {
  margin: 0;
  padding: 0;
  width: 100%;
  min-height: 100dvh;

  display: flex;
  justify-content: center;   /* center horizontally */
  align-items: flex-start;   /* top start, but centered horizontally */

  background-color: #000;
  overflow: hidden;
}


/* Center on desktop */
body {
    margin: 0;
    padding: 0;
    background: #000;
    display: flex;
    justify-content: center;
    align-items: center;
    height: auto;
    overflow: hidden;
}

.game-area {
  position: relative;
  width: 100%;        /* allow full natural width */
  max-width: 600px;   /* prevents oversized desktop scaling */
  height: 100dvh;
  overflow: hidden;
  background: url("assets/background.png") no-repeat center bottom;
  background-size: cover;
}


/* Title */
.title-bar {
  text-align: center;
  font-size: clamp(22px, 5vw, 32px);
  font-weight: 900;
  padding: 14px 0;
  color: #fff;
  text-shadow: 0 0 12px rgba(0,0,0,0.7);
}

/* Idle Hint */
.idle-hint {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(255,255,255,0.9);
  padding: 14px 22px;
  border-radius: 16px;
  font-size: 18px;
  font-weight: 700;
  color: #222;
  text-align: center;
  z-index: 50;
}
.hidden { display: none; }

/* Box (spawn items) */
.box {
  position: absolute;
  width: 120px;
  height: 120px;
  cursor: pointer;
  z-index: 10;
  transform-origin: center;
  transition: transform 0.2s ease-out;
}

.box img {
  width: 100%;
  height: 100%;
  user-select: none;
  pointer-events: none;
}

/* Gift box container */
.box {
    position: absolute;
    width: 120px;
    height: auto;
    transform: translateY(0);
    animation: riseUp 1.1s ease-out forwards;
}

/* Rise from bottom */
@keyframes riseUp {
    0% {
        transform: translateY(60dvh) scale(2);
        opacity: 0;
    }
    100% {
        transform: translateY(20px) scale(1);
        opacity: 1;
    }
}

/* Shake before smash */
@keyframes shakeBox {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-8px); }
    50% { transform: translateX(8px); }
    75% { transform: translateX(-4px); }
}

/* Smash pop explosion */
@keyframes smashPop {
    0%   { transform: scale(1) rotate(0deg); opacity: 1; }
    100% { transform: scale(2.4) rotate(25deg); opacity: 0; }
}

/* Confetti fall */
.confetti {
  position: fixed;
  width: 10px;
  height: 14px;
  top: -20px;
  opacity: 0.9;
  border-radius: 2px;
  animation: confettiFall linear forwards;
  pointer-events: none;
  z-index: 200;
}

@keyframes confettiFall {
  0% { transform: translateY(0) rotate(0deg); }
  100% { transform: translateY(120dvh) rotate(360deg); }
}

/* Popup */
.popup {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 100;
}

.popup.hidden { display: none; }

.popup-box {
  background: #fff;
  width: 78%;
  max-width: 320px;
  padding: 22px;
  border-radius: 20px;
  text-align: center;
  box-shadow: 0 8px 25px rgba(0,0,0,0.3);
  color: #333;
}

.popup-title {
  font-size: 20px;
  font-weight: 800;
  margin-bottom: 10px;
}

#rewardText {
  white-space: pre-line;
  font-size: 16px;
  margin-bottom: 14px;
}

.popup-btn {
  padding: 10px 26px;
  border-radius: 999px;
  border: none;
  background: linear-gradient(180deg, #ff7b7b, #d63838);
  color: white;
  font-weight: 800;
  font-size: 16px;
  cursor: pointer;
  box-shadow: 0 3px #8e1d1d;
}
.popup-btn:active {
  transform: translateY(2px);
}
