/* =============================================
   style.css — IQ Brain Age Test
   Theme: Deep Navy + Electric Blue + Gold
   ============================================= */

:root {
    --bg: #0B0F1A;
    --bg-card: #141929;
    --bg-card2: #1C2236;
    --border: rgba(255, 255, 255, 0.08);
    --border-f: rgba(59, 130, 246, 0.4);
    --blue: #3B82F6;
    --blue-glow: rgba(59, 130, 246, 0.2);
    --gold: #F59E0B;
    --gold-glow: rgba(245, 158, 11, 0.2);
    --green: #10B981;
    --red: #EF4444;
    --text: #F1F5F9;
    --text-sub: #94A3B8;
    --text-dim: #64748B;
    --radius: 14px;
    --radius-lg: 20px;
    --t: 0.22s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    background: var(--bg);
    background-image: radial-gradient(ellipse at 50% 0%, rgba(59, 130, 246, 0.12) 0%, transparent 60%);
    color: var(--text);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    overflow-x: hidden;
    padding-bottom: 80px;
    /* Prevent layout flash on load */
    visibility: visible;
}

/* ═══ WRAPPER ══════════════════════════════════════════ */
#root {
    width: 100%;
    max-width: 480px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    /* Lock width immediately to prevent side-flash */
    align-self: flex-start;
    align-self: stretch;
}

/* ═══ HEADER ══════════════════════════════════════════ */
.site-header {
    padding: 18px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    background: var(--bg);
    z-index: 100;
    backdrop-filter: blur(8px);
}

.logo {
    font-size: 20px;
    font-weight: 800;
    letter-spacing: -0.5px;
    color: var(--text);
}

.logo span {
    color: var(--blue);
}

.header-badge {
    font-size: 11px;
    font-weight: 700;
    color: var(--gold);
    background: var(--gold-glow);
    border: 1px solid rgba(245, 158, 11, 0.3);
    padding: 4px 10px;
    border-radius: 20px;
    letter-spacing: 0.5px;
}

/* ═══ APP CONTAINER ══════════════════════════════════════════ */
#app {
    padding: 0 16px 24px;
    flex: 1;
}

/* ═══ SCREEN BASE ══════════════════════════════════════════ */
.screen {
    animation: fadeIn 0.25s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ═══ LANDING ══════════════════════════════════════════ */
.landing-screen {
    padding-top: 12px;
}

.live-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.25);
    color: #10B981;
    font-size: 13px;
    font-weight: 600;
    padding: 7px 14px;
    border-radius: 30px;
    margin-bottom: 16px;
}

.live-dot {
    width: 8px;
    height: 8px;
    background: #10B981;
    border-radius: 50%;
    animation: blink 1.4s infinite;
}

@keyframes blink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.3;
    }
}

.iq-badge {
    display: inline-block;
    background: linear-gradient(135deg, var(--blue), #1D4ED8);
    color: #fff;
    font-size: 12px;
    font-weight: 800;
    padding: 6px 16px;
    border-radius: 30px;
    margin-bottom: 14px;
    letter-spacing: 0.5px;
}

.landing-title {
    font-size: clamp(26px, 7vw, 34px);
    font-weight: 900;
    line-height: 1.1;
    margin-bottom: 12px;
    letter-spacing: -0.5px;
}

.hl {
    background: linear-gradient(135deg, var(--blue) 0%, var(--gold) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.landing-sub {
    font-size: 15px;
    color: var(--text-sub);
    line-height: 1.7;
    margin-bottom: 22px;
}

/* CTA Button */
.cta-btn {
    width: 100%;
    padding: 18px 24px;
    background: linear-gradient(135deg, var(--blue) 0%, #1D4ED8 100%);
    border: none;
    border-radius: var(--radius);
    color: #fff;
    font-size: 17px;
    font-weight: 800;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 20px 0;
    box-shadow: 0 8px 32px rgba(59, 130, 246, 0.35);
    transition: transform var(--t), box-shadow var(--t);
    letter-spacing: -0.2px;
}

.cta-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 40px rgba(59, 130, 246, 0.45);
}

.cta-btn:active {
    transform: translateY(0);
}

.btn-arrow {
    font-size: 20px;
}

/* Trust row */
.trust-row {
    display: flex;
    gap: 10px;
    margin: 0 0 20px;
    flex-wrap: wrap;
}

.trust-item {
    flex: 1;
    min-width: 90px;
    background: var(--bg-card2);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px 8px;
    font-size: 12px;
    font-weight: 600;
    text-align: center;
    color: var(--text-sub);
}

/* Avatars */
.avatars-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 16px 0;
    font-size: 14px;
    color: var(--text-sub);
}

.avatar-stack {
    display: flex;
}

.avatar-stack span {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid var(--bg);
    background: var(--bg-card2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    margin-left: -8px;
}

.avatar-stack span:first-child {
    margin-left: 0;
}

/* Info card */
.info-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-top: 20px;
}

.info-card h2 {
    font-size: 18px;
    font-weight: 800;
    margin-bottom: 10px;
}

.info-card>p {
    font-size: 14px;
    color: var(--text-sub);
    line-height: 1.7;
    margin-bottom: 20px;
}

.info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.info-item {
    background: var(--bg-card2);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 14px;
}

.info-item h3 {
    font-size: 13px;
    color: var(--blue);
    margin-bottom: 5px;
}

.info-item p {
    font-size: 12px;
    color: var(--text-sub);
    line-height: 1.5;
}

/* ═══ PROGRESS BAR ══════════════════════════════════════════ */
.progress-bar-wrap {
    height: 4px;
    background: var(--bg-card2);
    border-radius: 4px;
    margin: 16px 0 20px;
    position: relative;
    overflow: visible;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--blue), var(--gold));
    border-radius: 4px;
    transition: width 0.4s ease;
    position: relative;
}

.progress-bar-fill::after {
    content: '';
    position: absolute;
    right: -1px;
    top: -3px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--gold);
    box-shadow: 0 0 8px var(--gold);
}

.progress-label {
    position: absolute;
    right: 0;
    top: 10px;
    font-size: 11px;
    color: var(--text-dim);
    font-weight: 600;
}

/* ═══ QUESTION CARD ══════════════════════════════════════════ */
.question-screen {
    padding-top: 8px;
}

.question-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px 20px;
    margin-bottom: 16px;
}

.q-number {
    display: inline-block;
    background: var(--blue-glow);
    border: 1px solid var(--border-f);
    color: var(--blue);
    font-size: 12px;
    font-weight: 800;
    padding: 4px 10px;
    border-radius: 20px;
    margin-bottom: 14px;
    letter-spacing: 0.5px;
}

.q-text {
    font-size: 18px;
    font-weight: 800;
    line-height: 1.4;
    margin-bottom: 8px;
}

.q-sub {
    font-size: 15px;
    color: var(--gold);
    font-weight: 700;
    margin-bottom: 20px;
    padding: 10px 14px;
    background: var(--gold-glow);
    border-left: 3px solid var(--gold);
    border-radius: 0 8px 8px 0;
}

.options-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.opt-btn {
    width: 100%;
    padding: 14px 18px;
    background: var(--bg-card2);
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 15px;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
    transition: all var(--t);
    line-height: 1.4;
}

.opt-btn:hover:not(:disabled) {
    border-color: var(--blue);
    background: var(--blue-glow);
    transform: translateX(4px);
}

.opt-btn:disabled {
    cursor: default;
}

.opt-selected {
    border-color: var(--blue) !important;
    background: var(--blue-glow) !important;
    color: var(--blue) !important;
}

.opt-correct {
    border-color: var(--green) !important;
    background: rgba(16, 185, 129, 0.1) !important;
    color: var(--green) !important;
}

.opt-wrong {
    border-color: var(--red) !important;
    background: rgba(239, 68, 68, 0.08) !important;
    color: var(--red) !important;
}

/* ═══ TRANSITION ══════════════════════════════════════════ */
.transition-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
    text-align: center;
}

.transition-loader {
    width: 100%;
}

.brain-pulse {
    font-size: 56px;
    display: block;
    margin: 0 auto 20px;
    animation: brainPulse 1.2s ease infinite;
}

@keyframes brainPulse {

    0%,
    100% {
        transform: scale(1);
        filter: drop-shadow(0 0 0 rgba(59, 130, 246, 0));
    }

    50% {
        transform: scale(1.12);
        filter: drop-shadow(0 0 20px rgba(59, 130, 246, 0.6));
    }
}

.transition-loader h3 {
    font-size: 22px;
    font-weight: 800;
    margin-bottom: 12px;
}

.transition-tip {
    font-size: 14px;
    color: var(--text-sub);
    font-style: italic;
    margin-bottom: 28px;
    padding: 0 20px;
    line-height: 1.6;
}

.loading-bar-wrap {
    height: 6px;
    background: var(--bg-card2);
    border-radius: 6px;
    overflow: hidden;
    margin: 0 20px;
}

.loading-bar-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--blue), var(--gold));
    border-radius: 6px;
    transition: width 0.3s ease;
}

/* ═══ RESULTS ══════════════════════════════════════════ */
.results-screen {
    padding-top: 8px;
}

.result-header {
    text-align: center;
    padding: 28px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    margin-bottom: 16px;
}

.result-emoji {
    font-size: 52px;
    margin-bottom: 8px;
}

.result-iq {
    font-size: 72px;
    font-weight: 900;
    line-height: 1;
    letter-spacing: -3px;
    margin-bottom: 4px;
}

.result-iq-label {
    font-size: 14px;
    color: var(--text-sub);
    font-weight: 600;
    margin-bottom: 16px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.result-title {
    font-size: 24px;
    font-weight: 900;
    margin-bottom: 10px;
}

.result-label-badge {
    display: inline-block;
    font-size: 13px;
    font-weight: 700;
    padding: 5px 16px;
    border-radius: 20px;
    letter-spacing: 0.5px;
}

.result-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 12px;
}

.result-card h3 {
    font-size: 16px;
    font-weight: 800;
    margin-bottom: 10px;
}

.result-card p {
    font-size: 14px;
    color: var(--text-sub);
    line-height: 1.7;
}

.tip-card {
    border-color: rgba(245, 158, 11, 0.3);
    background: rgba(245, 158, 11, 0.05);
}

.tip-card h3 {
    color: var(--gold);
}

.strength-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.strength-list li {
    font-size: 14px;
    color: var(--text-sub);
    display: flex;
    align-items: center;
    gap: 8px;
}

.result-footer {
    text-align: center;
    padding: 20px;
    font-size: 13px;
    color: var(--text-dim);
    line-height: 1.6;
}

.disclaimer {
    font-size: 11px;
    margin-top: 6px;
    color: var(--text-dim);
    font-style: italic;
}

.retry-btn {
    margin-top: 16px;
    padding: 13px 28px;
    background: transparent;
    border: 1.5px solid var(--border-f);
    border-radius: var(--radius);
    color: var(--blue);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--t);
    width: 100%;
}

.retry-btn:hover {
    background: var(--blue-glow);
}

/* ═══ ADS ══════════════════════════════════════════ */
.ad-wrapper {
    margin: 16px 0;
    text-align: center;
}

.ad-label {
    font-size: 10px;
    font-weight: 700;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-bottom: 8px;
}

#ad-hero,
#ad-q-top,
#ad-q-bottom,
#ad-result-1,
#ad-result-2,
#ad-result-3 {
    width: 100%;
    min-height: 250px;
    height: 250px;
    max-width: 300px;
    margin: 0 auto;
    background: var(--bg-card2);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-dim);
    font-size: 12px;
    border: 1px dashed var(--border);
    /* Prevent layout shift */
    contain: layout style paint;
}

/* ═══ STICKY FOOTER AD ══════════════════════════════════════════════════ */
#sticky-ad-bar {
    position: fixed;
    bottom: 0;
    /* Use margin:auto instead of left:50%+translateX to avoid side-flash */
    left: 0;
    right: 0;
    margin: 0 auto;
    width: 100%;
    max-width: 480px;
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    padding: 8px 16px;
    z-index: 999;
    transition: transform 0.3s ease;
    transform: translateY(0);
    text-align: center;
}

#ad-sticky-inner {
    width: 100%;
    min-height: 50px;
    height: 50px;
    max-width: 320px;
    margin: 0 auto;
    /* Prevent layout shift */
    contain: layout style paint;
}

/* ═══ ANTI-BOUNCE NUDGE ══════════════════════════════════════════ */
#nudge-banner {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 32px);
    max-width: 448px;
    z-index: 1000;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        transform: translateX(-50%) translateY(20px);
        opacity: 0;
    }

    to {
        transform: translateX(-50%) translateY(0);
        opacity: 1;
    }
}

/* Modal uses its own animation — no translateX needed (flexbox centers it) */
@keyframes slideUpModal {
    from {
        transform: translateY(24px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.nudge-inner {
    background: var(--bg-card);
    border: 1px solid var(--border-f);
    border-radius: var(--radius);
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.nudge-inner span {
    font-size: 14px;
    font-weight: 600;
}

.nudge-inner button {
    white-space: nowrap;
    padding: 8px 14px;
    background: var(--blue);
    border: none;
    border-radius: 8px;
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}

/* ═══ FOOTER ══════════════════════════════════════════ */
.site-footer {
    text-align: center;
    padding: 16px;
    font-size: 12px;
    color: var(--text-dim);
    border-top: 1px solid var(--border);
}

.site-footer a {
    color: var(--text-dim);
    text-decoration: none;
    margin: 0 8px;
}

.site-footer a:hover {
    color: var(--blue);
}

/* ═══ LEGAL MODALS ══════════════════════════════════════════ */
.legal-modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    z-index: 9999;
    align-items: flex-end;
    justify-content: center;
    padding: 0;
}

.legal-modal-content {
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    padding: 24px;
    max-height: 80vh;
    overflow-y: auto;
    width: 100%;
    max-width: 480px;
    animation: slideUpModal 0.3s ease;
    /* separate animation — no side-flash */
}

.legal-modal-content h2 {
    font-size: 20px;
    font-weight: 800;
    margin-bottom: 4px;
}

.legal-modal-content .last-updated {
    font-size: 12px;
    color: var(--text-dim);
    margin-bottom: 20px;
}

.legal-modal-content h3 {
    font-size: 14px;
    font-weight: 700;
    margin: 16px 0 6px;
    color: var(--blue);
}

.legal-modal-content p {
    font-size: 13px;
    color: var(--text-sub);
    line-height: 1.7;
}

.modal-close {
    float: right;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-dim);
    background: none;
    border: none;
    line-height: 1;
}

/* ═══ PRELOADER ══════════════════════════════════════════ */
#preloader {
    position: fixed;
    inset: 0;
    background: var(--bg);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    transition: opacity 0.4s ease;
}

.preloader-logo {
    font-size: 28px;
    font-weight: 900;
    color: var(--text);
    margin-bottom: 20px;
}

.preloader-logo span {
    color: var(--blue);
}

.preloader-bar {
    width: 100px;
    height: 3px;
    background: var(--bg-card2);
    border-radius: 4px;
    overflow: hidden;
}

.preloader-bar::after {
    content: '';
    display: block;
    height: 100%;
    background: linear-gradient(90deg, var(--blue), var(--gold));
    animation: sweep 1.2s ease infinite;
}

@keyframes sweep {
    0% {
        transform: translateX(-100%);
    }

    100% {
        transform: translateX(200%);
    }
}

/* ═══ QUESTION LOADER (for ad loading) ══════════════════════════════════════════ */
#question-loader {
    position: fixed;
    inset: 0;
    background: rgba(11, 15, 26, 0.95);
    backdrop-filter: blur(8px);
    z-index: 9998;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

#question-loader.active {
    opacity: 1;
    pointer-events: all;
}

.question-loader-content {
    text-align: center;
    padding: 24px;
}

.loader-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--bg-card2);
    border-top-color: var(--blue);
    border-right-color: var(--gold);
    border-radius: 50%;
    margin: 0 auto 16px;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loader-text {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-sub);
    letter-spacing: 0.5px;
}

/* ═══ LARGE SCREENS ══════════════════════════════════════════ */
@media (min-width: 600px) {
    #root {
        border-left: 1px solid var(--border);
        border-right: 1px solid var(--border);
    }
}