.game-tap-falling-gift {
  --gift-ink: #24212a;
  --gift-red: #e62129;
  --gift-gold: #ffd45a;
  --gift-green: #20a66b;
  --gift-blue: #1d73d8;
  --gift-stage-art: none;
  display: flex;
  flex-direction: column;
  width: 100%;
}

.portal-page.is-game-focus .mini-game-card:has(.game-tap-falling-gift) {
  --game-card-play-min-height: 452px;
  --game-card-play-max-height: 780px;
  --game-stage-play-min-height: 300px;
}

.game-tap-falling-gift .game-hud {
  gap: 6px;
  padding: 8px;
  border-bottom: 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.16), transparent 38%),
    linear-gradient(180deg, #f0444d 0%, #c41723 58%, #8f111a 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.26),
    inset 0 -4px 0 rgba(77, 5, 10, 0.22),
    0 6px 0 rgba(143, 17, 26, 0.12);
}

.game-tap-falling-gift .game-hud-item {
  min-height: 34px;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 5px 8px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 255, 255, 0.18), transparent 60%),
    rgba(64, 8, 12, 0.28);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.16),
    0 3px 0 rgba(73, 6, 11, 0.18);
}

.game-tap-falling-gift .game-hud-label {
  color: #fff3a0;
  font-size: 9px;
  line-height: 1;
  letter-spacing: 0;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.24);
}

.game-tap-falling-gift .game-hud-value {
  color: #ffffff;
  font-size: 18px;
  line-height: 1;
  text-shadow:
    0 2px 0 rgba(0, 0, 0, 0.22),
    0 0 14px rgba(255, 212, 90, 0.24);
}

.game-tap-falling-gift .game-stage {
  min-height: 280px;
  border-top: 1px solid rgba(255, 255, 255, 0.72);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.16), rgba(255, 230, 186, 0.04) 42%, rgba(94, 16, 24, 0.22)),
    var(--gift-stage-art) center / cover no-repeat,
    linear-gradient(135deg, #fff7d4 0%, #dff5ff 48%, #ffe3e5 100%);
  box-shadow:
    inset 0 10px 18px rgba(255, 255, 255, 0.2),
    inset 0 -26px 32px rgba(83, 12, 18, 0.28);
}

.game-tap-falling-gift .game-stage::before {
  z-index: 0;
  inset: auto 0 0;
  height: 84px;
  border-radius: 0;
  background:
    linear-gradient(180deg, transparent 0%, rgba(143, 17, 26, 0.1) 34%, rgba(143, 17, 26, 0.24) 100%),
    radial-gradient(ellipse at center bottom, rgba(255, 212, 90, 0.36), transparent 70%);
  filter: none;
}

.game-tap-falling-gift .game-stage::after {
  z-index: 1;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.16) 0 1px, transparent 1px calc(50% - 38px), rgba(255, 255, 255, 0.2) calc(50% - 38px) calc(50% - 36px), transparent calc(50% - 36px) calc(50% + 36px), rgba(255, 255, 255, 0.2) calc(50% + 36px) calc(50% + 38px), transparent calc(50% + 38px)),
    radial-gradient(circle at 50% 10%, rgba(255, 238, 157, 0.34), transparent 20%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.02) 0%, transparent 54%, rgba(80, 10, 16, 0.18) 100%);
}

.portal-page.is-game-focus .game-tap-falling-gift .game-stage {
  height: clamp(292px, calc(100svh - 330px), 380px);
  min-height: 292px;
}

@supports (height: 100dvh) {
  .portal-page.is-game-focus .game-tap-falling-gift .game-stage {
    height: clamp(292px, calc(100dvh - 330px), 380px);
  }
}

.portal-page.is-game-focus .game-tap-falling-gift.is-countdown .game-stage,
.portal-page.is-game-focus .game-tap-falling-gift.is-playing .game-stage,
.portal-page.is-game-focus .game-tap-falling-gift.is-completing .game-stage {
  height: clamp(318px, calc(100svh - 236px), 560px);
  min-height: var(--game-stage-play-min-height);
}

@supports (height: 100dvh) {
  .portal-page.is-game-focus .game-tap-falling-gift.is-countdown .game-stage,
  .portal-page.is-game-focus .game-tap-falling-gift.is-playing .game-stage,
  .portal-page.is-game-focus .game-tap-falling-gift.is-completing .game-stage {
    height: clamp(318px, calc(100dvh - 236px), 560px);
  }
}

@supports selector(:has(*)) {
  .portal-page.is-game-focus .game-tap-falling-gift.is-countdown .game-stage,
  .portal-page.is-game-focus .game-tap-falling-gift.is-playing .game-stage,
  .portal-page.is-game-focus .game-tap-falling-gift.is-completing .game-stage {
    height: auto;
    min-height: var(--game-stage-play-min-height);
  }
}

.game-tap-falling-gift.is-playing .game-stage {
  touch-action: none;
}

.game-tap-falling-gift.is-finished .game-stage {
  height: auto;
  min-height: 0;
  touch-action: auto;
  background: #ffffff;
}

.game-tap-falling-gift.is-finished .game-overlay {
  position: static;
  display: block;
  padding: 12px 16px;
  background: #ffffff;
  backdrop-filter: none;
}

.game-tap-falling-gift.is-finished .game-overlay-panel {
  width: 100%;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  text-align: left;
}

.game-tap-falling-gift.is-finished .game-overlay-panel h2 {
  margin: 0;
  color: var(--color-primary);
  font-size: 14px;
  line-height: 1.2;
}

.gift-stage-decor,
.gift-ribbon {
  pointer-events: none;
}

.gift-stage-decor {
  position: absolute;
  inset: 0;
  z-index: 1;
  overflow: hidden;
}

.gift-ribbon {
  position: absolute;
  top: 20px;
  width: 88px;
  height: 18px;
  border-radius: 999px;
  background:
    repeating-linear-gradient(90deg, rgba(230, 33, 41, 0.5) 0 10px, rgba(255, 255, 255, 0.72) 10px 18px),
    rgba(255, 255, 255, 0.42);
  box-shadow: 0 8px 18px rgba(143, 17, 26, 0.12);
}

.gift-ribbon--left {
  left: -28px;
  transform: rotate(-10deg);
}

.gift-ribbon--right {
  right: -24px;
  top: 64px;
  transform: rotate(12deg);
}

.game-tap-falling-gift .game-overlay {
  z-index: 6;
  background:
    radial-gradient(circle at 50% 30%, rgba(255, 255, 255, 0.56), transparent 44%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(143, 17, 26, 0.16));
  backdrop-filter: none;
}

.game-tap-falling-gift .game-overlay-panel {
  width: min(284px, 100%);
  padding: 16px 16px 18px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 22px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(255, 248, 230, 0.86)),
    rgba(255, 255, 255, 0.88);
  box-shadow:
    0 14px 28px rgba(143, 17, 26, 0.15),
    0 0 0 6px rgba(255, 255, 255, 0.24),
    inset 0 1px 0 rgba(255, 255, 255, 0.92);
  text-align: center;
}

.game-tap-falling-gift .game-overlay-panel h2 {
  margin: 5px 0 var(--space-2);
  color: var(--color-text);
  font-size: 26px;
  font-weight: 950;
  text-shadow: 0 2px 0 rgba(255, 255, 255, 0.72);
}

.game-tap-falling-gift .game-overlay-panel p {
  margin: 0 0 var(--space-4);
  color: var(--color-muted-strong);
  font-size: 14px;
  font-weight: 700;
}

.gift-ready-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 0 11px;
  border-radius: 999px;
  color: #ffffff;
  background: linear-gradient(180deg, #ff4450, #bc1620);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0;
  box-shadow:
    0 5px 0 rgba(188, 22, 32, 0.16),
    inset 0 1px 0 rgba(255, 255, 255, 0.32);
}

.gift-ready-stack {
  position: relative;
  width: 102px;
  height: 58px;
  margin: 9px auto 2px;
}

.ready-gift {
  position: absolute;
  bottom: 2px;
  width: 34px;
  height: 34px;
  border: 2px solid rgba(255, 255, 255, 0.78);
  border-radius: 9px;
  box-shadow:
    inset -5px -7px 0 rgba(0, 0, 0, 0.1),
    0 7px 14px rgba(143, 17, 26, 0.14);
}

.ready-gift::before,
.ready-gift::after {
  content: "";
  position: absolute;
  background: rgba(255, 255, 255, 0.58);
}

.ready-gift::before {
  top: -2px;
  bottom: -2px;
  left: 50%;
  width: 8px;
  transform: translateX(-50%);
}

.ready-gift::after {
  top: 10px;
  right: -2px;
  left: -2px;
  height: 8px;
}

.ready-gift--red {
  left: 6px;
  background: linear-gradient(135deg, #ff747b, #e62129 58%, #a90f18);
  transform: rotate(-10deg);
}

.ready-gift--gold {
  left: 34px;
  bottom: 10px;
  z-index: 1;
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, #fff09d, #f4bd35 58%, #bd7100);
}

.ready-gift--green {
  right: 5px;
  background: linear-gradient(135deg, #72e5ae, #20a66b 58%, #0f5f3b);
  transform: rotate(10deg);
}

.countdown-value {
  display: block;
  min-height: 72px;
  color: #bc1620;
  font-size: 64px;
  line-height: 1;
  font-weight: 950;
  text-shadow:
    0 3px 0 #ffd45a,
    0 7px 0 rgba(32, 166, 107, 0.18),
    0 0 22px rgba(255, 255, 255, 0.86);
}

.falling-gift {
  --gift-main: #e62129;
  --gift-hi: #ff747b;
  --gift-shade: #a90f18;
  position: absolute;
  left: 0;
  top: 0;
  z-index: 3;
  display: block;
  border: 3px solid rgba(255, 255, 255, 0.92);
  border-radius: 12px;
  background:
    linear-gradient(90deg, transparent 0 calc(50% - 5px), rgba(255, 255, 255, 0.62) calc(50% - 5px) calc(50% + 5px), transparent calc(50% + 5px)),
    linear-gradient(135deg, var(--gift-hi), var(--gift-main) 58%, var(--gift-shade));
  box-shadow:
    inset -8px -9px 0 rgba(0, 0, 0, 0.12),
    0 14px 26px rgba(85, 9, 16, 0.32),
    0 0 0 7px rgba(255, 255, 255, 0.26),
    0 0 22px rgba(255, 212, 90, 0.24);
  cursor: pointer;
  will-change: transform, opacity;
  touch-action: manipulation;
}

.falling-gift::before {
  content: "";
  position: absolute;
  inset: -12px;
  border: 2px solid rgba(255, 212, 90, 0.48);
  border-radius: 18px;
  opacity: 0.78;
  animation: gift-target-pulse 920ms ease-in-out infinite;
}

.falling-gift .gift-lid {
  position: absolute;
  right: -4px;
  top: 9px;
  left: -4px;
  height: 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.66);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.62);
}

.falling-gift .gift-ribbon-mark {
  position: absolute;
  top: -8px;
  left: 50%;
  width: 22px;
  height: 14px;
  border: 4px solid rgba(255, 255, 255, 0.62);
  border-bottom: 0;
  border-radius: 12px 12px 0 0;
  transform: translateX(-50%);
}

.gift--gold {
  --gift-main: #f4bd35;
  --gift-hi: #fff09d;
  --gift-shade: #b96800;
}

.gift--green {
  --gift-main: #20a66b;
  --gift-hi: #72e5ae;
  --gift-shade: #0f5f3b;
}

.gift--blue {
  --gift-main: #2a88df;
  --gift-hi: #72deff;
  --gift-shade: #113a7d;
}

.gift--red {
  --gift-main: #e62129;
  --gift-hi: #ff747b;
  --gift-shade: #9b1018;
}

.falling-gift.is-collected {
  pointer-events: none;
  opacity: 0;
  filter: brightness(1.18) saturate(1.15);
  transition:
    opacity 230ms ease 120ms,
    filter 260ms ease,
    transform 380ms cubic-bezier(0.16, 1, 0.3, 1);
}

.falling-gift.is-collected::before {
  animation: gift-collected-halo 380ms ease-out forwards;
}

.falling-gift.is-collected .gift-lid {
  animation: gift-lid-pop 360ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.falling-gift.is-collected .gift-ribbon-mark {
  animation: gift-ribbon-pop 360ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.gift-pop {
  position: absolute;
  z-index: 5;
  width: 1px;
  height: 1px;
  pointer-events: none;
  transform: translate(-50%, -50%);
}

.gift-pop-flash {
  position: absolute;
  inset: -32px;
  border-radius: 50%;
  background:
    radial-gradient(circle, rgba(255, 255, 255, 0.92) 0 16%, rgba(255, 212, 90, 0.72) 17% 35%, transparent 62%);
  animation: gift-pop-flash 420ms ease-out forwards;
}

.gift-pop-ring {
  position: absolute;
  inset: -20px;
  border: 4px solid rgba(255, 212, 90, 0.92);
  border-radius: 50%;
  box-shadow: 0 0 18px rgba(255, 212, 90, 0.46);
  animation: gift-pop-ring 680ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.gift-pop-ring--wide {
  inset: -30px;
  border-color: rgba(255, 255, 255, 0.74);
  animation-delay: 70ms;
}

.gift-pop-score {
  position: absolute;
  left: -17px;
  top: -32px;
  min-width: 34px;
  color: #ffffff;
  font-size: 18px;
  font-weight: 950;
  text-align: center;
  text-shadow:
    0 3px 0 rgba(188, 22, 32, 0.5),
    0 0 14px rgba(255, 212, 90, 0.82);
  animation: gift-pop-score 720ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.gift-pop-spark {
  position: absolute;
  left: -5px;
  top: -5px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.72);
  animation: gift-pop-spark 690ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.gift-pop-spark--one {
  --spark-x: -42px;
  --spark-y: -28px;
  background: #ffd45a;
}

.gift-pop-spark--two {
  --spark-x: 44px;
  --spark-y: -30px;
  background: #20a66b;
}

.gift-pop-spark--three {
  --spark-x: 0;
  --spark-y: 38px;
  background: #ff6b74;
}

.gift-pop-spark--four {
  --spark-x: -34px;
  --spark-y: 32px;
  background: #ffffff;
}

.gift-pop-spark--five {
  --spark-x: 34px;
  --spark-y: 30px;
  background: #72deff;
}

.gift-pop-spark--six {
  --spark-x: 0;
  --spark-y: -46px;
  background: #fff09d;
}

.gift-pop-confetti {
  position: absolute;
  left: -4px;
  top: -9px;
  width: 8px;
  height: 18px;
  border-radius: 4px;
  background: #ffd45a;
  animation: gift-pop-confetti 760ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.gift-pop-confetti--one {
  --confetti-x: -54px;
  --confetti-y: -4px;
  --confetti-rotate: -42deg;
}

.gift-pop-confetti--two {
  --confetti-x: 52px;
  --confetti-y: -2px;
  --confetti-rotate: 38deg;
  background: #20a66b;
  animation-delay: 50ms;
}

.gift-pop-confetti--three {
  --confetti-x: 12px;
  --confetti-y: 48px;
  --confetti-rotate: 86deg;
  background: #ff6b74;
  animation-delay: 80ms;
}

.game-tap-falling-gift .gift-ready-copy {
  color: var(--color-muted-strong);
}

.game-tap-falling-gift:not(.is-playing):not(.is-countdown):not(.is-finished) .game-overlay {
  place-items: start center;
  padding-top: 24px;
  padding-bottom: 30px;
}

.game-tap-falling-gift [data-start] {
  min-width: 118px;
}

@keyframes gift-pop-ring {
  0% {
    opacity: 0.95;
    transform: scale(0.18);
  }

  45% {
    opacity: 0.76;
  }

  100% {
    opacity: 0;
    transform: scale(2.1);
  }
}

@keyframes gift-pop-score {
  0% {
    opacity: 0;
    transform: translateY(12px) scale(0.72);
  }

  18% {
    opacity: 1;
    transform: translateY(-7px) scale(1.26);
  }

  46% {
    opacity: 1;
    transform: translateY(-14px) scale(1);
  }

  100% {
    opacity: 0;
    transform: translateY(-42px) scale(0.92);
  }
}

@keyframes gift-pop-spark {
  0% {
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(0.4);
  }

  24% {
    opacity: 1;
    transform: translate3d(var(--spark-x), var(--spark-y), 0) scale(1.28);
  }

  100% {
    opacity: 0;
    transform: translate3d(var(--spark-x), var(--spark-y), 0) scale(0.18);
  }
}

@keyframes gift-pop-flash {
  0% {
    opacity: 0.92;
    transform: scale(0.22);
  }

  100% {
    opacity: 0;
    transform: scale(1.55);
  }
}

@keyframes gift-pop-confetti {
  0% {
    opacity: 1;
    transform: translate3d(0, 0, 0) rotate(0deg) scaleY(0.75);
  }

  100% {
    opacity: 0;
    transform: translate3d(var(--confetti-x), var(--confetti-y), 0) rotate(var(--confetti-rotate)) scaleY(1);
  }
}

@keyframes gift-collected-halo {
  0% {
    opacity: 0.95;
    transform: scale(1);
  }

  100% {
    opacity: 0;
    transform: scale(1.72);
  }
}

@keyframes gift-lid-pop {
  0% {
    transform: translateY(0) rotate(0deg);
    opacity: 1;
  }

  100% {
    transform: translateY(-18px) rotate(-14deg);
    opacity: 0;
  }
}

@keyframes gift-ribbon-pop {
  0% {
    transform: translateX(-50%) translateY(0) scale(1);
    opacity: 1;
  }

  100% {
    transform: translateX(-50%) translateY(-12px) scale(1.16);
    opacity: 0;
  }
}

@keyframes gift-target-pulse {
  0%,
  100% {
    opacity: 0.38;
    transform: scale(0.94);
  }

  50% {
    opacity: 0.9;
    transform: scale(1.05);
  }
}

@media (max-width: 374px) {
  .portal-page.is-game-focus .mini-game-card:has(.game-tap-falling-gift) {
    --game-card-play-min-height: 430px;
    --game-stage-play-min-height: 274px;
  }

  .game-tap-falling-gift .game-stage {
    min-height: 256px;
  }

  .portal-page.is-game-focus .game-tap-falling-gift .game-stage {
    height: clamp(302px, calc(100svh - 292px), 340px);
    min-height: 302px;
  }

  @supports (height: 100dvh) {
    .portal-page.is-game-focus .game-tap-falling-gift .game-stage {
      height: clamp(302px, calc(100dvh - 292px), 340px);
    }
  }

  .game-tap-falling-gift .game-overlay-panel {
    width: min(264px, 100%);
    padding: 12px 14px 14px;
  }

  .game-tap-falling-gift .game-overlay-panel h2 {
    margin: 3px 0 6px;
    font-size: 22px;
  }

  .game-tap-falling-gift .game-overlay-panel p {
    margin-bottom: 10px;
    font-size: 12px;
    line-height: 1.3;
  }

  .gift-ready-stack {
    width: 86px;
    height: 48px;
    margin: 7px auto 0;
  }

  .ready-gift {
    width: 28px;
    height: 28px;
  }

  .ready-gift--gold {
    left: 28px;
    bottom: 7px;
    width: 34px;
    height: 34px;
  }

  .game-tap-falling-gift [data-start] {
    min-width: 110px;
    min-height: 50px;
  }

  .game-tap-falling-gift:not(.is-playing):not(.is-countdown):not(.is-finished) .game-overlay {
    padding-top: 14px;
    padding-bottom: 16px;
  }
}
