:root {
  color-scheme: dark;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #050505;
  color: #f8fafc;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: #050505;
}

body {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

#stage {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 35%, rgba(74, 222, 128, 0.12), transparent 35%),
    linear-gradient(135deg, #050505 0%, #121212 50%, #020617 100%);
}

.actor-video {
  position: absolute;
  top: 50%;
  left: 50%;
  width: auto;
  height: 100%;
  max-width: none;
  object-fit: contain;
  object-position: center center;
  opacity: 0;
  transform: translate(-50%, -50%);
  transition: opacity 120ms linear, filter 160ms ease;
  background: #050505;
}

.actor-video.is-visible {
  opacity: 1;
}

.actor-video.is-impact {
  filter: contrast(1.25) saturate(1.35) brightness(1.15);
}

#fxCanvas,
#flash,
#tapLayer,
.fallback {
  position: absolute;
  inset: 0;
}

#fxCanvas {
  width: 100%;
  height: 100%;
  pointer-events: none;
}

#flash {
  pointer-events: none;
  opacity: 0;
  background:
    radial-gradient(circle at var(--hit-x, 50%) var(--hit-y, 50%), rgba(255, 255, 255, 0.95), transparent 22%),
    linear-gradient(90deg, transparent 0%, rgba(125, 249, 255, 0.55) 50%, transparent 100%);
  mix-blend-mode: screen;
}

#flash.is-flashing {
  animation: flash-pop 360ms ease-out;
}

@keyframes flash-pop {
  0% {
    opacity: 0;
    transform: scale(1);
  }
  12% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: scale(1.08);
  }
}

.fallback {
  display: grid;
  place-items: center;
  padding: 28px;
  text-align: center;
  background:
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.03) 0 1px, transparent 1px 18px),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.025) 0 1px, transparent 1px 18px);
}

.fallback[hidden] {
  display: none;
}

.fallback h1 {
  margin: 0 0 10px;
  font-size: clamp(42px, 12vw, 128px);
  line-height: 0.92;
  letter-spacing: 0;
}

.fallback p {
  max-width: 520px;
  margin: 0 auto;
  color: rgba(248, 250, 252, 0.72);
  font-size: 15px;
  line-height: 1.7;
}

#tapLayer {
  z-index: 5;
  display: grid;
  place-items: end center;
  padding: 0 18px max(28px, env(safe-area-inset-bottom));
  border: 0;
  color: #fff;
  background: transparent;
  cursor: pointer;
}

#tapLayer:active #statusText {
  transform: scale(0.96);
}

#statusText {
  min-width: 92px;
  height: 44px;
  display: inline-grid;
  place-items: center;
  padding: 0 18px;
  border: 1px solid rgba(255, 255, 255, 0.42);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.42);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(12px);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  transition: transform 80ms ease, opacity 180ms ease;
}

.is-ready #statusText {
  opacity: 0.72;
}

.is-playing #statusText {
  opacity: 0;
}

@media (hover: hover) {
  #tapLayer:hover #statusText {
    opacity: 1;
  }
}
