:root {
  --primary: #ff4f8b;
  --secondary: #ffd6e7;
  --ink: #4a2a3d;
  --card: rgba(255, 255, 255, 0.94);
  --font-title: "Baloo 2", "Nunito", system-ui, sans-serif;
  --font-body: "Nunito", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; height: 100%; overflow: hidden; background: #ffe9f1; color: var(--ink);
  font-family: var(--font-body); user-select: none; -webkit-user-select: none; touch-action: none;
  overscroll-behavior: none;
}
#app, #app canvas { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }

.hidden { display: none !important; }

/* ---------- screens + cards ---------- */
.screen {
  position: fixed; inset: 0; display: flex; align-items: center; justify-content: center;
  padding: 20px 16px calc(20px + env(safe-area-inset-bottom)); z-index: 20;
  opacity: 0; pointer-events: none; transition: opacity 0.45s ease;
}
.screen.show { opacity: 1; pointer-events: auto; }
.screen.dim { background: rgba(60, 20, 45, 0.35); }

.card {
  width: min(420px, 100%); max-height: calc(100% - 8px); overflow-y: auto; touch-action: pan-y;
  background: var(--card); border-radius: 28px; padding: 26px 22px 22px; text-align: center;
  box-shadow: 0 20px 60px rgba(120, 30, 70, 0.25), 0 0 0 4px color-mix(in srgb, var(--secondary) 80%, transparent);
  transform: translateY(18px) scale(0.97); transition: transform 0.5s cubic-bezier(.2,1.4,.4,1);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.screen.show .card { transform: none; }

.eyebrow {
  font-family: var(--font-title); font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase;
  font-size: 13px; color: var(--primary);
}
h1, h2 { font-family: var(--font-title); margin: 6px 0 10px; line-height: 1.1; }
h1 { font-size: clamp(30px, 9vw, 42px); }
h2 { font-size: 26px; }
p { font-size: 17px; line-height: 1.5; margin: 10px 0; }

.btn {
  font-family: var(--font-title); font-weight: 800; font-size: 19px; color: #fff; background: var(--primary);
  border: 0; border-radius: 999px; padding: 13px 28px; margin-top: 12px; cursor: pointer;
  box-shadow: 0 6px 0 color-mix(in srgb, var(--primary) 70%, #000), 0 10px 24px color-mix(in srgb, var(--primary) 40%, transparent);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.btn:active { transform: translateY(4px); box-shadow: 0 2px 0 color-mix(in srgb, var(--primary) 70%, #000); }
.btn.alt { background: color-mix(in srgb, var(--primary) 70%, #ffb84d); }
.btn.ghost {
  background: transparent; color: var(--primary); box-shadow: none; border: 2px solid var(--secondary);
  font-size: 16px; padding: 9px 18px;
}
.row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* loading */
#loading { background: linear-gradient(#ffd6e7, #fff4e6); flex-direction: column; }
#loading p { font-family: var(--font-title); font-size: 20px; color: var(--primary); }
.beat { font-size: 64px; color: var(--primary); animation: beat 1s infinite; }
@keyframes beat { 0%, 100% { transform: scale(1); } 15% { transform: scale(1.25); } 30% { transform: scale(1); } 45% { transform: scale(1.15); } }
.big-emoji { font-size: 54px; }

/* intro */
#intro { background: linear-gradient(to bottom, rgba(255,255,255,0) 30%, rgba(255, 214, 231, 0.55)); }
.intro-msg { font-size: 19px; font-weight: 700; }
.story { font-size: 15px; opacity: 0.8; }
.hint-small { font-size: 13px; opacity: 0.6; margin-top: 14px; }

/* HUD */
#hud {
  position: fixed; top: 0; left: 0; right: 0; z-index: 10; pointer-events: none;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: calc(10px + env(safe-area-inset-top)) 12px 0;
}
#stage-pill, #mute-btn, #hearts {
  background: rgba(255, 255, 255, 0.85); border-radius: 999px; box-shadow: 0 4px 14px rgba(120, 30, 70, 0.15);
}
#stage-pill { font-family: var(--font-title); font-weight: 800; font-size: 14px; padding: 7px 13px; color: var(--primary); white-space: nowrap; }
#hearts { display: flex; gap: 3px; padding: 6px 10px; }
#hearts svg { width: 22px; height: 22px; transition: transform 0.3s; }
#hearts svg.got { transform: scale(1.15); }
#hearts svg path { fill: rgba(0, 0, 0, 0.1); stroke: var(--primary); stroke-width: 2; transition: fill 0.4s; }
#hearts svg.got path { fill: var(--primary); }
#mute-btn { pointer-events: auto; border: 0; width: 40px; height: 40px; font-size: 18px; cursor: pointer; }

#toast {
  position: fixed; left: 50%; bottom: calc(26px + env(safe-area-inset-bottom)); z-index: 11;
  transform: translate(-50%, 20px); opacity: 0; transition: all 0.35s ease; pointer-events: none;
  background: rgba(255, 255, 255, 0.92); color: var(--ink); font-weight: 700; font-size: 16px;
  border-radius: 18px; padding: 11px 18px; max-width: calc(100% - 32px); text-align: center;
  box-shadow: 0 6px 20px rgba(120, 30, 70, 0.18);
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* joystick */
#stick {
  position: fixed; width: 110px; height: 110px; margin: -55px 0 0 -55px; border-radius: 50%; z-index: 9;
  background: rgba(255, 255, 255, 0.25); border: 3px solid rgba(255, 255, 255, 0.7); pointer-events: none;
  opacity: 0; transition: opacity 0.15s;
}
#stick.on { opacity: 1; }
#knob {
  position: absolute; left: 50%; top: 50%; width: 48px; height: 48px; border-radius: 50%;
  background: var(--primary); box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2); transform: translate(-50%, -50%);
}

/* memory card */
#memory-img { display: none; width: 100%; max-height: 42vh; object-fit: cover; border-radius: 18px; margin: 8px 0; }
#memory-img.on { display: block; }
#memory-text { font-size: 19px; font-weight: 700; }

/* ending */
#ending { align-items: flex-end; background: linear-gradient(to bottom, rgba(0,0,0,0) 20%, rgba(60, 20, 45, 0.35)); }
.ending-card { margin-bottom: 4px; padding: 20px 20px 18px; }
.ending-card h1 { font-size: clamp(26px, 8vw, 38px); margin: 2px 0 6px; }
#ending-media img, #ending-media video { width: 100%; max-height: 22vh; object-fit: cover; border-radius: 18px; margin: 6px 0; display: block; }
#ending-text { font-size: 20px; font-weight: 700; min-height: 1.5em; }
#proposal-q { font-family: var(--font-title); font-size: 30px; font-weight: 800; color: var(--primary); margin: 14px 0 4px; }
#celebration { font-family: var(--font-title); font-size: 26px; font-weight: 800; color: var(--primary); }
#ending-actions { margin-top: 8px; }
#memories-list { text-align: left; margin: 14px 0 0; padding-left: 22px; font-size: 15px; line-height: 1.5; }
#memories-list li { margin: 6px 0; }
#memories-list b { color: var(--primary); }

/* confetti */
#confetti { position: fixed; inset: 0; pointer-events: none; z-index: 30; overflow: hidden; }
#confetti span {
  position: absolute; top: -40px; font-size: 22px; color: var(--primary);
  animation: fall linear forwards;
}
@keyframes fall {
  to { transform: translate(var(--dx), 110vh) rotate(var(--rot)); opacity: 0.9; }
}

@media (min-width: 700px) {
  #stage-pill { font-size: 16px; }
  #hearts svg { width: 26px; height: 26px; }
}
