:root {
    --pink: #ff6fae;
    --pink-soft: #ffd6e8;
    --violet: #8b5cf6;
    --violet-deep: #4c1d95;
    --cream: #fff8fb;
    --text: #3f2745;
    --muted: #7c607e;
    --white: #ffffff;
    --shadow: 0 16px 36px rgba(117, 36, 112, 0.18);
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    min-height: 100vh;
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at 20% 15%, rgba(255, 214, 232, 0.95), transparent 28%),
        radial-gradient(circle at 88% 12%, rgba(206, 188, 255, 0.9), transparent 24%),
        linear-gradient(135deg, #fff7fb 0%, #ffe3f0 44%, #efe6ff 100%);
    overflow-x: hidden;
}

button {
    font: inherit;
}

.effect-canvas {
    position: fixed;
    inset: 0;
    z-index: 20;
    width: 100%;
    height: 100%;
    opacity: 0;
    pointer-events: none;
    transform: translate3d(0, 0, 0);
}

.effect-canvas.is-running {
    opacity: 1;
}

.gift-screen {
    position: fixed;
    inset: 0;
    z-index: 10;
    display: none;
    place-items: center;
    padding: 24px;
    overflow: hidden;
    background:
        radial-gradient(circle at 18% 18%, rgba(255, 142, 205, 0.42), transparent 24%),
        radial-gradient(circle at 84% 14%, rgba(94, 234, 212, 0.22), transparent 24%),
        radial-gradient(circle at 50% 86%, rgba(167, 139, 250, 0.34), transparent 28%),
        linear-gradient(135deg, #31135f 0%, #7c2d92 42%, #ff7ab8 100%);
    transition: opacity 0.42s ease, transform 0.42s ease;
    will-change: opacity, transform;
}

.gift-screen.is-active {
    display: grid;
}

.gift-screen.is-leaving {
    opacity: 0;
    transform: scale(1.04);
}

.intro-stars,
.intro-stars::before,
.intro-stars::after {
    position: absolute;
    inset: 0;
    background-image:
        radial-gradient(circle, rgba(255, 255, 255, 0.95) 0 1px, transparent 1.5px),
        radial-gradient(circle, rgba(255, 237, 250, 0.8) 0 1px, transparent 1.5px);
    background-position: 0 0, 42px 58px;
    background-size: 96px 96px, 142px 142px;
    opacity: 0.58;
    pointer-events: none;
}

.intro-stars::before,
.intro-stars::after {
    content: "";
}

.intro-stars::before {
    opacity: 0.45;
    transform: translate3d(0, 0, 0) scale(1.25);
}

.intro-stars::after {
    opacity: 0.35;
    transform: translate3d(0, 0, 0) scale(0.82);
}

.intro-photo-cloud {
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
}

.intro-photo {
    --px: 0px;
    --py: 0px;
    --rotate: -8deg;
    --float: -14px;
    position: absolute;
    width: clamp(118px, 15vw, 190px);
    margin: 0;
    padding: 9px 9px 13px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 12px 24px rgba(30, 11, 58, 0.18);
    color: #6a3d70;
    text-align: center;
    transform: translate3d(var(--px), var(--py), 0) rotate(var(--rotate));
    transition: transform 0.22s ease;
    contain: layout paint;
}

.intro-photo img,
.intro-photo-placeholder span {
    display: block;
    width: 100%;
    aspect-ratio: 1 / 1;
    border-radius: 6px;
}

.intro-photo img {
    object-fit: cover;
}

.intro-photo figcaption {
    margin-top: 8px;
    font-size: 0.78rem;
    font-weight: 700;
    line-height: 1.25;
}

.intro-photo-placeholder span {
    display: grid;
    place-items: center;
    border: 1px dashed rgba(139, 92, 246, 0.38);
    background: linear-gradient(135deg, rgba(255, 214, 232, 0.8), rgba(224, 214, 255, 0.82));
    color: var(--pink);
    font-size: 3rem;
}

.intro-photo-one {
    top: 12%;
    left: 7%;
}

.intro-photo-two {
    right: 7%;
    top: 16%;
    --rotate: 8deg;
    --float: 16px;
    animation-delay: -1.6s;
}

.intro-photo-three {
    left: 11%;
    bottom: 12%;
    --rotate: 7deg;
    --float: 12px;
    animation-delay: -3s;
}

.gift-wrap {
    position: relative;
    z-index: 3;
    width: min(680px, 100%);
    text-align: center;
}

.intro-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 14px;
    padding: 9px 14px;
    border: 1px solid rgba(255, 255, 255, 0.26);
    border-radius: 999px;
    color: rgba(255, 255, 255, 0.92);
    background: rgba(255, 255, 255, 0.12);
    box-shadow: 0 10px 26px rgba(45, 12, 68, 0.18);
}

.intro-eyebrow span {
    font-weight: 700;
}

.small-title {
    margin: 0 0 10px;
    color: var(--violet);
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
}

.gift-wrap h1 {
    margin: 0 auto 12px;
    max-width: 720px;
    color: var(--white);
    font-size: clamp(2.35rem, 7vw, 5.4rem);
    line-height: 0.98;
    text-shadow: 0 8px 20px rgba(35, 8, 62, 0.28);
}

.intro-subtitle {
    margin: 0 auto 30px;
    color: rgba(255, 255, 255, 0.88);
    font-size: clamp(1rem, 2vw, 1.24rem);
    line-height: 1.55;
}

.gift-box {
    position: relative;
    display: block;
    width: min(250px, 62vw);
    height: min(230px, 56vw);
    margin: 0 auto 28px;
    border: 0;
    background: transparent;
    cursor: pointer;
    transform: translate3d(0, 0, 0);
    transition: transform 0.22s ease;
}

.gift-body,
.gift-lid {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    border-radius: 8px;
    background: linear-gradient(135deg, #ff75b6, #a855f7);
}

.gift-glow {
    position: absolute;
    left: 50%;
    bottom: 8%;
    z-index: -1;
    width: 80%;
    height: 42%;
    border-radius: 999px;
    background: rgba(255, 244, 163, 0.46);
    opacity: 0.72;
    transform: translate3d(-50%, 0, 0);
}

.gift-body {
    bottom: 0;
    width: 76%;
    height: 58%;
}

.gift-lid {
    top: 38px;
    width: 88%;
    height: 24%;
    transition: transform 0.45s ease;
    will-change: transform;
}

.gift-box:hover .gift-lid {
    transform: translate3d(-50%, -12px, 0) rotate(-4deg);
}

.gift-ribbon-vertical,
.gift-ribbon-horizontal {
    position: absolute;
    z-index: 2;
    left: 50%;
    transform: translateX(-50%);
    background: #fff1a8;
    box-shadow: inset 0 0 12px rgba(255, 190, 70, 0.35);
}

.gift-ribbon-vertical {
    bottom: 0;
    width: 18%;
    height: 82%;
    border-radius: 6px;
}

.gift-ribbon-horizontal {
    top: 52%;
    width: 76%;
    height: 15%;
    border-radius: 999px;
}

.gift-sparkle {
    position: absolute;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #fff4a3;
    opacity: 0.75;
}

.sparkle-one {
    top: 12px;
    left: 18%;
}

.sparkle-two {
    top: 4px;
    right: 20%;
    animation-delay: 0.25s;
}

.sparkle-three {
    top: 92px;
    right: 5%;
    animation-delay: 0.5s;
}

.primary-btn,
.music-btn {
    border: 0;
    border-radius: 999px;
    color: var(--white);
    background: linear-gradient(135deg, var(--pink), var(--violet));
    box-shadow: 0 10px 24px rgba(139, 92, 246, 0.24);
    cursor: pointer;
    transition: transform 0.2s ease;
    will-change: transform;
}

.primary-btn {
    padding: 15px 28px;
    font-size: 1.05rem;
    font-weight: 700;
}

.intro-open-btn {
    position: relative;
    isolation: isolate;
    min-width: 190px;
    min-height: 54px;
    border: 1px solid rgba(255, 255, 255, 0.28);
    background: linear-gradient(135deg, #ff5ba7, #8b5cf6 58%, #22d3ee);
    box-shadow:
        0 18px 42px rgba(72, 18, 99, 0.34),
        0 0 0 0 rgba(255, 255, 255, 0.42);
}

.intro-open-btn::before {
    content: "";
    position: absolute;
    inset: -2px;
    z-index: -1;
    border-radius: inherit;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.7), rgba(255, 111, 174, 0.3), rgba(34, 211, 238, 0.5));
    opacity: 0;
    transition: opacity 0.22s ease;
}

.intro-open-btn::after {
    content: "";
    position: absolute;
    inset: -8px;
    z-index: -2;
    border-radius: inherit;
    border: 1px solid rgba(255, 255, 255, 0.48);
    opacity: 0.36;
    transform: scale(1);
}

.intro-open-btn:hover,
.intro-open-btn:focus-visible {
    transform: translate3d(0, -4px, 0) scale(1.02);
}

.intro-open-btn:hover::before,
.intro-open-btn:focus-visible::before {
    opacity: 1;
}

.primary-btn:hover,
.music-btn:hover {
    transform: translate3d(0, -2px, 0);
    box-shadow: 0 12px 28px rgba(139, 92, 246, 0.3);
}

.birthday-page {
    position: relative;
    z-index: 3;
    display: none;
    width: min(1120px, calc(100% - 32px));
    margin: 0 auto;
    padding: 22px 0 44px;
}

.birthday-page.is-active {
    display: block;
    animation: pageReveal 0.68s ease both;
}

@keyframes pageReveal {
    from {
        opacity: 0;
        transform: translate3d(0, 18px, 0);
    }
    to {
        opacity: 1;
        transform: translate3d(0, 0, 0);
    }
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 0 22px;
}

.topbar h2 {
    margin: 0;
    color: var(--violet-deep);
}

.music-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 42px;
    padding: 10px 16px;
    white-space: nowrap;
}

.hero-section {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(280px, 0.85fr);
    align-items: center;
    gap: 28px;
    min-height: 560px;
}

.hero-copy h1 {
    margin: 0 0 22px;
    color: var(--violet-deep);
    font-size: clamp(2.35rem, 7vw, 5.2rem);
    line-height: 1.02;
}

.hero-copy h1 span {
    color: var(--pink);
}

.date-label {
    margin: 0 0 12px;
    color: var(--muted);
    font-weight: 700;
}

.typed-card {
    display: flex;
    align-items: flex-start;
    min-height: 176px;
    padding: 22px;
    border: 1px solid rgba(255, 111, 174, 0.26);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.82);
    box-shadow: var(--shadow);
}

.typed-message {
    font-size: clamp(1rem, 2vw, 1.18rem);
    line-height: 1.8;
    color: #4b3152;
}

.typed-line {
    display: block;
}

.typing-cursor {
    width: 2px;
    height: 1.4em;
    margin: 8px 0 0 4px;
    background: var(--pink);
    animation: blink 0.8s infinite;
}

@keyframes blink {
    50% {
        opacity: 0;
    }
}

.cake-scene {
    position: relative;
    min-height: 420px;
    border-radius: 8px;
    background:
        radial-gradient(circle at 50% 22%, rgba(255, 255, 255, 0.72), transparent 24%),
        linear-gradient(160deg, rgba(255, 196, 226, 0.75), rgba(181, 150, 255, 0.68));
    box-shadow: var(--shadow);
    overflow: hidden;
}

.moon {
    position: absolute;
    top: 52px;
    right: 50px;
    width: 74px;
    height: 74px;
    border-radius: 50%;
    background: #fff8bc;
    box-shadow: 0 0 22px rgba(255, 248, 188, 0.75);
}

.cake {
    position: absolute;
    left: 50%;
    bottom: 56px;
    width: 270px;
    height: 230px;
    transform: translateX(-50%);
}

.cake-top,
.cake-mid,
.cake-bottom {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    border-radius: 16px 16px 8px 8px;
}

.cake-top {
    bottom: 116px;
    width: 170px;
    height: 56px;
    background: #fff3f8;
}

.cake-mid {
    bottom: 62px;
    width: 220px;
    height: 70px;
    background: #ff8fc5;
}

.cake-bottom {
    bottom: 0;
    width: 270px;
    height: 82px;
    background: #9b6cf5;
}

.candle {
    position: absolute;
    left: 50%;
    bottom: 172px;
    z-index: 3;
    width: 18px;
    height: 58px;
    transform: translateX(-50%);
    border-radius: 999px;
    background: repeating-linear-gradient(45deg, #ffffff 0 8px, #ff6fae 8px 16px);
}

.candle span {
    position: absolute;
    left: 50%;
    top: -28px;
    width: 22px;
    height: 30px;
    transform: translateX(-50%);
    border-radius: 50% 50% 50% 0;
    background: #ffd166;
    box-shadow: 0 0 18px #ffd166;
    animation: flame 0.9s ease-in-out infinite alternate;
    will-change: transform;
}

.is-paused .candle span {
    animation-play-state: paused;
}

@keyframes flame {
    to {
        transform: translateX(-50%) scale(1.12) rotate(6deg);
    }
}

.section-block {
    padding: 46px 0 10px;
    content-visibility: auto;
    contain-intrinsic-size: 520px;
}

.section-heading {
    margin-bottom: 20px;
}

.section-heading h2 {
    margin: 0;
    color: var(--violet-deep);
    font-size: clamp(1.65rem, 4vw, 2.6rem);
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}

.photo-card {
    min-height: 230px;
    padding: 18px;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--photo-a), var(--photo-b));
    box-shadow: 0 10px 24px rgba(117, 36, 112, 0.12);
    color: var(--white);
    overflow: hidden;
}

.photo-card img {
    display: block;
    width: 100%;
    height: 190px;
    object-fit: cover;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.26);
}

.photo-placeholder {
    display: grid;
    place-items: center;
    height: 190px;
    border: 1px dashed rgba(255, 255, 255, 0.8);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.16);
    font-size: 2.4rem;
}

.photo-card h3 {
    margin: 14px 0 4px;
    font-size: 1.05rem;
}

.photo-card p {
    margin: 0;
    line-height: 1.5;
}

.timeline {
    position: relative;
    display: grid;
    gap: 14px;
}

.timeline::before {
    content: "";
    position: absolute;
    left: 18px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: rgba(139, 92, 246, 0.24);
}

.timeline-item {
    position: relative;
    padding: 16px 18px 16px 54px;
    border: 1px solid rgba(139, 92, 246, 0.16);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.7);
    box-shadow: 0 8px 18px rgba(117, 36, 112, 0.08);
}

.timeline-dot {
    position: absolute;
    left: 10px;
    top: 21px;
    width: 18px;
    height: 18px;
    border: 4px solid #fff;
    border-radius: 50%;
    background: var(--pink);
    box-shadow: 0 0 0 4px rgba(255, 111, 174, 0.24);
}

.timeline-item time {
    color: var(--violet);
    font-weight: 700;
}

.timeline-item h3 {
    margin: 8px 0 6px;
}

.timeline-item p {
    margin: 0;
    color: var(--muted);
    line-height: 1.6;
}

.footer-note {
    padding: 34px 0 8px;
    text-align: center;
    color: var(--muted);
}

@media (max-width: 820px) {
    .birthday-page {
        width: min(100% - 24px, 680px);
    }

    .topbar {
        align-items: flex-start;
    }

    .hero-section {
        grid-template-columns: 1fr;
        min-height: auto;
        padding-top: 20px;
    }

    .cake-scene {
        min-height: 340px;
    }

    .gallery-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .intro-photo {
        width: clamp(96px, 23vw, 132px);
        padding: 7px 7px 10px;
    }

    .intro-photo figcaption {
        font-size: 0.68rem;
    }

    .intro-photo-one {
        top: 8%;
        left: 4%;
    }

    .intro-photo-two {
        top: 9%;
        right: 4%;
    }

    .intro-photo-three {
        left: auto;
        right: 8%;
        bottom: 9%;
    }
}

@media (max-width: 560px) {
    .topbar {
        flex-direction: column;
    }

    .music-btn {
        width: 100%;
        justify-content: center;
    }

    .typed-card {
        min-height: 230px;
        padding: 18px;
    }

    .cake {
        transform: translateX(-50%) scale(0.82);
    }

    .gallery-grid {
        grid-template-columns: 1fr;
    }

    .photo-card {
        min-height: 210px;
    }

    .gift-screen {
        padding: 18px;
    }

    .gift-wrap {
        padding-top: 54px;
    }

    .gift-wrap h1 {
        font-size: clamp(2.08rem, 12vw, 3.8rem);
    }

    .intro-subtitle {
        margin-bottom: 22px;
    }

    .gift-box {
        width: min(210px, 58vw);
        height: min(192px, 52vw);
        margin-bottom: 22px;
    }

    .intro-photo {
        width: 92px;
        opacity: 0.88;
    }

    .intro-photo-one {
        top: 16px;
        left: 12px;
    }

    .intro-photo-two {
        top: 18px;
        right: 12px;
    }

    .intro-photo-three {
        display: none;
    }

    .intro-stars::before,
    .intro-stars::after {
        display: none;
    }

    .typing-cursor,
    .candle span {
        animation: none;
    }
}

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

    .effect-canvas {
        display: none;
    }
}
