/* Custom variables */
:root {
    --bg-dark: #090b0e;
    --bg-dark-gray: #12161f;
    --glass-bg: rgba(18, 22, 31, 0.65);
    --glass-border: rgba(255, 255, 255, 0.08);
    --text-primary: #f3f4f6;
    --text-secondary: #9ca3af;
    --accent: #f59e0b;
    --accent-hover: #d97706;
    --success: #10b981;
    --teal: #14b8a6;
    --font-sans: 'Inter', sans-serif;
    --font-display: 'Outfit', sans-serif;
    --transition-speed: 0.3s;
    --title-gradient-start: #ffffff;
    --text-disclaimer: rgba(156, 163, 175, 0.6);
    --text-copyright: rgba(156, 163, 175, 0.4);
}

/* Light theme overrides */
[data-theme="light"] {
    --bg-dark: #f3f4f6;
    --bg-dark-gray: #ffffff;
    --glass-bg: rgba(255, 255, 255, 0.75);
    --glass-border: rgba(0, 0, 0, 0.08);
    --text-primary: #111827;
    --text-secondary: #4b5563;
    --accent: #d97706;
    --accent-hover: #b45309;
    --teal: #0d9488;
    --title-gradient-start: var(--text-primary);
    --text-disclaimer: rgba(55, 65, 81, 0.9);
    --text-copyright: rgba(55, 65, 81, 0.7);
}

[data-theme="light"] .glow-bg-blob {
    opacity: 0.15;
}

[data-theme="light"] body::before {
    opacity: 0.22;
    filter: grayscale(20%) contrast(1.15) blur(1.5px);
}

[data-theme="light"] .option-card:hover {
    background: rgba(0, 0, 0, 0.02);
    border-color: rgba(0, 0, 0, 0.15);
}

[data-theme="light"] .option-card.selected {
    background: rgba(217, 119, 6, 0.08);
    border-color: var(--accent);
}

[data-theme="light"] .btn-secondary:hover {
    background: rgba(0, 0, 0, 0.03);
}

/* Reset & Basic styling */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-dark);
    font-family: var(--font-sans);
    color: var(--text-primary);
    overflow-x: hidden;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    position: relative;
    transition: background-color 0.4s ease, color 0.4s ease;
}

body::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-image: url('background.jpg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    opacity: 0.15;
    z-index: 0;
    pointer-events: none;
    filter: blur(1.5px);
}

/* Background glowing blobs */
.glow-bg-blob {
    position: absolute;
    width: 300px;
    height: 300px;
    border-radius: 50%;
    filter: blur(120px);
    z-index: 1;
    opacity: 0.4;
    pointer-events: none;
    animation: pulse-bg 10s infinite alternate ease-in-out;
}

.blob-1 {
    background-color: var(--accent);
    top: -50px;
    left: -100px;
}

.blob-2 {
    background-color: var(--teal);
    bottom: 50px;
    right: -100px;
    animation-delay: 3s;
}

@keyframes pulse-bg {
    0% { transform: scale(1) translate(0, 0); }
    100% { transform: scale(1.2) translate(30px, 40px); }
}

/* Base structural layout optimized for mobile */
.app-container {
    width: 100%;
    max-width: 600px;
    padding: 16px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    z-index: 2;
    position: relative;
}

.app-header {
    padding: 16px 0 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.theme-toggle-btn {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-speed) ease;
    padding: 0;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.theme-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    transform: scale(1.05);
}

[data-theme="light"] .theme-toggle-btn:hover {
    background: rgba(0, 0, 0, 0.04);
}

.theme-icon {
    width: 20px;
    height: 20px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 8px;
}

.brand-dot {
    width: 10px;
    height: 10px;
    background-color: var(--accent);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--accent);
}

.brand-text {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.1rem;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

/* Main content */
.app-main {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 24px;
}

.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 24px;
    width: 100%;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    transition: background-color 0.4s ease, border-color 0.4s ease, box-shadow 0.4s ease;
}

/* Screen states configuration */
.screen {
    display: none;
    width: 100%;
    opacity: 0;
    transform: translateY(15px);
    transition: opacity 0.4s ease-out, transform 0.4s ease-out;
}

.screen.show {
    display: block;
}

.screen.active {
    opacity: 1;
    transform: translateY(0);
}

/* Start screen / Hero styles */
.hero-title {
    font-family: var(--font-display);
    font-size: 1.85rem;
    font-weight: 800;
    line-height: 1.3;
    margin-bottom: 16px;
    text-align: center;
    background: linear-gradient(135deg, var(--title-gradient-start) 40%, var(--accent) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-desc {
    color: var(--text-secondary);
    font-size: 1rem;
    line-height: 1.6;
    margin-bottom: 32px;
    text-align: center;
}

.trust-indicators {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 12px 24px;
    margin-top: 32px;
    border-top: 1px solid var(--glass-border);
    padding-top: 24px;
}

.trust-item {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.icon {
    width: 18px;
    height: 18px;
}

/* Button UI */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-sans);
    font-size: 1rem;
    font-weight: 600;
    padding: 14px 28px;
    border-radius: 12px;
    border: none;
    cursor: pointer;
    transition: all var(--transition-speed) ease;
    width: 100%;
    gap: 8px;
}

.btn:focus, .option-card:focus, .footer-links a:focus {
    outline: none;
}

.btn:focus-visible, .option-card:focus-visible, .footer-links a:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 4px;
}

.btn-primary {
    background-color: var(--accent);
    color: #000;
}

.btn-primary:hover {
    background-color: var(--accent-hover);
    transform: translateY(-2px);
}

.btn-secondary {
    background-color: transparent;
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.05);
}

.btn-glow {
    box-shadow: 0 4px 20px rgba(245, 158, 11, 0.3);
}

.btn-glow:hover {
    box-shadow: 0 6px 24px rgba(245, 158, 11, 0.5);
}

/* Quiz styling */
.quiz-progress-container {
    margin-bottom: 24px;
}

.progress-bar-bg {
    width: 100%;
    height: 6px;
    background-color: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 12px;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--teal), var(--accent));
    border-radius: 3px;
    transition: width 0.4s ease;
}

.progress-stats {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.quiz-question {
    font-family: var(--font-display);
    font-size: 1.4rem;
    font-weight: 700;
    line-height: 1.4;
    margin-bottom: 24px;
}

.options-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    margin-bottom: 24px;
}

.option-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 0.95rem;
    line-height: 1.5;
    padding: 16px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    outline: none;
}

.option-card:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateX(4px);
}

.option-card.selected {
    background: rgba(245, 158, 11, 0.1);
    border-color: var(--accent);
    color: var(--accent);
}

/* Loader Styles */
.text-center {
    text-align: center;
}

.loader-card {
    padding: 48px 24px;
}

.loader-circle {
    position: relative;
    width: 80px;
    height: 80px;
    margin: 0 auto 32px;
}

.loader-ring {
    width: 100%;
    height: 100%;
    border: 4px solid rgba(255, 255, 255, 0.05);
    border-top: 4px solid var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.loader-pulse {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 48px;
    height: 48px;
    background-color: var(--accent);
    opacity: 0.15;
    border-radius: 50%;
    animation: pulse 1.5s infinite ease-in-out;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes pulse {
    0%, 100% { transform: translate(-50%, -50%) scale(0.8); opacity: 0.1; }
    50% { transform: translate(-50%, -50%) scale(1.2); opacity: 0.3; }
}

.loader-title {
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 12px;
}

.loader-subtitle {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Results Screen Styles */
.success-badge {
    display: flex;
    justify-content: center;
    color: var(--success);
    margin-bottom: 16px;
}

.success-badge .icon {
    width: 48px;
    height: 48px;
}

.results-category {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--accent);
    display: block;
    text-align: center;
    margin-bottom: 8px;
}

.results-archetype {
    font-family: var(--font-display);
    font-size: 1.8rem;
    font-weight: 800;
    text-align: center;
    margin-bottom: 24px;
}

.results-data-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 24px;
}

.data-item {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--glass-border);
    padding: 12px;
    border-radius: 12px;
    text-align: center;
}

.data-label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.data-val {
    font-family: var(--font-display);
    font-size: 1.15rem;
    font-weight: 700;
}

.glow-text-teal {
    color: var(--teal);
    text-shadow: 0 0 8px rgba(20, 184, 166, 0.5);
}

.results-text-block {
    margin-bottom: 32px;
}

.results-p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 16px;
}

.results-p-highlight {
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--text-primary);
    border-left: 3px solid var(--accent);
    padding-left: 16px;
    margin-top: 16px;
    font-weight: 500;
}

/* Footer Section */
.app-footer {
    padding: 24px 0 16px;
    text-align: center;
    border-top: 1px solid var(--glass-border);
    margin-top: auto;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-bottom: 16px;
}

.footer-links a {
    color: var(--text-secondary);
    font-size: 0.8rem;
    text-decoration: none;
    transition: color var(--transition-speed) ease;
}

.footer-links a:hover {
    color: var(--text-primary);
}

.disclaimer {
    font-size: 0.7rem;
    color: var(--text-disclaimer);
    line-height: 1.4;
    margin-bottom: 12px;
}

.copyright {
    font-size: 0.7rem;
    color: var(--text-copyright);
}

/* Media Query for Large Screens Progressive Scaling (Responsive Desktop adaptation) */
@media (min-width: 768px) {
    .app-container {
        max-width: 680px;
        padding: 32px;
    }
    
    .glass-panel {
        padding: 36px;
    }

    .hero-title {
        font-size: 2.2rem;
    }

    .quiz-question {
        font-size: 1.6rem;
    }

    .results-archetype {
        font-size: 2.1rem;
    }
    
    .glow-bg-blob {
        width: 450px;
        height: 450px;
    }
}

/* Media Query for Small Viewports (optimizing for 320px - 375px screens) */
@media (max-width: 375px) {
    .app-container {
        padding: 12px;
    }
    
    .glass-panel {
        padding: 18px;
    }

    .hero-title {
        font-size: 1.55rem;
    }

    .hero-desc {
        font-size: 0.95rem;
        margin-bottom: 24px;
    }

    .quiz-question {
        font-size: 1.2rem;
        margin-bottom: 20px;
    }

    .results-archetype {
        font-size: 1.55rem;
        margin-bottom: 20px;
    }

    .trust-indicators {
        gap: 16px;
    }
}
