:root {
    --bg-color: #f0f2f5;
    --surface-color: #ffffff;
    --primary-color: #e63946;
    /* Red for Catalan feeling */
    --primary-glow: #e6394640;
    --accent-color: #f1faee;
    --accent-text: #1d3557;
    --text-color: #1d1d1f;
    --text-secondary: #86868b;
    --error-color: #d00000;
    --success-color: #2a9d8f;
    --gold: #fca311;

    --font-main: 'Outfit', sans-serif;
    --radius-lg: 24px;
    --radius-md: 12px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: var(--font-main);
    display: flex;
    justify-content: center;
    /* align-items: center; Remove to allow scrolling landing page */ 
    min-height: 100vh;
    overflow-x: hidden;
}

/* Landing Page Wrapper */
.landing-container {
    width: 100%;
    background-color: var(--bg-color);
    display: flex;
    flex-direction: column;
}

.auth-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

.logo-small {
    font-weight: 800;
    font-size: 1.5rem;
    color: var(--primary-color);
}

/* Hero Section */
.hero-section {
    text-align: center;
    padding: 3rem 1rem;
    background: linear-gradient(180deg, rgba(230,57,70,0.05) 0%, rgba(255,255,255,0) 100%);
}

.hero-title {
    font-size: 3rem;
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: 1rem;
    color: var(--text-color);
}

.hero-title span {
    color: var(--primary-color);
}

.hero-subtitle {
    font-size: 1.25rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

/* Categories Grid */
.categories-section {
    max-width: 1200px;
    margin: 3rem auto;
    padding: 0 1rem;
    text-align: center;
}

.section-title {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 2rem;
}

.categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1rem;
}

.category-card {
    background: var(--surface-color);
    padding: 1.5rem;
    border-radius: var(--radius-md);
    box-shadow: 0 5px 20px rgba(0,0,0,0.05);
    transition: transform 0.2s;
    border-top: 5px solid #ccc; /* default */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.category-card:hover {
    transform: translateY(-5px);
}

.category-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.category-name {
    font-weight: 700;
    font-size: 1rem;
}

/* How it Works */
.steps-section {
    background: var(--surface-color);
    padding: 4rem 1rem;
    text-align: center;
    margin-top: 3rem;
}

.steps-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
    max-width: 1000px;
    margin: 3rem auto 0;
}

.step-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.step-number {
    width: 40px;
    height: 40px;
    background: var(--primary-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    margin-bottom: 1rem;
}

/* Trial Game Modal/Section */
.trial-modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 1rem;
}

.trial-content {
    background: var(--bg-color);
    width: 100%;
    max-width: 500px;
    border-radius: var(--radius-lg);
    padding: 2rem;
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
}

.close-trial {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #999;
}

.trial-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    color: #666;
    font-weight: 700;
}

.trial-question {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    text-align: center;
}

.trial-category-tag {
    background: #e0e0e0;
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    margin-bottom: 1.5rem;
    text-align: center;
    margin-left: auto;
    margin-right: auto;
    display: table; /* Center trick */
}

/* Footer */
.footer {
    background: #222;
    color: white;
    padding: 3rem 1rem;
    text-align: center;
    margin-top: auto;
}

.footer-content {
    max-width: 800px;
    margin: 0 auto;
}

.footer h3 {
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.footer p {
    color: #aaa;
    line-height: 1.6;
    margin-bottom: 1rem;
}

/* App Container Override */
.app-container {
    width: 100%;
    max-width: 480px;
    /* Mobile first standard width */
    min-height: 100vh;
    background-color: var(--bg-color); /* Kept original */
    /* position: relative; */ /* Removed to fix stacking contexts if needed */
    display: flex;
    flex-direction: column;
    margin: 0 auto; /* Center it */
}

/* Original App Styles (Merged/Adapted) */
/* Utils */
.hidden {
    display: none !important;
}

.btn {
    background: linear-gradient(135deg, var(--primary-color), #ff6b6b);
    color: white;
    border: none;
    padding: 16px 32px;
    border-radius: var(--radius-md);
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 15px var(--primary-glow);
    transition: transform 0.2s, box-shadow 0.2s;
    width: 100%;
    margin-top: 1rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn-small {
    padding: 10px 20px;
    font-size: 0.9rem;
    margin-top: 0;
    width: auto;
}

.btn:active {
    transform: scale(0.98);
}

.btn-secondary {
    background: transparent;
    border: 2px solid #ddd;
    box-shadow: none;
    color: var(--text-color);
    cursor: pointer;
    border-radius: var(--radius-md);
    padding: 14px 28px;
    font-weight: 700;
}

input,
select {
    background-color: #f8f9fa;
    border: 1px solid #ddd;
    color: var(--text-color);
    padding: 14px;
    border-radius: var(--radius-md);
    width: 100%;
    font-family: var(--font-main);
    font-size: 1rem;
    margin-bottom: 1rem;
    outline: none;
    transition: border-color 0.3s;
}

input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 10px var(--primary-glow);
    background-color: white;
}

/* Views */
.view {
    padding: 2rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    animation: fadeIn 0.4s ease-out;
}

.auth-card {
    background: var(--surface-color);
    border-radius: var(--radius-lg);
    padding: 2.5rem;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

h1,h2 {
    margin-bottom: 1rem;
    text-align: center;
    color: var(--text-color);
}

.logo {
    font-size: 2.5rem;
    font-weight: 800;
    text-align: center;
    margin-bottom: 2rem;
    color: var(--primary-color);
    letter-spacing: -1px;
}

/* Game Interface */
.timer-bar {
    width: 100%;
    height: 8px;
    background: #e0e0e0;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 100;
}

.timer-fill {
    height: 100%;
    background: var(--primary-color);
    width: 100%;
}

.question-card {
    background: var(--surface-color);
    padding: 2.5rem;
    border-radius: var(--radius-lg);
    margin-bottom: 2rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.05);
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-color);
}

.options-grid {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.option-btn {
    background: #ffffff;
    padding: 22px;
    border-radius: var(--radius-md);
    text-align: left;
    cursor: pointer;
    border: 2px solid #eef0f2;
    transition: all 0.2s;
    font-size: 1.1rem;
    color: var(--text-color);
    font-weight: 500;
}

.option-btn:hover {
    background: #f8f9fa;
    border-color: var(--text-secondary);
    transform: translateY(-2px);
}

.option-btn.selected {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.option-btn.correct {
    background: var(--success-color);
    border-color: var(--success-color);
    color: white;
}

.option-btn.wrong {
    background: var(--error-color);
    border-color: var(--error-color);
    color: white;
}

/* Results */
.score-big {
    font-size: 5rem;
    font-weight: 800;
    color: var(--primary-color);
    text-align: center;
    margin: 2rem 0;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Loading */
.loading-screen {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--bg-color);
    z-index: 1000;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #333;
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

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

/* Responsive */
@media (max-width: 768px) {
    .hero-title {
        font-size: 2.2rem;
    }
    
    .steps-grid {
        grid-template-columns: 1fr;
        gap: 3rem;
    }
    
    .categories-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}