:root {
    /* Dark Theme */
    --bg-dark: #0a0a1a;
    --bg-card: #141428;
    --bg-card-hover: #1e1e3a;
    --bg-input: #0f0f20;

    /* Primary - Education Green/Blue */
    --primary: #10b981;
    --primary-light: #34d399;
    --primary-glow: rgba(16, 185, 129, 0.4);
    --secondary: #6366f1;

    /* Category colors */
    --cat-math: #f59e0b;
    --cat-kanji: #ef4444;
    --cat-typing: #8b5cf6;
    --cat-history: #06b6d4;
    --cat-quiz: #ec4899;

    /* Text */
    --text: #f1f5f9;
    --text-muted: #94a3b8;
    --text-dim: #64748b;

    /* Borders & Effects */
    --border: #2d2d4a;
    --success: #22c55e;
    --error: #ef4444;
    --warning: #f59e0b;

    /* Radius */
    --radius: 16px;
    --radius-sm: 10px;
    --radius-lg: 24px;

    /* Shadows */
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.4);
    --shadow-glow: 0 0 30px var(--primary-glow);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-dark);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    background-image:
        radial-gradient(ellipse at 50% 0%, rgba(16, 185, 129, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 100% 0%, rgba(99, 102, 241, 0.05) 0%, transparent 40%),
        radial-gradient(ellipse at 0% 100%, rgba(245, 158, 11, 0.05) 0%, transparent 40%);
}

/* ==================== HEADER ==================== */
.header {
    background: rgba(10, 10, 26, 0.9);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    padding: 0.875rem 2rem;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-inner {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    text-decoration: none;
    color: var(--text);
}

.logo:hover .logo-icon {
    transform: scale(1.05);
    box-shadow: var(--shadow-glow);
}

.logo-icon {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1.25rem;
    transition: all 0.3s ease;
}

.logo-text {
    font-size: 1.125rem;
    font-weight: 700;
}

.logo-text span {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav-links {
    display: flex;
    gap: 1.5rem;
}

.nav-links a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: color 0.2s;
}

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

/* ==================== HERO ==================== */
.hero {
    text-align: center;
    padding: 4rem 2rem 3rem;
    max-width: 800px;
    margin: 0 auto;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.15) 0%, rgba(99, 102, 241, 0.15) 100%);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: var(--primary-light);
    padding: 0.5rem 1rem;
    border-radius: 50px;
    font-size: 0.8125rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
}

.hero-title {
    font-size: clamp(2rem, 5vw, 3rem);
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: 1rem;
}

.hero-title .highlight {
    background: linear-gradient(135deg, var(--primary) 0%, var(--cat-math) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

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

/* ==================== CATEGORY GRID ==================== */
.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    padding: 0 2rem;
    max-width: 1400px;
    margin: 0 auto 3rem;
}

.category-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    text-decoration: none;
    color: var(--text);
    transition: all 0.3s ease;
}

.category-card:hover {
    transform: translateY(-4px);
    border-color: var(--primary);
    box-shadow: var(--shadow-glow);
}

.category-card-header {
    padding: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.category-card-header.math {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.2) 0%, rgba(245, 158, 11, 0.05) 100%);
}

.category-card-header.kanji {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.2) 0%, rgba(239, 68, 68, 0.05) 100%);
}

.category-card-header.typing {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.2) 0%, rgba(139, 92, 246, 0.05) 100%);
}

.category-card-header.history {
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.2) 0%, rgba(6, 182, 212, 0.05) 100%);
}

.category-card-header.quiz {
    background: linear-gradient(135deg, rgba(236, 72, 153, 0.2) 0%, rgba(236, 72, 153, 0.05) 100%);
}

.category-icon {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    background: rgba(255, 255, 255, 0.1);
}

.category-card-body {
    padding: 1.25rem 1.5rem 1.5rem;
}

.category-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.category-title svg {
    width: 20px;
    height: 20px;
    color: var(--text-muted);
}

.category-desc {
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* ==================== GAME CONTAINER ==================== */
.game-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem;
}

.game-header {
    text-align: center;
    margin-bottom: 2rem;
}

.game-title {
    font-size: 1.75rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
}

.game-stats {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin: 1.5rem 0;
}

.stat-item {
    text-align: center;
}

.stat-value {
    font-size: 2rem;
    font-weight: 800;
    color: var(--primary);
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

.game-area {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    text-align: center;
}

.question {
    font-size: 3rem;
    font-weight: 800;
    margin-bottom: 2rem;
}

.answer-input {
    width: 200px;
    padding: 1rem;
    font-size: 2rem;
    text-align: center;
    background: var(--bg-input);
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    outline: none;
    transition: border-color 0.2s;
}

.answer-input:focus {
    border-color: var(--primary);
}

.answer-input.correct {
    border-color: var(--success);
    background: rgba(34, 197, 94, 0.1);
}

.answer-input.incorrect {
    border-color: var(--error);
    background: rgba(239, 68, 68, 0.1);
}

/* ==================== BUTTONS ==================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.875rem 1.5rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.9375rem;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
}

.btn-secondary {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text);
}

.btn-secondary:hover {
    border-color: var(--primary);
}

.btn-lg {
    padding: 1rem 2rem;
    font-size: 1.125rem;
}

/* ==================== PROGRESS BAR ==================== */
.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--bg-input);
    border-radius: 4px;
    overflow: hidden;
    margin: 1rem 0;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary) 0%, var(--primary-light) 100%);
    border-radius: 4px;
    transition: width 0.3s ease;
}

/* ==================== TIMER ==================== */
.timer {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-muted);
}

.timer.warning {
    color: var(--warning);
}

.timer.danger {
    color: var(--error);
}

/* ==================== RESULT SCREEN ==================== */
.result-screen {
    text-align: center;
    padding: 3rem 2rem;
}

.result-score {
    font-size: 5rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary) 0%, var(--cat-math) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.result-label {
    font-size: 1.25rem;
    color: var(--text-muted);
    margin-bottom: 2rem;
}

.result-details {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    margin: 2rem 0;
}

.result-item {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 1rem;
}

.result-item-value {
    font-size: 1.5rem;
    font-weight: 700;
}

.result-item-label {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ==================== BADGE ==================== */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.75rem;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-new {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: white;
}

.badge-popular {
    background: linear-gradient(135deg, var(--cat-math) 0%, #fbbf24 100%);
    color: #1a1a2e;
}

/* ==================== FOOTER ==================== */
.footer {
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    padding: 3rem 2rem;
    margin-top: 4rem;
}

.footer-inner {
    max-width: 1400px;
    margin: 0 auto;
    text-align: center;
}

.footer-brand {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.footer-tagline {
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-bottom: 1.5rem;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-bottom: 1.5rem;
}

.footer-links a {
    color: var(--text-dim);
    text-decoration: none;
    font-size: 0.8125rem;
    transition: color 0.2s;
}

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

.footer-copy {
    color: var(--text-dim);
    font-size: 0.75rem;
}

/* ==================== AD SPACE ==================== */
.ad-space {
    background: var(--bg-card);
    border: 1px dashed var(--border);
    border-radius: var(--radius-sm);
    padding: 1.5rem;
    text-align: center;
    margin: 1.5rem 0;
}

.ad-space-label {
    color: var(--text-dim);
    font-size: 0.75rem;
    text-transform: uppercase;
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 768px) {
    .header {
        padding: 0.75rem 1rem;
    }

    .hero {
        padding: 2rem 1rem;
    }

    .category-grid {
        padding: 0 1rem;
        gap: 1rem;
    }

    .game-container {
        padding: 1rem;
    }

    .game-stats {
        gap: 1rem;
    }

    .result-details {
        grid-template-columns: 1fr;
    }

    .footer-links {
        flex-wrap: wrap;
        gap: 1rem;
    }
}