
/* Ajla Valentine Quest — Upload-ready CSS */
/* Mobile-first (iPhone 15 optimized). No build step required. */

:root{
  --bg1: #ff5bb2;
  --bg2: #ff2f93;
  --bg3: #ff86c9;
  --cream: #fff7fb;
  --ink: #2b1830;
  --muted: rgba(43, 24, 48, 0.72);
  --glass: rgba(255, 255, 255, 0.58);
  --glass2: rgba(255, 255, 255, 0.40);
  --stroke: rgba(255, 255, 255, 0.55);
  --shadow: 0 18px 60px rgba(43, 24, 48, 0.22);
  --shadow2: 0 12px 30px rgba(43, 24, 48, 0.18);
  --radius: 28px;
  --radius2: 18px;
  --maxw: 430px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
}

*{ box-sizing: border-box; }
html, body { height: 100%; }
body{
  margin: 0;
  font-family: "Fredoka", ui-rounded, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, "Apple Color Emoji","Segoe UI Emoji";
  color: var(--ink);
  background: radial-gradient(1200px 900px at 20% 10%, rgba(255,255,255,0.55), transparent 55%),
              radial-gradient(900px 700px at 85% 20%, rgba(255,255,255,0.35), transparent 52%),
              linear-gradient(160deg, var(--bg1), var(--bg2));
  overflow: hidden;
}

/* subtle animated blobs + sparkles */
body::before,
body::after{
  content:"";
  position: fixed;
  inset: -20%;
  pointer-events: none;
  background:
    radial-gradient(closest-side at 30% 35%, rgba(255, 255, 255, 0.20), transparent 60%),
    radial-gradient(closest-side at 70% 25%, rgba(255, 255, 255, 0.18), transparent 60%),
    radial-gradient(closest-side at 60% 78%, rgba(255, 255, 255, 0.14), transparent 60%);
  filter: blur(6px);
  opacity: 0.9;
  transform: translate3d(0,0,0);
  animation: floaty 10s ease-in-out infinite;
}
body::after{
  opacity: 0.55;
  animation-duration: 14s;
  transform: scale(1.05);
  mix-blend-mode: screen;
}
@keyframes floaty{
  0%{ transform: translate3d(-1%, -1%, 0) scale(1.02); }
  50%{ transform: translate3d(2%, 1%, 0) scale(1.06); }
  100%{ transform: translate3d(-1%, -1%, 0) scale(1.02); }
}

.app{
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  padding: calc(14px + var(--safe-top)) calc(14px + var(--safe-right)) calc(14px + var(--safe-bottom)) calc(14px + var(--safe-left));
}

.topbar{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  max-width: var(--maxw);
  width: 100%;
  margin: 0 auto 12px auto;
}
.brand{
  font-weight: 700;
  letter-spacing: 0.2px;
  color: rgba(255,255,255,0.92);
  text-shadow: 0 10px 24px rgba(0,0,0,0.20);
  padding: 8px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.icon-btn{
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.20);
  background: rgba(255, 255, 255, 0.14);
  color: rgba(255,255,255,0.96);
  border-radius: 999px;
  padding: 10px 12px;
  font-weight: 700;
  box-shadow: 0 10px 26px rgba(0,0,0,0.15);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.icon-btn:active{
  transform: translateY(1px) scale(0.99);
}

.stage{
  position: relative;
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  flex: 1;
  display: grid;
  place-items: center;
}

.screen{
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 6px;
  opacity: 0;
  transform: translate3d(0, 14px, 0) scale(0.99);
  transition: opacity 280ms ease, transform 280ms ease;
  pointer-events: none;
}
.screen.active{
  opacity: 1;
  transform: translate3d(0, 0, 0) scale(1);
  pointer-events: auto;
}

.card{
  width: 100%;
  border-radius: var(--radius);
  padding: 18px 16px;
  background: var(--glass);
  border: 1px solid var(--stroke);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  position: relative;
  overflow: hidden;
}
.card::before{
  content:"";
  position: absolute;
  inset: -60% -30%;
  background: radial-gradient(circle at 20% 30%, rgba(255,255,255,0.45), transparent 55%),
              radial-gradient(circle at 70% 55%, rgba(255,255,255,0.30), transparent 55%);
  transform: rotate(12deg);
  opacity: 0.55;
  pointer-events: none;
}
.card > *{ position: relative; }

.hero{
  padding: 18px 16px 14px 16px;
}
.hero__mascot{
  display: grid;
  place-items: center;
  margin: 2px 0 6px 0;
}
.mascot{
  width: min(250px, 76vw);
  height: auto;
  filter: drop-shadow(0 18px 40px rgba(43,24,48,0.20));
  transform: translateZ(0);
  animation: bob 2.8s ease-in-out infinite;
}
@keyframes bob{
  0%{ transform: translate3d(0,0,0) rotate(-1deg); }
  50%{ transform: translate3d(0,-6px,0) rotate(1deg); }
  100%{ transform: translate3d(0,0,0) rotate(-1deg); }
}

.title{
  margin: 8px 0 8px 0;
  font-size: 34px;
  line-height: 1.05;
  letter-spacing: -0.6px;
}
.title.small{
  font-size: 24px;
  letter-spacing: -0.3px;
}
.subtitle{
  margin: 0 0 14px 0;
  font-size: 16px;
  line-height: 1.35;
  color: var(--muted);
}
.micro{
  margin: 12px 0 0 0;
  font-size: 13px;
  line-height: 1.35;
  color: rgba(43, 24, 48, 0.62);
}

.cta-row{
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.btn{
  appearance: none;
  border: 0;
  border-radius: 999px;
  padding: 14px 16px;
  font-weight: 800;
  font-size: 16px;
  letter-spacing: 0.2px;
  width: 100%;
  min-height: 48px; /* iOS tap target */
  box-shadow: var(--shadow2);
  transition: transform 140ms ease, filter 140ms ease, box-shadow 140ms ease;
  cursor: pointer;
}
.btn:active{
  transform: translateY(1px) scale(0.99);
  filter: brightness(0.99);
  box-shadow: 0 10px 20px rgba(43, 24, 48, 0.16);
}
.btn-primary{
  color: #fff;
  background: linear-gradient(135deg, var(--bg2), var(--bg1));
  border: 1px solid rgba(255, 255, 255, 0.18);
}
.btn-ghost{
  background: rgba(255, 255, 255, 0.32);
  color: rgba(43, 24, 48, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.55);
}

.meter{
  margin: 12px 0 12px 0;
  border-radius: var(--radius2);
  padding: 12px 12px;
  background: rgba(255, 255, 255, 0.42);
  border: 1px solid rgba(255, 255, 255, 0.55);
}
.meter__label{
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  font-weight: 800;
  color: rgba(43, 24, 48, 0.86);
}
.meter__numbers{
  font-weight: 900;
}
.meter__bar{
  margin-top: 10px;
  height: 14px;
  background: rgba(255, 255, 255, 0.35);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.55);
}
.meter__fill{
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, rgba(255,79,161,0.95), rgba(255,134,201,0.95));
  border-radius: 999px;
  transition: width 220ms ease;
  position: relative;
}
.meter__fill::after{
  content:"";
  position:absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255,255,255,0.55), transparent 55%);
  opacity: 0.55;
}

/* Game */
.game-area{
  position: relative;
  height: min(52svh, 420px);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.32);
  border: 1px solid rgba(255, 255, 255, 0.55);
  overflow: hidden;
}
.heart-field{
  position: absolute;
  inset: 0;
}
.game-hint{
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 10px;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  pointer-events: none;
}
.pill{
  padding: 8px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.38);
  border: 1px solid rgba(255, 255, 255, 0.55);
  color: rgba(43, 24, 48, 0.80);
  font-weight: 700;
  font-size: 13px;
}

/* Heart buttons (floating) */
.heart{
  position: absolute;
  top: 0;
  width: 62px;
  height: 62px;
  border: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
  filter: drop-shadow(0 12px 18px rgba(43, 24, 48, 0.14));
  transform: translateZ(0);
  animation: appearFade var(--dur, 4.6s) linear var(--delay, 0s) forwards;
  touch-action: manipulation;
}
.heart__svg{
  width: 100%;
  height: 100%;
  transform: rotate(var(--rot, 0deg));
}
.heart__shape{
  fill: rgba(255, 79, 161, 0.95);
}
.heart__shine{
  fill: rgba(255, 255, 255, 0.72);
  opacity: 0.78;
}
.heart.popped{
  animation: pop 220ms ease forwards;
}
@keyframes appearFade{
  from{
    transform: translate3d(0,0,0) scale(calc(var(--s, 1) * 0.9));
    opacity: 0;
  }
  15%{
    transform: translate3d(0,0,0) scale(var(--s, 1));
    opacity: 0.98;
  }
  85%{
    transform: translate3d(0,0,0) scale(var(--s, 1));
    opacity: 0.98;
  }
  to{
    transform: translate3d(0,0,0) scale(calc(var(--s, 1) * 0.92));
    opacity: 0;
  }
}
@keyframes pop{
  0%{ transform: translate3d(0,0,0) scale(1); opacity: 1; }
  100%{ transform: translate3d(0,-10px,0) scale(0.15); opacity: 0; }
}

/* Sparkle burst */
.spark{
  position: absolute;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  pointer-events: none;
  background: radial-gradient(circle at 30% 30%, rgba(255,255,255,0.95), rgba(255,255,255,0.25) 52%, transparent 70%);
  filter: drop-shadow(0 8px 12px rgba(43, 24, 48, 0.16));
  animation: spark 460ms ease forwards;
}
@keyframes spark{
  0%{ transform: translate3d(-50%, -50%, 0) scale(0.3); opacity: 0.0; }
  20%{ opacity: 1; }
  100%{ transform: translate3d(-50%, -50%, 0) scale(2.3); opacity: 0; }
}

.done-row{
  margin-top: 14px;
  display: grid;
  gap: 10px;
}

/* Envelope */
.envelope-stage{
  display: grid;
  place-items: center;
  padding: 6px 0 14px 0;
}
.envelope{
  width: min(340px, 86vw);
  height: 220px;
  position: relative;
  transform: translateZ(0);
}
.envelope__back{
  position:absolute;
  inset: 0;
  border-radius: 24px;
  background: rgba(255,255,255,0.40);
  border: 1px solid rgba(255,255,255,0.55);
  box-shadow: var(--shadow2);
}
.envelope__paper{
  position:absolute;
  left: 18px;
  right: 18px;
  top: 18px;
  height: 180px;
  border-radius: 18px;
  background: rgba(255,255,255,0.75);
  border: 1px solid rgba(255,255,255,0.80);
  transform: translate3d(0, 60px, 0);
  transition: transform 520ms cubic-bezier(.2,.9,.2,1);
  overflow: hidden;
}
.paper__shine{
  position:absolute;
  inset: -40% -30%;
  background: radial-gradient(circle at 30% 20%, rgba(255,255,255,0.8), transparent 52%),
              radial-gradient(circle at 70% 60%, rgba(255,79,161,0.18), transparent 60%);
  transform: rotate(12deg);
  opacity: 0.8;
}
.paper__text{
  position:absolute;
  bottom: 16px;
  left: 16px;
  right: 16px;
  font-weight: 800;
  color: rgba(43,24,48,0.56);
  letter-spacing: 0.6px;
  text-transform: lowercase;
  font-size: 14px;
}
.envelope__front{
  position:absolute;
  inset: 0;
  border-radius: 24px;
  background: rgba(255,255,255,0.22);
  border: 1px solid rgba(255,255,255,0.55);
  clip-path: polygon(0 35%, 50% 68%, 100% 35%, 100% 100%, 0 100%);
}
.envelope__flap{
  position:absolute;
  inset: 0;
  border-radius: 24px;
  background: rgba(255,255,255,0.30);
  border: 1px solid rgba(255,255,255,0.55);
  clip-path: polygon(0 35%, 50% 0%, 100% 35%, 50% 68%);
  transform-origin: 50% 30%;
  transform: rotateX(0deg);
  transition: transform 520ms cubic-bezier(.2,.9,.2,1);
}
.seal{
  position:absolute;
  left: 50%;
  top: 52%;
  transform: translate(-50%, -50%);
  width: 74px;
  height: 74px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.65);
  background: linear-gradient(145deg, rgba(255,255,255,0.44), rgba(255,255,255,0.18));
  box-shadow: 0 14px 30px rgba(43,24,48,0.20);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  cursor: grab;
  touch-action: none; /* allow dragging */
}
.seal:active{
  cursor: grabbing;
}
.seal__heart{
  display: grid;
  place-items: center;
  font-size: 28px;
}
.envelope.opened .envelope__flap{
  transform: rotateX(170deg);
}
.envelope.opened .envelope__paper{
  transform: translate3d(0, 6px, 0);
}
.envelope.opened .seal{
  pointer-events: none;
}

/* Letter */
.letter{
  margin-top: 12px;
  border-radius: var(--radius);
  background: rgba(255,255,255,0.34);
  border: 1px solid rgba(255,255,255,0.55);
  overflow: hidden;
}
.letter__inner{
  padding: 14px 14px 16px 14px;
  background:
    radial-gradient(closest-side at 16% 20%, rgba(255, 79, 161, 0.14), transparent 60%),
    radial-gradient(closest-side at 84% 36%, rgba(255, 255, 255, 0.60), transparent 60%);
}
.letter__top{
  display:flex;
  align-items:center;
  gap: 10px;
  justify-content: space-between;
  margin-bottom: 8px;
}
.stamp{
  font-size: 22px;
}
.to{
  font-weight: 800;
  color: rgba(43,24,48,0.70);
}
.ask-text{
  min-height: 118px;
  margin: 10px 0 14px 0;
  font-size: 18px;
  line-height: 1.45;
  color: rgba(43,24,48,0.88);
  font-weight: 600;
  letter-spacing: -0.1px;
  white-space: pre-wrap;
}
.ask-buttons{
  display:grid;
  gap: 10px;
}

/* Yes screen reward */
.reward-grid{
  display:grid;
  gap: 10px;
  grid-template-columns: 1fr;
}
.reward-card{
  appearance:none;
  border: 1px solid rgba(255,255,255,0.65);
  background: rgba(255,255,255,0.44);
  border-radius: 18px;
  padding: 14px 14px;
  text-align:left;
  box-shadow: 0 12px 24px rgba(43,24,48,0.14);
  cursor:pointer;
  transition: transform 160ms ease, filter 160ms ease;
}
.reward-card:active{
  transform: translateY(1px) scale(0.99);
  filter: brightness(0.99);
}
.reward-card.is-selected{
  border-color: rgba(255, 79, 161, 0.92);
  background: rgba(255, 255, 255, 0.70);
  box-shadow: 0 14px 26px rgba(255, 79, 161, 0.20);
}
.reward-card__emoji{
  font-size: 28px;
  margin-bottom: 6px;
}
.reward-card__title{
  font-weight: 900;
  font-size: 18px;
}
.reward-card__sub{
  margin-top: 2px;
  color: rgba(43,24,48,0.66);
  font-weight: 600;
}

.result{
  margin-top: 14px;
  padding: 12px 12px;
  border-radius: 18px;
  background: rgba(255,255,255,0.50);
  border: 1px solid rgba(255,255,255,0.65);
}
.result__text{
  margin: 0 0 10px 0;
  font-weight: 700;
  color: rgba(43,24,48,0.86);
}

/* Footer */
.footer{
  max-width: var(--maxw);
  width: 100%;
  margin: 12px auto 0 auto;
  display:flex;
  justify-content:center;
}
.footer__text{
  font-size: 12.5px;
  color: rgba(255,255,255,0.88);
  text-shadow: 0 10px 24px rgba(0,0,0,0.18);
  padding: 8px 10px;
  border-radius: 999px;
  background: rgba(255,255,255,0.14);
  border: 1px solid rgba(255,255,255,0.18);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

/* Canvas overlay */
.fx{
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce){
  body::before, body::after { animation: none; }
  .screen{ transition: none; }
  .mascot{ animation: none; }
  .heart{ animation: none; opacity: 0.9; }
  .meter__fill{ transition: none; }
}
