@import url('https://fonts.googleapis.com/css2?family=Delius&family=Pacifico&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html,
body {
    width: 100%;
    height: 100%;
}

body {
    overflow: hidden;
    font-family: Arial, Helvetica, sans-serif;
    color: white;
    background: radial-gradient(circle at 50% 30%, #85162a 0%, #55101d 35%, #27070e 70%, #100205 100%);
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    background: linear-gradient(120deg, rgba(255, 60, 90, 0.04), transparent 35%, rgba(255, 0, 55, 0.035));
    pointer-events: none;
}

.background-glow {
    position: fixed;
    left: 50%;
    top: 45%;
    width: 650px;
    height: 650px;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 25, 70, 0.19), rgba(255, 20, 60, 0.05) 45%, transparent 70%);
    filter: blur(35px);
    pointer-events: none;
    will-change: transform, filter, opacity;
    z-index: 0;
    transition: filter 1.05s ease, opacity 1.05s ease;
}

#backgroundHearts {
    position: fixed;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    z-index: 0;
    transition: filter 1.05s ease, opacity 1.05s ease;
}

.floating-heart {
    position: absolute;
    bottom: -60px;
    color: rgba(255, 120, 145, 0.30);
    user-select: none;
    will-change: transform, opacity;
    animation: floatingHeart linear forwards;
}

@keyframes floatingHeart {
    0% {
        transform: translate3d(0, 0, 0) scale(0.75);
        opacity: 0;
    }

    10% {
        opacity: 0.72;
    }

    50% {
        transform: translate3d(18px, -55vh, 0) scale(1);
    }

    100% {
        transform: translate3d(-10px, -115vh, 0) scale(0.9);
        opacity: 0;
    }
}

.scene {
    position: relative;
    width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 34px;
    z-index: 2;
    opacity: 1;
    transform: scale(1);
    transition: opacity 0.32s ease, transform 0.32s ease, filter 1.05s ease;
}

body.video-mode .scene {
    opacity: 0;
    transform: scale(0.985);
    pointer-events: none;
}

.heart-zone {
    position: relative;
    width: 300px;
    height: 285px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.heart-mouse {
    width: 190px;
    position: relative;
    will-change: transform, width;
    transform-style: preserve-3d;
    backface-visibility: hidden;
    transition: width 2.8s cubic-bezier(.18, .85, .2, 1);
}

.heart-zone::before,
.heart-zone::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    width: 260px;
    height: 260px;
    transform: translate(-50%, -50%) scale(0.85);
    border-radius: 50%;
    border: 1px solid rgba(255, 118, 145, 0);
    pointer-events: none;
    opacity: 0;
}

body.final-mode .heart-zone::before {
    animation: heartWave 1.8s infinite ease-out;
}

body.final-mode .heart-zone::after {
    animation: heartWave 1.8s 0.9s infinite ease-out;
}

@keyframes heartWave {
    0% {
        opacity: 0.35;
        transform: translate(-50%, -50%) scale(0.9);
        border-color: rgba(255, 118, 145, 0.36);
    }

    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(1.65);
        border-color: rgba(255, 118, 145, 0);
    }
}

.heart-svg {
    display: block;
    width: 100%;
    overflow: visible;
    filter: drop-shadow(0 9px 10px rgba(0, 0, 0, 0.25)) drop-shadow(0 0 22px rgba(255, 20, 60, 0.55));
    will-change: filter;
    backface-visibility: hidden;
}

.heart-content {
    transform-origin: center center;
    transform-box: fill-box;
    animation: heartbeat 1.35s cubic-bezier(.25, .8, .35, 1) infinite;
    will-change: transform;
    backface-visibility: hidden;
}

@keyframes heartbeat {
    0%, 100% { transform: translateZ(0) scale(1); }
    13% { transform: translateZ(0) scale(1.085); }
    22% { transform: translateZ(0) scale(1); }
    34% { transform: translateZ(0) scale(1.055); }
    44% { transform: translateZ(0) scale(1); }
}

.heart-content.hit {
    animation: heartHit 0.28s cubic-bezier(.2, .9, .3, 1);
}

@keyframes heartHit {
    0% { transform: translateZ(0) scale(1); }
    35% { transform: translateZ(0) scale(1.20); }
    66% { transform: translateZ(0) scale(0.97); }
    100% { transform: translateZ(0) scale(1); }
}

.heart-base {
    transition: opacity 0.35s ease;
}

.heart-highlight {
    fill: none;
    stroke: rgba(255, 255, 255, 0.13);
    stroke-width: 8;
}

.heart-image {
    opacity: 0;
    filter: blur(24px) saturate(0.7) brightness(0.82);
    transform: translateY(-10px) scale(0.92);
    transform-origin: center;
    transform-box: fill-box;
    transition: opacity 2.35s ease, filter 2.65s cubic-bezier(.2, .75, .25, 1), transform 2.8s cubic-bezier(.15, .82, .2, 1);
}

.heart-zone.show-photo .heart-image {
    opacity: 1;
    filter: blur(0) saturate(1) brightness(1);
    transform: translateY(-28px) scale(1.12);
}

.heart-zone.show-photo .heart-base {
    opacity: 0.10;
}

.heart-zone.show-photo .heart-mouse {
    width: 228px;
}

.final-photo-group {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
}

.final-heart-image {
    pointer-events: none;
}

.inner-love-text {
    fill: #fff7fa;
    font-size: 34px;
    font-family: 'Pacifico', 'Delius', cursive;
    paint-order: stroke;
    stroke: rgba(64, 0, 18, 0.36);
    stroke-width: 4px;
    letter-spacing: 0.3px;
}

.final-info {
    display: none;
    opacity: 0;
    text-align: center;
    color: #fff8fb;
    font-family: 'Pacifico', 'Delius', cursive;
    font-weight: 400;
    letter-spacing: 0.4px;
    text-shadow: 0 3px 9px rgba(0, 0, 0, 0.26);
    transition: opacity 0.75s ease, transform 0.75s cubic-bezier(.18, .78, .2, 1);
}

.final-info p {
    font-size: clamp(26px, 3.1vw, 36px);
    line-height: 1.12;
}

.final-info p + p {
    margin-top: 10px;
}

body.final-mode .final-photo-group {
    opacity: 1;
}

body.final-mode .final-info {
    display: block;
}

body.final-mode .heart-base {
    opacity: 0.94;
}

body.final-mode .heart-image {
    opacity: 0 !important;
    filter: blur(0);
}

body.final-mode .heart-zone {
    width: min(92vw, 560px);
    height: min(58vh, 470px);
    animation: finalHeartEntrance 0.78s cubic-bezier(.18, .78, .2, 1) both;
}

@keyframes finalHeartEntrance {
    from {
        opacity: 0;
        transform: translateY(72px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

body.final-mode .heart-mouse {
    width: min(82vw, 450px);
    transition: none;
}

body.final-mode .heart-svg {
    filter: drop-shadow(0 8px 12px rgba(0, 0, 0, 0.22)) drop-shadow(0 0 20px rgba(255, 70, 105, 0.70)) drop-shadow(0 0 50px rgba(255, 0, 55, 0.34));
}

body.final-mode .heart-content {
    animation: finalHeartBeat 1.08s cubic-bezier(.22, .8, .3, 1) infinite;
}

body.final-mode.music-visualizer .heart-content {
    animation: none;
}

body.final-mode.music-visualizer .heart-mouse {
    width: min(76vw, 450px);
    z-index: 1;
}

body.final-mode.music-visualizer .heart-zone::before {
    animation: none;
    width: min(86vw, 480px);
    height: min(86vw, 480px);
    transform: translate(-50%, -50%);
    border: 0;
    background: radial-gradient(circle, rgba(255, 90, 130, 0.46), rgba(255, 35, 85, 0.14) 45%, transparent 72%);
    filter: blur(18px);
    opacity: var(--audio-glow, 0);
}

body.final-mode.music-visualizer .heart-zone::after {
    animation: none;
    opacity: 0;
}

.surrounding-hearts-layer {
    position: absolute;
    inset: 0;
    pointer-events: none;
    transform-origin: center;
    will-change: transform;
}

@keyframes finalHeartBeat {
    0%, 100% { transform: translateZ(0) scale(1); }
    16% { transform: translateZ(0) scale(1.038); }
    29% { transform: translateZ(0) scale(1); }
    42% { transform: translateZ(0) scale(1.02); }
    55% { transform: translateZ(0) scale(1); }
}

.final-enter-item {
    opacity: 0;
    transform: translateY(72px);
    transition: opacity 0.78s ease, transform 0.78s cubic-bezier(.18, .78, .2, 1);
}

.final-enter-item.revealed {
    opacity: 1;
    transform: translateY(0);
}

.question {
    text-align: center;
    transition: opacity 0.35s ease, transform 0.35s ease;
}

.question h1 {
    margin-bottom: 26px;
    font-size: clamp(22px, 3vw, 32px);
    font-weight: 500;
    text-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
}

.scene.final-sequence .question {
    opacity: 0;
    transform: translateY(10px);
    pointer-events: none;
}

.buttons {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 18px;
    flex-wrap: wrap;
}

.option {
    min-width: 125px;
    padding: 13px 25px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 100px;
    background: rgba(255, 255, 255, 0.09);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: white;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.14);
    transition: transform 0.16s ease, background 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
    will-change: transform;
}

.option:hover {
    transform: translateY(-4px);
    background: rgba(255, 255, 255, 0.16);
    border-color: rgba(255, 255, 255, 0.32);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.22);
}

.option:active {
    transform: translateY(-1px) scale(0.97);
}

.fragment {
    position: fixed;
    z-index: 100;
    pointer-events: none;
    border-radius: 3px;
    background: rgba(255, 225, 232, 0.9);
    box-shadow: 0 0 9px rgba(255, 40, 80, 0.25);
    will-change: transform, opacity;
}

.video-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    background: transparent;
    opacity: 0;
    transition: opacity 0.36s cubic-bezier(.2, .75, .25, 1), filter 1.05s ease;
    pointer-events: none;
}

.video-overlay::before {
    content: "";
    position: absolute;
    width: min(66vw, 560px);
    aspect-ratio: 9 / 16;
    border-radius: 38px;
    background: rgba(255, 18, 64, 0.22);
    filter: blur(46px);
    opacity: 0;
    transform: scale(0.88);
    transition: opacity 0.38s ease, transform 0.44s ease;
}

.video-overlay.visible {
    opacity: 1;
    pointer-events: auto;
}

.video-overlay.visible::before {
    opacity: 0.72;
    transform: scale(1);
}

.video-overlay video {
    position: relative;
    z-index: 1;
    display: block;
    height: min(84vh, 900px);
    width: auto;
    max-width: 88vw;
    aspect-ratio: 9 / 16;
    object-fit: contain;
    border-radius: 22px;
    background: rgba(18, 2, 7, 0.72);
    box-shadow: 0 22px 70px rgba(0, 0, 0, 0.42), 0 0 0 1px rgba(255, 255, 255, 0.08);
    transform: translateY(8px) scale(0.985);
    transition: transform 0.42s cubic-bezier(.2, .75, .25, 1);
}

.video-overlay.visible video {
    transform: translateY(0) scale(1);
}

.video-gate {
    position: absolute;
    z-index: 3;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    display: none;
    padding: 13px 24px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 100px;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(10px);
    color: white;
    font-size: 16px;
    cursor: pointer;
}

.video-gate.show {
    display: block;
}

.ending-music-gate {
    position: absolute;
    z-index: 4;
    left: 50%;
    bottom: max(22px, env(safe-area-inset-bottom));
    transform: translateX(-50%);
    padding: 10px 18px;
    border: 1px solid rgba(255, 190, 205, 0.55);
    border-radius: 100px;
    background: rgba(57, 10, 27, 0.85);
    color: #fff8fb;
    font: 15px Arial, Helvetica, sans-serif;
    cursor: pointer;
}

.ending-music-gate[hidden] {
    display: none;
}

.heart-spark {
    position: fixed;
    z-index: 5;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #ff7893;
    box-shadow: 0 0 10px rgba(255, 60, 100, 0.9);
    pointer-events: none;
    will-change: transform, opacity;
}

.heart-spark.heart-shape {
    background: transparent;
    box-shadow: none;
    color: #ff92a8;
    line-height: 1;
    text-shadow: 0 0 10px rgba(255, 60, 100, 0.9);
}

.surrounding-heart {
    position: absolute;
    z-index: 2;
    color: #ffa0b6;
    line-height: 1;
    pointer-events: none;
    text-shadow: 0 0 12px rgba(255, 54, 99, 0.9);
    animation: surroundingHeartFloat 2.8s ease-in-out infinite;
    will-change: transform, opacity;
}

@keyframes surroundingHeartFloat {
    0%, 100% {
        opacity: 0.56;
        transform: translate(-50%, -50%) translateY(0) rotate(-8deg) scale(0.9);
    }

    50% {
        opacity: 0.98;
        transform: translate(-50%, -50%) translateY(-9px) rotate(8deg) scale(1.12);
    }
}

.scene.final-only .question {
    display: none;
}

.scene.final-only {
    gap: 8px;
}

@media (max-width: 600px) {
    .scene {
        gap: 28px;
    }

    .heart-zone {
        height: 250px;
    }

    .heart-mouse {
        width: 160px;
    }

    .heart-zone.show-photo .heart-mouse {
        width: 192px;
    }

    body.final-mode .heart-zone {
        width: 96vw;
        height: min(56vh, 430px);
    }

    body.final-mode .heart-mouse {
        width: min(88vw, 355px);
    }

    body.final-mode.music-visualizer .heart-mouse {
        width: min(74vw, 355px);
    }

    .buttons {
        width: 90vw;
        gap: 12px;
    }

    .option {
        min-width: 100px;
        padding: 12px 17px;
    }

    .video-overlay video {
        height: min(82vh, 760px);
        max-width: 90vw;
        border-radius: 18px;
    }

    .final-info p {
        font-size: clamp(24px, 5.6vw, 31px);
    }
}

@media (max-height: 560px) {
    body.final-mode .heart-mouse {
        width: min(82vw, 450px, calc(100vh - 180px));
    }

    body.final-mode.music-visualizer .heart-mouse {
        width: min(76vw, 450px, calc(100vh - 180px));
    }
}

@media (prefers-reduced-motion: reduce) {
    .floating-heart,
    .heart-content,
    body.final-mode .heart-content,
    body.final-mode .heart-zone::before,
    body.final-mode .heart-zone::after {
        animation-duration: 2.6s;
    }

    .surrounding-heart {
        animation: none;
        opacity: 0.75;
        transform: translate(-50%, -50%);
    }
}
