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

:root {
    --font-body: 'Roboto', sans-serif;
    --font-caption: 'Patrick Hand', cursive;
}

body {
    font-family: var(--font-body);
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #333;
    overflow: hidden;
}

.font-cozy {
    --font-body: 'Roboto', sans-serif;
    --font-caption: 'Patrick Hand', cursive;
}

.font-playful {
    --font-body: 'Fredoka', sans-serif;
    --font-caption: 'Comic Neue', cursive;
}

.font-handwritten {
    --font-body: 'Patrick Hand', cursive;
    --font-caption: 'Patrick Hand', cursive;
}

.font-romantic {
    --font-body: 'Dancing Script', cursive;
    --font-caption: 'Dancing Script', cursive;
}

/* Top Controls */
.top-controls {
    position: fixed;
    top: 14px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.8rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.18);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: rgba(255, 255, 255, 0.95);
    z-index: 10;
}

.control-label {
    font-weight: 800;
    letter-spacing: 0.3px;
}

.control-select {
    appearance: none;
    border: 1px solid rgba(255, 255, 255, 0.25);
    background: rgba(255, 255, 255, 0.14);
    color: rgba(255, 255, 255, 0.95);
    padding: 0.45rem 0.75rem;
    border-radius: 999px;
    font-weight: 700;
    outline: none;
}

.control-button {
    border: none;
    background: rgba(255, 255, 255, 0.95);
    color: #c41e3a;
    padding: 0.45rem 0.85rem;
    border-radius: 999px;
    font-weight: 900;
    cursor: pointer;
    box-shadow: 0 6px 22px rgba(0, 0, 0, 0.18);
}

.control-button.is-playing {
    background: rgba(255, 255, 255, 0.22);
    color: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.25);
    box-shadow: none;
}

/* Hide YouTube video (audio only) */
.yt-audio {
    position: fixed;
    width: 1px;
    height: 1px;
    overflow: hidden;
    left: -9999px;
    top: -9999px;
}

/* Confetti (pink snowflakes) */
.confetti {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 999;
    overflow: hidden;
}

.confetti-piece {
    position: absolute;
    top: -40px;
    left: 0;
    color: #ff7ac8;
    text-shadow: 0 0 10px rgba(255, 122, 200, 0.55);
    opacity: 0;
    will-change: transform, opacity;
    animation-name: confetti-fall;
    animation-timing-function: linear;
    animation-fill-mode: forwards;
}

@keyframes confetti-fall {
    0% {
        opacity: 0;
        transform: translate3d(var(--x, 0px), -20px, 0) rotate(0deg);
    }
    8% {
        opacity: 1;
    }
    100% {
        opacity: 0;
        transform: translate3d(calc(var(--x, 0px) + var(--drift, 0px)), 110vh, 0) rotate(var(--spin, 720deg));
    }
}

/* Card Styles */
.card {
    width: 90%;
    max-width: 500px;
    height: 600px;
    perspective: 1000px;
    cursor: pointer;
}

.card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    text-align: center;
    transition: transform 0.8s;
    transform-style: preserve-3d;
}

.card.flipped .card-inner {
    transform: rotateY(180deg);
}

.card-front,
.card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 20px;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.card-front,
.card-back {
    padding-top: 3.25rem;
    padding-bottom: 3.25rem;
    padding-left: 3.25rem;
    padding-right: 3.25rem;
}

/* Front of Card */
.card-front {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
}

.card h1 {
    font-family: 'Mountains of Christmas', cursive;
    font-size: 2.5rem;
    color: #c41e3a;
    margin-bottom: 1.5rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.card p {
    font-size: 1.2rem;
    margin-bottom: 2rem;
    color: #495057;
}

/* Gift Box Animation */
.gift-box {
    position: relative;
    width: 200px;
    height: 200px;
    margin: 2rem 0;
    cursor: pointer;
    transform-style: preserve-3d;
    transform: translateZ(0);
}

.box-body {
    width: 180px;
    height: 120px;
    background: #c41e3a;
    margin: 0 auto;
    position: relative;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

.box-body:before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 0 0 8px 8px;
}

.box-lid {
    width: 200px;
    height: 80px;
    background: #e63946;
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    border-radius: 8px 8px 0 0;
    z-index: 1;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    transition: transform 0.3s ease;
}

.gift-box:hover .box-lid {
    transform: translateX(-50%) rotateX(20deg);
    transform-origin: bottom;
}

/* Back of Card */
.card-back {
    background: linear-gradient(135deg, #c41e3a 0%, #e63946 100%);
    color: white;
    transform: rotateY(180deg);
    padding: 2rem;
    justify-content: flex-start;
    gap: 1rem;
    overflow: auto;
}

.card-back h2 {
    font-family: 'Mountains of Christmas', cursive;
    font-size: 2.5rem;
    margin-bottom: 1.5rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.message {
    background: rgba(255, 255, 255, 0.9);
    padding: 2rem;
    border-radius: 10px;
    margin: 1rem 0;
    color: #333;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    width: 100%;
}

.message p {
    margin: 1rem 0;
    font-size: 1.1rem;
    line-height: 1.6;
}

.card-back h3 {
    width: 100%;
    text-align: left;
    font-size: 1.2rem;
    letter-spacing: 0.3px;
    margin-top: 0.25rem;
    margin-bottom: 0.25rem;
    color: rgba(255, 255, 255, 0.95);
}

.upload-row {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.75rem;
    margin: 0.25rem 0 0.75rem;
}

.upload-row input[type="file"] {
    display: none;
}

.file-label {
    display: inline-block;
    background: rgba(255, 255, 255, 0.95);
    color: #c41e3a;
    border-radius: 999px;
    padding: 0.5rem 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.12);
}

.file-label:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.memories,
.gift {
    width: 100%;
}

.polaroid-carousel {
    width: 100%;
    display: grid;
    grid-template-columns: 44px 1fr 44px;
    align-items: center;
    gap: 0.75rem;
    margin-top: 0.25rem;
}

.carousel-nav {
    width: 44px;
    height: 44px;
    border-radius: 999px;
    border: none;
    padding: 0;
    margin: 0;
    background: rgba(255, 255, 255, 0.95);
    color: #c41e3a;
    font-size: 1.8rem;
    line-height: 44px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.12);
}

.carousel-nav:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.polaroid {
    --tilt: -2deg;
    width: 100%;
    background: #fff;
    border-radius: 10px;
    padding: 14px 14px 48px;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.25);
    transform: rotate(var(--tilt));
    transition: transform 0.35s ease;
    position: relative;
}

.polaroid img {
    width: 100%;
    height: 230px;
    object-fit: cover;
    border-radius: 8px;
    display: none;
    background: #f1f3f5;
}

.polaroid .polaroid-caption {
    position: absolute;
    bottom: 12px;
    left: 14px;
    right: 14px;
    color: #333;
    font-family: var(--font-caption);
    font-weight: 700;
    text-align: left;
    font-size: 0.95rem;
}

.carousel-meta {
    width: 100%;
    text-align: left;
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.9);
    margin-top: 0.5rem;
}

.gift-card {
    width: 100%;
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: 1rem;
    align-items: start;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.18);
    padding: 1rem;
    border-radius: 14px;
}

.gift-photo {
    position: relative;
    width: 140px;
    height: 140px;
    border-radius: 12px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.15);
}

.gift-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: none;
}

.gift-photo-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 0.75rem;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.95);
}

.gift-details {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    align-items: flex-start;
}

.gift-link {
    color: #ffffff;
    font-weight: 800;
    text-decoration: underline;
}

.gift-note {
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.92);
}

.reveal-name {
    font-size: 1.8rem;
    font-weight: bold;
    color: #c41e3a;
    background: #f8f9fa;
    padding: 0.8rem 1.5rem;
    border-radius: 8px;
    margin: 1.5rem 0;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px dashed #c41e3a;
}

.reveal-name.revealed {
    background: #c41e3a;
    color: white;
    border: 2px solid white;
}

.decoration {
    margin: 1.5rem 0;
    font-size: 1.5rem;
    color: white;
    display: flex;
    gap: 1.5rem;
}

button {
    background: white;
    color: #c41e3a;
    border: none;
    padding: 0.8rem 2rem;
    font-size: 1rem;
    border-radius: 50px;
    cursor: pointer;
    margin-top: 1rem;
    font-weight: bold;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

/* Snowflakes */
.snowflakes {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

/* String Lights */
.string-lights {
    position: absolute;
    top: 12px;
    left: 18px;
    right: 18px;
    height: 34px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    pointer-events: none;
    z-index: 3;
}

.string-lights:before {
    content: '';
    position: absolute;
    top: 12px;
    left: 0;
    right: 0;
    height: 2px;
    background: rgba(20, 20, 30, 0.35);
    border-radius: 999px;
}

.bulb {
    width: 14px;
    height: 18px;
    border-radius: 10px;
    position: relative;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
    animation: twinkle 2.8s infinite;
    transform-origin: top center;
}

.bulb:before {
    content: '';
    position: absolute;
    top: -5px;
    left: 50%;
    transform: translateX(-50%);
    width: 10px;
    height: 6px;
    border-radius: 3px;
    background: rgba(30, 30, 45, 0.75);
}

.bulb:after {
    content: '';
    position: absolute;
    top: 6px;
    left: 50%;
    transform: translateX(-50%);
    width: 70%;
    height: 45%;
    background: rgba(255, 255, 255, 0.35);
    border-radius: 999px;
}

.bulb.red { background: #ff4d6d; }
.bulb.green { background: #2fd87a; }
.bulb.yellow { background: #ffd166; }
.bulb.blue { background: #4dabf7; }
.bulb.pink { background: #f783ff; }

.bulb:nth-child(2) { animation-delay: 0.4s; }
.bulb:nth-child(3) { animation-delay: 0.9s; }
.bulb:nth-child(4) { animation-delay: 0.2s; }
.bulb:nth-child(5) { animation-delay: 1.2s; }
.bulb:nth-child(6) { animation-delay: 0.6s; }
.bulb:nth-child(7) { animation-delay: 1.4s; }
.bulb:nth-child(8) { animation-delay: 0.1s; }
.bulb:nth-child(9) { animation-delay: 1.0s; }
.bulb:nth-child(10) { animation-delay: 0.3s; }

@keyframes twinkle {
    0%, 100% {
        opacity: 0.8;
        filter: brightness(1);
        transform: translateY(0) rotate(-1deg);
    }
    50% {
        opacity: 1;
        filter: brightness(1.35);
        transform: translateY(1px) rotate(1deg);
        box-shadow: 0 0 22px rgba(255, 255, 255, 0.25), 0 10px 25px rgba(0, 0, 0, 0.2);
    }
}

/* Mushroom Sides */
.mushroom-sides {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 3;
}

.mushroom-side {
    position: absolute;
    top: 62px;
    bottom: 60px;
    width: 56px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-evenly;
    gap: 16px;
}

.mushroom-side.left {
    left: 10px;
}

.mushroom-side.right {
    right: 10px;
}

.mushroom {
    width: 46px;
    height: 56px;
    position: relative;
    filter: drop-shadow(0 10px 12px rgba(0, 0, 0, 0.22));
    animation: bob 4.2s ease-in-out infinite;
}

.mushroom:nth-child(2) { animation-delay: 0.6s; }
.mushroom:nth-child(3) { animation-delay: 1.1s; }
.mushroom:nth-child(4) { animation-delay: 0.2s; }

.mushroom:before {
    content: '';
    position: absolute;
    left: 50%;
    bottom: 0;
    transform: translateX(-50%);
    width: 18px;
    height: 26px;
    border-radius: 10px;
    background: #f2e8cf;
    box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.08);
}

.mushroom:after {
    content: '';
    position: absolute;
    left: 50%;
    top: 0;
    transform: translateX(-50%);
    width: 46px;
    height: 30px;
    border-radius: 22px 22px 16px 16px;
    background: #ff4d6d;
    box-shadow: inset 0 -5px 0 rgba(0, 0, 0, 0.12);
}

.mushroom.cap-green:after {
    background: #2fd87a;
}

.mushroom.cap-red:after {
    background: #ff4d6d;
}

.mushroom .dots {
    display: none;
}

.mushroom.cap-red:after,
.mushroom.cap-green:after {
    background-image:
        radial-gradient(circle at 12px 14px, rgba(255,255,255,0.9) 0 3px, transparent 3.2px),
        radial-gradient(circle at 24px 8px, rgba(255,255,255,0.85) 0 2.6px, transparent 2.8px),
        radial-gradient(circle at 34px 16px, rgba(255,255,255,0.85) 0 2.8px, transparent 3px);
}

.mushroom:before {
    background-image:
        radial-gradient(circle at 50% 30%, rgba(255, 255, 255, 0.25) 0 6px, transparent 6.2px);
}

.mushroom-sides .mushroom:before {
    box-shadow:
        inset 0 -4px 0 rgba(0, 0, 0, 0.08),
        0 0 14px rgba(255, 255, 255, 0.12);
}

.mushroom-side .mushroom {
    transform: rotate(-2deg);
}

.mushroom-side.right .mushroom {
    transform: rotate(2deg);
}

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

.snowflake {
    position: absolute;
    color: #e63946;
    font-size: 1.2rem;
    animation: fall linear infinite;
    opacity: 0.7;
}

@keyframes fall {
    to {
        transform: translateY(100vh);
    }
}

/* Responsive Design */
@media (max-width: 600px) {
    .card {
        height: 500px;
    }
    
    .card h1, .card-back h2 {
        font-size: 2rem;
    }
    
    .message {
        padding: 1.5rem;
    }
    
    .message p {
        font-size: 1rem;
    }
    
    .reveal-name {
        font-size: 1.4rem;
        padding: 0.6rem 1.2rem;
    }

    .polaroid img {
        height: 190px;
    }

    .gift-card {
        grid-template-columns: 110px 1fr;
    }

    .gift-photo {
        width: 110px;
        height: 110px;
    }

    .string-lights {
        left: 12px;
        right: 12px;
    }

    .card-front,
    .card-back {
        padding-left: 2.85rem;
        padding-right: 2.85rem;
    }

    .mushroom-side {
        width: 50px;
    }

    .mushroom-side.left {
        left: 6px;
    }

    .mushroom-side.right {
        right: 6px;
    }

    .mushroom {
        transform: scale(0.88);
    }
}
