:root {
  color-scheme: dark;
  --ink: #21172e;
  --pink: #ff9bd1;
  --lilac: #b9a6ff;
  --cream: #fff9fd;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  overflow: hidden;
  background: #21172e;
  color: var(--cream);
  cursor: none;
  font-family: "Fredoka", system-ui, sans-serif;
}

button { font: inherit; }

.stage {
  position: relative;
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-height: 100svh;
  isolation: isolate;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 48%, rgba(176, 132, 255, .3), transparent 28rem),
    radial-gradient(circle at 13% 12%, rgba(255, 144, 202, .25), transparent 25rem),
    linear-gradient(155deg, #261a36 0%, #16101f 55%, #2a1735 100%);
}

.stage::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  opacity: .24;
  background-image: radial-gradient(#eec7ff 1.2px, transparent 1.2px);
  background-size: 24px 24px;
  mask-image: linear-gradient(to bottom, black, transparent 85%);
}

.site-header { padding: clamp(1.4rem, 4vw, 3.5rem) 5vw 0; text-align: center; pointer-events: none; }
.eyebrow { margin: 0 0 .6rem; color: #f7b9df; font-family: "Space Mono", monospace; font-size: clamp(.62rem, 1.4vw, .85rem); letter-spacing: .12em; }
h1 { margin: 0; font-size: clamp(2.6rem, 7vw, 5.6rem); line-height: .92; letter-spacing: -.055em; text-shadow: 0 5px 0 rgba(55, 22, 70, .38); }
h1 span { color: var(--pink); }
.instruction { margin: 1rem auto 0; max-width: 36rem; color: #d7caec; font-size: clamp(.92rem, 2vw, 1.15rem); }

.play-area { position: relative; min-height: 0; display: grid; place-items: end center; }
.halo { position: absolute; top: 50%; left: 50%; width: min(75vw, 48rem); aspect-ratio: 1; border-radius: 50%; transform: translate(-50%, -44%); background: radial-gradient(circle, rgba(248, 198, 243, .28) 0 4%, rgba(186, 133, 255, .2) 24%, rgba(182, 120, 228, .08) 46%, transparent 68%); filter: blur(2px); }

.character {
  position: relative;
  z-index: 2;
  width: min(50vw, 29rem);
  height: min(62vh, 43rem);
  margin-top: .6rem;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: none;
  filter: drop-shadow(0 18px 16px rgba(2, 0, 7, .6));
  transform-origin: 50% 78%;
  -webkit-tap-highlight-color: transparent;
}

.character img { width: 100%; height: 100%; object-fit: contain; object-position: center bottom; user-select: none; pointer-events: none; }
.character:hover { filter: drop-shadow(0 18px 19px rgba(255, 133, 204, .34)); }
.character.bonked { animation: character-bonk .42s cubic-bezier(.25, .8, .3, 1); }

.site-footer { display: flex; align-items: center; justify-content: center; gap: 1.2rem; padding: .6rem 5vw 1.7rem; color: #d7caec; font-size: .86rem; }
.site-footer p { margin: 0; }
.creator { position: absolute; right: 5vw; bottom: 1.7rem; color: #d7caec; font-family: "Space Mono", monospace; font-size: .67rem; text-decoration: none; opacity: .62; transition: color .18s ease, opacity .18s ease; }
.creator:hover, .creator:focus-visible { color: #ffc6e4; opacity: 1; }
.counter { padding: .5rem .85rem; border: 1px solid rgba(255,255,255,.14); border-radius: 999px; background: rgba(255,255,255,.07); backdrop-filter: blur(8px); }
.counter span { color: #ffc6e4; font-family: "Space Mono", monospace; font-weight: 700; }
.mobile-bonk { display: none; padding: .6rem 1rem; border: 2px solid #5e315f; border-radius: 999px; background: var(--pink); color: #492244; font-weight: 700; box-shadow: 0 4px 0 #5e315f; }

.hammer { position: fixed; z-index: 20; top: 0; left: 0; width: 105px; pointer-events: none; transform: translate(-100vw, -100vh); transform-origin: 67% 89%; will-change: transform; transition: opacity .12s ease; }
.hammer svg { display: block; width: 100%; overflow: visible; filter: drop-shadow(0 5px 3px rgba(0,0,0,.35)); }
.hammer.swing svg { animation: hammer-swing .32s cubic-bezier(.13, .7, .24, 1); }
.hammer.is-hidden { opacity: 0; }

.hit-layer { position: absolute; inset: 0; z-index: 3; pointer-events: none; overflow: visible; }
.bonk-text { position: absolute; color: #fff4fb; font-size: clamp(2.1rem, 6vw, 4.7rem); font-weight: 700; letter-spacing: -.08em; text-shadow: 3px 3px 0 #9f4d94, 6px 6px 0 rgba(45, 18, 56, .5); animation: bonk-pop .8s ease-out forwards; }
.spark { position: absolute; width: 12px; height: 12px; border-radius: 50%; background: var(--spark); box-shadow: 0 0 12px var(--spark); animation: spark .66s cubic-bezier(.13,.74,.42,1) forwards; }

.bubble { position: absolute; z-index: -1; color: #efb5ff; opacity: .55; font-size: clamp(2rem, 4vw, 4rem); animation: float 6s ease-in-out infinite alternate; }
.bubble-one { top: 25%; left: 13%; }
.bubble-two { top: 39%; right: 13%; color: #f9b5d8; animation-delay: -2s; }
.bubble-three { bottom: 14%; left: 25%; color: #c5b5ff; animation-delay: -4s; }

@keyframes character-bonk { 0%, 100% { transform: rotate(0); } 20% { transform: translateY(10px) rotate(-2deg) scaleY(.98); } 47% { transform: translateY(-4px) rotate(2deg); } 73% { transform: translateY(2px) rotate(-1deg); } }
@keyframes hammer-swing { 0% { transform: rotate(0); } 44% { transform: rotate(58deg) scale(.92); } 100% { transform: rotate(0); } }
@keyframes bonk-pop { 0% { transform: translate(-50%, -50%) scale(.15) rotate(-12deg); opacity: 0; } 18% { opacity: 1; transform: translate(-50%, -50%) scale(1.25) rotate(5deg); } 62% { opacity: 1; } 100% { transform: translate(-50%, -105%) scale(.85) rotate(-5deg); opacity: 0; } }
@keyframes spark { to { transform: translate(var(--x), var(--y)) scale(0); opacity: 0; } }
@keyframes float { to { transform: translateY(-20px) rotate(12deg); } }

@media (max-width: 620px) {
  body, .character { cursor: auto; }
  .hammer { display: none; }
  .site-header { padding-top: 2rem; }
  .instruction { max-width: 20rem; }
  .character { width: min(90vw, 28rem); height: min(58vh, 34rem); }
  .site-footer { gap: .65rem; padding-bottom: 1.2rem; }
  .site-footer p { display: none; }
  .mobile-bonk { display: block; }
  .creator { right: 1.25rem; bottom: 1.35rem; font-size: .58rem; }
}

@media (prefers-reduced-motion: reduce) {
  .bubble { animation: none; }
  .character.bonked { animation-duration: .3s; }
  .hammer.swing svg { animation-duration: .24s; }
  .bonk-text { animation-duration: .55s; }
  .spark { animation-duration: .45s; }
}
