body {
    font-family: 'Montserrat', sans-serif;
    background-color: #fce4ec; /* Soft pink background */
    color: #333;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    transition: background-color 0.5s;
}

body.rtl {
    direction: rtl;
    text-align: right;
}

body.green-theme {
    background-color: #c6efce; /* Light green background */
    color: #2f4f2f;
}

main {
    position: relative;
    z-index: 1;
    text-align: center;
    padding: 2rem;
}

.hero {
    padding: 4rem 1rem;
}

.hero h1 {
    font-family: 'Dancing Script', cursive;
    font-size: 4.5rem;
    color: #e91e63; /* Hot Pink */
    margin-bottom: 1rem;
}

.hero p {
    font-size: 1.2rem;
    color: #6d4c41; /* Brownish text for contrast */
}

.message {
    background-color: white;
    padding: 3rem 1rem;
    margin: 2rem auto;
    max-width: 800px;
    border-radius: 15px;
    box-shadow: 0 10px 20px rgba(0,0,0,0.1);
}

.message h2 {
    font-family: 'Dancing Script', cursive;
    font-size: 3rem;
    color: #e91e63;
}

/* Falling Flowers Animation */
#flower-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
}

.flower {
    position: absolute;
    top: -50px;
    width: 20px;
    height: 20px;
    background-color: white;
    border-radius: 50% 0;
    opacity: 0.8;
    animation: fall linear infinite;
}

.flower::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    background-color: inherit; /* Inherit color from parent flower */
    border-radius: 50% 0;
    transform: rotate(90deg);
}

@keyframes fall {
    to {
        transform: translateY(105vh) rotate(360deg);
    }
}

.secret-message-container {
    background-color: white;
    padding: 3rem 1rem;
    margin: 4rem auto;
    max-width: 800px;
    border-radius: 15px;
    box-shadow: 0 10px 20px rgba(0,0,0,0.1);
}

.secret-message-container h2 {
    font-family: 'Dancing Script', cursive;
    font-size: 3rem;
    color: #e91e63;
}

#secret-box {
    max-height: 300px;
    overflow-y: auto;
    padding: 1rem;
    border: 2px dashed #ffc0cb; /* Light pink dashed border */
    border-radius: 10px;
    background-color: #fff9fa;
    transition: filter 0.5s ease-in-out;
    text-align: left;
}

#secret-box.locked {
    filter: blur(8px);
    user-select: none;
    pointer-events: none;
}

#password-prompt {
    margin-top: 1.5rem;
}

#password-input {
    padding: 10px;
    border: 2px solid #e91e63;
    border-radius: 5px;
    font-size: 1rem;
    margin-right: 10px;
}

#unlock-button {
    padding: 10px 20px;
    font-size: 1rem;
    font-weight: bold;
    color: white;
    background-color: #e91e63;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s;
}

#unlock-button:hover {
    background-color: #c2185b;
}

/* Falling Words Animation */
#word-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9998; /* Below flowers */
}

.falling-word {
    position: absolute;
    top: -100px;
    color: #e91e63;
    font-family: 'Dancing Script', cursive;
    font-size: 2rem;
    user-select: none;
    animation: fall-words linear infinite;
}

@keyframes fall-words {
    to {
        transform: translateY(105vh) rotate(20deg);
    }
}

/* Gift Box Section */
.gift-container {
    background-color: #f8bbd0;
    padding: 3rem 1rem;
    margin: 4rem auto;
    max-width: 800px;
    border-radius: 15px;
    box-shadow: 0 10px 20px rgba(0,0,0,0.1);
    text-align: center;
}

.gift-container h2 {
    font-family: 'Dancing Script', cursive;
    font-size: 3rem;
    color: white;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
}

#gift-box {
    position: relative;
    width: 200px;
    height: 200px;
    margin: 3rem auto;
}

.gift-box-base {
    width: 200px;
    height: 150px;
    background: linear-gradient(45deg, #d81b60, #f06292);
    position: absolute;
    bottom: 0;
    box-shadow: 5px 5px 15px rgba(0,0,0,0.3);
    border-radius: 5px;
}

.gift-box-base::before {
    content: '';
    position: absolute;
    width: 30px;
    height: 100%;
    background: linear-gradient(gold, goldenrod);
    left: 50%;
    transform: translateX(-50%);
}

.gift-lid {
    width: 220px;
    height: 60px;
    background: linear-gradient(45deg, #c2185b, #e91e63);
    position: absolute;
    top: -10px;
    left: -10px;
    transition: all 0.7s ease-in-out;
    transform-origin: bottom center;
    box-shadow: 5px -5px 15px rgba(0,0,0,0.2);
    border-radius: 5px;
    z-index: 2;
}

.gift-lid::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 30px;
    background: linear-gradient(gold, goldenrod);
    top: 50%;
    transform: translateY(-50%);
}

.gift-lid::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    border: 5px solid goldenrod;
    border-radius: 50%;
    box-shadow: 0 0 0 5px gold;
    top: -25px;
    left: 50%;
    transform: translateX(-50%);
}

#pull-tape {
    position: absolute;
    background-color: goldenrod;
    color: white;
    padding: 5px 15px;
    font-size: 0.8rem;
    font-weight: bold;
    top: 50px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 3;
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.3s;
    opacity: 0;
    pointer-events: none;
}

#pull-tape.visible {
    opacity: 1;
    pointer-events: all;
}

#gift-box.unlocked .gift-lid {
    transform: translateY(-250px) rotate(45deg) scale(0.9);
    opacity: 0;
}

#gift-password-prompt input {
    padding: 10px;
    border: 2px solid white;
    border-radius: 5px;
    font-size: 1rem;
    margin-right: 10px;
}

#gift-password-prompt button {
    padding: 10px 20px;
    font-size: 1rem;
    font-weight: bold;
    color: #e91e63;
    background-color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s, color 0.3s;
}

#gift-password-prompt button:hover {
    background-color: #fce4ec;
}

/* --- Controls --- */
#controls {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 12000;
    display: flex;
    gap: 10px;
    transition: opacity 0.3s ease;
}

#controls.controls-hidden {
    opacity: 0;
    pointer-events: none;
}

#controls button {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: 2px solid white;
    background-color: rgba(255, 255, 255, 0.8);
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

#controls button:hover {
    transform: scale(1.1);
    background-color: white;
}

/* --- Green Theme --- */
body.green-theme {
    background-color: #e8f5e9; /* Light green */
}

.green-theme h1, .green-theme h2 {
    color: #1b5e20; /* Dark green */
}

.green-theme .hero {
    background-color: #a5d6a7; /* Medium green */
}

.green-theme .main-message, .green-theme .secret-message-container, .green-theme .gift-container {
    background-color: #c8e6c9; /* Lighter green */
}

.green-theme .main-message h2, .green-theme .secret-message-container h2, .green-theme .gift-container h2 {
    color: white;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
}

.green-theme #password-prompt button, .green-theme #gift-password-prompt button {
    background-color: white;
    color: #2e7d32; /* Green text */
}

.green-theme #password-prompt button:hover, .green-theme #gift-password-prompt button:hover {
    background-color: #e8f5e9;
}

.green-theme .gift-box-base {
    background: linear-gradient(45deg, #2e7d32, #4caf50);
}

.green-theme .gift-lid {
    background: linear-gradient(45deg, #1b5e20, #388e3c);
}

.green-theme .mastercard {
    background: linear-gradient(135deg, #2e7d32, #1b5e20);
}

.green-theme .flower {
    background-color: #a5d6a7 !important;
}

/* --- Responsive Design --- */
@media (max-width: 768px) {
    .hero h1 {
        font-size: 3rem; /* Smaller title for mobile */
    }

    .hero p {
        font-size: 1rem;
    }

    .message, .secret-message-container, .gift-container {
        padding: 2rem 1rem;
        margin: 1rem;
        transform: none; /* Disable 3D effect on mobile for better readability */
        box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    }

    .secret-box, .gift-box {
        width: 90%;
        max-width: 300px; /* Ensure it doesn't get too wide */
        margin: 1rem auto;
    }

    #password-prompt, #gift-password-prompt {
        width: 90%;
        padding: 1.5rem;
    }

    .mastercard {
        width: 90%;
        max-width: 320px;
        height: auto; /* Adjust height automatically */
        padding: 15px;
    }

    .mastercard-header h2 {
        font-size: 1.2rem;
    }

    .card-number {
        font-size: 1.1rem;
    }

    .card-details .detail-item .label {
        font-size: 0.6rem;
    }

    .card-details .detail-item .value {
        font-size: 0.8rem;
    }
    
    #controls {
        bottom: 10px;
        right: 10px;
    }

    #controls button {
        width: 45px;
        height: 45px;
        font-size: 1.2rem;
    }
}

@media (max-width: 480px) {
    .hero h1 {
        font-size: 2.5rem;
    }

    h2 {
        font-size: 1.5rem;
    }

    .mastercard-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .mastercard-logo {
        align-self: flex-end;
        margin-top: -10px;
    }
}

/* Card Overlay & Mastercard */
#card-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background-color: rgba(0,0,0,0.5);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 11000;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    opacity: 0;
    transition: opacity 0.5s;
    pointer-events: none;
}

#card-overlay:not(.hidden) {
    opacity: 1;
    pointer-events: all;
}

.mastercard {
    width: 400px;
    height: 250px;
    background: linear-gradient(135deg, #333, #111);
    border-radius: 15px;
    padding: 20px;
    color: white;
    box-shadow: 0 15px 30px rgba(0,0,0,0.5);
    position: relative;
    font-family: 'Courier New', Courier, monospace;
    transform: scale(0.5);
    transition: transform 0.5s 0.3s;
}

#card-overlay:not(.hidden) .mastercard {
    transform: scale(1);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.mastercard-logo {
    display: flex;
}

.mastercard-logo .circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

.mastercard-logo .red {
    background-color: #eb001b;
}

.mastercard-logo .yellow {
    background-color: #f79e1b;
    margin-left: -15px;
    mix-blend-mode: screen;
}

.card-chip {
    width: 50px;
    height: 40px;
    background: linear-gradient(135deg, #d4af37, #ffd700);
    border-radius: 5px;
    margin-top: 20px;
}

.card-number {
    margin-top: 30px;
    font-size: 1.5rem;
    letter-spacing: 3px;
    display: flex;
    justify-content: space-between;
}

.card-footer {
    margin-top: 20px;
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    text-transform: uppercase;
}

.card-footer strong {
    font-size: 1rem;
    display: block;
}

#close-card-overlay {
    position: absolute;
    top: 20px;
    right: 20px;
    background: none;
    border: 2px solid white;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
}

.security-warning {
    color: white;
    margin-top: 20px;
    max-width: 400px;
    text-align: center;
}

/* Welcome Overlay */
#welcome-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background-color: rgba(252, 228, 236, 0.95);
    z-index: 10000;
    opacity: 1;
    transition: opacity 1s ease-in-out;
    display: flex;
    justify-content: center;
    align-items: center;
}

#welcome-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

#overlay-flower-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10001;
}

#welcome-message {
    position: relative;
    z-index: 10002;
    text-align: center;
    color: #e91e63;
}

#welcome-message h1 {
    font-family: 'Dancing Script', cursive;
    font-size: clamp(2.5rem, 10vw, 6rem);
    margin: 0;
    text-shadow: 3px 3px 5px rgba(0,0,0,0.15);
    padding: 0 1rem;
}

#close-overlay {
    position: absolute;
    top: 20px;
    right: 20px;
    background: white;
    color: #e91e63;
    border: 2px solid #e91e63;
    border-radius: 50%;
    width: 45px;
    height: 45px;
    font-size: 1.8rem;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    transition: transform 0.3s, background-color 0.3s;
    z-index: 10003;
    display: flex;
    justify-content: center;
    align-items: center;
}

#close-overlay:hover {
    transform: scale(1.1);
    background-color: #fce4ec;
}
