.game-pull-down-coupon {
  --coupon-red: #e62129;
  --coupon-red-dark: #830813;
  --coupon-gold: #ffd65e;
  --coupon-stage-art: none;
  --coupon-open: 0;
  --coupon-pull-offset: 0px;
  display: flex;
  flex-direction: column;
  width: 100%;
}

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

.game-pull-down-coupon .game-hud,
.game-crack-the-egg .game-hud,
.game-swipe-clean-card .game-hud,
.game-open-the-locker .game-hud,
.game-stop-the-bar .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-pull-down-coupon .game-hud-item,
.game-crack-the-egg .game-hud-item,
.game-swipe-clean-card .game-hud-item,
.game-open-the-locker .game-hud-item,
.game-stop-the-bar .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-pull-down-coupon .game-hud-label,
.game-crack-the-egg .game-hud-label,
.game-swipe-clean-card .game-hud-label,
.game-open-the-locker .game-hud-label,
.game-stop-the-bar .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-pull-down-coupon .game-hud-value,
.game-crack-the-egg .game-hud-value,
.game-swipe-clean-card .game-hud-value,
.game-open-the-locker .game-hud-value,
.game-stop-the-bar .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-pull-down-coupon .game-stage {
  min-height: 280px;
  border-top: 1px solid rgba(255, 255, 255, 0.72);
  background:
    radial-gradient(circle at 50% 26%, rgba(255, 214, 94, 0.2), transparent 26%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.18), rgba(80, 8, 14, 0.06) 46%, rgba(80, 8, 14, 0.18)),
    var(--coupon-stage-art) center / cover no-repeat,
    linear-gradient(180deg, #fff7e8, #f6dee0);
  box-shadow:
    inset 0 10px 18px rgba(255, 255, 255, 0.24),
    inset 0 -18px 28px rgba(143, 17, 26, 0.18);
}

.game-pull-down-coupon .game-stage::before {
  z-index: 0;
  inset: auto 10% 18px;
  height: 24px;
  border-radius: 999px;
  background: rgba(74, 7, 14, 0.28);
  filter: blur(16px);
}

.game-pull-down-coupon .game-stage::after {
  z-index: 1;
  background:
    radial-gradient(circle at 18% 16%, rgba(255, 214, 94, 0.26), transparent 16%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.02) 0%, transparent 60%, rgba(80, 8, 14, 0.14) 100%);
}

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

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

.portal-page.is-game-focus .game-pull-down-coupon:not(.is-countdown):not(.is-playing):not(.is-completing):not(.is-finished) .game-stage {
  height: clamp(340px, 53svh, 420px);
  min-height: 340px;
}

@supports (height: 100dvh) {
  .portal-page.is-game-focus .game-pull-down-coupon:not(.is-countdown):not(.is-playing):not(.is-completing):not(.is-finished) .game-stage {
    height: clamp(340px, 53dvh, 420px);
  }
}

.portal-page.is-game-focus .game-pull-down-coupon.is-countdown .game-stage,
.portal-page.is-game-focus .game-pull-down-coupon.is-playing .game-stage,
.portal-page.is-game-focus .game-pull-down-coupon.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-pull-down-coupon.is-countdown .game-stage,
  .portal-page.is-game-focus .game-pull-down-coupon.is-playing .game-stage,
  .portal-page.is-game-focus .game-pull-down-coupon.is-completing .game-stage {
    height: clamp(318px, calc(100dvh - 236px), 560px);
  }
}

@supports selector(:has(*)) {
  .portal-page.is-game-focus .game-pull-down-coupon.is-countdown .game-stage,
  .portal-page.is-game-focus .game-pull-down-coupon.is-playing .game-stage,
  .portal-page.is-game-focus .game-pull-down-coupon.is-completing .game-stage {
    height: clamp(318px, calc(100dvh - 236px), 560px);
    min-height: var(--game-stage-play-min-height);
  }
}

.game-pull-down-coupon.is-playing .game-stage {
  touch-action: none;
}

.game-pull-down-coupon.is-finished .game-stage {
  height: auto;
  min-height: 0;
  touch-action: auto;
  background: #ffffff;
}

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

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

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

.coupon-machine {
  position: absolute;
  left: 50%;
  top: 4%;
  z-index: 2;
  width: min(84%, 390px);
  height: min(88%, 380px);
  min-height: 300px;
  overflow: hidden;
  transform: translateX(-50%);
}

.coupon-machine *,
.coupon-machine *::before,
.coupon-machine *::after {
  box-sizing: border-box;
}

.coupon-sleeve {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  z-index: 3;
  height: 128px;
  overflow: hidden;
  border: 3px solid rgba(255, 214, 94, 0.94);
  border-radius: 28px 28px 22px 22px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.2), transparent 34%),
    radial-gradient(circle at 22% 16%, rgba(255, 255, 255, 0.22), transparent 22%),
    linear-gradient(180deg, #b80916 0%, #e62129 54%, #7a0812 100%);
  box-shadow:
    0 18px 28px rgba(74, 7, 14, 0.32),
    inset 0 1px 0 rgba(255, 255, 255, 0.34),
    inset 0 -12px 20px rgba(75, 3, 9, 0.28);
  pointer-events: none;
}

.coupon-sleeve::before {
  content: "";
  position: absolute;
  inset: 14px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 19px;
}

.coupon-sleeve::after {
  content: "";
  position: absolute;
  right: -3px;
  bottom: -3px;
  left: -3px;
  height: 42px;
  border: 3px solid rgba(255, 214, 94, 0.96);
  border-top: 0;
  border-radius: 0 0 22px 22px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), transparent),
    linear-gradient(180deg, #a40914, #710610);
  box-shadow: inset 0 9px 16px rgba(38, 2, 6, 0.38);
}

.coupon-sleeve__label {
  position: absolute;
  top: 20px;
  right: 20px;
  left: 20px;
  color: #ffe58f;
  font-size: 12px;
  font-weight: 950;
  line-height: 1;
  text-align: center;
  text-transform: uppercase;
  text-shadow: 0 2px 0 rgba(79, 4, 10, 0.24);
}

.coupon-sleeve__slot {
  position: absolute;
  right: 24px;
  bottom: 28px;
  left: 24px;
  z-index: 2;
  height: 26px;
  border: 2px solid rgba(255, 230, 143, 0.8);
  border-radius: 999px;
  background:
    linear-gradient(180deg, rgba(39, 2, 7, 0.5), rgba(39, 2, 7, 0.86)),
    radial-gradient(ellipse at center, rgba(255, 214, 94, 0.22), transparent 70%);
  box-shadow:
    inset 0 4px 8px rgba(0, 0, 0, 0.32),
    0 1px 0 rgba(255, 255, 255, 0.18);
}

.coupon-card {
  position: absolute;
  right: 20px;
  left: 20px;
  top: 0;
  height: 318px;
  padding: 0;
  border: 0;
  color: #ffffff;
  background: transparent;
  touch-action: none;
}

.coupon-ticket {
  position: absolute;
  top: -58px;
  right: 0;
  left: 0;
  z-index: 1;
  min-height: 184px;
  padding: 66px 18px 24px;
  border: 2px solid rgba(255, 214, 94, 0.92);
  border-radius: 22px;
  background:
    radial-gradient(circle at 18% 0%, rgba(255, 255, 255, 0.72), transparent 38%),
    repeating-linear-gradient(90deg, transparent 0 18px, rgba(184, 9, 22, 0.05) 18px 20px),
    linear-gradient(180deg, #fff8cf 0%, #ffe27a 42%, #ffc04b 100%);
  box-shadow:
    0 22px 34px rgba(74, 7, 14, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.34),
    inset 0 -12px 20px rgba(121, 50, 0, 0.16);
  transform: translateY(var(--coupon-pull-offset));
  transition: transform 120ms ease-out;
  will-change: transform;
}

.coupon-ticket::before,
.coupon-ticket::after {
  content: "";
  position: absolute;
  top: 52%;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: #fff7e8;
  transform: translateY(-50%);
}

.coupon-ticket::before {
  left: -10px;
}

.coupon-ticket::after {
  right: -10px;
}

.coupon-card-top {
  position: absolute;
  top: 28px;
  right: 16px;
  left: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  border-radius: 999px;
  color: #ffffff;
  background: linear-gradient(180deg, #f0444d, #b80916);
  font-size: 13px;
  font-weight: 900;
  text-transform: uppercase;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.48), 0 4px 10px rgba(74, 7, 14, 0.18);
}

.coupon-card strong {
  display: block;
  margin-top: 0;
  color: #b80916;
  font-size: clamp(24px, 6.5vw, 34px);
  line-height: 1;
  font-weight: 950;
  text-shadow: 0 2px 0 rgba(255, 255, 255, 0.5);
}

.coupon-progress {
  position: relative;
  display: block;
  height: 12px;
  margin: 18px 10px 0;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(83, 7, 14, 0.24);
  box-shadow:
    inset 0 2px 3px rgba(0, 0, 0, 0.28),
    0 1px 0 rgba(255, 255, 255, 0.16);
}

.coupon-progress span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #ffe58f, #ffb11f);
  box-shadow: 0 0 16px rgba(255, 214, 94, 0.48);
}

.coupon-tab {
  position: absolute;
  top: 92px;
  left: 50%;
  z-index: 5;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 92px;
  min-height: 42px;
  border: 2px solid rgba(255, 214, 94, 0.98);
  border-radius: 0 0 20px 20px;
  color: #5a3300;
  background: linear-gradient(180deg, #ffe58f, #d59a3f);
  font-size: 12px;
  font-weight: 950;
  box-shadow:
    0 12px 24px rgba(74, 7, 14, 0.24),
    inset 0 1px 0 rgba(255, 255, 255, 0.4);
  transform: translate(-50%, var(--coupon-pull-offset));
  transition: transform 120ms ease-out;
  will-change: transform;
}

.game-pull-down-coupon.is-open .coupon-ticket {
  filter: brightness(1.05);
  box-shadow:
    0 28px 42px rgba(74, 7, 14, 0.4),
    0 0 34px rgba(255, 214, 94, 0.34),
    inset 0 1px 0 rgba(255, 255, 255, 0.34),
    inset 0 -12px 20px rgba(75, 3, 9, 0.26);
}

.game-pull-down-coupon.is-completing .coupon-card {
  transform: none;
}

.game-pull-down-coupon.is-completing .coupon-ticket {
  transform: translateY(var(--coupon-pull-offset)) scale(1.02);
}

.game-pull-down-coupon .game-overlay {
  z-index: 6;
  background:
    radial-gradient(circle at 50% 28%, rgba(255, 255, 255, 0.58), transparent 42%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.1), rgba(74, 7, 14, 0.18));
  backdrop-filter: none;
}

.game-pull-down-coupon .game-overlay-panel {
  width: min(284px, 100%);
  padding: 16px 16px 18px;
  border: 1px solid rgba(255, 255, 255, 0.74);
  border-radius: 22px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(255, 248, 230, 0.86)),
    rgba(255, 255, 255, 0.9);
  box-shadow:
    0 14px 28px rgba(74, 7, 14, 0.17),
    0 0 0 6px rgba(255, 255, 255, 0.24),
    inset 0 1px 0 rgba(255, 255, 255, 0.92);
}

.coupon-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);
}

.coupon-ready-art {
  width: 92px;
  height: 56px;
  margin: 10px auto 4px;
  border: 2px solid rgba(255, 214, 94, 0.82);
  border-radius: 16px;
  background:
    radial-gradient(circle at 22% 42%, #ffe58f 0 14%, transparent 16%),
    linear-gradient(135deg, #ffd65e 0%, #ff6a35 54%, #e62129 100%);
  transform: rotate(-4deg);
  box-shadow: 0 12px 22px rgba(143, 17, 26, 0.18);
}
