/* ===== GLOBAL RESET & BASE ===== */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html,
body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #000;
    font-family: 'Outfit', sans-serif;
    color: #fff;
    -webkit-font-smoothing: antialiased;
}

.section {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    opacity: 0;
    pointer-events: none;
    transition: opacity 1.2s ease;
    z-index: 1;
}

.section.active {
    opacity: 1;
    pointer-events: all;
    z-index: 10;
}

canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
}

/* ===== START SCREEN ===== */
#start-screen {
    background: radial-gradient(ellipse at center, #1a0a2e 0%, #0a0018 100%);
    cursor: pointer;
}

#start-content {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    animation: fadeInUp 1s ease;
}

.gift-icon {
    font-size: clamp(4rem, 12vw, 7rem);
    animation: giftBounce 1.5s ease-in-out infinite;
    filter: drop-shadow(0 0 30px rgba(255, 105, 180, 0.5));
}

@keyframes giftBounce {

    0%,
    100% {
        transform: translateY(0) scale(1);
    }

    50% {
        transform: translateY(-15px) scale(1.05);
    }
}

.start-text {
    font-family: 'Dancing Script', cursive;
    font-size: clamp(1.5rem, 5vw, 2.5rem);
    background: linear-gradient(135deg, #ff69b4, #ff1493, #ffd700);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-align: center;
}

#start-btn {
    font-family: 'Outfit', sans-serif;
    font-size: clamp(1rem, 3vw, 1.3rem);
    font-weight: 600;
    padding: 14px 48px;
    border: 2px solid rgba(255, 105, 180, 0.6);
    border-radius: 50px;
    background: linear-gradient(135deg, rgba(255, 105, 180, 0.2), rgba(255, 20, 147, 0.2));
    color: #fff;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    animation: btnPulse 2s ease-in-out infinite;
    letter-spacing: 0.05em;
}

#start-btn:hover {
    background: linear-gradient(135deg, rgba(255, 105, 180, 0.4), rgba(255, 20, 147, 0.4));
    border-color: #ff69b4;
    transform: scale(1.05);
    box-shadow: 0 0 30px rgba(255, 105, 180, 0.3);
}

@keyframes btnPulse {

    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(255, 105, 180, 0.4);
    }

    50% {
        box-shadow: 0 0 0 15px rgba(255, 105, 180, 0);
    }
}

.start-sparkles {
    font-size: 1.5rem;
    animation: sparkleRotate 3s linear infinite;
    opacity: 0.7;
}

@keyframes sparkleRotate {
    0% {
        transform: rotate(0deg) scale(1);
    }

    50% {
        transform: rotate(180deg) scale(1.3);
    }

    100% {
        transform: rotate(360deg) scale(1);
    }
}

/* ===== SECTION 1: MATRIX RAIN ===== */
#matrix-section {
    background: #000;
}

#matrix-canvas {
    z-index: 1;
}

#matrix-text-overlay {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

#countdown {
    font-family: 'Outfit', sans-serif;
    font-weight: 800;
    font-size: clamp(4rem, 12vw, 10rem);
    color: #fff;
    text-shadow:
        0 0 20px rgba(255, 0, 128, 0.8),
        0 0 40px rgba(255, 0, 128, 0.5),
        0 0 80px rgba(255, 0, 128, 0.3);
    letter-spacing: 0.05em;
    text-transform: uppercase;
    animation: textGlow 0.5s ease-in-out;
    text-align: center;
    padding: 0 20px;
}

@keyframes textGlow {
    0% {
        opacity: 0;
        transform: scale(0.5);
        filter: blur(10px);
    }

    50% {
        opacity: 1;
        transform: scale(1.1);
    }

    100% {
        opacity: 1;
        transform: scale(1);
        filter: blur(0);
    }
}

/* Heart that appears after text sequence */
.matrix-heart {
    font-size: clamp(5rem, 15vw, 12rem);
    animation: heartPulse 1s ease-in-out infinite;
    filter: drop-shadow(0 0 30px rgba(255, 0, 128, 0.6));
}

@keyframes heartPulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.15);
    }
}

/* ===== SECTION 2: CHARACTER ===== */
#character-section {
    background: #0a0a2e;
}

#character-content {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    animation: fadeInUp 1s ease;
}

@keyframes fadeInUp {
    0% {
        opacity: 0;
        transform: translateY(40px);
    }

    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Candle Text */
#candle-text {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    justify-content: center;
    padding: 0 10px;
}

.candle-spacer {
    width: 20px;
}

.candle-letter {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    font-family: 'Outfit', sans-serif;
    font-weight: 800;
    font-size: clamp(1.5rem, 5vw, 2.5rem);
    color: hsl(var(--hue), 80%, 65%);
    position: relative;
    animation: candleFlicker 2s ease-in-out infinite;
    animation-delay: calc(var(--hue) * 5ms);
}

.candle-letter::before {
    content: '🕯️';
    font-size: clamp(0.8rem, 2.5vw, 1.2rem);
    margin-bottom: -5px;
    animation: flameDance 0.8s ease-in-out infinite alternate;
}

@keyframes candleFlicker {

    0%,
    100% {
        filter: brightness(1);
    }

    50% {
        filter: brightness(1.3);
    }
}

@keyframes flameDance {
    0% {
        transform: rotate(-5deg) scale(1);
    }

    100% {
        transform: rotate(5deg) scale(1.1);
    }
}

/* Cute Character */
#cute-character {
    margin-top: 10px;
}

.character-body {
    position: relative;
    width: 120px;
    height: 130px;
    background: #fff;
    border-radius: 50% 50% 45% 45%;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: characterBob 2s ease-in-out infinite;
    box-shadow: 0 10px 40px rgba(255, 255, 255, 0.1);
}

@keyframes characterBob {

    0%,
    100% {
        transform: translateY(0) rotate(0deg);
    }

    25% {
        transform: translateY(-5px) rotate(-2deg);
    }

    75% {
        transform: translateY(-5px) rotate(2deg);
    }
}

.party-hat {
    position: absolute;
    top: -30px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 22px solid transparent;
    border-right: 22px solid transparent;
    border-bottom: 40px solid #ff6b9d;
    border-radius: 2px;
}

.party-hat::after {
    content: '';
    position: absolute;
    bottom: -44px;
    left: -22px;
    width: 44px;
    height: 8px;
    background: repeating-linear-gradient(90deg, #ffe66d, #ffe66d 4px, #ff6b9d 4px, #ff6b9d 8px);
    border-radius: 0 0 6px 6px;
}

.hat-pom {
    position: absolute;
    top: -10px;
    left: -5px;
    width: 10px;
    height: 10px;
    background: #ffe66d;
    border-radius: 50%;
}

.character-face {
    position: relative;
    width: 80px;
    height: 60px;
    margin-top: -10px;
}

.eye {
    position: absolute;
    width: 8px;
    height: 10px;
    background: #333;
    border-radius: 50%;
    top: 15px;
    animation: blink 3s ease-in-out infinite;
}

.eye.left {
    left: 18px;
}

.eye.right {
    right: 18px;
}

@keyframes blink {

    0%,
    95%,
    100% {
        transform: scaleY(1);
    }

    97% {
        transform: scaleY(0.1);
    }
}

.blush {
    position: absolute;
    width: 14px;
    height: 8px;
    background: rgba(255, 150, 150, 0.5);
    border-radius: 50%;
    top: 28px;
}

.blush.left {
    left: 8px;
}

.blush.right {
    right: 8px;
}

.mouth {
    position: absolute;
    width: 12px;
    height: 6px;
    border: 2px solid #333;
    border-top: none;
    border-radius: 0 0 12px 12px;
    bottom: 15px;
    left: 50%;
    transform: translateX(-50%);
}

.character-arm {
    position: absolute;
    width: 30px;
    height: 50px;
    background: #fff;
    border-radius: 15px;
    bottom: 10px;
}

.left-arm {
    left: -15px;
    transform: rotate(15deg);
    animation: strum 0.6s ease-in-out infinite alternate;
}

.right-arm {
    right: -15px;
    transform: rotate(-15deg);
}

@keyframes strum {
    0% {
        transform: rotate(15deg) translateY(0);
    }

    100% {
        transform: rotate(20deg) translateY(-3px);
    }
}

.guitar {
    font-size: 2rem;
    position: absolute;
    bottom: -5px;
    left: -15px;
    transform: rotate(-30deg);
}

/* ===== SECTION 3: ALBUM ===== */
#album-section {
    background: #0a0a2e;
}

#album-container {
    position: relative;
    z-index: 2;
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    padding: 10px 0;
    scrollbar-width: none;
}

#album-container::-webkit-scrollbar {
    display: none;
}

.album-slide {
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    width: 100%;
    animation: slideIn 0.6s ease;
}

.album-slide.active {
    display: flex;
}

@keyframes slideIn {
    0% {
        opacity: 0;
        transform: translateX(60px);
    }

    100% {
        opacity: 1;
        transform: translateX(0);
    }
}

.message-card {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 16px;
    padding: 24px 28px;
    width: 100%;
    position: relative;
    box-shadow: 0 8px 32px rgba(255, 105, 180, 0.15);
}

.message-card p {
    font-family: 'Dancing Script', cursive;
    font-size: clamp(1rem, 3.5vw, 1.4rem);
    color: #333;
    line-height: 1.6;
    text-align: center;
}

.message-card .heart-icon {
    position: absolute;
    top: -8px;
    right: -8px;
    font-size: 1.2rem;
    animation: heartFloat 2s ease-in-out infinite;
}

@keyframes heartFloat {

    0%,
    100% {
        transform: translateY(0) scale(1);
    }

    50% {
        transform: translateY(-5px) scale(1.1);
    }
}

.photo-pair {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    width: 100%;
}

.photo-pair img {
    width: 100%;
    aspect-ratio: 3/4;
    object-fit: cover;
    border-radius: 12px;
    border: 3px solid rgba(255, 255, 255, 0.9);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    transition: transform 0.3s ease;
}

.photo-pair img:hover {
    transform: scale(1.03);
}

/* Album Navigation */
#album-nav {
    position: relative;
    z-index: 3;
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: 20px;
}

.nav-btn {
    background: rgba(255, 255, 255, 0.15);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: #fff;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
}

.nav-btn:hover {
    background: rgba(255, 105, 180, 0.3);
    border-color: rgba(255, 105, 180, 0.6);
    transform: scale(1.1);
}

#slide-dots {
    display: flex;
    gap: 8px;
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transition: all 0.3s ease;
    cursor: pointer;
}

.dot.active {
    background: #ff69b4;
    transform: scale(1.3);
    box-shadow: 0 0 10px rgba(255, 105, 180, 0.5);
}

/* Floating Hearts */
#floating-hearts {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    overflow: hidden;
}

.floating-heart {
    position: absolute;
    font-size: 1rem;
    opacity: 0;
    animation: floatUp 6s ease-in-out infinite;
}

@keyframes floatUp {
    0% {
        opacity: 0;
        transform: translateY(100vh) rotate(0deg);
    }

    10% {
        opacity: 0.7;
    }

    90% {
        opacity: 0.7;
    }

    100% {
        opacity: 0;
        transform: translateY(-20px) rotate(360deg);
    }
}

/* ===== SECTION 4: HEART COLLAGE ===== */
#heart-section {
    background: #0a0a2e;
}

#heart-collage {
    position: relative;
    z-index: 2;
    width: 320px;
    height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.heart-photo {
    position: absolute;
    width: 45px;
    height: 45px;
    border-radius: 6px;
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, 0.8);
    box-shadow: 0 2px 15px rgba(255, 105, 180, 0.3);
    opacity: 0;
    animation: flyToHeart 1.5s ease forwards;
}

@keyframes flyToHeart {
    0% {
        opacity: 0;
        transform: translate(var(--start-x), var(--start-y)) rotate(var(--start-rot)) scale(0.3);
    }

    60% {
        opacity: 1;
        transform: translate(0, 0) rotate(0deg) scale(1.2);
    }

    100% {
        opacity: 1;
        transform: translate(0, 0) rotate(0deg) scale(1);
    }
}

#final-message {
    position: relative;
    z-index: 2;
    text-align: center;
    margin-top: 30px;
    opacity: 0;
    animation: fadeInUp 1s ease 3s forwards;
}

#final-message p {
    font-family: 'Great Vibes', cursive;
    font-size: clamp(1.8rem, 5vw, 3rem);
    background: linear-gradient(135deg, #ff69b4, #ff1493, #ff69b4);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: none;
    filter: drop-shadow(0 0 20px rgba(255, 105, 180, 0.4));
}

#final-message .sub-message {
    font-family: 'Dancing Script', cursive;
    font-size: clamp(1rem, 3vw, 1.5rem);
    margin-top: 10px;
    background: linear-gradient(135deg, #ffd700, #ffb347);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ===== MUSIC TOGGLE ===== */
#music-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 100;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    font-size: 1.2rem;
    cursor: pointer;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

#music-toggle:hover {
    background: rgba(255, 105, 180, 0.2);
    border-color: rgba(255, 105, 180, 0.5);
    transform: scale(1.1);
}

#music-toggle.playing {
    border-color: rgba(255, 105, 180, 0.6);
    animation: musicPulse 1.5s ease-in-out infinite;
}

@keyframes musicPulse {

    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(255, 105, 180, 0.4);
    }

    50% {
        box-shadow: 0 0 0 10px rgba(255, 105, 180, 0);
    }
}

/* ===== RESPONSIVE ===== */

/* Tablets & small laptops */
@media (max-width: 768px) {
    #countdown {
        font-size: clamp(3rem, 10vw, 6rem);
    }

    #candle-text {
        gap: 2px;
    }

    .candle-letter {
        font-size: clamp(1.2rem, 4vw, 2rem);
    }

    .candle-letter::before {
        font-size: clamp(0.6rem, 2vw, 1rem);
    }

    .message-card {
        padding: 18px 20px;
    }

    .message-card p {
        font-size: clamp(0.9rem, 3vw, 1.2rem);
    }

    .photo-pair img {
        border-radius: 10px;
        border-width: 2px;
    }
}

/* Phones */
@media (max-width: 480px) {
    .character-body {
        width: 85px;
        height: 95px;
    }

    .party-hat {
        top: -25px;
        border-left-width: 18px;
        border-right-width: 18px;
        border-bottom-width: 32px;
    }

    .party-hat::after {
        bottom: -36px;
        left: -18px;
        width: 36px;
        height: 6px;
    }

    .guitar {
        font-size: 1.4rem;
    }

    .character-arm {
        width: 22px;
        height: 38px;
    }

    #character-content {
        gap: 14px;
    }

    #album-container {
        width: 94%;
        gap: 12px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .message-card {
        padding: 14px 16px;
        border-radius: 12px;
    }

    .message-card p {
        font-size: 0.95rem;
        line-height: 1.5;
    }

    .photo-pair {
        gap: 8px;
    }

    .photo-pair img {
        border-radius: 8px;
        border-width: 2px;
    }

    #heart-collage {
        width: 260px;
        height: 240px;
    }

    .heart-photo {
        width: 35px;
        height: 35px;
        border-radius: 4px;
    }

    .nav-btn {
        width: 36px;
        height: 36px;
        font-size: 1.2rem;
    }

    #album-nav {
        margin-top: 12px;
    }

    #final-message p {
        font-size: clamp(1.4rem, 5vw, 2.2rem);
    }

    #final-message .sub-message {
        font-size: clamp(0.9rem, 3vw, 1.2rem);
    }

    #music-toggle {
        top: 12px;
        right: 12px;
        width: 38px;
        height: 38px;
        font-size: 1rem;
    }
}

/* Very small phones */
@media (max-width: 360px) {
    #countdown {
        font-size: clamp(2.5rem, 9vw, 4rem);
    }

    .candle-letter {
        font-size: 1rem;
    }

    .candle-letter::before {
        font-size: 0.6rem;
    }

    .character-body {
        width: 70px;
        height: 80px;
    }

    #heart-collage {
        width: 220px;
        height: 200px;
    }

    .heart-photo {
        width: 28px;
        height: 28px;
    }

    .message-card p {
        font-size: 0.85rem;
    }

    #final-message {
        margin-top: 20px;
    }
}

/* Landscape phones */
@media (max-height: 500px) and (orientation: landscape) {
    #character-content {
        flex-direction: row;
        gap: 30px;
    }

    .character-body {
        width: 70px;
        height: 80px;
    }

    #album-container {
        max-height: 70vh;
    }

    .photo-pair img {
        aspect-ratio: 4/3;
    }

    #heart-collage {
        width: 200px;
        height: 180px;
    }

    .heart-photo {
        width: 25px;
        height: 25px;
    }

    #final-message {
        margin-top: 10px;
    }
}