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

body {
    font-family: 'Comic Sans MS', 'Chalkboard', sans-serif;
    background: linear-gradient(135deg, #ffd6e7 0%, #c9a7eb 50%, #a7d3f3 100%);
    min-height: 100vh;
    overflow: hidden;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    position: relative;
}

body::before {
    content: '🦄';
    position: fixed;
    top: 10px;
    left: 10px;
    font-size: 3rem;
    opacity: 0.3;
    animation: floatUnicorn 4s ease-in-out infinite;
}

body::after {
    content: '🦄';
    position: fixed;
    bottom: 10px;
    right: 10px;
    font-size: 3rem;
    opacity: 0.3;
    animation: floatUnicorn 4s ease-in-out infinite 2s;
}

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

#app {
    width: 100%;
    height: 100vh;
    max-width: 600px;
    margin: 0 auto;
    position: relative;
}

.screen {
    display: none;
    width: 100%;
    height: 100%;
    padding: 20px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.screen.active {
    display: flex;
}

/* Menu Screen */
#menu-screen h1 {
    color: #9b59b6;
    font-size: 2.5rem;
    text-shadow: 2px 2px 0 #fff, 4px 4px 0 rgba(155, 89, 182, 0.2);
    margin-bottom: 30px;
    text-align: center;
}

.menu-buttons {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    width: 100%;
    max-width: 400px;
    padding: 10px;
}

.game-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 15px 10px;
    font-size: 1rem;
    border: none;
    border-radius: 20px;
    background: linear-gradient(135deg, #fff 0%, #ffe6f2 100%);
    color: #9b59b6;
    cursor: pointer;
    transition: transform 0.1s, box-shadow 0.1s;
    box-shadow: 0 6px 0 rgba(155, 89, 182, 0.3);
    border: 3px solid #e9b3d1;
    min-height: 100px;
}

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

.btn-emoji {
    font-size: 2.5rem;
}

.btn-text {
    font-weight: bold;
    font-size: 0.85rem;
    text-align: center;
    line-height: 1.2;
}

.stars-display {
    margin-top: 30px;
    font-size: 1.5rem;
    color: #9b59b6;
    background: rgba(255,255,255,0.7);
    padding: 10px 25px;
    border-radius: 50px;
    border: 2px solid #e9b3d1;
}

.music-btn {
    margin-top: 15px;
    width: 60px;
    height: 60px;
    font-size: 2rem;
    border: none;
    border-radius: 50%;
    background: rgba(255,255,255,0.7);
    cursor: pointer;
    box-shadow: 0 4px 0 rgba(155, 89, 182, 0.3);
    border: 2px solid #e9b3d1;
    transition: transform 0.1s;
}

.music-btn:active {
    transform: translateY(3px);
    box-shadow: 0 1px 0 rgba(155, 89, 182, 0.3);
}

/* Game Screen */
#game-screen {
    justify-content: flex-start;
    padding-top: 10px;
}

.game-header {
    display: flex;
    align-items: center;
    gap: 15px;
    width: 100%;
    margin-bottom: 20px;
}

.back-btn {
    font-size: 2rem;
    background: white;
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    cursor: pointer;
    box-shadow: 0 4px 0 rgba(0,0,0,0.2);
}

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

.progress-bar {
    flex: 1;
    height: 20px;
    background: rgba(255,255,255,0.3);
    border-radius: 10px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: #4ade80;
    border-radius: 10px;
    transition: width 0.3s ease;
    width: 0%;
}

.game-header .stars-display {
    margin: 0;
    padding: 8px 15px;
    font-size: 1.2rem;
}

#game-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    gap: 20px;
}

/* Comparison Game */
.comparison-container {
    display: flex;
    gap: 20px;
    width: 100%;
    justify-content: center;
}

.choice-box {
    background: white;
    border-radius: 20px;
    padding: 20px;
    min-width: 140px;
    min-height: 180px;
    display: flex;
    flex-wrap: wrap;
    align-content: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    transition: transform 0.1s, box-shadow 0.1s;
    box-shadow: 0 6px 0 rgba(0,0,0,0.2);
}

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

.choice-box.correct {
    background: #4ade80;
    animation: pulse 0.5s ease;
}

.choice-box.wrong {
    background: #f87171;
    animation: shake 0.5s ease;
}

.choice-box .emoji {
    font-size: 2rem;
}

/* Addition/Subtraction Game */
.math-display {
    background: white;
    border-radius: 20px;
    padding: 30px;
    text-align: center;
    width: 90%;
    max-width: 400px;
}

.emoji-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin: 15px 0;
    min-height: 60px;
}

.emoji-row .emoji {
    font-size: 2.5rem;
    transition: all 0.3s ease;
}

.emoji-row .emoji.flying {
    animation: flyAway 0.8s ease forwards;
}

.math-symbol {
    font-size: 2rem;
    color: #666;
    margin: 10px 0;
}

.number-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin-top: 20px;
}

.number-btn {
    width: 80px;
    height: 80px;
    font-size: 2.2rem;
    font-weight: bold;
    border: none;
    border-radius: 20px;
    background: linear-gradient(135deg, #d891ef 0%, #a78bfa 100%);
    color: white;
    cursor: pointer;
    box-shadow: 0 6px 0 rgba(155, 89, 182, 0.4);
    transition: transform 0.1s;
    border: 3px solid #c77dff;
}

.number-btn:active {
    transform: translateY(3px);
    box-shadow: 0 1px 0 rgba(0,0,0,0.2);
}

.number-btn.correct {
    background: #4ade80;
}

.number-btn.wrong {
    background: #f87171;
}

/* Counting Game */
.counting-area {
    background: white;
    border-radius: 20px;
    padding: 30px;
    min-height: 200px;
    width: 90%;
    max-width: 400px;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-content: center;
    gap: 15px;
}

.counting-area .emoji {
    font-size: 3rem;
    cursor: pointer;
    transition: transform 0.2s;
}

.counting-area .emoji.counted {
    transform: scale(1.3);
    animation: bounce 0.3s ease;
}

.count-display {
    font-size: 3rem;
    color: white;
    background: rgba(255,255,255,0.2);
    padding: 10px 30px;
    border-radius: 20px;
    margin-top: 20px;
}

/* Feedback */
.feedback {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 5rem;
    z-index: 100;
    animation: popIn 0.5s ease;
}

.feedback.hidden {
    display: none;
}

/* Celebration Screen */
#celebration-screen {
    background: linear-gradient(135deg, #ffe6f7 0%, #e0b3ff 50%, #b3e0ff 100%);
}

#celebration-screen::before {
    content: '🦄✨🌈✨🦄';
    position: absolute;
    top: 50px;
    font-size: 2.5rem;
    animation: sparkle 1s ease-in-out infinite;
}

@keyframes sparkle {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.7; transform: scale(1.1); }
}

.celebration-content {
    text-align: center;
    z-index: 10;
}

.celebration-content h1 {
    color: white;
    font-size: 3rem;
    text-shadow: 3px 3px 0 rgba(0,0,0,0.2);
    margin-bottom: 20px;
}

.big-stars {
    font-size: 4rem;
    margin: 20px 0;
}

.celebration-content p {
    color: white;
    font-size: 1.5rem;
    margin-bottom: 20px;
}

.tap-hint {
    font-size: 1.2rem !important;
    opacity: 0.9;
    animation: pulse 1.5s ease-in-out infinite;
}

#celebration-screen {
    cursor: pointer;
}

#confetti {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
}

.confetti-piece {
    position: absolute;
    width: 15px;
    height: 15px;
    top: -20px;
    animation: confettiFall 3s linear forwards;
}

/* Animations */
@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

@keyframes bounce {
    0%, 100% { transform: scale(1.3); }
    50% { transform: scale(1.5); }
}

@keyframes popIn {
    0% { transform: translate(-50%, -50%) scale(0); opacity: 0; }
    50% { transform: translate(-50%, -50%) scale(1.3); }
    100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

@keyframes flyAway {
    0% { transform: translateY(0) rotate(0); opacity: 1; }
    100% { transform: translateY(-100px) rotate(20deg); opacity: 0; }
}

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

/* Patterns Game */
.pattern-row {
    gap: 5px !important;
}

.pattern-row .mystery {
    animation: pulse 1s ease-in-out infinite;
}

.emoji-btn {
    font-size: 2rem !important;
}

/* Shapes Game */
.shapes-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-top: 20px;
}

.shape-btn {
    width: 90px;
    height: 90px;
    font-size: 3rem;
    border: none;
    border-radius: 20px;
    background: linear-gradient(135deg, #fff 0%, #ffe6f2 100%);
    cursor: pointer;
    box-shadow: 0 6px 0 rgba(155, 89, 182, 0.3);
    transition: transform 0.1s;
    border: 3px solid #e9b3d1;
}

.shape-btn:active {
    transform: translateY(4px);
    box-shadow: 0 2px 0 rgba(155, 89, 182, 0.3);
}

.shape-btn.correct {
    background: #4ade80 !important;
    border-color: #22c55e;
}

.shape-btn.wrong {
    background: #f87171 !important;
    border-color: #ef4444;
}

/* Sorting Game */
.sorting-row {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 20px;
    min-height: 150px;
    padding: 20px;
}

.sort-btn {
    border: none;
    border-radius: 15px;
    background: linear-gradient(135deg, #fff 0%, #ffe6f2 100%);
    cursor: pointer;
    box-shadow: 0 6px 0 rgba(155, 89, 182, 0.3);
    transition: transform 0.1s;
    border: 3px solid #e9b3d1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sort-btn.size-small {
    width: 50px;
    height: 50px;
    font-size: 1.5rem;
}

.sort-btn.size-medium {
    width: 75px;
    height: 75px;
    font-size: 2.2rem;
}

.sort-btn.size-large {
    width: 100px;
    height: 100px;
    font-size: 3rem;
}

.sort-btn:active {
    transform: translateY(4px);
    box-shadow: 0 2px 0 rgba(155, 89, 182, 0.3);
}

.sort-btn.correct {
    background: #4ade80 !important;
    border-color: #22c55e;
}

.sort-btn.wrong {
    background: #f87171 !important;
    border-color: #ef4444;
}

/* Mobile adjustments */
@media (max-width: 400px) {
    #menu-screen h1 {
        font-size: 2rem;
    }
    
    .game-btn {
        padding: 15px 20px;
        font-size: 1.1rem;
    }
    
    .choice-box {
        min-width: 120px;
        min-height: 150px;
        padding: 15px;
    }
    
    .choice-box .emoji {
        font-size: 1.5rem;
    }
}
