/* Quiz Simulador — standalone full-screen quiz styles */

:root {
        --qs-primary: #9333ea;
        --qs-primary-hover: #7e22ce;
        --qs-bg: #f9fafb;
        --qs-card: #ffffff;
        --qs-gray-200: #e5e7eb;
        --qs-gray-400: #9ca3af;
        --qs-gray-500: #6b7280;
        --qs-gray-600: #4b5563;
        --qs-gray-700: #374151;
        --qs-gray-800: #1f2937;
}

* {
        box-sizing: border-box;
}

html,
body.qs-body {
        margin: 0;
        padding: 0;
        background: var(--qs-bg);
        font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
        color: var(--qs-gray-800);
        -webkit-font-smoothing: antialiased;
}

.qs-screen {
        min-height: 100vh;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: flex-start;
        padding: 1rem;
        padding-top: 1.25rem;
}

@media (min-width: 768px) {
        .qs-screen {
                justify-content: center;
                padding-top: 1rem;
        }

        /* Only when a disclaimer is present: re-center the quiz card in the space
         * above the footer (the footer's own top auto margin pins it to the
         * bottom). Quizzes without a footer keep the original centered layout. */
        .qs-screen.qs-has-footer .qs-card {
                margin-top: auto;
        }
}

@media (max-width: 767.98px) {
        /* On mobile there is little vertical room, so guarantee a visible gap of
         * at least 150px between the quiz and the disclaimer. The footer's top auto
         * margin still pins it to the bottom when the screen is tall enough; if the
         * content overflows, this fixed gap survives instead of collapsing to 0. */
        .qs-screen.qs-has-footer .qs-card {
                margin-bottom: 150px;
        }
}

.qs-card {
        background: var(--qs-card);
        border-radius: 1rem;
        box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
        max-width: 32rem;
        width: 100%;
        padding: 2rem;
}

.qs-logo {
        display: flex;
        justify-content: center;
        margin-bottom: 1.5rem;
}

.qs-logo img {
        display: block;
        width: auto;
        max-width: 100%;
}

/* Intro text */
.qs-intro {
        text-align: center;
        color: var(--qs-gray-700);
        font-size: 1rem;
        line-height: 1.625;
        margin: 0 0 1.5rem;
}

.qs-intro strong {
        font-weight: 700;
}

/* Progress bar */
.qs-progress {
        display: flex;
        align-items: center;
        gap: 0.75rem;
        margin-bottom: 1.5rem;
}

.qs-progress-track {
        flex: 1;
        height: 0.5rem;
        background: var(--qs-gray-200);
        border-radius: 9999px;
        overflow: hidden;
}

.qs-progress-fill {
        height: 100%;
        background: var(--qs-progress, var(--qs-primary));
        border-radius: 9999px;
        transition: width 0.5s ease-out;
        width: 0;
}

.qs-progress-label {
        font-size: 0.875rem;
        color: var(--qs-gray-500);
        white-space: nowrap;
}

/* Animated content area */
.qs-stage {
        transition: opacity 0.2s ease, transform 0.2s ease;
        opacity: 1;
        transform: translateY(0);
}

.qs-stage.qs-hidden {
        opacity: 0;
        transform: translateY(8px);
}

/* Question */
.qs-question-text,
.qs-completion-message {
        text-align: center;
        font-size: 1.125rem;
        font-weight: 600;
        color: var(--qs-gray-800);
        line-height: 1.375;
        margin: 0 0 1rem;
}

.qs-options {
        display: flex;
        flex-direction: column;
        gap: 0.75rem;
        margin-top: 0.5rem;
}

.qs-option,
.qs-cta {
        display: block;
        width: 100%;
        padding: 1rem 1.25rem;
        background: var(--qs-primary);
        color: #fff;
        font-size: 0.875rem;
        font-weight: 500;
        border: none;
        border-radius: 0.75rem;
        box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
        cursor: pointer;
        text-align: center;
        text-decoration: none;
        transition: background 0.15s ease, transform 0.15s ease;
        font-family: inherit;
}

/* Only apply hover on devices with a real pointer (mouse). On touch devices
 * the :hover state "sticks" to the last-tapped position, so after answering a
 * question the option in the same slot on the next question would appear
 * pre-highlighted. Gating behind (hover: hover) avoids that entirely. */
@media (hover: hover) and (pointer: fine) {
        .qs-option:hover,
        .qs-cta:hover {
                background: var(--qs-primary-hover);
        }
}

/* Hard guard: some browsers (notably in-app browsers like TikTok/Facebook/
 * Instagram) misreport (hover: hover) on touch devices, so the media query
 * above isn't enough on its own. Once any real touch is detected, quiz.js adds
 * the .qs-touch class to <html>; this rule then forces the base color back even
 * if the browser tries to apply :hover, killing the sticky highlight for good. */
html.qs-touch .qs-option:hover,
html.qs-touch .qs-cta:hover {
        background: var(--qs-primary);
}

.qs-option:active,
.qs-cta:active {
        transform: scale(0.95);
}

.qs-option:disabled {
        opacity: 0.7;
        cursor: default;
}

/* Loading */
.qs-loading {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 1rem;
        padding: 2rem 0;
}

.qs-spinner {
        width: 2.5rem;
        height: 2.5rem;
        border: 4px solid var(--qs-primary);
        border-top-color: transparent;
        border-radius: 9999px;
        animation: qs-spin 0.8s linear infinite;
}

.qs-loading-text {
        font-size: 0.875rem;
        font-weight: 500;
        color: var(--qs-gray-600);
        animation: qs-pulse 1.5s ease-in-out infinite;
}

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

@keyframes qs-pulse {
        0%, 100% {
                opacity: 1;
        }
        50% {
                opacity: 0.5;
        }
}

/* Completion */
.qs-completion {
        display: flex;
        flex-direction: column;
        gap: 1rem;
}

.qs-cta-subtitle {
        text-align: center;
        font-size: 0.75rem;
        color: var(--qs-gray-400);
        margin: 0;
}

.qs-empty {
        text-align: center;
        color: var(--qs-gray-500);
        font-size: 0.95rem;
        padding: 1rem 0;
}

/* Footer disclaimer (legal text). Spans the full viewport width via align-self
 * stretch plus negative horizontal/bottom margins that cancel the .qs-screen
 * padding, while internal padding keeps the text off the edges. Pinned to the
 * bottom of the viewport via the top auto margin; if the quiz + footer are
 * taller than the screen the margin collapses and the content scrolls. */
.qs-footer {
        align-self: stretch;
        width: auto;
        max-width: none;
        margin: auto -1rem -1rem;
        padding: 1rem 1.25rem;
        text-align: center;
        font-size: 0.6875rem;
        line-height: 1.5;
        background: #222223;
        color: #dbdbdd;
}

.qs-footer p {
        margin: 0 0 0.5rem;
}

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

/* No bullets/markers in disclaimer lists; keep them centered like the rest. */
.qs-footer ul,
.qs-footer ol {
        list-style: none;
        margin: 0 0 0.5rem;
        padding: 0;
}

.qs-footer li {
        margin: 0;
}

.qs-footer a {
        color: #dbdbdd;
        text-decoration: underline;
}

@media (hover: hover) and (pointer: fine) {
        .qs-footer a:hover {
                color: #ffffff;
        }
}
