/* ================= BASE ================= */
:root {
    color-scheme: light; /* 🔥 forces light UI */
}
html, body {
    background: white !important;
    color: black !important;
}

body {
    margin: 0;
    font-family: 'Segoe UI', sans-serif;
    background: white;
    overflow: hidden;
    text-align: center;
    position: relative;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    animation: bgMove 18s ease-in-out infinite alternate;
}

@keyframes bgMove {
    0% { transform: scale(1) translate(0,0); }
    100% { transform: scale(1.2) translate(-30px,-20px); }
}

h1, h2 {
    font-family: 'Pacifico', cursive;
}

/* ================= GLOBAL HEART SYSTEM  ================= */

#heartContainer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
    z-index: 5; /* 🔥 IMPORTANT */
}

.heart {
    position: absolute;
    top: -20px;
    font-size: 12px;
    opacity: 0.8;
    animation: fall 6s infinite;
    filter: drop-shadow(0 0 6px rgba(255, 0, 100, 0.6));
}

/* falling animation */
@keyframes fall {
    to {
        transform: translateY(110vh);
        opacity: 0;
    }
}

/* ❤️💙 Hearts */
/* .lock-heart {
    position: fixed;
    top: -20px;
    font-size: 14px;
    animation: fallHeart 5s linear forwards;
    pointer-events: none;
    z-index: 1;
}

.lock-heart.blue { color: #4da6ff; }
.lock-heart.red { color: #ff4d6d; }

@keyframes fallHeart {
    0% {
        transform: translateY(0);
        opacity: 1;
    }
    100% {
        transform: translateY(110vh);
        opacity: 0;
    }
} */

/* 🔥 ENSURE ALL CONTENT STAYS ABOVE HEARTS */
.section,
.lock-screen,
#introScreen,
.final-text,
.bubu-ending {
    position: relative;
    z-index: 10;
}

/* ================= SECTIONS ================= */

.section {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100vh;
    display: none;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    padding: 20px;
    background: transparent;
    z-index: 2; /* UI above hearts */
}

.section.active {
    display: flex;
}

.cinematic {
    animation: fadeIn 2s ease-in-out;
}

h1 {
    color: #ff4d6d;
    font-size: 28px;
}

/* base text */
p {
    max-width: 600px;
    line-height: 1.7;
    font-size: 16px;
    font-family: 'Poppins', sans-serif;
}

/* ================= LOCK SCREEN ================= */

.lock-screen {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    background: white;
}

.lock-screen::before {
    display: none;
}

/* text */
.lock-text {
    margin-top: 40px;
    text-align: center;
    z-index: 5;
    position: relative;
}

.lock-text h2 {
    font-size: clamp(20px, 3vw, 28px);
    margin: 0;
    color: black;
}

.lock-text .hint {
    font-size: clamp(14px, 2vw, 16px);
    color: #555;
    margin-top: 5px;
}

/* ================= KEYPAD ================= */

.lock-box {
    width: 100%;

    /* 🔥 Responsive height */
    height: 80vh; /* mobile default */

    display: flex;
    justify-content: center;
    align-items: center;

    position: relative;

    background-image: url("images/our_love.png");

    background-size: 90%;   /* ✅ FULL IMAGE visible */
    background-repeat: no-repeat;
    background-position: center;

    background-color: white; /* fill empty space clean */

    border-top-left-radius: 30px;
    border-top-right-radius: 30px;
    overflow: hidden;
}

/* blur overlay */
.lock-box::before {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,0.05);
    backdrop-filter: blur(1px);
    z-index: 0;
}

/* keypad */
.keypad {
    position: relative;
    z-index: 2;

    display: grid;
    grid-template-columns: repeat(3, 75px);
    gap: 18px;
}

.keypad button {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: none;

    font-size: 20px;
    font-weight: 600;
    color: black;

    background: rgba(255,255,255,0.6); /* 🔥 LESS WHITE → IMAGE VISIBLE */
    backdrop-filter: blur(5px);

    box-shadow:
        0 6px 18px rgba(0,0,0,0.25),
        inset 0 0 10px rgba(255,255,255,0.6);

    transition: 0.2s;
}

.keypad button:active {
    transform: scale(0.9);
}

/* passcode */
.passcode-box {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin: 15px 0;
}

.passcode-box span {
    width: 45px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    border: 2px solid #ddd;
    transition: 0.2s;
    font-size: 22px;
    font-weight: bold;
    background: white;
    color: black;
}

/* active typing effect */
.passcode-box span.filled {
    border-color: black;
    transform: scale(1.05);
}

/* error highlight */
.passcode-box.error span {
    border-color: red;
}

#errorMsg {
    position: relative;
    z-index: 5;

    color: red;
    font-size: 14px;

    margin-top: 5px;
}

#unlockMessage {
    position: fixed;
    inset: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    z-index: 100000;
    opacity: 0;
    filter: blur(12px);
    transform: scale(1.1);
    pointer-events: none;  
    transition: all 0.9s ease;
}

/* when visible */
#unlockMessage.show {
    opacity: 1;
    filter: blur(0);
    transform: scale(1);
    pointer-events: auto;   /* 🔥 clickable only when shown */
}


/* 🎬 FADE OUT */
#unlockMessage.hide {
    opacity: 0;
    transform: scale(0.95);
    transition: all 0.8s ease;
}

/* GIF */
.unlock-gif {
    width: 150px;
    margin-bottom: 12px;
}

/* text */
#unlockMessage p {
    font-size: 18px;
    color: #ff4d6d;
    font-weight: 500;
}

#unlockMessage.show p {
    animation: glow 1.5s ease-in-out infinite;
}

@keyframes glow {
    0% { text-shadow: 0 0 5px #ff4d6d; }
    50% { text-shadow: 0 0 20px #ff4d6d; }
    100% { text-shadow: 0 0 5px #ff4d6d; }
}

.fade-out {
    opacity: 0;
    transform: scale(0.95);
    transition: all 0.6s ease;
}

/* ================= INTRO ================= */

#introScreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: white;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    text-align: center;
}

.intro-content h1 {
    color: #ff4d6d;
    font-size: 30px;
}

.intro-content p {
    margin-top: 10px;
    color: #555;
}

.fade-out {
    animation: fadeOut 1s forwards;
}

@keyframes fadeOut {
    to {
        opacity: 0;
        visibility: hidden;
    }
}



/* ================= BUTTON ================= */

button {
    padding: 12px 25px;
    border-radius: 25px;
    border: none;
    background: linear-gradient(45deg, #ff6b81, #ff4d6d);
    color: white;
    cursor: pointer;
    margin-top: 20px;
    transition: 0.3s;
}
button:hover {
    transform: scale(1.1);
}

.gif {
    width: 220px;
    margin-bottom: 15px;
}

/* ================= ENVELOPE ================= */

.envelope-container {
    text-align: center;
    position: relative;
    cursor: pointer;
}

.envelope {
    width: 220px;
    height: 150px;
    margin: auto;
    position: relative;
    transition: 0.6s ease;
}

.envelope .body {
    position: absolute;
    width: 100%;
    height: 100%;
    background: #ff4d6d;
    border-radius: 10px;
    z-index: 1;
}

.envelope .flap {
    position: absolute;
    width: 100%;
    height: 100%;
    background: #ff6b81;
    clip-path: polygon(0 0, 100% 0, 50% 60%);
    transform-origin: top;
    transition: 0.6s ease;
    z-index: 2;
}

/* 📜 LETTER */
.kavana-box {
    position: absolute;
    left: 50%;
    transform: translateX(-50%) translateY(40px);
    width: 85%;
    max-width: 400px;
    min-height: 600px;
    padding: 20px;
    border-radius: 15px;
    background: 
        linear-gradient(rgba(255,255,255,0.65), rgba(255,255,255,0.65)),
        url("images/us.png");
    /* backdrop-filter: blur(2px); */
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    box-shadow: 0 10px 25px rgba(0,0,0,0.25);
    opacity: 0;
    transition: 0.7s ease;
}

.kavana-box p {
    font-family: 'Dancing Script', cursive;
    font-size: 18px;
    line-height: 1.8;
    color: #222;
    text-shadow: 0 1px 3px rgba(255,255,255,0.6);
}

/* flap opens */
.open .flap {
    transform: rotateX(180deg);
}
.open .envelope {
    transform: scale(0.75) translateY(20px);
}

.open + .kavana-box {
    opacity: 1;
    transform: translateX(-50%) translateY(-60px);
    animation: letterRise 0.7s ease;
}
@keyframes letterRise {
    0% { transform: translateX(-50%) translateY(60px) scale(0.9); }
    100% { transform: translateX(-50%) translateY(-60px) scale(1); }
}


/* ================= SLIDES ================= */
.slideshow-container {
    position: relative;
    width: 90%;
    max-width: 600px;
    height: auto; /* 🔥 important: remove fixed height */
    margin: auto;
    overflow: hidden;
    border-radius: 15px;
}

.slide {
    display: none;
    width: 100%;
    text-align: center;
    animation: fadeSlide 1.2s ease;
}
@keyframes fadeSlide {
    from { opacity: 0; }
    to { opacity: 1; }
}

.slide.activeSlide {
    display: block;
}

.slide img,
.slide video {
    width: 100%;
    max-height: 500px; 
    object-fit: contain;
    border-radius: 15px;
}

.slide p {
    margin-top: 10px;  /* 🔥 small gap only */
    font-size: 18px;
    line-height: 1.7;
    color: black;
    padding: 0 10px;
}

/* TEXT SLIDE (CINEMATIC) */
.text-only h2,
.text-only p {
    opacity: 0;
    transform: translateY(20px);
    font-family: 'Dancing Script', cursive;
    font-size: 25px;
    color: #ff4d6d;
}

/* ACTIVE slide animation */
.slide.activeSlide .text-only h2 {
    animation: fadeUp 2s ease forwards;
}

.slide.activeSlide .text-only p {
    animation: fadeUp 2s ease forwards;
    animation-delay: 1s;
}

@keyframes fadeUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ================= CONTROLS ================= */

.controls {
    margin-top: 10px;
}

.controls button {
    margin: 5px;
}

.voice-container {
    margin-top: 20px;
}

audio {
    margin-top: 10px;
    width: 250px;
}


/* ================= FINAL TEXT ================= */

.final-text {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: white;
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    opacity: 0;
    z-index: 9999;
    transition: opacity 1.5s ease;
    backdrop-filter: blur(6px);
}

#finalMessage {
    font-size: 30px;
    letter-spacing: 1px;
    line-height: 1.6;
    color: #ff4d6d;
    text-align: center;
    font-family: 'Dancing Script';
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 2s ease, transform 2s ease;
}

#finalBtn {
    position: absolute;
    bottom: 40px;

    padding: 12px 25px;
    border-radius: 25px;
    border: none;
    background: linear-gradient(45deg,#ff6b81,#ff4d6d);
    color: white;
    cursor: pointer;

    opacity: 0;
    pointer-events: none;
    z-index: 10001;

    transition: opacity 1s ease;
}

.glow {
    opacity: 1 !important;
    pointer-events: auto !important;
    animation: glowPulse 1.5s infinite;
}

@keyframes glowPulse {
    0% { box-shadow: 0 0 5px #ff4d6d; }
    50% { box-shadow: 0 0 22px #ff4d6d; }
    100% { box-shadow: 0 0 5px #ff4d6d; }
}

/* ================= BUBU ================= */

.bubu-ending {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: white;
    animation: fadeIn 2s ease, finalFade 8s ease forwards;
    display: none;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    opacity: 0;
    z-index: 10000;
    transition: opacity 2s ease;
}
@keyframes finalFade {
    0% { opacity: 1; }
    85% { opacity: 1; }
    100% { opacity: 0; }
}

.bubu-ending.show {
    display: flex;
    opacity: 1;
    animation: fadeIn 2s ease;
}

.bubu-text {
    font-size: 40px; /* bigger text */
    font-weight: 600;
    color: #ff4d6d;
    margin-top: 20px;
    letter-spacing: 1px;
    font-family: 'Dancing Script';
    text-shadow:
        0 0 8px rgba(255,77,109,0.6),
        0 0 18px rgba(255,77,109,0.4),
        0 0 30px rgba(255,77,109,0.2);

    animation: bubuGlow 2.5s ease-in-out infinite,
               floatSoft 4s ease-in-out infinite;
}

@keyframes bubuGlow {
    0% {
        text-shadow:
            0 0 5px rgba(255,77,109,0.5),
            0 0 12px rgba(255,77,109,0.3);
        transform: scale(1);
    }

    50% {
        text-shadow:
            0 0 18px rgba(255,77,109,0.9),
            0 0 35px rgba(255,77,109,0.6),
            0 0 55px rgba(255,77,109,0.4);
        transform: scale(1.05);
    }

    100% {
        text-shadow:
            0 0 5px rgba(255,77,109,0.5),
            0 0 12px rgba(255,77,109,0.3);
        transform: scale(1);
    }
}

.hug-gif {
    width: 220px;
    margin-top: 25px;

    opacity: 0;
    transform: scale(0.9);

    transition: opacity 2s ease, transform 2s ease;
}

/* appears softly */
.hug-gif.show {
    opacity: 1;
    transform: scale(1);
}

/* Gentle floating motion */
@keyframes floatSoft {
    0%   { transform: translateY(0px); }
    50%  { transform: translateY(-8px); }
    100% { transform: translateY(0px); }
}

/* ================= SPARKLE TRAIL ================= */

.sparkle {
    position: fixed;
    width: 6px;
    height: 6px;
    background: #ff4d6d;
    border-radius: 50%;
    pointer-events: none;
    z-index: 9999;

    animation: sparkleFade 0.8s linear forwards;
}

@keyframes sparkleFade {
    from {
        transform: scale(1.5);
        opacity: 1;
    }
    to {
        transform: scale(0);
        opacity: 0;
    }
}


/* ================= Responsive ================= */
@media (max-width: 600px) {

    p {
        font-size: 16px;
    }

    .slide img,
    .slide video {
        max-height: 300px;
    }

    .kavana-box p {
        font-size: 16px;
    }

    h1 {
        font-size: 24px;
    }
}

@media (max-width: 768px) {

    body, html {
        height: 100%;
        overflow: hidden;
    }

    .section,
    #introScreen,
    .lock-screen {
        height: 100dvh; /* ✅ FIX: better than 100vh on mobile */
        padding: 12px;
    }

    /* 🎧 INTRO SCREEN FIX */
    .intro-content {
        width: 90%;
        max-width: 320px;
    }

    .intro-content h1 {
        font-size: 22px;
    }

    .intro-content p {
        font-size: 14px;
        line-height: 1.5;
    }

    .gif {
        width: 160px; /* smaller for mobile */
    }

    button {
        padding: 10px 20px;
        font-size: 13px;
    }

    /* 🔐 KEYPAD FIX */
    .keypad {
        /* grid-template-columns: repeat(3, 60px);
        gap: 10px;
        bottom: 2%; */
        top: 50%;
        transform: translate(-50%, -40%);
    }

    .keypad button {
        width: 60px;
        height: 60px;
        font-size: 16px;
    }

    /* PASSCODE BOX */
    .passcode-box span {
        width: 35px;
        height: 40px;
        font-size: 18px;
    }

    /* 📺 SECTION TEXT */
    h1 {
        font-size: 22px;
    }

    p {
        font-size: 14px;
        padding: 0 10px;
    }

    /* 💌 ENVELOPE */
    .envelope {
        width: 180px;
        height: 120px;
    }

    .kavana-box {
        width: 90%;
        font-size: 14px;
    }

    /* 🎬 SLIDES */
    .slide img,
    .slide video {
        max-height: 400px;
    }

    .slide p {
        font-size: 18px;
    }

    /* 💖 FINAL TEXT */
    #finalMessage {
        font-size: 20px;
        padding: 0 15px;
    }

    .bubu-text {
        font-size: 26px;
    }

    lock-screen {
        justify-content: flex-start;
    }

    .lock-text {
        margin-top: 20px;
    }

    .passcode-box {
        margin: 8px 0;
    }

    /* 🔥 make image taller without breaking layout */
    .lock-box {
        height: 65vh !important;   /* 🔥 key fix */
        margin-top: 10px;
    }


}


@media (min-width: 1024px) {

    .lock-box {
        height: 65vh; /* 🔥 takes ~60–70% screen */

        background-size: contain; /* keep full image */
    }
}

/* ================= 🔥 LOCKSCREEN PERFECT MOBILE FIX ================= */
@media (max-width: 768px) {
    .section active fade cinematic .typing{
        font-size: 14px;
    }
    /* FULL SCREEN LIKE REAL LOCKSCREEN */
    .lock-screen {
        justify-content: flex-start;
    }

    .lock-text {
        margin-top: 18px;
    }

    .passcode-box {
        margin: 10px 0;
    }

    /* 🔥 MAIN FIX: IMAGE FILLS SCREEN NICELY */
    .lock-box {
        height: calc(100dvh - 160px); /* removes top gap dynamically */
        width: 100%;

        background-size: cover;      /* 🔥 fills like real lockscreen */
        background-position: center top;

        border-radius: 25px 25px 0 0;

        display: flex;
        justify-content: center;
        align-items: flex-end; /* 👈 keypad moves DOWN */
        padding-bottom: 25px;
    }

    /* 🔥 KEYPAD POSITION — LIKE PHONE LOCKSCREEN */
    .keypad {
        position: relative;
        transform: none;
        top: auto;
    }

    /* BUTTON SIZE */
    .keypad button {
        width: 65px;
        height: 65px;
        font-size: 18px;
    }

    #finalBtn {
        bottom: calc(80px + env(safe-area-inset-bottom));
    }
}

/* ================= 💻 LAPTOP PERFECT ALIGN FIX ================= */
@media (min-width: 900px) {

    .lock-screen {
        justify-content: center;
        align-items: center;
    }

    /* Center whole block nicely */
    .lock-box {
        width: 380px;
        height: 600px;

        margin-top: 20px;

        border-radius: 30px;
        overflow: hidden;

        background-size: cover;
        background-position: center;

        display: flex;
        justify-content: center;
        align-items: flex-end; /* keypad to bottom */

        padding-bottom: 30px;
    }

    /* 🔥 FIX: REMOVE weird shifting */
    .keypad {
        position: relative;
        top: auto;
        left: auto;
        transform: none;

        display: grid;
        grid-template-columns: repeat(3, 80px);
        gap: 20px;
    }

    .keypad button {
        width: 70px;
        height: 70px;
        font-size: 18px;
    }

    /* Keep text centered and proportional */
    .lock-text {
        margin-top: 0;
    }

    .passcode-box {
        margin: 12px 0;
    }
}