/* =====================================================================
   Proposal site — classroom romance, goofy edition
   Nalla mon ✨  ×  Nalla kochh 💕
   ===================================================================== */

:root {
  --board: #1f3b34;
  --board-2: #16302a;
  --chalk: #eef7f2;
  --paper: #fdfbef;
  --line: #cfe3f5;
  --margin: #f4a3a3;
  --ink: #2b3a55;
  --pink: #ff5d8f;
  --pink-soft: #ffd9e4;
  --red: #e5484d;
  --yellow: #ffd166;
  --blue: #4ea8de;
  --green: #57cc99;
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
  --hand: "Caveat", "Comic Sans MS", cursive;
  --text: "Patrick Hand", "Comic Sans MS", cursive;
  --head: "Fredoka", "Trebuchet MS", sans-serif;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

:focus-visible {
  outline: 3px dashed var(--pink);
  outline-offset: 3px;
}
.btn:focus-visible, .opt:focus-visible { outline-color: #ff5d8f; outline-offset: 4px; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  font-family: var(--text);
  color: var(--chalk);
  background:
    radial-gradient(circle at 12% 8%, rgba(255, 255, 255, 0.06), transparent 45%),
    radial-gradient(circle at 88% 92%, rgba(255, 209, 102, 0.08), transparent 40%),
    repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.012) 0 2px, transparent 2px 6px),
    linear-gradient(160deg, var(--board) 0%, var(--board-2) 100%);
  background-attachment: fixed;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}

/* ------------------------------- behind the scenes ------------------ */

.hearts,
.board-doodles {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.doodle {
  position: absolute;
  opacity: 0.18;
  font-size: clamp(1.2rem, 3vw, 2.2rem);
  filter: grayscale(0.2);
  animation: floaty 7s ease-in-out infinite;
}
.d1 { top: 8%;  left: 6%;  }
.d2 { top: 72%; left: 4%;  animation-delay: -1.5s; }
.d3 { top: 22%; right: 7%; animation-delay: -3s; }
.d4 { top: 86%; right: 10%; animation-delay: -2s; }
.d5 { top: 50%; left: 2%; animation-delay: -4s; }
.d6 { top: 12%; right: 22%; font-size: 2.6rem; color: var(--pink); opacity: 0.3; }
.d7 { bottom: 12%; left: 12%; font-family: var(--hand); font-size: 1.1rem; transform: rotate(-6deg); }
.d8 { top: 40%; right: 3%; font-family: var(--hand); font-size: 1.1rem; transform: rotate(5deg); }
.d9 { bottom: 6%; right: 26%; font-family: var(--hand); font-size: 1.05rem; transform: rotate(3deg); }

@keyframes floaty {
  0%, 100% { transform: translateY(0) rotate(-3deg); }
  50%      { transform: translateY(-14px) rotate(4deg); }
}

.heart {
  position: absolute;
  top: -40px;
  font-size: 18px;
  opacity: 0.8;
  animation: fall linear forwards;
  will-change: transform;
}
@keyframes fall {
  from { transform: translateY(-10vh) rotate(0deg); }
  to   { transform: translateY(112vh) rotate(360deg); opacity: 0; }
}

#confetti {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 60;
}

/* ------------------------------- music button ----------------------- */

.music-btn {
  position: fixed;
  top: 14px;
  right: 14px;
  z-index: 70;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 15px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.35);
  color: var(--chalk);
  font-family: var(--text);
  font-size: 1rem;
  cursor: pointer;
  backdrop-filter: blur(6px);
  transition: transform 0.15s ease, background 0.2s ease;
}
.music-btn:hover { transform: scale(1.05); }
.music-btn.playing { background: var(--pink); border-color: #fff; }
.music-btn.playing .music-icon { animation: spin 2.4s linear infinite; display: inline-block; }
.music-btn.missing { opacity: 0.55; }
.music-btn.missing .music-label::after { content: " (add mp3)"; font-size: 0.75rem; }
@keyframes spin { to { transform: rotate(360deg); } }

/* soft vignette so the cards pop */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 5;
  background: radial-gradient(ellipse at 50% 45%, transparent 42%, rgba(0, 0, 0, 0.38) 100%);
}

/* ------------------------------- progress dots ---------------------- */

.steps {
  position: fixed;
  top: 22px;
  left: 18px;
  z-index: 70;
  display: flex;
  gap: 7px;
  align-items: center;
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity 0.45s ease, transform 0.45s ease;
  pointer-events: none;
}
.steps.visible { opacity: 1; transform: none; }
.steps i {
  display: block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.25);
  transition: background 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease;
}
.steps i.done { background: rgba(255, 255, 255, 0.6); }
.steps i.on {
  background: var(--pink);
  transform: scale(1.4);
  box-shadow: 0 0 12px rgba(255, 93, 143, 0.9);
}

/* ------------------------------- tape ------------------------------- */

#app .tape {
  position: absolute;
  width: 92px;
  height: 26px;
  background: linear-gradient(100deg, rgba(255, 231, 141, 0.72), rgba(255, 216, 96, 0.6));
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.12);
  z-index: 4;
  pointer-events: none;
  clip-path: polygon(0 4%, 100% 0, 97% 100%, 3% 96%);
}
#app .tape.tl { top: -14px; left: 26px; transform: rotate(-7deg); }
#app .tape.br { bottom: -13px; right: 30px; transform: rotate(-5deg); }

/* ------------------------------- scenes ----------------------------- */

#app {
  position: relative;
  z-index: 10;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 84px 16px 48px;
}

.scene {
  display: none;
  width: 100%;
  max-width: 720px;
  animation: pop 0.45s cubic-bezier(0.2, 1.2, 0.4, 1) both;
}
.scene.active { display: block; }

@keyframes pop {
  from { opacity: 0; transform: translateY(26px) scale(0.96); }
  to   { opacity: 1; transform: none; }
}

/* ------------------------------- cards ------------------------------ */

.chalk-card {
  border: 2px dashed rgba(255, 255, 255, 0.35);
  border-radius: 22px;
  padding: 30px 26px;
  text-align: center;
  background: rgba(0, 0, 0, 0.16);
  box-shadow: var(--shadow);
}

.chalk-small {
  margin: 0 0 6px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 0.78rem;
  opacity: 0.75;
}
.chalk-title {
  font-family: var(--hand);
  font-size: clamp(2.1rem, 8vw, 3.4rem);
  margin: 4px 0 10px;
  color: #fff;
  text-shadow: 0 0 18px rgba(255, 93, 143, 0.55);
}
.chalk-sub { font-size: 1.15rem; margin: 0 0 22px; opacity: 0.92; }

.chalk-title::after {
  content: "";
  display: block;
  width: min(250px, 72%);
  margin: 8px auto 0;
  border-bottom: 3px dashed rgba(255, 255, 255, 0.32);
}

.paper-card {
  position: relative;
  background:
    linear-gradient(var(--paper), #fffdf3);
  color: var(--ink);
  border-radius: 14px;
  padding: 34px 30px 30px 52px;
  box-shadow: var(--shadow), 0 0 0 1px rgba(0, 0, 0, 0.06);
  border: 1px solid #eadfbf;
}
/* notebook vertical margin + ruled lines */
.paper-card::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 38px;
  width: 2px;
  background: var(--margin);
  opacity: 0.75;
}
.paper-card::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 14px;
  background-image: repeating-linear-gradient(
    to bottom,
    transparent 0 30px,
    rgba(78, 168, 222, 0.22) 30px 31px
  );
  background-position: 0 18px;
  pointer-events: none;
  mask-image: linear-gradient(to bottom, transparent 0, #000 40px, #000 calc(100% - 24px), transparent 100%);
}
.paper-card > * { position: relative; z-index: 2; }
.paper-narrow { max-width: 560px; margin: 0 auto; }

.paper-tag {
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #9a8b6a;
  margin: 0 0 14px;
}

.q {
  font-family: var(--hand);
  font-size: clamp(1.5rem, 5.5vw, 2.1rem);
  line-height: 1.2;
  margin: 0 0 18px;
  color: #21304a;
}
.hl {
  background: linear-gradient(transparent 62%, var(--pink-soft) 62%);
  padding: 0 3px;
  border-radius: 3px;
}

/* ------------------------------- buttons ---------------------------- */

.btn {
  font-family: var(--text);
  font-size: 1.2rem;
  padding: 13px 24px;
  border-radius: 14px;
  border: none;
  cursor: pointer;
  background: var(--yellow);
  color: #3b2d00;
  box-shadow: 0 5px 0 #d9a92f;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.2s ease;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 7px 0 #d9a92f; }
.btn:active { transform: translateY(3px); box-shadow: 0 2px 0 #d9a92f; }

.btn-big { font-size: 1.35rem; padding: 15px 32px; }

.btn-ghost {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 4px 0 #d8d2c0;
  border: 2px dashed #cbbf9c;
}
.btn-ghost:hover { box-shadow: 0 6px 0 #d8d2c0; }
.btn-ghost:active { box-shadow: 0 2px 0 #d8d2c0; }

.btn-yes {
  background: var(--pink);
  color: #fff;
  box-shadow: 0 5px 0 #c93b6b;
  font-size: 1.35rem;
  padding: 15px 34px;
}
.btn-yes:hover { box-shadow: 0 7px 0 #c93b6b; }
.btn-yes:active { box-shadow: 0 2px 0 #c93b6b; }
.btn-yes.grow { animation: grow 0.5s ease; }

#yesBtn::after {
  content: "";
  position: absolute;
  inset: -6px;
  border-radius: 18px;
  border: 2px solid rgba(255, 93, 143, 0.75);
  animation: ring 2.1s ease-out infinite;
  pointer-events: none;
}
@keyframes ring {
  0%   { opacity: 0.85; transform: scale(0.96); }
  70%  { opacity: 0; transform: scale(1.16); }
  100% { opacity: 0; transform: scale(1.16); }
}
@keyframes grow {
  0% { transform: scale(1); }
  40% { transform: scale(1.35) rotate(-3deg); }
  100% { transform: scale(1); }
}

.btn-no {
  background: #e9edf5;
  color: #4a5670;
  box-shadow: 0 5px 0 #c2cbdb;
  position: relative;
  transition: top 0.35s cubic-bezier(0.3, 1.4, 0.4, 1), left 0.35s cubic-bezier(0.3, 1.4, 0.4, 1);
}
.btn-no:hover { box-shadow: 0 5px 0 #c2cbdb; transform: none; }
.btn-no:active { transform: translateY(3px); box-shadow: 0 2px 0 #c2cbdb; }
.btn-no.turned {
  background: var(--green);
  color: #06301f;
  box-shadow: 0 5px 0 #3a9c72;
}
.btn-no.running { position: absolute; z-index: 20; }

/* ------------------------------- envelope --------------------------- */

.envelope {
  position: relative;
  width: 190px;
  height: 126px;
  margin: 34px auto 26px;
  cursor: pointer;
  filter: drop-shadow(0 14px 22px rgba(0, 0, 0, 0.35));
  animation: hover-bob 2.6s ease-in-out infinite;
}
@keyframes hover-bob { 0%,100% { transform: translateY(0) rotate(-1deg); } 50% { transform: translateY(-10px) rotate(1.5deg); } }

.envelope-back {
  position: absolute;
  inset: 0;
  background: linear-gradient(160deg, #ffe9ef, #ffcadb);
  border-radius: 10px;
}
.envelope-letter {
  position: absolute;
  left: 50%;
  top: -24px;
  transform: translateX(-50%);
  font-size: 2.4rem;
  z-index: 3;
  filter: drop-shadow(0 3px 4px rgba(0, 0, 0, 0.18));
  animation: peek 2s ease-in-out infinite;
}
@keyframes peek { 0%,100% { top: -18px; } 50% { top: -30px; } }
.envelope-flap {
  position: absolute;
  inset: 0;
  background: linear-gradient(160deg, #ffb3cb, #ff8fb4);
  clip-path: polygon(0 0, 100% 0, 50% 62%);
  border-radius: 10px 10px 4px 4px;
  transform-origin: top center;
  transition: transform 0.6s ease;
}
.envelope.open .envelope-flap { transform: rotateX(180deg); }
.envelope-seal {
  position: absolute;
  right: 12px;
  bottom: 10px;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--red);
  color: #fff;
  font-family: var(--hand);
  font-size: 0.85rem;
  line-height: 0.95;
  display: grid;
  place-items: center;
  text-align: center;
  transform: rotate(-12deg);
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.18);
}

.tiny-note { font-size: 0.9rem; opacity: 0.7; margin: 16px 0 0; }

/* ------------------------------- game ------------------------------- */

.options { display: grid; gap: 12px; margin: 6px 0 4px; }

.opt {
  font-family: var(--text);
  font-size: 1.12rem;
  text-align: left;
  padding: 14px 18px;
  border-radius: 12px;
  border: 2px solid #d8e6f5;
  background: #f4f9ff;
  color: var(--ink);
  cursor: pointer;
  transition: transform 0.12s ease, background 0.2s ease, border-color 0.2s ease;
}
.opt:hover { transform: translateX(5px) rotate(-0.5deg); border-color: var(--blue); background: #e8f4ff; }
.opt.picked { border-color: var(--pink); background: var(--pink-soft); }
.opt.correct { border-color: var(--green); background: #e2f8ee; }
.opt.wrong { opacity: 0.45; }
.opt:disabled { cursor: default; }
.opt:disabled:hover { transform: none; }

.reaction {
  font-family: var(--hand);
  font-size: 1.4rem;
  min-height: 34px;
  margin: 16px 0 4px;
  color: var(--red);
  line-height: 1.25;
}
.reaction.happy { color: #1f9d6b; }

/* ------------------------------- letter ----------------------------- */

.letter-card { max-width: 640px; margin: 0 auto; }
.letter-card .type-line {
  font-family: var(--hand);
  font-size: clamp(1.28rem, 4.6vw, 1.6rem);
  line-height: 1.45;
  margin: 0 0 16px;
  color: #1f2c44;
  opacity: 0;
  transform: translateY(14px);
}
.letter-card.reveal .type-line { animation: ink 0.7s ease forwards; }
.letter-card.reveal .type-line:nth-of-type(2) { animation-delay: 0.35s; }
.letter-card.reveal .type-line:nth-of-type(3) { animation-delay: 1.1s; }
.letter-card.reveal .type-line:nth-of-type(4) { animation-delay: 2.5s; }
.letter-card.reveal .type-line:nth-of-type(5) { animation-delay: 3.3s; }
.letter-card.reveal .type-line:nth-of-type(6) { animation-delay: 3.9s; }
@keyframes ink { to { opacity: 1; transform: none; } }

.big-love {
  font-size: clamp(1.9rem, 7vw, 2.6rem) !important;
  color: var(--pink) !important;
  text-align: center;
  margin-top: 6px !important;
}
.sign { text-align: right; color: #6b5a8a !important; }

/* ------------------------------- reasons ---------------------------- */

.reasons { display: grid; gap: 14px; margin: 4px 0 18px; }
.reason {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  background: #fff;
  border: 2px solid #efe6cd;
  border-radius: 14px;
  padding: 14px 16px;
  box-shadow: 0 3px 0 #efe6cd;
  animation: slide 0.5s ease both;
}
.reason:nth-child(2) { animation-delay: 0.1s; }
.reason:nth-child(3) { animation-delay: 0.2s; }
.reason:nth-child(4) { animation-delay: 0.3s; }
@keyframes slide { from { opacity: 0; transform: translateX(-18px); } }
.reason b { font-family: var(--hand); font-size: 1.35rem; display: block; }
.reason p { margin: 2px 0 0; font-size: 1.02rem; color: #4a5670; }
.reason .num {
  flex: 0 0 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--pink-soft);
  color: #b5305e;
  font-family: var(--head);
  font-weight: 700;
  display: grid;
  place-items: center;
}
.reason.wide .num { background: #dff3ff; color: #1b6d9c; }

.sticky {
  display: inline-block;
  background: var(--yellow);
  color: #4a3a00;
  font-family: var(--hand);
  font-size: 1.4rem;
  padding: 10px 18px;
  border-radius: 4px;
  transform: rotate(-2.5deg);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
  margin: 6px 0 4px;
}

/* ------------------------------- ask -------------------------------- */

.ask-stage {
  position: relative;
  min-height: 380px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
/* the No button escapes the page flow — it must anchor to the card, not the row */
.paper-card > .answer-row { position: static; }
.answer-row > * { position: relative; z-index: 2; }
.ask-q {
  font-family: var(--hand);
  font-size: clamp(2rem, 7.5vw, 2.9rem);
  margin: 0 0 4px;
  color: #21304a;
  text-align: center;
}
.ask-sub { text-align: center; font-size: 1.15rem; color: #6c7590; margin: 0 0 26px; }

.answer-row {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
}
.answer-row.stacked { flex-direction: column; align-items: stretch; }
.answer-row.stacked .btn { width: 100%; text-align: center; }

.hint {
  font-family: var(--hand);
  font-size: 1.3rem;
  color: var(--red);
  text-align: center;
  margin: 20px 0 0;
  min-height: 30px;
}
.hint.pop { animation: hintPop 0.4s ease; }
@keyframes hintPop { 0% { transform: scale(0.85); } 60% { transform: scale(1.06); } 100% { transform: scale(1); } }

.btn-no.jumping { animation: jump 0.32s ease 3; }
@keyframes jump {
  0%   { transform: translate(0, 0) rotate(0deg); }
  30%  { transform: translate(-14px, -30px) rotate(-10deg); }
  60%  { transform: translate(16px, -14px) rotate(12deg); }
  100% { transform: translate(0, 0) rotate(0deg); }
}

.btn-no.shake { animation: shake 0.4s ease; }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-8px) rotate(-4deg); }
  75% { transform: translateX(8px) rotate(4deg); }
}

.sorry-note {
  font-family: var(--hand);
  font-size: 1.2rem;
  color: #7c6a3a;
  text-align: center;
  margin: 18px 0 0;
}

/* ------------------------------- celebrate -------------------------- */

.celebrate { text-align: center; max-width: 640px; margin: 0 auto; }
.yay-title {
  font-family: var(--hand);
  font-size: clamp(2.2rem, 9vw, 3.4rem);
  margin: 0 0 8px;
  color: var(--pink);
  text-shadow: 2px 2px 0 var(--pink-soft);
}
.yay-sub { font-size: 1.15rem; color: #4a5670; margin: 0 0 22px; line-height: 1.45; }
.yay-sub.small { font-size: 1rem; margin-top: 18px; }

.certificate {
  border: 3px double #c9b98a;
  border-radius: 12px;
  padding: 20px 18px;
  background: #fffdf0;
  transform: rotate(-0.8deg);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.12);
  margin: 0 0 20px;
}
.cert-head {
  font-family: var(--head);
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-size: 0.85rem;
  color: #9a8b6a;
  margin: 0 0 10px;
}
.cert-body { font-family: var(--hand); font-size: 1.45rem; line-height: 1.4; margin: 0 0 10px; }
.cert-body b { color: var(--pink); }
.cert-date { font-size: 0.9rem; color: #7d8a9c; margin: 0 0 8px; }
.cert-sign { font-family: var(--hand); font-size: 1.15rem; color: #6b5a8a; margin: 0; }

.final-love {
  font-family: var(--hand);
  font-size: clamp(1.9rem, 7vw, 2.5rem);
  color: var(--red);
  margin: 6px 0 0;
  animation: beat 1.6s ease-in-out infinite;
}
@keyframes beat { 0%,100% { transform: scale(1); } 50% { transform: scale(1.07); } }

.scene-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 22px;
}

/* ------------------------------- responsive ------------------------- */

@media (max-width: 560px) {
  #app { padding: 76px 12px 40px; }
  .paper-card { padding: 26px 18px 24px 40px; }
  .paper-card::before { left: 26px; }
  .chalk-card { padding: 24px 18px; }
  .music-btn .music-label { display: none; }
  .reason .num { flex-basis: 30px; height: 30px; }
  .ask-stage { min-height: 330px; }
  .answer-row.stacked { gap: 10px; }
  .answer-row.stacked .btn { padding: 11px 16px; font-size: 1.08rem; }
  .scene-actions .btn { font-size: 1.05rem; padding: 11px 16px; }
  .cert-body { font-size: 1.2rem; }
  .yay-title { font-size: clamp(1.9rem, 9vw, 2.6rem); }
  .reason p { font-size: 0.98rem; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001s !important; transition-duration: 0.05s !important; }
}
