:root {
    --primary: #d63384;
    --primary-light: #ff85a1;
    --accent: #f8bbd0;
    --text: #4a0e1c;
    --glass: rgba(255, 255, 255, 0.25);
    --glass-border: rgba(255, 255, 255, 0.4);
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    color: var(--text);
    padding: 12px 24px;
    border-radius: 50px;
    box-shadow: 0 4px 15px rgba(214, 51, 132, 0.2);
    font-size: 0.95rem;
    font-weight: 500;
    pointer-events: auto;
    animation: toastSlideIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards,
        toastFadeOut 0.4s ease forwards 2.6s;
    transition: 0.3s;
    display: flex;
    align-items: center;
    gap: 10px;
}

@keyframes toastSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes toastFadeOut {
    from {
        opacity: 1;
        transform: translateY(0);
    }

    to {
        opacity: 0;
        transform: translateY(-20px);
    }
}

* {
    padding: 0;
    margin: 0;
    box-sizing: border-box;
}

html,
body {
    width: 100%;
    height: 100vh;
    margin: 0;
    padding: 0;
    overflow: hidden;
    /* Prevent scrolls on html/body itself */
}

body {
    background-color: #fff0f3;
    font-family: 'Outfit', sans-serif;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    color: var(--text);
    text-align: center;
    overflow-y: auto;
    overflow-x: hidden;
    position: relative;
    user-select: none;
    height: 100%;
}

#fallingContainer {
    position: fixed;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    z-index: 1;
}

.background-decor {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: -1;
    background: url('https://i.pinimg.com/736x/fe/3e/ee/fe3eee7f6a82b536e6e74361479658d3.jpg') center/cover no-repeat fixed;
}

.background-decor::after {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        radial-gradient(circle at 10% 20%, rgba(255, 133, 161, 0.1) 0%, transparent 40%),
        radial-gradient(circle at 90% 80%, rgba(214, 51, 132, 0.1) 0%, transparent 40%);
}

.falling-img {
    position: absolute;
    top: -120px;
    animation: fall linear forwards;
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 1;
    cursor: pointer;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.1));
    max-width: 30vw;
    pointer-events: auto;
    /* Enable clicks inside pointer-events: none container */
}

.falling-img:hover {
    transform: scale(1.2) rotate(10deg);
    filter: brightness(1.1);
    animation-play-state: paused;
    z-index: 10;
}

@keyframes fall {
    0% {
        transform: translateY(0) translateX(-50%) rotate(0deg);
        opacity: 0;
    }

    10% {
        opacity: 1;
    }

    90% {
        opacity: 1;
    }

    100% {
        transform: translateY(110vh) translateX(-50%) rotate(360deg);
        opacity: 0;
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Modal / Popup */
.overlay {
    position: fixed;
    inset: 0;
    background: rgba(74, 14, 28, 0.4);
    backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 15px;
}

.popup {
    width: 95%;
    max-width: 450px;
    background: white;
    border-radius: 20px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    position: relative;
    animation: zoomIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    display: flex;
    flex-direction: column;
}

@keyframes zoomIn {
    from {
        transform: scale(0.9);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

.popup-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    color: white;
    transition: 0.3s;
}

.popup .media {
    width: 100%;
    max-height: 55vh;
    object-fit: cover;
}

.caption {
    padding: 15px;
    font-size: 1rem;
    line-height: 1.4;
    color: var(--text);
    font-weight: 500;
    text-align: center;
}

/* Password Modal */
.pass-popup {
    max-width: 320px;
}

.pass-content {
    padding: 30px 20px;
    text-align: center;
}

.pass-inputs {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 10px;
}

.pass-inputs input {
    width: 50px;
    height: 55px;
    text-align: center;
    font-size: 1.5rem;
    font-weight: 600;
    border: 2px solid #eee;
    border-radius: 12px;
    outline: none;
    transition: 0.3s;
    background: #f8f9fa;
    color: var(--primary);
}

.pass-inputs input:focus {
    border-color: var(--primary);
    background: white;
    box-shadow: 0 0 10px rgba(214, 51, 132, 0.2);
    transform: translateY(-2px);
}

/* Edit Modal Specific Styles */
.edit-popup {
    max-width: 500px;
    height: 85vh;
    display: flex;
    flex-direction: column;
}

.edit-content {
    padding: 20px;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.edit-title {
    font-size: 1.5rem;
    margin-bottom: 20px;
}

.edit-scroll-area {
    flex: 1;
    overflow-y: auto;
    padding-right: 10px;
}

.edit-section {
    margin-bottom: 25px;
    text-align: left;
}

.section-title {
    font-size: 1.1rem;
    margin-bottom: 12px;
    color: var(--primary);
    border-left: 4px solid var(--primary);
    padding-left: 10px;
}

.edit-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.edit-item {
    background: #f8f9fa;
    padding: 10px 15px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.95rem;
    border: 1px solid #eee;
}

.edit-item span {
    flex: 1;
    margin-right: 15px;
}

.del-btn {
    color: #e63946;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
}

.add-row {
    margin-top: 15px;
    display: flex;
    gap: 10px;
}

.add-row input {
    flex: 1;
    padding: 10px 15px;
    border-radius: 10px;
    border: 1px solid #ddd;
    outline: none;
}

.add-btn {
    background: var(--primary);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    cursor: pointer;
}

/* Image Grid */
.edit-image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 10px;
    margin-bottom: 15px;
}

.edit-img-wrap {
    position: relative;
    aspect-ratio: 1;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid #eee;
}

.edit-img-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.img-del-btn {
    position: absolute;
    top: 5px;
    right: 5px;
    background: rgba(0, 0, 0, 0.5);
    color: white;
    width: 20px;
    height: 20px;
    font-size: 12px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.custom-upload-btn {
    display: block;
    width: 100%;
    padding: 12px;
    background: #f0f4f8;
    color: #4a5568;
    text-align: center;
    border-radius: 12px;
    cursor: pointer;
    border: 2px dashed #cbd5e0;
    transition: 0.3s;
}

.custom-upload-btn:hover {
    background: #e2e8f0;
}

/* Actions */
.edit-actions {
    display: flex;
    padding-top: 20px;
    gap: 15px;
    border-top: 1px solid #eee;
}

.primary-btn {
    flex: 1;
    background: var(--primary);
    color: white;
    border: none;
    padding: 12px;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
}

.secondary-btn {
    flex: 1;
    background: #f1f3f5;
    color: #495057;
    border: none;
    padding: 12px;
    border-radius: 12px;
    cursor: pointer;
}

.edit-scroll-area::-webkit-scrollbar {
    width: 5px;
}

.edit-scroll-area::-webkit-scrollbar-thumb {
    background: #ddd;
    border-radius: 10px;
}

/* Settings Container */
.settings-container {
    position: fixed;
    bottom: 5px;
    right: 5px;
    padding: 10px;
    z-index: 200;
}

.settings-fab {
    width: 44px;
    height: 44px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(214, 51, 132, 0.4);
    transition: 0.5s;
    border: 2px solid white;
    position: relative;
    z-index: 1;
}

.settings-fab.active {
    background: var(--text);
    transform: rotate(90deg);
}

.settings-menu {
    position: absolute;
    bottom: 60px;
    right: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    opacity: 0;
    transform: translateY(15px) scale(0);
    pointer-events: none;
    transition: 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    transform-origin: bottom center;
    z-index: 2;
}

.settings-menu.visible {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: all;
}

.settings-menu button {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 2px solid white;
    background: white;
    color: var(--primary);
    font-size: 15px;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    transition: 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

#musicToggle.playing {
    background: var(--accent);
    color: var(--primary);
}

.share-row {
    display: flex;
    gap: 10px;
}

.share-btn {
    flex: 1;
    background: #fdf2f8;
    color: var(--primary);
    border: 1px solid var(--accent);
    padding: 10px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
}

.share-btn:hover {
    background: var(--accent);
    transform: translateY(-2px);
}

@media (max-width: 480px) {
    .settings-container {
        bottom: 0;
        right: 0;
    }

    .settings-fab {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }

    .settings-menu {
        bottom: 55px;
        right: 10px;
        gap: 8px;
    }

    .settings-menu button {
        width: 34px;
        height: 34px;
    }

    /* Roate background on mobile */
    .background-decor {
        width: 100vh;
        height: 100vw;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%) rotate(90deg);
        background-attachment: scroll;
        /* Fixed doesn't work well with rotation */
    }

    .start-screen::after {
        width: 100vh;
        height: 100vw;
        transform: rotate(90deg);
    }
}

/* Start Screen */
.start-screen {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: #fff;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: 1.2s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.start-screen::after {
    content: '';
    position: absolute;
    inset: 0;
    background: url('https://i.pinimg.com/736x/fe/3e/ee/fe3eee7f6a82b536e6e74361479658d3.jpg') center/cover no-repeat;
    z-index: -1;
    transition: 0.5s;
}

.start-screen::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
}

.heart-pulse {
    font-size: clamp(6rem, 20vw, 10rem);
    color: var(--primary);
    position: relative;
    z-index: 1;
    animation: pulseHeart 1.2s infinite;
    filter: drop-shadow(0 0 30px rgba(214, 51, 132, 0.5));
}

.start-screen p {
    font-size: clamp(1.2rem, 5vw, 1.8rem);
    color: var(--text);
    font-weight: 600;
    margin-top: 30px;
    z-index: 1;
    font-family: 'Dancing Script', cursive;
    letter-spacing: 1px;
    animation: fadeInText 2s ease-in-out infinite alternate;
}

@keyframes pulseHeart {
    0% {
        transform: scale(1);
    }

    15% {
        transform: scale(1.2);
    }

    30% {
        transform: scale(1);
    }

    45% {
        transform: scale(1.15);
    }

    100% {
        transform: scale(1);
    }
}

@keyframes fadeInText {
    from {
        opacity: 0.6;
        transform: translateY(0);
    }

    to {
        opacity: 1;
        transform: translateY(-5px);
    }
}

.start-screen.hide {
    opacity: 0;
    visibility: hidden;
    transform: translateY(-20px) scale(1.2);
    pointer-events: none;
}
