
:root {
    --bg: #090609;
    --surface: #160b10;
    --crimson: #c71940;
    --bright: #ff3158;
    --text: #f7e9ec;
    --muted: #a9959b;
    --serif: "Cormorant Garamond", Georgia, serif;
    --sans: "Inter", sans-serif;
}

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

html {
    scroll-behavior: smooth;
}

body {
    min-height: 100vh;
    overflow-x: hidden;
    background: var(--bg);
    color: var(--text);
    font-family: var(--sans);
}

#stars {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

.ambient-glow {
    position: fixed;
    width: 500px;
    height: 500px;
    left: 50%;
    top: 45%;
    transform: translate(-50%, -50%);
    background: radial-gradient(circle, rgba(150, 10, 45, .13), transparent 70%);
    pointer-events: none;
    z-index: 0;
}

.topbar, footer {
    position: fixed;
    left: 0;
    width: 100%;
    padding: 22px 7%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 10;
}

.topbar {
    top: 0;
}

footer {
    bottom: 0;
    font-size: 9px;
    letter-spacing: 2px;
    color: #806e74;
}

.brand {
    font-size: 12px;
    letter-spacing: 5px;
    font-weight: 600;
}

.music-button {
    border: 1px solid #4a2832;
    color: var(--text);
    background: rgba(30, 10, 18, .7);
    border-radius: 30px;
    padding: 9px 15px;
    font-size: 11px;
    cursor: pointer;
}

main {
    position: relative;
    z-index: 1;
}

.scene {
    min-height: 100svh;
    width: 100%;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 100px 22px 85px;
    text-align: center;
    animation: sceneEnter 1s ease both;
}

.scene.active {
    display: flex;
}

@keyframes sceneEnter {
    from {
        opacity: 0;
        transform: translateY(15px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.eyebrow {
    font-size: 9px;
    letter-spacing: 4px;
    color: #d56b82;
    display: block;
    margin-bottom: 22px;
}

h1, h2 {
    font-family: var(--serif);
    font-weight: 400;
    line-height: 1.08;
}

h1 {
    font-size: clamp(42px, 8vw, 78px);
}

h2 {
    font-size: clamp(32px, 6vw, 52px);
}

h1 em, h2 em {
    color: #f05272;
    font-weight: 400;
}

.intro-content p,
#finalScene p {
    color: var(--muted);
    font-size: 13px;
    line-height: 2;
    margin-top: 25px;
}

.primary-button {
    border: 1px solid #963149;
    background: linear-gradient(120deg, #8e1230, #d01e48);
    color: white;
    padding: 15px 25px;
    border-radius: 3px;
    font-family: var(--sans);
    font-size: 11px;
    letter-spacing: 1px;
    cursor: pointer;
    margin-top: 35px;
    box-shadow: 0 0 30px rgba(205, 24, 65, .15);
    transition: .3s ease;
}

.primary-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 0 35px rgba(255, 40, 85, .35);
}

.primary-button span {
    margin-left: 8px;
}

.bottom-note {
    position: absolute;
    bottom: 90px;
    color: #806b73;
    font-size: 9px;
    letter-spacing: 3px;
}

.section-heading {
    margin-bottom: 15px;
}

.heart-wrapper {
    width: min(95vw, 570px);
    height: min(95vw, 570px);
    max-height: 55vh;
    display: grid;
    place-items: center;
}

#heartCanvas {
    width: 100%;
    height: 100%;
}

.scene-caption, .ring-caption {
    color: var(--muted);
    font-size: 12px;
    line-height: 1.8;
}

.letter-card {
    width: min(100%, 550px);
    padding: 35px 28px;
    background: linear-gradient(145deg, rgba(39, 13, 24, .9), rgba(15, 8, 12, .9));
    border: 1px solid rgba(202, 54, 91, .3);
    box-shadow: 0 15px 80px rgba(0, 0, 0, .35);
    text-align: left;
}

.letter-card h2 {
    margin-bottom: 25px;
}

#letterText {
    color: #d8c1c8;
    font-family: var(--serif);
    font-size: 20px;
    line-height: 1.8;
    min-height: 130px;
    white-space: pre-line;
}

.letter-signature {
    margin-top: 25px;
    color: #c99da9;
    font-family: var(--serif);
    line-height: 1.7;
}

.letter-signature em {
    color: #f05b7a;
}

.secret-box {
    margin-top: 35px;
    padding: 35px;
    width: min(100%, 360px);
    background: rgba(45, 12, 25, .55);
    border: 1px solid #612536;
}

.envelope {
    width: 100px;
    height: 75px;
    margin: auto;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, #8f1737, #3e101e);
    font-size: 35px;
    box-shadow: 0 0 35px rgba(255, 25, 75, .2);
    animation: heartbeat 2s infinite;
}

.secret-box p {
    margin-top: 20px;
    font-size: 12px;
    color: var(--muted);
}

.secret-message {
    max-width: 420px;
    color: #f4c4d0;
    font-family: var(--serif);
    font-size: 25px;
    line-height: 1.6;
    margin-top: 30px;
    animation: sceneEnter 1.5s ease;
}

.hidden {
    display: none !important;
}

.final-heart {
    font-size: 85px;
    color: #ef2854;
    filter: drop-shadow(0 0 25px #e91d4b);
    animation: heartbeat 1.5s infinite;
    margin-bottom: 25px;
}

@keyframes heartbeat {
    0%, 100% { transform: scale(1); }
    15% { transform: scale(1.13); }
    30% { transform: scale(1); }
    45% { transform: scale(1.08); }
}

@media (max-width: 600px) {
    .topbar {
        padding: 20px;
    }

    footer {
        padding: 15px 20px;
    }

    .scene {
        padding-left: 18px;
        padding-right: 18px;
    }

    .letter-card {
        padding: 27px 22px;
    }

    .heart-wrapper {
        max-height: 48vh;
    }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .01ms !important;
        transition-duration: .01ms !important;
    }
}

/* ETERNAL — cosmic atmosphere */
#heartScene,
#ringScene {
    position: relative;
    isolation: isolate;
}

#heartScene::before,
#ringScene::before {
    content: "";
    position: absolute;
    width: min(90vw, 650px);
    height: min(90vw, 650px);
    left: 50%;
    top: 48%;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    background: radial-gradient(
        circle,
        rgba(190, 0, 48, .12),
        rgba(90, 0, 30, .04) 45%,
        transparent 72%
    );
    filter: blur(35px);
    z-index: -1;
    pointer-events: none;
}

#heartCanvas {
    filter: drop-shadow(0 0 12px rgba(255, 20, 75, .35));
}

#ringContainer {
    filter: drop-shadow(0 0 20px rgba(255, 0, 55, .15));
}

/* =========================================
   ETERNAL LOVEPRINT OPENING
========================================= */

#intro {
    position: relative;
    isolation: isolate;
    overflow: hidden;
}

.loveprint-content {
    width: min(100%, 520px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.loveprint-title {
    font-size: clamp(54px, 12vw, 82px);
    line-height: .86;
    letter-spacing: -2px;
}

.loveprint-title em {
    color: #f2b4c1;
}

.loveprint-subtitle {
    margin-top: 24px;
    color: var(--muted);
    font-size: 13px;
    letter-spacing: .3px;
}

.fingerprint-orbit {
    width: min(68vw, 245px);
    aspect-ratio: 1;
    margin-top: 48px;
    position: relative;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: conic-gradient(
        from 0deg,
        rgba(199, 25, 64, .12),
        #f05272,
        rgba(199, 25, 64, .12) 72%,
        transparent
    );
    animation: fingerprintOrbit 12s linear infinite;
    box-shadow: 0 0 50px rgba(199, 25, 64, .12);
}

.fingerprint-progress {
    position: absolute;
    inset: 7px;
    border-radius: 50%;
    background: var(--bg);
}

.fingerprint-disc {
    position: relative;
    z-index: 1;
    width: 76%;
    aspect-ratio: 1;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: radial-gradient(circle, #32131e, #160b10 75%);
    border: 1px solid rgba(230, 126, 151, .28);
    box-shadow: inset 0 0 35px rgba(199, 25, 64, .12);
    animation: fingerprintPulse 3s ease-in-out infinite;
}

.fingerprint-heart {
    width: 65%;
    height: 65%;
    color: #f4dce2;
    filter: drop-shadow(0 0 8px rgba(255, 190, 205, .28));
    animation: fingerprintHeartGlow 3s ease-in-out infinite;
}

.loveprint-caption {
    margin-top: 22px;
    color: #c9a6af;
    font-family: var(--serif);
    font-size: 19px;
    font-style: italic;
}

@keyframes fingerprintOrbit {
    to { transform: rotate(360deg); }
}

@keyframes fingerprintPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.045); }
}

@keyframes fingerprintHeartGlow {
    0%, 100% { opacity: .78; }
    50% { opacity: 1; }
}

/* =========================================
   FINAL SCAN BEFORE THE RING
========================================= */

#scanScene {
    position: relative;
    isolation: isolate;
}

.scan-intro {
    margin-top: 18px;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.8;
}

.final-scan-orbit {
    width: min(68vw, 250px);
    aspect-ratio: 1;
    margin: 38px auto 24px;
    display: grid;
    place-items: center;
}

.final-scan-ring {
    --scan-progress: 0%;
    width: 100%;
    height: 100%;
    padding: 8px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: conic-gradient(
        #ff5478 var(--scan-progress),
        rgba(199, 25, 64, .14) var(--scan-progress)
    );
    box-shadow: 0 0 45px rgba(199, 25, 64, .15);
    transition: background .08s linear;
}

.final-scan-core {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: radial-gradient(circle, #27101a, #10080d 78%);
    border: 1px solid rgba(235, 118, 148, .25);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 9px;
    box-shadow: inset 0 0 35px rgba(199, 25, 64, .12);
}

.scan-heart {
    color: #ff5278;
    font-size: 42px;
    filter: drop-shadow(0 0 14px rgba(255, 49, 88, .7));
    animation: heartbeat 1.5s infinite;
}

#scanPercent {
    color: #f8dce4;
    font-family: var(--serif);
    font-size: 28px;
    font-weight: 500;
}

.final-scan-status {
    color: #d56b82;
    font-size: 10px;
    letter-spacing: 3px;
    line-height: 1.8;
}

@media (max-width: 600px) {
    .fingerprint-orbit {
        margin-top: 38px;
    }

    .loveprint-caption {
        font-size: 17px;
    }

    .final-scan-orbit {
        margin-top: 32px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .fingerprint-orbit,
    .fingerprint-disc,
    .fingerprint-heart {
        animation: none !important;
    }
}

/* ETERNAL — welcome and fingerprint challenge */

.fingerprint-enter {
    display: block;
    padding: 0;
    border: 0;
    color: inherit;
    background: transparent;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.fingerprint-enter:focus-visible,
.challenge-fingerprint:focus-visible {
    outline: 2px solid #ff7894;
    outline-offset: 9px;
}

.welcome-heart {
    margin: 24px 0;
    color: #ff3158;
    font-size: clamp(4rem, 18vw, 7rem);
    line-height: 1;
    text-shadow: 0 0 24px #ff315888, 0 0 70px #c7194077;
    animation: fingerprintPulse 2.5s ease-in-out infinite;
}

#challengeScene {
    gap: 18px;
}

.challenge-instructions {
    max-width: 440px;
    margin-inline: auto;
}

.challenge-stats {
    display: flex;
    justify-content: center;
    gap: clamp(32px, 12vw, 80px);
    margin: 12px 0;
}

.challenge-stat {
    display: grid;
    gap: 5px;
    text-align: center;
}

.challenge-stat strong {
    color: #fff0f3;
    font-family: "Cormorant Garamond", serif;
    font-size: clamp(2.5rem, 10vw, 4rem);
    font-weight: 500;
    line-height: 1;
    text-shadow: 0 0 22px #ff315855;
    font-variant-numeric: tabular-nums;
}

.challenge-fingerprint {
    position: relative;
    display: grid;
    place-items: center;
    width: clamp(170px, 48vw, 220px);
    aspect-ratio: 1;
    margin: 8px auto;
    overflow: hidden;
    border: 1px solid #ff557777;
    border-radius: 50%;
    color: #ff5577;
    background:
        radial-gradient(circle, #481020 0%, #210b13 58%, #10080c 100%);
    box-shadow: 0 0 35px #d51c4a33, inset 0 0 35px #ff315822;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    transition: transform 100ms ease, box-shadow 150ms ease;
}

.challenge-fingerprint:active {
    transform: scale(.94);
    box-shadow: 0 0 55px #ff315877, inset 0 0 45px #ff315855;
}

.challenge-fingerprint:disabled {
    cursor: default;
    opacity: .65;
}

.challenge-fingerprint-glow {
    position: absolute;
    inset: 12%;
    border: 1px solid #ff789455;
    border-radius: 50%;
    box-shadow: 0 0 25px #ff315833;
    animation: fingerprintOrbit 12s linear infinite;
}

.challenge-fingerprint-heart {
    font-size: clamp(4.5rem, 20vw, 6.5rem);
    line-height: 1;
    text-shadow: 0 0 18px #ff3158, 0 0 45px #ff3158aa;
    animation: fingerprintPulse 1.3s ease-in-out infinite;
}

.challenge-tap-hint {
    position: absolute;
    bottom: 22%;
    color: #f7c4d0;
    font-size: .65rem;
    letter-spacing: .3em;
}

.challenge-status {
    min-height: 1.5em;
    color: #d7b9c2;
    text-align: center;
}

.challenge-result {
    display: grid;
    justify-items: center;
    gap: 12px;
    margin: 8px auto 24px;
    text-align: center;
}

.challenge-result strong {
    color: #ff5577;
    font-family: "Cormorant Garamond", serif;
    font-size: clamp(3.5rem, 15vw, 5.5rem);
    font-weight: 500;
    text-shadow: 0 0 30px #ff315866;
}

.challenge-result p {
    color: #d7b9c2;
}

.challenge-finished .challenge-fingerprint-heart {
    animation: none;
}

@media (prefers-reduced-motion: reduce) {
    .welcome-heart,
    .challenge-fingerprint-glow,
    .challenge-fingerprint-heart {
        animation: none;
    }
}

/* INTRO LAYOUT REFINEMENT */

#intro {
    padding: 48px 20px 38px;
}

#intro .loveprint-content {
    width: min(100%, 520px);
    min-height: min(690px, calc(100svh - 130px));
    margin-inline: auto;
    justify-content: center;
    gap: 0;
    text-align: center;
}

#intro .eyebrow {
    margin-bottom: 25px;
}

#intro .loveprint-title {
    margin: 0;
    font-size: clamp(54px, 11vw, 78px);
    line-height: .94;
    letter-spacing: -2.5px;
}

#intro .loveprint-subtitle {
    max-width: 290px;
    margin: 22px auto 0;
    line-height: 1.7;
    font-size: 14px;
}

#intro .fingerprint-orbit {
    flex: 0 0 auto;
    width: min(62vw, 230px);
    margin: 42px auto 0;
    padding: 0;
    border: 0;
    appearance: none;
    -webkit-appearance: none;
    color: inherit;
    cursor: pointer;
    touch-action: none;
    -webkit-tap-highlight-color: transparent;
    --hold-progress: 0%;
    background: conic-gradient(
        from -90deg,
        #ff7894 0 var(--hold-progress),
        rgba(199, 25, 64, .13) var(--hold-progress) 100%
    );
}

#intro .fingerprint-orbit.is-holding {
    animation: none;
    box-shadow: 0 0 55px rgba(255, 49, 88, .35);
}

#intro .fingerprint-progress {
    background: var(--bg);
}

#intro .fingerprint-disc {
    pointer-events: none;
}

#intro .fingerprint-heart {
    pointer-events: none;
}

#intro .loveprint-caption {
    max-width: 290px;
    min-height: 2.8em;
    margin: 25px auto 0;
    color: #e7b6c2;
    font-family: Inter, sans-serif;
    font-size: 10px;
    font-style: normal;
    font-weight: 500;
    letter-spacing: .2em;
    line-height: 1.8;
    text-align: center;
}

#intro .bottom-note {
    margin-top: 15px;
}

#intro .fingerprint-enter:focus-visible {
    outline: 2px solid #ff7894;
    outline-offset: 12px;
}

@media (max-height: 720px) {
    #intro {
        padding-top: 25px;
        padding-bottom: 20px;
    }

    #intro .loveprint-content {
        min-height: auto;
    }

    #intro .eyebrow {
        margin-bottom: 16px;
    }

    #intro .loveprint-title {
        font-size: clamp(48px, 10vw, 66px);
    }

    #intro .loveprint-subtitle {
        margin-top: 14px;
    }

    #intro .fingerprint-orbit {
        width: min(48vw, 190px);
        margin-top: 25px;
    }

    #intro .loveprint-caption {
        margin-top: 17px;
    }
}

@media (prefers-reduced-motion: reduce) {
    #intro .fingerprint-orbit.is-holding {
        animation: none;
    }
}
