/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Comic Neue', cursive;
    background: #2E8B57; /* Jungle green background */
    min-height: 100vh;
    min-height: 100dvh; /* dynamic viewport height for mobile browsers */
    color: #333;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
}

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

/* Header Styles */
.header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 0.3rem 0;
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

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

.logo {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.logo-text {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.logo h1 {
    font-family: 'Fredoka One', cursive;
    font-size: 1.8rem;
    color: #FFD700; /* Sunlight yellow */
    text-shadow: 2px 2px 0 #8B4513; /* Earth brown shadow */
    margin-bottom: 0;
}

.logo p {
    color: #666;
    font-size: 0.8rem;
    margin-bottom: 0;
}

.header-mascot {
    max-width: 80px;
    height: auto;
    margin: 0;
    transition: transform 0.3s ease, filter 0.3s ease;
}

.header-mascot:hover {
    transform: scale(1.1) rotate(5deg);
    filter: drop-shadow(0 0 10px rgba(255, 215, 0, 0.8)); /* Sunlight yellow */
}

.nav {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

/* Hamburger menu button (hidden on desktop, shown on mobile) */
.menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 44px;
    height: 44px;
    padding: 9px;
    background: #fff3e0;
    border: 2px solid #8B4513;
    border-radius: 12px;
    cursor: pointer;
    flex-shrink: 0;
}
.menu-toggle span {
    display: block;
    height: 3px;
    width: 100%;
    background: #8B4513;
    border-radius: 3px;
    transition: all 0.3s ease;
}
.menu-toggle.active span:nth-child(1) { transform: translateY(8px) rotate(45deg); }
.menu-toggle.active span:nth-child(2) { opacity: 0; }
.menu-toggle.active span:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }

.nav ul {
    display: flex;
    list-style: none;
    gap: 0.8rem;
}

.nav-link {
    text-decoration: none;
    color: #333;
    font-weight: 700;
    font-size: 0.9rem;
    padding: 0.25rem 0.8rem;
    border-radius: 20px;
    transition: all 0.3s ease;
    position: relative;
}

.nav-link:hover {
    background: #FFD700; /* Sunlight yellow */
    color: #333;
    transform: translateY(-2px);
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 50%;
    width: 0;
    height: 3px;
    background: #8B4513; /* Earth brown */
    transition: all 0.3s ease;
    transform: translateX(-50%);
}

.nav-link:hover::after {
    width: 80%;
}

/* Active navigation link */
.nav-link.active {
    background: #8B4513; /* Earth brown */
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(139, 69, 19, 0.3);
}

.nav-link.active::after {
    width: 80%;
    background: white;
}

/* Main Content */
.main {
    padding: 0.3rem 0;
    flex: 1;
}

.section {
    display: none;
    animation: fadeIn 0.5s ease-in;
}

.section.active {
    display: block;
}

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

/* Hero Section */
.hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 1.5rem;
    align-items: center;
    min-height: 0;
    padding: 0.8rem 20px;
    flex: 1;
}

.hero-content h2 {
    font-family: 'Fredoka One', cursive;
    font-size: 3.5rem;
    color: white;
    text-shadow: 3px 3px 0 #8B4513; /* Earth brown */
    margin-bottom: 1rem;
    line-height: 1.2;
}

.hero-content p {
    font-size: 1.3rem;
    color: white;
    margin-bottom: 2rem;
    opacity: 0.9;
}

.hero-buttons {
    display: flex;
    gap: 0.5rem;
    flex-wrap: nowrap;
}
/* Character images overlapping buttons */
.button-with-image {
    position: relative;
    display: inline-block;
}

.character-img {
    position: absolute;
    z-index: 10;
    pointer-events: none;
    width: 100px;
    height: auto;
    transform: translateY(-50%);
    transition: transform 0.3s ease, filter 0.3s ease;
}

.character-abc {
    top: -50px;
    left: 50%;
    transform: translateX(-50%) translateY(-50%);
}

.character-reading {
    top: -50px;
    left: 50%;
    transform: translateX(-50%) translateY(-50%);
}

.character-math {
    top: -50px;
    left: 50%;
    transform: translateX(-50%) translateY(-50%);
}

.character-games {
    top: -50px;
    left: 50%;
    transform: translateX(-50%) translateY(-50%);
}

.character-progress {
    top: -50px;
    left: 50%;
    transform: translateX(-50%) translateY(-50%);
}

/* Hover effects for character images */
.button-with-image:hover .character-abc,
.button-with-image:hover .character-reading,
.button-with-image:hover .character-math,
.button-with-image:hover .character-games,
.button-with-image:hover .character-progress {
    transform: translateX(-50%) translateY(-50%) scale(1.2) rotate(5deg);
    filter: drop-shadow(0 0 8px rgba(255, 215, 0, 0.6)); /* Sunlight yellow */
}

/* Adjust hero-buttons to accommodate images */
.hero-buttons {
    align-items: flex-start;
    padding-top: 80px;
}

.hero-buttons .btn {
    padding: 0.8rem 1.5rem;
    font-size: 1rem;
}

.btn {
    padding: 1rem 2rem;
    border: none;
    border-radius: 50px;
    font-family: 'Comic Neue', cursive;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
    text-align: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.btn-primary {
    background: #8B4513; /* Earth brown */
    color: white;
}

.btn-secondary {
    background: #228B22; /* Canopy green */
    color: white;
}

.btn-tertiary {
    background: #FFD700; /* Sunlight yellow */
    color: #333;
}

.btn-quaternary {
    background: #2E8B57; /* Jungle green */
    color: white;
}

.btn-progress {
    background: #8A2BE2; /* Progress purple */
    color: white;
}

.btn-sound {
    background: #87CEEB; /* Sky blue */
    color: white;
    padding: 0.8rem 1.5rem;
    font-size: 1rem;
}

/* Floating Letters Animation */
.floating-letters {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    perspective: 1000px;
}

.floating-letters span {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 80px;
    height: 80px;
    background: white;
    border-radius: 20px;
    font-family: 'Fredoka One', cursive;
    font-size: 2.5rem;
    color: #8B4513; /* Earth brown */
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
    animation: float 3s ease-in-out infinite;
    cursor: pointer;
    transition: all 0.3s ease;
}

.floating-letters span:hover {
    transform: scale(1.1) rotate(5deg);
    background: #FFD700; /* Sunlight yellow */
}

.floating-letters span:nth-child(1) { animation-delay: 0s; }
.floating-letters span:nth-child(2) { animation-delay: 0.5s; }
.floating-letters span:nth-child(3) { animation-delay: 1s; }
.floating-letters span:nth-child(4) { animation-delay: 1.5s; }
.floating-letters span:nth-child(5) { animation-delay: 2s; }
.floating-letters span:nth-child(6) { animation-delay: 2.5s; }

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

/* Section Headers */
.section-header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.section-header h2 {
    font-family: 'Fredoka One', cursive;
    font-size: 2.5rem;
    color: white;
    text-shadow: 2px 2px 0 #8B4513; /* Earth brown */
    margin-bottom: 1rem;
}

.section-header p {
    font-size: 1.2rem;
    color: white;
    opacity: 0.9;
}

.title-with-image {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

.section-header-image {
    width: 100px;
    height: auto;
    filter: drop-shadow(2px 2px 0 #FFD700); /* Sunlight yellow */
    transition: transform 0.3s ease, filter 0.3s ease;
}

.section-header-image:hover {
    transform: scale(1.15) rotate(5deg);
    filter: drop-shadow(0 0 12px rgba(255, 215, 0, 0.8)) drop-shadow(2px 2px 0 #FFD700); /* Sunlight yellow */
}


/* Game Cards */
.reading-games,
.math-games,
.fun-games {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 1rem;
}

.game-card {
    background: rgba(255, 255, 255, 0.95);
    padding: 1.5rem;
    border-radius: 25px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    position: relative;
    min-height: 140px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    border: 3px solid transparent;
}

.game-card:hover,
.game-card:active {
    transform: translateY(-8px);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.25);
    background: white;
    border-color: #FFD700; /* Sunlight yellow */
}

.game-card h3 {
    font-family: 'Fredoka One', cursive;
    font-size: 1.8rem;
    color: #8B4513; /* Earth brown */
    margin-bottom: 0.75rem;
    line-height: 1.2;
}

.game-card p {
    color: #666;
    font-size: 1.1rem;
    line-height: 1.4;
}

/* Game Card Mascot */
.game-card-mascot {
    position: absolute;
    z-index: 10;
    width: 100px;
    height: auto;
    left: -30px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    transition: transform 0.3s ease, filter 0.3s ease;
}

.game-card:hover .game-card-mascot {
    transform: translateY(-50%) scale(1.2) rotate(10deg);
    filter: drop-shadow(0 0 8px rgba(255, 215, 0, 0.6)); /* Sunlight yellow */
}

/* Alligator mascot adjustment */
.mascot-aligator {
    left: -50px;
    top: 40%;
}

.game-card:hover .mascot-aligator {
    transform: translateY(-50%) scale(1.2) rotate(10deg);
}

/* Bear mascot adjustment */
.mascot-bear {
    top: 65%;
}

.game-card:hover .mascot-bear {
    transform: translateY(-50%) scale(1.2) rotate(10deg);
}

/* Tiger mascot adjustment */
.mascot-tiger {
    left: -40px;
    top: 50%;
}

.game-card:hover .mascot-tiger {
    transform: translateY(-50%) scale(1.2) rotate(10deg);
}

/* Footer */
.footer {
    background: rgba(255, 255, 255, 0.9);
    padding: 0.4rem 0;
    text-align: center;
    margin-top: 0.8rem;
}

.footer p {
    color: #666;
    font-size: 1rem;
}

/* Responsive Design - iPad (1024px and below) */
@media (max-width: 1024px) {
    .hero-content h2 {
        font-size: 3rem;
    }
    .hero-content p {
        font-size: 1.2rem;
    }
    .hero {
        gap: 2rem;
        padding: 1.5rem 20px;
    }
    .hero-buttons {
        gap: 0.8rem;
    }
    .character-img {
        width: 100px;
    }
    .character-abc,
    .character-reading,
    .character-math,
    .character-games {
        top: -50px;
    }
    .hero-buttons {
        padding-top: 80px;
    }
    
    /* iPad specific improvements */
    .btn {
        min-height: 44px; /* Minimum touch target height */
        min-width: 44px; /* Minimum touch target width */
    }
    
    /* Improve button spacing for iPad */
    .hero-buttons {
        justify-content: center;
    }
    
    /* Adjust floating letters for iPad */
    .floating-letters span {
        width: 70px;
        height: 70px;
        font-size: 2.2rem;
    }
}
@media (max-width: 768px) {
    /* iPad portrait and smaller tablets */
    .header .container {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 0.4rem;
    }

    .logo {
        flex: 1 1 auto;
    }

    .menu-toggle {
        display: flex;
        margin-left: auto;
    }

    .nav {
        order: 3;
        flex-basis: 100%;
        justify-content: center;
        flex-wrap: wrap;
        margin-top: 0.25rem;
    }

    /* Collapse the link list into a hamburger dropdown */
    .nav ul {
        display: none;
        width: 100%;
        flex-direction: column;
        gap: 0.5rem;
        padding: 0.5rem 0;
        border-top: 2px dashed #f0d9a8;
    }
    .header.nav-open .nav ul {
        display: flex;
    }

    .nav-link {
        padding: 0.4rem 0.7rem;
        font-size: 0.95rem;
    }
    
    .hero {
        grid-template-columns: 1fr;
        text-align: center;
        padding: 1rem 15px;
    }
    
    .hero-content h2 {
        font-size: 2.5rem;
        line-height: 1.1;
        margin-bottom: 0.8rem;
    }
    
    .hero-content p {
        font-size: 1.1rem;
        margin-bottom: 1.5rem;
    }
    
    .section-header h2 {
        font-size: 2.2rem;
    }
    
    .hero-buttons {
        justify-content: center;
        flex-wrap: wrap;
        gap: 0.8rem;
        padding-top: 70px;
    }
    
    /* Adjust character images for tablet */
    .character-img {
        width: 90px;
    }
    .character-abc,
    .character-reading,
    .character-math,
    .character-games {
        top: -45px;
    }
    
    /* Improve button sizing for touch */
    .btn {
        padding: 0.9rem 1.6rem;
        font-size: 1rem;
        min-height: 44px;
        min-width: 44px;
    }
    
    .hero-buttons .btn {
        padding: 0.9rem 1.4rem;
        font-size: 0.95rem;
    }
    
    .reading-games,
    .math-games,
    .fun-games {
        grid-template-columns: 1fr;
        gap: 1rem;
        padding: 0 0.5rem;
    }
    
    .game-card {
        padding: 1.25rem;
        min-height: 120px;
        border-width: 2px;
    }
    
    .game-card h3 {
        font-size: 1.6rem;
        margin-bottom: 0.5rem;
    }
    
    .game-card p {
        font-size: 1rem;
    }
    
    /* Reduce tiger image size on tablet */
    .header-mascot {
        max-width: 70px;
    }
    
    /* Adjust ABC header image for tablet */
    .section-header-image {
        width: 80px;
    }
    
    /* Adjust game card mascot for tablet */
    .game-card-mascot {
        width: 80px;
        left: -20px;
    }
    
    /* Alligator mascot adjustment for tablet */
    .mascot-aligator {
        left: -40px;
        top: 35%;
    }
    
    /* Bear mascot adjustment for tablet */
    .mascot-bear {
        top: 60%;
    }
    
    /* Tiger mascot adjustment for tablet */
    .mascot-tiger {
        left: -30px;
        top: 45%;
    }
    
    /* Floating letters adjustment for tablet */
    .floating-letters {
        gap: 0.8rem;
        margin-top: 1.5rem;
    }
    
    .floating-letters span {
        width: 60px;
        height: 60px;
        font-size: 2rem;
    }
}

/* iPhone and small mobile devices */
@media (max-width: 480px) {
    .logo h1 {
        font-size: 1.6rem;
        text-align: center;
    }
    
    .logo p {
        font-size: 0.75rem;
        text-align: center;
    }
    
    .nav ul {
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.4rem;
    }
    
    .nav-link {
        padding: 0.3rem 0.7rem;
        font-size: 0.85rem;
        min-height: 40px; /* Minimum touch target height for mobile */
        min-width: 40px; /* Minimum touch target width for mobile */
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    /* Improve game cards for iPhone */
    .reading-games,
    .math-games,
    .fun-games {
        grid-template-columns: 1fr;
        gap: 0.75rem;
        padding: 0 0.25rem;
    }
    
    .game-card {
        padding: 1rem;
        min-height: 100px;
        border-radius: 20px;
    }
    
    .game-card h3 {
        font-size: 1.4rem;
        margin-bottom: 0.4rem;
    }
    
    .game-card p {
        font-size: 0.9rem;
    }
    
    .hero {
        padding: 0.8rem 10px;
        min-height: auto;
    }
    
    .hero-content h2 {
        font-size: 1.8rem;
        line-height: 1.1;
        margin-bottom: 0.6rem;
        text-shadow: 2px 2px 0 #8B4513;
    }
    
    .hero-content p {
        font-size: 1rem;
        margin-bottom: 1.2rem;
    }
    
    .btn {
        padding: 0.8rem 1.2rem;
        font-size: 0.95rem;
        min-height: 44px;
        min-width: 44px;
        border-radius: 25px;
    }
    
    /* Adjust character images for mobile */
    .character-img {
        width: 70px;
    }
    
    .character-abc,
    .character-reading,
    .character-math,
    .character-games {
        top: -35px;
    }
    
    .hero-buttons {
        padding-top: 60px;
        gap: 0.5rem;
        flex-wrap: wrap;
        justify-content: center;
    }
    
    /* Stack buttons vertically on very small screens */
    @media (max-width: 360px) {
        .hero-buttons {
            flex-direction: column;
            align-items: center;
            gap: 0.8rem;
        }
        
        .button-with-image {
            width: 100%;
            max-width: 250px;
        }
        
        .btn {
            width: 100%;
        }
    }
    
    /* Further reduce tiger image size on mobile */
    .header-mascot {
        max-width: 50px;
    }
    
    /* Adjust ABC header image for mobile */
    .section-header-image {
        width: 60px;
    }
    
    /* Adjust game card mascot for mobile */
    .game-card-mascot {
        width: 60px;
        left: -15px;
    }
    
    /* Alligator mascot adjustment for mobile */
    .mascot-aligator {
        left: -30px;
        top: 30%;
    }
    
    /* Bear mascot adjustment for mobile */
    .mascot-bear {
        top: 55%;
    }
    
    /* Tiger mascot adjustment for mobile */
    .mascot-tiger {
        left: -20px;
        top: 40%;
    }
    
    /* Floating letters adjustment for mobile */
    .floating-letters {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.6rem;
        margin-top: 1rem;
    }
    
    .floating-letters span {
        width: 50px;
        height: 50px;
        font-size: 1.8rem;
        border-radius: 15px;
    }
    
    /* Improve footer for mobile */
    .footer p {
        font-size: 0.9rem;
        padding: 0 10px;
    }
}

/* iPad landscape specific optimizations */
@media (min-width: 769px) and (max-width: 1024px) and (orientation: landscape) {
    .hero {
        grid-template-columns: 1fr 1fr;
        gap: 1.5rem;
        padding: 1rem 20px;
    }
    
    .hero-content h2 {
        font-size: 2.8rem;
    }
    
    .hero-buttons {
        gap: 0.6rem;
        flex-wrap: nowrap;
    }
    
    .btn {
        padding: 0.8rem 1.2rem;
        font-size: 0.95rem;
        min-height: 44px;
        min-width: 44px;
    }
    
    .character-img {
        width: 90px;
    }
    
    /* Reading section optimizations for iPad landscape */
    .reading-games,
    .math-games,
    .fun-games {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.25rem;
        max-width: 900px;
    }
    
    .game-card {
        padding: 1.25rem;
        min-height: 120px;
    }
    
    .game-card h3 {
        font-size: 1.6rem;
    }
    
    .game-card p {
        font-size: 1rem;
    }
}

/* iPad portrait specific optimizations */
@media (min-width: 769px) and (max-width: 1024px) and (orientation: portrait) {
    .reading-games,
    .math-games,
    .fun-games {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
        max-width: 800px;
    }
    
    .game-card {
        padding: 1.5rem;
        min-height: 130px;
    }
    
    .game-card h3 {
        font-size: 1.7rem;
    }
    
    .game-card p {
        font-size: 1.05rem;
    }
    
    /* Improve header for iPad portrait */
    .header .container {
        flex-direction: row;
    }
    
    .nav ul {
        gap: 1rem;
    }
    
    .nav-link {
        padding: 0.4rem 0.9rem;
        font-size: 0.95rem;
        min-height: 44px;
        min-width: 44px;
    }
}

/* iPhone landscape optimizations */
@media (max-width: 768px) and (orientation: landscape) {
    .hero {
        grid-template-columns: 1fr 1fr;
        gap: 1rem;
        padding: 0.8rem 15px;
    }

    .hero-content h2 {
        font-size: 2rem;
    }

    .hero-buttons {
        flex-wrap: nowrap;
        gap: 0.5rem;
        padding-top: 60px;
    }

    .character-img {
        width: 70px;
    }

    .character-abc,
    .character-reading,
    .character-math,
    .character-games {
        top: -35px;
    }

    .floating-letters {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.5rem;
    }

    .floating-letters span {
        width: 50px;
        height: 50px;
        font-size: 1.8rem;
    }
}

/* Sound toggle button */
.sound-toggle {
    background: none;
    border: 2px solid #8B4513;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    color: #8B4513;
    min-width: 44px;
    min-height: 44px;
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.sound-toggle:hover {
    background: #FFD700;
    transform: scale(1.1);
    border-color: #FFD700;
}

.sound-toggle.muted {
    background: #e74c3c;
    border-color: #e74c3c;
    color: white;
}

.sound-toggle.muted:hover {
    background: #c0392b;
    border-color: #c0392b;
    transform: scale(1.1);
}

/* Custom confirmation modal */
.confirm-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 5000;
    display: none;
    backdrop-filter: blur(3px);
}

.confirm-overlay.active {
    display: block;
}

.confirm-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) translateZ(0);
    width: 90vw;
    max-width: 420px;
    background: white;
    border-radius: 25px;
    padding: 2rem;
    z-index: 5001;
    display: none;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.4);
    text-align: center;
}

.confirm-modal.active {
    display: block;
}

.confirm-modal h3 {
    font-family: 'Fredoka One', cursive;
    font-size: 1.6rem;
    color: #8B4513;
    margin-bottom: 1rem;
}

.confirm-modal p {
    font-size: 1.1rem;
    color: #555;
    margin-bottom: 1.5rem;
    line-height: 1.4;
}

.confirm-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.confirm-btn {
    padding: 0.8rem 2rem;
    border: none;
    border-radius: 50px;
    font-family: 'Comic Neue', cursive;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1rem;
    min-height: 44px;
    min-width: 100px;
}

.confirm-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.confirm-btn.confirm-yes {
    background: #e74c3c;
    color: white;
}

.confirm-btn.confirm-yes:hover {
    background: #c0392b;
}

.confirm-btn.confirm-no {
    background: #95a5a6;
    color: white;
}

.confirm-btn.confirm-no:hover {
    background: #7f8c8d;
}

.confirm-btn.confirm-ok {
    background: #8B4513;
    color: white;
}

.confirm-btn.confirm-ok:hover {
    background: #A0522D;
}

/* iOS Safe Area Support */
@supports (padding: max(0px)) {
    .header,
    .footer,
    .main {
        padding-left: max(0.75rem, env(safe-area-inset-left));
        padding-right: max(0.75rem, env(safe-area-inset-right));
    }
    
    .header {
        padding-top: max(0.5rem, env(safe-area-inset-top));
    }
    
    .footer {
        padding-bottom: max(0.75rem, env(safe-area-inset-bottom));
    }
}

/* Prevent iOS text size adjustment */
html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

/* Improve tap highlight on iOS */
button,
a,
input,
select,
textarea {
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}

/* Prevent callout on iOS */
.no-callout {
    -webkit-touch-callout: none;
}

/* Prevent user selection */
.no-select {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* Auth styles */
.auth-btn {
    background: #8B4513;
    color: white;
    border: none;
    border-radius: 20px;
    padding: 0.25rem 0.8rem;
    font-family: 'Comic Neue', cursive;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    min-height: 44px;
    min-width: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    white-space: nowrap;
}

.auth-btn:hover {
    background: #A0522D;
    transform: translateY(-2px);
}

.auth-btn.logged-in {
    background: #228B22;
}

.auth-btn.logged-in:hover {
    background: #2E8B57;
}

.auth-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 9000;
    backdrop-filter: blur(3px);
}

.auth-overlay.active {
    display: block;
}

.auth-modal {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) translateZ(0);
    width: 90vw;
    max-width: 400px;
    background: white;
    border-radius: 25px;
    padding: 2rem;
    z-index: 9001;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.4);
    text-align: center;
    max-height: 90vh;
    overflow-y: auto;
}

.auth-modal.active {
    display: block;
}

.auth-modal h2 {
    font-family: 'Fredoka One', cursive;
    font-size: 1.8rem;
    color: #8B4513;
    margin-bottom: 0.5rem;
}

.auth-modal p {
    color: #666;
    margin-bottom: 1.5rem;
    font-size: 1rem;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.auth-form label {
    text-align: left;
    font-weight: 700;
    color: #333;
    font-size: 0.95rem;
}

.auth-form input {
    padding: 0.8rem 1rem;
    border: 2px solid #ddd;
    border-radius: 12px;
    font-family: 'Comic Neue', cursive;
    font-size: 1rem;
    transition: border-color 0.3s ease;
    outline: none;
}

.auth-form input:focus {
    border-color: #8B4513;
}

.auth-form .btn {
    margin-top: 0.5rem;
}

.auth-toggle {
    background: none;
    border: none;
    color: #8B4513;
    font-weight: 700;
    cursor: pointer;
    font-family: 'Comic Neue', cursive;
    font-size: 0.95rem;
    margin-top: 1rem;
    text-decoration: underline;
}

.auth-toggle:hover {
    color: #A0522D;
}

.auth-error {
    color: #e74c3c;
    font-size: 0.9rem;
    min-height: 1.3rem;
}

.auth-success {
    color: #27ae60;
    font-size: 0.9rem;
    min-height: 1.3rem;
}

.auth-user-info {
    display: none;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: #333;
    font-weight: 700;
}

.auth-user-info.visible {
    display: flex;
}

.auth-user-icon {
    font-size: 1.2rem;
}

.auth-logout-btn {
    background: none;
    border: 1px solid #e74c3c;
    color: #e74c3c;
    border-radius: 12px;
    padding: 2px 8px;
    font-size: 0.75rem;
    font-family: 'Comic Neue', cursive;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    min-height: 30px;
}

.auth-logout-btn:hover {
    background: #e74c3c;
    color: white;
}

@media (max-width: 768px) {
    .auth-modal {
        padding: 1.5rem;
    }
    .auth-modal h2 {
        font-size: 1.5rem;
    }
}

/* Locked Game Card state */
.game-card.locked {
    cursor: default;
    opacity: 0.75;
    position: relative;
    overflow: hidden;
}

.game-card.locked::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.08);
    border-radius: 22px;
    z-index: 1;
}

.game-card.locked:hover,
.game-card.locked:active {
    transform: none;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    border-color: transparent;
}

.game-card.locked .lock-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 2;
    font-size: 2.5rem;
    opacity: 0.9;
    pointer-events: none;
}

.game-card.locked:hover .lock-overlay {
    animation: shake 0.4s ease;
}

.game-card.locked .signin-prompt {
    display: none;
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(139, 69, 19, 0.95);
    color: white;
    padding: 0.5rem;
    font-size: 0.85rem;
    font-weight: 700;
    z-index: 3;
    border-radius: 0 0 22px 22px;
    cursor: pointer;
}

.game-card.locked:hover .signin-prompt {
    display: block;
}

.game-card .free-badge {
    display: none;
    position: absolute;
    top: 10px;
    right: 10px;
    background: #2ecc71;
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 700;
    z-index: 2;
    box-shadow: 0 2px 8px rgba(46, 204, 113, 0.4);
}



@keyframes shake {
    0%, 100% { transform: translate(-50%, -50%) rotate(0deg); }
    25% { transform: translate(-50%, -50%) rotate(-10deg); }
    75% { transform: translate(-50%, -50%) rotate(10deg); }
}

@media (max-width: 768px) {
    .game-card.locked .signin-prompt {
        display: block;
        font-size: 0.75rem;
        padding: 0.4rem;
    }
}

/* Auth Gate - Inline upsell banner */
.auth-gate {
    display: none;
}

.auth-gate.active {
    display: block;
}

.auth-gate-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 1.2rem 1.5rem;
    margin: 1.5rem auto;
    max-width: 800px;
    background: linear-gradient(135deg, #8B4513, #A0522D);
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    flex-wrap: wrap;
    text-align: center;
}

.auth-gate-icon {
    font-size: 2rem;
    flex-shrink: 0;
}

.auth-gate-text {
    flex: 1;
    min-width: 200px;
}

.auth-gate-text h3 {
    font-family: 'Fredoka One', cursive;
    font-size: 1.2rem;
    color: #FFD700;
    margin-bottom: 0.2rem;
}

.auth-gate-text p {
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.9);
    margin: 0;
}

.auth-gate-btn {
    background: #FFD700;
    color: #8B4513;
    border: none;
    border-radius: 50px;
    padding: 0.7rem 1.8rem;
    font-family: 'Fredoka One', cursive;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    flex-shrink: 0;
    white-space: nowrap;
}

.auth-gate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.3);
    background: #FFE44D;
}

@media (max-width: 768px) {
    .auth-gate-content {
        flex-direction: column;
        padding: 1rem;
        margin: 1rem;
    }
    .auth-gate-text h3 {
        font-size: 1.1rem;
    }
    .auth-gate-text p {
        font-size: 0.85rem;
    }
}

/* Trial Upgrade Modal */
.trial-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 9500;
    backdrop-filter: blur(3px);
}

.trial-overlay.active {
    display: block;
}

.trial-modal {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) translateZ(0);
    width: 90vw;
    max-width: 420px;
    background: white;
    border-radius: 25px;
    padding: 2.5rem 2rem;
    z-index: 9501;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.4);
    text-align: center;
}

.trial-modal.active {
    display: block;
}

.trial-modal-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.trial-modal h2 {
    font-family: 'Fredoka One', cursive;
    font-size: 1.8rem;
    color: #8B4513;
    margin-bottom: 0.5rem;
}

.trial-modal p {
    color: #666;
    margin-bottom: 1.5rem;
    font-size: 1rem;
    line-height: 1.5;
}

.trial-modal .trial-signin-btn {
    background: #8B4513;
    color: white;
    border: none;
    border-radius: 50px;
    padding: 0.9rem 2.5rem;
    font-family: 'Fredoka One', cursive;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: block;
    width: 100%;
    margin-bottom: 0.8rem;
}

.trial-modal .trial-signin-btn:hover {
    background: #A0522D;
    transform: translateY(-2px);
}

.trial-modal .trial-close-btn {
    background: none;
    border: none;
    color: #999;
    font-family: 'Comic Neue', cursive;
    font-size: 0.95rem;
    cursor: pointer;
    text-decoration: underline;
    padding: 0.5rem;
}

.trial-modal .trial-close-btn:hover {
    color: #666;
}

@media (max-width: 768px) {
    .trial-modal {
        padding: 2rem 1.5rem;
    }
    .trial-modal h2 {
        font-size: 1.5rem;
    }
}

/* Full-screen gate variant (for progress page) */
.auth-gate-full {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #2E8B57, #228B22);
    /* Below the header (z-index 1000) so the nav stays visible and usable
       while a signed-out user is being asked to sign in. */
    z-index: 500;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 20px;
}

.auth-gate-full.active {
    display: flex;
}

.auth-gate-full .auth-gate-content {
    max-width: 500px;
    padding: 2rem;
    flex-direction: column;
    background: none;
    box-shadow: none;
    margin: 0;
}

.auth-gate-full .auth-gate-icon {
    font-size: 5rem;
    margin-bottom: 1rem;
}

.auth-gate-full .auth-gate-text h3 {
    font-family: 'Fredoka One', cursive;
    font-size: 2.5rem;
    color: white;
    margin-bottom: 0.5rem;
    text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.2);
}

.auth-gate-full .auth-gate-text p {
    font-size: 1.2rem;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 0;
    line-height: 1.6;
}

.auth-gate-full .auth-gate-btn {
    padding: 1rem 2.5rem;
    font-size: 1.3rem;
}

@media (max-width: 768px) {
    .auth-gate-full .auth-gate-text h3 {
        font-size: 2rem;
    }
    .auth-gate-full .auth-gate-text p {
        font-size: 1rem;
    }
    .auth-gate-full .auth-gate-icon {
        font-size: 4rem;
    }
}

/* Counting game objects rendered inside modals / quick games */
.counting-image {
    width: 80px;
    height: 80px;
    object-fit: contain;
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    margin: 0 0.25rem;
}