/* Base styling & Variables */
:root {
    /* Light Mode Palette (Default) */
    --bg-color: #f4f6f9;
    --text-color: #1a1a2e;
    --text-muted: #666;
    --card-bg: rgba(255, 255, 255, 0.7);
    --card-border: rgba(255, 255, 255, 0.5);
    --primary-color: #3b82f6;
    --primary-hover: #2563eb;
    --secondary-color: #e2e8f0;
    --secondary-hover: #cbd5e1;
    --accent-glow: rgba(59, 130, 246, 0.2);
    --shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.07);
    --cookie-bg: #1a1a2e;
    --cookie-text: #ffffff;
}

body.dark-mode {
    /* Dark Mode Palette */
    --bg-color: #0f172a;
    --text-color: #f8fafc;
    --text-muted: #94a3b8;
    --card-bg: rgba(30, 41, 59, 0.6);
    --card-border: rgba(255, 255, 255, 0.1);
    --primary-color: #60a5fa;
    --primary-hover: #3b82f6;
    --secondary-color: #334155;
    --secondary-hover: #475569;
    --accent-glow: rgba(96, 165, 250, 0.15);
    --shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
    --cookie-bg: #ffffff;
    --cookie-text: #0f172a;
}

/* Typography fallback */
@font-face {
    font-family: 'Outfit';
    src: url('fonts/outfit.woff2') format('woff2');
    font-weight: 100 900;
    font-display: swap;
}

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

body {
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    transition: background-color 0.4s ease, color 0.4s ease;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Header */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.language-selector {
    padding: 0.4rem;
    font-size: 0.9rem;
    font-family: inherit;
    font-weight: 500;
    color: var(--text-color);
    background-color: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    cursor: pointer;
    outline: none;
    transition: all 0.2s ease;
}

.language-selector:hover {
    border-color: var(--primary-color);
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo-img {
    height: 40px;
    width: auto;
    border-radius: 8px;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, var(--primary-color), #8b5cf6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

#theme-toggle {
    background: none;
    border: none;
    color: var(--text-color);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s ease;
}

#theme-toggle:hover {
    background-color: var(--secondary-color);
}

/* Main Container */
.container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

/* Glassmorphism Card */
.card.glass {
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--card-border);
    border-radius: 24px;
    padding: 3rem;
    max-width: 600px;
    width: 100%;
    box-shadow: var(--shadow);
    text-align: center;
    position: relative;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card.glass::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, var(--accent-glow) 0%, transparent 70%);
    z-index: -1;
    pointer-events: none;
}

/* Typography in Cards */
.card h1 {
    font-size: 2rem;
    margin-bottom: 1rem;
    font-weight: 700;
}

.card p {
    font-size: 1.125rem;
    color: var(--text-muted);
    margin-bottom: 2rem;
}

.question-text {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 2.5rem;
    line-height: 1.4;
}

.result-title {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, var(--primary-color), #8b5cf6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.result-emoji {
    font-size: 4rem;
    margin-bottom: 1rem;
    display: block;
}

/* Buttons */
.btn-group {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.btn {
    padding: 1rem 2rem;
    font-size: 1.125rem;
    font-weight: 600;
    font-family: inherit;
    border-radius: 12px;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
}

.btn.primary {
    background-color: var(--primary-color);
    color: #fff;
    box-shadow: 0 4px 14px 0 var(--accent-glow);
}

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

.btn.secondary {
    background-color: var(--secondary-color);
    color: var(--text-color);
}

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

.btn.full-width {
    width: 100%;
}

/* Action Wrapper for Centering */
.actions-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
}

.actions-left, .actions-right {
    flex: 1;
    display: flex;
}

.actions-left {
    justify-content: flex-end;
    padding-right: 1rem;
}

.back-btn-small {
    padding: 0.3rem 0.75rem;
    font-size: 0.75rem;
    font-family: inherit;
    font-weight: 600;
    background: transparent;
    border: 1px solid #64748b; /* Darker gray border */
    border-radius: 8px;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.back-btn-small:hover {
    background-color: var(--secondary-color);
    color: var(--text-color);
    transform: translateY(-2px);
}

/* Animations */
.fade-enter {
    opacity: 0;
    transform: translateY(10px);
}
.fade-enter-active {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.4s ease, transform 0.4s ease;
}
.fade-exit {
    opacity: 1;
    transform: translateY(0);
}
.fade-exit-active {
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

/* Content Layout for Ads and Quiz */
.content-wrapper {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    justify-content: center;
    gap: 5rem;
    padding: 0 2rem;
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
}

/* Main Container Override */
.container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    max-width: 600px;
}

/* Ad Placeholders */
.ad-placeholder {
    width: 160px; /* Wide Skyscraper width */
    height: 600px; /* Standard Half-Page/Skyscraper height */
    background-color: var(--secondary-color);
    border: 1px dashed var(--text-muted);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-size: 0.875rem;
    flex-shrink: 0;
}

/* SEO Section */
.seo-section {
    max-width: 800px;
    margin: 1rem auto 2rem auto;
    padding: 0 2rem 3rem 2rem;
    text-align: center;
    color: var(--text-color);
}

.seo-section h2 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: var(--text-color);
}

.seo-section p {
    font-size: 1rem;
    color: var(--text-muted);
    line-height: 1.6;
}

/* Footer */
footer {
    text-align: center;
    padding: 2rem;
    margin-top: auto;
    border-top: 1px solid var(--card-border);
}

footer a {
    color: var(--text-muted);
    text-decoration: none;
    margin: 0 1rem;
    font-size: 0.875rem;
    transition: color 0.2s ease;
}

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

/* Legal Pages Styling */
.legal-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem;
    width: 100%;
}

.legal-container {
    width: 100%;
    margin: 1.5rem 0;
    padding: 2.5rem;
    background: var(--card-bg);
    border-radius: 12px;
    border: 1px solid var(--card-border);
}

.legal-container h1, .legal-container h2 {
    color: var(--text-color);
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
}

.legal-container p, .legal-container li {
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.legal-container a {
    color: var(--primary-color);
    text-decoration: none;
}

.legal-container a:hover {
    text-decoration: underline;
}

/* Responsive */
@media (max-width: 1200px) {
    .content-wrapper {
        flex-direction: column;
        align-items: center;
    }
    
    .ad-placeholder {
        width: 100%;
        max-width: 728px;
        height: 90px; /* Standard Leaderboard height */
        margin: 1rem 0;
    }

    .card.glass {
        padding: 2rem;
        margin: 1rem 0;
    }
    
    .btn-group {
        flex-direction: column;
        order: 1;
    }
    
    .actions-wrapper {
        flex-direction: column;
    }
    
    .actions-left {
        order: 2;
        justify-content: center;
        padding-right: 0;
        margin-top: 1.5rem;
        margin-bottom: 0;
        width: 100%;
    }
    
    .actions-right {
        display: none;
    }
    
    .logo {
        font-size: 1.25rem;
    }
    .logo-img {
        height: 32px;
    }
    header {
        padding: 1rem;
    }
}
