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

* { box-sizing: border-box; }

html, body { margin: 0; min-height: 100%; }

body { background: #073d30; }

button { font: inherit; }

.scene {
  position: relative;
  display: grid;
  min-height: 100svh;
  place-items: center;
  overflow: hidden;
  isolation: isolate;
  touch-action: none;
  background: radial-gradient(circle at 50% 42%, #238765 0, #136249 35%, #0a4738 66%, #052f2b 100%);
}

.scene::before {
  position: absolute;
  z-index: -1;
  inset: 0;
  content: "";
  opacity: .36;
  background-image:
    linear-gradient(#c4f1c322 1px, transparent 1px),
    linear-gradient(90deg, #c4f1c322 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(circle at center, #000 12%, transparent 78%);
}

.scene::after {
  position: absolute;
  z-index: -1;
  inset: -25%;
  content: "";
  opacity: .65;
  background:
    radial-gradient(circle at 22% 28%, #8ad48b52, transparent 24%),
    radial-gradient(circle at 82% 76%, #83e3ba35, transparent 30%);
  filter: blur(52px);
}

.brand {
  position: absolute;
  z-index: 5;
  top: clamp(24px, 4vw, 48px);
  left: clamp(24px, 4vw, 52px);
  color: #e9f9dd;
  font-size: clamp(18px, 2vw, 23px);
  font-weight: 750;
  letter-spacing: -.06em;
  line-height: 1;
}

.hero {
  position: relative;
  display: grid;
  width: min(92vw, 850px);
  min-height: min(84svh, 770px);
  place-items: center;
  pointer-events: none;
}

.halo {
  width: min(68vw, 620px);
  aspect-ratio: 1;
  border: 1px solid #e8ffcb70;
  border-radius: 50%;
  background: radial-gradient(circle at 34% 26%, #b9ef9f 0, #86d798 43%, #50af7b 100%);
  box-shadow: inset 0 0 85px #e8ffb944, 0 38px 110px #00281d91;
}

.halo::after {
  display: block;
  margin: 5.5%;
  width: 89%;
  aspect-ratio: 1;
  content: "";
  border: 1px solid #f3ffe467;
  border-radius: 50%;
}

.spark {
  position: absolute;
  width: 12px;
  aspect-ratio: 1;
  border-radius: 3px;
  background: #d6fba7;
  transform: rotate(45deg);
  box-shadow: 0 0 20px #d6fba7a0;
}

.spark.one { top: 23%; left: 12%; }
.spark.two { top: 30%; right: 10%; width: 8px; }
.spark.three { bottom: 20%; right: 17%; width: 6px; }

.rope {
  position: absolute;
  z-index: 1;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
  transition: opacity .65s ease;
}

.rope-shadow { stroke: #24452e; stroke-width: 8; stroke-linecap: round; }
.rope-thread { stroke: #e9d9a1; stroke-width: 4; stroke-linecap: round; }

.pinata {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 2;
  display: block;
  width: var(--pinata-size, 600px);
  height: var(--pinata-size, 600px);
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  transform-origin: 46% 45%;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  touch-action: none;
  will-change: transform;
}

.pinata[hidden], .restart[hidden], .instruction[hidden] { display: none; }

.pinata:focus-visible { outline: none; }

.pinata:focus-visible .pinata-art {
  filter: drop-shadow(0 0 12px #e9f9dd) drop-shadow(0 24px 24px #073a2c66);
}

.pinata-art {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 24px 24px #073a2c66);
  transition: filter .12s ease;
}

.pinata.is-hit .pinata-art { filter: brightness(1.18) drop-shadow(0 24px 24px #073a2c66); }

.pinata-art img {
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.pinata.is-breaking .pinata-art { animation: break-apart .5s ease-in forwards; }
.scene.is-gone .rope { opacity: 0; }

.piece {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 4;
  display: block;
  pointer-events: none;
  border-radius: 1px;
  box-shadow: 0 1px 2px #072b2333;
  will-change: transform, opacity;
}

.instruction, .restart {
  position: absolute;
  z-index: 5;
  bottom: clamp(24px, 4vw, 42px);
  margin: 0;
}

.instruction {
  color: #dcf1ce;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .11em;
  text-transform: uppercase;
}

.restart {
  padding: 11px 22px;
  border: 1px solid #e3f9c7a8;
  border-radius: 999px;
  color: #edffe0;
  background: #e9f9dd1c;
  cursor: pointer;
  font-size: 14px;
  font-weight: 650;
  transition: background .2s ease, transform .2s ease;
}

.restart:hover { background: #e9f9dd34; transform: translateY(-2px); }
.restart:focus-visible { outline: 2px solid #e9f9dd; outline-offset: 3px; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@keyframes break-apart {
  0% { opacity: 1; transform: scale(1) rotate(0); }
  35% { opacity: 1; transform: scale(1.05) rotate(-5deg); }
  100% { opacity: 0; transform: scale(.62) rotate(18deg); }
}

@media (max-width: 600px) {
  .hero { min-height: 74svh; }
  .halo { width: 82vw; }
  .spark.one { left: 6%; }
  .spark.two { right: 5%; }
}

@media (prefers-reduced-motion: reduce) {
  .pinata.is-breaking .pinata-art { animation-duration: .15s; }
  .piece { display: none; }
}
