.text-birthday {
    position: fixed;
    inset: 0;
    z-index: 30;
    color: #be5a7a;
    user-select: none;
    -webkit-user-select: none;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.75s ease, visibility 0.75s ease;
}

.text-birthday.is-active {
    z-index: 70;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* Ambient glowing text */
.glowing-text {
    text-shadow: 0 0 15px rgba(255, 182, 193, 0.55),
                 0 0 30px rgba(255, 192, 203, 0.45),
                 0 0 45px rgba(255, 228, 235, 0.35);
}

#name-line {
    width: 100%;
    max-width: 100%;
    margin-inline: auto;
    padding-block: 0.2rem 0.1rem;
    padding-inline: 0;
    overflow: visible;
}

/* Gradient text for recipient name — size set by JS fit (--recipient-fs) */
.gradient-recipient-name {
    --recipient-fs: clamp(1.7rem, 8vw, 9rem);
    display: block;
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    box-sizing: border-box;
    font-family: 'Great Vibes', cursive;
    font-size: var(--recipient-fs);
    font-weight: 400;
    line-height: 1.18;
    letter-spacing: 0.012em;
    text-align: center;
    text-wrap: balance;
    overflow-wrap: normal;
    word-break: keep-all;
    white-space: nowrap;
    background: linear-gradient(135deg, #f472b6 10%, #fda4af 45%, #fb7185 90%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
    /* Swash cursive cần padding; ngang hẹp để đỡ “ăn” bề rộng trên mobile */
    padding: 0.36em 0.04em 0.24em;
    overflow: visible;
}

.gradient-recipient-name.is-wrapped {
    white-space: normal;
    line-height: 1.3;
    overflow-wrap: break-word;
    word-break: normal;
}

.gradient-recipient-name.is-compact {
    letter-spacing: 0;
}

.gradient-recipient-name.is-tight {
    letter-spacing: -0.015em;
}

/* Phone */
@media (max-width: 479px) {
    .gradient-recipient-name {
        --recipient-fs: clamp(1.55rem, 7vw, 3.6rem);
        line-height: 1.16;
        padding: 0.32em 0.02em 0.2em;
    }

    .gradient-recipient-name.is-wrapped {
        line-height: 1.34;
    }
}

/* Phone lớn / phablet */
@media (min-width: 480px) and (max-width: 767px) {
    .gradient-recipient-name {
        --recipient-fs: clamp(1.75rem, 6.8vw, 4.4rem);
    }

    .gradient-recipient-name.is-wrapped {
        line-height: 1.32;
    }
}

/* iPad & tablet */
@media (min-width: 768px) and (max-width: 1024px) {
    .gradient-recipient-name {
        --recipient-fs: clamp(2.2rem, 6.2vw, 6.25rem);
        line-height: 1.2;
    }

    .gradient-recipient-name.is-wrapped {
        line-height: 1.3;
    }
}

/* Phone / iPad xoay ngang: hạ trần cỡ chữ để khỏi đụng greeting + subtitle */
@media (max-width: 1024px) and (orientation: landscape) {
    .gradient-recipient-name {
        --recipient-fs: clamp(1.4rem, 5.2vw, 3.75rem);
        padding-block: 0.22em 0.14em;
    }

    .gradient-recipient-name.is-wrapped {
        line-height: 1.22;
    }

    #name-line {
        padding-block: 0.05rem;
    }
}

/* Shine effect */
.shine-sweep {
    position: relative;
    overflow: visible;
}

.shine-sweep::after {
    content: '';
    position: absolute;
    top: -10%;
    left: -150%;
    width: 60%;
    height: 120%;
    background: linear-gradient(
        to right,
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 0.55) 50%,
        rgba(255, 255, 255, 0) 100%
    );
    transform: skewX(-25deg);
}

/* Typewriter cursor */
.typing-cursor::after {
    content: '|';
    animation: blink 0.8s infinite;
}

@keyframes blink {
    0%, 100% { opacity: 0; }
    50% { opacity: 1; }
}

.text-actions {
    position: absolute;
    left: 50%;
    bottom: calc(1.1rem + env(safe-area-inset-bottom, 0px));
    top: auto;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: clamp(0.65rem, 2.2vw, 1.1rem);
    width: max-content;
    padding: clamp(0.35rem, 1.2vw, 0.55rem) clamp(0.7rem, 2.4vw, 1.1rem);
    border: 2px solid #f9a8d4;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.72);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.65) inset,
        0 0 16px rgba(244, 114, 182, 0.45),
        0 0 32px rgba(251, 113, 133, 0.28),
        0 8px 22px rgba(244, 114, 182, 0.18);
    transform: translateX(-50%);
    opacity: 0;
    pointer-events: none;
    cursor: pointer;
    appearance: none;
    -webkit-tap-highlight-color: transparent;
    animation: text-actions-glow 2.4s ease-in-out infinite;
    transition: transform 0.25s ease;
}

.text-actions.is-visible {
    opacity: 1;
    pointer-events: auto;
}

.text-actions:hover {
    transform: translateX(-50%) scale(1.04);
}

.text-actions:active {
    transform: translateX(-50%) scale(0.97);
}

@keyframes text-actions-glow {
    0%, 100% {
        border-color: #f9a8d4;
        box-shadow:
            0 0 0 1px rgba(255, 255, 255, 0.65) inset,
            0 0 14px rgba(244, 114, 182, 0.4),
            0 0 28px rgba(251, 113, 133, 0.22),
            0 8px 22px rgba(244, 114, 182, 0.16);
    }
    50% {
        border-color: #fb7185;
        box-shadow:
            0 0 0 1px rgba(255, 255, 255, 0.8) inset,
            0 0 22px rgba(244, 114, 182, 0.7),
            0 0 42px rgba(251, 113, 133, 0.42),
            0 10px 26px rgba(244, 114, 182, 0.24);
    }
}

.text-action-icon-wrap {
    display: block;
    opacity: 0;
    transform: translateY(18px) scale(0.86);
}

.text-action-icon {
    display: block;
    width: clamp(2.1rem, 7vw, 3rem);
    height: auto;
    filter: drop-shadow(0 4px 8px rgba(244, 114, 182, 0.2));
    pointer-events: none;
    user-select: none;
}

.text-action-icon--next {
    width: clamp(1.75rem, 5.8vw, 2.5rem);
}

@media (hover: none) {
    .text-actions:hover {
        transform: translateX(-50%);
    }
}

@media (prefers-reduced-motion: reduce) {
    .text-birthday,
    .text-actions {
        transition: none;
        animation: none;
    }
}
