:root {
    color-scheme: dark;
    --rose: #ff77b7;
    --rose-bright: #ffb5d8;
    --violet: #9d7bff;
    --gold: #ffd8a8;
    --ink: #0b0920;
    --white: #fffafc;
    --glass: rgba(24, 15, 56, .42);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
    width: 100%;
    min-height: 100%;
    margin: 0;
}

body {
    overflow-x: hidden;
    background: #0b0920;
    color: var(--white);
    font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
    -webkit-tap-highlight-color: transparent;
}

button { font: inherit; }

.page-shell {
    position: relative;
    display: grid;
    grid-template-rows: auto 1fr auto;
    min-height: 100svh;
    overflow: hidden;
    isolation: isolate;
    background:
        linear-gradient(180deg, rgba(8, 7, 30, .08), rgba(8, 7, 30, .45)),
        url("../images/cosmic-love-bg.png") center / cover fixed;
}

.page-shell::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background: radial-gradient(circle at 50% 46%, transparent 0 18%, rgba(7, 5, 28, .2) 72%);
    pointer-events: none;
}

#starCanvas, #celebrationCanvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

#starCanvas { z-index: 0; opacity: .72; }
#celebrationCanvas { z-index: 9; }

.aurora {
    position: absolute;
    z-index: 0;
    width: 44vw;
    height: 44vw;
    border-radius: 50%;
    filter: blur(90px);
    opacity: .22;
    pointer-events: none;
    animation: auroraFloat 12s ease-in-out infinite alternate;
}

.aurora-one { left: -14vw; top: 14%; background: #d948b8; }
.aurora-two { right: -16vw; bottom: 0; background: #7650ff; animation-delay: -6s; }

.topbar, footer {
    position: relative;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: min(1180px, calc(100% - 48px));
    margin-inline: auto;
}

.topbar { padding-top: max(26px, env(safe-area-inset-top)); }

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .2em;
    text-transform: uppercase;
}

.brand-orbit {
    position: relative;
    width: 28px;
    height: 28px;
    border: 1px solid rgba(255, 255, 255, .45);
    border-radius: 50%;
    animation: spin 6s linear infinite;
}

.brand-orbit::before {
    content: "♥";
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    color: var(--rose-bright);
    font-size: 10px;
}

.brand-orbit i {
    position: absolute;
    top: -2px;
    left: 12px;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--gold);
    box-shadow: 0 0 10px var(--gold);
}

.sound-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border: 1px solid rgba(255, 255, 255, .16);
    border-radius: 999px;
    color: rgba(255, 255, 255, .78);
    background: rgba(16, 11, 45, .38);
    backdrop-filter: blur(14px);
    cursor: pointer;
    transition: border-color .25s, background .25s, transform .25s;
}

.sound-toggle:hover { transform: translateY(-2px); border-color: rgba(255, 181, 216, .5); }
.sound-toggle[aria-pressed="true"] { background: rgba(151, 69, 150, .28); color: white; }

.sound-waves { display: flex; align-items: center; gap: 2px; height: 14px; }
.sound-waves i { width: 2px; height: 4px; border-radius: 2px; background: currentColor; }
.sound-toggle[aria-pressed="true"] .sound-waves i { animation: wave .8s ease-in-out infinite alternate; }
.sound-toggle[aria-pressed="true"] .sound-waves i:nth-child(2) { animation-delay: -.4s; }
.sound-toggle[aria-pressed="true"] .sound-waves i:nth-child(3) { animation-delay: -.2s; }

.experience {
    position: relative;
    z-index: 2;
    display: grid;
    grid-template-columns: minmax(260px, .8fr) minmax(390px, 1.2fr);
    align-items: center;
    gap: clamp(20px, 5vw, 90px);
    width: min(1120px, calc(100% - 48px));
    margin: auto;
    padding: 32px 0;
}

.intro { position: relative; z-index: 4; }
.eyebrow { display: flex; align-items: center; gap: 12px; margin: 0 0 18px; color: var(--gold); font-size: 11px; letter-spacing: .34em; }
.eyebrow b { font: inherit; }
.eyebrow span { width: 34px; height: 1px; background: linear-gradient(90deg, transparent, var(--gold)); }

h1 {
    max-width: 480px;
    margin: 0;
    font-family: Georgia, "Songti SC", serif;
    font-size: clamp(54px, 8vw, 104px);
    font-weight: 500;
    line-height: .96;
    letter-spacing: -.06em;
    color: transparent;
    background: linear-gradient(115deg, #fff 20%, #ffd5e9 50%, #dec8ff 76%, #fff 90%);
    background-clip: text;
    -webkit-background-clip: text;
    filter: drop-shadow(0 8px 25px rgba(244, 131, 193, .22));
}

.subtitle { margin: 22px 0 0; color: rgba(255, 255, 255, .7); font-size: 15px; letter-spacing: .06em; }

.heart-stage {
    position: relative;
    display: grid;
    place-items: center;
    min-height: min(600px, 66svh);
    --hands-gap: clamp(34px, 4.5vw, 58px);
    --left-hand-angle: -5deg;
    --right-hand-angle: 5deg;
}

.halo {
    position: absolute;
    width: min(440px, 76vw);
    aspect-ratio: 1;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 113, 180, .22), rgba(152, 105, 255, .08) 43%, transparent 70%);
    filter: blur(4px);
    animation: breathe 3.4s ease-in-out infinite;
}

.orbit {
    position: absolute;
    border: 1px solid rgba(255, 255, 255, .13);
    border-radius: 50%;
    animation: spin 18s linear infinite;
}
.orbit-large { width: min(485px, 82vw); aspect-ratio: 1; }
.orbit-small { width: min(360px, 64vw); aspect-ratio: 1; animation-direction: reverse; animation-duration: 13s; }
.orbit i { position: absolute; display: block; width: 7px; height: 7px; border-radius: 50%; background: white; box-shadow: 0 0 16px 4px rgba(255, 186, 222, .8); }
.orbit i:nth-child(1) { top: 8%; left: 23%; }
.orbit i:nth-child(2) { right: -3px; top: 50%; background: var(--gold); }
.orbit i:nth-child(3) { bottom: 11%; left: 18%; width: 4px; height: 4px; }

.hand-gesture {
    position: absolute;
    top: 48%;
    left: 50%;
    z-index: 3;
    width: clamp(330px, 43vw, 530px);
    aspect-ratio: 1.5;
    transform: translate(-50%, -58%);
    animation: gestureFloat 4.8s ease-in-out infinite;
    perspective: 900px;
}

.heart-hands {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    user-select: none;
    will-change: transform;
    transform-origin: 50% 54%;
    filter: saturate(.96);
    transition: filter .3s ease;
}

.heart-hands-left {
    clip-path: inset(-12% 50% -12% -12%);
    transform-origin: 76% 56%;
    transform: translate3d(calc(var(--hands-gap) * -1), var(--gesture-lift, 7px), 0) rotate(var(--left-hand-angle)) scale(var(--gesture-scale, .93));
}

.heart-hands-right {
    clip-path: inset(-12% -12% -12% 50%);
    transform-origin: 24% 56%;
    transform: translate3d(var(--hands-gap), var(--gesture-lift, 7px), 0) rotate(var(--right-hand-angle)) scale(var(--gesture-scale, .93));
}

.gesture-energy {
    position: absolute;
    z-index: 1;
    left: 50%;
    top: 48%;
    width: 46%;
    aspect-ratio: 1;
    border-radius: 50%;
    opacity: var(--energy-opacity, .28);
    transform: translate(-50%, -50%) scale(var(--energy-scale, .72));
    background: radial-gradient(circle, rgba(255, 235, 247, .86) 0 3%, rgba(255, 111, 183, .42) 18%, rgba(168, 99, 255, .18) 44%, transparent 70%);
    filter: blur(2px);
    transition: opacity .2s;
}

.gesture-energy::before,
.gesture-energy::after {
    content: "";
    position: absolute;
    inset: -18%;
    border: 1px solid rgba(255, 197, 226, .28);
    border-radius: 50%;
    animation: energyOrbit 7s linear infinite;
}

.gesture-energy::after {
    inset: -36%;
    border-style: dashed;
    border-color: rgba(255, 221, 177, .18);
    animation-direction: reverse;
    animation-duration: 11s;
}

.gesture-energy i {
    position: absolute;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: white;
    box-shadow: 0 0 12px 4px var(--rose-bright);
}
.gesture-energy i:nth-child(1) { left: 4%; top: 36%; }
.gesture-energy i:nth-child(2) { right: 8%; top: 18%; width: 3px; height: 3px; }
.gesture-energy i:nth-child(3) { right: 22%; bottom: 2%; width: 4px; height: 4px; background: var(--gold); }

.heart-core {
    position: absolute;
    top: 49%;
    left: 50%;
    z-index: -1;
    color: #ff68aa;
    font-size: clamp(45px, 6vw, 72px);
    opacity: 0;
    transform: translate(-50%, -50%) scale(.1);
    text-shadow: 0 0 18px #ff4da1, 0 0 60px #e949c5;
    transition: opacity .25s, transform .55s cubic-bezier(.17, .89, .32, 1.55);
}

.heart-stage.charging .hand-gesture { animation-play-state: paused; }
.heart-stage.charging .heart-hands { filter: saturate(1.06) brightness(1.06); }
.heart-stage.complete .heart-hands { animation: completedGlow 2.4s ease-in-out infinite; }
.heart-stage.complete .heart-core { opacity: 1; transform: translate(-50%, -50%) scale(1); animation: heartbeat .85s ease-in-out infinite; }

.hold-button {
    position: absolute;
    z-index: 5;
    bottom: 32px;
    width: 112px;
    height: 112px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    color: white;
    background: transparent;
    cursor: pointer;
    touch-action: none;
    user-select: none;
    filter: drop-shadow(0 13px 25px rgba(4, 2, 30, .48));
}

.hold-button:focus-visible { outline: 2px solid white; outline-offset: 6px; }
.progress-ring { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.progress-ring circle { fill: none; stroke-width: 2; }
.ring-track { stroke: rgba(255, 255, 255, .2); }
.ring-value { stroke: #ffb5d8; stroke-linecap: round; stroke-dasharray: 314.16; stroke-dashoffset: 314.16; filter: drop-shadow(0 0 5px #ff79b8); }

.hold-center {
    position: absolute;
    inset: 10px;
    display: grid;
    place-content: center;
    gap: 2px;
    border: 1px solid rgba(255, 255, 255, .22);
    border-radius: 50%;
    background: radial-gradient(circle at 34% 26%, rgba(255,255,255,.18), rgba(117, 54, 157, .48));
    backdrop-filter: blur(13px);
    transition: transform .25s, background .25s;
}
.hold-button:hover .hold-center { transform: scale(1.05); }
.hold-button.is-holding .hold-center { transform: scale(.92); background: radial-gradient(circle, rgba(255, 142, 198, .62), rgba(117, 54, 157, .55)); }
.hold-icon { color: #ffd1e7; font-size: 20px; line-height: 1; }
.hold-copy { font-size: 12px; letter-spacing: .18em; text-indent: .18em; }
.hold-help { position: absolute; bottom: 4px; margin: 0; color: rgba(255,255,255,.5); font-size: 11px; letter-spacing: .08em; }

.success-card {
    position: absolute;
    z-index: 12;
    left: 50%;
    top: 50%;
    width: min(330px, calc(100vw - 40px));
    padding: 28px;
    border: 1px solid rgba(255, 255, 255, .24);
    border-radius: 26px;
    text-align: center;
    background: linear-gradient(145deg, rgba(48, 25, 84, .78), rgba(22, 12, 55, .72));
    box-shadow: 0 28px 80px rgba(8, 2, 35, .52), inset 0 1px rgba(255,255,255,.13);
    backdrop-filter: blur(24px);
    opacity: 0;
    visibility: hidden;
    transform: translate(-50%, -40%) scale(.84);
    transition: opacity .5s, transform .6s cubic-bezier(.2,.9,.25,1.18), visibility .5s;
}
.success-card.visible { opacity: 1; visibility: visible; transform: translate(-50%, -50%) scale(1); }
.success-spark { display: block; color: var(--gold); font-size: 24px; animation: spin 4s linear infinite; }
.success-card p { margin: 12px 0 4px; color: rgba(255,255,255,.64); font-size: 12px; letter-spacing: .24em; }
.success-card strong { display: block; margin: 4px 0 20px; font-family: Georgia, "Songti SC", serif; font-size: 36px; font-weight: 500; }
.success-card button { padding: 10px 18px; border: 1px solid rgba(255,255,255,.22); border-radius: 999px; color: white; background: rgba(255,255,255,.08); cursor: pointer; }
.success-card button i { font-style: normal; }
.success-card button:hover { background: rgba(255,255,255,.15); }

footer { padding-bottom: max(22px, env(safe-area-inset-bottom)); color: rgba(255,255,255,.38); font-size: 10px; letter-spacing: .14em; }
.coordinates { color: rgba(255, 216, 168, .52); }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes breathe { 50% { transform: scale(1.1); opacity: .75; } }
@keyframes auroraFloat { to { transform: translate3d(8vw, -5vh, 0) scale(1.15); } }
@keyframes heartbeat { 45% { transform: translate(-50%, -50%) scale(1.14); } }
@keyframes wave { to { height: 14px; } }
@keyframes gestureFloat { 50% { transform: translate(-50%, calc(-58% - 7px)) rotate(.5deg); } }
@keyframes energyOrbit { to { transform: rotate(360deg); } }
@keyframes completedGlow {
    50% { filter: saturate(1.08) brightness(1.06); }
}

@media (max-width: 760px) {
    .topbar, footer, .experience { width: calc(100% - 32px); }
    .sound-label { display: none; }
    .sound-toggle { width: 40px; height: 40px; justify-content: center; padding: 0; }
    .experience { grid-template-columns: 1fr; grid-template-rows: auto 1fr; gap: 4px; padding: 22px 0 12px; }
    .intro { text-align: center; }
    .eyebrow { justify-content: center; margin-bottom: 10px; font-size: 9px; }
    h1 { margin-inline: auto; font-size: clamp(48px, 16vw, 76px); }
    .subtitle { margin-top: 12px; font-size: 13px; }
    .heart-stage { min-height: min(500px, 59svh); }
    .hand-gesture { width: min(440px, 102vw); transform: translate(-50%, -62%); }
    .hold-button { bottom: 30px; width: 96px; height: 96px; }
    .progress-ring { width: 96px; height: 96px; }
    .hold-help { bottom: 3px; }
    footer span:first-child { display: none; }
    footer { justify-content: center; }
}

@media (max-height: 700px) and (min-width: 761px) {
    .heart-stage { min-height: 500px; transform: scale(.88); }
    .experience { padding-block: 8px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; }
}
