.game-falling-coin-catcher {
  --coin-stage-art: none;
  display: flex;
  flex-direction: column;
  width: 100%;
}

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

.game-falling-coin-catcher .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 -4px 0 rgba(77, 5, 10, 0.22);
}

.game-falling-coin-catcher .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: 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-falling-coin-catcher .game-hud-label {
  color: #fff3a0;
  font-size: 9px;
  line-height: 1;
}

.game-falling-coin-catcher .game-hud-value {
  color: #ffffff;
  font-size: 18px;
  line-height: 1;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.22);
}

.game-falling-coin-catcher .game-stage {
  min-height: 300px;
  background:
    radial-gradient(circle at 50% 16%, rgba(255, 212, 90, 0.24), transparent 20%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(128, 48, 4, 0.1)),
    var(--coin-stage-art) center / cover no-repeat,
    linear-gradient(160deg, #ef404b, #ffd45a);
}

.game-falling-coin-catcher .game-stage::before {
  z-index: 1;
  inset: auto 10% 18px;
  height: 30px;
  border-radius: 999px;
  background: rgba(74, 30, 0, 0.28);
  filter: blur(18px);
}

.game-falling-coin-catcher .game-stage::after {
  z-index: 1;
  background:
    linear-gradient(90deg, transparent 0 46%, rgba(255, 255, 255, 0.2) 50%, transparent 54%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent 58%, rgba(74, 30, 0, 0.12));
}

.portal-page.is-game-focus .game-falling-coin-catcher:not(.is-countdown):not(.is-playing):not(.is-completing):not(.is-finished) .game-stage {
  min-height: clamp(364px, 50svh, 420px);
}

@supports (height: 100dvh) {
  .portal-page.is-game-focus .game-falling-coin-catcher:not(.is-countdown):not(.is-playing):not(.is-completing):not(.is-finished) .game-stage {
    min-height: clamp(364px, 50dvh, 420px);
  }
}

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

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

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

.game-falling-coin-catcher.is-playing .game-stage {
  touch-action: none;
}

.game-falling-coin-catcher.is-finished .game-stage {
  min-height: 0;
  height: auto;
  background: #ffffff;
}

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

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

.falling-coin {
  position: absolute;
  z-index: 3;
  border-radius: 999px;
  border: 1px solid rgba(130, 76, 0, 0.44);
  background:
    radial-gradient(circle at 30% 24%, rgba(255, 255, 255, 0.96) 0 7px, transparent 8px),
    radial-gradient(circle at 62% 70%, rgba(168, 91, 0, 0.36) 0 9px, transparent 10px),
    repeating-conic-gradient(from 8deg, #fff4a6 0 8deg, #d28a00 8deg 14deg, #ffcf3f 14deg 22deg),
    radial-gradient(circle, #ffe76f 0 47%, #f5b41d 48% 63%, #a65e00 64% 100%);
  box-shadow:
    0 10px 18px rgba(85, 40, 0, 0.3),
    0 0 0 7px rgba(255, 255, 255, 0.2),
    inset 0 2px 0 rgba(255, 255, 255, 0.72),
    inset 0 -4px 0 rgba(117, 63, 0, 0.34);
  pointer-events: none;
}

.falling-coin::before,
.falling-coin::after {
  content: "";
  position: absolute;
  border-radius: inherit;
}

.falling-coin::before {
  inset: 13%;
  background:
    radial-gradient(circle at 34% 24%, rgba(255, 255, 255, 0.62) 0 5px, transparent 6px),
    radial-gradient(circle, #ffe98b 0 54%, #d99300 55% 100%);
  box-shadow:
    inset 0 0 0 2px rgba(255, 255, 255, 0.5),
    inset 0 -3px 0 rgba(145, 77, 0, 0.3),
    0 0 0 2px rgba(132, 75, 0, 0.3);
}

.falling-coin::after {
  inset: 28%;
  border: 3px solid rgba(135, 78, 0, 0.58);
  border-right-color: transparent;
  border-radius: 50%;
  box-shadow:
    5px 0 0 -3px rgba(255, 244, 168, 0.9),
    inset 1px 1px 0 rgba(255, 255, 255, 0.55);
  transform: rotate(-14deg);
}

.falling-coin span {
  position: absolute;
  inset: 9%;
  border: 2px dashed rgba(135, 78, 0, 0.32);
  border-radius: inherit;
  box-shadow: inset 0 0 0 2px rgba(255, 244, 168, 0.52);
}

.falling-coin.is-caught {
  opacity: 0;
  transform: scale(1.3) !important;
  transition: 0.12s ease;
}

.coin-basket {
  position: absolute;
  bottom: 12px;
  left: 50%;
  z-index: 4;
  height: 48px;
  border: 2px solid rgba(255, 255, 255, 0.72);
  border-radius: 16px 16px 8px 8px;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.18), transparent 28%, rgba(255, 255, 255, 0.14)),
    repeating-linear-gradient(45deg, #8b4a16 0 9px, #a96320 9px 18px);
  box-shadow: 0 12px 22px rgba(74, 30, 0, 0.34), inset 0 8px 0 rgba(255, 212, 90, 0.28);
  transform: translateX(-50%);
  pointer-events: none;
}

.coin-basket::before {
  content: "";
  position: absolute;
  inset: -8px -5px auto;
  height: 13px;
  border-radius: 999px;
  background: repeating-linear-gradient(90deg, #e62129 0 14px, #ffd45a 14px 28px);
  box-shadow: 0 4px 0 rgba(62, 25, 0, 0.2);
}

.coin-catch-pop {
  position: absolute;
  z-index: 5;
  color: #ffffff;
  font-size: 18px;
  font-weight: 950;
  text-shadow: 0 2px 0 rgba(99, 0, 0, 0.3);
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.game-falling-coin-catcher .game-overlay {
  background: rgba(255, 242, 225, 0.72);
  backdrop-filter: none;
}

.game-falling-coin-catcher .game-overlay-panel {
  width: min(284px, 100%);
  padding: 16px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 16px 30px rgba(100, 12, 18, 0.2), 0 0 0 6px rgba(255, 255, 255, 0.24);
  text-align: center;
}

.coin-ready-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 18px;
  border-radius: 999px;
  color: #ffffff;
  background: linear-gradient(180deg, #ff4b55, #d6101e);
  font-size: 12px;
  font-weight: 900;
}

.coin-ready-art {
  position: relative;
  width: 88px;
  height: 88px;
  margin: 8px auto 6px;
  background: url("/assets/games/falling-coin-catcher/ready-gold-coin.png?v=2") center / contain no-repeat;
}

@media (max-width: 340px), (max-height: 620px) {
  .portal-page.is-game-focus .game-falling-coin-catcher:not(.is-countdown):not(.is-playing):not(.is-completing):not(.is-finished) .game-stage {
    min-height: 352px !important;
  }
}
