/* ================================================================
   diplomatic.boo — Confetti cannon in an embassy ballroom
   Palette: candy-bright | Layout: card-grid pinboard
   Fonts: Lilita One, Outfit, Patrick Hand
   ================================================================ */

:root {
    --strawberry-pop: #FF4F81;
    --lemon-fizz:     #FFD23F;
    --sky-bounce:     #3EC1D3;
    --grape-burst:    #A855F7;
    --tangerine:      #FF8C42;
    --buttercream:    #FFF5E6;
    --blackberry:     #1E1333;
    --blush-mist:     #FFE8EC;
    --paper-white:    #FFFAF5;
    --pinboard-thread: #E8B4B8;

    --font-display: 'Lilita One', 'Inter', sans-serif;
    --font-body:    'Outfit', 'Inter', sans-serif;
    --font-hand:    'Patrick Hand', 'Outfit', cursive;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    width: 100%;
    overflow-x: hidden;
}

body {
    font-family: var(--font-body);
    color: var(--blackberry);
    background: var(--buttercream);
    line-height: 1.6;
    min-height: 100vh;
    position: relative;
    -webkit-font-smoothing: antialiased;
}

/* --- Pinboard crosshatch texture --- */
.pinboard-texture {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    background-image:
        repeating-linear-gradient(45deg,
            rgba(232, 180, 184, 0.08) 0,
            rgba(232, 180, 184, 0.08) 1px,
            transparent 1px,
            transparent 14px),
        repeating-linear-gradient(-45deg,
            rgba(232, 180, 184, 0.08) 0,
            rgba(232, 180, 184, 0.08) 1px,
            transparent 1px,
            transparent 14px);
}

/* --- Confetti & Balloon background fields --- */
.confetti-field, .balloon-field {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 1;
    overflow: hidden;
}

.confetti-piece {
    position: absolute;
    width: 6px;
    height: 10px;
    border-radius: 2px;
    will-change: transform;
}

.balloon-piece {
    position: absolute;
    width: 26px;
    height: 32px;
    border-radius: 50%;
    opacity: 0.6;
    will-change: transform;
}

.balloon-piece::after {
    content: "";
    position: absolute;
    bottom: -4px;
    left: 50%;
    width: 6px;
    height: 6px;
    background: inherit;
    transform: translateX(-50%) rotate(45deg);
    border-radius: 1px;
}

.balloon-piece::before {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    width: 1px;
    height: 40px;
    background: rgba(30, 19, 51, 0.3);
    transform: translateX(-50%);
}

.star-sparkle {
    position: absolute;
    width: 8px;
    height: 8px;
    background: var(--lemon-fizz);
    clip-path: polygon(50% 0, 60% 40%, 100% 50%, 60% 60%, 50% 100%, 40% 60%, 0 50%, 40% 40%);
    pointer-events: none;
    will-change: transform, opacity;
}

/* --- Page layout --- */
.page {
    position: relative;
    z-index: 2;
    max-width: 1320px;
    margin: 0 auto;
    padding: clamp(40px, 6vw, 80px) clamp(20px, 4vw, 48px) 80px;
}

.phase {
    position: relative;
    padding: clamp(40px, 8vh, 100px) 0;
}

/* ================================================================
   PHASE 1: THE INVITATION
   ================================================================ */
.phase-invitation {
    min-height: 90vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    flex-direction: column;
}

.party-burst-bg {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 80vw;
    height: 80vw;
    max-width: 900px;
    max-height: 900px;
    transform: translate(-50%, -50%);
    background: conic-gradient(from 45deg,
        #FF4F81, #FFD23F, #3EC1D3, #A855F7, #FF8C42, #FF4F81);
    opacity: 0.2;
    filter: blur(80px);
    border-radius: 50%;
    pointer-events: none;
    z-index: 0;
    animation: slowSpin 40s linear infinite;
}

.hero {
    position: relative;
    z-index: 2;
    width: 100%;
}

.letter-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: clamp(4px, 0.6vw, 8px);
    margin-bottom: clamp(20px, 3vw, 36px);
}

.letter-card {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-display);
    font-size: clamp(2.6rem, 9vw, 7rem);
    line-height: 1;
    color: var(--paper-white);
    background: var(--letter-color, var(--strawberry-pop));
    border-radius: 16px;
    padding: 0.1em 0.18em;
    min-width: 0.7em;
    box-shadow:
        inset 0 2px 0 rgba(255, 255, 255, 0.3),
        0 6px 0 rgba(0, 0, 0, 0.08),
        0 14px 30px rgba(255, 79, 129, 0.18);
    transform: rotate(var(--rot, 0deg)) translateY(0);
    opacity: 0;
    animation: letterPop 0.7s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    animation-delay: calc(var(--i, 0) * 70ms);
}

.letter-card.dot {
    background: transparent;
    color: var(--blackberry);
    box-shadow: none;
    min-width: 0.4em;
}

@keyframes letterPop {
    0% { opacity: 0; transform: scale(0.2) rotate(-12deg) translateY(80px); }
    40% { opacity: 1; transform: scale(1.18) rotate(4deg) translateY(-12px); }
    65% { transform: scale(0.94) rotate(-2deg) translateY(4px); }
    80% { transform: scale(1.04) rotate(1deg) translateY(-2px); }
    100% { transform: scale(1) rotate(var(--rot, 0deg)) translateY(0); }
}

.hero-tagline {
    font-family: var(--font-hand);
    font-size: clamp(1.05rem, 2vw, 1.4rem);
    color: var(--strawberry-pop);
    margin-bottom: clamp(40px, 6vw, 70px);
    opacity: 0;
    animation: fadeInUp 0.8s 1.2s ease-out forwards;
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.welcome-envelope {
    position: relative;
    width: clamp(220px, 30vw, 360px);
    height: clamp(160px, 22vw, 260px);
    margin: 0 auto;
    opacity: 0;
    animation: fadeInUp 0.8s 1.6s ease-out forwards;
}

.big-envelope {
    position: absolute;
    inset: 0;
    background: var(--blush-mist);
    border-radius: 12px;
    box-shadow:
        inset 0 2px 0 rgba(255, 255, 255, 0.5),
        0 12px 40px rgba(255, 79, 129, 0.18);
}

.env-flap {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 60%;
    background: var(--strawberry-pop);
    clip-path: polygon(0 0, 50% 80%, 100% 0);
    transform-origin: top center;
    transition: transform 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.env-body {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.env-seal {
    position: absolute;
    top: 38%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 36px;
    height: 36px;
    background: var(--lemon-fizz);
    border-radius: 50%;
    box-shadow:
        inset 0 2px 0 rgba(255, 255, 255, 0.4),
        0 3px 0 rgba(218, 161, 26, 0.6);
}

.env-seal::after {
    content: "";
    position: absolute;
    inset: 30%;
    background: var(--strawberry-pop);
    clip-path: polygon(50% 0, 60% 40%, 100% 50%, 60% 60%, 50% 100%, 40% 60%, 0 50%, 40% 40%);
}

.welcome-envelope:hover .env-flap {
    transform: rotateX(-180deg);
}

/* --- Ambassador Boo (welcoming character) --- */
.ambassador-boo {
    position: absolute;
    width: 100px;
    height: 100px;
    bottom: -30px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 3;
}

.ambassador-boo.big {
    width: 140px;
    height: 140px;
    bottom: -40px;
}

.ambassador-boo::before {
    content: "";
    position: absolute;
    inset: 0;
    background: var(--strawberry-pop);
    border-radius: 48% 48% 50% 50%;
    box-shadow:
        inset 0 3px 0 rgba(255, 255, 255, 0.3),
        0 6px 0 rgba(180, 40, 80, 0.5);
    animation: ambassadorBounce 2.5s ease-in-out infinite;
}

@keyframes ambassadorBounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

.ambassador-boo .char-eye {
    position: absolute;
    top: 35%;
    width: 22%;
    height: 24%;
    background: var(--paper-white);
    border-radius: 50%;
    z-index: 2;
    animation: ambassadorBounce 2.5s ease-in-out infinite;
}

.ambassador-boo .char-eye.left { left: 22%; }
.ambassador-boo .char-eye.right { right: 22%; }

.ambassador-boo .pupil {
    position: absolute;
    top: 30%;
    left: 30%;
    width: 40%;
    height: 40%;
    background: var(--blackberry);
    border-radius: 50%;
    transition: transform 0.2s ease-out;
}

.ambassador-boo .char-bowtie {
    position: absolute;
    bottom: 18%;
    left: 50%;
    width: 30%;
    height: 14%;
    transform: translateX(-50%);
    z-index: 2;
    animation: ambassadorBounce 2.5s ease-in-out infinite;
}

.ambassador-boo .char-bowtie::before,
.ambassador-boo .char-bowtie::after {
    content: "";
    position: absolute;
    top: 0;
    width: 50%;
    height: 100%;
    background: var(--lemon-fizz);
}

.ambassador-boo .char-bowtie::before {
    left: 0;
    clip-path: polygon(0 0, 100% 50%, 0 100%);
}

.ambassador-boo .char-bowtie::after {
    right: 0;
    clip-path: polygon(100% 0, 0 50%, 100% 100%);
}

.ambassador-boo .char-arm {
    position: absolute;
    top: 38%;
    width: 18%;
    height: 22%;
    background: var(--strawberry-pop);
    border-radius: 50%;
    z-index: 1;
    animation: ambassadorBounce 2.5s ease-in-out infinite;
}

.ambassador-boo .char-arm.left { left: -6%; transform: rotate(-30deg); }
.ambassador-boo .char-arm.right { right: -6%; transform: rotate(30deg); }

@keyframes slowSpin {
    from { transform: translate(-50%, -50%) rotate(0deg); }
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* ================================================================
   PHASE 2: CARD GRID
   ================================================================ */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: clamp(20px, 3.5vw, 36px);
    grid-auto-flow: dense;
    grid-auto-rows: minmax(360px, auto);
}

.card {
    --tilt: calc((var(--card-seed, 0.5) - 0.5) * 4deg);
    position: relative;
    transform: rotate(var(--tilt));
    opacity: 0;
    transition: transform 0.4s ease-out, box-shadow 0.4s ease-out;
}

.card.in-view {
    animation: partyBounce 1s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    animation-delay: calc(var(--card-index, 0) * 100ms);
}

@keyframes partyBounce {
    0% { opacity: 0; transform: scale(0.2) rotate(calc(var(--tilt) * 3)) translateY(80px); }
    40% { opacity: 1; transform: scale(1.12) rotate(calc(var(--tilt) * -0.5)) translateY(-12px); }
    65% { transform: scale(0.94) rotate(calc(var(--tilt) * 0.3)) translateY(5px); }
    80% { transform: scale(1.04) rotate(var(--tilt)) translateY(-2px); }
    100% { opacity: 1; transform: scale(1) rotate(var(--tilt)) translateY(0); }
}

.invitation-card {
    aspect-ratio: 4/5;
}

.banner-card {
    grid-column: span 2;
    aspect-ratio: 5/2;
}

.surprise-card {
    grid-row: span 2;
    aspect-ratio: 4/9;
}

.card-shell {
    position: relative;
    width: 100%;
    height: 100%;
    background: color-mix(in srgb, var(--accent) 15%, var(--paper-white));
    border: 3px solid color-mix(in srgb, var(--accent) 40%, transparent);
    border-radius: 28px;
    padding: 4px;
    overflow: hidden;
    transition: box-shadow 0.4s ease-out;
}

.card:hover .card-shell {
    box-shadow: 0 16px 48px color-mix(in srgb, var(--accent) 30%, transparent);
}

.card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    background: var(--paper-white);
    border-radius: 24px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Card shimmer sweep */
.card-inner::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(110deg,
        transparent 30%,
        rgba(255, 255, 255, 0.4) 50%,
        transparent 70%);
    transform: translateX(-100%);
    transition: transform 0.8s ease-out;
    pointer-events: none;
    z-index: 5;
}

.card:hover .card-inner::before {
    transform: translateX(100%);
}

.card:hover {
    z-index: 10;
}

/* Invitation card layout */
.illustration-zone {
    position: relative;
    flex: 0 0 65%;
    overflow: hidden;
}

.gradient-pink   { background: linear-gradient(135deg, #FFE8EC, #FFD0DA); }
.gradient-yellow { background: linear-gradient(135deg, #FFF4D0, #FFE9A8); }
.gradient-cyan   { background: linear-gradient(135deg, #D0F0F4, #A8E4ED); }
.gradient-orange { background: linear-gradient(135deg, #FFE0CC, #FFC8A0); }
.gradient-cream  { background: linear-gradient(135deg, #FFFAF0, #FFE8B8); }
.gradient-tangerine { background: linear-gradient(135deg, #FFD6B5, #FFB87A); }

.caption-strip {
    flex: 0 0 35%;
    padding: clamp(14px, 2vw, 22px);
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
}

.card-title {
    font-family: var(--font-display);
    font-size: clamp(1.2rem, 2.4vw, 1.8rem);
    line-height: 1.05;
    color: var(--blackberry);
    margin: 0;
}

.card-desc {
    font-family: var(--font-body);
    font-size: clamp(0.85rem, 1.4vw, 1rem);
    color: var(--blackberry);
    opacity: 0.75;
    line-height: 1.4;
}

.badge {
    position: absolute;
    top: 8px;
    right: 12px;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: var(--strawberry-pop);
    color: var(--paper-white);
    font-family: var(--font-display);
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow:
        inset 0 2px 0 rgba(255, 255, 255, 0.3),
        0 3px 0 rgba(180, 40, 80, 0.4);
    transform: rotate(-8deg);
}

.badge.yellow { background: var(--lemon-fizz); color: var(--blackberry); box-shadow: inset 0 2px 0 rgba(255,255,255,0.3), 0 3px 0 rgba(218,161,26,0.5); }
.badge.cyan   { background: var(--sky-bounce); box-shadow: inset 0 2px 0 rgba(255,255,255,0.3), 0 3px 0 rgba(50,140,160,0.5); }
.badge.purple { background: var(--grape-burst); box-shadow: inset 0 2px 0 rgba(255,255,255,0.3), 0 3px 0 rgba(110,40,180,0.5); }
.badge.orange { background: var(--tangerine); box-shadow: inset 0 2px 0 rgba(255,255,255,0.3), 0 3px 0 rgba(190,90,30,0.5); }

/* ================================================================
   BANNER CARDS — Scalloped party banners
   ================================================================ */
.banner-inner {
    background: linear-gradient(135deg, #FFE8EC, #FFFAF5);
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 30px 24px;
    position: relative;
}

.scallop-top, .scallop-bottom {
    position: absolute;
    left: 0;
    right: 0;
    height: 14px;
    background: var(--accent);
    -webkit-mask: radial-gradient(circle at 14px 0, transparent 12px, black 12.5px) 0 0 / 28px 14px;
            mask: radial-gradient(circle at 14px 0, transparent 12px, black 12.5px) 0 0 / 28px 14px;
}

.scallop-top { top: 0; }
.scallop-bottom {
    bottom: 0;
    -webkit-mask: radial-gradient(circle at 14px 14px, transparent 12px, black 12.5px) 0 0 / 28px 14px;
            mask: radial-gradient(circle at 14px 14px, transparent 12px, black 12.5px) 0 0 / 28px 14px;
    transition: transform 0.5s ease-in-out;
}

.banner-card:hover .scallop-bottom { transform: translateY(2px); }
.banner-card:hover .scallop-top { transform: translateY(-2px); }

.banner-illustration {
    position: relative;
    width: 100%;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
}

.banner-title {
    font-family: var(--font-display);
    font-size: clamp(1.4rem, 3vw, 2.4rem);
    color: var(--blackberry);
    line-height: 1.05;
}

.streamer-row {
    display: flex;
    gap: 12px;
    width: 100%;
    align-items: center;
    justify-content: center;
}

.streamer {
    width: 80px;
    height: 30px;
    stroke-dasharray: 200;
    stroke-dashoffset: 200;
    animation: streamerFlow 4s linear infinite;
}

.streamer:nth-child(2) { animation-delay: 0.5s; }
.streamer:nth-child(3) { animation-delay: 1s; }

@keyframes streamerFlow {
    to { stroke-dashoffset: -200; }
}

/* ================================================================
   CHARACTERS
   ================================================================ */
.illustration-zone .character {
    position: absolute;
    width: 50%;
    height: 50%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    cursor: pointer;
}

/* --- Envoy Peek (teardrop) --- */
.envoy-peek {
    width: 60%;
    height: 60%;
}

.envoy-peek .teardrop {
    position: absolute;
    inset: 0;
    background: var(--lemon-fizz);
    border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
    box-shadow:
        inset 0 2px 0 rgba(255, 255, 255, 0.4),
        0 4px 0 rgba(218, 161, 26, 0.5);
    animation: peekShy 5s ease-in-out infinite;
}

.envoy-peek .char-eye.sleepy {
    position: absolute;
    top: 38%;
    width: 18%;
    height: 4px;
    background: var(--blackberry);
    border-radius: 4px;
    animation: peekShy 5s ease-in-out infinite;
}

.envoy-peek .char-eye.sleepy.left { left: 25%; }
.envoy-peek .char-eye.sleepy.right { right: 25%; }

.envoy-peek .zigzag-hat {
    position: absolute;
    top: -22%;
    left: 50%;
    width: 50%;
    height: 30%;
    transform: translateX(-50%);
    background: var(--strawberry-pop);
    clip-path: polygon(0 100%, 20% 30%, 40% 100%, 60% 30%, 80% 100%, 100% 30%, 100% 100%);
    animation: peekShy 5s ease-in-out infinite;
}

@keyframes peekShy {
    0%, 100% { transform: translateX(-30%); }
    20%, 70% { transform: translateX(0); }
    85% { transform: translateX(0); }
}

/* --- Consul Confetti (star) --- */
.consul-confetti {
    width: 60%;
    height: 60%;
    animation: consulSpin 20s linear infinite;
}

.consul-confetti.small {
    width: 70%;
    height: 70%;
}

.consul-confetti .star-shape {
    position: absolute;
    inset: 0;
    background: var(--sky-bounce);
    clip-path: polygon(50% 0, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
    box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.4);
    filter: drop-shadow(0 4px 0 rgba(40, 130, 150, 0.5));
}

.consul-confetti .char-mouth {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 24%;
    height: 12%;
    background: var(--blackberry);
    border-radius: 0 0 100px 100px;
    transform: translate(-50%, -20%);
}

.halo-particles {
    position: absolute;
    inset: -20%;
    pointer-events: none;
}

.halo-particles::before,
.halo-particles::after {
    content: "";
    position: absolute;
    width: 6px;
    height: 6px;
    background: var(--strawberry-pop);
    border-radius: 1px;
}

.halo-particles::before {
    top: 10%;
    right: 5%;
    background: var(--lemon-fizz);
    animation: particleDrift 3s ease-in-out infinite;
}

.halo-particles::after {
    bottom: 10%;
    left: 5%;
    background: var(--strawberry-pop);
    border-radius: 50%;
    animation: particleDrift 4s ease-in-out infinite reverse;
}

@keyframes particleDrift {
    0%, 100% { transform: translate(0, 0); opacity: 0.8; }
    50% { transform: translate(8px, -8px); opacity: 0.3; }
}

@keyframes consulSpin {
    from { transform: translate(-50%, -50%) rotate(0); }
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* --- Attache Wobble (briefcase) --- */
.attache-wobble {
    width: 50%;
    height: 55%;
    animation: attacheWobble 1.8s ease-in-out infinite;
}

.attache-wobble .briefcase-body {
    position: absolute;
    inset: 12% 0 14% 0;
    background: var(--tangerine);
    border-radius: 18%;
    box-shadow:
        inset 0 2px 0 rgba(255, 255, 255, 0.3),
        0 4px 0 rgba(190, 90, 30, 0.5);
}

.attache-wobble .briefcase-handle {
    position: absolute;
    top: 0;
    left: 30%;
    right: 30%;
    height: 18%;
    border: 4px solid var(--tangerine);
    border-bottom: none;
    border-radius: 30% 30% 0 0;
}

.attache-wobble .briefcase-foot {
    position: absolute;
    bottom: 0;
    width: 22%;
    height: 18%;
    background: var(--tangerine);
    border-radius: 50%;
}

.attache-wobble .briefcase-foot.left { left: 15%; }
.attache-wobble .briefcase-foot.right { right: 15%; }

@keyframes attacheWobble {
    0%, 100% { transform: translate(-50%, -50%) rotate(-5deg); }
    50% { transform: translate(-50%, -50%) rotate(5deg); }
}

.illustration-zone .attache-wobble {
    bottom: 5%;
    top: auto;
    left: auto;
    right: 8%;
    transform: rotate(-5deg);
    width: 40%;
    height: 50%;
}

.illustration-zone .attache-wobble {
    animation: attacheWobbleAlt 1.8s ease-in-out infinite;
}

@keyframes attacheWobbleAlt {
    0%, 100% { transform: rotate(-5deg); }
    50% { transform: rotate(5deg); }
}

/* --- Ambassador Boo (in cards) --- */
.illustration-zone .ambassador-boo {
    position: absolute;
    width: 60%;
    height: 70%;
    top: 50%;
    left: 50%;
    bottom: auto;
    transform: translate(-50%, -50%);
}

/* ================================================================
   BOUNCY CASTLE / BRACELET ILLUSTRATIONS
   ================================================================ */
.bouncy-castle {
    position: absolute;
    bottom: 5%;
    left: 8%;
    width: 50%;
    height: 70%;
}

.castle-body {
    position: absolute;
    bottom: 0;
    width: 100%;
    height: 80%;
    background: var(--strawberry-pop);
    border-radius: 50% 50% 12% 12% / 30% 30% 12% 12%;
    box-shadow:
        inset 0 3px 0 rgba(255, 255, 255, 0.3),
        0 4px 0 rgba(180, 40, 80, 0.5);
}

.castle-flag {
    position: absolute;
    top: 0;
    left: 50%;
    width: 4px;
    height: 30%;
    background: var(--blackberry);
    transform: translateX(-50%);
}

.castle-flag::after {
    content: "";
    position: absolute;
    top: 0;
    left: 4px;
    width: 18px;
    height: 14px;
    background: var(--lemon-fizz);
    clip-path: polygon(0 0, 100% 50%, 0 100%);
}

.castle-window {
    position: absolute;
    top: 45%;
    left: 50%;
    width: 30%;
    height: 25%;
    transform: translateX(-50%);
    background: var(--paper-white);
    border-radius: 50% 50% 4px 4px;
}

.bracelet {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(-10deg);
    width: 70%;
    height: 70%;
    border: 4px dashed var(--strawberry-pop);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: space-around;
    flex-wrap: wrap;
    padding: 8px;
}

.bead {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.4), 0 2px 0 rgba(0, 0, 0, 0.15);
}

.bead.b1 { background: var(--strawberry-pop); }
.bead.b2 { background: var(--lemon-fizz); }
.bead.b3 { background: var(--sky-bounce); }
.bead.b4 { background: var(--grape-burst); }
.bead.b5 { background: var(--tangerine); }

/* ================================================================
   SURPRISE CARDS — Envelopes
   ================================================================ */
.envelope-inner {
    background: linear-gradient(to bottom, var(--blush-mist) 0%, var(--paper-white) 100%);
    overflow: hidden;
}

.envelope-back {
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, #FFE8EC, #FFF5E6);
    z-index: 1;
}

.hidden-illustration {
    position: absolute;
    top: 8%;
    left: 0;
    right: 0;
    height: 60%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transform: translateY(20px);
    transition: transform 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.hidden-msg {
    font-family: var(--font-hand);
    font-size: 1.1rem;
    color: var(--strawberry-pop);
    margin-top: 12px;
}

.balloon-illust {
    position: absolute;
    width: 40px;
    height: 50px;
    border-radius: 50%;
}

.balloon-illust.b1 { top: 5%; left: 15%; background: var(--strawberry-pop); }
.balloon-illust.b2 { top: 20%; right: 10%; background: var(--lemon-fizz); }
.balloon-illust.b3 { top: 0; left: 50%; transform: translateX(-50%); background: var(--sky-bounce); }

.envelope-flap {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 55%;
    background: var(--blush-mist);
    clip-path: polygon(0 0, 50% 70%, 100% 0, 100% 100%, 0 100%);
    transform-origin: top center;
    transition: transform 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 3;
}

.envelope-flap.pink-flap {
    background: var(--strawberry-pop);
}

.wax-seal {
    position: absolute;
    top: 35%;
    left: 50%;
    width: 40px;
    height: 40px;
    transform: translate(-50%, -50%);
    z-index: 4;
}

.seal-half {
    position: absolute;
    top: 0;
    width: 50%;
    height: 100%;
    background: var(--strawberry-pop);
    transition: transform 0.5s ease-out;
    box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.3);
}

.seal-half.left {
    left: 0;
    border-radius: 100% 0 0 100% / 50% 0 0 50%;
    transform-origin: right center;
}

.seal-half.right {
    right: 0;
    border-radius: 0 100% 100% 0 / 0 50% 50% 0;
    transform-origin: left center;
}

.wax-seal.yellow-seal .seal-half {
    background: var(--lemon-fizz);
}

.seal-star {
    position: absolute;
    inset: 25%;
    background: var(--paper-white);
    clip-path: polygon(50% 0, 60% 40%, 100% 50%, 60% 60%, 50% 100%, 40% 60%, 0 50%, 40% 40%);
    z-index: 5;
    transition: opacity 0.3s ease-out;
}

.surprise-card:hover .envelope-flap {
    transform: rotateX(-180deg);
}

.surprise-card:hover .seal-half.left { transform: rotate(-110deg) translateX(-10px); }
.surprise-card:hover .seal-half.right { transform: rotate(110deg) translateX(10px); }
.surprise-card:hover .seal-star { opacity: 0; }

.surprise-card:hover .hidden-illustration {
    transform: translateY(-10px);
}

.envelope-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--paper-white);
    border-top: 2px dashed color-mix(in srgb, var(--accent) 40%, transparent);
    z-index: 4;
    height: 30%;
}

/* ================================================================
   PHASE 3: GRAND FINALE
   ================================================================ */
.phase-finale {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 80vh;
}

.finale-card {
    width: 100%;
    max-width: 880px;
    aspect-ratio: 16/10;
    --accent: #FF4F81;
    transform: rotate(0);
    opacity: 0;
}

.finale-card.in-view {
    animation: partyBounce 1.2s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.finale-inner {
    background: linear-gradient(135deg, #FFE8EC, #FFFAF5, #FFF4D0);
    text-align: center;
    padding: clamp(30px, 5vw, 60px);
    align-items: center;
    justify-content: center;
    position: relative;
}

.finale-title {
    font-family: var(--font-display);
    font-size: clamp(2rem, 5vw, 3.6rem);
    color: var(--blackberry);
    margin-bottom: 8px;
    animation: pulseHeart 2.5s ease-in-out infinite;
}

@keyframes pulseHeart {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.04); }
}

.finale-tag {
    font-family: var(--font-hand);
    font-size: clamp(1rem, 1.8vw, 1.3rem);
    color: var(--strawberry-pop);
    margin-bottom: 30px;
}

.finale-stage {
    position: relative;
    width: 100%;
    max-width: 560px;
    height: clamp(120px, 18vw, 180px);
    margin: 0 auto 30px;
    display: flex;
    align-items: center;
    justify-content: space-around;
}

.finale-char {
    position: relative !important;
    width: clamp(60px, 11vw, 110px) !important;
    height: clamp(60px, 11vw, 110px) !important;
    transform: none !important;
    top: auto !important;
    left: auto !important;
    bottom: auto !important;
    right: auto !important;
}

.finale-stage .ambassador-boo .pupil { transition: transform 0.2s; }

.closing-envelope {
    position: relative;
    width: clamp(140px, 22vw, 200px);
    height: clamp(100px, 16vw, 140px);
    margin: 0 auto 16px;
}

.closing-envelope .env-flap.closing {
    background: var(--strawberry-pop);
    transform: rotateX(-180deg);
    animation: envelopeClose 3s ease-in-out 0.5s forwards;
}

@keyframes envelopeClose {
    from { transform: rotateX(-180deg); }
    to { transform: rotateX(0deg); }
}

.closing-envelope .env-body {
    background: var(--blush-mist);
    border-radius: 12px;
}

.closing-envelope .env-seal.closing-seal {
    background: var(--lemon-fizz);
    opacity: 0;
    animation: sealAppear 0.6s ease-out 3.2s forwards;
}

@keyframes sealAppear {
    from { opacity: 0; transform: translate(-50%, -50%) scale(0); }
    to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

.closing-envelope .env-seal::after {
    content: "";
    position: absolute;
    inset: 30%;
    background: var(--strawberry-pop);
    clip-path: polygon(50% 0, 60% 40%, 100% 50%, 60% 60%, 50% 100%, 40% 60%, 0 50%, 40% 40%);
}

.finale-signoff {
    font-family: var(--font-hand);
    font-size: clamp(0.95rem, 1.6vw, 1.2rem);
    color: var(--grape-burst);
}

.page-footer {
    text-align: center;
    padding: 60px 20px 20px;
    font-family: var(--font-hand);
    color: var(--blackberry);
    opacity: 0.6;
    position: relative;
    z-index: 2;
}

/* ================================================================
   SPEECH BUBBLES
   ================================================================ */
.speech-bubble {
    position: fixed;
    z-index: 100;
    background: var(--paper-white);
    border: 2px solid var(--strawberry-pop);
    border-radius: 16px;
    padding: 10px 16px;
    font-family: var(--font-hand);
    font-size: 1rem;
    color: var(--blackberry);
    pointer-events: none;
    opacity: 0;
    transform: scale(0.2) translateY(10px);
    transition: opacity 0.2s, transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 8px 24px rgba(255, 79, 129, 0.2);
    max-width: 220px;
    white-space: normal;
}

.speech-bubble.show {
    opacity: 1;
    transform: scale(1) translateY(0);
}

.bubble-tail {
    position: absolute;
    bottom: -10px;
    left: 30px;
    width: 14px;
    height: 14px;
    background: var(--paper-white);
    border-right: 2px solid var(--strawberry-pop);
    border-bottom: 2px solid var(--strawberry-pop);
    transform: rotate(45deg);
}

/* ================================================================
   RESPONSIVE
   ================================================================ */
@media (max-width: 1100px) {
    .card-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .surprise-card {
        grid-row: span 1;
        aspect-ratio: 4/5;
    }
}

@media (max-width: 768px) {
    .card-grid {
        grid-template-columns: 1fr;
    }
    .banner-card {
        grid-column: span 1;
        aspect-ratio: 5/3;
    }
    .surprise-card {
        aspect-ratio: 4/5;
    }
    .card {
        --tilt: calc((var(--card-seed, 0.5) - 0.5) * 1deg);
    }
    .letter-card {
        font-size: clamp(2rem, 11vw, 4rem);
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01s !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01s !important;
    }
    .card { opacity: 1; }
    .confetti-field, .balloon-field { display: none; }
}
