:root {
    --pink-1: #fff0f6;
    --pink-2: #ff7eb3;
    --pink-3: #ff4f8b;
    --red-1: #e5154f;
    --red-2: #9b0037;
    --deep: #250013;
    --glass: rgba(255, 255, 255, .76);
    --shadow: 0 30px 80px rgba(124, 0, 47, .28);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
html, body { min-height: 100%; }

body {
    margin: 0;
    font-family: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    color: var(--deep);
    overflow-x: hidden;
    background:
        radial-gradient(circle at 20% 15%, rgba(255,255,255,.95), transparent 24rem),
        radial-gradient(circle at 85% 10%, rgba(255,126,179,.35), transparent 22rem),
        linear-gradient(135deg, #fff2f7 0%, #ffd0df 38%, #ff7fa7 100%);
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background-image:
        radial-gradient(circle, rgba(255,255,255,.7) 0 2px, transparent 3px),
        radial-gradient(circle, rgba(255,79,139,.18) 0 5px, transparent 6px);
    background-size: 48px 48px, 110px 110px;
    animation: dreamyDrift 18s linear infinite;
}

button, input { font: inherit; }
button { cursor: pointer; }

.gate-screen {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: grid;
    place-items: center;
    padding: 24px;
    background:
        radial-gradient(circle at center, rgba(255,255,255,.9), rgba(255,126,179,.75)),
        linear-gradient(135deg, #fff0f6, #e5154f);
    transition: opacity .8s ease, transform .8s ease, visibility .8s ease;
}

.gate-screen.unlocked {
    opacity: 0;
    transform: scale(1.08);
    visibility: hidden;
    pointer-events: none;
}

.gate-card, .hero-card, .countdown-card, .proposal-card, .pin-panel {
    width: min(880px, 100%);
    padding: clamp(24px, 5vw, 46px);
    border: 1px solid rgba(255,255,255,.72);
    border-radius: 34px;
    background: var(--glass);
    box-shadow: var(--shadow);
    text-align: center;
    backdrop-filter: blur(18px);
}

.gate-card { animation: cardEntrance 1s ease both; }
.gate-form { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin: 28px auto 10px; }
input {
    min-width: min(320px, 100%);
    border: 0;
    border-radius: 999px;
    padding: 15px 20px;
    box-shadow: inset 0 0 0 2px rgba(229,21,79,.16), 0 12px 25px rgba(155,0,55,.14);
    outline: none;
}
input:focus { box-shadow: inset 0 0 0 3px rgba(229,21,79,.35), 0 12px 25px rgba(155,0,55,.14); }
button, .scroll-cue {
    border: 0;
    border-radius: 999px;
    padding: 14px 22px;
    background: linear-gradient(135deg, var(--red-1), var(--red-2));
    color: white;
    font-weight: 800;
    box-shadow: 0 16px 28px rgba(155,0,55,.28);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform .2s ease, filter .2s ease;
}
button:hover, .scroll-cue:hover { transform: translateY(-2px) scale(1.03); filter: brightness(1.06); }

.page-shell {
    width: min(1180px, calc(100% - 32px));
    margin: 0 auto;
    padding: 64px 0 90px;
    display: grid;
    gap: clamp(78px, 10vw, 140px);
    justify-items: center;
    transition: filter .6s ease;
}
.page-shell.locked { filter: blur(10px); height: 100vh; overflow: hidden; }

.eyebrow {
    margin: 0 0 10px;
    color: var(--red-2);
    font-weight: 900;
    letter-spacing: .18em;
    text-transform: uppercase;
}

h1 {
    margin: 0;
    font-size: clamp(2.6rem, 8vw, 6.6rem);
    line-height: .92;
    color: var(--red-1);
    text-shadow: 0 6px 22px rgba(229,21,79,.2);
}

h2 { margin: 16px 0 0; font-size: clamp(1.8rem, 4.5vw, 3.5rem); }
h3 { font-size: clamp(1.6rem, 4vw, 2.6rem); margin: 0 0 18px; }
.personal-text, .love-letter {
    margin: 22px auto 0;
    max-width: 760px;
    font-size: clamp(1.05rem, 2.3vw, 1.35rem);
    line-height: 1.72;
}
.scroll-cue { margin-top: 28px; }

.section-heading { text-align: center; max-width: 820px; margin: 0 auto 24px; }
.section-heading p { line-height: 1.6; }

.countdown-card { max-width: 920px; }
.countdown-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(110px, 1fr));
    gap: 16px;
    margin-top: 28px;
}
.countdown-grid span {
    padding: 18px 12px;
    border-radius: 24px;
    background: rgba(255,255,255,.62);
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.8);
    font-weight: 800;
}
.countdown-grid strong { display: block; color: var(--red-1); font-size: clamp(2rem, 5vw, 4rem); line-height: 1; }

.timeline-section { position: relative; width: min(960px, 100%); padding: 30px 0 10px; }
.timeline-line {
    position: absolute;
    top: 160px;
    bottom: 0;
    left: 50%;
    width: 6px;
    transform: translateX(-50%);
    border-radius: 99px;
    background: linear-gradient(var(--pink-2), var(--red-1));
    box-shadow: 0 0 30px rgba(229,21,79,.35);
}
.timeline-item {
    position: relative;
    width: min(430px, calc(50% - 44px));
    margin: 38px 0;
    padding: 24px;
    border-radius: 28px;
    background: rgba(255,255,255,.78);
    box-shadow: var(--shadow);
    backdrop-filter: blur(14px);
}
.timeline-item:nth-of-type(even) { margin-left: auto; }
.timeline-dot {
    position: absolute;
    top: 28px;
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: white;
    color: var(--red-1);
    box-shadow: 0 10px 20px rgba(155,0,55,.2);
}
.timeline-item:nth-of-type(odd) .timeline-dot { right: -66px; }
.timeline-item:nth-of-type(even) .timeline-dot { left: -66px; }
.timeline-item strong { font-size: 1.35rem; color: var(--red-2); }
.timeline-item p { line-height: 1.65; margin-bottom: 0; }

.wheel-stage {
    position: relative;
    width: min(980px, 100%);
    min-height: clamp(680px, 82vw, 880px);
    display: grid;
    place-items: center;
    perspective: 1200px;
    isolation: isolate;
    overflow: visible;
    padding: 24px 0 80px;
}

.wheel-halo {
    position: absolute;
    width: min(760px, 86vw);
    aspect-ratio: 1;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255,255,255,.55), rgba(255,126,179,.12) 55%, transparent 68%);
    filter: blur(2px);
    z-index: -1;
    animation: pulse 4s ease-in-out infinite;
}

.ferris-wheel {
    --radius: min(300px, 34vw);
    position: relative;
    width: calc(var(--radius) * 2);
    height: calc(var(--radius) * 2);
    transform-style: preserve-3d;
}

.wheel-ring, .wheel-spokes {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    pointer-events: none;
}
.wheel-ring {
    border: 12px solid rgba(255,255,255,.65);
    box-shadow: inset 0 0 0 8px rgba(229,21,79,.22), 0 22px 60px rgba(155,0,55,.26);
    animation: wheelRotate 30s linear infinite;
}
.wheel-spokes {
    background:
        linear-gradient(90deg, transparent 49.4%, rgba(255,255,255,.75) 49.8% 50.2%, transparent 50.6%),
        linear-gradient(0deg, transparent 49.4%, rgba(255,255,255,.75) 49.8% 50.2%, transparent 50.6%),
        linear-gradient(45deg, transparent 49.4%, rgba(255,255,255,.55) 49.8% 50.2%, transparent 50.6%),
        linear-gradient(-45deg, transparent 49.4%, rgba(255,255,255,.55) 49.8% 50.2%, transparent 50.6%);
    animation: wheelRotate 30s linear infinite;
}
.wheel-center {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 82px;
    height: 82px;
    transform: translate(-50%, -50%);
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: linear-gradient(135deg, #fff, #ffd1df);
    color: var(--red-1);
    font-size: 2.4rem;
    box-shadow: 0 16px 36px rgba(155,0,55,.28);
    z-index: 5;
}
.photo-seat {
    position: absolute;
    left: 50%;
    top: 50%;
    width: clamp(82px, 13vw, 132px);
    height: clamp(104px, 17vw, 166px);
    padding: 8px;
    border-radius: 24px;
    background: rgba(255,255,255,.94);
    box-shadow: 0 22px 38px rgba(82, 0, 32, .24);
    transform: translate(-50%, -50%);
    transform-origin: center;
    z-index: 4;
    pointer-events: none;
}
.photo-seat img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 18px;
    display: block;
}
.wheel-base {
    position: absolute;
    bottom: 30px;
    width: min(420px, 65vw);
    height: 170px;
    border-left: 18px solid rgba(255,255,255,.62);
    border-right: 18px solid rgba(255,255,255,.62);
    transform: perspective(420px) rotateX(38deg);
    border-radius: 18px;
    z-index: -1;
}

.quiz-section, .gift-section, .proposal-section { width: min(980px, 100%); text-align: center; }
.quiz-panel {
    width: min(760px, 100%);
    margin: 28px auto 0;
}
.quiz-progress {
    height: 14px;
    border-radius: 999px;
    overflow: hidden;
    background: rgba(255,255,255,.54);
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.8);
}
.quiz-progress span {
    display: block;
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #ff8fb4 0%, var(--red-1) 100%);
    transition: width .35s ease;
}
.quiz-progress-text {
    margin: 12px 0 0;
    color: var(--red-2);
    font-weight: 800;
}
.quiz-card {
    margin-top: 18px;
    padding: clamp(22px, 4vw, 34px);
    border: 1px solid rgba(255,255,255,.72);
    border-radius: 32px;
    background: rgba(255,255,255,.82);
    box-shadow: var(--shadow);
    backdrop-filter: blur(16px);
}
.quiz-step { margin-bottom: 8px; }
.quiz-card h3 {
    margin-bottom: 10px;
    color: var(--red-2);
}
.quiz-success {
    min-height: 24px;
    margin: 0 auto 18px;
    max-width: 560px;
    color: rgba(37, 0, 19, .74);
    line-height: 1.55;
}
.quiz-options {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
    margin-bottom: 18px;
}
.quiz-option {
    min-width: 140px;
    background: rgba(255,255,255,.92);
    color: var(--red-2);
    box-shadow: inset 0 0 0 2px rgba(229,21,79,.12), 0 14px 24px rgba(155,0,55,.12);
}
.quiz-option:hover,
.quiz-option.active {
    background: linear-gradient(135deg, #fff3f7, #ffd6e3);
    color: var(--red-1);
}
.quiz-answer-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
}
.quiz-answer-row input {
    margin: 0;
}
.quiz-next {
    margin-top: 16px;
}
.quiz-feedback {
    min-height: 24px;
}
.quiz-feedback.is-error {
    color: #8f113b;
}
.quiz-feedback.is-success {
    color: #a3063a;
    font-weight: 700;
}
.typewriter-box {
    margin: 24px auto 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 4px;
    max-width: min(100%, 760px);
    padding: 18px 24px;
    border-radius: 999px;
    background: rgba(255,255,255,.78);
    box-shadow: var(--shadow);
    font-size: clamp(1rem, 2vw, 1.25rem);
    text-align: center;
    overflow-wrap: anywhere;
}
.typewriter-box strong { max-width: 100%; overflow-wrap: anywhere; }
.quiz-reveal-note {
    margin: 14px auto 0;
    max-width: 620px;
    color: var(--red-2);
    font-weight: 700;
}
.caret { animation: blink .85s infinite; }

.gift-section { display: grid; place-items: center; gap: 22px; }
.gift-box {
    position: relative;
    width: 210px;
    height: 220px;
    filter: drop-shadow(0 28px 32px rgba(155,0,55,.25));
    transition: transform .4s ease;
}
.gift-box:hover { transform: translateY(-8px) rotate(-2deg); }
.gift-lid, .gift-body {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, var(--red-1), var(--red-2));
    border: 8px solid rgba(255,255,255,.72);
}
.gift-lid { top: 20px; width: 230px; height: 58px; border-radius: 18px; transform-origin: left bottom; transition: transform .7s ease; }
.gift-body { bottom: 0; width: 190px; height: 150px; border-radius: 22px; display: grid; place-items: center; color: white; font-size: 4rem; }
.gift-ribbon { position: absolute; left: 50%; top: 20px; bottom: 0; width: 36px; transform: translateX(-50%); background: rgba(255,255,255,.82); border-radius: 999px; z-index: 2; }
.gift-box.open .gift-lid { transform: translateX(-48%) translateY(-40px) rotate(-18deg); }
.pin-panel { max-width: 720px; animation: cardEntrance .7s ease both; }
.pin-panel input { margin: 18px 10px 10px 0; text-align: center; text-transform: uppercase; }

.proposal-card { margin: 0 auto; animation: cardEntrance .8s ease both; }
.proposal-actions { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; margin-top: 28px; }
#maybeButton { background: rgba(255,255,255,.85); color: var(--red-2); box-shadow: inset 0 0 0 2px rgba(229,21,79,.16), 0 16px 28px rgba(155,0,55,.12); }

.hint, .gate-hint { margin: 14px 0 0; opacity: .78; }
code { background: rgba(255,255,255,.7); padding: 2px 6px; border-radius: 6px; }

body.valentine-modal-open { overflow: hidden; }
.valentine-modal[hidden] { display: none !important; }
.valentine-modal {
    position: fixed;
    inset: 0;
    z-index: 260;
    display: grid;
    place-items: center;
    padding: 24px;
}
.valentine-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(72, 6, 33, .42);
    backdrop-filter: blur(12px);
}
.valentine-modal-card {
    position: relative;
    z-index: 1;
    width: min(760px, calc(100vw - 32px));
    max-height: calc(100dvh - 48px);
    overflow: auto;
    padding: clamp(26px, 5vw, 42px);
    border-radius: 34px;
    border: 1px solid rgba(255,255,255,.74);
    background: linear-gradient(180deg, rgba(255,245,249,.98), rgba(255,236,243,.96));
    box-shadow: 0 34px 90px rgba(93, 8, 42, .28);
}
.valentine-modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 999px;
    background: rgba(255,255,255,.88);
    color: var(--red-2);
    font-size: 1.8rem;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 12px 26px rgba(155,0,55,.14);
}
.valentine-modal .pin-panel,
.valentine-modal .proposal-section {
    width: 100%;
    margin: 0;
}
.valentine-modal .proposal-card {
    width: 100%;
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
}

#heartBurst, #pointerHearts { position: fixed; inset: 0; overflow: hidden; pointer-events: none; z-index: 150; }
#pointerHearts { z-index: 90; }
.heart, .trail-heart {
    position: absolute;
    left: 50%;
    top: 50%;
    font-size: var(--size);
    transform: translate(-50%, -50%);
    filter: drop-shadow(0 8px 12px rgba(155,0,55,.25));
}
.heart { animation: heartExplosion var(--duration) cubic-bezier(.12,.68,.22,1) forwards; }
.trail-heart { animation: trailFloat 1.2s ease-out forwards; }

.memory-dialog {
    width: min(560px, calc(100% - 32px));
    border: 0;
    border-radius: 28px;
    padding: 34px;
    background: rgba(255,255,255,.94);
    box-shadow: var(--shadow);
    color: var(--deep);
}
.memory-dialog::backdrop { background: rgba(37,0,19,.38); backdrop-filter: blur(8px); }
.dialog-close { position: absolute; top: 12px; right: 12px; width: 42px; height: 42px; padding: 0; }

.reveal { opacity: 0; transform: translateY(42px) scale(.98); transition: opacity .8s ease, transform .8s ease; }
.reveal.in-view { opacity: 1; transform: translateY(0) scale(1); }

@keyframes dreamyDrift { to { background-position: 48px 48px, 110px 110px; } }
@keyframes cardEntrance { from { opacity: 0; transform: translateY(35px) scale(.96); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes wheelRotate { to { transform: rotate(360deg); } }
@keyframes pulse { 50% { transform: scale(1.05); opacity: .72; } }
@keyframes blink { 50% { opacity: 0; } }
@keyframes heartExplosion {
    0% { opacity: 0; transform: translate(-50%, -50%) scale(.2) rotate(0deg); }
    12% { opacity: 1; }
    100% { opacity: 0; transform: translate(calc(-50% + var(--x)), calc(-50% + var(--y))) scale(var(--scale)) rotate(var(--rotation)); }
}
@keyframes trailFloat {
    to { opacity: 0; transform: translate(-50%, -150%) scale(.3) rotate(80deg); }
}
@media (max-width: 760px) {
    body::before {
        animation: none;
    }

    .countdown-grid { grid-template-columns: repeat(2, 1fr); }
    .timeline-line { left: 24px; }
    .timeline-item, .timeline-item:nth-of-type(even) { width: calc(100% - 68px); margin-left: 68px; }
    .timeline-item:nth-of-type(odd) .timeline-dot, .timeline-item:nth-of-type(even) .timeline-dot { left: -64px; right: auto; }
    .wheel-stage { min-height: 600px; padding-bottom: 60px; }
    .ferris-wheel { --radius: min(220px, 36vw); }
    .wheel-base { bottom: 62px; }
    .quiz-answer-row {
        flex-direction: column;
        align-items: stretch;
    }
    .quiz-answer-row input {
        min-width: 100%;
    }
    .quiz-answer-row button,
    .quiz-option,
    .quiz-next {
        width: 100%;
    }
    .typewriter-box { border-radius: 30px; }
    .gate-card,
    .hero-card,
    .countdown-card,
    .proposal-card,
    .pin-panel,
    .timeline-item,
    .quiz-card,
    .typewriter-box {
        backdrop-filter: none;
        box-shadow: 0 18px 42px rgba(124, 0, 47, .18);
    }

    .valentine-modal {
        align-items: start;
        padding: 16px;
    }

    .valentine-modal-backdrop {
        backdrop-filter: none;
    }

    .valentine-modal-card {
        width: 100%;
        max-height: calc(100dvh - 32px);
        border-radius: 26px;
        padding: 24px 18px;
    }

    .valentine-modal-close {
        position: sticky;
        top: 0;
        margin-left: auto;
        z-index: 5;
    }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; transition-duration: .001ms !important; }
}
