/* RegaloQR — the gift experience (public viewer and editor preview). Builds on styles.css tokens. */

/* Theme tokens. "Día" is the base; dark themes override. */

.gift {
    --g-bg: #fbf7f2;
    --g-bg-2: #f3e9e1;
    --g-text: #2b2521;
    --g-muted: #7a6f68;
    --g-surface: #fffdf9;
    --g-surface-border: #e9e0d8;
    --g-paper: #fffdf9;
    --g-paper-ink: #2b2521;
    --g-paper-muted: #7a6f68;
    --g-shadow: 0 20px 40px rgba(43, 37, 33, 0.14);
    --g-glow: 0 0 0 transparent;
    --g-heart-fill: #ffffff;
    --g-heart-stroke: #ffffff;
    --gold: #f5c242;
    --success: #1f7a4d;
    --font-script: 'Caveat', 'Segoe Script', cursive;
    position: relative;
    min-height: 100dvh;
    color: var(--g-text);
    background: var(--g-bg);
}

.gift[data-mode='dark'] {
    --g-bg: #120b14;
    --g-bg-2: #1c1020;
    --g-text: #f7f1f4;
    --g-muted: #b9a9b3;
    --g-surface: rgba(255, 255, 255, 0.06);
    --g-surface-border: rgba(255, 255, 255, 0.12);
    --g-shadow: 0 24px 50px rgba(0, 0, 0, 0.45);
    --g-glow: 0 0 40px color-mix(in srgb, var(--accent) 45%, transparent);
    --g-heart-fill: var(--accent);
    --g-heart-stroke: var(--accent);
}

.gift[data-theme='cielo'] {
    --g-bg: #0b1026;
    --g-bg-2: #161f45;
}

.gift[data-theme='atardecer'] {
    --g-bg: #26101a;
    --g-bg-2: #4a1d1a;
}

.gift[data-theme='fiesta'] {
    --g-bg: #1b1033;
    --g-bg-2: #2d1b4e;
}

.gift {
    --wish-paper-0: #fff3b0;
    --wish-paper-1: #ffd6e0;
    --wish-paper-2: #d4f1f4;
    --wish-paper-3: #e2f0cb;
}

.script {
    font-family: var(--font-script);
}

/* Effects layer (bursts and confetti) */

.fx-layer {
    position: fixed;
    inset: 0;
    z-index: 60;
    pointer-events: none;
    overflow: hidden;
}

.burst-piece {
    position: absolute;
    left: var(--x);
    top: var(--y);
    font-size: var(--size);
    color: var(--color, #fff);
    transform: translate(-50%, -50%);
    animation: burst 0.9s ease-out forwards;
}

@keyframes burst {
    to {
        transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) rotate(var(--rot))
            scale(0.2);
        opacity: 0;
    }
}

.confetti-piece {
    position: absolute;
    top: -6vh;
    left: var(--x);
    width: 10px;
    height: 14px;
    border-radius: 2px;
    background: var(--color);
    opacity: 0;
    animation: confetti-fall var(--duration) linear var(--delay) forwards;
}

@keyframes confetti-fall {
    0% {
        opacity: 1;
        transform: translateY(0) rotate(0deg);
    }

    100% {
        opacity: 1;
        transform: translateY(115vh) rotate(var(--rot));
    }
}

/* Ambient layer: emoji rain or twinkling stars */

.ambient {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
}

.ambient-emoji {
    position: absolute;
    top: -12vh;
    left: var(--x);
    font-size: var(--size);
    opacity: var(--opacity);
    animation: rain var(--duration) linear var(--delay) infinite;
}

@keyframes rain {
    0% {
        transform: translate3d(0, 0, 0) rotate(0deg);
    }

    50% {
        transform: translate3d(var(--sway), 60vh, 0) rotate(var(--rot));
    }

    100% {
        transform: translate3d(0, 125vh, 0) rotate(calc(var(--rot) * 2));
    }
}

.ambient-star {
    position: absolute;
    left: var(--x);
    top: var(--y);
    width: var(--size);
    height: var(--size);
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 0 8px #fff;
    animation: twinkle var(--duration) ease-in-out var(--delay) infinite alternate;
}

@keyframes twinkle {
    from {
        opacity: 0.15;
        transform: scale(0.6);
    }

    to {
        opacity: 0.95;
        transform: scale(1.15);
    }
}

.story > .ambient {
    z-index: 0;
    opacity: 0.45;
}

/* Cover: heart unlock */

.cover {
    position: relative;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 2rem 1.5rem;
    overflow: hidden;
    color: #fff;
    background:
        radial-gradient(
            circle at 20% 20%,
            color-mix(in srgb, var(--accent) 35%, white),
            transparent 50%
        ),
        radial-gradient(
            circle at 80% 80%,
            color-mix(in srgb, var(--accent) 55%, white),
            transparent 55%
        ),
        linear-gradient(160deg, color-mix(in srgb, var(--accent) 85%, #1a1a1a), var(--accent));
    transition:
        opacity 0.7s ease,
        transform 0.7s ease;
}

.gift[data-mode='dark'] .cover {
    background:
        radial-gradient(
            circle at 50% 110%,
            color-mix(in srgb, var(--accent) 45%, transparent),
            transparent 60%
        ),
        linear-gradient(180deg, var(--g-bg), var(--g-bg-2));
}

.cover.is-unlocked {
    opacity: 0;
    transform: scale(1.08);
    pointer-events: none;
}

.cover-backdrop {
    position: absolute;
    inset: -10%;
    background-size: cover;
    background-position: center;
    filter: blur(28px) saturate(1.25);
    opacity: 0.5;
    animation: slow-zoom 18s ease-in-out infinite alternate;
}

@keyframes slow-zoom {
    from {
        transform: scale(1);
    }

    to {
        transform: scale(1.12);
    }
}

.cover-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.15), rgba(0, 0, 0, 0.5));
}

.cover-content {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: min(100%, 30rem);
}

.avatar {
    width: 112px;
    height: 112px;
    padding: 4px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), #fff);
    box-shadow: 0 0 36px color-mix(in srgb, var(--accent) 60%, transparent);
    margin-bottom: 1rem;
    animation: rise 0.8s ease both;
}

.avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    display: block;
}

.cover-eyebrow {
    font-size: 0.78rem;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    opacity: 0.85;
    margin: 0 0 0.5rem;
    animation: rise 0.8s ease both;
}

.cover h1 {
    font-size: clamp(2.6rem, 11vw, 4.5rem);
    font-weight: 500;
    font-style: italic;
    margin: 0 0 0.1em;
    text-shadow: 0 6px 30px rgba(0, 0, 0, 0.25);
    animation: rise 0.8s ease 0.1s both;
}

.cover-from {
    font-family: var(--font-script);
    font-size: 1.9rem;
    line-height: 1.1;
    margin: 0 0 0.9rem;
    opacity: 0.95;
    animation: rise 0.8s ease 0.2s both;
}

.cover-since {
    font-size: 0.75rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    opacity: 0.85;
    margin: 0 0 0.4rem;
    animation: rise 0.8s ease 0.25s both;
}

.cover-teaser {
    font-size: 0.95rem;
    opacity: 0.85;
    margin: 0 0 1.4rem;
    animation: rise 0.8s ease 0.3s both;
}

.heart-button {
    position: relative;
    width: min(46vw, 190px);
    aspect-ratio: 32 / 29.6;
    padding: 0;
    border: 0;
    background: none;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    filter: drop-shadow(0 18px 30px rgba(0, 0, 0, 0.25));
    animation: rise 0.8s ease 0.35s both;
}

.gift[data-mode='dark'] .heart-button {
    filter: drop-shadow(0 0 22px color-mix(in srgb, var(--accent) 55%, transparent));
}

.heart-button:focus-visible {
    outline: 3px solid #fff;
    outline-offset: 8px;
    border-radius: 50%;
}

.heart-svg {
    width: 100%;
    height: 100%;
    overflow: visible;
    transform-origin: center;
}

.heart-outline {
    fill: rgba(255, 255, 255, 0.16);
    stroke: var(--g-heart-stroke);
    stroke-width: 0.8;
    transition: fill 0.4s ease;
}

.gift[data-mode='dark'] .heart-outline {
    fill: color-mix(in srgb, var(--accent) 14%, transparent);
}

.heart-liquid {
    transition: transform 0.55s cubic-bezier(0.34, 1.4, 0.64, 1);
}

.heart-wave {
    fill: var(--g-heart-fill);
    animation: wave 2.2s linear infinite;
}

@keyframes wave {
    to {
        transform: translateX(-16px);
    }
}

.heart-shine {
    fill: rgba(255, 255, 255, 0.35);
}

.heart-button.is-pumping .heart-svg {
    animation: pump 0.35s ease-out;
}

@keyframes pump {
    30% {
        transform: scale(1.14);
    }
}

.heart-button.is-full .heart-outline {
    fill: var(--g-heart-fill);
}

.heart-button.is-full .heart-svg {
    animation: heart-burst 0.9s ease-in forwards;
}

@keyframes heart-burst {
    35% {
        transform: scale(1.18);
    }

    100% {
        transform: scale(3);
        opacity: 0;
    }
}

.tap-progress {
    width: min(60vw, 240px);
    height: 4px;
    margin-top: 1.1rem;
    border-radius: 2px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.22);
    animation: rise 0.8s ease 0.4s both;
}

.tap-progress span {
    display: block;
    width: 0;
    height: 100%;
    background: var(--g-heart-fill);
    transition: width 0.45s cubic-bezier(0.34, 1.4, 0.64, 1);
}

.tap-hint {
    margin: 0.75rem 0 0;
    font-size: 0.92rem;
    opacity: 0.9;
    animation: rise 0.8s ease 0.45s both;
}

.tap-count {
    display: inline-block;
    min-width: 3.2em;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

/* Balloons: ambient (rising), cover (poppable) and pinned (reasons) */

.balloon {
    position: absolute;
    left: var(--x);
    width: 64px;
    height: 150px;
    padding: 0;
    border: 0;
    background: none;
    transform: scale(var(--scale));
    transform-origin: top center;
    -webkit-tap-highlight-color: transparent;
}

.balloon-floating {
    bottom: -170px;
    animation: balloon-rise var(--duration) linear var(--delay) infinite;
}

@keyframes balloon-rise {
    0% {
        transform: translate3d(0, 0, 0) scale(var(--scale)) rotate(-3deg);
    }

    50% {
        transform: translate3d(26px, -60vh, 0) scale(var(--scale)) rotate(3deg);
    }

    100% {
        transform: translate3d(0, -130vh, 0) scale(var(--scale)) rotate(-3deg);
    }
}

.balloon-body {
    display: block;
    width: 64px;
    height: 78px;
    border-radius: 50% 50% 50% 50% / 56% 56% 44% 44%;
    background:
        radial-gradient(circle at 32% 26%, rgba(255, 255, 255, 0.6), transparent 34%),
        var(--balloon);
    box-shadow: inset -8px -10px 18px rgba(0, 0, 0, 0.2);
    position: relative;
}

.balloon-body::after {
    content: '';
    position: absolute;
    left: 50%;
    bottom: -7px;
    width: 10px;
    height: 10px;
    background: var(--balloon);
    clip-path: polygon(50% 0, 0 100%, 100% 100%);
    transform: translateX(-50%);
}

.balloon-string {
    display: block;
    width: 2px;
    height: 60px;
    margin: 8px auto 0;
    border-radius: 1px;
    background: rgba(255, 255, 255, 0.5);
    transform-origin: top;
    animation: string-sway 2.4s ease-in-out infinite alternate;
}

@keyframes string-sway {
    from {
        transform: rotate(-6deg);
    }

    to {
        transform: rotate(6deg);
    }
}

.cover-balloons {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
}

.cover-balloons .balloon {
    pointer-events: auto;
    cursor: pointer;
}

.balloon.is-popped {
    visibility: hidden;
}

.balloon-field .balloon {
    top: var(--y);
    bottom: auto;
    margin: -40px 0 0 -32px;
    cursor: pointer;
    animation: balloon-bob var(--duration) ease-in-out var(--delay) infinite alternate;
}

@keyframes balloon-bob {
    from {
        transform: translateY(0) scale(var(--scale)) rotate(-2deg);
    }

    to {
        transform: translateY(-14px) scale(var(--scale)) rotate(2deg);
    }
}

.balloon-field .balloon.is-popped {
    visibility: visible;
    animation: none;
    opacity: 0.25;
    transform: scale(calc(var(--scale) * 0.35));
    transition:
        transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
        opacity 0.3s ease;
    pointer-events: none;
}

.balloon-sky {
    background: radial-gradient(circle at 70% 10%, #3b2a6b, #1b1033 70%);
}

/* Cake unlock */

.cover-cumpleanos .avatar {
    width: 92px;
    height: 92px;
    margin-bottom: 0.6rem;
}

.cover-cumpleanos .cover-teaser {
    margin-bottom: 0.9rem;
}

.cake-button {
    width: min(70vw, 270px);
    padding: 0;
    border: 0;
    background: none;
    cursor: default;
    -webkit-tap-highlight-color: transparent;
    filter: drop-shadow(0 20px 30px rgba(0, 0, 0, 0.35));
    animation: rise 0.8s ease 0.35s both;
}

.cake-svg {
    display: block;
    width: 100%;
    height: auto;
    overflow: visible;
}

.cake-plate {
    fill: rgba(255, 255, 255, 0.85);
}

.cake-tier rect {
    fill: #f6c3d0;
}

.cake-tier:first-of-type rect {
    fill: #f2a7bd;
}

.cake-frosting {
    fill: #fff6f8;
}

.cake-sprinkle {
    fill: var(--accent);
    opacity: 0.9;
}

.cake-sprinkle:nth-child(3n) {
    fill: #4cc9f0;
}

.cake-sprinkle:nth-child(3n + 1) {
    fill: #80ed99;
}

.cake-age rect {
    fill: var(--accent);
}

.cake-age text {
    fill: #fff;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 24px;
}

.candle {
    cursor: pointer;
}

.candle-body {
    fill: #fff;
}

.candle-stripe {
    fill: var(--accent);
}

.candle-wick {
    stroke: #3b2a2a;
    stroke-width: 2;
    stroke-linecap: round;
}

.candle-hit {
    fill: transparent;
}

.flame-group {
    transition: opacity 0.25s ease;
}

.flame-glow {
    fill: #ffb020;
    opacity: 0.25;
    transform-box: fill-box;
    transform-origin: center;
    animation: flame-glow 0.9s ease-in-out infinite alternate;
    animation-delay: calc(var(--i) * 0.13s);
}

@keyframes flame-glow {
    from {
        transform: scale(0.9);
        opacity: 0.18;
    }

    to {
        transform: scale(1.15);
        opacity: 0.32;
    }
}

.flame {
    fill: #ffb020;
    transform-box: fill-box;
    transform-origin: 50% 100%;
    animation: flicker 0.45s ease-in-out infinite alternate;
    animation-delay: calc(var(--i) * 0.11s);
}

.flame-core {
    fill: #fff3b0;
}

@keyframes flicker {
    from {
        transform: scaleY(1) scaleX(1) rotate(-3deg);
    }

    to {
        transform: scaleY(1.18) scaleX(0.88) rotate(3deg);
    }
}

.smoke circle {
    fill: rgba(255, 255, 255, 0.55);
    opacity: 0;
    transform-box: fill-box;
    transform-origin: center;
}

.candle.is-out .flame-group {
    opacity: 0;
}

.candle.is-out .smoke circle {
    animation: smoke 1.3s ease-out forwards;
}

.candle.is-out .smoke circle:nth-child(2) {
    animation-delay: 0.15s;
}

.candle.is-out .smoke circle:nth-child(3) {
    animation-delay: 0.3s;
}

@keyframes smoke {
    0% {
        opacity: 0.7;
        transform: translateY(0) scale(0.6);
    }

    100% {
        opacity: 0;
        transform: translateY(-34px) scale(1.8);
    }
}

.cake-button.is-done {
    animation: cake-done 0.8s ease both;
}

@keyframes cake-done {
    40% {
        transform: scale(1.06);
    }
}

.blow-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.9rem;
    animation: rise 0.8s ease 0.5s both;
}

.blow-button {
    min-height: 48px;
    padding: 0.6rem 1.4rem;
    border: 0;
    border-radius: 999px;
    background: linear-gradient(90deg, #ffb020, #ff6a3d, var(--accent));
    color: #fff;
    font-weight: 700;
    cursor: pointer;
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
    transition: transform 0.15s ease;
}

.blow-button.is-blowing {
    transform: scale(0.96);
    animation: blow-pulse 0.4s ease-in-out infinite alternate;
}

@keyframes blow-pulse {
    to {
        box-shadow: 0 0 0 10px rgba(255, 255, 255, 0.15);
    }
}

.blow-mic {
    border: 0;
    background: none;
    color: #fff;
    opacity: 0.8;
    font-size: 0.85rem;
    text-decoration: underline;
    cursor: pointer;
}

.blow-mic.is-listening {
    opacity: 1;
    text-decoration: none;
    animation: hint-pulse 1.2s ease-in-out infinite;
}

/* Birthday celebration card and wishes wall */

.celebration {
    text-align: center;
    background: color-mix(in srgb, var(--accent) 18%, var(--g-surface));
}

.celebration-icon {
    font-size: 3rem;
    line-height: 1;
    animation: pop 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.celebration-title {
    margin: 0.5rem 0 0.25rem;
    font-family: var(--font-display);
    font-size: 2rem;
    font-style: italic;
    color: var(--accent);
}

.celebration p:last-child {
    margin: 0;
    color: var(--g-muted);
}

.wishes {
    display: grid;
    gap: 1rem;
}

.wish {
    padding: 1.25rem 1.25rem 1rem;
    border-radius: 6px;
    background: var(--paper);
    color: #2b2521;
    box-shadow: var(--g-shadow);
    transform: rotate(var(--tilt));
    animation: wish-in 0.5s cubic-bezier(0.2, 0.8, 0.2, 1) both;
    animation-delay: calc(var(--i) * 0.12s);
}

@keyframes wish-in {
    from {
        opacity: 0;
        transform: translateY(20px) rotate(var(--tilt)) scale(0.96);
    }
}

.wish-text {
    margin: 0 0 0.5rem;
    font-family: var(--font-display);
    font-size: 1.1rem;
    line-height: 1.5;
}

.wish-from {
    margin: 0;
    text-align: right;
    font-family: var(--font-script);
    font-size: 1.5rem;
    color: #7a4b5a;
}

/* Story shell */

.story {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 100dvh;
    z-index: 40;
    display: flex;
    flex-direction: column;
    background: linear-gradient(180deg, var(--g-bg), var(--g-bg-2));
    color: var(--g-text);
    animation: fade-in 0.5s ease both;
}

.story[hidden] {
    display: none;
}

.story-top {
    position: relative;
    z-index: 2;
    padding: max(10px, env(safe-area-inset-top)) 12px 6px;
}

.story-progress {
    display: flex;
    gap: 4px;
}

.story-progress-segment {
    position: relative;
    flex: 1;
    height: 4px;
    border-radius: 2px;
    overflow: hidden;
    background: color-mix(in srgb, var(--accent) 18%, var(--g-surface-border));
}

.story-progress-segment::after {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--accent);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.45s ease;
}

.story-progress-segment.is-done::after,
.story-progress-segment.is-active::after {
    transform: scaleX(1);
}

.story-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    min-height: 34px;
    margin-top: 8px;
}

.chapter-counter {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--g-muted);
    font-variant-numeric: tabular-nums;
}

.music-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    max-width: 62%;
    padding: 0.25rem 0.75rem 0.25rem 0.3rem;
    border: 1px solid var(--g-surface-border);
    border-radius: 999px;
    background: var(--g-surface);
    backdrop-filter: blur(10px);
    color: var(--g-text);
    font-size: 0.8rem;
    cursor: pointer;
}

.music-pill-icon {
    flex: none;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: var(--accent);
    color: #fff;
    font-size: 0.7rem;
}

.music-pill-bars {
    display: inline-flex;
    align-items: flex-end;
    gap: 2px;
    height: 12px;
    flex: none;
}

.music-pill-bars span {
    width: 3px;
    height: 30%;
    border-radius: 1px;
    background: var(--accent);
}

.music-pill.is-playing .music-pill-bars span {
    animation: equalize 0.8s ease-in-out infinite;
    animation-delay: calc(var(--i) * 0.1s);
}

.music-pill-title {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.story-stage {
    position: relative;
    z-index: 1;
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
}

.chapter {
    width: min(100%, 44rem);
    min-height: 100%;
    margin-inline: auto;
    padding: 0.25rem 16px 2.5rem;
    animation: chapter-in 0.42s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.chapter-enter-left {
    animation-name: chapter-in-left;
}

@keyframes chapter-in {
    from {
        opacity: 0;
        transform: translateX(48px);
    }
}

@keyframes chapter-in-left {
    from {
        opacity: 0;
        transform: translateX(-48px);
    }
}

.chapter-exit-left {
    animation: chapter-out-left 0.32s ease-in both;
}

.chapter-exit-right {
    animation: chapter-out-right 0.32s ease-in both;
}

@keyframes chapter-out-left {
    to {
        opacity: 0;
        transform: translateX(-48px);
    }
}

@keyframes chapter-out-right {
    to {
        opacity: 0;
        transform: translateX(48px);
    }
}

.chapter-header {
    text-align: center;
    padding: 0.5rem 0 1.25rem;
}

.chapter-kicker {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--accent);
}

.chapter-header h2 {
    margin: 0;
    font-size: clamp(1.8rem, 6vw, 2.4rem);
    font-style: italic;
    font-weight: 500;
    color: var(--g-text);
}

.story-nav {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.75rem 16px max(0.75rem, env(safe-area-inset-bottom));
    border-top: 1px solid var(--g-surface-border);
    background: color-mix(in srgb, var(--g-bg) 85%, transparent);
    backdrop-filter: blur(10px);
}

.nav-back {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    border: 1px solid var(--g-surface-border);
    background: var(--g-surface);
    color: var(--g-text);
    display: grid;
    place-items: center;
    font-size: 1.25rem;
    cursor: pointer;
}

.nav-back:disabled {
    opacity: 0.3;
    cursor: default;
}

.story-nav .button-primary {
    flex: 1;
    max-width: 20rem;
    margin-left: auto;
    color: #fff;
}

/* Shared card and label */

.card-g {
    padding: 1.25rem;
    border: 1px solid var(--g-surface-border);
    border-radius: 20px;
    background: var(--g-surface);
    box-shadow: var(--g-shadow);
    backdrop-filter: blur(10px);
}

.card-g + .card-g {
    margin-top: 1rem;
}

.card-label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 0 0 1rem;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    text-align: center;
    color: var(--accent);
}

.card-label::before,
.card-label::after {
    content: '';
    flex: 1;
    height: 1px;
    background: color-mix(in srgb, var(--accent) 35%, transparent);
}

.hint-tap {
    margin: 1.25rem 0 0;
    text-align: center;
    color: var(--g-muted);
    font-size: 0.95rem;
    animation: hint-pulse 2s ease-in-out infinite;
}

@keyframes hint-pulse {
    50% {
        opacity: 0.45;
    }
}

@keyframes rise {
    from {
        opacity: 0;
        transform: translateY(12px);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

@keyframes fade-in {
    from {
        opacity: 0;
    }
}

@keyframes card-in {
    from {
        opacity: 0;
        transform: translateY(28px) scale(0.96);
    }
}

/* Time together */

.time-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.6rem;
}

.time-grid-4 {
    grid-template-columns: repeat(4, 1fr);
}

.time-tile {
    padding: 0.8rem 0.25rem 0.6rem;
    border: 1px solid var(--g-surface-border);
    border-radius: 14px;
    background: color-mix(in srgb, var(--accent) 10%, var(--g-surface));
    text-align: center;
    animation: rise 0.5s ease both;
    animation-delay: calc(var(--i) * 0.06s);
}

.time-tile strong {
    display: block;
    font-family: var(--font-display);
    font-size: clamp(1.6rem, 7vw, 2.4rem);
    line-height: 1;
    color: var(--accent);
    font-variant-numeric: tabular-nums;
}

.time-tile span {
    display: block;
    margin-top: 0.3rem;
    font-size: 0.66rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--g-muted);
}

.stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.9rem 0.75rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

.stats li {
    text-align: center;
}

.stats strong {
    display: block;
    font-family: var(--font-display);
    font-size: 1.55rem;
    line-height: 1.1;
    color: var(--g-text);
    font-variant-numeric: tabular-nums;
}

.stats span {
    font-size: 0.8rem;
    color: var(--g-muted);
}

.countdown-date {
    margin: 0.75rem 0 0;
    text-align: center;
    font-size: 0.9rem;
    color: var(--g-muted);
}

/* Album carousel */

.album-scene {
    position: relative;
    margin: 0 -16px;
    padding: 0 16px;
    overflow: hidden;
    border-radius: 24px;
}

.album-backdrop {
    position: absolute;
    inset: -24px;
    background-size: cover;
    background-position: center;
    filter: blur(30px) saturate(1.3);
    opacity: 0;
    transition: opacity 0.7s ease;
}

.album-backdrop.is-visible {
    opacity: 0.45;
}

.gift[data-mode='light'] .album-backdrop.is-visible {
    opacity: 0.3;
}

.carousel {
    position: relative;
    user-select: none;
    -webkit-user-select: none;
}

.carousel-viewport {
    overflow: hidden;
    padding: 1rem 0;
    touch-action: pan-y;
    cursor: grab;
}

.carousel-viewport.is-dragging {
    cursor: grabbing;
}

.carousel-track {
    display: flex;
    will-change: transform;
    transition: transform 0.45s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.slide {
    flex: 0 0 100%;
    display: flex;
    justify-content: center;
    margin: 0;
    padding: 0 8px;
    opacity: 0.55;
    transform: scale(0.9) rotate(var(--tilt));
    transition:
        transform 0.45s cubic-bezier(0.2, 0.8, 0.2, 1),
        opacity 0.45s ease;
}

.slide.is-active {
    opacity: 1;
    transform: scale(1) rotate(0deg);
}

.polaroid {
    width: min(100%, 22rem, calc((100dvh - 400px) * 0.8));
    padding: 10px 10px 12px;
    border-radius: 6px;
    background: var(--g-paper);
    color: var(--g-paper-ink);
    box-shadow: var(--g-shadow);
    cursor: zoom-in;
}

.polaroid-frame {
    aspect-ratio: 4 / 5;
    overflow: hidden;
    border-radius: 3px;
    background: #e9e0d8;
}

.polaroid img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    -webkit-user-drag: none;
}

.slide.is-active .polaroid img {
    animation: ken-burns 7s ease-out forwards;
}

@keyframes ken-burns {
    from {
        transform: scale(1);
    }

    to {
        transform: scale(1.08);
    }
}

.polaroid figcaption {
    min-height: 1.5em;
    padding-top: 0.5rem;
    text-align: center;
    font-family: var(--font-script);
    font-size: 1.35rem;
    line-height: 1.2;
    color: var(--g-paper-muted);
}

.carousel-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-top: 0.25rem;
}

.carousel-arrow {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1px solid var(--g-surface-border);
    background: var(--g-surface);
    color: var(--g-text);
    display: grid;
    place-items: center;
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
    transition: transform 0.15s ease;
}

.carousel-arrow:active {
    transform: scale(0.92);
}

.carousel-dots {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
    max-width: 60%;
}

.carousel-dot {
    width: 8px;
    height: 8px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: color-mix(in srgb, var(--accent) 30%, var(--g-surface-border));
    cursor: pointer;
    transition:
        transform 0.2s ease,
        background 0.2s ease;
}

.carousel-dot.is-active {
    background: var(--accent);
    transform: scale(1.4);
}

.carousel-counter {
    margin: 0.75rem 0 0;
    text-align: center;
    color: var(--g-muted);
    font-size: 0.9rem;
}

/* Lightbox */

.lightbox {
    position: fixed;
    inset: 0;
    z-index: 58;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1rem 2rem;
    background: rgba(8, 4, 10, 0.94);
    color: #fff;
    animation: fade-in 0.25s ease both;
    touch-action: pan-y;
}

.lightbox[hidden] {
    display: none;
}

.lightbox figure {
    margin: 0;
    text-align: center;
    max-width: 100%;
}

.lightbox img {
    width: 100%;
    max-height: 72dvh;
    object-fit: contain;
    border-radius: 10px;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.5);
}

.lightbox figcaption {
    margin-top: 0.9rem;
    font-family: var(--font-script);
    font-size: 1.5rem;
}

.lightbox-close {
    position: absolute;
    top: max(12px, env(safe-area-inset-top));
    right: 12px;
}

.lightbox-nav {
    position: absolute;
    top: 50%;
    width: 44px;
    height: 44px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    font-size: 1.4rem;
    display: grid;
    place-items: center;
    cursor: pointer;
    transform: translateY(-50%);
}

.lightbox-nav[data-lightbox-prev] {
    left: 8px;
}

.lightbox-nav[data-lightbox-next] {
    right: 8px;
}

.lightbox-counter {
    position: absolute;
    bottom: max(14px, env(safe-area-inset-bottom));
    font-size: 0.85rem;
    opacity: 0.8;
    font-variant-numeric: tabular-nums;
}

/* Letter: envelope and paper */

.envelope-scene {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1.5rem 0 1rem;
}

.envelope-scene[hidden] {
    display: none;
}

.envelope {
    position: relative;
    width: min(80vw, 320px);
    padding: 0;
    border: 0;
    background: none;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    animation: envelope-idle 2.4s ease-in-out infinite;
}

@keyframes envelope-idle {
    50% {
        transform: translateY(-6px);
    }
}

.envelope-svg {
    display: block;
    width: 100%;
    height: auto;
    overflow: visible;
    filter: drop-shadow(0 14px 24px rgba(0, 0, 0, 0.25));
}

.envelope-back {
    fill: color-mix(in srgb, var(--accent) 75%, #000);
}

.envelope-paper {
    transition: transform 0.7s cubic-bezier(0.2, 0.8, 0.2, 1) 0.3s;
}

.envelope-sheet {
    fill: var(--g-paper);
}

.envelope-line {
    fill: #e9e0d8;
}

.envelope-name {
    fill: var(--accent);
    font-family: var(--font-script);
    font-size: 26px;
}

.envelope-front {
    fill: color-mix(in srgb, var(--accent) 88%, #fff);
}

.envelope-flap {
    fill: color-mix(in srgb, var(--accent) 70%, #000);
    transform-origin: 150px 0;
    transition:
        transform 0.6s ease,
        opacity 0.3s ease 0.4s;
}

.envelope-seal {
    transform-origin: 150px 112px;
    transition:
        opacity 0.3s ease,
        transform 0.3s ease;
}

.envelope-seal circle {
    fill: var(--gold);
}

.envelope-seal text {
    fill: #fff;
    font-size: 24px;
}

.envelope.is-open {
    animation: none;
}

.envelope.is-open .envelope-flap {
    opacity: 0;
    transform: scaleY(-1);
}

.envelope.is-open .envelope-seal {
    opacity: 0;
    transform: scale(0.3);
}

.envelope.is-open .envelope-paper {
    transform: translateY(-120px);
}

.letter {
    position: relative;
    padding: clamp(1.5rem, 6vw, 2.5rem) clamp(1.25rem, 5vw, 2.25rem);
    border-radius: 20px;
    background: var(--g-paper);
    color: var(--g-paper-ink);
    box-shadow: var(--g-shadow);
    font-family: var(--font-display);
    font-size: 1.1rem;
    line-height: 1.7;
    animation: card-in 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.letter[hidden] {
    display: none;
}

.letter::before {
    content: '';
    position: absolute;
    inset: 10px;
    border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
    border-radius: 14px;
    pointer-events: none;
}

.letter-quote {
    display: block;
    font-size: 3.5rem;
    line-height: 0.6;
    color: color-mix(in srgb, var(--accent) 50%, transparent);
    margin-bottom: 0.5rem;
}

.letter p {
    opacity: 0;
    animation: rise 0.6s ease both;
    animation-delay: calc(0.3s + var(--i) * 0.18s);
}

.letter p:last-child {
    margin-bottom: 0;
}

.letter-signature {
    margin-top: 1.25rem;
    text-align: right;
    font-family: var(--font-script);
    font-size: 1.8rem;
    color: var(--accent);
}

/* Song */

.vinyl-scene {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    margin: 0.25rem 0 1.25rem;
}

.vinyl {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: repeating-radial-gradient(circle, #1b1b1b 0 2px, #2c2c2c 2px 4px);
    box-shadow:
        0 12px 30px rgba(0, 0, 0, 0.35),
        var(--g-glow);
    animation: spin 4s linear infinite;
}

.vinyl-label {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    overflow: hidden;
    background: radial-gradient(circle, #1b1b1b 0 4px, var(--accent) 5px);
}

.vinyl-label img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

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

.equalizer {
    display: flex;
    align-items: flex-end;
    gap: 4px;
    height: 44px;
}

.equalizer span {
    width: 6px;
    height: 30%;
    border-radius: 3px;
    background: var(--accent);
    animation: equalize 1s ease-in-out infinite;
    animation-delay: calc(var(--i) * 0.12s);
}

@keyframes equalize {
    50% {
        height: 100%;
    }
}

.embed {
    overflow: hidden;
    border-radius: 20px;
    background: #000;
    box-shadow: var(--g-shadow);
}

.embed iframe {
    display: block;
    width: 100%;
    border: 0;
}

.embed-spotify iframe {
    height: 352px;
}

.embed-youtube {
    aspect-ratio: 16 / 9;
}

.embed-youtube iframe {
    height: 100%;
}

.song-note {
    margin-top: 1rem;
    text-align: center;
    font-family: var(--font-script);
    font-size: 1.4rem;
    color: var(--g-muted);
}

/* Video */

.video-frame {
    position: relative;
    overflow: hidden;
    border-radius: 20px;
    background: #000;
    box-shadow: var(--g-shadow);
}

.video-player {
    display: block;
    width: 100%;
    max-height: 62dvh;
    background: #000;
}

.video-play {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 84px;
    height: 84px;
    border: 0;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    display: grid;
    place-items: center;
    font-size: 1.9rem;
    cursor: pointer;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
    transform: translate(-50%, -50%);
    transition:
        transform 0.15s ease,
        opacity 0.25s ease;
}

.video-play:active {
    transform: translate(-50%, -50%) scale(0.94);
}

.video-frame.is-playing .video-play {
    opacity: 0;
    pointer-events: none;
}

/* Voice note player */

.voice-player {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    animation: card-in 0.5s ease both;
}

.voice-intro {
    margin: 0;
    color: var(--g-muted);
    font-family: var(--font-script);
    font-size: 1.4rem;
}

.play-button {
    width: 78px;
    height: 78px;
    border: 0;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    display: grid;
    place-items: center;
    font-size: 1.7rem;
    cursor: pointer;
    box-shadow: 0 10px 25px color-mix(in srgb, var(--accent) 40%, transparent);
    transition: transform 0.15s ease;
}

.play-button:active {
    transform: scale(0.94);
}

.voice-player.is-playing .play-button {
    animation: pulse-ring 1.6s ease-out infinite;
}

@keyframes pulse-ring {
    0% {
        box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 45%, transparent);
    }

    100% {
        box-shadow: 0 0 0 22px transparent;
    }
}

.waveform {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
    width: 100%;
    height: 48px;
}

.waveform span {
    width: 4px;
    height: 18%;
    border-radius: 2px;
    background: color-mix(in srgb, var(--accent) 40%, var(--g-surface-border));
    transition: background 0.3s ease;
}

.voice-player.is-playing .waveform span {
    background: var(--accent);
    animation: wave-bar 0.9s ease-in-out infinite;
    animation-delay: calc(var(--i) * 45ms);
}

@keyframes wave-bar {
    50% {
        height: var(--peak);
    }
}

.voice-progress {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    overflow: hidden;
    background: color-mix(in srgb, var(--g-text) 12%, transparent);
    cursor: pointer;
}

.voice-progress-bar {
    width: 0;
    height: 100%;
    background: var(--accent);
    transition: width 0.2s linear;
}

.voice-time {
    display: flex;
    justify-content: space-between;
    width: 100%;
    font-size: 0.85rem;
    color: var(--g-muted);
    font-variant-numeric: tabular-nums;
}

/* Timeline */

.timeline {
    position: relative;
    list-style: none;
    margin: 0;
    padding: 0.5rem 0 0 1.75rem;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 7px;
    top: 12px;
    bottom: 6px;
    width: 2px;
    background: color-mix(in srgb, var(--accent) 40%, var(--g-surface-border));
}

.timeline li {
    position: relative;
    padding-bottom: 1.8rem;
    opacity: 0;
    transform: translateX(-18px);
    transition:
        opacity 0.6s ease,
        transform 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.timeline li.is-visible {
    opacity: 1;
    transform: none;
}

.timeline li::before {
    content: '';
    position: absolute;
    left: calc(-1.75rem + 2px);
    top: 6px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 0 4px var(--g-bg);
    transform: scale(0);
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) 0.2s;
}

.timeline li.is-visible::before {
    transform: scale(1);
}

.timeline time {
    display: block;
    margin-bottom: 0.2rem;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--accent);
}

.timeline-relative {
    margin-left: 0.5rem;
    font-weight: 400;
    letter-spacing: 0;
    text-transform: none;
    color: var(--g-muted);
}

.timeline h3 {
    margin-bottom: 0.25rem;
    color: var(--g-text);
}

.timeline p {
    margin: 0;
    color: var(--g-muted);
}

.timeline-photo {
    display: block;
    width: 100%;
    max-width: 16rem;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    margin-top: 0.7rem;
    padding: 6px;
    border-radius: 10px;
    background: var(--g-paper);
    box-shadow: var(--g-shadow);
    transform: rotate(-1.5deg);
}

/* Reasons: star sky */

.sky {
    position: relative;
    padding: 1rem 1rem 1.25rem;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 20px;
    background: radial-gradient(circle at 30% 15%, #2a2d5a, #0b1026 70%);
    color: #fff;
    box-shadow: var(--g-shadow);
    overflow: hidden;
}

.sky-hint {
    position: relative;
    margin: 0 0 0.25rem;
    text-align: center;
    font-size: 0.85rem;
    opacity: 0.85;
}

.sky-field {
    position: relative;
    height: min(320px, 44dvh);
}

.star {
    position: absolute;
    left: var(--x);
    top: var(--y);
    width: 44px;
    height: 44px;
    margin: -22px 0 0 -22px;
    padding: 0;
    border: 0;
    background: none;
    color: rgba(255, 255, 255, 0.6);
    font-size: calc(1.1rem * var(--scale));
    line-height: 1;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    animation: twinkle var(--duration) ease-in-out var(--delay) infinite alternate;
    transition:
        color 0.3s ease,
        text-shadow 0.3s ease;
}

.star.is-lit {
    color: var(--gold);
    text-shadow: 0 0 18px var(--gold);
    animation: star-pop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes star-pop {
    from {
        transform: scale(0.6);
    }

    50% {
        transform: scale(1.6);
    }

    to {
        transform: scale(1.25);
    }
}

.sky-reason {
    position: relative;
    min-height: 3.6rem;
    margin-top: 0.5rem;
    padding: 0.9rem 1rem;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.1);
    text-align: center;
    font-family: var(--font-display);
    font-style: italic;
    font-size: 1.15rem;
    line-height: 1.4;
    animation: rise 0.4s ease both;
}

.sky-reason p {
    margin: 0;
}

/* Quiz */

.quiz-progress {
    margin-bottom: 0.75rem;
    text-align: center;
    font-size: 0.9rem;
    color: var(--g-muted);
}

.quiz-card {
    padding: 1.5rem;
    border: 1px solid var(--g-surface-border);
    border-radius: 20px;
    background: var(--g-surface);
    box-shadow: var(--g-shadow);
    backdrop-filter: blur(10px);
    animation: card-in 0.45s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.quiz-question {
    margin-bottom: 1.25rem;
    text-align: center;
    font-family: var(--font-display);
    font-size: 1.35rem;
    line-height: 1.3;
    color: var(--g-text);
}

.quiz-options {
    display: grid;
    gap: 0.6rem;
}

.quiz-option {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.8rem 1rem;
    border: 1.5px solid var(--g-surface-border);
    border-radius: 12px;
    background: var(--g-surface);
    color: var(--g-text);
    text-align: left;
    font-size: 1rem;
    cursor: pointer;
    opacity: 0;
    animation: rise 0.4s ease both;
    animation-delay: calc(0.1s + var(--i) * 0.08s);
    transition:
        border-color 0.2s ease,
        background 0.2s ease,
        transform 0.15s ease;
}

.quiz-option:hover:not(:disabled) {
    border-color: var(--accent);
}

.quiz-option:active:not(:disabled) {
    transform: scale(0.98);
}

.quiz-option:disabled {
    cursor: default;
}

.quiz-letter {
    flex: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: color-mix(in srgb, var(--g-text) 10%, transparent);
    font-size: 0.85rem;
    font-weight: 700;
}

.quiz-option.is-correct {
    border-color: var(--success);
    background: color-mix(in srgb, var(--success) 18%, var(--g-surface));
}

.quiz-option.is-correct .quiz-letter {
    background: var(--success);
    color: #fff;
}

.quiz-option.is-wrong {
    border-color: var(--danger);
    background: color-mix(in srgb, var(--danger) 16%, var(--g-surface));
    opacity: 1;
    animation: shake 0.4s ease;
}

@keyframes shake {
    20%,
    60% {
        transform: translateX(-6px);
    }

    40%,
    80% {
        transform: translateX(6px);
    }
}

.quiz-feedback {
    margin: 1rem 0 0;
    text-align: center;
    font-weight: 600;
    animation: rise 0.4s ease both;
}

.quiz-feedback[hidden] {
    display: none;
}

.quiz-feedback.is-correct {
    color: var(--success);
}

.gift[data-mode='dark'] .quiz-feedback.is-correct {
    color: #6fd39a;
}

.quiz-feedback.is-wrong {
    color: var(--danger);
}

.gift[data-mode='dark'] .quiz-feedback.is-wrong {
    color: #ff8a80;
}

.quiz-next {
    display: flex;
    margin: 1rem auto 0;
    color: #fff;
}

.quiz-next[hidden] {
    display: none;
}

.quiz-result {
    text-align: center;
}

.quiz-badge {
    font-size: 3rem;
    line-height: 1;
    animation: pop 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.quiz-score {
    margin: 0.5rem 0;
    font-family: var(--font-display);
    font-size: 3.5rem;
    font-style: italic;
    color: var(--accent);
    animation: pop 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) 0.1s both;
}

.quiz-result-title {
    margin: 0 0 0.25rem;
    font-family: var(--font-display);
    font-size: 1.4rem;
}

@keyframes pop {
    from {
        opacity: 0;
        transform: scale(0.4);
    }
}

/* Final gift box */

.giftbox-scene {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 2rem 0 1rem;
}

.giftbox-scene[hidden] {
    display: none;
}

.giftbox {
    position: relative;
    width: 180px;
    height: 200px;
    padding: 0;
    border: 0;
    background: none;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    filter: drop-shadow(0 20px 30px rgba(0, 0, 0, 0.3));
    animation: wiggle 1.8s ease-in-out infinite;
}

@keyframes wiggle {
    0%,
    100% {
        transform: rotate(0deg);
    }

    20% {
        transform: rotate(-4deg);
    }

    40% {
        transform: rotate(4deg);
    }

    60% {
        transform: rotate(-2deg);
    }

    80% {
        transform: rotate(2deg);
    }
}

.giftbox > span {
    position: absolute;
    display: block;
}

.giftbox-body {
    left: 14px;
    right: 14px;
    bottom: 0;
    height: 125px;
    border-radius: 8px;
    background: var(--accent);
}

.giftbox-body::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 26px;
    background: var(--gold);
    transform: translateX(-50%);
}

.giftbox-lid {
    left: 0;
    right: 0;
    top: 52px;
    height: 44px;
    z-index: 2;
    border-radius: 8px;
    background: color-mix(in srgb, var(--accent) 82%, #000);
    transform-origin: bottom left;
    transition:
        transform 0.7s cubic-bezier(0.2, 0.8, 0.2, 1),
        opacity 0.7s ease;
}

.giftbox-lid::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 26px;
    background: var(--gold);
    transform: translateX(-50%);
}

.giftbox-bow {
    position: absolute;
    left: 50%;
    top: -26px;
    width: 84px;
    height: 36px;
    transform: translateX(-50%);
    background: radial-gradient(circle at 50% 78%, var(--gold) 0 9px, transparent 10px);
}

.giftbox-bow::before,
.giftbox-bow::after {
    content: '';
    position: absolute;
    top: 4px;
    width: 36px;
    height: 24px;
    border: 6px solid var(--gold);
    border-radius: 50%;
}

.giftbox-bow::before {
    left: 2px;
    transform: rotate(-22deg);
}

.giftbox-bow::after {
    right: 2px;
    transform: rotate(22deg);
}

.giftbox.is-open {
    animation: none;
}

.giftbox.is-open .giftbox-lid {
    opacity: 0;
    transform: translate(-40px, -170px) rotate(-35deg);
}

.giftbox.is-open .giftbox-body {
    animation: box-bounce 0.6s ease;
}

@keyframes box-bounce {
    30% {
        transform: translateY(8px) scaleX(1.04);
    }

    60% {
        transform: translateY(-6px);
    }
}

.final-message {
    padding: clamp(1.5rem, 6vw, 2.5rem);
    border-radius: 20px;
    background: var(--g-paper);
    color: var(--g-paper-ink);
    box-shadow: var(--g-shadow);
    text-align: center;
    font-family: var(--font-display);
    font-size: 1.25rem;
    line-height: 1.6;
    animation: card-in 0.7s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.final-message[hidden] {
    display: none;
}

.final-message p {
    opacity: 0;
    animation: rise 0.6s ease both;
    animation-delay: calc(0.3s + var(--i) * 0.2s);
}

.final-message p:last-child {
    margin-bottom: 0;
}

/* Outro */

.outro {
    padding: 2.5rem 0;
    text-align: center;
}

.outro-heart {
    font-size: 4rem;
    line-height: 1;
    color: var(--accent);
    animation: heartbeat 1.4s ease-in-out infinite;
}

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

    14% {
        transform: scale(1.18);
    }

    28% {
        transform: scale(1);
    }

    42% {
        transform: scale(1.12);
    }
}

.outro h2 {
    margin: 1rem 0 0.25rem;
    font-style: italic;
    font-weight: 500;
    color: var(--g-text);
}

.outro p {
    color: var(--g-muted);
}

.outro-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.6rem;
    margin: 1.25rem 0 0.75rem;
}

.outro .button-secondary {
    background: var(--g-surface);
    border-color: var(--g-surface-border);
    color: var(--g-text);
}

.share-status {
    min-height: 1.4em;
    font-size: 0.9rem;
    color: var(--g-muted);
}

/* Loading and errors */

.gift-loading {
    min-height: 100dvh;
    display: grid;
    place-items: center;
    text-align: center;
    color: var(--muted);
}

.loading-heart {
    font-size: 3.5rem;
    line-height: 1;
    color: var(--accent);
    animation: heartbeat 1.2s ease-in-out infinite;
}

.gift-error {
    min-height: 100dvh;
    display: grid;
    place-items: center;
    padding: 2rem;
    text-align: center;
}

/* Reduced motion */

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