/* Shared, offline depth treatment. The game engines still own their boards and rules. */
.pg-depth-card {
  --pg-card-depth-shadow: 0 0.5rem 1.6rem rgb(5 13 31 / 0.18);
  position: relative;
  isolation: isolate;
  box-shadow: var(--pg-card-depth-shadow);
}

.pg-depth-card::after {
  display: none;
}

.pg-depth-card .game-card {
  position: relative;
  isolation: isolate;
}

.pg-depth-card .game-card:hover,
.pg-depth-card .game-card:focus-visible {
  transform: translateY(-2px);
}

.pg-depth-card .game-art--depth-aware,
.pg-depth-card .game-art--native-webgl {
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.16), inset 0 -1.2rem 2rem rgb(3 8 25 / 0.16);
}

.pg-depth-card .game-art--native-webgl {
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.18), 0 0 1.2rem color-mix(in srgb, var(--accent, #8af0cb) 20%, transparent), inset 0 -1.2rem 2rem rgb(3 8 25 / 0.2);
}

#game-player #game-stage.pg-3d-skin {
  --pg-depth-accent: var(--play-accent, #8af0cb);
  --pg-depth-accent-2: var(--play-violet, #a89bff);
  --pg-depth-intensity: 1;
  position: relative;
  isolation: isolate;
  perspective: var(--pg-depth-perspective, 1100px);
  transform-style: preserve-3d;
  touch-action: manipulation;
}

#game-player #game-stage.pg-3d-skin::before,
#game-player #game-stage.pg-3d-skin::after,
#game-player #game-stage.pg-3d-skin > .pg-3d-skin__light,
#game-player #game-stage.pg-3d-skin > .pg-3d-skin__depth {
  position: absolute;
  pointer-events: none;
  content: "";
}

#game-player #game-stage.pg-3d-skin::before {
  z-index: 0;
  inset: 0;
  background: radial-gradient(ellipse 70% 55% at 50% 0%, color-mix(in srgb, var(--pg-depth-accent) 16%, transparent), transparent 72%);
}

#game-player #game-stage.pg-3d-skin::after {
  z-index: 0;
  inset: 0;
  background: linear-gradient(120deg, transparent 28%, color-mix(in srgb, var(--pg-depth-accent-2) 8%, transparent) 50%, transparent 72%);
  opacity: calc(0.5 * var(--pg-depth-intensity));
}

#game-player #game-stage.pg-3d-skin > .pg-depth-root {
  position: relative;
  z-index: 2;
  transform-style: preserve-3d;
}

#game-player #game-stage.pg-3d-skin > .pg-3d-skin__light {
  z-index: 1;
  inset: 0;
  background: radial-gradient(ellipse at 50% 0%, color-mix(in srgb, var(--pg-depth-accent) 32%, transparent), transparent 64%);
  opacity: calc(0.42 * var(--pg-depth-intensity));
  transform: translate3d(var(--pg-depth-tilt-y, 0deg), var(--pg-depth-tilt-x, 0deg), 0);
  animation: pg-depth-breathe 8s ease-in-out infinite;
}

#game-player #game-stage.pg-3d-skin > .pg-3d-skin__depth {
  z-index: 1;
  inset: 0;
  background: repeating-linear-gradient(115deg, transparent 0 4.5rem, color-mix(in srgb, var(--pg-depth-accent-2) 7%, transparent) 4.55rem 4.62rem, transparent 4.7rem 9rem);
  opacity: calc(0.38 * var(--pg-depth-intensity));
  mix-blend-mode: screen;
}

#game-player #game-stage.pg-3d-skin > .pg-3d-skin__status {
  position: absolute;
  z-index: 4;
  right: 0.75rem;
  bottom: 0.75rem;
  display: inline-flex;
  align-items: center;
  max-width: min(18rem, calc(100% - 1.5rem));
  min-height: 1.75rem;
  padding: 0.32rem 0.6rem;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--pg-depth-accent) 50%, var(--play-line, #32435e));
  border-radius: 999px;
  color: var(--play-text, #f3f7ff);
  background: color-mix(in srgb, var(--play-surface, #121d32) 86%, transparent);
  box-shadow: 0 0.45rem 1.3rem rgb(0 3 15 / 0.24), 0 0 1rem color-mix(in srgb, var(--pg-depth-accent) 16%, transparent);
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  line-height: 1.2;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
  pointer-events: none;
}

#game-player #game-stage.pg-3d-skin > .pg-3d-skin__status::before {
  flex: 0 0 auto;
  width: 0.38rem;
  height: 0.38rem;
  margin-right: 0.42rem;
  content: "";
  border-radius: 50%;
  background: var(--pg-depth-accent);
  box-shadow: 0 0 0 0.24rem color-mix(in srgb, var(--pg-depth-accent) 16%, transparent), 0 0 0.65rem var(--pg-depth-accent);
}

#game-player #game-stage.pg-3d-skin[data-depth-engine="native-webgl"] > .pg-3d-skin__status::after {
  margin-left: 0.45rem;
  content: "NATIVE WEBGL";
  color: var(--pg-depth-accent);
  font-size: 0.48rem;
}

#game-player #game-stage.pg-3d-skin[data-depth-engine="shared-depth-skin"] > .pg-3d-skin__status::after {
  margin-left: 0.45rem;
  content: "DEPTH SKIN";
  color: var(--pg-depth-accent);
  font-size: 0.48rem;
}

#game-player #game-stage.pg-3d-skin .pg-depth-scene {
  position: relative;
  z-index: 2;
  transform-style: preserve-3d;
  box-shadow: 0 0.9rem 2.1rem rgb(0 3 15 / 0.2), 0 0 0 1px color-mix(in srgb, var(--pg-depth-accent) 18%, transparent);
}

#game-player #game-stage.pg-3d-skin .pg-depth-scene canvas {
  filter: drop-shadow(0 0.45rem 0.9rem color-mix(in srgb, var(--pg-depth-accent) 14%, transparent));
}

#game-player #game-stage.pg-3d-skin[data-depth-state="won"] > .pg-3d-skin__status,
#game-player #game-stage.pg-3d-skin[data-depth-state="won"] > .pg-3d-skin__status::before {
  border-color: #8af0cb;
  background-color: color-mix(in srgb, #8af0cb 13%, var(--play-surface, #121d32));
}

#game-player #game-stage.pg-3d-skin[data-depth-state="lost"] > .pg-3d-skin__status,
#game-player #game-stage.pg-3d-skin[data-depth-state="lost"] > .pg-3d-skin__status::before {
  border-color: #ff9e91;
  background-color: color-mix(in srgb, #ff9e91 13%, var(--play-surface, #121d32));
}

@keyframes pg-depth-breathe {
  0%, 100% { opacity: calc(0.32 * var(--pg-depth-intensity)); }
  50% { opacity: calc(0.52 * var(--pg-depth-intensity)); }
}

@media (max-width: 640px) {
  .pg-depth-card {
    perspective: 720px;
  }

  .pg-depth-card .game-card:hover,
  .pg-depth-card .game-card:focus-visible {
    transform: translate3d(0, -2px, 0);
  }

  #game-player #game-stage.pg-3d-skin {
    --pg-depth-perspective: 720px;
  }

  #game-player #game-stage.pg-3d-skin > .pg-3d-skin__status {
    right: 0.45rem;
    bottom: 0.45rem;
    max-width: calc(100% - 0.9rem);
    font-size: 0.52rem;
  }
}

@media (max-height: 560px) and (orientation: landscape) {
  #game-player #game-stage.pg-3d-skin > .pg-3d-skin__status {
    bottom: 0.4rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .pg-depth-card,
  .pg-depth-card .game-card,
  .pg-depth-card .game-card:hover,
  .pg-depth-card .game-card:focus-visible,
  #game-player #game-stage.pg-3d-skin > .pg-3d-skin__light {
    transition: none !important;
    animation: none !important;
    transform: none !important;
  }

  #game-player #game-stage.pg-3d-skin .pg-depth-scene {
    transition: none !important;
  }
}
