/* GLOBAL */
body {
  margin: 0;

  /* Use full-screen background image */
  background: url("assets/background.png") center top / cover no-repeat fixed;

  font-family: "Kanit", system-ui;
  display: flex;
  justify-content: center;
  padding-top: 24px;
  color: white;

  /* smooth rendering */
  image-rendering: -webkit-optimize-contrast;
}

.wrapper {
  width: 360px;
  text-align: center;
}

.title-bar {
  position: absolute;
  top: 28px;
  left: 50%;
  transform: translateX(-50%);

  font-weight: 900;
  color: #ffffff;
  white-space: nowrap;              /* NEVER wrap */
  text-shadow: 0 4px 10px rgba(0,0,0,0.55);

  /* RESPONSIVE TEXT — NEVER WRAPS */
  font-size: clamp(20px, 5vw, 32px);

  padding: 12px 24px;
  border-radius: 18px;

  background: rgba(0,0,0,0.25);
  backdrop-filter: blur(6px);

  z-index: 20;

  max-width: 95vw;                  /* safe on narrow screens */
  overflow: hidden;
  text-overflow: ellipsis;          /* avoids breaking layout */
}


/* GAME AREA */
.game-area {
  position: fixed;
  inset: 0;          /* full screen */
  width: 100%;
  height: 100%;

  background: url("assets/background.png") center center / cover no-repeat;
  overflow: hidden;
  z-index: 1;
}

/* =======================
   SNOWFLAKE
========================== */
.snowflake {
  position: absolute;
  top: -80px;                          /* start above the game box */
  width: 70px;
  height: 70px;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 50;                         /* ensure it's above blur overlay */
  pointer-events: auto;
  background: transparent !important;
  box-shadow: none !important;
}

.flake-img {
  width: 40px;
  height: 40px;
  object-fit: contain;
  pointer-events: none;   /* allows flake div to handle click */
  user-select: none;
}

/* Falling only controls Y */
@keyframes fallDown {
  0% {
    transform: translateY(0) scale(1);
    opacity: 0;
  }
  10% {
    opacity: 1;
  }
  100% {
    transform: translateY(460px) scale(1);
    opacity: 0.9;
  }
}

/* Caught state */
.snowflake.caught {
  animation: none !important;
  transform: scale(1.4);
  filter:
    drop-shadow(0 0 10px white)
    drop-shadow(0 0 18px #9cf);
}

.snowflake.faded {
  opacity: 0.2;
  pointer-events: none;
}

/* =======================
   IDLE HINT
========================== */
.idle-hint {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(255,255,255,0.9);
  padding: 10px 16px;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 700;
  color: #1c2e4b;
  text-align: center;
  display: none;      /* hidden by default */
  z-index: 20;
}

/* class to show it */
.idle-hint.visible {
  display: block;
}

/* =======================
   POPUP
========================== */
.popup {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  display: none;   /* hidden by default */
  justify-content: center;
  align-items: center;
  z-index: 100;
}

/* class to show popup */
.popup.visible {
  display: flex;
}

.popup-box {
  width: 80%;
  max-width: 320px;
  background: #e9f3ff;
  padding: 20px;
  border-radius: 18px;
  text-align: center;
  color: #14325c;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}

.popup-title {
  font-size: 20px;
  font-weight: 800;
  margin-bottom: 10px;
}

#rewardText {
  white-space: pre-line;
  font-size: 16px;
  font-weight: 600;
}

.popup-btn {
  margin-top: 14px;
  padding: 10px 26px;
  border-radius: 20px;
  border: none;
  background: #4da6ff;
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
}
