/* ====================================
   MathStar Platform - Main Stylesheet
   Modern, Kid-Friendly Design System
   ==================================== */

/* CSS Variables */
:root {
    /* Primary Colors */
    --primary-50: #eef2ff;
    --primary-100: #e0e7ff;
    --primary-200: #c7d2fe;
    --primary-300: #a5b4fc;
    --primary-400: #818cf8;
    --primary-500: #6366f1;
    --primary-600: #4f46e5;
    --primary-700: #4338ca;
    --primary-800: #3730a3;
    --primary-900: #312e81;

    /* Secondary Colors */
    --secondary-50: #faf5ff;
    --secondary-100: #f3e8ff;
    --secondary-200: #e9d5ff;
    --secondary-300: #d8b4fe;
    --secondary-400: #c084fc;
    --secondary-500: #a855f7;
    --secondary-600: #9333ea;
    --secondary-700: #7e22ce;
    --secondary-800: #6b21a8;
    --secondary-900: #581c87;

    /* Accent Colors */
    --accent-50: #fff1f2;
    --accent-100: #ffe4e6;
    --accent-200: #fecdd3;
    --accent-300: #fda4af;
    --accent-400: #fb7185;
    --accent-500: #f43f5e;
    --accent-600: #e11d48;
    --accent-700: #be123c;
    --accent-800: #9f1239;
    --accent-900: #881337;

    /* Success Colors */
    --success-50: #f0fdf4;
    --success-100: #dcfce7;
    --success-200: #bbf7d0;
    --success-300: #86efac;
    --success-400: #4ade80;
    --success-500: #22c55e;
    --success-600: #16a34a;
    --success-700: #15803d;
    --success-800: #166534;
    --success-900: #14532d;

    /* Warning Colors */
    --warning-50: #fffbeb;
    --warning-100: #fef3c7;
    --warning-200: #fde68a;
    --warning-300: #fcd34d;
    --warning-400: #fbbf24;
    --warning-500: #f59e0b;
    --warning-600: #d97706;
    --warning-700: #b45309;
    --warning-800: #92400e;
    --warning-900: #78350f;

    /* Error Colors */
    --error-50: #fef2f2;
    --error-100: #fee2e2;
    --error-200: #fecaca;
    --error-300: #fca5a5;
    --error-400: #f87171;
    --error-500: #ef4444;
    --error-600: #dc2626;
    --error-700: #b91c1c;
    --error-800: #991b1b;
    --error-900: #7f1d1d;

    /* Gray Scale */
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;

    /* Spacing */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-10: 2.5rem;
    --space-12: 3rem;
    --space-16: 4rem;
    --space-20: 5rem;
    --space-24: 6rem;

    /* Typography */
    --font-family-primary: 'Quicksand', sans-serif;
    --font-family-secondary: 'Comic Neue', cursive;
    --font-size-xs: 0.75rem;
    --font-size-sm: 0.875rem;
    --font-size-base: 1rem;
    --font-size-lg: 1.125rem;
    --font-size-xl: 1.25rem;
    --font-size-2xl: 1.5rem;
    --font-size-3xl: 1.875rem;
    --font-size-4xl: 2.25rem;
    --font-size-5xl: 3rem;

    /* Borders */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-2xl: 1.5rem;
    --radius-3xl: 2rem;
    --radius-full: 9999px;

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1);
    --shadow-2xl: 0 25px 50px -12px rgb(0 0 0 / 0.25);

    /* Transitions */
    --transition-fast: 150ms;
    --transition-base: 300ms;
    --transition-slow: 500ms;
    --transition-bounce: cubic-bezier(0.68, -0.55, 0.265, 1.55);

    /* Z-index */
    --z-dropdown: 1000;
    --z-sticky: 1020;
    --z-fixed: 1030;
    --z-modal: 1040;
    --z-popover: 1050;
    --z-tooltip: 1060;
}

/* Reset & Base Styles */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-family-primary);
    color: var(--gray-800);
    line-height: 1.5;
    background: linear-gradient(135deg, var(--primary-50), var(--secondary-50));
    min-height: 100vh;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.2;
}

h1 { font-size: var(--font-size-5xl); }
h2 { font-size: var(--font-size-4xl); }
h3 { font-size: var(--font-size-3xl); }
h4 { font-size: var(--font-size-2xl); }
h5 { font-size: var(--font-size-xl); }
h6 { font-size: var(--font-size-lg); }

a {
    color: var(--primary-600);
    text-decoration: none;
    transition: color var(--transition-fast);
}

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

/* Font Utilities */
.font-rounded { font-family: var(--font-family-primary); }
.font-fun { font-family: var(--font-family-secondary); }

/* Container */
.container {
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 var(--space-4);
}

@media (min-width: 640px) {
    .container { padding: 0 var(--space-6); }
}

@media (min-width: 1024px) {
    .container { padding: 0 var(--space-8); }
}

/* ====================================
   Animations
   ==================================== */
@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-20px); }
}

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

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes popIn {
    0% {
        opacity: 0;
        transform: scale(0.8);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

@keyframes blob {
    0% { transform: scale(1); }
    33% { transform: scale(1.1); }
    66% { transform: scale(0.9); }
    100% { transform: scale(1); }
}

@keyframes glow {
    0%, 100% { box-shadow: 0 0 5px var(--primary-400); }
    50% { box-shadow: 0 0 20px var(--primary-600); }
}

@keyframes confetti {
    0% { transform: translateY(0) rotate(0); opacity: 1; }
    100% { transform: translateY(100vh) rotate(720deg); opacity: 0; }
}

/* Animation Classes */
.animate-float { animation: float 6s ease-in-out infinite; }
.animate-float-slow { animation: float-slow 8s ease-in-out infinite; }
.animate-pulse { animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite; }
.animate-pulse-slow { animation: pulse 3s ease-in-out infinite; }
.animate-bounce { animation: bounce 1s ease infinite; }
.animate-spin { animation: spin 1s linear infinite; }
.animate-slide-in { animation: slideIn 0.5s ease-out; }
.animate-pop-in { animation: popIn 0.3s var(--transition-bounce); }
.animate-shake { animation: shake 0.5s ease-in-out; }
.animate-blob { animation: blob 7s infinite; }
.animate-glow { animation: glow 2s ease-in-out infinite; }

/* Animation Delays */
.animation-delay-2000 { animation-delay: 2s; }
.animation-delay-4000 { animation-delay: 4s; }
.animation-delay-6000 { animation-delay: 6s; }

/* ====================================
   Game Components
   ==================================== */
.game-card {
    background: white;
    border-radius: var(--radius-3xl);
    padding: var(--space-8);
    box-shadow: var(--shadow-2xl);
    border: 4px solid var(--primary-200);
    transition: all var(--transition-base);
}

.game-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-2xl), 0 0 20px var(--primary-300);
}

/* Question Display */
.question {
    font-size: clamp(2rem, 8vw, 4rem);
    font-weight: 700;
    color: var(--primary-800);
    text-align: center;
    line-height: 1.2;
    word-break: break-word;
}

/* Option Buttons */
.option-btn {
    background: linear-gradient(135deg, white, var(--gray-50));
    border: 3px solid var(--primary-200);
    border-radius: var(--radius-2xl);
    padding: var(--space-4) var(--space-6);
    font-size: var(--font-size-2xl);
    font-weight: 600;
    color: var(--primary-700);
    cursor: pointer;
    transition: all var(--transition-base);
    box-shadow: var(--shadow-md);
    width: 100%;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.option-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(79, 70, 229, 0.2);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.option-btn:hover::before {
    width: 300px;
    height: 300px;
}

.option-btn:hover {
    transform: scale(1.02);
    border-color: var(--primary-500);
    box-shadow: var(--shadow-xl);
}

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

.option-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
}

.option-btn-correct {
    background: linear-gradient(135deg, var(--success-500), var(--success-600));
    border-color: var(--success-400);
    color: white;
    transform: scale(1.05);
}

.option-btn-wrong {
    background: linear-gradient(135deg, var(--error-500), var(--error-600));
    border-color: var(--error-400);
    color: white;
    opacity: 0.8;
}

/* Timer Box */
.timer-box {
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, var(--secondary-500), var(--secondary-600));
}

.timer-box::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: repeating-linear-gradient(
        45deg,
        transparent,
        transparent 10px,
        rgba(255, 255, 255, 0.1) 10px,
        rgba(255, 255, 255, 0.1) 20px
    );
    animation: spin 20s linear infinite;
}

.timer-box-warning {
    background: linear-gradient(135deg, var(--warning-500), var(--warning-600));
    animation: pulse 1s ease-in-out infinite;
}

.timer-box-danger {
    background: linear-gradient(135deg, var(--error-500), var(--error-600));
    animation: pulse 0.5s ease-in-out infinite;
}

/* Feedback Messages */
.feedback {
    padding: var(--space-4);
    border-radius: var(--radius-xl);
    font-size: var(--font-size-lg);
    font-weight: 600;
    text-align: center;
    transition: all var(--transition-base);
    min-height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.feedback-success {
    background: linear-gradient(135deg, var(--success-100), var(--success-200));
    border: 3px solid var(--success-400);
    color: var(--success-800);
}

.feedback-error {
    background: linear-gradient(135deg, var(--error-100), var(--error-200));
    border: 3px solid var(--error-400);
    color: var(--error-800);
}

.feedback-timeout {
    background: linear-gradient(135deg, var(--warning-100), var(--warning-200));
    border: 3px solid var(--warning-400);
    color: var(--warning-800);
}

/* Progress Bar */
.progress-bar {
    background: var(--gray-200);
    border-radius: var(--radius-full);
    height: 1rem;
    overflow: hidden;
    border: 2px solid var(--gray-300);
}

.progress-fill {
    background: linear-gradient(90deg, var(--primary-500), var(--secondary-500));
    height: 100%;
    transition: width 0.3s ease;
    position: relative;
    overflow: hidden;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.3),
        transparent
    );
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* Score Boxes */
.score-box {
    background: linear-gradient(135deg, var(--primary-600), var(--primary-700));
    border-radius: var(--radius-xl);
    padding: var(--space-4);
    color: white;
    text-align: center;
    box-shadow: var(--shadow-lg);
}

.score-box-value {
    font-size: var(--font-size-3xl);
    font-weight: 700;
    line-height: 1;
}

/* Topic Buttons */
.topic-btn {
    padding: var(--space-2) var(--space-4);
    border-radius: var(--radius-full);
    font-weight: 600;
    transition: all var(--transition-base);
    border: 2px solid transparent;
}

.topic-btn-active {
    background: var(--primary-600);
    color: white;
    border-color: var(--primary-400);
    transform: scale(1.05);
}

/* Year Buttons */
.year-btn {
    padding: var(--space-3) var(--space-6);
    border-radius: var(--radius-xl);
    font-weight: 600;
    transition: all var(--transition-base);
    border: 2px solid var(--gray-300);
    background: var(--gray-100);
    color: var(--gray-700);
}

.year-btn:hover {
    background: var(--primary-100);
    border-color: var(--primary-400);
}

.year-btn-active {
    background: var(--primary-600);
    color: white;
    border-color: var(--primary-400);
    transform: scale(1.05);
}

/* ====================================
   Dashboard Components
   ==================================== */
.stat-card {
    background: white;
    border-radius: var(--radius-xl);
    padding: var(--space-6);
    box-shadow: var(--shadow-lg);
    transition: all var(--transition-base);
    border: 2px solid var(--primary-100);
}

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

.stat-icon {
    width: 3rem;
    height: 3rem;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: var(--space-4);
    font-size: 1.5rem;
}

.stat-value {
    font-size: var(--font-size-3xl);
    font-weight: 700;
    color: var(--gray-800);
    line-height: 1;
}

.stat-label {
    color: var(--gray-500);
    font-size: var(--font-size-sm);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Progress Charts */
.chart-container {
    background: white;
    border-radius: var(--radius-xl);
    padding: var(--space-6);
    box-shadow: var(--shadow-lg);
    border: 2px solid var(--primary-100);
}

/* Achievement Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: var(--space-1) var(--space-3);
    border-radius: var(--radius-full);
    font-size: var(--font-size-sm);
    font-weight: 600;
    line-height: 1;
}

.badge-gold {
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    color: white;
}

.badge-silver {
    background: linear-gradient(135deg, #9ca3af, #6b7280);
    color: white;
}

.badge-bronze {
    background: linear-gradient(135deg, #b45309, #92400e);
    color: white;
}

/* ====================================
   Form Elements
   ==================================== */
.form-input {
    width: 100%;
    padding: var(--space-3) var(--space-4);
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-lg);
    font-family: var(--font-family-primary);
    font-size: var(--font-size-base);
    transition: all var(--transition-fast);
}

.form-input:focus {
    outline: none;
    border-color: var(--primary-500);
    box-shadow: 0 0 0 3px var(--primary-100);
}

.form-label {
    display: block;
    margin-bottom: var(--space-2);
    font-weight: 600;
    color: var(--gray-700);
}

.form-error {
    color: var(--error-600);
    font-size: var(--font-size-sm);
    margin-top: var(--space-1);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-3) var(--space-6);
    border-radius: var(--radius-lg);
    font-weight: 600;
    transition: all var(--transition-base);
    cursor: pointer;
    border: none;
    font-size: var(--font-size-base);
    gap: var(--space-2);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-600), var(--primary-700));
    color: white;
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-700), var(--primary-800));
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-secondary {
    background: linear-gradient(135deg, var(--secondary-600), var(--secondary-700));
    color: white;
}

.btn-success {
    background: linear-gradient(135deg, var(--success-600), var(--success-700));
    color: white;
}

.btn-warning {
    background: linear-gradient(135deg, var(--warning-600), var(--warning-700));
    color: white;
}

.btn-error {
    background: linear-gradient(135deg, var(--error-600), var(--error-700));
    color: white;
}

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

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

.btn-lg {
    padding: var(--space-4) var(--space-8);
    font-size: var(--font-size-lg);
}

.btn-sm {
    padding: var(--space-2) var(--space-4);
    font-size: var(--font-size-sm);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* ====================================
   Modal
   ==================================== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: var(--z-modal);
    padding: var(--space-4);
}

.modal {
    background: white;
    border-radius: var(--radius-3xl);
    padding: var(--space-8);
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-2xl);
    animation: popIn 0.3s var(--transition-bounce);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-6);
}

.modal-title {
    font-size: var(--font-size-2xl);
    font-weight: 700;
    color: var(--gray-800);
}

.modal-close {
    background: var(--gray-100);
    border: none;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-fast);
    color: var(--gray-600);
}

.modal-close:hover {
    background: var(--gray-200);
    color: var(--gray-800);
    transform: rotate(90deg);
}

.modal-body {
    margin-bottom: var(--space-6);
}

.modal-footer {
    display: flex;
    gap: var(--space-4);
    justify-content: flex-end;
}

/* ====================================
   Loading States
   ==================================== */
.loading-spinner {
    width: 3rem;
    height: 3rem;
    border: 4px solid var(--primary-200);
    border-top-color: var(--primary-600);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.loading-dots {
    display: flex;
    gap: var(--space-2);
}

.loading-dot {
    width: 1rem;
    height: 1rem;
    background: var(--primary-600);
    border-radius: 50%;
    animation: bounce 0.5s ease-in-out infinite;
}

.loading-dot:nth-child(2) { animation-delay: 0.1s; }
.loading-dot:nth-child(3) { animation-delay: 0.2s; }

/* Skeleton Loading */
.skeleton {
    background: linear-gradient(
        90deg,
        var(--gray-200) 25%,
        var(--gray-300) 50%,
        var(--gray-200) 75%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-md);
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ====================================
   Toast Notifications
   ==================================== */
.toast-container {
    position: fixed;
    bottom: var(--space-4);
    right: var(--space-4);
    z-index: var(--z-tooltip);
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.toast {
    background: white;
    border-radius: var(--radius-lg);
    padding: var(--space-4) var(--space-6);
    box-shadow: var(--shadow-xl);
    display: flex;
    align-items: center;
    gap: var(--space-3);
    animation: slideIn 0.3s ease-out;
    min-width: 300px;
    max-width: 400px;
    border-left: 4px solid;
}

.toast-success {
    border-left-color: var(--success-500);
}

.toast-error {
    border-left-color: var(--error-500);
}

.toast-warning {
    border-left-color: var(--warning-500);
}

.toast-info {
    border-left-color: var(--primary-500);
}

.toast-icon {
    flex-shrink: 0;
    font-size: 1.5rem;
}

.toast-content {
    flex: 1;
}

.toast-title {
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: var(--space-1);
}

.toast-message {
    color: var(--gray-600);
    font-size: var(--font-size-sm);
}

.toast-close {
    background: transparent;
    border: none;
    color: var(--gray-400);
    cursor: pointer;
    padding: var(--space-1);
    transition: color var(--transition-fast);
}

.toast-close:hover {
    color: var(--gray-600);
}

/* ====================================
   Responsive Design
   ==================================== */
@media (max-width: 768px) {
    h1 { font-size: var(--font-size-4xl); }
    h2 { font-size: var(--font-size-3xl); }
    h3 { font-size: var(--font-size-2xl); }
    
    .option-btn {
        font-size: var(--font-size-xl);
        padding: var(--space-3) var(--space-4);
    }
    
    .question {
        font-size: clamp(1.5rem, 6vw, 3rem);
    }
    
    .modal {
        margin: var(--space-4);
        padding: var(--space-6);
    }
}

@media (max-width: 640px) {
    .option-btn {
        font-size: var(--font-size-lg);
    }
    
    .game-card {
        padding: var(--space-4);
    }
    
    .toast {
        min-width: 250px;
        max-width: 300px;
    }
}

/* ====================================
   Print Styles
   ==================================== */
@media print {
    .no-print {
        display: none !important;
    }
    
    body {
        background: white;
    }
    
    .print-only {
        display: block !important;
    }
}

/* ====================================
   Accessibility
   ==================================== */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

.focus-visible:focus-visible {
    outline: 2px solid var(--primary-500);
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ====================================
   Dark Mode Support (Optional)
   ==================================== */
@media (prefers-color-scheme: dark) {
    :root {
        --gray-50: #1f2937;
        --gray-100: #374151;
        --gray-200: #4b5563;
        --gray-300: #6b7280;
        --gray-400: #9ca3af;
        --gray-500: #d1d5db;
        --gray-600: #e5e7eb;
        --gray-700: #f3f4f6;
        --gray-800: #f9fafb;
        --gray-900: #ffffff;
    }
    
    body {
        background: linear-gradient(135deg, #1a1c2c, #2a1e3c);
    }
    
    .game-card,
    .stat-card,
    .chart-container {
        background: var(--gray-100);
        border-color: var(--gray-300);
    }
}



/* ====================================
   CRITICAL FIXES - ADD AT THE END
   ==================================== */

/* Ensure body has proper padding/margin */
body {
    margin: 0;
    padding: 0;
    overflow-x: hidden;
}

/* Fix oversized icons */
.text-6xl, .text-7xl, .text-8xl, .text-9xl {
    font-size: clamp(3rem, 10vw, 6rem) !important;
    line-height: 1.2;
}

/* Fix hero section spacing */
.hero-section {
    min-height: auto;
    padding: 2rem 1rem;
}

/* Fix container widths */
.container, .max-w-7xl {
    width: 100%;
    max-width: 1280px;
    margin-left: auto;
    margin-right: auto;
    padding-left: 1rem;
    padding-right: 1rem;
}

/* Fix flexbox issues */
.flex {
    display: flex;
    flex-wrap: wrap;
}

/* Fix grid issues */
.grid {
    display: grid;
    gap: 1rem;
}

/* Ensure images don't overflow */
img {
    max-width: 100%;
    height: auto;
}

/* Fix button sizes on mobile */
@media (max-width: 640px) {
    .btn, button[class*="btn-"] {
        padding: 0.75rem 1rem !important;
        font-size: 1rem !important;
    }
    
    h1 { font-size: 2.5rem !important; }
    h2 { font-size: 2rem !important; }
    h3 { font-size: 1.5rem !important; }
}

/* Fix oversized icons in feature cards */
.feature-card .text-5xl,
.stat-card .text-5xl,
[class*="stat-icon"] {
    font-size: 2.5rem !important;
    width: auto !important;
    height: auto !important;
}

/* Ensure proper box sizing */
*, *::before, *::after {
    box-sizing: border-box;
}

/* Fix navigation on mobile */
@media (max-width: 768px) {
    nav .flex {
        flex-wrap: wrap;
    }
    
    .nav-menu {
        width: 100%;
        order: 3;
    }
}



/* ====================================
   UTILITY CLASSES (Tailwind-like)
   ==================================== */

/* Display */
.hidden { display: none; }
.block { display: block; }
.inline-block { display: inline-block; }
.flex { display: flex; }
.inline-flex { display: inline-flex; }
.grid { display: grid; }

/* Flex Direction */
.flex-row { flex-direction: row; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.flex-nowrap { flex-wrap: nowrap; }

/* Justify Content */
.justify-start { justify-content: flex-start; }
.justify-end { justify-content: flex-end; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-around { justify-content: space-around; }
.justify-evenly { justify-content: space-evenly; }

/* Align Items */
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }
.items-center { align-items: center; }
.items-baseline { align-items: baseline; }
.items-stretch { align-items: stretch; }

/* Gap */
.gap-0 { gap: 0; }
.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.gap-5 { gap: 1.25rem; }
.gap-6 { gap: 1.5rem; }
.gap-8 { gap: 2rem; }
.gap-10 { gap: 2.5rem; }

/* Padding */
.p-0 { padding: 0; }
.p-1 { padding: 0.25rem; }
.p-2 { padding: 0.5rem; }
.p-3 { padding: 0.75rem; }
.p-4 { padding: 1rem; }
.p-5 { padding: 1.25rem; }
.p-6 { padding: 1.5rem; }
.p-8 { padding: 2rem; }
.p-10 { padding: 2.5rem; }

.px-0 { padding-left: 0; padding-right: 0; }
.px-1 { padding-left: 0.25rem; padding-right: 0.25rem; }
.px-2 { padding-left: 0.5rem; padding-right: 0.5rem; }
.px-3 { padding-left: 0.75rem; padding-right: 0.75rem; }
.px-4 { padding-left: 1rem; padding-right: 1rem; }
.px-5 { padding-left: 1.25rem; padding-right: 1.25rem; }
.px-6 { padding-left: 1.5rem; padding-right: 1.5rem; }
.px-8 { padding-left: 2rem; padding-right: 2rem; }

.py-0 { padding-top: 0; padding-bottom: 0; }
.py-1 { padding-top: 0.25rem; padding-bottom: 0.25rem; }
.py-2 { padding-top: 0.5rem; padding-bottom: 0.5rem; }
.py-3 { padding-top: 0.75rem; padding-bottom: 0.75rem; }
.py-4 { padding-top: 1rem; padding-bottom: 1rem; }
.py-5 { padding-top: 1.25rem; padding-bottom: 1.25rem; }
.py-6 { padding-top: 1.5rem; padding-bottom: 1.5rem; }
.py-8 { padding-top: 2rem; padding-bottom: 2rem; }

/* Margin */
.m-0 { margin: 0; }
.m-1 { margin: 0.25rem; }
.m-2 { margin: 0.5rem; }
.m-3 { margin: 0.75rem; }
.m-4 { margin: 1rem; }
.m-5 { margin: 1.25rem; }
.m-6 { margin: 1.5rem; }
.m-8 { margin: 2rem; }

.mx-auto { margin-left: auto; margin-right: auto; }
.my-0 { margin-top: 0; margin-bottom: 0; }
.my-1 { margin-top: 0.25rem; margin-bottom: 0.25rem; }
.my-2 { margin-top: 0.5rem; margin-bottom: 0.5rem; }
.my-3 { margin-top: 0.75rem; margin-bottom: 0.75rem; }
.my-4 { margin-top: 1rem; margin-bottom: 1rem; }
.my-5 { margin-top: 1.25rem; margin-bottom: 1.25rem; }
.my-6 { margin-top: 1.5rem; margin-bottom: 1.5rem; }
.my-8 { margin-top: 2rem; margin-bottom: 2rem; }

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }
.mt-5 { margin-top: 1.25rem; }
.mt-6 { margin-top: 1.5rem; }
.mt-8 { margin-top: 2rem; }
.mt-10 { margin-top: 2.5rem; }

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-5 { margin-bottom: 1.25rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mb-8 { margin-bottom: 2rem; }
.mb-10 { margin-bottom: 2.5rem; }

.ml-0 { margin-left: 0; }
.ml-1 { margin-left: 0.25rem; }
.ml-2 { margin-left: 0.5rem; }
.ml-3 { margin-left: 0.75rem; }
.ml-4 { margin-left: 1rem; }
.ml-5 { margin-left: 1.25rem; }

.mr-0 { margin-right: 0; }
.mr-1 { margin-right: 0.25rem; }
.mr-2 { margin-right: 0.5rem; }
.mr-3 { margin-right: 0.75rem; }
.mr-4 { margin-right: 1rem; }
.mr-5 { margin-right: 1.25rem; }

/* Width */
.w-full { width: 100%; }
.w-screen { width: 100vw; }
.w-auto { width: auto; }
.w-1\/2 { width: 50%; }
.w-1\/3 { width: 33.333333%; }
.w-2\/3 { width: 66.666667%; }
.w-1\/4 { width: 25%; }
.w-3\/4 { width: 75%; }

.max-w-xs { max-width: 20rem; }
.max-w-sm { max-width: 24rem; }
.max-w-md { max-width: 28rem; }
.max-w-lg { max-width: 32rem; }
.max-w-xl { max-width: 36rem; }
.max-w-2xl { max-width: 42rem; }
.max-w-3xl { max-width: 48rem; }
.max-w-4xl { max-width: 56rem; }
.max-w-5xl { max-width: 64rem; }
.max-w-6xl { max-width: 72rem; }
.max-w-7xl { max-width: 80rem; }
.max-w-full { max-width: 100%; }

/* Height */
.h-full { height: 100%; }
.h-screen { height: 100vh; }
.h-auto { height: auto; }

/* Text Colors */
.text-primary-600 { color: var(--primary-600); }
.text-primary-700 { color: var(--primary-700); }
.text-primary-800 { color: var(--primary-800); }
.text-secondary-600 { color: var(--secondary-600); }
.text-success-600 { color: var(--success-600); }
.text-warning-600 { color: var(--warning-600); }
.text-error-600 { color: var(--error-600); }

/* Background Colors */
.bg-primary-50 { background-color: var(--primary-50); }
.bg-primary-100 { background-color: var(--primary-100); }
.bg-primary-600 { background-color: var(--primary-600); }
.bg-secondary-50 { background-color: var(--secondary-50); }
.bg-success-50 { background-color: var(--success-50); }
.bg-warning-50 { background-color: var(--warning-50); }
.bg-error-50 { background-color: var(--error-50); }

/* Borders */
.rounded-none { border-radius: 0; }
.rounded-sm { border-radius: var(--radius-sm); }
.rounded-md { border-radius: var(--radius-md); }
.rounded-lg { border-radius: var(--radius-lg); }
.rounded-xl { border-radius: var(--radius-xl); }
.rounded-2xl { border-radius: var(--radius-2xl); }
.rounded-3xl { border-radius: var(--radius-3xl); }
.rounded-full { border-radius: var(--radius-full); }

.border-0 { border-width: 0; }
.border { border-width: 1px; }
.border-2 { border-width: 2px; }
.border-4 { border-width: 4px; }
.border-8 { border-width: 8px; }

.border-primary-200 { border-color: var(--primary-200); }
.border-primary-300 { border-color: var(--primary-300); }
.border-primary-400 { border-color: var(--primary-400); }
.border-primary-500 { border-color: var(--primary-500); }
.border-gray-200 { border-color: var(--gray-200); }
.border-gray-300 { border-color: var(--gray-300); }

/* Shadows */
.shadow-sm { box-shadow: var(--shadow-sm); }
.shadow-md { box-shadow: var(--shadow-md); }
.shadow-lg { box-shadow: var(--shadow-lg); }
.shadow-xl { box-shadow: var(--shadow-xl); }
.shadow-2xl { box-shadow: var(--shadow-2xl); }
.shadow-none { box-shadow: none; }

/* Z-index */
.z-0 { z-index: 0; }
.z-10 { z-index: 10; }
.z-20 { z-index: 20; }
.z-30 { z-index: 30; }
.z-40 { z-index: 40; }
.z-50 { z-index: 50; }
.z-auto { z-index: auto; }

/* Position */
.relative { position: relative; }
.absolute { position: absolute; }
.fixed { position: fixed; }
.sticky { position: sticky; }
.static { position: static; }

/* Overflow */
.overflow-hidden { overflow: hidden; }
.overflow-auto { overflow: auto; }
.overflow-scroll { overflow: scroll; }
.overflow-visible { overflow: visible; }
.overflow-x-hidden { overflow-x: hidden; }
.overflow-y-hidden { overflow-y: hidden; }
.overflow-x-auto { overflow-x: auto; }
.overflow-y-auto { overflow-y: auto; }

/* Object Fit */
.object-contain { object-fit: contain; }
.object-cover { object-fit: cover; }
.object-fill { object-fit: fill; }
.object-none { object-fit: none; }
.object-scale-down { object-fit: scale-down; }

/* Transitions */
.transition { transition-property: all; transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); transition-duration: 150ms; }
.transition-colors { transition-property: background-color, border-color, color, fill, stroke; transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); transition-duration: 150ms; }
.transition-opacity { transition-property: opacity; transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); transition-duration: 150ms; }
.transition-shadow { transition-property: box-shadow; transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); transition-duration: 150ms; }
.transition-transform { transition-property: transform; transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); transition-duration: 150ms; }

.duration-75 { transition-duration: 75ms; }
.duration-100 { transition-duration: 100ms; }
.duration-150 { transition-duration: 150ms; }
.duration-200 { transition-duration: 200ms; }
.duration-300 { transition-duration: 300ms; }
.duration-500 { transition-duration: 500ms; }
.duration-700 { transition-duration: 700ms; }
.duration-1000 { transition-duration: 1000ms; }

.ease-linear { transition-timing-function: linear; }
.ease-in { transition-timing-function: cubic-bezier(0.4, 0, 1, 1); }
.ease-out { transition-timing-function: cubic-bezier(0, 0, 0.2, 1); }
.ease-in-out { transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); }

/* Hover Effects */
.hover\:scale-105:hover { transform: scale(1.05); }
.hover\:scale-110:hover { transform: scale(1.1); }
.hover\:shadow-lg:hover { box-shadow: var(--shadow-lg); }
.hover\:shadow-xl:hover { box-shadow: var(--shadow-xl); }
.hover\:bg-primary-50:hover { background-color: var(--primary-50); }
.hover\:bg-primary-100:hover { background-color: var(--primary-100); }
.hover\:bg-primary-700:hover { background-color: var(--primary-700); }
.hover\:text-primary-700:hover { color: var(--primary-700); }
.hover\:text-primary-800:hover { color: var(--primary-800); }
.hover\:text-white:hover { color: white; }

/* Focus */
.focus\:outline-none:focus { outline: 0; }
.focus\:ring-2:focus { box-shadow: 0 0 0 2px var(--primary-200); }
.focus\:ring-primary-300:focus { box-shadow: 0 0 0 3px var(--primary-300); }

/* Disabled */
.disabled\:opacity-50:disabled { opacity: 0.5; }
.disabled\:cursor-not-allowed:disabled { cursor: not-allowed; }

/* Grid Columns */
.grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-cols-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.grid-cols-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }

@media (min-width: 640px) {
    .sm\:grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
    .sm\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .sm\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (min-width: 768px) {
    .md\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .md\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .md\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .md\:flex { display: flex; }
    .md\:hidden { display: none; }
    .md\:block { display: block; }
}

@media (min-width: 1024px) {
    .lg\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .lg\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .lg\:grid-cols-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
    .lg\:flex { display: flex; }
    .lg\:hidden { display: none; }
}

/* Container Queries */
.container {
    width: 100%;
    margin-left: auto;
    margin-right: auto;
    padding-left: 1rem;
    padding-right: 1rem;
}

@media (min-width: 640px) {
    .container {
        max-width: 640px;
    }
}

@media (min-width: 768px) {
    .container {
        max-width: 768px;
    }
}

@media (min-width: 1024px) {
    .container {
        max-width: 1024px;
    }
}

@media (min-width: 1280px) {
    .container {
        max-width: 1280px;
    }
}

@media (min-width: 1536px) {
    .container {
        max-width: 1536px;
    }
}