/* ===== Reset & Base ===== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --primary: #4f46e5;
    --primary-light: #818cf8;
    --primary-dark: #3730a3;
    --accent: #f59e0b;
    --bg: #f1f5f9;
    --card-bg: #ffffff;
    --text: #1e293b;
    --text-light: #64748b;
    --radius: 16px;
    --shadow: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.1);
    --shadow-lg: 0 20px 25px -5px rgba(0,0,0,0.1), 0 8px 10px -6px rgba(0,0,0,0.1);
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.6;
}

/* ===== Header ===== */
.site-header {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    padding: 0.75rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 10px rgba(79,70,229,0.3);
}

.site-header .logo {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.site-header .logo a {
    color: white;
    text-decoration: none;
}

.site-header nav a {
    color: rgba(255,255,255,0.85);
    text-decoration: none;
    margin-left: 1.5rem;
    font-weight: 500;
    transition: color 0.2s;
}

.site-header nav a:hover {
    color: white;
}

/* ===== Container ===== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

.page-title {
    text-align: center;
    font-size: 2.25rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.page-subtitle {
    text-align: center;
    color: var(--text-light);
    font-size: 1.1rem;
    margin-bottom: 2.5rem;
}

/* ===== Game Grid ===== */
.game-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1.5rem;
}

.game-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 2rem 1.5rem;
    text-decoration: none;
    color: var(--text);
    box-shadow: var(--shadow);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    border: 2px solid transparent;
    position: relative;
    overflow: hidden;
}

.game-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 5px;
    background: linear-gradient(90deg, var(--primary-light), var(--accent));
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.game-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-light);
}

.game-card:hover::before {
    transform: scaleX(1);
}

.game-icon {
    font-size: 3.5rem;
    margin-bottom: 1rem;
    transition: transform 0.3s ease;
}

.game-card:hover .game-icon {
    transform: scale(1.15) rotate(-5deg);
}

.game-card h2 {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--primary-dark);
}

.game-card p {
    font-size: 0.9rem;
    color: var(--text-light);
    margin-bottom: 1rem;
    flex-grow: 1;
}

.game-level {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: var(--bg);
    color: var(--primary);
}

/* ===== Footer ===== */
.site-footer {
    text-align: center;
    padding: 1.5rem;
    color: var(--text-light);
    font-size: 0.875rem;
}

/* ===== Game Pages (shared) ===== */
.game-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    margin-bottom: 1.5rem;
    transition: color 0.2s;
}

.back-link:hover {
    color: var(--primary-dark);
}

.game-box {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 2rem;
    box-shadow: var(--shadow);
    margin-bottom: 1.5rem;
}

.game-box h1 {
    font-size: 1.75rem;
    margin-bottom: 1.5rem;
    color: var(--primary-dark);
    text-align: center;
}

.score-display {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-bottom: 1rem;
    font-weight: 700;
    font-size: 1.1rem;
}

.score-display .score {
    color: #22c55e;
}

.score-display .wrong {
    color: #ef4444;
}

.btn {
    display: inline-block;
    padding: 0.75rem 2rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: scale(1.03);
}

.btn-success {
    background: #22c55e;
    color: white;
}

.btn-success:hover {
    background: #16a34a;
}

.btn-danger {
    background: #ef4444;
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
}

.btn-outline:hover {
    background: var(--primary);
    color: white;
}

.option-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    margin-top: 1rem;
}

.option-btn {
    padding: 1rem;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    background: white;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
}

.option-btn:hover {
    border-color: var(--primary-light);
    background: #eef2ff;
}

.option-btn.correct {
    border-color: #22c55e;
    background: #f0fdf4;
    color: #16a34a;
}

.option-btn.wrong {
    border-color: #ef4444;
    background: #fef2f2;
    color: #dc2626;
}

.feedback {
    text-align: center;
    padding: 1rem;
    border-radius: 8px;
    margin-top: 1rem;
    font-weight: 600;
}

.feedback.correct {
    background: #f0fdf4;
    color: #16a34a;
}

.feedback.wrong {
    background: #fef2f2;
    color: #dc2626;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .game-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 1rem;
    }

    .page-title {
        font-size: 1.75rem;
    }

    .option-grid {
        grid-template-columns: 1fr;
    }

    .container {
        padding: 1rem;
    }
}

@media (max-width: 480px) {
    .game-grid {
        grid-template-columns: 1fr 1fr;
        gap: 0.75rem;
    }

    .game-card {
        padding: 1.25rem 1rem;
    }

    .game-icon {
        font-size: 2.5rem;
    }

    .game-card h2 {
        font-size: 1rem;
    }
}
