:root {
  --bg: #050507;
  --panel: rgba(24, 24, 31, 0.86);
  --text: #f8f8ff;
  --accent: #7dffcb;
  --shadow: 0 16px 40px rgba(0, 0, 0, 0.4);
  --font-stack: "Trebuchet MS", "Avenir Next", "Gill Sans", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}

* {
  box-sizing: border-box;
  user-select: none;
  -webkit-user-select: none;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  font-family: var(--font-stack);
  background: var(--bg);
}

body {
  color: var(--text);
  touch-action: manipulation;
  -webkit-touch-callout: none;
}

#app {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg);
  background-image:
    radial-gradient(circle at 14% 18%, rgba(255, 255, 255, 0.2) 0 1.2px, transparent 1.4px),
    radial-gradient(circle at 72% 63%, rgba(110, 185, 255, 0.2) 0 1.5px, transparent 1.7px),
    radial-gradient(circle at 36% 84%, rgba(255, 162, 220, 0.18) 0 1.1px, transparent 1.3px),
    linear-gradient(135deg, transparent 0 48%, rgba(255, 255, 255, 0.05) 50% 51%, transparent 53% 100%);
  background-size: 120px 120px, 180px 180px, 140px 140px, 220px 220px;
  background-position: 0 0, 20px 30px, 10px 60px, 0 0;
}

#stage,
#burst-layer {
  position: absolute;
  inset: 0;
}

#controls {
  position: absolute;
  top: 14px;
  right: 14px;
  display: flex;
  gap: 8px;
  z-index: 45;
}

#controls button {
  border: 0;
  border-radius: 999px;
  padding: 10px 14px;
  font-size: 0.9rem;
  font-weight: 700;
  color: #111;
  background: rgba(255, 255, 255, 0.88);
  cursor: pointer;
  box-shadow: var(--shadow);
}

.screen {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(5, 5, 7, 0.75);
  z-index: 50;
  padding: 1rem;
}

.screen.visible {
  display: flex;
}

.card {
  width: min(92vw, 560px);
  border-radius: 24px;
  background: var(--panel);
  backdrop-filter: blur(4px);
  text-align: center;
  padding: clamp(1.2rem, 2vw, 2rem);
  box-shadow: var(--shadow);
}

.card h1,
.card h2 {
  margin: 0 0 0.7rem;
  font-size: clamp(1.8rem, 4vw, 2.6rem);
}

.card p {
  margin: 0 0 1rem;
  font-size: clamp(1rem, 2vw, 1.3rem);
}

.card button {
  border: 0;
  border-radius: 14px;
  padding: 0.9rem 1.4rem;
  background: linear-gradient(145deg, #8afcd7, #56acff);
  color: #031222;
  font-weight: 800;
  font-size: clamp(1rem, 2vw, 1.3rem);
  cursor: pointer;
}

.burst {
  position: absolute;
  transform: translate(-50%, -50%) scale(0.3) rotate(0deg);
  font-weight: 900;
  line-height: 1;
  text-shadow: 0 6px 20px rgba(0, 0, 0, 0.36);
  pointer-events: none;
  opacity: 0;
  white-space: nowrap;
  will-change: transform, opacity;
  animation: popFloat 1100ms ease-out forwards;
}

.burst.symbol {
  font-size: clamp(2.5rem, 14vw, 10rem);
}

.burst.emoji {
  font-size: clamp(2.2rem, 10vw, 7rem);
}

@keyframes popFloat {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.3) rotate(var(--rot));
  }

  18% {
    opacity: 1;
    transform: translate(calc(-50% + var(--jitter-x)), calc(-50% + var(--jitter-y))) scale(1.1)
      rotate(calc(var(--rot) * 1.2));
  }

  100% {
    opacity: 0;
    transform: translate(calc(-50% + var(--float-x)), calc(-50% - var(--float-y))) scale(0.72)
      rotate(calc(var(--rot) * 1.7));
  }
}

@media (max-width: 640px) {
  #controls {
    top: 8px;
    right: 8px;
    gap: 6px;
  }

  #controls button {
    padding: 8px 12px;
    font-size: 0.8rem;
  }
}
