:root {
  --pink: #ff6fa5;
  --pink-dark: #e64d8a;
  --peach: #ffb38a;
  --lilac: #b79cff;
  --ink: #5a2a43;
  --bg1: #ffe3ef;
  --bg2: #fff1d9;
}

[hidden] { display: none !important; }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  height: 100%;
  font-family: "Baloo 2", system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background: linear-gradient(160deg, var(--bg1), var(--bg2));
  overflow: hidden;
}

main {
  position: relative;
  height: 100dvh;
  padding: max(24px, env(safe-area-inset-top)) 20px max(24px, env(safe-area-inset-bottom));
  display: grid;
  place-items: center;
}

.page {
  display: none;
  width: 100%;
  max-width: 420px;
  text-align: center;
  padding: 28px 22px;
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(8px);
  box-shadow: 0 12px 40px rgba(230, 77, 138, 0.18);
}
.page.active { display: block; animation: pop 0.45s cubic-bezier(.2,1.4,.4,1); }

h1 { font-size: 1.7rem; margin: 8px 0; line-height: 1.2; }
p { margin: 6px 0 16px; font-size: 1.05rem; }

.emoji.big { font-size: 3.6rem; }

input {
  width: 100%;
  font: inherit;
  font-size: 1.1rem; /* >=16px stops iOS zoom on focus */
  padding: 14px 16px;
  border: 2px solid #ffc2da;
  border-radius: 16px;
  background: #fff;
  color: var(--ink);
  outline: none;
  margin-bottom: 8px;
  -webkit-appearance: none;
  appearance: none;
  min-height: 52px;
}
input:focus { border-color: var(--pink); }

.btn {
  display: inline-block;
  font: inherit;
  font-weight: 700;
  font-size: 1.15rem;
  padding: 14px 28px;
  border: none;
  border-radius: 999px;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.15s, font-size 0.25s, padding 0.25s;
  margin: 8px 6px;
}
.btn:active { transform: scale(0.95); }
.btn.primary { background: var(--pink); color: #fff; box-shadow: 0 6px 0 var(--pink-dark); }
.btn.secondary { background: var(--lilac); color: #fff; box-shadow: 0 6px 0 #9479e8; }
.btn.ghost { background: #fff; color: var(--ink); border: 2px solid #ffc2da; }

.choices { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; min-height: 80px; }

#page-ask { position: relative; }
#no-btn.runaway { position: absolute; z-index: 10; margin: 0; transition: left 0.25s, top 0.25s, transform 0.25s; }

.taunt { min-height: 1.4em; color: var(--pink-dark); font-weight: 600; }

.sad-bunny {
  pointer-events: none;
  user-select: none;
  opacity: 0.85;
  animation: pop 0.4s;
}
.sad-bunny pre { font-size: 1.3rem; margin: 0; line-height: 1.15; font-family: ui-monospace, Menlo, monospace; }
.sad-bunny small { display: block; color: #a77; }

.error { color: #d6336c; min-height: 1.2em; font-size: 0.95rem; margin: 4px 0; }
.hint { display: block; opacity: 0.7; margin-top: 4px; }

.autocomplete { position: relative; text-align: left; }
#suggestions {
  list-style: none;
  margin: 0;
  padding: 0;
  position: absolute;
  left: 0; right: 0;
  top: 100%;
  z-index: 5;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(90, 42, 67, 0.15);
  max-height: 240px;
  overflow-y: auto;
}
#suggestions li { padding: 12px 16px; border-bottom: 1px solid #ffe3ef; cursor: pointer; }
#suggestions li:last-child { border-bottom: none; }
#suggestions li small { display: block; opacity: 0.6; }
#suggestions li:active { background: #ffe3ef; }

.card {
  background: #fff;
  border-radius: 18px;
  padding: 14px 18px;
  margin: 10px 0 14px;
  text-align: left;
  line-height: 1.7;
}

#hearts { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }
#hearts span {
  position: absolute;
  bottom: -40px;
  animation: float linear forwards;
  opacity: 0.7;
}

.bounce { animation: bounce 1.6s infinite; }
.wiggle { animation: wiggle 2s infinite; }
.shake { animation: shake 0.4s; }
.boing { animation: boing 0.6s; }

@keyframes pop { from { transform: scale(0.85); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes bounce { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
@keyframes wiggle { 0%,100% { transform: rotate(0); } 25% { transform: rotate(-8deg); } 75% { transform: rotate(8deg); } }
@keyframes boing { 0%,100% { transform: scale(1) translateY(0); } 30% { transform: scale(1.15) translateY(-12px); } 55% { transform: scale(0.95) translateY(0); } 75% { transform: scale(1.05) translateY(-4px); } }
@keyframes shake { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-8px); } 75% { transform: translateX(8px); } }
@keyframes float { to { transform: translateY(-110vh) rotate(30deg); opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

.lang { display: flex; justify-content: center; gap: 8px; margin-bottom: 6px; }
.lang button {
  font: inherit; font-size: 0.95rem; padding: 6px 14px; border-radius: 999px; cursor: pointer;
  border: 2px solid #ffc2da; background: #fff; color: var(--ink);
}
.lang button.on { background: var(--pink); border-color: var(--pink); color: #fff; }
.lang.corner {
  position: fixed; z-index: 20; margin: 0;
  top: max(12px, env(safe-area-inset-top)); right: 12px;
  gap: 4px; padding: 4px; border-radius: 999px; background: rgba(255, 255, 255, 0.7);
}
.lang.corner button { padding: 2px 8px; font-size: 1.1rem; border-width: 0; background: transparent; opacity: 0.5; }
.lang.corner button.on { background: #fff; opacity: 1; }
