.game-avoid-the-bomb {
  --bomb-stage-art: none;
  display: flex;
  flex-direction: column;
  width: 100%;
}

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

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

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

.game-avoid-the-bomb .game-stage {
  min-height: 300px;
  background:
    radial-gradient(circle at 50% 18%, rgba(255, 212, 90, 0.22), transparent 22%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(75, 0, 0, 0.08)),
    var(--bomb-stage-art) center / cover no-repeat,
    linear-gradient(160deg, #e62129, #ffd45a);
}

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

.game-avoid-the-bomb .game-stage::after {
  z-index: 1;
  background:
    radial-gradient(circle at 18% 20%, rgba(255, 255, 255, 0.14), transparent 16%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent 58%, rgba(75, 0, 0, 0.14));
}

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

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

.game-avoid-the-bomb.is-playing .game-stage {
  touch-action: manipulation;
}

.game-avoid-the-bomb.is-finished .game-stage {
  min-height: 0;
  height: auto;
  background: #ffffff;
}

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

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

.danger-strip {
  position: absolute;
  top: 0;
  bottom: 0;
  z-index: 1;
  width: 34px;
  background: linear-gradient(90deg, rgba(126, 4, 17, 0.24), transparent);
  pointer-events: none;
}

.danger-strip--left {
  left: 0;
}

.danger-strip--right {
  right: 0;
  transform: scaleX(-1);
}

.bonus-object,
.bomb-object {
  position: absolute;
  z-index: 3;
  display: grid;
  place-items: center;
  border: 0;
  cursor: pointer;
  touch-action: manipulation;
}

.bonus-object {
  border-radius: 999px;
  background:
    radial-gradient(circle at 34% 28%, rgba(255, 255, 255, 0.9) 0 8px, transparent 9px),
    radial-gradient(circle, #fff08a 0 26%, #ffd45a 27% 62%, #d99200 63% 100%);
  box-shadow:
    0 10px 18px rgba(90, 45, 0, 0.3),
    0 0 0 7px rgba(255, 255, 255, 0.24),
    0 0 22px rgba(255, 212, 90, 0.24);
}

.bonus-object span {
  width: 48%;
  height: 48%;
  clip-path: polygon(50% 0%, 61% 34%, 97% 34%, 68% 55%, 79% 90%, 50% 69%, 21% 90%, 32% 55%, 3% 34%, 39% 34%);
  background: rgba(255, 255, 255, 0.9);
}

.bomb-object {
  border-radius: 999px;
  background:
    radial-gradient(circle at 32% 24%, rgba(255, 255, 255, 0.28) 0 8px, transparent 9px),
    radial-gradient(circle, #34343a 0 66%, #111116 67% 100%);
  box-shadow:
    0 10px 18px rgba(0, 0, 0, 0.34),
    0 0 0 7px rgba(255, 255, 255, 0.16),
    0 0 22px rgba(230, 33, 41, 0.18);
}

.bomb-fuse {
  position: absolute;
  top: -12px;
  left: 50%;
  width: 20px;
  height: 20px;
  border-top: 5px solid #f5c46b;
  border-right: 5px solid #f5c46b;
  border-radius: 0 12px 0 0;
  transform: translateX(-20%) rotate(-24deg);
}

.bomb-face {
  width: 48%;
  height: 24%;
  background:
    radial-gradient(circle at 25% 50%, #0a0a0d 0 5px, transparent 6px),
    radial-gradient(circle at 75% 50%, #0a0a0d 0 5px, transparent 6px),
    linear-gradient(90deg, transparent 0 39%, #0a0a0d 40% 60%, transparent 61%);
}

.bonus-object.is-collected,
.bomb-object.is-collected {
  opacity: 0;
  transform: scale(1.25) !important;
  transition: 0.12s ease;
}

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

.game-avoid-the-bomb.is-hit-bomb .game-stage {
  box-shadow: inset 0 0 0 999px rgba(120, 0, 0, 0.08);
}

.game-avoid-the-bomb .game-overlay {
  background: rgba(255, 242, 225, 0.72);
  backdrop-filter: none;
}

.game-avoid-the-bomb .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;
}

.bomb-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;
}

.bomb-ready-art {
  position: relative;
  width: 156px;
  height: 104px;
  margin: 8px auto 6px;
  background: url("/assets/games/avoid-the-bomb/ready-avoid-bomb.png?v=1") center / contain no-repeat;
}

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