:root {
    --fht-primary: #4f46e5;
    --fht-primary-dark: #3730a3;
    --fht-contrast: #ffffff;
    --fht-shadow: rgba(15, 23, 42, 0.25);
}

.fht-helper {
    position: fixed;
    bottom: clamp(3rem, 8vw, 6rem);
    right: clamp(1.25rem, 4vw, 2rem);
    left: auto;
    top: auto;
    z-index: 9999;
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

.fht-floating-button {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.85rem 1.25rem;
    border: none;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--fht-primary), #7c3aed);
    color: var(--fht-contrast);
    font-size: 0.95rem;
    font-weight: 600;
    box-shadow: 0 18px 35px -15px var(--fht-shadow);
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease, background 0.3s ease;
    animation: fht-pulse 3.75s ease-in-out infinite;
}

.fht-floating-button:focus,
.fht-floating-button:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 20px 40px -18px var(--fht-shadow);
    background: linear-gradient(135deg, var(--fht-primary-dark), #6d28d9);
    outline: none;
    animation-play-state: paused;
}

.fht-floating-button:focus-visible {
    outline: 3px solid rgba(79, 70, 229, 0.35);
    outline-offset: 3px;
}

.fht-button-icon {
    width: 1.35rem;
    height: 1.35rem;
    border-radius: 999px;
    background-color: rgba(255, 255, 255, 0.2);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
}

.fht-modal[hidden] {
    display: none;
}

.fht-modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: grid;
    place-items: center;
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

.fht-modal__overlay {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(4px);
}

.fht-modal__content {
    position: relative;
    width: min(88vw, 720px);
    padding: 1.5rem 1.5rem 2rem;
    border-radius: 18px;
    background: #0f172a;
    color: var(--fht-contrast);
    box-shadow: 0 30px 60px -25px var(--fht-shadow);
    animation: fht-fade-up 0.28s ease-out;
    max-height: min(92vh, 720px);
    overflow: hidden;
}

.fht-modal__content h2 {
    margin-top: 0;
    margin-bottom: 1rem;
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: 0.01em;
}

.fht-modal__video {
    position: relative;
    width: 100%;
    padding-top: 56.25%;
    border-radius: 14px;
    overflow: hidden;
    background: #111827;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

.fht-modal__video iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.fht-modal__close {
    position: absolute;
    inset: 1rem 1rem auto auto;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 999px;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    color: var(--fht-contrast);
    font-size: 1.5rem;
    line-height: 1;
    display: grid;
    place-items: center;
    cursor: pointer;
    transition: background 0.3s ease, transform 0.3s ease;
}

.fht-modal__close:hover,
.fht-modal__close:focus {
    background: rgba(255, 255, 255, 0.18);
    transform: scale(1.07);
    outline: none;
}

.fht-modal__close:focus-visible {
    outline: 3px solid rgba(255, 255, 255, 0.4);
    outline-offset: 3px;
}

@keyframes fht-fade-up {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fht-pulse {
    0%, 100% {
        transform: translateY(0) scale(1);
        box-shadow: 0 18px 35px -15px var(--fht-shadow);
    }
    50% {
        transform: translateY(-4px) scale(1.04);
        box-shadow: 0 22px 45px -18px var(--fht-shadow);
    }
}

@media (max-width: 768px) {
    .fht-modal__content {
        width: min(92vw, 640px);
        padding: 1.35rem 1.25rem 1.75rem;
        max-height: min(94vh, 640px);
    }
    .fht-modal__content h2 {
        font-size: 1.25rem;
    }
    .fht-floating-button {
        padding: 0.8rem 1.1rem;
        font-size: 0.9rem;
    }
}

@media (max-width: 540px) {
    .fht-helper {
        bottom: calc(3.25rem + env(safe-area-inset-bottom, 0px));
        right: clamp(1rem, 6vw, 1.5rem);
    }
    .fht-floating-button {
        padding: 0.75rem 1rem;
        gap: 0.45rem;
    }
    .fht-modal__content {
        width: min(94vw, 420px);
        padding: 1.1rem 1rem 1.5rem;
        border-radius: 16px;
        max-height: min(96vh, 520px);
    }
    .fht-modal__video {
        border-radius: 12px;
    }
}

@media (max-width: 420px) {
    .fht-floating-button {
        padding: 0.65rem 0.95rem;
        font-size: 0.85rem;
    }
    .fht-button-label {
        display: none;
    }
    .fht-floating-button {
        border-radius: 50px;
    }
    .fht-modal__content {
        width: min(96vw, 360px);
        padding: 1rem 0.9rem 1.35rem;
        max-height: 94vh;
    }
}
