:root {
  --font-stack: "Trebuchet MS", "Segoe UI", system-ui, -apple-system, sans-serif;
  --heart: #ff5c8a;
  --heart-soft: #ffb6cd;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  height: 100%;
  overflow: hidden;
  font-family: var(--font-stack);
  background: linear-gradient(160deg, var(--bg1, #ffd9e8), var(--bg2, #e8d9ff));
  transition: background 1.2s ease;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
  overscroll-behavior: none;
}

body.scene-title  { --bg1: #ffd6ea; --bg2: #e6d8ff; }
body.scene-rabbits{ --bg1: #ffe0ec; --bg2: #ffd0dc; }
body.scene-bears  { --bg1: #ffe8d4; --bg2: #ffd6c0; }
body.scene-msg1   { --bg1: #ffd8ee; --bg2: #d4e4ff; }
body.scene-msg2   { --bg1: #ffe8b0; --bg2: #ffd0e4; }
body.scene-finale { --bg1: #d4ecff; --bg2: #ffd9ee; }

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.055;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='84' height='84' viewBox='0 0 24 24'%3E%3Cpath fill='%23ff7fa8' d='M12 21s-8-5.5-8-11a4.5 4.5 0 0 1 8-2.8A4.5 4.5 0 0 1 20 10c0 5.5-8 11-8 11z'/%3E%3C/svg%3E");
  background-size: 84px 84px;
}

#fx {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}

#stage {
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}

.scene {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.9s ease, visibility 0.9s;
}

.scene.is-active {
  opacity: 1;
  visibility: visible;
}

/* ---------- title ---------- */

.yata {
  font-size: clamp(72px, 24vw, 200px);
  font-weight: 900;
  letter-spacing: -0.02em;
  line-height: 1;
  color: #ff5c8a;
  text-shadow:
    0 4px 0 rgba(255, 255, 255, 0.85),
    0 10px 24px rgba(255, 92, 138, 0.4);
  animation: yata-bounce 2.4s ease-in-out infinite;
  transform-origin: center bottom;
}

.yata span {
  display: inline-block;
  animation: letter-float 2.8s ease-in-out infinite;
}
.yata .y  { animation-delay: 0s;   color: #ff5c8a; }
.yata .a1 { animation-delay: 0.15s; color: #ff7fa8; }
.yata .t  { animation-delay: 0.3s;  color: #c084fc; }
.yata .a2 { animation-delay: 0.45s; color: #60a5fa; }

@keyframes yata-bounce {
  0%, 100% { transform: translateY(0) scale(1); }
  50%      { transform: translateY(-14px) scale(1.03); }
}

@keyframes letter-float {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50%      { transform: translateY(-8px) rotate(2deg); }
}

.hint-wrap {
  margin-top: clamp(24px, 6vh, 56px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  animation: hint-pulse 1.6s ease-in-out infinite;
}

#hint-heart {
  width: 56px;
  height: 56px;
}

.hint {
  font-size: clamp(16px, 4.5vw, 22px);
  font-weight: 700;
  color: #d4577e;
  letter-spacing: 0.18em;
  text-transform: lowercase;
}

@keyframes hint-pulse {
  0%, 100% { transform: scale(1); opacity: 0.9; }
  50%      { transform: scale(1.12); opacity: 1; }
}

/* ---------- messages ---------- */

.scene-message {
  gap: clamp(28px, 7vh, 64px);
}

.msg {
  font-size: clamp(28px, 7.5vw, 64px);
  font-weight: 900;
  line-height: 1.25;
  color: #d43f74;
  text-shadow:
    0 3px 0 rgba(255, 255, 255, 0.75),
    0 10px 26px rgba(255, 92, 138, 0.35);
  max-width: 14ch;
  letter-spacing: 0.01em;
}

.msg-final {
  color: #e07020;
  text-shadow:
    0 3px 0 rgba(255, 255, 255, 0.85),
    0 0 22px rgba(255, 196, 64, 0.55),
    0 14px 30px rgba(224, 112, 32, 0.35);
  animation: final-glow 2.2s ease-in-out infinite;
}

@keyframes final-glow {
  0%, 100% { filter: drop-shadow(0 0 10px rgba(255, 196, 64, 0.35)); }
  50%      { filter: drop-shadow(0 0 28px rgba(255, 196, 64, 0.75)); }
}

.msg-love {
  color: #e0447c;
  text-shadow:
    0 3px 0 rgba(255, 255, 255, 0.9),
    0 0 22px rgba(255, 150, 190, 0.5),
    0 14px 30px rgba(224, 68, 124, 0.35);
  animation: love-glow 2.4s ease-in-out infinite;
}

@keyframes love-glow {
  0%, 100% { filter: drop-shadow(0 0 10px rgba(255, 160, 200, 0.4)); }
  50%      { filter: drop-shadow(0 0 26px rgba(255, 160, 200, 0.85)); }
}

.msg .word {
  display: inline-block;
  white-space: nowrap;
}

.msg .letter {
  display: inline-block;
  opacity: 0;
  transform: translateY(28px) scale(0.4);
  animation: letter-pop 0.55s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.msg .letter.space {
  width: 0.35em;
}

@keyframes letter-pop {
  0%   { opacity: 0; transform: translateY(28px) scale(0.4) rotate(-8deg); }
  60%  { opacity: 1; transform: translateY(-6px) scale(1.15) rotate(3deg); }
  100% { opacity: 1; transform: translateY(0) scale(1) rotate(0deg); }
}

.restart {
  pointer-events: auto;
  cursor: pointer;
  border: none;
  background: rgba(255, 255, 255, 0.7);
  color: #d4577e;
  font-family: inherit;
  font-size: clamp(15px, 4vw, 18px);
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 12px 28px;
  border-radius: 999px;
  box-shadow: 0 6px 18px rgba(212, 87, 126, 0.25);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  opacity: 0;
  animation: letter-pop 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) 2.6s forwards;
}

.restart:hover { transform: scale(1.07); }
.restart:active { transform: scale(0.94); }

/* ---------- tap ripple ---------- */

#tap-ripple {
  position: fixed;
  z-index: 3;
  width: 24px;
  height: 24px;
  margin: -12px 0 0 -12px;
  border-radius: 50%;
  border: 3px solid rgba(255, 92, 138, 0.7);
  background: rgba(255, 182, 205, 0.35);
  pointer-events: none;
  opacity: 0;
  transform: scale(0.2);
}

#tap-ripple.is-on {
  animation: ripple 0.65s ease-out forwards;
}

@keyframes ripple {
  0%   { opacity: 1; transform: scale(0.2); }
  100% { opacity: 0; transform: scale(4.5); }
}

/* ---------- reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  .yata, .yata span, .hint-wrap, .msg-final, .restart {
    animation: none !important;
  }
  .msg .letter {
    animation-duration: 0.01s;
  }
}
