:root {
    --color-bg: #E0F7FA;
    --color-text: #2B2D42;
    --color-white: #FFFFFF;

    --color-blue: #4CC9F0;
    --color-pink: #F72585;
    --color-yellow: #FFD166;
    /* Warmer yellow */
    --color-green: #06D6A0;
    --color-purple: #7209B7;

    --font-main: 'Fredoka', sans-serif;

    --shadow-soft: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-pop: 0 8px 15px rgba(0, 0, 0, 0.15);
}

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    /* Prevent text selection for game feel */
}

body {
    margin: 0;
    padding: 0;
    font-family: var(--font-main);
    background-color: var(--color-bg);
    color: var(--color-text);
    overflow: hidden;
    /* Prevent scrolling */
    height: 100vh;
    width: 100vw;
}

#app {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    background: radial-gradient(circle at center, #ffffff 0%, var(--color-bg) 100%);
}

.screen-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

/* Typography */
h1 {
    font-size: 3rem;
    color: var(--color-purple);
    margin-bottom: 1rem;
    text-shadow: 2px 2px 0px rgba(255, 255, 255, 0.5);
}

h2 {
    font-size: 2rem;
    color: var(--color-blue);
}

/* Animations */
@keyframes bounce {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-15px);
    }
}

.bounce {
    animation: bounce 2s infinite ease-in-out;
}

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

    80% {
        transform: scale(1.1);
        opacity: 1;
    }

    100% {
        transform: scale(1);
    }
}

.pop-in {
    animation: popIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-10px);
    }

    75% {
        transform: translateX(10px);
    }
}

.shake {
    animation: shake 0.3s ease-in-out;
}

@keyframes celebrate {
    0% {
        transform: scale(1) rotate(0deg);
    }

    50% {
        transform: scale(1.2) rotate(10deg);
    }

    100% {
        transform: scale(1) rotate(0deg);
    }
}

.celebrate {
    animation: celebrate 0.5s ease-in-out;
}

/* Components */
.btn {
    background: var(--color-white);
    border: none;
    border-radius: 20px;
    padding: 15px 30px;
    font-family: var(--font-main);
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--color-text);
    box-shadow: 0 6px 0px rgba(0, 0, 0, 0.1);
    transition: transform 0.1s, box-shadow 0.1s;
    cursor: pointer;
    margin: 10px;
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.btn:active {
    transform: translateY(4px);
    box-shadow: 0 2px 0px rgba(0, 0, 0, 0.1);
}

.btn-primary {
    background: var(--color-blue);
    color: white;
    box-shadow: 0 6px 0px #3aa1c0;
}

.btn-primary:active {
    box-shadow: 0 2px 0px #3aa1c0;
}

.btn-secondary {
    background: var(--color-pink);
    color: white;
    box-shadow: 0 6px 0px #c71f6b;
}

.btn-secondary:active {
    box-shadow: 0 2px 0px #c71f6b;
}

.icon {
    font-size: 2rem;
}

/* Home Screen Grid */
.module-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    padding: 20px;
    width: 100%;
    max-width: 600px;
}

/* Game Header */
.game-header {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 10;
}

.back-btn {
    font-size: 1.5rem;
    background: #fff;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-soft);
    cursor: pointer;
}

/* Game Area */
.game-area {
    width: 100%;
    max-width: 800px;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding-top: 60px;
    /* Space for header */
}

/* Footer */
.footer-link {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 1.2rem;
    color: var(--color-blue);
    text-decoration: none;
    font-weight: bold;
    background: rgba(255, 255, 255, 0.9);
    padding: 8px 20px;
    border-radius: 25px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    transition: all 0.2s;
    z-index: 1000;
}

.footer-link:active {
    transform: translateX(-50%) scale(0.95);
    background: #fff;
}

/* Responsive */
@media (min-width: 768px) {
    .module-grid {
        grid-template-columns: repeat(2, 1fr);
        /* Still 2x2 but larger cards */
        gap: 30px;
    }

    .btn {
        font-size: 2rem;
        padding: 20px 40px;
    }
}

@media (max-width: 480px) {
    h1 {
        font-size: 2.5rem;
    }

    h2 {
        font-size: 1.5rem;
    }

    .btn {
        padding: 10px 20px;
        font-size: 1.2rem;
    }

    .options-grid {
        gap: 10px;
    }

    .footer-link {
        bottom: 10px;
        font-size: 1rem;
    }

    /* Mobile Fix for Modules */
    .game-area {
        padding-top: 50px;
        justify-content: center;
    }

    .abc-game,
    .num-game,
    .shapes-game,
    .words-game {
        gap: 10px;
        width: 100%;
    }

    .target-display {
        width: 110px;
        height: 110px;
        font-size: 4rem;
    }

    .letter-btn,
    .num-btn {
        width: 55px;
        height: 55px;
        font-size: 1.8rem;
    }

    /* Shapes Fix - More compact and higher up */
    .shapes-game {
        height: 100%;
        justify-content: center;
        gap: 10px;
    }

    .target-zone {
        flex: 0;
        min-height: 140px;
    }

    .ghost-shape {
        width: 100px;
        height: 100px;
    }

    .ghost-shape svg {
        width: 60px;
        height: 60px;
    }

    .draggables {
        padding-bottom: 5px;
        flex-wrap: wrap;
        gap: 8px;
        order: 2;
    }

    .draggable-item {
        width: 60px;
        height: 60px;
    }

    .instruction {
        font-size: 1.2rem;
        margin-top: 5px;
    }
}

/* Sparkle/Pop Animation */
.sparkle {
    position: absolute;
    pointer-events: none;
    z-index: 2000;
    font-size: 2rem;
    animation: sparkle-anim 0.8s forwards ease-out;
}

@keyframes sparkle-anim {
    0% {
        transform: scale(0) translate(0, 0);
        opacity: 0;
    }

    50% {
        opacity: 1;
    }

    100% {
        transform: scale(1.5) translate(var(--dx), var(--dy));
        opacity: 0;
    }
}