:root {
    /* Brand Colors - Enhanced Premium Palette */
    --primary-color: #FF2E93;
    --primary-dark: #FF006E;
    --secondary-color: #8338EC;
    --accent-color: #FFBE0B;
    --success-color: #06D6A0;
    --info-color: #667EEA;

    /* Background - Dark Mode Premium */
    --bg-dark: #0A0D12;
    --bg-gradient-start: #667eea;
    --bg-gradient-end: #764ba2;
    --bg-white: #FFFFFF;
    --glass-bg: rgba(255, 255, 255, 0.95);
    --glass-border: rgba(255, 255, 255, 0.18);

    /* Text Colors */
    --text-dark: #1A1D23;
    --text-gray: #64748B;
    --text-white: #FFFFFF;

    /* Fonts */
    --font-heading: 'Bubblegum Sans', cursive;
    --font-body: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

    /* Spacing */
    --spacing-xs: 0.5rem;
    --spacing-sm: 1rem;
    --spacing-md: 1.5rem;
    --spacing-lg: 2.5rem;
    --spacing-xl: 4rem;

    /* Enhanced Shadows */
    --shadow-sm: 0 2px 12px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.15);
    --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.25);
    --shadow-glow: 0 0 40px rgba(255, 46, 147, 0.3);

    /* Border */
    --border-color: #E2E8F0;
}

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

body {
    font-family: var(--font-body);
    color: var(--text-dark);
    background: linear-gradient(135deg, var(--bg-gradient-start) 0%, var(--bg-gradient-end) 100%);
    background-attachment: fixed;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    position: relative;
    overflow-x: hidden;
}

/* Animated Background Particles */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        radial-gradient(circle at 20% 30%, rgba(255, 190, 11, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(6, 214, 160, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 50% 50%, rgba(131, 56, 236, 0.1) 0%, transparent 50%);
    animation: floatBackground 20s ease-in-out infinite;
    pointer-events: none;
    z-index: 0;
}

@keyframes floatBackground {
    0%, 100% {
        transform: translate(0, 0) scale(1);
        opacity: 1;
    }
    25% {
        transform: translate(-20px, 20px) scale(1.05);
        opacity: 0.8;
    }
    50% {
        transform: translate(20px, -20px) scale(0.95);
        opacity: 1;
    }
    75% {
        transform: translate(-10px, -30px) scale(1.02);
        opacity: 0.9;
    }
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--spacing-md);
}

/* Header */
.header {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--glass-border);
    box-shadow: var(--shadow-md);
    padding: var(--spacing-md) 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    z-index: 1;
}

.logo {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    font-family: var(--font-heading);
    font-size: 1.5rem;
    color: var(--primary-color);
    cursor: pointer;
    transition: transform 0.3s ease;
}

.logo:hover {
    transform: scale(1.05);
}

.logo-icon {
    font-size: 2rem;
}

.user-section {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

.user-name {
    font-weight: 600;
    color: var(--text-dark);
    font-size: 1rem;
}

.btn-nav {
    background: linear-gradient(135deg, var(--info-color), var(--secondary-color));
    border: none;
    color: white;
    padding: 0.65rem 1.4rem;
    border-radius: 50px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: var(--font-body);
    font-size: 0.95rem;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.btn-nav:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.btn-logout {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    border: none;
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 50px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: var(--font-body);
    font-size: 0.95rem;
    box-shadow: 0 4px 15px rgba(255, 46, 147, 0.3);
    /* WCAG 2.1 Level AAA: Minimum 44x44px touch target */
    min-width: 44px;
    min-height: 44px;
}

.btn-logout:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 46, 147, 0.4);
}

/* Main Content */
.main-content {
    padding: var(--spacing-xl) 0;
    position: relative;
    z-index: 1;
}

/* Welcome Section - Enhanced */
.welcome-section {
    text-align: center;
    margin-bottom: var(--spacing-xl);
    color: white;
    padding: 2rem 1rem;
    position: relative;
}

.welcome-title {
    font-family: var(--font-heading);
    font-size: clamp(2.2rem, 6vw, 3.5rem);
    margin-bottom: var(--spacing-md);
    text-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    animation: titleFloat 3s ease-in-out infinite;
}

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

.welcome-subtitle {
    font-size: clamp(1.1rem, 2.5vw, 1.4rem);
    opacity: 0.95;
    font-weight: 500;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    max-width: 600px;
    margin: 0 auto;
}

/* Games Dashboard */
.games-dashboard {
    margin-bottom: var(--spacing-xl);
    display: flex;
    flex-direction: column;
    gap: var(--spacing-lg);
}

/* Age section grouping */
.age-section {
    background: var(--glass-bg);
    border-radius: 24px;
    padding: 1.75rem 1.5rem 1.75rem;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--glass-border);
}

.age-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.age-title {
    font-family: var(--font-heading);
    font-size: 1.4rem;
    color: var(--text-dark);
}

.age-subtitle {
    font-size: 0.95rem;
    color: var(--text-gray);
    margin-top: 0.2rem;
}

.age-tag {
    padding: 0.35rem 0.9rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: rgba(102, 126, 234, 0.12);
    color: var(--info-color);
    white-space: nowrap;
}

.age-tag-popular {
    background: rgba(255, 190, 11, 0.15);
    color: var(--accent-color);
}

.age-tag-advanced {
    background: rgba(131, 56, 236, 0.15);
    color: var(--secondary-color);
}

/* Tile grid inside each age section */
.games-tiles {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.25rem;
}

.game-tile {
    background: var(--bg-white);
    border-radius: 18px;
    padding: 1rem 1rem 1.1rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.game-tile:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-color);
}

.game-tile-icon {
    font-size: 1.9rem;
}

.game-tile-title {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    color: var(--text-dark);
}

.game-tile-desc {
    font-size: 0.9rem;
    color: var(--text-gray);
}

.game-tile-meta {
    margin: 0.1rem 0 0.4rem;
    padding-left: 1.1rem;
    font-size: 0.83rem;
    color: var(--text-gray);
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.game-tile-meta li {
    list-style: disc;
}

.game-tile-cta {
    margin-top: auto;
    align-self: flex-start;
    padding: 0.45rem 0.9rem;
    border-radius: 999px;
    border: none;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: var(--text-white);
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    box-shadow: 0 4px 10px rgba(255, 46, 147, 0.35);
    min-height: 36px;
}

.game-tile-cta::after {
    content: '▶';
    font-size: 0.75rem;
}

.game-tile-cta:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 14px rgba(255, 46, 147, 0.45);
}

/* Legacy Game Card Large - kept for compatibility (not used in new layout) */
.game-card-large {
    background: var(--bg-white);
    border-radius: 32px;
    overflow: hidden;
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.25);
    transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    cursor: pointer;
    position: relative;
    border: 4px solid transparent;
    width: 100%;
    max-width: 450px;
}

.game-card-large::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color), var(--accent-color));
    border-radius: 32px;
    opacity: 0;
    z-index: -1;
    transition: opacity 0.5s ease;
}

/* Shimmer effect on hover */
.game-card-large::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        45deg,
        transparent 30%,
        rgba(255, 255, 255, 0.3) 50%,
        transparent 70%
    );
    opacity: 0;
    transform: rotate(45deg);
    transition: opacity 0.5s ease;
}

.game-card-large:hover::after {
    opacity: 1;
    animation: shimmer 1.5s ease-in-out;
}

@keyframes shimmer {
    0% {
        transform: translateX(-100%) translateY(-100%) rotate(45deg);
    }
    100% {
        transform: translateX(100%) translateY(100%) rotate(45deg);
    }
}

.game-card-large:hover {
    transform: translateY(-16px) scale(1.03);
    box-shadow: 0 25px 70px rgba(0, 0, 0, 0.35), var(--shadow-glow);
}

.game-card-large:hover::before {
    opacity: 1;
}

.game-card-large:active {
    transform: translateY(-10px) scale(1.01);
    transition: all 0.2s ease;
}

.game-thumbnail {
    position: relative;
    width: 100%;
    padding-top: 60%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    overflow: hidden;
}

/* Different gradient for each legacy game card */
.game-card-large:nth-child(1) .game-thumbnail {
    background: linear-gradient(135deg, #FF6B9D 0%, #FFA06B 100%);
}

.game-card-large:nth-child(2) .game-thumbnail {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.game-card-large:nth-child(3) .game-thumbnail {
    background: linear-gradient(135deg, #06D6A0 0%, #06BCA0 100%);
}

.game-icon-large {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 8rem;
    animation: float 4s ease-in-out infinite;
    filter: drop-shadow(0 10px 25px rgba(0, 0, 0, 0.3));
    text-shadow: 0 0 40px rgba(255, 255, 255, 0.5);
}

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

.game-card-large:hover .game-icon-large {
    animation: floatFast 1.5s ease-in-out infinite;
}

@keyframes floatFast {
    0%, 100% { transform: translate(-50%, -50%) translateY(0) rotate(0deg) scale(1); }
    50% { transform: translate(-50%, -50%) translateY(-20px) rotate(8deg) scale(1.1); }
}

.play-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.4s ease, backdrop-filter 0.4s ease;
    backdrop-filter: blur(0px);
}

.game-card-large:hover .play-overlay {
    opacity: 1;
    backdrop-filter: blur(4px);
}

.play-button {
    width: 100px;
    height: 100px;
    background: linear-gradient(135deg, #FFFFFF 0%, #F8F9FA 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.8rem;
    color: var(--primary-color);
    padding-left: 8px;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.4);
    animation: playPulse 2s ease-in-out infinite;
    transition: all 0.3s ease;
    border: 4px solid rgba(255, 255, 255, 0.8);
}

.play-button:hover {
    transform: scale(1.15);
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.5);
    border-color: white;
}

@keyframes playPulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 15px 40px rgba(0, 0, 0, 0.4), 0 0 0 0 rgba(255, 46, 147, 0.7);
    }
    50% {
        transform: scale(1.1);
        box-shadow: 0 15px 40px rgba(0, 0, 0, 0.4), 0 0 0 15px rgba(255, 46, 147, 0);
    }
}

.game-info {
    padding: 2rem 2.25rem 2.25rem;
}

.game-title {
    font-family: var(--font-heading);
    font-size: 1.9rem;
    margin-bottom: 1rem;
    color: var(--text-dark);
    line-height: 1.3;
    background: linear-gradient(135deg, var(--text-dark), var(--primary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.game-age-badge {
    display: inline-block;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    padding: 0.6rem 1.4rem;
    border-radius: 30px;
    font-size: 0.95rem;
    font-weight: 800;
    margin-bottom: 1.15rem;
    box-shadow: 0 6px 18px rgba(255, 46, 147, 0.4);
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.game-age-badge:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(255, 46, 147, 0.5);
}

.game-age-badge.featured {
    background: linear-gradient(135deg, var(--accent-color), #FFA500);
    animation: badgePulse 2.5s ease-in-out infinite;
    box-shadow: 0 6px 18px rgba(255, 190, 11, 0.5);
}

@keyframes badgePulse {
    0%, 100% {
        box-shadow: 0 6px 18px rgba(255, 190, 11, 0.5);
        transform: scale(1);
    }
    50% {
        box-shadow: 0 8px 28px rgba(255, 190, 11, 0.7), 0 0 0 8px rgba(255, 190, 11, 0.2);
        transform: scale(1.05);
    }
}

.game-description {
    color: var(--text-gray);
    margin-bottom: 1.25rem;
    line-height: 1.7;
    font-size: 1.05rem;
}

.game-stats {
    display: flex;
    gap: 1.75rem;
    padding-top: 1.25rem;
    border-top: 3px solid transparent;
    border-image: linear-gradient(90deg, var(--primary-color), var(--secondary-color)) 1;
    margin-top: 0.75rem;
}

.stat {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    background: linear-gradient(135deg, rgba(255, 46, 147, 0.08), rgba(131, 56, 236, 0.08));
    padding: 0.6rem 1rem;
    border-radius: 20px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.stat:hover {
    transform: translateY(-3px);
    background: linear-gradient(135deg, rgba(255, 46, 147, 0.15), rgba(131, 56, 236, 0.15));
    box-shadow: 0 6px 15px rgba(255, 46, 147, 0.2);
}

.stat-icon {
    font-size: 1.6rem;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.stat-value {
    font-weight: 800;
    color: var(--text-dark);
    font-size: 1.05rem;
}

/* Account Info - Enhanced Design */
.account-info {
    display: flex;
    justify-content: center;
    margin-top: var(--spacing-xl);
    padding: 0 1rem;
}

.info-card {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 2rem 2.5rem;
    border-radius: 24px;
    box-shadow: var(--shadow-lg);
    min-width: 400px;
    border: 2px solid var(--glass-border);
    position: relative;
    overflow: hidden;
}

.info-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color), var(--accent-color));
}

.info-card h3 {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    color: var(--text-dark);
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.info-row {
    display: flex;
    justify-content: space-between;
    padding: 1rem 0;
    border-bottom: 2px solid rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

.info-row:hover {
    padding-left: 0.5rem;
    background: rgba(255, 46, 147, 0.03);
    border-radius: 8px;
}

.info-row:last-child {
    border-bottom: none;
}

.info-label {
    font-weight: 700;
    color: var(--text-gray);
    font-size: 1rem;
}

.info-value {
    color: var(--text-dark);
    font-weight: 800;
    font-size: 1rem;
}

/* Loading Overlay - Enhanced */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.95) 0%, rgba(118, 75, 162, 0.95) 100%);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.loading-overlay.active {
    display: flex;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.spinner {
    width: 70px;
    height: 70px;
    border: 7px solid rgba(255, 255, 255, 0.2);
    border-top-color: var(--accent-color);
    border-right-color: var(--primary-color);
    border-radius: 50%;
    animation: spinGradient 1s cubic-bezier(0.68, -0.55, 0.265, 1.55) infinite;
    box-shadow: 0 0 30px rgba(255, 190, 11, 0.4);
}

@keyframes spinGradient {
    0% {
        transform: rotate(0deg);
        border-top-color: var(--accent-color);
        border-right-color: var(--primary-color);
    }
    50% {
        border-top-color: var(--primary-color);
        border-right-color: var(--secondary-color);
    }
    100% {
        transform: rotate(360deg);
        border-top-color: var(--accent-color);
        border-right-color: var(--primary-color);
    }
}

.loading-overlay p {
    color: white;
    font-size: 1.35rem;
    margin-top: 1.5rem;
    font-weight: 700;
    font-family: var(--font-heading);
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    animation: textPulse 1.5s ease-in-out infinite;
}


@keyframes textPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.8; transform: scale(1.05); }
}

/* Mobile Responsive - Systematic Scaling */
@media (max-width: 768px) {
    /* Header - Proportional Scaling */
    .header {
        padding: clamp(0.7rem, 2vw, 1rem) 0;
    }

    .logo {
        font-size: clamp(1.2rem, 4vw, 1.5rem);
        gap: clamp(0.4rem, 1.5vw, 0.6rem);
    }

    .logo-icon {
        font-size: clamp(1.5rem, 5vw, 2rem);
    }

    .user-section {
        gap: clamp(0.5rem, 2vw, 1rem);
    }

    .user-name {
        font-size: clamp(0.8rem, 2.5vw, 0.95rem);
    }

    .btn-nav {
        padding: clamp(0.5rem, 1.5vw, 0.7rem) clamp(0.8rem, 2.5vw, 1.2rem);
        font-size: clamp(0.8rem, 2.5vw, 0.95rem);
        min-width: 44px;
        min-height: 44px;
    }

    .btn-logout {
        padding: clamp(0.4rem, 1.5vw, 0.6rem) clamp(0.9rem, 2.8vw, 1.2rem);
        font-size: clamp(0.8rem, 2.5vw, 0.95rem);
        min-width: 44px;
        min-height: 44px;
    }

    /* Welcome Section */
    .welcome-section {
        margin-bottom: clamp(2rem, 6vw, 3rem);
        padding: 0 1rem;
    }

    .welcome-title {
        font-size: clamp(1.6rem, 6vw, 2.5rem);
        margin-bottom: clamp(0.6rem, 2vw, 1rem);
    }

    .welcome-subtitle {
        font-size: clamp(0.95rem, 3.2vw, 1.2rem);
    }

    /* Games layout - single column age sections, tiles adapt */
    .main-content {
        padding: clamp(1.5rem, 5vw, 3rem) 0;
    }

    .games-dashboard {
        gap: 1.5rem;
    }

    .age-section {
        padding: 1.1rem 1rem 1.3rem;
        border-radius: 18px;
    }

    .age-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.35rem;
    }

    .games-tiles {
        grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
        gap: 1.25rem;
    }

    .game-tile {
        padding: 0.8rem 0.85rem 0.95rem;
    }

    .game-tile-title {
        font-size: 1rem;
    }

    .game-tile-desc {
        font-size: 0.85rem;
    }

    .game-tile-meta {
        font-size: 0.8rem;
    }

    /* Account Info Section */
    .account-info {
        margin-top: clamp(2rem, 6vw, 3rem);
        padding: 0 1rem;
    }

    .info-card {
        min-width: auto;
        width: 100%;
        max-width: 550px;
        padding: clamp(1.2rem, 4vw, 1.8rem);
        border-radius: clamp(14px, 3.5vw, 16px);
    }

    .info-card h3 {
        font-size: clamp(1.1rem, 3.5vw, 1.25rem);
        margin-bottom: clamp(1rem, 3vw, 1.5rem);
    }

    .info-row {
        padding: clamp(0.7rem, 2.5vw, 1rem) 0;
    }

    .info-label,
    .info-value {
        font-size: clamp(0.85rem, 2.8vw, 1rem);
    }

    /* Loading Overlay */
    .spinner {
        width: clamp(45px, 12vw, 60px);
        height: clamp(45px, 12vw, 60px);
        border-width: clamp(4px, 1.5vw, 6px);
    }

    .loading-overlay p {
        font-size: clamp(1rem, 3.5vw, 1.25rem);
        margin-top: clamp(0.8rem, 2.5vw, 1.2rem);
    }

}

/* Extra Small Screens */
@media (max-width: 380px) {
    .header .container {
        padding: 0 0.8rem;
    }

    .logo-text {
        font-size: 1.1rem;
    }

    .user-name {
        display: none;
    }

    .games-grid {
        padding: 0 0.5rem;
    }

    .game-info {
        padding: 1rem;
    }

    .game-stats {
        flex-direction: column;
        gap: 0.8rem;
    }
}

/* Touch Optimization */
@media (hover: none) {
    .btn-logout:hover,
    .logo:hover,
    .game-card-large:hover {
        transform: none;
    }

    .btn-logout:active {
        transform: scale(0.97);
    }

    .game-card-large:active {
        transform: scale(0.98);
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    }

    .play-overlay {
        opacity: 0.9;
    }

    .btn-nav:active {
        transform: scale(0.95);
    }
}

/* Reduce heavy animations and shadows on small screens for smoother mobile gameplay */
@media (max-width: 768px) {
    body::before,
    .game-icon-large,
    .play-button,
    .welcome-title {
        animation: none !important;
        box-shadow: none;
    }

    body {
        background-attachment: scroll;
    }
}

/* Enhanced Accessibility - Larger Touch Targets for Kids */
.btn-nav,
.btn-logout,
.game-card-large {
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

/* Improve readability on all screen sizes */
@media (min-width: 769px) and (max-width: 1024px) {
    .games-grid {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
        gap: 1.5rem;
    }

    .game-card-large {
        max-width: 380px;
    }
}
