:root {
    --primary-orange: #FF8C00;
    --soft-orange: #FFDAB9;
    --deep-red: #D2042D;
    --bg-color: #FFF5EE;
    /* Seashell */
    --text-color: #4A4A4A;
}

body {
    margin: 0;
    padding: 0;
    font-family: 'Varela Round', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    overflow: hidden;
    /* Prevent scrolling during drag/drop */
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    width: 100vw;
    text-align: center;
}

.hidden {
    display: none !important;
}

h1 {
    color: var(--primary-orange);
    margin-bottom: 10px;
}

.instruction {
    font-size: 1.2rem;
    color: #888;
    margin-bottom: 30px;
}

/* --- Stage 1: Puzzle --- */
#game-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding-top: 50px;
}

.flower-target {
    width: 100px;
    height: 100px;
    background: #FFD700;
    /* Gold/Yellow center */
    border-radius: 50%;
    position: absolute;
    top: 40%;
    left: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 0 15px rgba(255, 140, 0, 0.4);
    z-index: 10;
}

.center-core {
    width: 100%;
    height: 100%;
    border-radius: 50%;
}

.petal {
    width: 60px;
    height: 120px;
    background: linear-gradient(to bottom, #FFA500, #FF4500);
    border-radius: 50% 50% 0 50%;
    /* Petal shape */
    position: absolute;
    cursor: grab;
    transition: transform 0.2s, box-shadow 0.2s;
    user-select: none;
    z-index: 5;
    transform-origin: bottom center;
}

.petal:active {
    cursor: grabbing;
    transform: scale(1.1);
}

.petal.placed {
    cursor: default;
    z-index: 1;
    /* Behind the center */
    pointer-events: none;
    /* Can't move it once placed */
    transition: all 0.5s ease;
}

/* --- Stage 2: Bouquet --- */
#bouquet-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    /* Transformation handled by JS adding a class */
    opacity: 0;
    transition: opacity 2s ease;
}

#bouquet-container.bloomed {
    opacity: 1;
}

.bouquet-wrapper {
    position: relative;
    width: 600px;
    height: 500px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.bouquet {
    font-size: 5rem;
    position: relative;
    width: 300px;
    height: 300px;
    display: flex;
    justify-content: center;
    align-items: center;
    transform: scale(0);
    transition: transform 2.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    /* Springy bloom */
}

#bouquet-container.bloomed .bouquet {
    transform: scale(1.2);
}

.bouquet .flower {
    position: absolute;
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.1));
}

/* More flowers for a fuller bouquet */
@keyframes splitMove {
    0% {
        transform: scale(0.5) translate(0, 0);
        opacity: 0;
    }

    100% {
        transform: scale(1) translate(var(--tx), var(--ty));
        opacity: 1;
    }
}

/* Color Shifting */
@keyframes colorShift {
    0% {
        filter: hue-rotate(0deg);
    }

    50% {
        filter: hue-rotate(30deg);
    }

    100% {
        filter: hue-rotate(0deg);
    }
}

.bouquet .flower.shifting {
    animation: float 3s infinite ease-in-out, colorShift 5s infinite linear;
}

/* Heart Particles */
.heart-particle {
    position: fixed;
    font-size: 1.5rem;
    color: #ff4d4d;
    user-select: none;
    pointer-events: none;
    z-index: 0;
    /* Behind everything */
    animation: floatUp 4s linear forwards;
}

@keyframes floatUp {
    0% {
        transform: translateY(100vh) scale(0.5);
        opacity: 0;
    }

    10% {
        opacity: 0.8;
    }

    100% {
        transform: translateY(-10vh) scale(1.2);
        opacity: 0;
    }
}

.wrapper {
    position: absolute;
    bottom: -20px;
    z-index: 3;
    font-size: 5rem;
    filter: drop-shadow(0 10px 10px rgba(0, 0, 0, 0.2));
}

/* --- Memory Lane (Photos) --- */
.memory-lane {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    pointer-events: none;
    /* Let clicks pass through to potential interactables if needed, but photos might block */
}

.photo-card {
    position: absolute;
    background: white;
    padding: 10px 10px 30px 10px;
    /* Polaroid bottom padding */
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    transform: scale(0) rotate(0deg);
    transition: transform 1.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    opacity: 0;
    width: 120px;
    z-index: 0;
    /* Behind bouquet slightly? or around it */
}

.photo-inner {
    width: 100%;
    height: 100px;
    background: #eee;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

.photo-inner img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    /* Ensures any aspect ratio looks good */
    object-position: center;
    border-radius: 2px;
}

/* Positioning photos around the bouquet */
/* Positioning 8 photos in a wider circle */
.p1 {
    top: 0%;
    left: 10%;
    transform: rotate(-20deg) scale(0);
}

.p2 {
    top: -10%;
    right: 10%;
    transform: rotate(15deg) scale(0);
}

.p3 {
    bottom: 20%;
    left: -10%;
    transform: rotate(10deg) scale(0);
}

.p4 {
    bottom: 10%;
    right: -5%;
    transform: rotate(-10deg) scale(0);
}

.p5 {
    top: 40%;
    left: -20%;
    transform: rotate(-5deg) scale(0);
}

.p6 {
    top: 30%;
    right: -20%;
    transform: rotate(8deg) scale(0);
}

.p7 {
    bottom: -10%;
    left: 20%;
    transform: rotate(12deg) scale(0);
}

.p8 {
    bottom: -5%;
    right: 25%;
    transform: rotate(-15deg) scale(0);
}


/* Blooming state for photos */
#bouquet-container.bloomed .p1 {
    transform: rotate(-20deg) scale(1);
    opacity: 1;
    transition-delay: 0.5s;
}

#bouquet-container.bloomed .p2 {
    transform: rotate(15deg) scale(1);
    opacity: 1;
    transition-delay: 0.7s;
}

#bouquet-container.bloomed .p3 {
    transform: rotate(10deg) scale(1);
    opacity: 1;
    transition-delay: 0.9s;
}

#bouquet-container.bloomed .p4 {
    transform: rotate(-10deg) scale(1);
    opacity: 1;
    transition-delay: 1.1s;
}

#bouquet-container.bloomed .p5 {
    transform: rotate(-5deg) scale(1);
    opacity: 1;
    transition-delay: 1.3s;
}

#bouquet-container.bloomed .p6 {
    transform: rotate(8deg) scale(1);
    opacity: 1;
    transition-delay: 1.5s;
}

#bouquet-container.bloomed .p7 {
    transform: rotate(12deg) scale(1);
    opacity: 1;
    transition-delay: 1.7s;
}

#bouquet-container.bloomed .p8 {
    transform: rotate(-15deg) scale(1);
    opacity: 1;
    transition-delay: 1.9s;
}


.note-card-trigger {
    margin-top: 40px;
    background: white;
    padding: 15px 30px;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    font-size: 1.5rem;
    transition: transform 0.2s;
    border: 2px solid var(--soft-orange);
}

.note-card-trigger:hover {
    transform: translateY(-5px);
}

/* --- Stage 3: Modal --- */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
}

.modal-content {
    background: white;
    padding: 40px;
    border-radius: 15px;
    max-width: 500px;
    width: 90%;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    position: relative;
    border: 3px solid var(--primary-orange);
}

.close-modal {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 2rem;
    cursor: pointer;
    color: #aaa;
}

.love-letter {
    font-family: 'Dancing Script', cursive;
    font-size: 1.8rem;
    line-height: 1.6;
    color: var(--deep-red);
    margin-bottom: 30px;
}

.password-section input {
    padding: 10px;
    font-size: 1rem;
    border: 2px solid #ddd;
    border-radius: 5px;
    width: 60%;
    margin-bottom: 10px;
}

.password-section button {
    padding: 10px 20px;
    background: var(--primary-orange);
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
    transition: background 0.3s;
}

.password-section button:hover {
    background: #e67e00;
}

#error-msg {
    color: red;
    margin-top: 5px;
    font-size: 0.9rem;
}

/* --- Stage 4: Finale --- */
#final-proposal {
    background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 99%, #fecfef 100%);
    width: 100vw;
    height: 100vh;
    position: absolute;
    top: 0;
    left: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.proposal-text {
    font-family: 'Dancing Script', cursive;
    font-size: 4rem;
    color: #fff;
    text-shadow: 2px 2px 5px rgba(0, 0, 0, 0.2);
}

#yes-btn {
    padding: 20px 50px;
    font-size: 2rem;
    background: #FF4081;
    color: white;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 10px 20px rgba(255, 64, 129, 0.4);
    transition: transform 0.2s;
    margin-top: 30px;
}

#yes-btn:hover {
    transform: scale(1.1);
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

@keyframes shake {
    0% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-5px);
    }

    50% {
        transform: translateX(5px);
    }

    75% {
        transform: translateX(-5px);
    }

    100% {
        transform: translateX(0);
    }
}

.shake {
    animation: shake 0.3s ease;
}