:root {
  color-scheme: light;
  --ink: #174047;
  --white: #fffdf8;
  --rose: #ff6b8a;
  --sun: #ffd15c;
  --mint: #58d6a8;
  --sky: #4fb7ff;
  --grape: #9b7bff;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: none;
  background: #fff4d6;
  color: var(--ink);
  font-family:
    ui-rounded, "Hiragino Maru Gothic ProN", "Hiragino Sans", system-ui,
    sans-serif;
}

button {
  font: inherit;
}

.stage {
  position: relative;
  width: 100vw;
  height: 100dvh;
  min-height: 420px;
  overflow: hidden;
  background:
    radial-gradient(circle at 12% 18%, rgba(255, 255, 255, 0.92) 0 12%, transparent 13%),
    radial-gradient(circle at 86% 12%, rgba(255, 255, 255, 0.76) 0 9%, transparent 10%),
    linear-gradient(135deg, #fff1ad 0%, #ffd0db 34%, #b9edff 68%, #cff8c8 100%);
}

#partyCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.soft-glow {
  position: absolute;
  inset: auto -10vw -22vh -10vw;
  height: 42vh;
  background: radial-gradient(ellipse at center, rgba(255, 255, 255, 0.82), transparent 67%);
  pointer-events: none;
}

.hud {
  position: absolute;
  top: max(14px, env(safe-area-inset-top));
  left: max(14px, env(safe-area-inset-left));
  right: max(14px, env(safe-area-inset-right));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  pointer-events: none;
}

h1 {
  margin: 0;
  color: rgba(23, 64, 71, 0.82);
  font-size: clamp(1.2rem, 3vw, 2rem);
  line-height: 1.05;
  letter-spacing: 0;
  text-shadow: 0 2px 0 rgba(255, 255, 255, 0.72);
}

.toolbar {
  display: flex;
  gap: 8px;
  pointer-events: auto;
}

.toolbar button {
  display: grid;
  place-items: center;
  width: clamp(44px, 11vw, 58px);
  height: clamp(44px, 11vw, 58px);
  border: 3px solid rgba(255, 255, 255, 0.88);
  border-radius: 999px;
  background: rgba(255, 253, 248, 0.62);
  color: var(--ink);
  box-shadow: 0 8px 20px rgba(37, 82, 85, 0.16);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.toolbar button:active {
  transform: scale(0.94);
}

.toolbar span {
  display: block;
  font-size: clamp(1.3rem, 5vw, 2rem);
  font-weight: 800;
  line-height: 1;
}

.spark-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.pop-word {
  position: absolute;
  min-width: 68px;
  transform: translate(-50%, -50%);
  color: rgba(23, 64, 71, 0.8);
  font-size: clamp(1.7rem, 7vw, 4.2rem);
  font-weight: 900;
  line-height: 1;
  letter-spacing: 0;
  text-align: center;
  text-shadow:
    0 4px 0 rgba(255, 255, 255, 0.68),
    0 12px 30px rgba(57, 79, 82, 0.18);
  animation: word-pop 1.25s ease-out forwards;
}

@keyframes word-pop {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.55) rotate(-8deg);
  }
  18% {
    opacity: 1;
    transform: translate(-50%, -55%) scale(1.06) rotate(4deg);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -105%) scale(0.92) rotate(10deg);
  }
}

@media (max-width: 560px) {
  .hud {
    align-items: flex-start;
    gap: 8px;
  }

  h1 {
    max-width: 9.5rem;
    font-size: 1.05rem;
  }

  .toolbar {
    gap: 6px;
  }

  .toolbar button {
    width: 38px;
    height: 38px;
    border-width: 2px;
  }

  .toolbar span {
    font-size: 1.3rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .pop-word {
    animation-duration: 0.8s;
  }
}
