/* =========================================
   1. GLOBAL RESETS & BODY
   ========================================= */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Varela Round', sans-serif;
    /* The Kawaii Pink Gradient Background */
    background: linear-gradient(135deg, #ffdde1 0%, #ee9ca7 100%);
    
    /* SCROLL CONTROL: Hidden initially, enabled by JS later */
    overflow-x: hidden;
    overflow-y: hidden; 
    
    width: 100%;
}

/* =========================================
   2. TYPOGRAPHY
   ========================================= */
h1, h2, h3 {
    font-family: 'Fredoka One', cursive;
    color: #5e4648; /* Soft Cocoa color */
    margin-bottom: 10px;
}

p {
    color: #7a6163;
    font-size: 1.1rem;
    line-height: 1.5;
}

/* =========================================
   3. SECTION 1: THE HUG SCENE
   ========================================= */
#main-screen {
    height: 100vh; /* Takes up full screen height */
    width: 100%;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}

.screen {
    position: absolute;
    width: 100%;
    height: 100%;
    display: flex; /* Flexbox centers everything */
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    transition: opacity 0.5s ease;
}

/* CRITICAL: This class hides elements! */
.hidden {
    display: none !important;
    opacity: 0;
}

/* WAITING SCREEN ANIMATION */
#waiting-img {
    width: 150px;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
    100% { transform: translateY(0px); }
}

/* BUTTON STYLING */
#start-btn {
    margin-top: 20px;
    padding: 15px 30px;
    font-family: 'Fredoka One', cursive;
    font-size: 1.2rem;
    color: white;
    background-color: #ff4d6d; /* Kawaii Red */
    border: none;
    border-radius: 50px;
    box-shadow: 0 5px 0 #c41e3a; /* 3D Effect */
    cursor: pointer;
    transition: transform 0.1s;
    animation: pulse 1.5s infinite;
}

#start-btn:active {
    transform: translateY(5px);
    box-shadow: 0 0 0 #c41e3a;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* =========================================
   4. THE ANIMATION STAGE (BEARS & DUST)
   ========================================= */
.characters-container {
    position: relative;
    width: 100%;
    height: 300px;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden; /* Keeps running bears inside the box */
}

.character {
    position: absolute;
    width: 150px;
    /* This makes them run slowly (3 seconds) */
    transition: left 3s linear, right 3s linear, transform 3s linear !important;
    z-index: 50;
}

/* Initial Positions (Off-screen) */
#char-left { left: -300px; }
#char-right { right: -300px; }

/* Running States */
.rush-in-left { 
    left: 50% !important; 
    transform: translateX(-50%) !important; 
}

.rush-in-right { 
    right: 50% !important; 
    transform: translateX(50%) !important; 
}

/* HUG GIF (Updated Size) */
#hug-gif {
    width: 200px; /* 20% Smaller */
    z-index: 10;
}

/* DUST CLOUD EFFECT (Updated Size & Layer) */
.dust-effect {
    position: absolute;
    width: 150px;  /* Bigger dust */
    height: 150px; /* Bigger dust */
    background: radial-gradient(circle, #f0f0f0 20%, transparent 70%); /* Soft puff look */
    
    bottom: 50px; 
    left: 50%;
    transform: translateX(-50%) scale(0);
    z-index: 999; /* On top of everything */
    opacity: 0;
    pointer-events: none;
}

.dust-active {
    animation: poof 0.8s ease-out forwards;
}

@keyframes poof {
    0% { transform: translateX(-50%) scale(0.5); opacity: 1; }
    100% { transform: translateX(-50%) scale(2.5); opacity: 0; }
}

/* =========================================
   5. MESSAGE CARD
   ========================================= */
.card {
    background: rgba(255, 255, 255, 0.9);
    padding: 20px;
    border-radius: 20px;
    width: 85%;
    max-width: 400px;
    margin-top: 20px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    transform: translateY(50px);
    opacity: 0;
    transition: all 0.8s ease;
    z-index: 20;
}

.card.show-card {
    transform: translateY(0);
    opacity: 1;
}

.signature {
    margin-top: 15px;
    font-weight: bold;
    color: #ff4d6d;
}

/* SCROLL HINT TEXT */
.hidden-hint {
    opacity: 0;
    margin-top: 15px;
    font-size: 0.9rem;
    color: #ff4d6d;
    animation: bounce 2s infinite;
    transition: opacity 1s;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {transform: translateY(0);}
    40% {transform: translateY(-5px);}
    60% {transform: translateY(-3px);}
}

/* =========================================
   6. SECTION 2: BONUS CONTENT (ENVELOPE/CARDS)
   ========================================= */
#bonus-section {
    width: 100%;
    min-height: 100vh;
    background: linear-gradient(180deg, #ee9ca7 0%, #ffdde1 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 50px;
    opacity: 0; /* Hidden initially */
    transition: opacity 2s ease;
}

.section-title {
    font-family: 'Dancing Script', cursive;
    font-size: 2.5rem;
    color: #fff;
    text-shadow: 2px 2px 0px rgba(0,0,0,0.1);
    margin-bottom: 30px;
}

/* ENVELOPE STYLES */
.envelope-wrapper {
    cursor: pointer;
    margin-bottom: 80px;
    transform: scale(0.8);
}

.envelope {
    position: relative;
    width: 300px;
    height: 200px;
    background: #ff6b81;
    border-radius: 0 0 10px 10px;
    box-shadow: 0 10px 20px rgba(0,0,0,0.2);
}

.flap {
    position: absolute;
    top: 0;
    left: 0;
    width: 0;
    height: 0;
    border-left: 150px solid transparent;
    border-right: 150px solid transparent;
    border-top: 100px solid #ff85a2;
    transform-origin: top;
    transition: transform 0.6s ease-in-out, z-index 0.6s;
    z-index: 3;
}

.pocket {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 0;
    border-left: 150px solid transparent;
    border-right: 150px solid transparent;
    border-bottom: 100px solid #ff4d6d;
    z-index: 2;
    border-radius: 0 0 10px 10px;
}

.letter {
    position: absolute;
    top: 10px;
    left: 25px;
    width: 250px;
    height: 180px;
    background: #fff;
    border-radius: 10px;
    padding: 15px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    transition: transform 0.6s ease-in-out;
    z-index: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    text-align: center;
}

.letter h3 { font-family: 'Dancing Script', cursive; color: #ff4d6d; }
.letter p { font-family: 'Varela Round', sans-serif; font-size: 0.9rem; color: #555; }

/* Open Animation */
.envelope.open .flap {
    transform: rotateX(180deg);
    z-index: 0;
}
.envelope.open .letter {
    transform: translateY(-100px);
    z-index: 2;
}

/* --- PREMIUM GLASS CARDS --- */
.card-deck {
    position: relative;
    width: 300px;
    height: 400px;
    margin-top: 20px;
    /* Center the cards */
    display: flex;
    justify-content: center;
}

.glass-card {
    position: absolute;
    top: 0;
    width: 100%;
    height: 100%;
    
    /* 1. THE GLASS BASE */
    background: linear-gradient(
        135deg,
        rgba(255, 255, 255, 0.3) 0%,   /* Top left is brighter (Light source) */
        rgba(255, 255, 255, 0.05) 100% /* Bottom right is transparent */
    );
    
    /* 2. THE BLUR (Frost Effect) */
    backdrop-filter: blur(20px); 
    -webkit-backdrop-filter: blur(20px);
    
    /* 3. THE REFLECTIVE BORDERS (Light Catching) */
    border-top: 1px solid rgba(255, 255, 255, 0.8);  /* Bright top edge */
    border-left: 1px solid rgba(255, 255, 255, 0.8); /* Bright left edge */
    border-right: 1px solid rgba(255, 255, 255, 0.2); /* Dim right edge */
    border-bottom: 1px solid rgba(255, 255, 255, 0.2); /* Dim bottom edge */
    
    /* 4. DEPTH & SHADOW */
    border-radius: 20px;
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.15); /* Soft deep shadow */
    
    /* Layout */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    cursor: pointer;
    
    /* Smooth Transition for hover */
    transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* Hover Effect: Lifts up slightly */
.glass-card:hover {
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 15px 40px 0 rgba(31, 38, 135, 0.25);
}

/* TEXT & IMAGE STYLING */
.glass-card img {
    width: 100%;
    max-height: 200px;
    object-fit: contain;
    /* Add a small shadow to the image inside so it floats */
    filter: drop-shadow(0 10px 10px rgba(0,0,0,0.1));
    margin-bottom: 15px;
}

.glass-card p {
    font-family: 'Varela Round', sans-serif;
    font-weight: bold;
    color: #fff; /* White text */
    text-shadow: 0 2px 5px rgba(0,0,0,0.2); /* Shadow for readability */
    font-size: 1.1rem;
    margin: 0;
}

/* --- SWIPE ANIMATIONS --- */
/* The card flies out to the right and fades away */
@keyframes flyOutRight {
    0% { transform: translateX(0) rotate(0); opacity: 1; }
    100% { transform: translateX(300px) rotate(20deg); opacity: 0; }
}

/* The card flies out to the left and fades away */
@keyframes flyOutLeft {
    0% { transform: translateX(0) rotate(0); opacity: 1; }
    100% { transform: translateX(-300px) rotate(-20deg); opacity: 0; }
}

/* The card gently fades in at the back */
@keyframes fadeInBack {
    0% { transform: scale(0.9); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

.animate-right { animation: flyOutRight 0.6s ease-out forwards; }
.animate-left { animation: flyOutLeft 0.6s ease-out forwards; }
.animate-back { animation: fadeInBack 0.6s ease-in forwards; }

/* CONFETTI */
@keyframes fall {
    0% { transform: translateY(-10px) rotate(0deg); opacity: 1; }
    100% { transform: translateY(100vh) rotate(360deg); opacity: 0; }
}