/* MathSpark - CSS Variables & Base Styles */
:root {
    --primary: #F59E0B;
    --primary-dark: #D97706;
    --secondary: #0EA5E9;
    --secondary-dark: #0284C7;
    --accent: #10B981;
    --dark: #1E293B;
    --light-bg: #FFFBEB;
    --card-bg: #FFFFFF;
    --text: #334155;
    --text-light: #64748B;
    --border: #E2E8F0;
    --shadow: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
    --radius: 12px;
    --radius-sm: 8px;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--light-bg);
    color: var(--text);
    line-height: 1.6;
    font-size: 16px;
    min-height: 100vh;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Poppins', sans-serif;
    font-weight: 700;
    color: var(--dark);
    line-height: 1.2;
}

a {
    text-decoration: none;
    color: inherit;
    transition: color 0.3s ease;
}

img {
    max-width: 100%;
    height: auto;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Navigation */
.navbar {
    position: sticky;
    top: 0;
    background: var(--card-bg);
    box-shadow: var(--shadow);
    z-index: 1000;
    padding: 15px 0;
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: 'Poppins', sans-serif;
    font-weight: 700;
    font-size: 1.5rem;
    color: var(--primary);
}

.logo svg {
    width: 40px;
    height: 40px;
}

.nav-links {
    display: flex;
    gap: 30px;
    list-style: none;
}

.nav-links a {
    font-weight: 500;
    color: var(--dark);
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    transition: all 0.3s ease;
}

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

.nav-links a.active {
    background: var(--primary);
    color: white;
}

.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 10px;
}

.mobile-menu-btn span {
    display: block;
    width: 25px;
    height: 3px;
    background: var(--dark);
    margin: 5px 0;
    border-radius: 2px;
    transition: all 0.3s ease;
}

@media (max-width: 768px) {
    .mobile-menu-btn {
        display: block;
    }
    
    .nav-links {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--card-bg);
        flex-direction: column;
        padding: 20px;
        gap: 10px;
        box-shadow: var(--shadow);
        display: none;
    }
    
    .nav-links.active {
        display: flex;
    }
}

/* Hero Section */
.hero {
    padding: 80px 0;
    background: linear-gradient(135deg, var(--light-bg) 0%, #FEF3C7 100%);
    position: relative;
    overflow: hidden;
}

.hero-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 60px;
    align-items: center;
}

.hero h1 {
    font-size: 3.5rem;
    margin-bottom: 20px;
    color: var(--dark);
}

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

.hero p {
    font-size: 1.25rem;
    color: var(--text-light);
    margin-bottom: 30px;
}

.hero-buttons {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.hero-visual {
    position: relative;
    height: 400px;
}

.floating-shape {
    position: absolute;
    border-radius: 50%;
    animation: float 6s ease-in-out infinite;
}

.shape-1 {
    width: 120px;
    height: 120px;
    background: var(--primary);
    top: 20%;
    left: 20%;
    animation-delay: 0s;
}

.shape-2 {
    width: 80px;
    height: 80px;
    background: var(--secondary);
    top: 50%;
    right: 20%;
    animation-delay: 1s;
}

.shape-3 {
    width: 60px;
    height: 60px;
    background: var(--accent);
    bottom: 20%;
    left: 30%;
    animation-delay: 2s;
}

.shape-4 {
    width: 100px;
    height: 100px;
    background: #8B5CF6;
    top: 10%;
    right: 30%;
    animation-delay: 3s;
}

@keyframes float {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-20px) rotate(10deg); }
}

@media (max-width: 968px) {
    .hero-content {
        grid-template-columns: 1fr;
        text-align: center;
    }
    
    .hero h1 {
        font-size: 2.5rem;
    }
    
    .hero-buttons {
        justify-content: center;
    }
    
    .hero-visual {
        height: 300px;
    }
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 14px 28px;
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    border: none;
    transition: all 0.3s ease;
}

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

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

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

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

.btn-outline {
    background: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
}

.btn-outline:hover {
    background: var(--primary);
    color: white;
}

/* Section Styles */
.section {
    padding: 80px 0;
}

.section-header {
    text-align: center;
    margin-bottom: 50px;
}

.section-header h2 {
    font-size: 2.5rem;
    margin-bottom: 15px;
}

.section-header p {
    color: var(--text-light);
    font-size: 1.1rem;
    max-width: 600px;
    margin: 0 auto;
}

/* Game Cards Grid */
.games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 25px;
}

.game-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 25px;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.game-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.game-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: var(--primary);
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.game-card:hover::before {
    transform: scaleX(1);
}

.game-icon {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 15px;
    font-size: 1.8rem;
}

.game-card h3 {
    font-size: 1.2rem;
    margin-bottom: 8px;
}

.game-card p {
    color: var(--text-light);
    font-size: 0.9rem;
    margin-bottom: 12px;
}

.game-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.difficulty {
    font-family: 'Patrick Hand', cursive;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
}

.difficulty-easy {
    background: #D1FAE5;
    color: #065F46;
}

.difficulty-medium {
    background: #FEF3C7;
    color: #92400E;
}

.difficulty-hard {
    background: #FEE2E2;
    color: #991B1B;
}

.category-tag {
    font-family: 'Patrick Hand', cursive;
    color: var(--secondary);
    font-size: 0.85rem;
}

/* Article Cards */
.article-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
}

.article-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.article-card img {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.article-content {
    padding: 20px;
}

.article-meta {
    display: flex;
    gap: 15px;
    margin-bottom: 10px;
    font-size: 0.85rem;
    color: var(--text-light);
}

.article-category {
    background: var(--secondary);
    color: white;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
}

.article-card h3 {
    font-size: 1.2rem;
    margin-bottom: 10px;
    transition: color 0.3s ease;
}

.article-card:hover h3 {
    color: var(--primary);
}

.article-card p {
    color: var(--text-light);
    font-size: 0.95rem;
}

/* Stats Section */
.stats {
    background: var(--dark);
    padding: 60px 0;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 30px;
    text-align: center;
}

.stat-item h3 {
    font-size: 3rem;
    color: var(--primary);
    margin-bottom: 5px;
}

.stat-item p {
    color: #94A3B8;
    font-size: 1rem;
}

@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Newsletter Section */
.newsletter {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    padding: 80px 0;
    text-align: center;
    color: white;
}

.newsletter h2 {
    color: white;
    margin-bottom: 15px;
}

.newsletter p {
    margin-bottom: 30px;
    opacity: 0.9;
}

.newsletter-form {
    display: flex;
    gap: 15px;
    max-width: 500px;
    margin: 0 auto;
    flex-wrap: wrap;
    justify-content: center;
}

.newsletter-form input {
    flex: 1;
    min-width: 250px;
    padding: 14px 20px;
    border: none;
    border-radius: var(--radius);
    font-size: 1rem;
}

.newsletter-form button {
    background: var(--dark);
    color: white;
    padding: 14px 30px;
    border: none;
    border-radius: var(--radius);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.newsletter-form button:hover {
    background: #0F172A;
    transform: scale(1.05);
}

/* Footer */
.footer {
    background: var(--dark);
    color: #94A3B8;
    padding: 60px 0 30px;
}

.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 40px;
    margin-bottom: 40px;
}

.footer-brand .logo {
    color: white;
    margin-bottom: 15px;
}

.footer-brand p {
    font-size: 0.95rem;
    line-height: 1.7;
}

.footer h4 {
    color: white;
    margin-bottom: 20px;
    font-size: 1.1rem;
}

.footer-links {
    list-style: none;
}

.footer-links li {
    margin-bottom: 10px;
}

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

.social-links {
    display: flex;
    gap: 15px;
    margin-top: 20px;
}

.social-link {
    width: 40px;
    height: 40px;
    background: #334155;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.social-link:hover {
    background: var(--primary);
    transform: translateY(-3px);
}

.footer-bottom {
    border-top: 1px solid #334155;
    padding-top: 30px;
    text-align: center;
    font-size: 0.9rem;
}

@media (max-width: 768px) {
    .footer-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 480px) {
    .footer-grid {
        grid-template-columns: 1fr;
    }
}

/* Game Page Styles */
.game-page {
    padding: 40px 0;
}

.game-header {
    text-align: center;
    margin-bottom: 40px;
}

.game-header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

.game-container {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 30px;
}

.game-area {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 30px;
    box-shadow: var(--shadow);
}

.game-sidebar {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.sidebar-section {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
}

.sidebar-section h3 {
    font-size: 1rem;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--border);
}

.game-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.difficulty-btn {
    flex: 1;
    padding: 10px;
    border: 2px solid var(--border);
    background: white;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
}

.difficulty-btn.active {
    border-color: var(--primary);
    background: var(--primary);
    color: white;
}

.game-score {
    display: flex;
    justify-content: space-between;
    padding: 15px;
    background: var(--light-bg);
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
}

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

.score-item span {
    display: block;
    font-size: 0.8rem;
    color: var(--text-light);
}

.score-item strong {
    font-size: 1.5rem;
    color: var(--primary);
}

.game-instructions {
    background: var(--light-bg);
    padding: 20px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
}

.game-instructions h3 {
    margin-bottom: 10px;
}

.related-games {
    list-style: none;
}

.related-games li {
    margin-bottom: 10px;
}

.related-games a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: var(--light-bg);
    border-radius: var(--radius-sm);
    transition: all 0.3s ease;
}

.related-games a:hover {
    background: var(--primary);
    color: white;
}

@media (max-width: 968px) {
    .game-container {
        grid-template-columns: 1fr;
    }
    
    .game-sidebar {
        order: -1;
    }
}

/* Filter Bar */
.filter-bar {
    display: flex;
    gap: 15px;
    margin-bottom: 30px;
    flex-wrap: wrap;
    align-items: center;
}

.search-box {
    flex: 1;
    min-width: 250px;
    position: relative;
}

.search-box input {
    width: 100%;
    padding: 12px 20px 12px 45px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    font-size: 1rem;
    transition: all 0.3s ease;
}

.search-box input:focus {
    outline: none;
    border-color: var(--primary);
}

.search-box::before {
    content: '🔍';
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
}

.filter-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 10px 20px;
    border: 2px solid var(--border);
    background: white;
    border-radius: var(--radius);
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
}

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

.filter-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

/* Article Page Styles */
.article-page {
    padding: 40px 0;
}

.article-layout {
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: 40px;
}

.article-main {
    background: var(--card-bg);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.article-hero {
    width: 100%;
    height: 400px;
    object-fit: cover;
}

.article-body {
    padding: 40px;
}

.article-body h1 {
    font-size: 2.5rem;
    margin-bottom: 20px;
}

.article-meta {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
    font-size: 0.9rem;
    color: var(--text-light);
}

.article-meta span {
    display: flex;
    align-items: center;
    gap: 5px;
}

.article-content {
    font-size: 1.1rem;
    line-height: 1.8;
}

.article-content h2 {
    font-size: 1.8rem;
    margin: 40px 0 20px;
}

.article-content h3 {
    font-size: 1.4rem;
    margin: 30px 0 15px;
}

.article-content p {
    margin-bottom: 20px;
}

.article-content ul, .article-content ol {
    margin: 20px 0;
    padding-left: 30px;
}

.article-content li {
    margin-bottom: 10px;
}

.article-sidebar {
    position: sticky;
    top: 100px;
    align-self: start;
}

.toc {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 25px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}

.toc h3 {
    margin-bottom: 15px;
    font-size: 1.1rem;
}

.toc ul {
    list-style: none;
}

.toc li {
    margin-bottom: 10px;
}

.toc a {
    color: var(--text-light);
    font-size: 0.95rem;
    transition: color 0.3s ease;
}

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

.share-section {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 25px;
    box-shadow: var(--shadow);
    text-align: center;
}

.share-section h3 {
    margin-bottom: 15px;
}

.share-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.share-btn {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: all 0.3s ease;
}

.share-btn:hover {
    transform: scale(1.1);
}

.share-btn.facebook { background: #1877F2; color: white; }
.share-btn.twitter { background: #1DA1F2; color: white; }
.share-btn.linkedin { background: #0A66C2; color: white; }
.share-btn.copy { background: var(--dark); color: white; }

.tags-section {
    margin-top: 40px;
    padding-top: 30px;
    border-top: 1px solid var(--border);
}

.tags {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.tag {
    background: var(--light-bg);
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 0.85rem;
    color: var(--text-light);
}

.related-articles {
    margin-top: 60px;
    padding-top: 40px;
    border-top: 2px solid var(--border);
}

.related-articles h2 {
    margin-bottom: 30px;
}

.related-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 25px;
}

@media (max-width: 968px) {
    .article-layout {
        grid-template-columns: 1fr;
    }
    
    .article-sidebar {
        position: static;
    }
    
    .related-grid {
        grid-template-columns: 1fr;
    }
}

/* About Page */
.about-hero {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    padding: 80px 0;
    text-align: center;
    color: white;
}

.about-hero h1 {
    color: white;
    font-size: 3rem;
    margin-bottom: 15px;
}

.about-hero p {
    font-size: 1.25rem;
    opacity: 0.9;
}

.about-content {
    padding: 80px 0;
}

.about-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 60px;
    align-items: center;
}

.about-text h2 {
    font-size: 2rem;
    margin-bottom: 20px;
}

.about-text p {
    margin-bottom: 20px;
    font-size: 1.1rem;
}

.values-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
    margin-top: 60px;
}

.value-item {
    text-align: center;
    padding: 30px;
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.value-item .icon {
    font-size: 3rem;
    margin-bottom: 15px;
}

.value-item h3 {
    margin-bottom: 10px;
}

@media (max-width: 768px) {
    .about-grid {
        grid-template-columns: 1fr;
    }
    
    .values-grid {
        grid-template-columns: 1fr;
    }
}

/* Contact Page */
.contact-section {
    padding: 80px 0;
}

.contact-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 60px;
}

.contact-form {
    background: var(--card-bg);
    padding: 40px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
}

.form-group input, .form-group textarea {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.3s ease;
}

.form-group input:focus, .form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
}

.form-group textarea {
    min-height: 150px;
    resize: vertical;
}

.contact-info h2 {
    margin-bottom: 30px;
}

.info-item {
    display: flex;
    gap: 15px;
    margin-bottom: 25px;
}

.info-icon {
    width: 50px;
    height: 50px;
    background: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    flex-shrink: 0;
}

.info-content h4 {
    margin-bottom: 5px;
}

.info-content p {
    color: var(--text-light);
}

.faq-section {
    margin-top: 60px;
}

.faq-item {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 25px;
    margin-bottom: 15px;
    box-shadow: var(--shadow);
}

.faq-item h3 {
    margin-bottom: 10px;
    color: var(--primary);
}

@media (max-width: 768px) {
    .contact-grid {
        grid-template-columns: 1fr;
    }
}

/* 404 Page */
.error-page {
    min-height: 80vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 40px;
}

.error-content h1 {
    font-size: 8rem;
    color: var(--primary);
    margin-bottom: 20px;
}

.error-content h2 {
    font-size: 2rem;
    margin-bottom: 15px;
}

.error-content p {
    color: var(--text-light);
    margin-bottom: 30px;
}

.error-illustration {
    font-size: 6rem;
    margin-bottom: 30px;
}

/* Page Header */
.page-header {
    background: linear-gradient(135deg, var(--dark), #334155);
    padding: 60px 0;
    text-align: center;
    color: white;
}

.page-header h1 {
    color: white;
    font-size: 2.5rem;
    margin-bottom: 10px;
}

.page-header p {
    opacity: 0.8;
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-in {
    animation: fadeInUp 0.6s ease forwards;
}

/* Utility Classes */
.text-center { text-align: center; }
.text-primary { color: var(--primary); }
.text-secondary { color: var(--secondary); }
.mt-20 { margin-top: 20px; }
.mb-20 { margin-bottom: 20px; }
