:root {
  --cream: #fff8f3;
  --paper: #fffdfb;
  --ink: #352b3a;
  --muted: #7e707d;
  --rose: #e9788e;
  --pink: #f8c2d1;
  --lilac: #cbbcf0;
  --mint: #c8e8dc;
  --butter: #f5d795;
  --line: rgba(53, 43, 58, .12);
  --display: "Playfair Display", Georgia, serif;
  --body: "DM Sans", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  min-width: 320px;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 5% 7%, rgba(248, 194, 209, .34), transparent 20rem),
    radial-gradient(circle at 95% 70%, rgba(203, 188, 240, .25), transparent 24rem),
    var(--cream);
  font-family: var(--body);
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
button, a { font: inherit; }
button { color: inherit; }

button:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(233, 120, 142, .48);
  outline-offset: 4px;
}

.page-shell { width: min(1040px, calc(100% - 36px)); margin: 0 auto; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 76px;
}

.brand { display: inline-flex; align-items: center; gap: .6rem; font-size: .72rem; font-weight: 700; letter-spacing: .13em; text-transform: uppercase; }
.brand-mark { display: grid; width: 2rem; height: 2rem; place-items: center; background: var(--butter); border-radius: 50%; font-family: var(--display); font-size: 1.1rem; }
.topbar-note { color: var(--muted); font-size: .7rem; letter-spacing: .06em; }
.topbar-note span { color: var(--rose); font-size: 1rem; }

.hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 230px;
  align-items: center;
  gap: 2rem;
  min-height: 420px;
  margin-bottom: 2rem;
  padding: clamp(2.3rem, 6vw, 5rem);
  overflow: visible;
  background:
    radial-gradient(circle at 82% 10%, rgba(255, 255, 255, .9), transparent 15rem),
    linear-gradient(135deg, #ffe8e6, #f8eaff 52%, #e7f5ed);
  border: 1px solid rgba(255, 255, 255, .95);
  border-radius: 2rem;
  box-shadow: 0 25px 70px rgba(89, 54, 67, .12);
}

.hero::after {
  position: absolute;
  right: -4rem;
  bottom: -7rem;
  width: 18rem;
  height: 18rem;
  border: 1px solid rgba(255, 255, 255, .7);
  border-radius: 50%;
  content: "";
}

.hero-copy { position: relative; z-index: 2; }
.eyebrow { margin: 0 0 1rem; color: var(--rose); font-size: .66rem; font-weight: 700; letter-spacing: .18em; text-transform: uppercase; }

h1, h2, h3 { margin-top: 0; font-family: var(--display); font-weight: 600; letter-spacing: -.06em; }
h1 { max-width: 650px; margin-bottom: 1rem; font-size: clamp(3.4rem, 8vw, 6.7rem); line-height: .91; }
h1 em, h2 em { display: block; color: var(--rose); font-style: italic; }
.hero-subtitle { max-width: 520px; margin: 0 0 1.8rem; color: var(--muted); font-size: 1rem; line-height: 1.75; }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .65rem;
  min-height: 3rem;
  padding: .8rem 1.15rem;
  border: 1px solid transparent;
  border-radius: 999px;
  cursor: pointer;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .05em;
  transition: transform .25s ease, box-shadow .25s ease, background .25s ease;
}

.button:hover { transform: translateY(-3px); }
.button-primary, .button-dark { color: #fffaf7; background: var(--ink); box-shadow: 0 12px 24px rgba(53, 43, 58, .18); }
.button-primary:hover, .button-dark:hover { background: #4b3a51; box-shadow: 0 16px 30px rgba(53, 43, 58, .22); }
.button-soft { background: rgba(255, 253, 251, .72); border-color: var(--line); }
.button-soft:hover { background: var(--paper); box-shadow: 0 12px 25px rgba(53, 43, 58, .08); }

.hero-note {
  position: relative;
  z-index: 2;
  display: grid;
  align-content: center;
  justify-items: center;
  width: 11rem;
  height: 13rem;
  margin-left: auto;
  padding: 1rem;
  background: rgba(255, 253, 251, .74);
  border: 1px solid rgba(255, 255, 255, .9);
  box-shadow: 0 16px 30px rgba(53, 43, 58, .1);
  transform: rotate(7deg);
}

.hero-note-pin { align-self: start; color: var(--rose); font-size: 1.1rem; }
.hero-note p { margin: .6rem 0; color: var(--muted); font-family: var(--display); font-size: .9rem; font-style: italic; line-height: 1.35; text-align: center; }
.hero-note strong { color: var(--ink); font-size: 1.45rem; font-style: normal; }
.hero-note-heart { align-self: end; color: var(--rose); font-family: var(--display); font-size: 2.1rem; }

.gift-wrap { position: relative; z-index: 4; display: grid; justify-items: center; min-height: 235px; padding-top: 3.7rem; }
.gift-box { position: relative; width: 10.5rem; height: 8.3rem; padding: 0; background: transparent; border: 0; cursor: pointer; filter: drop-shadow(0 16px 18px rgba(53, 43, 58, .13)); transition: transform .28s ease, filter .28s ease; }
.gift-box:hover { filter: drop-shadow(0 20px 24px rgba(53, 43, 58, .19)); transform: translateY(-5px) rotate(-2deg); }
.gift-base { position: absolute; bottom: .35rem; left: 50%; width: 8.5rem; height: 5.8rem; background: linear-gradient(135deg, #ef8296, #d9617c); border-radius: .35rem .35rem .8rem .8rem; transform: translateX(-50%); }
.gift-lid { position: absolute; z-index: 3; top: 1.2rem; left: 50%; width: 9.5rem; height: 1.5rem; background: linear-gradient(135deg, #f7a8b8, #e36c85); border-radius: .4rem; box-shadow: 0 .3rem 0 rgba(119, 50, 72, .12); transform: translateX(-50%); transition: transform .55s cubic-bezier(.2, .8, .25, 1); }
.gift-ribbon { position: absolute; z-index: 4; display: block; background: #f6d795; }
.gift-ribbon-vertical { top: 1.15rem; bottom: .35rem; left: 50%; width: 1.1rem; transform: translateX(-50%); }
.gift-ribbon-horizontal { top: 3.1rem; left: 1rem; width: 8.5rem; height: 1rem; }
.gift-bow { position: absolute; z-index: 5; top: .35rem; width: 2.2rem; height: 1.25rem; background: #f6d795; border-radius: 90% 15% 90% 15%; transition: transform .55s cubic-bezier(.2, .8, .25, 1); }
.gift-bow-left { left: 3.8rem; transform: rotate(24deg); }
.gift-bow-right { right: 3.8rem; transform: scaleX(-1) rotate(24deg); }
.gift-box.is-open .gift-lid { transform: translate(-63%, -2.7rem) rotate(-12deg); }
.gift-box.is-open .gift-bow-left { transform: translate(-.6rem, -2.1rem) rotate(18deg); }
.gift-box.is-open .gift-bow-right { transform: translate(.6rem, -2.1rem) scaleX(-1) rotate(18deg); }
.gift-contents { position: absolute; z-index: 6; top: .2rem; left: 50%; width: 11rem; transform: translateX(-50%); pointer-events: none; }
.gift-contents:not([hidden]) { animation: gift-pop .7s cubic-bezier(.2, .8, .25, 1) both; }
.gift-note { display: grid; gap: .35rem; padding: .85rem .9rem 1rem; color: var(--ink); background: #fff8db; border: 1px solid rgba(212, 160, 73, .32); box-shadow: 0 12px 20px rgba(53, 43, 58, .11); transform: rotate(-4deg); }
.gift-note p { margin: 0; color: var(--rose); font-size: .58rem; font-weight: 700; letter-spacing: .15em; text-transform: uppercase; }
.gift-note strong { font-family: var(--display); font-size: 1rem; line-height: 1.2; }
.gift-note > span { color: var(--muted); font-size: .55rem; font-style: italic; }
.gift-pop-heart { position: absolute; color: var(--rose); font-family: var(--display); font-size: 1.5rem; animation: gift-heart-float 1.7s ease-in-out infinite alternate; }
.gift-pop-heart-one { top: -.7rem; left: -.8rem; }
.gift-pop-heart-two { top: -.4rem; right: -.7rem; color: var(--lilac); animation-delay: -.7s; }
.gift-hint { position: relative; z-index: 2; max-width: 230px; margin: .4rem 0 0; color: var(--muted); font-size: .65rem; line-height: 1.4; text-align: center; }

.hero-decoration { position: absolute; z-index: 1; color: rgba(233, 120, 142, .46); font-family: var(--display); animation: floaty 4s ease-in-out infinite; }
.hero-decoration-one { top: 14%; right: 46%; font-size: 2rem; }
.hero-decoration-two { right: 8%; bottom: 18%; color: rgba(203, 188, 240, .8); font-size: 1.5rem; animation-delay: -1.4s; }
.hero-decoration-three { bottom: 10%; left: 5%; color: rgba(233, 120, 142, .28); font-size: 4rem; animation-delay: -2.5s; }

.love-panel { background: linear-gradient(145deg, rgba(255, 253, 251, .96), rgba(255, 232, 230, .72) 52%, rgba(248, 234, 255, .78)); }
.love-message-layout { display: block; }
.love-letter h2 { max-width: 560px; margin: 0 0 1.3rem; font-size: clamp(2.6rem, 6vw, 4.8rem); line-height: .95; }
.heartfelt-message { max-width: 630px; margin: 0 0 1rem; color: var(--muted); font-size: .95rem; line-height: 1.85; }
.love-signature { margin: 1.4rem 0 0; color: var(--rose); font-family: var(--display); font-size: 1.1rem; font-style: italic; }

.panel {
  margin-bottom: 2rem;
  padding: clamp(1.4rem, 5vw, 3.3rem);
  background: rgba(255, 253, 251, .84);
  border: 1px solid rgba(255, 255, 255, .95);
  border-radius: 1.6rem;
  box-shadow: 0 18px 50px rgba(89, 54, 67, .08);
}

.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; }
.panel-heading h2 { margin-bottom: 0; font-size: clamp(2.6rem, 6vw, 4.5rem); line-height: .95; }
.panel-intro { max-width: 720px; margin: 1rem 0 1.7rem; color: var(--muted); font-size: .9rem; line-height: 1.75; }
.no-wrong-badge { display: inline-flex; align-items: center; gap: .45rem; margin: -.7rem 0 1.5rem; padding: .42rem .65rem; color: var(--rose); background: rgba(248, 194, 209, .22); border: 1px dashed rgba(233, 120, 142, .34); border-radius: 999px; font-size: .64rem; font-weight: 700; letter-spacing: .04em; }
.no-wrong-badge span { font-size: .8rem; }
code { padding: .15rem .35rem; color: var(--rose); background: rgba(247, 183, 200, .17); border-radius: .35rem; font-size: .8em; }

.vibe-stamp { display: flex; flex-shrink: 0; align-items: center; gap: .45rem; margin-top: .2rem; padding: .55rem .7rem; background: rgba(245, 215, 149, .45); border: 1px dashed rgba(198, 145, 55, .45); border-radius: .7rem; transform: rotate(4deg); }
.vibe-stamp > :first-child { font-family: var(--display); font-size: 1.3rem; font-weight: 700; letter-spacing: -.08em; }
.vibe-stamp small { color: var(--muted); font-size: .48rem; font-weight: 700; letter-spacing: .09em; line-height: 1.2; text-transform: uppercase; }

.quiz-status, .game-meta { display: flex; align-items: center; justify-content: space-between; gap: 1rem; color: var(--muted); font-size: .67rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.quiz-status strong { color: var(--rose); }
.progress-track { height: .45rem; margin: .65rem 0 1.7rem; overflow: hidden; background: rgba(233, 120, 142, .12); border-radius: 999px; }
.progress-track span { display: block; width: 16.66%; height: 100%; background: linear-gradient(90deg, var(--rose), var(--lilac)); border-radius: inherit; transition: width .4s ease; }

.quiz-card { max-width: 860px; margin: 0 auto; padding: clamp(1.2rem, 4vw, 2rem); background: linear-gradient(135deg, rgba(248, 194, 209, .22), rgba(203, 188, 240, .2)); border: 1px solid rgba(255, 255, 255, .86); border-radius: 1.1rem; }
.question-kicker, .result-kicker { margin: 0 0 .55rem; color: var(--rose); font-size: .63rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; }
.quiz-card h3 { margin-bottom: 1.25rem; font-size: clamp(1.7rem, 4vw, 2.7rem); line-height: 1.05; }
.answer-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .7rem; }
.answer-choice { display: flex; align-items: center; gap: .7rem; min-height: 3.5rem; padding: .75rem .9rem; color: var(--ink); background: rgba(255, 253, 251, .78); border: 1px solid var(--line); border-radius: .8rem; cursor: pointer; font-size: .78rem; line-height: 1.4; text-align: left; transition: transform .2s ease, border-color .2s ease, background .2s ease, box-shadow .2s ease; }
.answer-choice:hover { background: var(--paper); border-color: rgba(233, 120, 142, .4); transform: translateY(-2px); }
.answer-choice.is-selected { background: rgba(248, 194, 209, .45); border-color: var(--rose); box-shadow: 0 10px 22px rgba(233, 120, 142, .12); transform: translateY(-2px); }
.answer-letter { display: grid; flex: 0 0 1.8rem; width: 1.8rem; height: 1.8rem; place-items: center; color: var(--rose); background: rgba(248, 194, 209, .25); border-radius: 50%; font-family: var(--display); font-size: .9rem; font-weight: 700; }
.quiz-feedback { margin: 1rem 0 0; padding: .8rem .9rem; color: var(--ink); background: rgba(245, 215, 149, .3); border: 1px dashed rgba(198, 145, 55, .43); border-radius: .7rem; font-size: .78rem; line-height: 1.5; animation: pop .35s ease both; }
.quiz-feedback.is-correct { background: rgba(200, 232, 220, .48); border-color: rgba(91, 153, 127, .35); }
.quiz-feedback.is-wrong { background: rgba(248, 194, 209, .3); border-color: rgba(233, 120, 142, .35); }
.quiz-card > .button { margin-top: 1rem; }
.quiz-card > .button:disabled { cursor: not-allowed; opacity: .45; transform: none; }

.quiz-result { max-width: 700px; margin: 1rem auto 0; padding: 2rem 1rem .6rem; text-align: center; animation: pop .55s ease both; }
.result-heart { color: var(--rose); font-size: 3rem; line-height: 1; animation: heartbeat 1.2s ease-in-out infinite; }
.quiz-result h3 { margin: .5rem 0 .55rem; font-size: clamp(2rem, 5vw, 3.4rem); line-height: 1; }
.quiz-result > p:not(.result-kicker) { max-width: 520px; margin: 0 auto 1.4rem; color: var(--muted); font-size: .9rem; line-height: 1.7; }
.chosen-list { display: grid; gap: .5rem; max-width: 620px; margin: 0 auto 1.5rem; padding: 0; list-style: none; text-align: left; }
.chosen-list li { display: grid; grid-template-columns: 2rem minmax(0, 1fr); gap: .65rem; align-items: center; padding: .6rem .7rem; background: rgba(248, 194, 209, .18); border-radius: .65rem; font-size: .73rem; line-height: 1.35; }
.chosen-list li span { display: grid; width: 1.55rem; height: 1.55rem; place-items: center; color: var(--rose); background: rgba(255, 253, 251, .8); border-radius: 50%; font-size: .58rem; font-weight: 700; }
.chosen-list li strong { font-weight: 500; }
.result-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: .7rem; }

.game-panel { position: relative; overflow: hidden; background: linear-gradient(145deg, #3d3047, #59405f); color: #fffaf7; box-shadow: 0 22px 60px rgba(53, 43, 58, .2); }
.game-panel::before { position: absolute; top: -5rem; right: -4rem; width: 15rem; height: 15rem; border: 1px solid rgba(255, 255, 255, .15); border-radius: 50%; content: ""; }
.game-panel .eyebrow { color: #f4b4c5; }
.game-panel h2 { color: #fffaf7; }
.game-panel h2 em { color: #f7b6c7; }
.game-panel .panel-intro, .game-panel .game-meta { color: rgba(255, 250, 247, .72); }
.game-score { position: relative; z-index: 1; display: flex; align-items: baseline; gap: .25rem; padding: .55rem .7rem; background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .14); border-radius: .7rem; }
.game-score strong { color: #ffd9a4; font-family: var(--display); font-size: 1.55rem; }
.game-score small { color: rgba(255, 250, 247, .7); font-size: .54rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.game-meta { margin-bottom: .7rem; }
.game-meta span:first-child { color: #ffd9a4; font-family: var(--display); font-size: 1.35rem; letter-spacing: -.05em; }
.heart-arena { position: relative; min-height: 290px; overflow: hidden; background: radial-gradient(circle at 50% 45%, rgba(255, 255, 255, .13), transparent 13rem), rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .14); border-radius: 1rem; }
.game-start-card { position: absolute; top: 50%; left: 50%; display: grid; justify-items: center; gap: .7rem; width: min(300px, calc(100% - 32px)); padding: 1.5rem; background: rgba(255, 253, 251, .12); border: 1px solid rgba(255, 255, 255, .14); border-radius: 1rem; text-align: center; transform: translate(-50%, -50%); }
.game-start-card > span { color: #f7b6c7; font-family: var(--display); font-size: 3rem; line-height: .8; }
.game-start-card strong { font-family: var(--display); font-size: 1.35rem; }
.heart-target { position: absolute; display: grid; width: 3.5rem; height: 3.5rem; place-items: center; padding: 0; color: #fffaf7; background: var(--rose); border: .2rem solid rgba(255, 255, 255, .68); border-radius: 50% 50% 50% 0; box-shadow: 0 8px 22px rgba(233, 120, 142, .45); cursor: pointer; font-size: 1.6rem; transform: rotate(-45deg); animation: heart-in .22s ease both; }
.heart-target span { display: block; transform: rotate(45deg); }
.heart-target:hover { background: #f48fa5; }
.game-again { display: block; margin: 1rem auto 0; color: #fffaf7; background: rgba(255, 255, 255, .12); border-color: rgba(255, 255, 255, .2); }
.game-again:hover { background: rgba(255, 255, 255, .2); }

.memory-panel { background: linear-gradient(145deg, rgba(255, 253, 251, .95), rgba(248, 234, 255, .82) 54%, rgba(231, 245, 237, .8)); }
.memory-book-mark { display: grid; flex-shrink: 0; width: 3.4rem; height: 4rem; place-items: center; color: var(--rose); background: var(--butter); border: 1px solid rgba(198, 145, 55, .3); border-radius: .55rem; box-shadow: .35rem .35rem 0 rgba(233, 120, 142, .18); font-family: var(--display); font-size: 1.8rem; transform: rotate(4deg); }
.memory-status { margin: 0 0 1rem; padding: .85rem 1rem; color: var(--muted); background: rgba(255, 255, 255, .65); border: 1px dashed var(--line); border-radius: .75rem; font-size: .78rem; line-height: 1.5; }
.memory-status.is-ready { color: #3d765d; background: rgba(200, 232, 220, .55); border-color: rgba(91, 153, 127, .35); }
.memory-actions { display: flex; flex-wrap: wrap; gap: .7rem; }
.memory-actions .button:disabled { cursor: not-allowed; opacity: .45; transform: none; }
.memory-book-hint { margin: 1rem 0 0; color: var(--muted); font-size: .68rem; line-height: 1.6; }

.footer { display: flex; align-items: center; justify-content: center; gap: 1rem; padding: .5rem 0 2.2rem; color: var(--muted); font-size: .66rem; text-align: center; }
.footer p { margin: 0; }
.footer span { color: var(--rose); letter-spacing: .25em; }

.celebration-heart { position: fixed; z-index: 20; top: -2rem; left: 50%; color: var(--rose); font-family: var(--display); font-size: 1.7rem; pointer-events: none; animation: heart-fall 2.4s ease var(--delay) forwards; }

[hidden] { display: none !important; }

@keyframes floaty { 0%, 100% { transform: translateY(0) rotate(0); } 50% { transform: translateY(-12px) rotate(8deg); } }
@keyframes pop { 0% { opacity: 0; transform: translateY(8px) scale(.98); } 100% { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes gift-pop { 0% { opacity: 0; transform: translate(-50%, 3.4rem) scale(.55) rotate(8deg); } 70% { transform: translate(-50%, -.55rem) scale(1.04) rotate(-4deg); } 100% { opacity: 1; transform: translate(-50%, 0) scale(1) rotate(0); } }
@keyframes gift-heart-float { from { transform: translateY(3px) rotate(-8deg); } to { transform: translateY(-12px) rotate(10deg); } }
@keyframes heartbeat { 0%, 100% { transform: scale(1); } 15% { transform: scale(1.16); } 30% { transform: scale(1); } }
@keyframes heart-in { from { opacity: 0; transform: rotate(-45deg) scale(.4); } to { opacity: 1; transform: rotate(-45deg) scale(1); } }
@keyframes heart-fall { 0% { opacity: 0; transform: translate3d(0, -1rem, 0) rotate(0); } 12% { opacity: 1; } 100% { opacity: 0; transform: translate3d(var(--drift), 105vh, 0) rotate(180deg); } }

@media (max-width: 680px) {
  .page-shell { width: min(100% - 24px, 520px); }
  .topbar { min-height: 64px; }
  .topbar-note { font-size: .58rem; }
  .hero { grid-template-columns: 1fr; min-height: 0; padding: 2.1rem 1.4rem 1.6rem; }
  h1 { font-size: clamp(3.1rem, 15vw, 5rem); }
  .hero-subtitle { font-size: .9rem; }
  .hero-note { width: 9rem; height: 10rem; margin: .7rem 1rem .2rem auto; }
  .hero-note strong { font-size: 1.15rem; }
  .gift-wrap { min-height: 220px; padding-top: 3rem; }
  .gift-box { transform: scale(.9); }
  .gift-box:hover { transform: scale(.9) translateY(-5px) rotate(-2deg); }
  .gift-contents { top: .15rem; }
  .hero-decoration-one { top: 48%; right: 7%; }
  .hero-decoration-two { right: 10%; bottom: 8%; }
  .panel { padding: 1.35rem 1rem; border-radius: 1.3rem; }
  .panel-heading { gap: .7rem; }
  .panel-heading h2 { font-size: 2.8rem; }
  .vibe-stamp { margin-top: 0; padding: .45rem .55rem; }
  .vibe-stamp > :first-child { font-size: 1.05rem; }
  .answer-options { grid-template-columns: 1fr; }
  .quiz-status, .game-meta { font-size: .58rem; }
  .result-actions { align-items: stretch; flex-direction: column; }
  .result-actions .button { width: 100%; }
  .memory-actions { align-items: stretch; flex-direction: column; }
  .memory-actions .button { width: 100%; }
  .heart-arena { min-height: 250px; }
  .footer { display: grid; gap: .55rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
