.video-demo-card {
  display: grid;
  gap: 14px;
}

.video-demo-card .game-info-title {
  margin: 0;
}

.video-demo {
  display: grid;
  gap: 12px;
}

.video-demo__stage {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  border-radius: 16px;
  background: rgba(229, 240, 245, .72);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .8);
}

.video-demo__poster,
.video-demo__video {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  object-position: center;
  border: 0;
}

.video-demo__video[hidden],
.video-demo__poster[hidden] {
  display: none;
}

.video-demo__button {
  width: 100%;
  min-width: 0;
}

.has-game-demo-overlay {
  position: relative !important;
}

.game-demo-overlay {
  position: absolute;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 18px;
  overflow: hidden;
  border-radius: inherit;
  background: rgba(232, 243, 248, .97);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.game-demo-overlay .video-demo__video {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 14px;
  background: transparent;
}

.game-demo-overlay__close {
  position: absolute;
  top: 18px;
  right: 18px;
  z-index: 2147483647;
  min-width: 190px;
  height: 48px;
  padding: 0 24px;
  border: 1px solid rgba(255, 255, 255, .72);
  border-radius: 16px;
  background: rgba(30, 45, 54, .76);
  color: #fff;
  font: 750 15px/1 inherit;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(0, 0, 0, .18);
  pointer-events: auto;
}

.article-video-demo {
  margin: 18px 0 28px;
  padding: 14px;
  border-radius: 20px;
  background: rgba(224, 239, 245, .52);
  border: 1px solid rgba(255, 255, 255, .58);
}

.article-video-demo .video-demo__stage {
  aspect-ratio: auto;
  max-height: 430px;
}

.article-video-demo .video-demo__poster,
.article-video-demo .video-demo__video {
  height: auto;
  max-height: 430px;
}

.article-video-demo .start-button {
  display: block;
  margin-inline: auto;
}

@media (prefers-reduced-motion: reduce) {
  .video-demo__button { transition: none; }
}

/* Mobile info is portaled to body to avoid transformed/blurred ancestor clipping. */
@media (max-width: 620px) {
  body.mobile-info-open > :is(#numbersGameInfo,#colorsGameInfo,#dualTaskGameInfo) {
    position: fixed; inset: 0; z-index: 2147482000;
    display: flex; flex-direction: column; align-items: stretch;
    width: 100%; max-width: none; height: 100%; height: 100dvh;
    min-height: 0; margin: 0; box-sizing: border-box;
    padding: max(10px,env(safe-area-inset-top)) 12px max(18px,env(safe-area-inset-bottom));
    gap: 12px; overflow-x: hidden; overflow-y: auto;
    border-radius: 0; background: rgba(239,248,251,.98);
    transform: none; visibility: visible;
    -webkit-overflow-scrolling: touch;
  }
  body.mobile-info-open > :is(#numbersGameInfo,#colorsGameInfo,#dualTaskGameInfo) > .mobile-info-close {
    position: sticky; top: 0; right: auto; z-index: 10;
    display: inline-flex; align-self: flex-end; flex: 0 0 44px;
    width: 44px; min-width: 44px; height: 44px; margin: 0;
    align-items: center; justify-content: center;
    border: 1px solid rgba(37,71,83,.22); border-radius: 50%;
    background: #f4fafc; color: #111; box-shadow: 0 3px 12px #294a5824;
    touch-action: manipulation;
  }
  body.has-game-demo-overlay > .game-demo-overlay.game-demo-overlay--mobile {
    position: fixed; inset: 0; z-index: 2147483000;
    display: grid; grid-template-rows: 48px minmax(0,1fr);
    align-items: stretch; justify-items: stretch; gap: 10px;
    width: 100%; max-width: none; height: 100%; height: 100dvh;
    max-height: none; min-height: 0; margin: 0; box-sizing: border-box;
    padding: max(10px,env(safe-area-inset-top)) max(12px,env(safe-area-inset-right)) max(12px,env(safe-area-inset-bottom)) max(12px,env(safe-area-inset-left));
    border: 0; border-radius: 0; overflow: hidden;
    background: #e8f3f8; isolation: isolate;
  }
  .game-demo-overlay--mobile::backdrop { background: rgba(24,47,56,.45); }
  body.has-game-demo-overlay > .game-demo-overlay.game-demo-overlay--mobile > .game-demo-overlay__close {
    position: relative; inset: auto; grid-row: 1; justify-self: end;
    z-index: 2; width: 48px; min-width: 48px; height: 48px;
    margin: 0; padding: 0; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    background: #fff; color: #111; -webkit-text-fill-color: #111;
    border: 1px solid #9eb9c3; font-size: 30px; line-height: 1;
    pointer-events: auto; touch-action: manipulation;
  }
  body.has-game-demo-overlay > .game-demo-overlay.game-demo-overlay--mobile > .video-demo__video {
    position: relative; grid-row: 2; z-index: 0;
    width: 100%; height: 100%; min-height: 0; max-height: 100%;
    margin: 0; object-fit: contain;
  }
}
