@import url('https://fonts.googleapis.com/css2?family=Comic+Neue:wght@400;700&family=Pacifico&display=swap');

:root {
  --bg: #f4e8da;
  --paper: #fffaf1;
  --paper-shadow: rgba(90, 55, 38, 0.18);
  --ink: #4d3a35;
  --muted: #8f7770;
  --pink: #d8748a;
  --deep-pink: #b8536b;
  --cream: #efe1cf;
}

* {
  box-sizing: border-box;
}

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

body {
  min-height: 100vh;
  overflow: hidden;
  background:
    radial-gradient(circle at 15% 15%, rgba(255,255,255,.8), transparent 30%),
    radial-gradient(circle at 85% 80%, rgba(232,185,190,.35), transparent 28%),
    linear-gradient(135deg, #f7ecdf 0%, #efe1cf 100%);
  color: var(--ink);
  font-family: "Comic Sans MS", "Comic Neue", cursive, sans-serif;
}

button {
  font: inherit;
}

.site-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 28px 24px 24px;
  position: relative;
  z-index: 2;
}

.top-note {
  position: absolute;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  font-size: .95rem;
  color: rgba(77, 58, 53, .62);
  letter-spacing: .03em;
}

.book-wrap {
  width: min(980px, 94vw);
  height: min(690px, 76vh);
  min-height: 520px;
  display: grid;
  grid-template-columns: 66px 1fr 66px;
  align-items: center;
  gap: 6px;
}

.book {
  position: relative;
  width: 100%;
  height: 100%;
  perspective: 1800px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.book-pages {
  position: relative;
  width: min(730px, 78vw);
  height: min(620px, 70vh);
  min-height: 500px;
  transform-style: preserve-3d;
}

.page {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background:
    linear-gradient(90deg, rgba(255,255,255,.55), transparent 4%, transparent 96%, rgba(155,120,95,.06)),
    var(--paper);
  border: 1px solid rgba(88, 58, 42, .12);
  border-radius: 5px 12px 12px 5px;
  box-shadow:
    0 18px 34px var(--paper-shadow),
    inset 0 0 0 1px rgba(255,255,255,.55);
  transform-origin: left center;
  backface-visibility: hidden;
  transform-style: preserve-3d;
  transition:
    transform 900ms cubic-bezier(.62,.06,.16,1),
    box-shadow 900ms ease,
    filter 500ms ease;
}

.page::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 23px;
  width: 1px;
  background: rgba(189, 149, 126, .20);
}

.page::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 17px;
  height: 1px;
  background: rgba(189, 149, 126, .12);
}

.paper-texture {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: .32;
  background-image:
    radial-gradient(circle at 20% 20%, rgba(110, 77, 62, .09) 0 .6px, transparent .8px),
    radial-gradient(circle at 80% 30%, rgba(110, 77, 62, .07) 0 .55px, transparent .75px),
    radial-gradient(circle at 30% 78%, rgba(110, 77, 62, .06) 0 .5px, transparent .7px);
  background-size: 18px 18px, 23px 23px, 17px 17px;
  mix-blend-mode: multiply;
}

.page[data-page="1"] { z-index: 8; }
.page[data-page="2"] { z-index: 7; }
.page[data-page="3"] { z-index: 6; }
.page[data-page="4"] { z-index: 5; }
.page[data-page="5"] { z-index: 4; }
.page[data-page="6"] { z-index: 3; }
.page[data-page="7"] { z-index: 2; }
.page[data-page="8"] { z-index: 1; }

.page.turned {
  transform: rotateY(-180deg);
  box-shadow:
    -12px 18px 28px rgba(90, 55, 38, .07),
    inset 0 0 0 1px rgba(255,255,255,.35);
}

.cover-page {
  background:
    radial-gradient(circle at 50% 18%, rgba(255,255,255,.65), transparent 35%),
    linear-gradient(145deg, #f9e5db 0%, #f4ccd0 52%, #efd3bc 100%);
}

.cover-inner {
  position: relative;
  z-index: 2;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 56px;
}

.tiny-label {
  text-transform: uppercase;
  letter-spacing: .23em;
  font-size: .76rem;
  color: rgba(77, 58, 53, .58);
  margin-bottom: 12px;
}

.cover-heart {
  font-size: 2.5rem;
  color: var(--deep-pink);
  margin-bottom: 8px;
  animation: heartbeat 2.6s ease-in-out infinite;
}

.cover-page h1 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 3.45rem);
  line-height: 1.08;
  letter-spacing: .02em;
  max-width: 650px;
}

.cover-subtitle {
  margin: 22px auto 0;
  font-size: clamp(1.05rem, 1.8vw, 1.35rem);
  max-width: 530px;
  line-height: 1.45;
  color: rgba(77, 58, 53, .82);
}

.cover-sparkle {
  margin: 10px 0 0;
  color: var(--deep-pink);
  font-weight: 700;
}

.cake-line {
  margin-top: 24px;
  font-size: clamp(1rem, 1.7vw, 1.2rem);
}

.open-btn {
  margin-top: 30px;
  border: 1px solid rgba(184, 83, 107, .35);
  background: rgba(255, 250, 244, .58);
  color: var(--deep-pink);
  padding: 11px 18px;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(130, 74, 79, .10);
  transition: transform .35s ease, background .35s ease, box-shadow .35s ease;
}

.open-btn:hover {
  transform: translateY(-2px);
  background: rgba(255, 250, 244, .82);
  box-shadow: 0 12px 24px rgba(130, 74, 79, .16);
}

.cover-footer {
  position: absolute;
  bottom: 24px;
  font-size: .84rem;
  color: rgba(77, 58, 53, .54);
}

.page-inner {
  position: relative;
  z-index: 2;
  height: 100%;
  padding: 64px 78px 54px 72px;
  overflow: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(184, 83, 107, .28) transparent;
}

.page-inner::-webkit-scrollbar {
  width: 6px;
}

.page-inner::-webkit-scrollbar-thumb {
  background: rgba(184, 83, 107, .25);
  border-radius: 10px;
}

.page-number {
  position: absolute;
  right: 25px;
  top: 22px;
  z-index: 4;
  color: rgba(77, 58, 53, .34);
  font-size: .82rem;
  letter-spacing: .15em;
}

.eyebrow {
  margin: 0 0 8px;
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .16em;
  color: var(--muted);
}

h2 {
  margin: 0;
  font-size: clamp(1.75rem, 3.3vw, 2.7rem);
  line-height: 1.08;
}

p {
  font-size: clamp(1rem, 1.5vw, 1.18rem);
  line-height: 1.7;
  margin: 0 0 18px;
}

.rule {
  width: 76px;
  height: 2px;
  background: rgba(184, 83, 107, .43);
  margin: 18px 0 28px;
  transform: rotate(-1deg);
}

.little-doodle,
.moon-doodle {
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  margin: 18px auto 0;
  border: 1px dashed rgba(184,83,107,.28);
  border-radius: 50%;
  color: var(--deep-pink);
  font-size: 1.6rem;
  transform: rotate(-6deg);
}

.appreciation-list p,
.wish-list p {
  padding-left: 4px;
  margin-bottom: 14px;
}

.appreciation-list span {
  display: inline-block;
  width: 22px;
  color: var(--deep-pink);
  transform: translateY(-1px);
}

.bottom-quote {
  margin-top: 30px;
  text-align: right;
  font-size: 1rem;
  color: var(--muted);
  font-style: italic;
  transform: rotate(-1deg);
}

.centered-page {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
}

.centered-page .rule {
  margin-left: auto;
  margin-right: auto;
}

.centered-page p {
  max-width: 570px;
}

.wish-list {
  margin-top: 2px;
}

.closing-line {
  margin-top: 27px;
  font-weight: 700;
  color: var(--deep-pink);
}

.emphasis {
  margin-top: 24px;
  text-align: center;
  font-size: clamp(1.15rem, 2vw, 1.45rem);
  color: var(--deep-pink);
  font-weight: 700;
}

.signature-line {
  margin-top: 34px;
  text-align: right;
  color: var(--muted);
  font-family: "Comic Sans MS", "Comic Neue", cursive;
  font-size: 1rem;
}

.interlude-page {
  background:
    radial-gradient(circle at 50% 40%, rgba(255, 227, 226, .9), transparent 34%),
    var(--paper);
}

.dots {
  color: rgba(184,83,107,.5);
  letter-spacing: .55em;
  margin-bottom: 8px;
}

.interlude-heart {
  font-size: 3.3rem;
  color: var(--deep-pink);
  margin-bottom: 8px;
  animation: heartbeat 2.6s ease-in-out infinite;
}

.interlude-copy {
  margin-top: 12px;
  max-width: 390px;
  color: var(--muted);
}

.doodle-row {
  margin-top: 26px;
  color: var(--deep-pink);
  font-size: 1.6rem;
}

.final-page {
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 219, 223, .62), transparent 40%),
    var(--paper);
}

.final-wish {
  margin-top: 26px;
  font-size: clamp(1.2rem, 2vw, 1.5rem);
  color: var(--deep-pink);
  font-weight: 700;
}

.signoff {
  margin-top: 24px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  align-items: flex-end;
  color: var(--muted);
}

.signoff strong {
  color: var(--ink);
  font-size: 1rem;
}

.page-btn {
  width: 54px;
  height: 54px;
  border: 1px solid rgba(77, 58, 53, .14);
  border-radius: 50%;
  background: rgba(255, 250, 243, .52);
  color: rgba(77, 58, 53, .72);
  box-shadow: 0 8px 20px rgba(87, 56, 42, .09);
  cursor: pointer;
  transition:
    transform .35s ease,
    background .35s ease,
    box-shadow .35s ease,
    opacity .35s ease;
  font-size: 2rem;
  line-height: 1;
}

.page-btn span {
  display: inline-block;
  transform: translateY(-1px);
}

.page-btn:hover:not(:disabled) {
  transform: scale(1.06);
  background: rgba(255, 250, 243, .9);
  box-shadow: 0 12px 25px rgba(87, 56, 42, .13);
}

.page-btn:disabled {
  opacity: .28;
  cursor: default;
}

.bottom-controls {
  width: min(730px, 78vw);
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 14px;
  color: rgba(77, 58, 53, .53);
  font-size: .9rem;
}

.music-toggle {
  border: none;
  background: transparent;
  color: rgba(77, 58, 53, .68);
  cursor: pointer;
  padding: 6px 0;
  transition: transform .25s ease, color .25s ease;
}

.music-toggle:hover {
  transform: translateY(-1px);
  color: var(--deep-pink);
}

.hint {
  position: fixed;
  left: 50%;
  bottom: 17px;
  transform: translateX(-50%);
  padding: 8px 13px;
  border-radius: 999px;
  background: rgba(255, 250, 244, .65);
  border: 1px solid rgba(77,58,53,.1);
  color: rgba(77, 58, 53, .62);
  font-size: .82rem;
  opacity: 1;
  transition: opacity .7s ease;
  pointer-events: none;
}

.hint.hide {
  opacity: 0;
}

.ambient-glow {
  position: fixed;
  border-radius: 50%;
  filter: blur(48px);
  pointer-events: none;
  opacity: .32;
}

.glow-one {
  width: 180px;
  height: 180px;
  background: rgba(240, 181, 193, .36);
  top: 8%;
  left: 6%;
}

.glow-two {
  width: 210px;
  height: 210px;
  background: rgba(235, 205, 164, .27);
  right: 4%;
  bottom: 8%;
}

@keyframes heartbeat {
  0%, 100% { transform: scale(1); }
  12% { transform: scale(1.07); }
  22% { transform: scale(1); }
  32% { transform: scale(1.05); }
  44% { transform: scale(1); }
}

@media (max-width: 800px) {
  body {
    overflow: auto;
  }

  .site-shell {
    padding: 52px 12px 22px;
    justify-content: flex-start;
  }

  .top-note {
    top: 13px;
    font-size: .82rem;
  }

  .book-wrap {
    width: 100%;
    height: auto;
    min-height: 0;
    grid-template-columns: 42px 1fr 42px;
    gap: 3px;
  }

  .book {
    height: auto;
    min-height: 0;
  }

  .book-pages {
    width: 100%;
    height: 76vh;
    min-height: 520px;
    max-height: 760px;
  }

  .page-inner,
  .cover-inner {
    padding: 52px 30px 38px 42px;
  }

  .page::before {
    left: 16px;
  }

  .page-btn {
    width: 40px;
    height: 40px;
    font-size: 1.6rem;
  }

  .bottom-controls {
    width: 100%;
    padding: 0 3px;
    margin-top: 12px;
  }

  .hint {
    display: none;
  }
}

@media (max-width: 510px) {
  .book-pages {
    height: 74vh;
    min-height: 500px;
  }

  .page-inner,
  .cover-inner {
    padding: 50px 24px 34px 34px;
  }

  h2 {
    font-size: 1.55rem;
  }

  p {
    font-size: 1rem;
    line-height: 1.58;
  }

  .cover-page h1 {
    font-size: 1.95rem;
  }

  .cover-subtitle {
    font-size: 1rem;
  }

  .cake-line {
    font-size: .95rem;
  }

  .open-btn {
    margin-top: 22px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .page,
  .page-btn,
  .open-btn,
  .music-toggle,
  .hint {
    transition: none !important;
  }

  .cover-heart,
  .interlude-heart {
    animation: none;
  }
}
