.game-shake-to-reveal {
  --reveal-stage-art: none;
  --reveal-progress: 0;
  --reveal-progress-x: 0%;
  --reveal-door-left-x: 0%;
  --reveal-door-right-x: 0%;
  --reveal-label-opacity: 1;
  --reveal-label-y: 0px;
  --reveal-label-scale: 1;
  --reveal-seam-opacity: 0;
  --reveal-seam-scale: 1;
  --shake-intensity: 13;
  display: flex;
  flex-direction: column;
  width: 100%;
}

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

.game-shake-to-reveal .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-shake-to-reveal .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-shake-to-reveal .game-hud-label {
  color: #fff3a0;
  font-size: 9px;
  line-height: 1;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.24);
}

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

.game-shake-to-reveal .game-stage {
  min-height: 300px;
  display: grid;
  place-items: center;
  padding: 24px 14px;
  background:
    radial-gradient(circle at 50% 20%, rgba(255, 238, 150, 0.18), transparent 24%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.1), rgba(74, 9, 17, 0.2)),
    var(--reveal-stage-art) center / cover no-repeat,
    linear-gradient(160deg, #9d1018, #f5b640);
  box-shadow:
    inset 0 12px 18px rgba(255, 255, 255, 0.16),
    inset 0 -26px 32px rgba(74, 9, 17, 0.28);
}

.game-shake-to-reveal .game-stage::before,
.game-shake-to-reveal .game-stage::after {
  display: block;
  pointer-events: none;
}

.game-shake-to-reveal .game-stage::before {
  z-index: 1;
  inset: 14px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 22px;
  background:
    linear-gradient(115deg, transparent 0 18%, rgba(255, 255, 255, 0.1) 18% 19%, transparent 19% 42%, rgba(255, 212, 90, 0.14) 42% 43%, transparent 43%),
    radial-gradient(circle at 14% 16%, rgba(255, 255, 255, 0.24), transparent 10%),
    radial-gradient(circle at 88% 22%, rgba(255, 212, 90, 0.2), transparent 12%);
  filter: none;
}

.game-shake-to-reveal .game-stage::after {
  z-index: 1;
  background:
    linear-gradient(180deg, transparent, rgba(89, 8, 18, 0.14)),
    radial-gradient(ellipse at center bottom, rgba(255, 212, 90, 0.2), transparent 68%);
}

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

@supports selector(:has(*)) {
  .portal-page.is-game-focus .game-shake-to-reveal.is-countdown .game-stage,
  .portal-page.is-game-focus .game-shake-to-reveal.is-playing .game-stage,
  .portal-page.is-game-focus .game-shake-to-reveal.is-completing .game-stage {
    height: auto;
  }
}

.game-shake-to-reveal.is-playing .game-stage {
  touch-action: none;
}

.game-shake-to-reveal.is-finished .game-stage {
  min-height: 0;
  height: auto;
  padding: 0;
  background: #ffffff;
}

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

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

.reveal-card {
  position: relative;
  z-index: 2;
  width: min(330px, 100%);
  padding: 18px 16px 16px;
  border: 2px solid rgba(255, 216, 91, 0.9);
  border-radius: 20px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.12), transparent 34%),
    linear-gradient(160deg, #ef3c47 0%, #e01422 52%, #770913 100%);
  box-shadow: 0 20px 34px rgba(79, 7, 13, 0.34), inset 0 1px 0 rgba(255, 255, 255, 0.32);
}

.game-shake-to-reveal.is-playing[data-input-mode="shake_primary"] .reveal-card {
  animation: reveal-ready-shake 1260ms ease-in-out infinite;
}

.game-shake-to-reveal.is-shaking .reveal-card {
  animation: reveal-card-shake 210ms ease-out;
}

.reveal-card__glow {
  position: absolute;
  inset: 10px;
  border-radius: 17px;
  background:
    radial-gradient(circle at var(--reveal-progress-x) 42%, rgba(255, 245, 162, 0.34), transparent 24%),
    linear-gradient(115deg, transparent, rgba(255, 255, 255, 0.1) 42%, transparent 58%);
  pointer-events: none;
}

.reveal-card__copy {
  position: relative;
  z-index: 2;
  margin-bottom: 16px;
  text-align: center;
  text-transform: uppercase;
}

.reveal-card__copy span {
  display: block;
  color: rgba(255, 255, 255, 0.82);
  font-size: 12px;
  font-weight: 900;
}

.reveal-card__copy strong {
  display: block;
  margin-top: 5px;
  color: #ffd45a;
  font-size: clamp(30px, 10vw, 45px);
  line-height: 1;
  font-weight: 950;
  text-shadow: 0 4px 0 rgba(99, 0, 0, 0.24);
}

.reveal-surface {
  position: relative;
  height: 172px;
  overflow: hidden;
  border: 3px solid #ffd45a;
  border-radius: 18px;
  background: linear-gradient(180deg, #b91522, #7d0610);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.18),
    0 12px 22px rgba(64, 6, 13, 0.22),
    0 0 0 5px rgba(255, 212, 90, 0.12);
}

.reveal-prize,
.reveal-cover {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  text-align: center;
}

.reveal-prize strong {
  display: block;
  color: #ffffff;
  font-size: 34px;
  font-weight: 950;
}

.reveal-prize small {
  display: block;
  margin-top: 4px;
  color: rgba(255, 255, 255, 0.9);
  font-size: 13px;
  font-weight: 850;
}

.reveal-cover {
  overflow: hidden;
  color: #7b1117;
  font-size: 17px;
  font-weight: 950;
  letter-spacing: 0;
  pointer-events: none;
}

.reveal-door {
  position: absolute;
  top: 0;
  bottom: 0;
  z-index: 2;
  width: 53%;
  border: 0 solid rgba(255, 231, 132, 0.9);
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.16), transparent 18%, rgba(87, 0, 8, 0.24) 100%),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.13) 0 2px, transparent 2px 16px),
    linear-gradient(180deg, #ffcf55 0%, #f04248 48%, #b4111e 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.34),
    inset 0 -10px 18px rgba(77, 5, 10, 0.22),
    0 12px 22px rgba(64, 6, 13, 0.24);
  transition: transform 0.1s ease-out;
}

.reveal-door--left {
  left: 0;
  border-right-width: 2px;
  border-radius: 14px 0 0 14px;
  transform: translateX(var(--reveal-door-left-x));
}

.reveal-door--right {
  right: 0;
  border-left-width: 2px;
  border-radius: 0 14px 14px 0;
  transform: translateX(var(--reveal-door-right-x));
}

.reveal-door::before {
  content: "";
  position: absolute;
  top: 14px;
  bottom: 14px;
  width: 10px;
  border-radius: 999px;
  background: linear-gradient(180deg, #fff1a1, #f7a71f);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.54), 0 3px 8px rgba(77, 5, 10, 0.28);
}

.reveal-door--left::before {
  right: 12px;
}

.reveal-door--right::before {
  left: 12px;
}

.reveal-cover > span:not(.reveal-door) {
  position: relative;
  z-index: 3;
  display: inline-grid;
  min-width: 94px;
  min-height: 36px;
  place-items: center;
  padding: 0 14px;
  border: 2px solid rgba(255, 231, 132, 0.96);
  border-radius: 999px;
  background: linear-gradient(180deg, #fff5b8, #ffc843);
  box-shadow: 0 8px 16px rgba(77, 5, 10, 0.22);
  opacity: var(--reveal-label-opacity);
  transform: translateY(var(--reveal-label-y)) scale(var(--reveal-label-scale));
}

.game-shake-to-reveal[data-input-mode="shake_primary"] .reveal-cover > span:not(.reveal-door) {
  transform: rotate(-2deg) translateY(var(--reveal-label-y)) scale(var(--reveal-label-scale));
}

.game-shake-to-reveal[data-input-mode="swipe_fallback"] .reveal-cover > span:not(.reveal-door),
.game-shake-to-reveal[data-motion-input="silent"] .reveal-cover > span:not(.reveal-door) {
  min-width: 86px;
  font-size: 15px;
  letter-spacing: 0;
}

.reveal-cover::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: calc(50% - 8px);
  z-index: 4;
  width: 16px;
  background: linear-gradient(90deg, transparent, rgba(255, 246, 184, 0.8), transparent);
  opacity: var(--reveal-seam-opacity);
  transform: scaleY(var(--reveal-seam-scale));
}

.reveal-progress {
  height: 8px;
  margin: 13px 12px 0;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(55, 8, 16, 0.58);
}

.reveal-progress span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #fff07a, #ffd45a, #ffffff);
}

.reveal-action-hint {
  position: relative;
  z-index: 2;
  min-height: 18px;
  margin: 10px 4px 0;
  color: rgba(255, 255, 255, 0.92);
  font-size: 12px;
  line-height: 1.25;
  font-weight: 850;
  text-align: center;
  text-shadow: 0 1px 0 rgba(73, 6, 11, 0.32);
}

.game-shake-to-reveal[data-input-mode="swipe_fallback"] .reveal-action-hint,
.game-shake-to-reveal[data-motion-input="silent"] .reveal-action-hint {
  color: #fff4b4;
}

.reveal-spark {
  position: absolute;
  z-index: 4;
  width: 34px;
  height: 8px;
  border-radius: 999px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.94), #ffd45a);
  box-shadow: 0 0 12px rgba(255, 212, 90, 0.72);
  pointer-events: none;
  transform: translate(-50%, -50%) rotate(var(--spark-turn));
  animation: reveal-spark 520ms ease-out forwards;
}

.game-shake-to-reveal .game-overlay {
  background: rgba(255, 246, 230, 0.72);
  backdrop-filter: none;
}

.game-shake-to-reveal .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;
}

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

.reveal-ready-art {
  width: 92px;
  height: 58px;
  margin: 10px auto;
  border-radius: 16px;
  background: linear-gradient(135deg, #ffd45a, #ff3a2f);
  box-shadow: 0 10px 20px rgba(175, 34, 22, 0.2);
  transform: rotate(-4deg);
}

@media (max-width: 340px), (max-height: 620px) {
  .game-shake-to-reveal .game-stage {
    padding: 16px 12px;
  }

  .reveal-card {
    padding: 14px 12px 13px;
    border-radius: 18px;
  }

  .reveal-card__copy {
    margin-bottom: 12px;
  }

  .reveal-card__copy strong {
    font-size: 28px;
  }

  .reveal-surface {
    height: 140px;
    border-radius: 16px;
  }

  .reveal-prize strong {
    font-size: 28px;
  }

  .reveal-progress {
    margin-top: 10px;
  }
}

@keyframes reveal-spark {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) rotate(var(--spark-turn)) scaleX(0.45);
  }

  26% {
    opacity: 1;
  }

  100% {
    opacity: 0;
    transform: translate(-50%, -50%) rotate(var(--spark-turn)) translateX(22px) scaleX(1.2);
  }
}

@keyframes reveal-ready-shake {
  0%,
  100% {
    transform: rotate(0deg) translate3d(0, 0, 0);
  }

  28% {
    transform: rotate(-1.2deg) translate3d(-2px, 0, 0);
  }

  56% {
    transform: rotate(1deg) translate3d(2px, 0, 0);
  }
}

@keyframes reveal-card-shake {
  0% {
    transform: rotate(0deg) translate3d(0, 0, 0);
  }

  22% {
    transform: rotate(-1.7deg) translate3d(-5px, 1px, 0);
  }

  48% {
    transform: rotate(1.4deg) translate3d(5px, -1px, 0);
  }

  72% {
    transform: rotate(-0.8deg) translate3d(-3px, 0, 0);
  }

  100% {
    transform: rotate(0deg) translate3d(0, 0, 0);
  }
}
