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 */
}

.button-group {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin-top: 20px;
}

/* --- Envelope Button --- */
.envelope-button {
    cursor: pointer;
    width: 80px;
    height: 50px;
    position: relative;
    background-color: #ffc107;
    border-radius: 5px;
    transition: all 0.3s ease;
    display: flex;
    justify-content: center;
    align-items: center;
}

.envelope-button:hover {
    transform: translateY(-5px) scale(1.05);
    box-shadow: 0 10px 20px rgba(0,0,0,0.2);
}

.envelope-icon {
    width: 60px;
    height: 40px;
    background-color: #fff;
    border: 2px solid #e0a800;
    border-radius: 4px;
    position: relative;
}

.envelope-icon-flap {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #ffc107;
    clip-path: polygon(0 0, 100% 0, 50% 50%);
    transition: transform 0.4s ease;
}

.envelope-button:hover .envelope-icon-flap {
    transform: translateY(-10px) rotateX(180deg);
    transform-origin: bottom;
}

/* --- Future Messages Page --- */
.messages-page {
    padding: 20px;
    max-width: 1200px;
    margin: 0 auto;
}

.messages-header {
    text-align: center;
    margin-bottom: 40px;
    position: relative;
}

.messages-header h1 {
    font-family: 'Dancing Script', cursive;
    font-size: 3.5em;
    color: #c2185b;
}

.green-theme .messages-header h1 {
    color: #2e7d32;
}

.back-button {
    position: absolute;
    top: 10px;
    left: 10px;
    text-decoration: none;
    background-color: #e91e63;
    color: white;
    padding: 10px 15px;
    border-radius: 20px;
    font-weight: bold;
    transition: background-color 0.3s ease;
}

.green-theme .back-button {
    background-color: #4caf50;
}

.back-button:hover {
    background-color: #c2185b;
}

.green-theme .back-button:hover {
    background-color: #388e3c;
}

#messages-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.message-card {
    background: #fff;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
    border-left: 5px solid #f06292;
}

.green-theme .message-card {
    border-left-color: #66bb6a;
}

.message-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 15px 25px rgba(0,0,0,0.15);
}

.message-card.locked {
    background: linear-gradient(45deg, #f5f5f5, #e0e0e0);
    text-align: center;
    justify-content: center;
    align-items: center;
}

.message-card h3 {
    margin-top: 0;
    font-family: 'Dancing Script', cursive;
    color: #c2185b;
    font-size: 1.8em;
}

.green-theme .message-card h3 {
    color: #2e7d32;
}

.message-card p {
    flex-grow: 1;
    line-height: 1.6;
}

.message-card .timestamp {
    font-size: 0.8em;
    color: #999;
    text-align: right;
    margin-top: 15px;
}

.message-card .unlock-date {
    font-size: 1.1em;
    font-weight: bold;
    color: #333;
}

/* --- Scheduling Modal --- */
#schedule-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s, visibility 0.4s;
}

#schedule-modal.visible {
    opacity: 1;
    visibility: visible;
}

.schedule-modal-content {
    background: #fff;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    width: 90%;
    max-width: 400px;
    text-align: center;
    transform: scale(0.7);
    transition: transform 0.4s cubic-bezier(0.18, 0.89, 0.32, 1.28);
}

#schedule-modal.visible .schedule-modal-content {
    transform: scale(1);
}

.schedule-modal-content h2 {
    font-family: 'Dancing Script', cursive;
    color: #c2185b;
    font-size: 2.5em;
    margin-top: 0;
    margin-bottom: 20px;
}

.green-theme .schedule-modal-content h2 {
    color: #2e7d32;
}

.schedule-form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-bottom: 20px;
}

.schedule-form-grid label {
    font-weight: bold;
    text-align: right;
    padding-right: 10px;
    align-self: center;
}

.schedule-form-grid input {
    width: 100%;
    padding: 10px;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 1em;
    transition: border-color 0.3s;
}

.schedule-form-grid input:focus {
    outline: none;
    border-color: #f06292;
}

.green-theme .schedule-form-grid input:focus {
    border-color: #66bb6a;
}

#set-schedule-btn, #cancel-schedule-btn {
    margin: 10px 5px 0;
}


.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;
}

/* Corrected Flower and Animation styles */
.flower {
    position: absolute;
    top: -50px;
    width: 20px;
    height: 20px;
    /* 3D look with gradient */
    background: radial-gradient(circle at 30% 30%, #ffffff, #ffc0cb);
    border-radius: 50% 0;
    opacity: 0.9;
    /* 3D shadow */
    box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.2), 
                inset 1px 1px 2px rgba(255, 255, 255, 0.8);
    animation: fall-3d 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-3d {
    0% {
        transform: translateY(-5vh) rotate(0deg) rotateY(0deg);
    }
    100% {
        transform: translateY(105vh) rotate(720deg) rotateY(360deg);
    }
}
/* General Body Styles */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
   
    color: #333;
    line-height: 1.6;
    margin: 0;
}

.container {
    max-width: 800px;
    margin: 30px auto;
    padding: 20px;
    background: #fff;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    border-radius: 10px;
}

h1, h2 {
    color: #E91E63;
    text-align: center;
}

/* --- index.html specific styles --- */

.button-group {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 20px;
    align-items: center;
}

/* Envelope Icon on index.html */
.envelope-button .envelope-icon {
    width: 60px;
    height: 40px;
    background-color: #ffc107;
    border-radius: 5px;
    position: relative;
    cursor: pointer;
    transition: transform 0.3s ease, background-color 0.3s ease;
}

.envelope-button:hover .envelope-icon {
    transform: translateY(-5px);
    background-color: #ffca2c;
}

.envelope-button .envelope-icon-flap {
    width: 0;
    height: 0;
    border-left: 30px solid transparent;
    border-right: 30px solid transparent;
    border-bottom: 20px solid #ffc107;
    position: absolute;
    top: 0;
    left: 0;
    transition: border-bottom-color 0.3s ease;
}

.envelope-button:hover .envelope-icon-flap {
    border-bottom-color: #ffca2c;
}

.envelope-button .envelope-icon::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 30px;
    height: 40px;
    border-right: 30px solid transparent;
    border-bottom: 20px solid #f8b700;
    border-top: 20px solid transparent;
}


/* --- messages.html specific styles --- */

/* Message Form on messages.html */
#message-form textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    min-height: 120px;
    margin-bottom: 10px;
    box-sizing: border-box;
    resize: vertical;
}

.action-button {
    display: inline-block;
    width: auto;
    padding: 12px 20px;
    border: none;
    background-color: #E91E63;
    color: white;
    font-size: 16px;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s ease;
    text-decoration: none;
    text-align: center;
}

#message-form .action-button {
    width: 100%;
}

.action-button:hover {
    background-color: #C2185B;
}

/* Messages List */
#messages-list {
    margin-top: 25px;
}

.message-item {
    background: #e9ecef;
    padding: 15px;
    margin-bottom: 10px;
    border-radius: 8px;
    border-left: 5px solid #E91E63;
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 0.5s ease forwards;
}

.message-item.revealed {
    border-left-color: #28a745;
    background-color: #e8f5e9;
}

.message-item .date {
    font-size: 0.85em;
    color: #6c757d;
    margin-bottom: 8px;
}

.message-item .text {
    font-size: 1.05em;
    word-wrap: break-word;
}

.message-item .locked {
    color: #E91E63;
    font-style: italic;
    display: flex;
    align-items: center;
}

.message-item .locked i {
    margin-right: 8px;
}

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

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    animation: fadeIn 0.3s;
}

.modal-content {
    background-color: #fff;
    margin: 15% auto;
    padding: 25px;
    border-radius: 10px;
    width: 90%;
    max-width: 450px;
    text-align: center;
    animation: slideIn 0.4s;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

#date-time-form input {
    padding: 10px;
    margin: 8px 5px;
    border: 1px solid #ccc;
    border-radius: 5px;
}

#set-schedule-btn {
    width: auto;
    padding: 10px 25px;
    margin-top: 10px;
    background-color: #28a745;
}

#set-schedule-btn:hover {
    background-color: #218838;
}

.back-link {
    display: inline-block;
    margin-top: 20px;
    color: #E91E63;
    text-decoration: none;
    font-weight: bold;
}

.back-link:hover {
    text-decoration: underline;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideIn {
    from { transform: translateY(-40px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* --- New Styles for Features --- */

#message-password {
    width: 100%;
    padding: 10px;
    margin-top: 10px;
    box-sizing: border-box;
    border: 1px solid #ddd;
    border-radius: 5px;
}

.message-actions {
    margin-top: 10px;
    display: flex;
    gap: 10px;
}

.message-actions button {
    padding: 5px 10px;
    font-size: 0.9em;
    border-radius: 5px;
    cursor: pointer;
    border: 1px solid transparent;
}

.edit-btn {
    background-color: #ffc107;
    color: #333;
}
.edit-btn:hover { background-color: #e0a800; }

.delete-btn {
    background-color: #dc3545;
    color: white;
}
.delete-btn:hover { background-color: #c82333; }

.show-more-btn {
    background: none;
    border: none;
    color: #E91E63;
    text-decoration: underline;
    cursor: pointer;
    padding: 5px 0;
    font-weight: bold;
}

.cancel-btn {
    background-color: #6c757d;
}
.cancel-btn:hover {
    background-color: #5a6268;
}

#password-prompt-modal .modal-content button {
    margin: 10px 5px 0 5px;
}

#edit-modal textarea {
    width: 100%;
    min-height: 200px;
    margin-bottom: 10px;
}

/* --- Green Theme --- */

body.green-theme h1,
body.green-theme h2 {
    color: #4CAF50;
}

body.green-theme .action-button {
    background-color: #4CAF50;
}

body.green-theme .action-button:hover {
    background-color: #45a049;
}

body.green-theme .message-item {
    border-left-color: #4CAF50;
}

body.green-theme .message-item.revealed {
    border-left-color: #81C784;
}

body.green-theme .message-item .locked {
    color: #4CAF50;
}

body.green-theme .back-link,
body.green-theme .show-more-btn {
    color: #4CAF50;
}

body.green-theme #set-schedule-btn {
    background-color: #81C784;
}
body.green-theme #set-schedule-btn:hover {
    background-color: #66bb6a;
}
.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: 2.2rem; /* Slightly larger for better effect */
    user-select: none;
    /* 3D text effect */
    text-shadow: 1px 1px 0px #fff, 
                 2px 2px 0px rgba(233, 30, 99, 0.5);
    animation: fall-words-3d linear infinite;
}

@keyframes fall-words-3d {
    from {
        transform: translateY(-10vh) rotateX(0) rotateY(0) rotateZ(0);
    }
    to {
        transform: translateY(105vh) rotateX(360deg) rotateY(180deg) rotateZ(360deg);
    }
}

/* 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 .gift-burst-container {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 1px;
    height: 1px;
    pointer-events: none;
    z-index: 1;
}

.gift-particle {
    position: absolute;
    top: 0;
    left: 0;
    width: 15px;
    height: 15px;
    border-radius: 50%;
    animation: burst-and-fall 1.5s ease-out forwards;
}

@keyframes burst-and-fall {
    0% {
        transform: translate(-50%, -50%) scale(0);
        opacity: 1;
    }
    30% {
        transform: translate(var(--x-end), -150px) scale(1) rotate(var(--rotate-start));
        opacity: 1;
    }
    100% {
        transform: translate(var(--x-end), 100px) scale(0.8) rotate(var(--rotate-end));
        opacity: 1;
    }
}

#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 .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;
}

/* --- Rose Fall Animation --- */
#rose-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 998;
    overflow: hidden;
}

.rose {
    position: absolute;
    top: -50px; /* Start off-screen */
    width: 25px; /* Slightly larger */
    height: 25px;
    /* 3D gradient */
    background: radial-gradient(circle at 30% 30%, #ff8a80, #d32f2f);
    opacity: 0.9;
    border-radius: 50% 0 50% 50%; /* Simple petal shape */
    /* 3D shadow */
    box-shadow: 2px 2px 6px rgba(0, 0, 0, 0.3);
    animation: fall-and-spin-3d linear forwards;
}

@keyframes fall-and-spin-3d {
    from {
        transform: translateY(0) rotate(0deg) rotateX(0deg);
        opacity: 1;
    }
    to {
        transform: translateY(105vh) rotate(720deg) rotateX(360deg); /* Fall and spin in 3D */
        opacity: 1;
    }
}

/* --- Personal Note Envelope --- */
.personal-note-container {
    text-align: center;
}

#envelope-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1001;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s, visibility 0.4s;
}

#envelope-overlay:not(.hidden) {
    opacity: 1;
    visibility: visible;
}

.envelope {
    position: relative;
    width: 320px;
    height: 200px;
    background-color: #f0e6d8;
    border-radius: 5px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.3);
    display: flex;
    justify-content: center;
    align-items: center;
}

.envelope-flap {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100px;
    background-color: #e6dace;
    border-bottom: 2px solid #dcd0c0;
    transform-origin: top;
    transition: transform 0.5s ease-in-out;
    clip-path: polygon(0 0, 100% 0, 50% 100%);
    z-index: 3;
}

.envelope.open .envelope-flap {
    transform: rotateX(180deg);
}

.envelope-body {
    position: absolute;
    top: 100px;
    left: 0;
    width: 100%;
    height: 100px;
    background-color: #f0e6d8;
    border-top: 2px solid #dcd0c0;
    z-index: 1;
}

.letter {
    position: relative;
    width: 90%;
    height: 90%;
    background-color: #fff;
    box-shadow: 0 0 10px rgba(0,0,0,0.1) inset;
    transform: translateY(100px);
    transition: transform 0.6s 0.3s ease-out;
    padding: 20px;
    box-sizing: border-box;
    overflow: hidden;
    z-index: 2;
}

.envelope.open .letter {
    transform: translateY(-10px);
}

#personal-letter-text {
    width: 100%;
    height: 100%;
    border: none;
    background: transparent;
    font-family: 'Dancing Script', cursive;
    font-size: 1.2rem;
    color: #333;
    resize: none;
    background-image: repeating-linear-gradient(
        to bottom,
        transparent,
        transparent 20px,
        var(--secondary-color) 21px,
        var(--secondary-color) 21px
    );
    line-height: 21px;
    padding-top: 5px;
}

#personal-letter-text:focus {
    outline: none;
}

#save-letter-btn {
    position: absolute;
    bottom: 15px;
    left: 50%;
    transform: translateX(-50%);
    padding: 8px 16px;
    font-size: 0.9rem;
    min-width: 120px;
}

.letter {
    /* Adjust padding to make space for the button */
    padding-bottom: 60px;
}

#close-envelope-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    background: white;
    color: #333;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 2rem;
    line-height: 38px;
    z-index: 1002;
    cursor: pointer;
    border: none;
}

/* --- 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;
}

#welcome-message h1 span {
    display: inline-block;
    opacity: 0;
    transform: translateY(20px) scale(0.8);
    transition: opacity 0.4s, transform 0.4s;
    transition-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

#welcome-message h1 span.visible {
    opacity: 1;
    transform: translateY(0) scale(1);
}
