/* Quiz popup — layout only; colors/controls from style.css (hero, form-section, submit) */

.fluxweb-quiz-popup {
    --quiz-close-size: 3.75rem;
    --quiz-close-gap: 0.75rem;
    --quiz-close-area: calc(var(--quiz-close-size) + var(--quiz-close-gap));
    --quiz-popup-v-reserve: calc(
        var(--quiz-close-area) + max(0.5rem, env(safe-area-inset-top, 0px)) + max(0.5rem, env(safe-area-inset-bottom, 0px))
    );
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding-top: max(calc(var(--quiz-close-area) + 0.25rem), calc(env(safe-area-inset-top, 0px) + var(--quiz-close-area)));
    padding-right: max(0.5rem, env(safe-area-inset-right, 0px));
    padding-bottom: max(0.5rem, env(safe-area-inset-bottom, 0px));
    padding-left: max(0.5rem, env(safe-area-inset-left, 0px));
    box-sizing: border-box;
}

.fluxweb-quiz-popup[hidden] {
    display: none !important;
}

.fluxweb-quiz-popup__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(12, 20, 31, 0.78);
    backdrop-filter: blur(4px);
}

.fluxweb-quiz-popup__panel {
    position: relative;
    z-index: 1;
    width: min(100%, 36rem);
    max-width: 100%;
    height: auto;
    max-height: calc(100dvh - var(--quiz-popup-v-reserve));
    display: flex;
    flex-direction: column;
    flex: 0 1 auto;
    min-height: 0;
}

.fluxweb-quiz-popup__dialog.form-section {
    position: relative;
    width: 100%;
    height: auto;
    flex: 0 1 auto;
    min-height: 0;
    max-height: calc(100dvh - var(--quiz-popup-v-reserve));
    display: flex;
    flex-direction: column;
    padding: 0;
    background-color: var(--color-background);
    background-image: linear-gradient(
        122deg,
        rgba(13, 219, 178, 0.14) -9.98%,
        rgba(21, 99, 224, 0.14) 102.62%
    );
    box-shadow: 0 1.5rem 4rem rgba(0, 0, 0, 0.45);
    outline: none;
    overflow: hidden;
}

.fluxweb-quiz-popup__close {
    position: fixed;
    top: max(0.75rem, env(safe-area-inset-top, 0px));
    right: max(0.75rem, env(safe-area-inset-right, 0px));
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 3.5rem;
    height: 3.5rem;
    padding: 0;
    border: none;
    border-radius: 0;
    background: none;
    color: rgba(255, 255, 255, 0.9);
    font-size: 3rem;
    font-weight: 300;
    line-height: 0.9;
    cursor: pointer;
    transition: color 175ms ease, opacity 175ms ease;
}

.fluxweb-quiz-popup__close span {
    display: block;
    transform: translateY(-0.04em);
}

.fluxweb-quiz-popup__close:hover {
    color: var(--color-accent);
    opacity: 1;
}

body.fluxweb-quiz-open {
    overflow: hidden;
}

.fluxweb-quiz-app {
    position: relative;
    z-index: 1;
    flex: 0 1 auto;
    min-height: 0;
    max-height: calc(100dvh - var(--quiz-popup-v-reserve));
    overflow-x: hidden;
    overflow-y: auto;
    padding: 2.5rem 2.5rem 2rem;
    scrollbar-width: thin;
    scrollbar-color: rgba(13, 219, 179, 0.4) transparent;
}

.fluxweb-quiz-app::-webkit-scrollbar {
    width: 0.375rem;
}

.fluxweb-quiz-app::-webkit-scrollbar-track {
    margin: 0.5rem 0;
    background: transparent;
}

.fluxweb-quiz-app::-webkit-scrollbar-thumb {
    border-radius: 999px;
    background: rgba(13, 219, 179, 0.35);
    border: 0.125rem solid transparent;
    background-clip: padding-box;
}

.fluxweb-quiz-app::-webkit-scrollbar-thumb:hover {
    background: rgba(13, 219, 179, 0.55);
    background-clip: padding-box;
}

.fluxweb-quiz-app::-webkit-scrollbar-corner {
    background: transparent;
}

.fluxweb-quiz-step {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    min-height: 0;
}

.fluxweb-quiz-step__title-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.fluxweb-quiz-heading {
    margin: 0;
    flex: 1;
    min-width: 0;
}

.fluxweb-quiz-progress {
    flex-shrink: 0;
    margin: 0;
    font-size: 1.125rem;
    font-weight: 600;
    line-height: 1;
    color: var(--color-accent);
    font-variant-numeric: tabular-nums;
}

.fluxweb-quiz-breadcrumb {
    margin: 0.5rem 0 0;
}

.fluxweb-quiz-breadcrumb__back {
    margin-right: 0.35rem;
    padding: 0;
    border: none;
    background: none;
    color: var(--color-text-gray70);
    cursor: pointer;
    font-size: inherit;
    font-family: inherit;
}

.fluxweb-quiz-breadcrumb__back:hover {
    color: var(--color-accent);
}

.fluxweb-quiz-options {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    padding: 1rem 1.25rem;
    border-radius: 1.5rem;
    border: 0.0625rem solid rgba(21, 99, 224, 0.2);
    background: #0a1119;
}

.fluxweb-quiz-options--grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.35rem;
}

.fluxweb-quiz-options--grid .fluxweb-quiz-option--wide {
    grid-column: auto;
}

.fluxweb-quiz-option {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.85rem 0.65rem;
    cursor: pointer;
    border-radius: 0.75rem;
    transition: background-color 180ms ease;
}

.fluxweb-quiz-option:hover {
    background: rgba(13, 219, 179, 0.06);
}

.fluxweb-quiz-option.is-selected {
    background: rgba(13, 219, 179, 0.1);
}

.fluxweb-quiz-option__input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.fluxweb-quiz-option__radio {
    flex-shrink: 0;
    margin-top: 0.2rem;
    width: 1.125rem;
    height: 1.125rem;
    border: 0.125rem solid rgba(255, 255, 255, 0.45);
    border-radius: 50%;
    transition: border-color 180ms ease, box-shadow 180ms ease;
}

.fluxweb-quiz-option.is-selected .fluxweb-quiz-option__radio {
    border-color: var(--color-accent);
    box-shadow: inset 0 0 0 0.25rem var(--color-accent);
}

.fluxweb-quiz-option__icon {
    flex-shrink: 0;
    margin-top: 0.1rem;
    font-size: 1.05rem;
    line-height: 1;
}

.fluxweb-quiz-option__label {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    min-width: 0;
    flex: 1;
}

.fluxweb-quiz-option__title {
    font-size: 0.9375rem;
    line-height: 1.35;
    color: var(--color-text);
}

.fluxweb-quiz-option__desc {
    font-size: 0.8125rem;
    line-height: 1.4;
    color: var(--color-text-gray70);
}

.fluxweb-quiz-nav {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 0;
    padding-top: 0.25rem;
    flex-shrink: 0;
}

.fluxweb-quiz-nav__spacer {
    width: 2.75rem;
    flex-shrink: 0;
}

.fluxweb-quiz-nav__back {
    flex-shrink: 0;
    width: 2.75rem;
    height: 2.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 0.0625rem solid rgba(13, 219, 179, 0.35);
    border-radius: 50%;
    background: rgba(12, 20, 31, 0.5);
    color: var(--color-text);
    font-size: 1.125rem;
    cursor: pointer;
    transition: background-color 175ms ease, border-color 175ms ease;
}

.fluxweb-quiz-nav__back:hover {
    border-color: var(--color-accent);
    background: rgba(12, 20, 31, 0.72);
}

.fluxweb-quiz-popup .fluxweb-quiz-nav__next.submit {
    flex: 1;
    width: auto;
    max-width: none;
    margin-top: 0;
    border-radius: 1.5rem;
}

.fluxweb-quiz-popup .fluxweb-quiz-nav__next.submit:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    box-shadow: none;
}

/* Contact step — reuse form blocks from theme */
.fluxweb-quiz-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.fluxweb-quiz-form .form-messenger-block {
    gap: 0.5rem;
}

.fluxweb-quiz-form .checkbox_wrap {
    margin-top: 0.25rem;
}

.fluxweb-quiz-nav--form {
    margin-top: 0.5rem;
}

.fluxweb-quiz-form-note {
    margin: 0;
    text-align: center;
}

.fluxweb-quiz-message {
    margin: 0;
    font-size: 0.875rem;
    text-align: center;
}

.fluxweb-quiz-message--error {
    color: #ff8a7a;
}

.fluxweb-quiz-message--success {
    color: var(--color-accent);
}

.fluxweb-quiz-step--success {
    text-align: center;
    padding: 1.5rem 0 0.5rem;
}

.fluxweb-quiz-step--success .submit {
    max-width: 22rem;
    margin: 1.5rem auto 0;
}

/* Desktop: фиксированные размеры поверх резинового rem */
@media screen and (min-width: 769px) {
    .fluxweb-quiz-popup__panel {
        width: min(100%, 36rem);
    }

    .fluxweb-quiz-popup__close {
        width: 3.75rem;
        height: 3.75rem;
        font-size: 3.25rem;
    }

    .fluxweb-quiz-popup .fluxweb-quiz-heading {
        font-size: 1.75rem;
        line-height: 1.25;
    }

    .fluxweb-quiz-popup .faq-subtitle,
    .fluxweb-quiz-popup .fluxweb-quiz-subtitle {
        font-size: 1.0625rem;
        line-height: 1.55;
    }

    .fluxweb-quiz-popup .fluxweb-quiz-hint {
        font-size: 0.9375rem;
        line-height: 1.45;
    }
}

/* Mobile / tablet ≤768px — как #form и .form-section на сайте */
@media screen and (max-width: 768px) {
    .fluxweb-quiz-popup {
        --quiz-close-size: 6.5rem;
        --quiz-close-gap: 1rem;
        align-items: center;
        justify-content: center;
        padding-top: max(calc(var(--quiz-close-area) + 0.5rem), calc(env(safe-area-inset-top, 0px) + var(--quiz-close-area)));
        padding-right: max(1.4rem, env(safe-area-inset-right, 0px));
        padding-bottom: max(0.5rem, env(safe-area-inset-bottom, 0px));
        padding-left: max(1.4rem, env(safe-area-inset-left, 0px));
    }

    .fluxweb-quiz-popup__panel {
        width: 100%;
        max-width: none;
        min-width: 0;
        flex: 0 1 auto;
        display: flex;
        flex-direction: column;
    }

    .fluxweb-quiz-popup__dialog.form-section {
        flex: 0 1 auto;
        min-height: 0;
        width: 100%;
        border-radius: 2.81rem;
    }

    .fluxweb-quiz-popup__close {
        top: max(0.75rem, env(safe-area-inset-top, 0px));
        right: max(1rem, env(safe-area-inset-right, 0px));
        width: 6.5rem;
        height: 6.5rem;
        font-size: 6.5rem;
    }

    .fluxweb-quiz-app {
        padding: 4.69rem 3.75rem 3.75rem;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
    }

    .fluxweb-quiz-step {
        gap: 3.75rem;
    }

    .fluxweb-quiz-step__title-row {
        gap: 2.5rem;
        align-items: center;
    }

    .fluxweb-quiz-heading {
        font-size: 4.69rem;
        line-height: 1.2;
    }

    .fluxweb-quiz-progress {
        font-size: 3.05rem;
    }

    .fluxweb-quiz-popup .faq-subtitle,
    .fluxweb-quiz-popup .fluxweb-quiz-subtitle {
        font-size: 3.05rem !important;
        line-height: 1.5 !important;
    }

    .fluxweb-quiz-breadcrumb {
        margin-top: 1.25rem;
        font-size: 2.65rem;
        line-height: 1.45;
    }

    .fluxweb-quiz-options {
        gap: 1.25rem;
        padding: 3.75rem 3.15rem;
        border-radius: 2.81rem;
        border-width: 0.12rem;
    }

    .fluxweb-quiz-option {
        gap: 2.11rem;
        padding: 2.5rem 1.75rem;
        border-radius: 1.5rem;
    }

    .fluxweb-quiz-option__radio {
        width: 2.5rem;
        height: 2.5rem;
        margin-top: 0.65rem;
        border-width: 0.18rem;
    }

    .fluxweb-quiz-option.is-selected .fluxweb-quiz-option__radio {
        box-shadow: inset 0 0 0 0.55rem var(--color-accent);
    }

    .fluxweb-quiz-option__icon {
        font-size: 3.05rem;
        margin-top: 0.35rem;
    }

    .fluxweb-quiz-option__title {
        font-size: 3.05rem;
        line-height: 1.45;
    }

    .fluxweb-quiz-option__desc {
        font-size: 2.65rem;
        line-height: 1.45;
    }

    .fluxweb-quiz-nav {
        gap: 2.81rem;
        padding-top: 0.5rem;
    }

    .fluxweb-quiz-nav__back,
    .fluxweb-quiz-nav__spacer {
        width: 9.84rem;
        height: 9.84rem;
        font-size: 3.05rem;
        border-width: 0.12rem;
        border-radius: 50%;
    }

    .fluxweb-quiz-popup .fluxweb-quiz-nav__next.submit {
        min-height: 11.5rem;
        padding: 2.6rem 2.81rem;
        border-radius: 2.81rem;
        font-size: 3.05rem;
        line-height: 1.15;
        border-width: 0.12rem;
    }

    /* Контактный шаг — те же пропорции, что у #form */
    .fluxweb-quiz-form {
        gap: 4.22rem;
    }

    .fluxweb-quiz-form .form-messenger-block {
        gap: 3.75rem;
    }

    .fluxweb-quiz-popup .form-messenger-label {
        font-size: 3.05rem;
        line-height: 1.45;
        margin-bottom: 0.5rem;
    }

    .fluxweb-quiz-popup .form-input {
        min-height: 10.75rem;
        max-height: none;
        padding: 3.35rem 3.15rem;
        font-size: 3.35rem;
        line-height: 1.35;
        border-width: 0.12rem;
        border-radius: 2.81rem;
    }

    .fluxweb-quiz-popup .form-input::placeholder {
        font-size: 3.45rem;
        line-height: 1.35;
        opacity: 0.62;
    }

    .fluxweb-quiz-popup .messenger-segment {
        gap: 2.11rem;
        padding: 0.65rem;
        border-width: 0.12rem;
        border-radius: 2.81rem;
    }

    .fluxweb-quiz-popup .messenger-segment__text {
        font-size: 3.05rem;
        line-height: 1.4;
        padding: 1.25rem 1rem;
        border-radius: 2.5rem;
    }

    .fluxweb-quiz-form .checkbox_wrap {
        gap: 2.81rem;
        margin-top: 0.75rem;
    }

    .fluxweb-quiz-form .checkbox_wrap .s-text {
        font-size: 2.65rem;
        line-height: 1.5;
    }

    .fluxweb-quiz-form-note,
    .fluxweb-quiz-popup .fluxweb-quiz-hint {
        font-size: 2.65rem;
        line-height: 1.45;
    }

    .fluxweb-quiz-message {
        font-size: 2.8rem;
        line-height: 1.35;
        padding: 2rem 0;
    }

    .fluxweb-quiz-step--success .submit {
        max-width: none;
        width: 100%;
        min-height: 11.5rem;
        font-size: 3.05rem;
        border-radius: 2.81rem;
    }
}

/* Узкие экраны: сегмент мессенджеров в столбик */
@media screen and (max-width: 480px) {
    .fluxweb-quiz-popup .messenger-segment {
        flex-direction: column;
        align-items: stretch;
    }

    .fluxweb-quiz-popup .messenger-segment__text {
        padding: 1.5rem 1.25rem;
    }
}

/* Ландшафт на телефоне — чуть меньше вертикальные отступы */
@media screen and (max-width: 768px) and (max-height: 500px) {
    .fluxweb-quiz-app {
        padding-top: 2.5rem;
        padding-bottom: 2rem;
    }

    .fluxweb-quiz-popup {
        --quiz-close-gap: 0.5rem;
    }

    .fluxweb-quiz-step {
        gap: 2rem;
    }

    .fluxweb-quiz-options {
        padding: 2rem 2.25rem;
    }

    .fluxweb-quiz-option {
        padding: 1.5rem 1.25rem;
    }
}
