.pong-scene {
  --pong-cream: #f0e9d7;
  --pong-blue: #133db8;
  --pong-dark: #092672;
  --pong-power: #00b8ee;
  box-sizing: border-box;
  position: relative;
  display: grid;
  min-block-size: 100svh;
  background: var(--pong-cream);
  color: var(--pong-blue);
  overflow: clip;
  isolation: isolate;
  touch-action: pan-y pinch-zoom;
}

.pong-scene *, .pong-scene *::before, .pong-scene *::after { box-sizing: border-box; }

.pong-scene .pong-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.pong-scene .pong-inner {
  position: relative;
  inline-size: 100%;
  min-block-size: max(100svh, 34rem);
  margin-inline: auto;
  text-align: center;
}

.pong-scene .pong-heading {
  position: absolute;
  z-index: 1;
  inset: clamp(4.25rem, 9.3svh, 7rem) 0 auto;
  user-select: none;
}

.pong-scene .pong-heading p {
  margin: 0 0 0.55rem;
  font-size: clamp(0.84rem, 1.65vw, 1.5rem);
  font-weight: 800;
}

.pong-scene .pong-heading h2 {
  margin: 0;
  font-size: clamp(3.5rem, 12vw, 12rem);
  line-height: 0.88;
  font-weight: 900;
  transform: scaleX(.77);
}

.pong-scene .pong-heading h2 span { padding-inline-start: 0.06em; }

.pong-scene .pong-table {
  position: absolute;
  z-index: 2;
  top: 19.5svh;
  left: 50%;
  translate: -50% 0;
  inline-size: min(100%, 70rem);
  block-size: 82svh;
  direction: ltr;
  cursor: crosshair;
  touch-action: pan-y pinch-zoom;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.pong-scene .pong-cups { position: absolute; inset: 0; pointer-events: none; }

.pong-scene .pong-cup {
  position: absolute;
  display: block;
  transform: translate(-50%, calc(-.5 * var(--cup-mouth-height, 10px)));
  transform-origin: 50% 20%;
}

.pong-scene .pong-cup::before {
  position: absolute;
  content: '';
  inset: 87% -9% -5% 8%;
  border-radius: 50%;
  background: radial-gradient(ellipse at 51% 42%, #30292269, #50453538 45%, transparent 72%);
  transform: rotate(-9deg);
  filter: blur(.28rem);
}

.pong-scene .pong-cup-art {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.pong-scene .pong-cup-mouth {
  position: absolute;
  inset: 0 0 auto;
  height: var(--cup-mouth-height, 10px);
}

.pong-scene .pong-cup:not(.has-cup-art)::after {
  content: '';
  position: absolute;
  inset: calc(.47 * var(--cup-mouth-height, 10px)) 0 0;
  clip-path: polygon(0 0, 100% 0, 78% 92%, 67% 98%, 50% 100%, 33% 98%, 22% 92%);
  background: linear-gradient(90deg, #14273b45, #fff4 30%, #1b2b433b 85%), var(--cup-color);
}

.pong-scene .pong-cup:not(.has-cup-art) .pong-cup-mouth {
  z-index: 1;
  border: clamp(2px, .3vw, 4px) solid #e2e7df;
  border-radius: 50%;
  background: radial-gradient(ellipse at 50% 103%, #cfd5cc, #a6aea5 89%);
}

.pong-scene .pong-table[data-pong-state='won'] .pong-cup-hit {
  filter: saturate(1.35) brightness(1.24);
  animation: pong-target-hit 570ms cubic-bezier(.2,.73,.32,1);
}

@keyframes pong-target-hit {
  0%, 100% { transform: translate(-50%, calc(-.5 * var(--cup-mouth-height))); }
  42% { transform: translate(-50%, calc(-.7 * var(--cup-mouth-height))) scale(1.10) rotate(-7deg); }
}

.pong-scene .pong-side {
  position: absolute;
  font-size: clamp(2.5rem, 7vw, 7.2rem);
  line-height: 1;
  transform: rotate(-18deg);
  font-weight: 400;
}

.pong-scene .pong-side-left { left: 5%; top: -12%; }
.pong-scene .pong-side-right { right: 8%; top: 19%; }

.pong-scene .pong-sight {
  --charge: 0;
  position: absolute;
  z-index: 14;
  translate: -50% -100%;
  transform-origin: 50% 100%;
  clip-path: polygon(50% 0, 100% 36%, 78% 36%, 80% 100%, 20% 100%, 22% 36%, 0 36%);
  background: linear-gradient(0deg, var(--pong-power) calc(var(--charge) * 100%), var(--pong-blue) 0);
  transition: rotate 100ms ease-out;
  pointer-events: none;
}

.pong-scene .pong-ball {
  position: absolute;
  z-index: 16;
  display: block;
  aspect-ratio: 1;
  border-radius: 50%;
  background:
    radial-gradient(ellipse 35% 37% at 24% 19%, #fffdfb 0%, #fffbefd9 32%, #ffffee00 89%),
    radial-gradient(ellipse 27% 29% at 86% 79%, #aeccdc90 0%, #a6bdc600 100%),
    radial-gradient(circle at 39% 35%, #fff2d3 0%, #f7e8cb 38%, #c2b19a 74%, #877c6c 100%);
  box-shadow: inset 0 0 1px #71685765;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.pong-scene .pong-ball-shadow {
  position: absolute;
  z-index: 1;
  aspect-ratio: 4 / 1;
  border-radius: 50%;
  translate: -50% -50%;
  background: radial-gradient(ellipse at center, #332f2659, transparent 72%);
  filter: blur(5px);
  pointer-events: none;
}

.pong-scene .pong-table:not([data-pong-state='flying']) :is(.pong-ball, .pong-ball-shadow) { visibility: hidden; }
.pong-scene .pong-table[data-pong-state='won'] .pong-sight { opacity: 0; }

.pong-scene .pong-console {
  position: absolute;
  z-index: 3;
  inset: 0 max(1.05rem, 4vw) 1.5svh;
  display: grid;
  align-content: end;
  justify-items: center;
  margin: 0;
  pointer-events: none;
}

.pong-scene .pong-console p {
  margin: 0.55rem 0 0;
  font-size: clamp(0.82rem, 1.26vw, 1rem);
  line-height: 1.45;
}

.pong-scene .pong-actions {
  display: grid;
  justify-items: center;
  margin-top: .45rem;
}

.pong-scene .pong-throw, .pong-scene .pong-skip {
  min-block-size: 2.8rem;
  border: 2px solid var(--pong-blue);
  border-radius: 999px;
  padding: 0.39rem 1.25rem;
  font: inherit;
  font-size: clamp(0.82rem, 1.23vw, 1rem);
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
  pointer-events: auto;
  transition: transform 150ms ease, background-color 150ms ease, color 150ms ease;
}

.pong-scene .pong-throw {
  border-color: transparent;
  background: transparent;
  color: var(--pong-blue);
  touch-action: pan-y pinch-zoom;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.pong-scene:not([data-pong-prompt='ready']) .pong-throw {
  position: absolute;
  top: 50svh;
  left: 50%;
  translate: calc(-50% + var(--pong-prompt-x, 0px)) calc(-50% + var(--pong-prompt-y, 0px));
  inline-size: max-content;
  border-width: 0;
  padding: 0;
}

.pong-scene:not([data-pong-prompt='ready']) .pong-throw:focus-visible { translate: -50% -50%; }

.pong-scene .pong-throw-disc {
  display: inline-flex;
  align-items: center;
  gap: .65rem;
  min-block-size: 52px;
  padding-inline: 1rem 1.35rem;
  border-radius: 999px;
  background: var(--pong-dark);
  color: var(--pong-cream);
  scale: 1;
  transition: scale var(--pong-prompt-retire, 500ms) cubic-bezier(.645, .045, .355, 1);
  pointer-events: none;
}
.pong-scene .pong-throw-disc i {
  inline-size: 14px;
  block-size: 14px;
  border: 3px solid var(--lime);
  border-radius: 50%;
}

.pong-scene[data-pong-prompt='retiring'] .pong-throw-disc { scale: 0; }
.pong-scene[data-pong-prompt='ready'] .pong-throw-disc,
.pong-scene:not([data-pong-prompt='ready']) .pong-throw-label { display: none; }

.pong-scene[data-pong-prompt='ready'] .pong-throw-label {
  animation: pong-prompt-label-in 2s cubic-bezier(.645, .045, .355, 1) calc(-1 * var(--pong-prompt-retire, 500ms)) both;
}

@keyframes pong-prompt-label-in { from { opacity: 0; } }

.pong-scene[data-pong-prompt='ready'] .pong-throw:focus-visible .pong-throw-label { animation: none; }
.pong-scene .pong-throw[aria-disabled='true'] { cursor: wait; }
.pong-scene .pong-skip { position: relative; z-index: 1; border-color: transparent; background: #202522; color: #fff1d4; }
.pong-scene .pong-skip span { margin-inline-start: 0.25em; }
.pong-scene .pong-skip:hover, .pong-scene[data-pong-prompt='ready'] .pong-throw:hover {
  text-decoration: underline;
  text-underline-offset: .25em;
}
.pong-scene button:focus-visible { outline: 2px solid var(--pong-dark); outline-offset: 3px; }
.pong-scene .pong-console .pong-result { min-block-size: 1.6em; font-weight: 700; }
.pong-scene .pong-console .pong-result:empty { min-block-size: 0; margin: 0; }

@media (min-width: 57rem) {
  .pong-scene[data-pong-prompt='ready'] .pong-actions { padding-block-end: .65rem; }
  .pong-scene .pong-skip { position: absolute; inset-inline-start: 0; inset-block-end: .15rem; }
}

@media (max-width: 39rem) {
  .pong-scene .pong-heading { inset-block-start: calc(var(--nav, 3.5rem) + 1.5svh); }
  .pong-scene .pong-heading h2 {
    inline-size: min(88vw, 34rem);
    margin-inline: auto;
    font-size: clamp(3.7rem, 21.8vw, 6.5rem);
    transform: scale(.9, 1.22);
    transform-origin: top center;
  }
  .pong-scene .pong-table { top: 21svh; inline-size: 250vw; block-size: 75.5svh; }
  .pong-scene .pong-side-left { left: calc(50% - 37vw); top: -18%; }
  .pong-scene .pong-side-right { right: calc(50% - 42vw); top: -21%; font-size: 1.65rem; }
  .pong-scene .pong-console p { max-inline-size: 29rem; }
  .pong-scene .pong-actions { margin-top: .25rem; }
}

@media (max-width: 39rem) and (max-height: 650px) {
  .pong-scene .pong-heading h2 { inline-size: 64vw; font-size: min(21vw, 9.7svh); }
  .pong-scene .pong-table { top: 25svh; block-size: 61svh; }
}

@media (max-width: 360px) {
  .pong-scene .pong-console { inset-inline: .65rem; }
  .pong-scene .pong-skip { padding-inline: .9rem; background: var(--pong-blue); color: #fff1d4; }
}

@media (prefers-reduced-motion: reduce) {
  .pong-scene *, .pong-scene *::before, .pong-scene *::after { animation: none !important; transition: none !important; }
}
