/* ==========================================================================
   1. GLOBAL / GENERAL STYLES
   ========================================================================== */
body {
  margin: 0;
  font-family: Arial, sans-serif;
  background: #f7cdeb;
  color: #222;
  overflow-x: hidden;
}

button {
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  background: orange;
  cursor: pointer;
  font-size: 16px;
}

.back-arrow {
    position: fixed;
    top: 20px;
    left: 20px;
    font-size: 32px;
    cursor: pointer;
    user-select: none;
    z-index: 9999;
}

/* ==========================================================================
   2. HOME PAGE (Isolated under .home-page container)
   ========================================================================== */
.home-page header {
  text-align: center;
  padding: 80px 20px;
  background: #111;
  color: white;
}

.home-page .hero {
    min-height: 100vh;
    background: pink;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
}

.home-page .hero h1 {
    font-size: 60px;
}

.home-page .love-section {
    min-height: 100vh;
    background: #e0b4ca;
    text-align: center;
    padding: 10px 10px;
    font-size: 100px;
    color: #d63384;
}

.home-page .love-section h2 {
    font-size: 100px;
    color: #d63384;
    font-weight: bold;
}

.home-page .question {
    font-size: 24px;
    margin-top: 20px;
}

.home-page .here-link {
    font-size: 80px;
    font-weight: bold;
    color: #d63384;
    text-decoration: none;
}

.home-page .arrow {
    display: inline-block;
    font-size: 35px;
    margin: 0 15px;
    animation: arrowMove 1s infinite alternate ease-in-out;
}

.home-page .left {
    animation-name: arrowMoveLeft;
}

@keyframes arrowMove {
    from { transform: translateX(0); }
    to { transform: translateX(15px); }
}

@keyframes arrowMoveLeft {
    from { transform: translateX(0); }
    to { transform: translateX(-15px); }
}

/* ==========================================================================
   3. SONGS PAGE (Isolated under .songs-page container)
   ========================================================================== */
.songs-page section {
    min-height: 50vh;
    padding: 100px;
}

.songs-page .songs-section {
    min-height: 100vh;
    position: relative;
    overflow: hidden;
}

.songs-page .hero {
    background: linear-gradient(135deg, #f7cdeb, #fbd1ff);
    text-align: center;
    padding: 100px 20px;
}

.songs-page .album {
    position: absolute;
    width: 360px;
    border-radius: 20px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.songs-page .album1 { top: 600px; left: 10%; z-index: 1; animation: float1 12s ease-in-out infinite; }
.songs-page .album2 { top: 300px; right: 15%; z-index: 2; animation: float2 12s ease-in-out infinite; }
.songs-page .album3 { top: 500px; left: 40%; z-index: 3; animation: float3 12s ease-in-out infinite; }

@keyframes float1 {
    0% { transform: translateY(0px); }
    25% { transform: translateY(-300px); }
    50% { transform: translateX(300px); }
    75% { transform: translateY(300px); }
    100% { transform: translateY(0px); }
}
@keyframes float2 {
    0% { transform: translateY(0px); }
    25% { transform: translateX(-300px); }
    50% { transform: translateY(250px); }
    75% { transform: translateY(320px); }
    100% { transform: translateX(200px); }
}
@keyframes float3 {
    0% { transform: translateY(0px); }
    12.5% { transform: translateX(150px); }
    25% { transform: translateX(-150px); }
    37.5% { transform: translateY(250px); }
    50% { transform: translateX(-350px); }
    62.5% { transform: translateX(-150px); }
    75% { transform: translateY(100px); }
    87.5% { transform: translateX(50px); }
    100% { transform: translateY(0px); }
}

/* ==========================================================================
   4. TIMER PAGE
   ========================================================================== */
.scale-container {
    position: relative;
    width: 100%;
    min-height: 100vh; 
    display: flex;
    justify-content: center;
    align-items: center;
    background: #f7cdeb; 
}

.slide {
    position: absolute;
    transition: all 0.8s cubic-bezier(0.25, 1, 0.5, 1);
    opacity: 0;
    transform: scale(0);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center; 
    width: 100%; 
    max-width: 100vw;
    height: 70%; 
    top: 0;
}

.slide.active {
    opacity: 1;
    transform: scale(1);
    z-index: 10;
}

.slide.shrunk {
    opacity: 0.7; 
    transform: scale(0.12) translateX(var(--offset)); 
    z-index: 5;
    pointer-events: none;
}

/* Base font sizes */
.emoji1 { font-size: 50px; }
.emoji2 { font-size: 150px; }
.emoji3 { font-size: 650px; }
.emoji4 { 
    font-size: min(1500px, 60vw); /* Keeps layout boundaries perfectly safe on mobile screens */
    margin-bottom: 20px;
}

/* Dynamic setup for slide 4 layout scrolling behaviors */
.slide.slide-final {
    justify-content: flex-start !important; 
    height: auto !important;                
    min-height: 100vh;
    top: 0;
    padding: 8vh 20px 140px 20px !important; /* Bottom padding ensures content doesn't crash into fixed captions */
}

.slide.slide-final.active {
    display: flex;
    opacity: 1;
    transform: scale(1);
    z-index: 10;
    position: relative;          
}

/* Reset layout parameters within final slide boundaries */
.slide.slide-final section {
    min-height: auto !important;
    padding: 0 !important;
}

.timer-hero h2 {
    font-size: 26px;
    font-weight: 600;
    margin: 20px 0 5px 0;
    color: #4a4a4a;
    text-align: center;
}

.timer-hero p {
    font-size: 16px;
    color: #666;
    font-style: italic;
    margin: 0;
    text-align: center;
}

.timer-box {
    background: rgba(240, 198, 236, 0.8);
    backdrop-filter: blur(10px);
    border-radius: 25px;
    padding: 20px 30px;
    width: fit-content;
    margin: 25px auto 0 auto;
    text-align: center;
}

.timer-box h3 {
    margin: 0 0 5px 0;
    color: #555;
    font-size: 18px;
}

#timer {
    font-size: clamp(24px, 4.5vw, 44px); 
    font-family: Arial, sans-serif;
    font-weight: 700;
    color: #ffffff;
    margin: 0;
}

/* FIXED CAPTION BAR: Locked flawlessly to bottom viewport window edge */
.caption-bar {
    position: fixed; /* Crucial fix: stays viewable over scrolling containers */
    bottom: 40px; 
    left: 0;
    width: 100%;
    display: flex;
    justify-content: center; 
    align-items: center;
    text-align: center; 
    pointer-events: none;
    z-index: 9999; /* Higher layer forces text above layout items */
}

.caption {
    position: absolute;
    opacity: 0;
    transition: opacity 0.4s ease;
    width: 90%; 
    display: flex;
    flex-direction: column;
    align-items: center;
}

.caption.active {
    opacity: 1;
}

.caption h2 {
    font-size: 26px; 
    font-weight: 700;
    color: #4a4a4a;
    margin: 0;
    text-transform: uppercase; 
}

.caption p {
    font-size: 16px;
    color: #666;
    margin-top: 6px; 
    font-style: italic;
    margin-bottom: 0;
}

.next-control {
    position: fixed; /* Matched to fixed positioning so button stays tracking text layouts */
    bottom: 42px; 
    right: 50px;
    font-size: 36px;
    cursor: pointer;
    color: #ff477e;
    user-select: none;
    z-index: 10000; 
    padding: 10px; 
}
/* ==========================================================================
   NEW INDEPENDENT TEXT SECTION
   ========================================================================== */
.love-caption-section {
    width: 100%;
    background: #f7cdeb; /* Matches your page background color */
    padding: 60px 20px;
    text-align: center;
    box-sizing: border-box;
}

.love-caption-section h2 {
    font-size: 28px; 
    font-weight: 700;
    color: #4a4a4a;
    margin: 0;
    text-transform: uppercase; 
    font-family: Arial, sans-serif;
}

.love-caption-section p {
    font-size: 16px;
    color: #666;
    margin-top: 8px; 
    font-style: italic;
    margin-bottom: 0;
    font-family: Arial, sans-serif;
}
/* ==========================================================================
   LIVE MATH SECTION STYLES
   ========================================================================== */
.math-section {
    width: 100%;
    max-width: 500px;
    margin: 60px auto 0 auto; /* Generous top gap so it feels like a new section as you scroll */
    text-align: center;
    padding: 20px;
    box-sizing: border-box;
}

.math-section h2 {
    font-size: 30px;
    color: #020000;
    font-weight: 700;
    margin-bottom: 10px;
}

.math-section p {
    font-size: 30px;
    color: #050000;
    margin: 0;
}

#live-seconds {
    font-weight: bold;
    color: #040001; /* Pink highlight color to draw attention to the live math counter */
}

/* Container for your editable notes further down */
.editable-text-area {
    margin-top: 40px;
    border-top: 2px dashed rgba(255, 255, 255, 0.5);
    padding-top: 30px;
}

.editable-text-area p {
    font-size: 30px;
    color: #0c0000;
    font-style: bold;
    line-height: 1.6;
    margin-bottom: 10px;
}
/* ==========================================================================
   LETTER & QUIZ INTERFACES
   ========================================================================== */
.letter-page {
    background: #f7cdeb;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    font-family: Arial, sans-serif;
}

.quiz-container, .pin-container, .envelope-container {
    display: none;
    flex-direction: column;
    align-items: center;
    text-align: center;
    width: 90%;
    max-width: 400px;
}

.quiz-container.active, .pin-container.active, .envelope-container.active {
    display: flex;
}

/* Quiz Style Options */
.quiz-question { font-size: 22px; color: #4a4a4a; margin-bottom: 30px; font-weight: bold;}
.quiz-options button {
    display: block;
    width: 100%;
    margin: 15px 0;
    padding: 15px;
    font-size: 18px;
    background: white;
    color: #4a4a4a;
    border: 2px solid #ff477e;
    border-radius: 12px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.2s ease;
}
.quiz-options button:hover {
    background: #ff477e;
    color: white;
}

/* iPhone Style Pin Dots */
.pin-dots {
    display: flex;
    gap: 15px;
    margin: 30px 0;
}
.dot {
    width: 15px;
    height: 15px;
    border: 2px solid #4a4a4a;
    border-radius: 50%;
    transition: background-color 0.15s ease;
}
.dot.filled {
    background-color: #4a4a4a; /* Fills little black dot when active input occurs */
}

/* Keypad Styling grid */
.keypad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    width: 280px;
}
.keypad button {
    width: 75px;
    height: 75px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.6);
    font-size: 26px;
    font-weight: 600;
    color: #4a4a4a;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.keypad button.empty { background: transparent; cursor: default; }
.keypad button.clear-btn {
    background: transparent;
    font-size: 14px;
    text-transform: uppercase;
}

/* Envelope Interactive Animation Layout */
.envelope-container {
    max-width: 600px;
    height: 500px;
    justify-content: center;
}
.envelope-instruction {
    margin-top: 30px;
    font-size: 16px;
    color: #666;
    font-style: italic;
    transition: opacity 0.3s;
}
.envelope-wrapper {
    position: relative;
    width: 300px;
    height: 200px;
    background: #bfadb6;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}
.envelope {
    position: relative;
    width: 100%;
    height: 100%;
}
.flap {
    position: absolute;
    top: 0; left: 0;
    border-left: 150px solid transparent;
    border-right: 150px solid transparent;
    border-top: 100px solid #f6e8ef;
    transform-origin: top;
    transition: transform 0.4s ease, z-index 0.2s;
    z-index: 3;
}
.pocket {
    position: absolute;
    bottom: 0; left: 0;
    border-left: 150px solid #d5cfd2;
    border-right: 150px solid #d5cfd2;
    border-bottom: 100px solid #f3eef1;
    z-index: 2;
}
.letter {
    position: absolute;
    bottom: 5px; left: 15px;
    width: 270px;
    height: 180px;
    background: rgb(231, 198, 225);
    border-radius: 8px;
    z-index: 1;
    transition: transform 0.5s ease, z-index 0.4s;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}
.letter-text {
    padding: 20px;
    text-align: left;
    font-size: 13px;
    color: #4a4a4a;
    line-height: 1.5;
    opacity: 0;
    transition: opacity 0.3s ease;
}

/* Interactive Click States */
.envelope-wrapper.open .flap {
    transform: rotateX(180deg);
    z-index: 0;
}
.envelope-wrapper.pull-out .letter {
    transform: translateY(-140px);
    height: 320px; /* Expands so all the message text matches layout boundaries */
    z-index: 4;
}
.envelope-wrapper.pull-out .letter-text {
    opacity: 1;
    transition-delay: 0.3s;
}
/* ==========================================================================
   PASSWORD PAGE CENTERING WITH SHARP CORNERS
   ========================================================================== */
body.password-page {
    margin: 0;
    padding: 0;
    background: #111111; /* Matches your project background */
    display: flex;
    justify-content: center; /* Centers horizontally */
    align-items: center;     /* Centers vertically */
    min-height: 100vh;       /* Forces the body to take up the full screen height */
    font-family: Arial, sans-serif;
    box-sizing: border-box;
}

.password-box {
    background: rgba(255, 255, 255, 0.6); /* Semi-transparent white box */
    backdrop-filter: blur(10px);           /* Smooth blur effect */
    padding: 40px 30px;
    border-radius: 0px;                    /* Sharp corners */
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    text-align: center;
    max-width: 400px;
    width: 90%; /* Keeps it responsive on mobile phones */
}

.password-box h1 {
    font-size: 24px;
    color: #2c2c2c;
    margin-bottom: 24px;
}

.password-box input[type="password"] {
    width: 100%;
    padding: 12px;
    margin-bottom: 16px;
    border: 2px solid #050103;
    border-radius: 0px;                    /* Sharp corners */
    font-size: 16px;
    box-sizing: border-box;
    outline: none;
}

.password-box button {
    width: 100%;
    padding: 12px;
    background: #262525;
    color: white;
    font-size: 16px;
    font-weight: bold;
    border: none;
    border-radius: 0px;                    /* Sharp corners */
    cursor: pointer;
    transition: background 0.2s ease;
}

.password-box button:hover {
    background: #010001;
}

#message {
    margin-top: 15px;
    font-size: 14px;
    font-weight: bold;
    color: #fbf6f8;
}
/* ==========================================================================
   HOME PAGE SONGS IMAGE LINK (SHARP EDGES)
   ========================================================================== */
.songs-section {
    text-align: center;
    padding: 20px;
}

.songs-image-link {
    display: inline-block;
    margin-top: 20px; /* Space right under the sentence */
    width: 100%;
    max-width: 320px; /* Keeps it perfectly sized for phones */
}

.clickable-image {
    width: 100%;
    height: auto;
    border: 3px solid #ff477e; /* Pink border outline */
    border-radius: 0px;        /* Sharp, square corners */
    box-sizing: border-box;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.clickable-image:hover {
    transform: scale(1.02); /* Slight pop effect when tapped/hovered */
}
/* ==========================================================================
   HOME PAGE: SECRET LETTER LINK (SHARP EDGES)
   ========================================================================== */
.letter-notice-section {
    width: 100%;
    max-width: 500px;
    margin: 100px auto 80px auto; /* Generous top space so you scroll down to see it */
    text-align: center;
    padding: 20px;
    box-sizing: border-box;
}

.letter-notice-section h2 {
    font-size: 28px;
    color: #4a4a4a;
    font-weight: 700;
    margin-bottom: 20px;
}

.letter-image-link {
    display: inline-block;
    width: 100%;
    max-width: 260px; /* Looks clean and compact on phones */
    margin-bottom: 12px;
}

.clickable-letter-image {
    width: 100%;
    height: auto;
    border: 3px solid #ff477e;
    border-radius: 0px; /* Strictly sharp corners */
    box-sizing: border-box;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.clickable-letter-image:hover {
    transform: scale(1.03); /* Subtle pop up effect on hover/tap */
}

.letter-notice-section p {
    font-size: 18px;
    color: #666;
    font-style: italic;
    margin: 0;
}
/* ==========================================================================
   HERO COLLAGE & FLYING HEARTS ENGINE
   ========================================================================== */

/* Layer 1 (Lowest): The Collage Setup */
.home-page .hero {
    position: relative;
    min-height: 100vh;
    overflow: hidden;
    background: #f7cdeb;
    display: flex;
    justify-content: center;
    align-items: center;
}

.hero-collage {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: grid;
    grid-template-columns: repeat(2, 1fr); /* 2x2 grid for your photos */
    grid-template-rows: repeat(2, 1fr);
    opacity: 0.4; /* Soft opacity ensures text reads easily on top */
    z-index: 1; 
}

.hero-collage img {
    width: 100%;
    height: 100%;
    object-fit: cover; /* Ensures pictures scale cleanly on mobile */
    border-radius: 0px; /* Kept perfectly sharp */
}

/* Layer 2 (Middle): The Heading Text */
.hero-text {
    position: relative;
    font-size: clamp(32px, 8vw, 60px);
    color: #d63384;
    text-shadow: 2px 2px 8px rgba(255, 255, 255, 0.8);
    z-index: 2;
    text-align: center;
    padding: 20px;
}

/* Layer 3 (Highest): Flying Hearts Overlay Container */
.hearts-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none; /* Allows interactions to pass straight through */
    z-index: 99999; /* Forces hearts on top of absolutely everything else */
}

.fly-heart {
    position: absolute;
    font-size: clamp(40px, 10vw, 70px);
    bottom: -100px; /* Start below screen sight lines */
    opacity: 0;
    animation: flyUpward 4s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}

/* Base upward animation script mapping path behavior */
@keyframes flyUpward {
    0% {
        transform: translateY(0) scale(0.5) rotate(0deg);
        opacity: 0;
    }
    15% {
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% {
        transform: translateY(-120vh) scale(1.2) rotate(35deg);
        opacity: 0; /* Fully clean drop-away effect once off top edges */
    }
}

/* Individual random variations for paths across the layout width */
.h1 { left: 5%;  animation-delay: 0s;   animation-duration: 3.5s; }
.h2 { left: 15%; animation-delay: 0.3s; animation-duration: 4.2s; }
.h3 { left: 25%; animation-delay: 0.1s; animation-duration: 3.8s; }
.h4 { left: 38%; animation-delay: 0.6s; animation-duration: 4.5s; }
.h5 { left: 48%; animation-delay: 0.2s; animation-duration: 3.2s; }
.h6 { left: 58%; animation-delay: 0.7s; animation-duration: 4.0s; }
.h7 { left: 68%; animation-delay: 0.4s; animation-duration: 3.6s; }
.h8 { left: 78%; animation-delay: 0.9s; animation-duration: 4.7s; }
.h9 { left: 88%; animation-delay: 0.5s; animation-duration: 3.9s; }
.h10{ left: 93%; animation-delay: 0.8s; animation-duration: 4.3s; }