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

body {
    font-family: 'Avenir Next Rounded', 'Avenir Next', 'Nunito', 'Helvetica Rounded', 'Trebuchet MS', 'Arial Rounded MT Bold', 'Comic Sans MS', system-ui, -apple-system, sans-serif;
    background: linear-gradient(180deg, #87CEEB 0%, #98D8AA 100%);
    min-height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.game-container {
    text-align: center;
    position: relative;
    width: 100%;
    min-height: 300px;
    cursor: pointer;
}

.sky-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    transition: background 0.5s ease;
}

.home-button {
    position: fixed;
    top: 20px;
    right: 20px;
    background: linear-gradient(180deg, #FF6B6B 0%, #EE5A5A 100%);
    color: #fff;
    padding: 14px 22px;
    border-radius: 18px;
    font-size: 18px;
    border: none;
    cursor: pointer;
    box-shadow: 0 5px 0 #CC4444;
    transition: transform 0.1s, box-shadow 0.1s;
}

.home-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 7px 0 #CC4444;
}

.home-button:active {
    transform: translateY(2px);
    box-shadow: 0 3px 0 #CC4444;
}

.level-indicator {
    position: fixed;
    top: 20px;
    left: 20px;
    background: #4ECDC4;
    color: white;
    padding: 15px 25px;
    border-radius: 20px;
    font-size: 24px;
    box-shadow: 0 4px 0 #3BA99C;
}

.height-meter {
    position: fixed;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    width: 30px;
    height: 300px;
    background: rgba(255,255,255,0.5);
    border-radius: 15px;
    overflow: hidden;
}

.height-fill {
    position: absolute;
    bottom: 0;
    width: 100%;
    background: linear-gradient(180deg, #FFE66D, #FF6B6B);
    border-radius: 15px;
    transition: height 0.5s ease;
}

.word-display {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin: 50px 0;
    perspective: 1000px;
    transition: transform 0.3s ease, opacity 0.3s ease;
    flex-wrap: wrap;
    padding: 0 10px;
    position: relative;
}

.word-display.shake {
    animation: wordShake 0.4s ease;
}

.word-display.exit-down {
    animation: exitDown 0.5s ease forwards;
}

.word-display.enter-from-top {
    animation: enterFromTop 0.6s ease forwards;
}

@keyframes wordShake {
    0%, 100% { transform: translateY(0); }
    25% { transform: translateY(3px); }
    50% { transform: translateY(-2px); }
    75% { transform: translateY(1px); }
}

@keyframes exitDown {
    0% { 
        transform: translateY(0) scale(1); 
        opacity: 1;
    }
    100% { 
        transform: translateY(300px) scale(0.5); 
        opacity: 0;
    }
}

@keyframes enterFromTop {
    0% { 
        transform: translateY(-300px) scale(0.5); 
        opacity: 0;
    }
    60% {
        transform: translateY(20px) scale(1.05);
        opacity: 1;
    }
    80% {
        transform: translateY(-10px) scale(1);
    }
    100% { 
        transform: translateY(0) scale(1); 
        opacity: 1;
    }
}

.letter-platform {
    width: 120px;
    height: 120px;
    background: linear-gradient(180deg, #96CEB4 0%, #588157 100%);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 72px;
    font-weight: bold;
    color: white;
    text-shadow: 3px 3px 0 #2D5016;
    box-shadow: 0 10px 0 #3A5A40, 0 15px 25px rgba(0,0,0,0.2);
    position: relative;
    transition: all 0.3s ease, transform 0.2s ease;
}

.letter-platform.completed {
    background: linear-gradient(180deg, #FFE66D 0%, #F4A261 100%);
    box-shadow: 0 10px 0 #E76F51, 0 15px 25px rgba(0,0,0,0.2);
    transform: scale(1.05);
}

.letter-platform.current {
    background: linear-gradient(180deg, #FF6B6B 0%, #CC5555 100%);
    box-shadow: 0 10px 0 #993333, 0 15px 25px rgba(0,0,0,0.2);
    animation: pulse 1s infinite;
}

.letter-platform.wrong {
    animation: shake 0.5s ease;
    background: linear-gradient(180deg, #E63946 0%, #9D0208 100%);
}

.letter-platform.bounce {
    animation: platformBounce 0.3s ease;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.08); }
}

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

@keyframes platformBounce {
    0% { transform: translateY(0) scale(1); }
    30% { transform: translateY(5px) scale(1.02, 0.98); }
    60% { transform: translateY(-3px) scale(0.98, 1.02); }
    100% { transform: translateY(0) scale(1); }
}

/* Cute Chick */
.chick-container {
    position: absolute;
    transition: left 0.4s ease, top 0.3s ease;
    z-index: 100;
}

.chick-container.hidden {
    opacity: 0;
    pointer-events: none;
}

.chick {
    width: 60px;
    height: 55px;
    position: relative;
    animation: idle 0.5s infinite ease-in-out;
}

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

.chick-body {
    width: 50px;
    height: 45px;
    background: linear-gradient(180deg, #FFE66D 0%, #FFD93D 100%);
    border-radius: 50% 50% 45% 45%;
    position: absolute;
    bottom: 10px;
    left: 5px;
    box-shadow: inset -5px -5px 10px rgba(255,200,0,0.5);
}

.chick-belly {
    width: 35px;
    height: 25px;
    background: #FFF8DC;
    border-radius: 50%;
    position: absolute;
    bottom: 5px;
    left: 50%;
    transform: translateX(-50%);
}

.chick-eye {
    width: 12px;
    height: 14px;
    background: #1a1a2e;
    border-radius: 50%;
    position: absolute;
    top: 8px;
}

.chick-eye::after {
    content: '';
    width: 4px;
    height: 4px;
    background: white;
    border-radius: 50%;
    position: absolute;
    top: 2px;
    left: 2px;
}

.chick-eye.left { left: 8px; }
.chick-eye.right { right: 8px; }

.chick-beak {
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 12px solid #FF6B35;
    position: absolute;
    top: 18px;
    left: 50%;
    transform: translateX(-50%);
}

.chick-wing {
    width: 15px;
    height: 20px;
    background: #F4D03F;
    border-radius: 50% 50% 50% 20%;
    position: absolute;
    bottom: 15px;
}

.chick-wing.left {
    left: -5px;
    transform: rotate(-20deg);
}

.chick-wing.right {
    right: -5px;
    transform: rotate(20deg) scaleX(-1);
}

.chick-feet {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
}

.chick-foot {
    width: 12px;
    height: 8px;
    background: #FF6B35;
    border-radius: 0 0 50% 50%;
}

.chick-cheek {
    width: 10px;
    height: 8px;
    background: rgba(255, 150, 150, 0.6);
    border-radius: 50%;
    position: absolute;
    top: 20px;
}

.chick-cheek.left { left: 3px; }
.chick-cheek.right { right: 3px; }

/* Jumping animations */
.chick.jumping {
    animation: jump 0.4s ease;
}

.chick.big-jump {
    animation: bigJump 0.8s ease;
}

.chick.wrong-jump {
    animation: wrongJump 0.4s ease;
}

@keyframes jump {
    0% { transform: translateY(0) scale(1); }
    20% { transform: translateY(5px) scale(1.1, 0.9); }
    50% { transform: translateY(-50px) scale(0.9, 1.1); }
    80% { transform: translateY(-10px) scale(1.05); }
    100% { transform: translateY(0) scale(1); }
}

@keyframes bigJump {
    0% { transform: translateY(0) scale(1); }
    15% { transform: translateY(20px) scale(1.1, 0.9); }
    30% { transform: translateY(-200px) scale(0.9, 1.2); }
    50% { transform: translateY(-350px) scale(1.1) rotate(180deg); }
    70% { transform: translateY(-450px) scale(1.2) rotate(360deg); }
    100% { transform: translateY(-600px) scale(0.8) rotate(360deg); }
}

@keyframes dropIn {
    0% { transform: translateY(-300px) scale(1.2); }
    60% { transform: translateY(20px) scale(1); }
    80% { transform: translateY(-10px) scale(1); }
    100% { transform: translateY(0) scale(1); }
}

.chick.drop-in {
    animation: dropIn 0.6s ease-out forwards;
}

@keyframes wrongJump {
    0% { transform: translateY(0) rotate(0deg); }
    25% { transform: translateY(-20px) rotate(-10deg); }
    75% { transform: translateY(-20px) rotate(10deg); }
    100% { transform: translateY(0) rotate(0deg); }
}

/* Success celebration */
.celebration {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 72px;
    color: #FFE66D;
    text-shadow: 3px 3px 0 #FF6B6B;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    text-align: center;
}

.celebration.show {
    animation: celebrate 1s ease forwards;
}

@keyframes celebrate {
    0% { opacity: 0; transform: translate(-50%, -50%) scale(0.5); }
    50% { opacity: 1; transform: translate(-50%, -50%) scale(1.2); }
    100% { opacity: 0; transform: translate(-50%, -50%) scale(1.5); }
}

/* Clouds */
.cloud {
    position: fixed;
    background: white;
    border-radius: 50px;
    opacity: 0.8;
    z-index: -1;
}

.cloud::before, .cloud::after {
    content: '';
    position: absolute;
    background: white;
    border-radius: 50%;
}

.instructions {
    position: fixed;
    bottom: 30px;
    background: rgba(255,255,255,0.9);
    padding: 15px 30px;
    border-radius: 20px;
    font-size: 18px;
    color: #333;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.start-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(180deg, #87CEEB 0%, #98D8AA 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.start-screen h1 {
    font-size: 64px;
    color: #FF6B6B;
    text-shadow: 4px 4px 0 #FFE66D;
    margin-bottom: 30px;
}

.start-btn {
    background: linear-gradient(180deg, #4ECDC4 0%, #44A08D 100%);
    color: white;
    border: none;
    padding: 20px 60px;
    font-size: 32px;
    font-family: inherit;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 6px 0 #2D7A6E;
    transition: transform 0.1s, box-shadow 0.1s;
}

.start-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 0 #2D7A6E;
}

.start-btn:active {
    transform: translateY(2px);
    box-shadow: 0 4px 0 #2D7A6E;
}

.sound-toggle {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: #FFE66D;
    border: none;
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 18px;
    cursor: pointer;
    box-shadow: 0 4px 0 #F4A261;
}

.keyboard-toggle {
    position: fixed;
    top: 70px;
    left: 50%;
    transform: translateX(-50%);
    background: #FFE66D;
    border: none;
    padding: 8px 16px;
    border-radius: 16px;
    font-size: 14px;
    cursor: pointer;
    box-shadow: 0 4px 0 #F4A261;
}

.language-buttons {
    display: flex;
    gap: 20px;
    margin-top: 20px;
}

.lang-btn {
    background: linear-gradient(180deg, #FF6B6B 0%, #EE5A5A 100%);
    color: white;
    border: none;
    padding: 15px 40px;
    font-size: 24px;
    font-family: inherit;
    border-radius: 30px;
    cursor: pointer;
    box-shadow: 0 5px 0 #CC4444;
    transition: transform 0.1s, box-shadow 0.1s;
}

.lang-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 7px 0 #CC4444;
}

.lang-btn:active {
    transform: translateY(2px);
    box-shadow: 0 3px 0 #CC4444;
}

.lang-btn.polish {
    background: linear-gradient(180deg, #DC143C 0%, #B22222 100%);
    box-shadow: 0 5px 0 #8B0000;
}

.lang-btn.polish:hover {
    box-shadow: 0 7px 0 #8B0000;
}

.lang-btn.polish:active {
    box-shadow: 0 3px 0 #8B0000;
}

.lang-btn.english {
    background: linear-gradient(180deg, #3366CC 0%, #2255AA 100%);
    box-shadow: 0 5px 0 #1A4488;
}

.lang-btn.english:hover {
    box-shadow: 0 7px 0 #1A4488;
}

.lang-btn.english:active {
    box-shadow: 0 3px 0 #1A4488;
}

.mode-buttons {
    display: flex;
    gap: 14px;
    margin: 8px 0 24px;
}

.mode-btn {
    background: linear-gradient(180deg, #f3f4f6 0%, #e2e8f0 100%);
    color: #2d3748;
    border: none;
    padding: 12px 26px;
    font-size: 18px;
    font-family: inherit;
    border-radius: 18px;
    cursor: pointer;
    box-shadow: 0 4px 0 #d69f27;
    transition: transform 0.1s, box-shadow 0.1s, background 0.15s;
}

.mode-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 0 #d69f27;
}

.mode-btn:active {
    transform: translateY(2px);
    box-shadow: 0 3px 0 #d69f27;
}

.mode-btn.active,
.lang-btn.active {
    transform: translateY(-3px);
    box-shadow: 0 8px 0 rgba(0,0,0,0.28);
}

.lang-btn.active {
    background: linear-gradient(180deg, #ffb347 0%, #ff8c42 100%);
    color: #3b1d00;
    outline: 3px solid rgba(255,255,255,0.7);
}

.mode-btn.active {
    background: linear-gradient(180deg, #ffd54f 0%, #ff9e00 100%);
    color: #241400;
    outline: 3px solid rgba(255,255,255,0.75);
}

.language-indicator {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: #9B59B6;
    color: white;
    padding: 8px 20px;
    border-radius: 15px;
    font-size: 16px;
    box-shadow: 0 3px 0 #7D3C98;
}

/* Mobile responsive styles */
@media (max-width: 768px) {
    .letter-platform {
        width: 80px;
        height: 80px;
        font-size: 48px;
        border-radius: 15px;
        box-shadow: 0 6px 0 #3A5A40, 0 10px 15px rgba(0,0,0,0.2);
    }

    .letter-platform.completed {
        box-shadow: 0 6px 0 #E76F51, 0 10px 15px rgba(0,0,0,0.2);
    }

    .letter-platform.current {
        box-shadow: 0 6px 0 #993333, 0 10px 15px rgba(0,0,0,0.2);
    }

    .word-display {
        gap: 8px;
        margin: 30px 0;
    }

    .chick-container {
        transform: scale(0.8);
    }

    .home-button, .level-indicator {
        font-size: 16px;
        padding: 10px 15px;
    }

    .level-indicator {
        top: 10px;
        left: 10px;
    }

    .home-button {
        top: 10px;
        right: 10px;
    }

    .height-meter {
        display: none;
    }

    .sound-toggle {
        font-size: 14px;
        padding: 8px 15px;
    }
    
    .keyboard-toggle {
        top: 56px;
        font-size: 12px;
        padding: 7px 12px;
    }

    .language-indicator {
        top: 60px;
        font-size: 14px;
    }

    .instructions {
        font-size: 14px;
        padding: 10px 20px;
        bottom: 20px;
    }

    .start-screen h1 {
        font-size: 36px;
    }

    .lang-btn {
        font-size: 18px;
        padding: 12px 25px;
    }

    .celebration {
        font-size: 48px;
    }
}

@media (max-width: 480px) {
    .letter-platform {
        width: 60px;
        height: 60px;
        font-size: 36px;
        border-radius: 12px;
    }

    .word-display {
        gap: 6px;
    }

    .chick-container {
        transform: scale(0.6);
    }

    .start-screen h1 {
        font-size: 28px;
    }

    .language-buttons {
        flex-direction: column;
        gap: 15px;
    }
}

/* Hidden input for mobile keyboard */
.mobile-input {
    position: fixed;
    top: -100px;
    left: 0;
    width: 100%;
    height: 50px;
    opacity: 0;
    pointer-events: none;
    font-size: 16px; /* Prevents zoom on iOS */
}

.tap-hint {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255,255,255,0.95);
    padding: 12px 25px;
    border-radius: 25px;
    font-size: 16px;
    color: #666;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    display: none;
    animation: tapPulse 2s infinite;
}

@keyframes tapPulse {
    0%, 100% { transform: translateX(-50%) scale(1); }
    50% { transform: translateX(-50%) scale(1.05); }
}

.tap-hint.show {
    display: block;
}

.on-screen-keyboard {
    position: fixed;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px;
    background: rgba(255,255,255,0.9);
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    max-width: 640px;
    width: calc(100% - 20px);
    z-index: 20;
    backdrop-filter: blur(6px);
}

.key-row {
    display: flex;
    justify-content: center;
    gap: 6px;
}

.key-btn {
    flex: 1 1 0;
    max-width: 52px;
    height: 48px;
    border: none;
    border-radius: 12px;
    background: linear-gradient(180deg, #ffe27a 0%, #ffc94a 100%);
    color: #5a3b00;
    font-size: 18px;
    font-weight: 700;
    box-shadow: 0 3px 0 #d69f27, 0 6px 15px rgba(0,0,0,0.12);
    cursor: pointer;
    transition: transform 0.05s ease, box-shadow 0.1s ease, background 0.2s ease;
}

.key-btn:active {
    transform: translateY(2px);
    box-shadow: 0 1px 0 #d69f27, 0 3px 10px rgba(0,0,0,0.12);
    background: linear-gradient(180deg, #ffd65f 0%, #ffbe33 100%);
}

@media (max-width: 480px) {
    .on-screen-keyboard {
        gap: 6px;
        padding: 10px;
        bottom: 6px;
    }
    
    .key-btn {
        max-width: 44px;
        height: 44px;
        font-size: 16px;
    }
}

.finish-screen {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 30;
    padding: 20px;
}

.finish-card {
    background: linear-gradient(180deg, #ffe27a 0%, #ffc94a 100%);
    border-radius: 24px;
    padding: 30px 28px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    max-width: 320px;
    width: 100%;
    animation: popIn 0.4s ease;
}

.finish-title {
    font-size: 28px;
    color: #5a3b00;
    margin-bottom: 10px;
}

.finish-button {
    background: linear-gradient(180deg, #4ECDC4 0%, #44A08D 100%);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 16px;
    font-size: 18px;
    cursor: pointer;
    box-shadow: 0 6px 0 #2D7A6E;
    transition: transform 0.1s, box-shadow 0.1s;
}

.finish-button:active {
    transform: translateY(2px);
    box-shadow: 0 3px 0 #2D7A6E;
}

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

.confetti-screen {
    position: fixed;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
    z-index: 25;
}

.confetti-piece {
    position: absolute;
    top: -12px;
    width: 8px;
    height: 14px;
    border-radius: 2px;
    opacity: 0;
    transform: translateY(0) rotate(0deg);
    animation: confettiFall var(--d, 0.95s) ease-out forwards;
    animation-delay: var(--delay, 0s);
    background: var(--c, #ff6b6b);
}

@keyframes confettiFall {
    0% { opacity: 0; transform: translate3d(0, -10px, 0) rotate(var(--r, 0deg)); }
    10% { opacity: 1; }
    100% { opacity: 1; transform: translate3d(var(--drift, 0px), 120vh, 0) rotate(calc(var(--r, 0deg) + 240deg)); }
}
