:root {
  --ink: #17122b; --dusk: #261d4a; --card: rgba(255,255,255,.07); --line: rgba(255,255,255,.14);
  --rose: #ff8fa3; --amber: #ffd08a; --cream: #fff3e6; --muted: #c3b9e0;
  --serif: "Fraunces", Georgia, serif; --sans: "Nunito", system-ui, sans-serif; --hand: "Caveat", cursive;
}
* { box-sizing: border-box; margin: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--sans); color: var(--cream); line-height: 1.65; overflow-x: hidden;
  background: radial-gradient(120% 80% at 50% 0%, var(--dusk), var(--ink) 70%) fixed;
}
body.locked { overflow: hidden; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--amber); outline-offset: 3px; }
#sky { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; }
main, header, footer, .nav { position: relative; z-index: 1; }

/* gate */
.gate {
  position: fixed; inset: 0; z-index: 100; display: grid; place-content: center; justify-items: center; gap: 1.6rem;
  background: var(--ink); transition: opacity .8s, visibility .8s;
}
.gate.gone { opacity: 0; visibility: hidden; }
.gate-text { font-family: var(--hand); font-size: 1.8rem; color: var(--amber); text-align: center; padding: 0 1rem; }
.envelope {
  position: relative; width: 220px; height: 150px; border: 0; cursor: pointer; border-radius: 8px;
  background: var(--rose); box-shadow: 0 20px 50px rgba(0,0,0,.5); animation: float 3s ease-in-out infinite;
}
.flap {
  position: absolute; left: 0; right: 0; top: 0; height: 0; transform-origin: top;
  border-left: 110px solid transparent; border-right: 110px solid transparent; border-top: 85px solid #ff6f8a;
  transition: transform .6s;
}
.seal { position: absolute; left: 50%; top: 62px; transform: translateX(-50%); width: 44px; height: 44px; border-radius: 50%;
  display: grid; place-items: center; background: var(--amber); color: var(--ink); font-size: 1.4rem; }
.envelope:hover .flap { transform: rotateX(160deg); }
@keyframes float { 50% { transform: translateY(-10px); } }

/* progress + nav */
.progress { position: fixed; top: 0; left: 0; height: 3px; width: 0; z-index: 20; background: linear-gradient(90deg, var(--rose), var(--amber)); }
.nav {
  position: sticky; top: 0; z-index: 10; display: flex; gap: 1.2rem; justify-content: center; align-items: center; flex-wrap: wrap;
  padding: .8rem 1rem; font-size: .92rem; background: rgba(23,18,43,.72); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line);
}
.nav a { color: var(--muted); transition: color .2s; }
.nav a:hover { color: var(--amber); }
.nav a:first-child { font-family: var(--serif); color: var(--rose); font-weight: 700; }
.icon-btn { background: var(--card); border: 1px solid var(--line); border-radius: 50%; width: 34px; height: 34px; cursor: pointer; }
.icon-btn.on { background: var(--rose); color: var(--ink); }

/* hero */
.hero { min-height: 92vh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 3rem 1.2rem; }
.hero-small { font-family: var(--hand); font-size: 1.9rem; color: var(--rose); }
.hero h1 { font-family: var(--serif); font-weight: 700; font-size: clamp(2.6rem, 9vw, 6rem); line-height: 1.05; letter-spacing: -.02em; }
.hero h1 span { font-style: italic; color: var(--amber); }
.hero-sub { max-width: 34ch; margin: 1rem 0 2rem; color: var(--muted); }
.clock { display: flex; gap: clamp(.6rem, 3vw, 1.6rem); }
.clock div { min-width: 4.6rem; padding: .8rem .6rem; border-radius: 14px; background: var(--card); border: 1px solid var(--line); }
.clock b { display: block; font-family: var(--serif); font-size: clamp(1.7rem, 5vw, 2.8rem); font-variant-numeric: tabular-nums; }
.clock span { font-size: .8rem; color: var(--muted); }
.clock-note { margin-top: .9rem; color: var(--muted); }
.scroll { margin-top: 2.5rem; color: var(--rose); font-family: var(--hand); font-size: 1.4rem; animation: bob 2s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(6px); } }
body:not(.locked) .hero h1 { animation: rise 1.1s cubic-bezier(.2,.8,.2,1) both; }
@keyframes rise { from { opacity: 0; transform: translateY(30px); } to { opacity: 1; transform: none; } }

/* layout */
.block { max-width: 1000px; margin: 0 auto; padding: 5rem 1.2rem; }
.block.narrow { max-width: 680px; }
.center, .narrow { text-align: center; }
.block h2 { font-family: var(--serif); font-size: clamp(1.9rem, 5vw, 3rem); text-align: center; margin-bottom: 2rem; letter-spacing: -.01em; }
.muted { color: var(--muted); }
.muted.center { margin: -1rem 0 1.5rem; }
.reveal { opacity: 0; transform: translateY(24px); transition: opacity .7s, transform .7s; }
.reveal.in { opacity: 1; transform: none; }

.cards { display: grid; gap: 1.2rem; }
.cards.two { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.cards.grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.card { padding: 1.6rem; border-radius: 18px; text-align: center; background: var(--card); border: 1px solid var(--line); }
.card h3 { font-family: var(--serif); font-weight: 500; color: var(--amber); margin-bottom: .6rem; }
.big { font-family: var(--serif); font-size: clamp(1.4rem, 3.4vw, 2rem); line-height: 1.3; }
.stats { display: flex; flex-wrap: wrap; gap: 1rem; justify-content: center; margin-top: 1.6rem; }
.stats div { padding: .8rem 1.2rem; border-radius: 999px; background: var(--card); border: 1px solid var(--line); color: var(--muted); }
.stats b { color: var(--rose); font-family: var(--serif); margin-right: .3rem; }
.birthday-count { text-align: center; margin-top: 2rem; font-family: var(--hand); font-size: 1.7rem; color: var(--rose); }

/* timeline */
.timeline { list-style: none; padding: 0; position: relative; max-width: 640px; margin: 0 auto; }
.timeline::before { content: ""; position: absolute; left: 14px; top: 6px; bottom: 6px; width: 2px; background: linear-gradient(var(--rose), var(--amber)); }
.timeline li { position: relative; padding: 0 0 2.2rem 3rem; }
.timeline li::before { content: ""; position: absolute; left: 6px; top: 6px; width: 18px; height: 18px; border-radius: 50%; background: var(--ink); border: 3px solid var(--rose); }
.timeline time { font-family: var(--hand); font-size: 1.4rem; color: var(--amber); }
.timeline h3 { font-family: var(--serif); font-weight: 500; }
.timeline p { color: var(--muted); }

/* flip cards + coupons */
.flip { perspective: 900px; height: 150px; cursor: pointer; background: none; border: 0; padding: 0; }
.flip-in { position: relative; width: 100%; height: 100%; transition: transform .6s; transform-style: preserve-3d; }
.flip.on .flip-in { transform: rotateY(180deg); }
.face { position: absolute; inset: 0; display: grid; place-items: center; padding: 1rem; text-align: center; border-radius: 18px; border: 1px solid var(--line); backface-visibility: hidden; }
.face.front { background: var(--card); font-family: var(--serif); font-size: 1.15rem; }
.face.back { background: linear-gradient(135deg, var(--rose), var(--amber)); color: var(--ink); transform: rotateY(180deg); font-weight: 600; }
.coupon { cursor: pointer; padding: 1.4rem 1rem; border-radius: 14px; border: 2px dashed var(--amber); background: var(--card); transition: transform .2s, opacity .3s; }
.coupon:hover { transform: rotate(-1.5deg) scale(1.03); }
.coupon h3 { font-family: var(--serif); font-weight: 500; color: var(--amber); }
.coupon small { display: block; color: var(--muted); margin-top: .3rem; }
.coupon.used { opacity: .45; border-style: solid; }
.coupon.used h3 { text-decoration: line-through; }

/* gallery */
.gallery { columns: 3 220px; column-gap: 1rem; }
.shot { break-inside: avoid; margin: 0 0 1rem; border-radius: 16px; overflow: hidden; border: 1px solid var(--line); background: var(--card); cursor: zoom-in; }
.shot .ph { display: grid; place-items: center; text-align: center; padding: 1rem; color: var(--muted); font-size: .9rem; background: repeating-linear-gradient(45deg, transparent 0 12px, rgba(255,255,255,.03) 12px 24px); }
.shot img { display: block; width: 100%; transition: transform .5s; }
.shot:hover img { transform: scale(1.04); }
.shot figcaption { padding: .7rem 1rem; font-family: var(--hand); font-size: 1.3rem; color: var(--amber); }
.lightbox { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; background: rgba(10,8,20,.9); cursor: zoom-out; }
.lightbox img { max-width: 92vw; max-height: 86vh; border-radius: 12px; }

/* quiz */
.quiz { text-align: left; padding: 1.6rem; border-radius: 18px; background: var(--card); border: 1px solid var(--line); }
.quiz .q { font-family: var(--serif); font-size: 1.3rem; margin-bottom: 1rem; }
.opt { display: block; width: 100%; text-align: left; margin-bottom: .6rem; padding: .7rem 1rem; border-radius: 12px; border: 1px solid var(--line); background: transparent; cursor: pointer; transition: background .2s; }
.opt:hover:not(:disabled) { background: rgba(255,255,255,.1); }
.opt.right { background: #2c7a5b; border-color: #2c7a5b; }
.opt.wrong { background: #8a3550; border-color: #8a3550; }
.quiz .step { color: var(--muted); font-size: .9rem; margin-bottom: .4rem; }
.quiz .score { font-family: var(--serif); font-size: 1.6rem; text-align: center; }

/* letter */
.paper { min-height: 220px; padding: 2rem; margin-bottom: 1.5rem; border-radius: 6px; background: var(--cream); color: #3a2a2a; font-family: var(--hand); font-size: 1.55rem; line-height: 1.5; text-align: left; box-shadow: 0 18px 40px rgba(0,0,0,.35); transform: rotate(-1deg); white-space: pre-line; }
.btn { font-weight: 600; cursor: pointer; padding: .8rem 1.8rem; border-radius: 999px; border: 0; background: var(--rose); color: var(--ink); transition: transform .2s, background .2s; }
.btn:hover { transform: translateY(-2px) scale(1.03); background: var(--amber); }
.big-btn { font-size: 1.3rem; padding: 1rem 2.4rem; margin-top: 1rem; }

/* cake */
.cake { position: relative; width: 220px; margin: 3rem auto 1.5rem; }
.tier { margin: 0 auto; border-radius: 10px 10px 4px 4px; }
.t1 { width: 140px; height: 60px; background: var(--rose); }
.t2 { width: 220px; height: 80px; background: var(--amber); box-shadow: inset 0 14px 0 var(--cream); }
.candles { position: absolute; top: -44px; left: 0; right: 0; display: flex; justify-content: center; gap: 22px; }
.candle { position: relative; width: 10px; height: 44px; border-radius: 3px; background: var(--cream); cursor: pointer; border: 0; padding: 0; }
.candle::before { content: ""; position: absolute; left: 50%; top: -20px; width: 12px; height: 18px; transform: translateX(-50%); border-radius: 50% 50% 50% 50% / 65% 65% 35% 35%; background: radial-gradient(#fff6c8, #ffb347 70%); animation: flicker .3s infinite alternate; }
.candle.out::before { display: none; }
@keyframes flicker { to { transform: translateX(-50%) scale(1.1, .92); } }
.surprise { max-width: 40ch; margin: 2rem auto 0; font-family: var(--serif); font-size: 1.5rem; }
.foot { text-align: center; padding: 3rem 1rem; color: var(--muted); font-size: .9rem; }

@media (max-width: 560px) { .nav { gap: .8rem; font-size: .82rem; } .clock div { min-width: 3.6rem; } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } .reveal { opacity: 1; transform: none; } }