* {
    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%, #98D8C8 100%);
    min-height: 100vh;
    overflow: hidden;
}

/* Start Screen */
.start-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(180deg, #87CEEB 0%, #F0E68C 50%, #98D8C8 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 20px;
}

.start-screen h1 {
    font-size: 48px;
    color: #FF6B6B;
    text-shadow: 3px 3px 0 #fff, 5px 5px 0 rgba(0,0,0,0.1);
    margin-bottom: 20px;
}

.characters-preview {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 20px;
}

.character-icon {
    animation: bounce 1s ease-in-out infinite;
}

.character-icon.chick-icon {
    animation-delay: 0s;
}

.character-icon.cat-icon {
    animation-delay: 0.3s;
}

/* Preview characters on start screen - larger size */
.preview-chick, .preview-cat {
    transform: scale(1.4);
}

.heart-icon {
    font-size: 40px;
    animation: pulse-heart 1s ease-in-out infinite;
}

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

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

.story-text {
    font-size: 18px;
    color: #444;
    text-align: center;
    max-width: 500px;
    margin-bottom: 30px;
    line-height: 1.5;
}

.language-buttons {
    display: flex;
    gap: 15px;
    margin-bottom: 30px;
}

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

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

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

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

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

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

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

.lang-btn.active {
    transform: translateY(-3px);
    outline: 3px solid rgba(255, 255, 255, 0.8);
}

/* Level Selection Buttons */
.level-buttons {
    display: flex;
    gap: 15px;
    margin-bottom: 25px;
}

.level-btn {
    width: 60px;
    height: 60px;
    border: none;
    border-radius: 50%;
    background: linear-gradient(180deg, #9f7aea 0%, #805ad5 100%);
    color: white;
    font-size: 24px;
    font-weight: bold;
    font-family: inherit;
    cursor: pointer;
    box-shadow: 0 4px 0 #6b46c1;
    transition: transform 0.1s, box-shadow 0.1s;
}

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

.level-btn:active {
    transform: translateY(2px);
    box-shadow: 0 2px 0 #6b46c1;
}

.level-btn.active {
    background: linear-gradient(180deg, #ffd54f 0%, #ff9e00 100%);
    color: #241400;
    box-shadow: 0 4px 0 #cc7a00;
    outline: 3px solid rgba(255, 255, 255, 0.8);
    transform: translateY(-3px);
}

/* Obstacle Selection Buttons */
.obstacle-buttons {
    display: flex;
    gap: 15px;
    margin-bottom: 25px;
}

.obstacle-btn {
    width: 60px;
    height: 60px;
    border: none;
    border-radius: 50%;
    background: linear-gradient(180deg, #48bb78 0%, #38a169 100%);
    color: white;
    font-size: 24px;
    font-weight: bold;
    font-family: inherit;
    cursor: pointer;
    box-shadow: 0 4px 0 #2f855a;
    transition: transform 0.1s, box-shadow 0.1s;
}

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

.obstacle-btn:active {
    transform: translateY(2px);
    box-shadow: 0 2px 0 #2f855a;
}

.obstacle-btn.active {
    background: linear-gradient(180deg, #ffd54f 0%, #ff9e00 100%);
    color: #241400;
    box-shadow: 0 4px 0 #cc7a00;
    outline: 3px solid rgba(255, 255, 255, 0.8);
    transform: translateY(-3px);
}

.start-btn {
    background: linear-gradient(180deg, #4ECDC4 0%, #44A08D 100%);
    color: white;
    border: none;
    padding: 18px 50px;
    font-size: 28px;
    font-family: inherit;
    border-radius: 40px;
    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;
}

/* Game Container */
.game-container {
    display: none;
    width: 100%;
    height: 100vh;
    position: relative;
    overflow: hidden;
}

.sky {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 70%;
    background: linear-gradient(180deg, #87CEEB 0%, #B0E0E6 100%);
}

/* Game Header */
.game-header {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 20px;
    background: rgba(255, 255, 255, 0.95);
    padding: 12px 25px;
    border-radius: 30px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.15);
    z-index: 100;
}

.player-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.current-player-icon {
    font-size: 36px;
}

.player-name {
    font-size: 20px;
    font-weight: bold;
    color: #333;
}

.level-info {
    font-size: 18px;
    color: #666;
    font-weight: 500;
}

.progress-bar-container {
    width: 150px;
    height: 12px;
    background: #e0e0e0;
    border-radius: 6px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #4ECDC4, #44A08D);
    border-radius: 6px;
    transition: width 0.3s ease;
}

/* Game World */
.game-world {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 50%;
    min-height: 300px;
    overflow: hidden;
}

/* Parallax backgrounds */
.parallax-bg-far {
    position: absolute;
    top: 0;
    left: 0;
    width: 400%;
    height: 60%;
    transition: transform 0.1s linear;
}

.parallax-bg {
    position: absolute;
    top: 20%;
    left: 0;
    width: 400%;
    height: 50%;
    transition: transform 0.1s linear;
}

.cloud {
    position: absolute;
    font-size: 50px;
    opacity: 0.9;
}

.cloud1 { top: 5%; left: 5%; font-size: 60px; }
.cloud2 { top: 15%; left: 25%; font-size: 45px; }
.cloud3 { top: 8%; left: 45%; font-size: 55px; }
.cloud4 { top: 20%; left: 65%; font-size: 40px; }
.cloud5 { top: 10%; left: 85%; font-size: 50px; }

.mountain {
    position: absolute;
    bottom: 20%;
    font-size: 80px;
    opacity: 0.7;
}

.mountain1 { left: 10%; font-size: 100px; }
.mountain2 { left: 40%; font-size: 70px; }
.mountain3 { left: 70%; font-size: 90px; }

.tree {
    position: absolute;
    bottom: 0;
    font-size: 60px;
}

.tree1 { left: 5%; font-size: 70px; }
.tree2 { left: 15%; font-size: 55px; }
.tree3 { left: 30%; font-size: 65px; }
.tree4 { left: 45%; font-size: 50px; }
.tree5 { left: 55%; font-size: 70px; }
.tree6 { left: 70%; font-size: 55px; }
.tree7 { left: 82%; font-size: 65px; }
.tree8 { left: 95%; font-size: 60px; }

.bush {
    position: absolute;
    bottom: -5px;
    font-size: 35px;
}

.bush1 { left: 20%; }
.bush2 { left: 38%; }
.bush3 { left: 60%; }
.bush4 { left: 88%; }

.ground {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 50%;
    background: linear-gradient(180deg, #90EE90 0%, #228B22 100%);
    border-top: 8px solid #32CD32;
    overflow: hidden;
}

.ground-scroll {
    position: absolute;
    top: 0;
    left: 0;
    width: 400%;
    height: 100%;
    transition: transform 0.1s linear;
}

.grass-patch {
    position: absolute;
    top: -12px;
    left: 0;
    width: 100%;
    height: 20px;
    background: repeating-linear-gradient(
        90deg,
        transparent,
        transparent 30px,
        rgba(34, 139, 34, 0.4) 30px,
        rgba(34, 139, 34, 0.4) 60px
    );
}

/* Character */
.character {
    position: absolute;
    bottom: 52%;
    left: 5%;
    transform: translateX(-50%);
    transition: left 0.1s linear;
    z-index: 20;
}

.character-sprite {
    filter: drop-shadow(2px 4px 4px rgba(0,0,0,0.3));
    transition: transform 0.1s ease;
    transform-origin: bottom center;
}

.character.walking .character-sprite {
    animation: walk 0.3s ease-in-out infinite;
}

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

/* Jumping animation - only vertical movement */
.character.jumping .character-sprite {
    animation: jump-over 0.7s ease-in-out;
}

@keyframes jump-over {
    0% { transform: translateY(0) scaleY(1) scaleX(1); }
    8% { transform: translateY(15px) scaleY(0.8) scaleX(1.15); }
    25% { transform: translateY(-100px) scaleY(1.1) scaleX(0.95); }
    40% { transform: translateY(-180px) scaleY(1.05) scaleX(0.95); }
    50% { transform: translateY(-190px) scaleY(1) scaleX(1); }
    60% { transform: translateY(-180px) scaleY(1.05) scaleX(0.95); }
    75% { transform: translateY(-100px) scaleY(1.1) scaleX(0.95); }
    92% { transform: translateY(10px) scaleY(0.85) scaleX(1.1); }
    100% { transform: translateY(0) scaleY(1) scaleX(1); }
}

/* Detailed Chick Character */
.chick {
    width: 117px;
    height: 108px;
    position: relative;
    animation: idle 0.5s infinite ease-in-out;
}

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

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

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

.chick-eye {
    width: 24px;
    height: 27px;
    background: #1a1a2e;
    border-radius: 50%;
    position: absolute;
    top: 15px;
}

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

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

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

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

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

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

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

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

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

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

/* Detailed Cat Character */
.cat {
    width: 117px;
    height: 117px;
    position: relative;
    animation: idle 0.5s infinite ease-in-out;
}

.cat-body {
    width: 90px;
    height: 83px;
    background: linear-gradient(180deg, #A0A0A0 0%, #808080 100%);
    border-radius: 50% 50% 45% 45%;
    position: absolute;
    bottom: 20px;
    left: 14px;
    box-shadow: inset -5px -5px 10px rgba(100,100,100,0.3);
}

.cat-belly {
    width: 60px;
    height: 42px;
    background: #E8E8E8;
    border-radius: 50%;
    position: absolute;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
}

.cat-ear {
    width: 0;
    height: 0;
    border-left: 18px solid transparent;
    border-right: 18px solid transparent;
    border-bottom: 33px solid #A0A0A0;
    position: absolute;
    top: 0;
}

.cat-ear::after {
    content: '';
    width: 0;
    height: 0;
    border-left: 11px solid transparent;
    border-right: 11px solid transparent;
    border-bottom: 21px solid #FFB6C1;
    position: absolute;
    top: 9px;
    left: -11px;
}

.cat-ear.left { left: 15px; }
.cat-ear.right { right: 15px; }

.cat-eye {
    width: 21px;
    height: 27px;
    background: #2ECC71;
    border-radius: 50%;
    position: absolute;
    top: 18px;
}

.cat-eye::before {
    content: '';
    width: 9px;
    height: 21px;
    background: #1a1a2e;
    border-radius: 50%;
    position: absolute;
    top: 3px;
    left: 6px;
}

.cat-eye::after {
    content: '';
    width: 6px;
    height: 6px;
    background: white;
    border-radius: 50%;
    position: absolute;
    top: 5px;
    left: 3px;
}

.cat-eye.left { left: 12px; }
.cat-eye.right { right: 12px; }

.cat-nose {
    width: 15px;
    height: 12px;
    background: #FFB6C1;
    border-radius: 50% 50% 40% 40%;
    position: absolute;
    top: 42px;
    left: 50%;
    transform: translateX(-50%);
}

.cat-mouth {
    width: 24px;
    height: 9px;
    border-bottom: 3px solid #666;
    border-radius: 0 0 50% 50%;
    position: absolute;
    top: 53px;
    left: 50%;
    transform: translateX(-50%);
}

.cat-whisker {
    width: 27px;
    height: 3px;
    background: #666;
    position: absolute;
    border-radius: 2px;
}

.cat-whisker.left.top { left: -12px; top: 42px; transform: rotate(-10deg); }
.cat-whisker.left.bottom { left: -12px; top: 51px; transform: rotate(10deg); }
.cat-whisker.right.top { right: -12px; top: 42px; transform: rotate(10deg); }
.cat-whisker.right.bottom { right: -12px; top: 51px; transform: rotate(-10deg); }

.cat-cheek {
    width: 18px;
    height: 15px;
    background: rgba(255, 182, 193, 0.5);
    border-radius: 50%;
    position: absolute;
    top: 48px;
}

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

.cat-paw {
    width: 21px;
    height: 27px;
    background: #909090;
    border-radius: 50% 50% 40% 40%;
    position: absolute;
    bottom: 24px;
}

.cat-paw.left { left: 0; }
.cat-paw.right { right: 0; }

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

.cat-foot {
    width: 24px;
    height: 12px;
    background: #707070;
    border-radius: 50%;
}

.cat-tail {
    width: 15px;
    height: 53px;
    background: linear-gradient(180deg, #A0A0A0 0%, #707070 100%);
    border-radius: 8px 8px 15px 15px;
    position: absolute;
    bottom: 30px;
    right: -12px;
    transform: rotate(30deg);
    transform-origin: bottom center;
    animation: tail-wag 0.8s ease-in-out infinite;
}

@keyframes tail-wag {
    0%, 100% { transform: rotate(30deg); }
    50% { transform: rotate(45deg); }
}

/* Obstacle */
.obstacle {
    position: absolute;
    bottom: 52%;
    left: 37%;
    transform: translateX(-50%);
    transition: left 0.1s linear;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 15;
}

.obstacle-letter {
    width: 137px;
    height: 137px;
    background: linear-gradient(135deg, #8B4513 0%, #654321 100%);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 71px;
    font-weight: bold;
    color: #FFF8DC;
    box-shadow: 0 12px 0 #3E2723, 0 15px 39px rgba(0,0,0,0.3);
    border: 8px solid #A0522D;
    transition: transform 0.2s ease, opacity 0.3s ease;
}

.obstacle.active .obstacle-letter {
    animation: obstacle-pulse 0.8s ease-in-out infinite;
    background: linear-gradient(135deg, #D2691E 0%, #8B4513 100%);
}

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

.obstacle.wrong .obstacle-letter {
    animation: obstacle-shake 0.4s ease;
    background: linear-gradient(135deg, #FF6B6B 0%, #CC0000 100%);
}

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

.obstacle.destroyed .obstacle-letter {
    animation: obstacle-destroy 0.4s ease forwards;
}

@keyframes obstacle-destroy {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.3) rotate(15deg); opacity: 0.5; }
    100% { transform: scale(0) rotate(45deg); opacity: 0; }
}

/* Goal Flag */
.goal-flag {
    position: absolute;
    bottom: 52%;
    left: 100%;
    transition: left 0.1s linear;
    filter: drop-shadow(2px 4px 4px rgba(0,0,0,0.3));
    display: none;
    transform: translateX(-50%);
}

.flag-sprite {
    position: relative;
    width: 100px;
    height: 140px;
}

.flag-pole {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 12px;
    height: 140px;
    background: linear-gradient(90deg, #8B4513 0%, #D2691E 50%, #8B4513 100%);
    border-radius: 6px;
    box-shadow: 2px 0 4px rgba(0,0,0,0.3);
}

.flag-pole::before {
    content: '';
    position: absolute;
    top: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 20px;
    background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.flag-banner {
    position: absolute;
    top: 8px;
    left: 50%;
    margin-left: 6px;
    width: 70px;
    height: 50px;
    background: linear-gradient(135deg, #FF6B6B 0%, #EE4444 50%, #CC2222 100%);
    border-radius: 0 8px 8px 0;
    animation: flag-wave 1.5s ease-in-out infinite;
    transform-origin: left center;
    box-shadow: 2px 2px 6px rgba(0,0,0,0.3);
}

.flag-banner::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(180deg, 
        rgba(255,255,255,0.3) 0%, 
        transparent 30%,
        transparent 70%,
        rgba(0,0,0,0.1) 100%);
    border-radius: 0 8px 8px 0;
}

.flag-star {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 24px;
    height: 24px;
    background: #FFD700;
    clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
    filter: drop-shadow(1px 1px 2px rgba(0,0,0,0.3));
}

@keyframes flag-wave {
    0%, 100% { transform: rotate(-3deg) skewY(-2deg); }
    50% { transform: rotate(3deg) skewY(2deg); }
}

/* Current Key Display */
.current-key-display {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.95);
    padding: 20px 39px;
    border-radius: 33px;
    font-size: 31px;
    color: #333;
    box-shadow: 0 10px 33px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    gap: 20px;
    z-index: 100;
}

.current-key {
    background: linear-gradient(135deg, #f6ad55 0%, #ed8936 100%);
    color: white;
    padding: 13px 26px;
    border-radius: 20px;
    font-size: 42px;
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    box-shadow: 0 5px 0 #c05621;
    min-width: 78px;
    text-align: center;
}

/* Level Complete Screen */
.level-complete-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 3000;
}

.level-complete-card {
    background: linear-gradient(180deg, #ffe27a 0%, #ffc94a 100%);
    border-radius: 30px;
    padding: 40px;
    text-align: center;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.3);
    max-width: 400px;
    animation: pop-in 0.4s ease;
}

.level-complete-title {
    font-size: 32px;
    color: #5a3b00;
    margin-bottom: 20px;
}

.level-complete-character {
    font-size: 100px;
    margin-bottom: 20px;
    animation: bounce 0.6s ease infinite;
}

.level-complete-card p {
    font-size: 18px;
    color: #666;
    margin-bottom: 25px;
}

.continue-btn {
    background: linear-gradient(180deg, #4ECDC4 0%, #44A08D 100%);
    color: white;
    border: none;
    padding: 15px 40px;
    font-size: 22px;
    font-family: inherit;
    border-radius: 30px;
    cursor: pointer;
    box-shadow: 0 5px 0 #2D7A6E;
    transition: transform 0.1s, box-shadow 0.1s;
}

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

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

/* Player Switch Screen */
.player-switch-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(180deg, #667eea 0%, #764ba2 100%);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 3000;
}

.player-switch-card {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 30px;
    padding: 50px;
    text-align: center;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.3);
    max-width: 450px;
    animation: pop-in 0.4s ease;
}

.player-switch-title {
    font-size: 32px;
    color: #333;
    margin-bottom: 30px;
}

.player-switch-characters {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin-bottom: 30px;
}

.switch-char {
    font-size: 80px;
}

.switch-char.done {
    opacity: 0.5;
    filter: grayscale(50%);
}

.switch-char.next {
    animation: bounce 0.6s ease infinite;
}

.switch-arrow {
    font-size: 40px;
}

.player-switch-card p {
    font-size: 20px;
    color: #555;
    margin-bottom: 30px;
}

/* Reunion Screen */
.reunion-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 4000;
    overflow: hidden;
}

.reunion-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(180deg, #FFB6C1 0%, #FF69B4 50%, #FFD700 100%);
    animation: rainbow-shift 3s ease-in-out infinite;
}

@keyframes rainbow-shift {
    0%, 100% { filter: hue-rotate(0deg); }
    50% { filter: hue-rotate(30deg); }
}

.reunion-content {
    position: relative;
    z-index: 10;
    text-align: center;
}

.reunion-title {
    font-size: 52px;
    color: white;
    text-shadow: 4px 4px 0 #FF6B6B, 6px 6px 0 rgba(0,0,0,0.2);
    margin-bottom: 30px;
    animation: title-bounce 0.5s ease infinite;
}

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

.reunion-characters {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 30px;
    margin-bottom: 30px;
}

.reunion-char {
    filter: drop-shadow(4px 6px 6px rgba(0,0,0,0.3));
}

/* Reunion screen sprites - larger size */
.reunion-chick, .reunion-cat {
    transform: scale(1.8);
}

.reunion-char.jumping {
    animation: jump-joy 0.5s ease infinite;
}

.reunion-char.chick.jumping {
    animation-delay: 0s;
}

.reunion-char.cat.jumping {
    animation-delay: 0.25s;
}

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

.reunion-char.jumping .reunion-chick,
.reunion-char.jumping .reunion-cat {
    transform: scale(1.8);
    animation: none;
}

.reunion-hearts {
    font-size: 60px;
    animation: hearts-pulse 0.8s ease infinite;
}

@keyframes hearts-pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.3); opacity: 0.8; }
}

.reunion-message {
    font-size: 28px;
    color: white;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
    margin-bottom: 40px;
}

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

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

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

/* Confetti */
.confetti-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
    z-index: 5;
}

.confetti-piece {
    position: absolute;
    top: -20px;
    width: 10px;
    height: 14px;
    border-radius: 2px;
    opacity: 0;
    animation: confetti-fall var(--d, 1.5s) ease-out forwards;
    animation-delay: var(--delay, 0s);
}

@keyframes confetti-fall {
    0% { opacity: 0; transform: translate3d(0, -20px, 0) rotate(var(--r, 0deg)); }
    10% { opacity: 1; }
    100% { opacity: 1; transform: translate3d(var(--drift, 0px), 100vh, 0) rotate(calc(var(--r, 0deg) + 360deg)); }
}

/* Control Buttons */
.sound-toggle {
    position: fixed;
    top: 20px;
    left: 20px;
    background: #FFE66D;
    border: none;
    padding: 10px 18px;
    border-radius: 20px;
    font-size: 16px;
    cursor: pointer;
    box-shadow: 0 4px 0 #F4A261;
    z-index: 200;
}

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

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

.keyboard-toggle {
    position: fixed;
    top: 70px;
    left: 20px;
    background: #FFE66D;
    border: none;
    padding: 8px 14px;
    border-radius: 16px;
    font-size: 14px;
    cursor: pointer;
    box-shadow: 0 3px 0 #F4A261;
    z-index: 200;
}

/* On-screen Keyboard */
.on-screen-keyboard {
    position: fixed;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    display: none;
    flex-direction: column;
    gap: 6px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    max-width: 640px;
    width: calc(100% - 20px);
    z-index: 100;
}

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

.key-btn {
    flex: 1 1 0;
    max-width: 48px;
    height: 44px;
    border: none;
    border-radius: 10px;
    background: linear-gradient(180deg, #f6ad55 0%, #ed8936 100%);
    color: white;
    font-size: 16px;
    font-weight: 700;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
    box-shadow: 0 3px 0 #c05621;
    cursor: pointer;
    transition: transform 0.05s ease;
}

.key-btn:active {
    transform: translateY(2px);
    box-shadow: 0 1px 0 #c05621;
}

/* Animation helpers */
@keyframes pop-in {
    0% { transform: scale(0.8); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

/* Responsive Styles */
@media (max-width: 768px) {
    .start-screen {
        padding: 15px;
        gap: 0;
    }
    
    .start-screen h1 {
        font-size: 28px;
        margin-bottom: 10px;
    }
    
    .characters-preview {
        margin-bottom: 10px;
        gap: 15px;
    }
    
    .preview-chick, .preview-cat {
        transform: scale(1);
    }
    
    .character-icon {
        font-size: 50px;
    }
    
    .heart-icon {
        font-size: 24px;
    }
    
    .story-text {
        font-size: 14px;
        padding: 0 15px;
        margin-bottom: 15px;
    }
    
    .language-buttons {
        flex-direction: row;
        gap: 8px;
        margin-bottom: 15px;
    }
    
    .lang-btn {
        font-size: 13px;
        padding: 8px 16px;
    }
    
    .level-buttons,
    .obstacle-buttons {
        gap: 10px;
        margin-bottom: 15px;
    }
    
    .level-btn,
    .obstacle-btn {
        width: 50px;
        height: 50px;
        font-size: 20px;
    }
    
    .start-screen p {
        font-size: 16px !important;
        margin: 10px 0 8px !important;
    }
    
    .start-btn {
        font-size: 18px;
        padding: 12px 30px;
    }
    
    .game-header {
        flex-wrap: wrap;
        padding: 10px 15px;
        gap: 10px;
    }
    
    .current-player-icon {
        font-size: 28px;
    }
    
    .player-name {
        font-size: 16px;
    }
    
    .level-info {
        font-size: 14px;
    }
    
    .progress-bar-container {
        width: 100px;
    }
    
    .character {
        transform: scale(0.75);
        transform-origin: bottom center;
    }
    
    .obstacle-letter {
        width: 65px;
        height: 65px;
        font-size: 32px;
    }
    
    .flag-sprite {
        transform: scale(0.8);
    }
    
    .current-key-display {
        bottom: 20px;
        padding: 13px 26px;
        font-size: 23px;
    }
    
    .current-key {
        font-size: 31px;
        padding: 10px 20px;
    }
    
    .reunion-title {
        font-size: 36px;
    }
    
    .reunion-chick, .reunion-cat {
        transform: scale(1.3);
    }
    
    .reunion-hearts {
        font-size: 40px;
    }
    
    .reunion-message {
        font-size: 20px;
    }
}

@media (max-width: 480px) {
    .start-screen {
        padding: 10px;
    }
    
    .start-screen h1 {
        font-size: 22px;
        margin-bottom: 8px;
    }
    
    .characters-preview {
        margin-bottom: 8px;
        gap: 10px;
    }
    
    .preview-chick, .preview-cat {
        transform: scale(0.8);
    }
    
    .character-icon {
        font-size: 40px;
    }
    
    .heart-icon {
        font-size: 20px;
    }
    
    .story-text {
        font-size: 12px;
        margin-bottom: 10px;
    }
    
    .language-buttons {
        gap: 6px;
        margin-bottom: 10px;
    }
    
    .lang-btn {
        font-size: 12px;
        padding: 6px 12px;
    }
    
    .level-buttons,
    .obstacle-buttons {
        gap: 8px;
        margin-bottom: 10px;
    }
    
    .level-btn,
    .obstacle-btn {
        width: 44px;
        height: 44px;
        font-size: 18px;
    }
    
    .start-screen p {
        font-size: 14px !important;
        margin: 8px 0 6px !important;
    }
    
    .start-btn {
        font-size: 16px;
        padding: 10px 24px;
    }
    
    .game-header {
        top: 50px;
        padding: 6px 10px;
        gap: 8px;
    }
    
    .current-player-icon {
        font-size: 20px;
    }
    
    .player-name {
        font-size: 12px;
    }
    
    .level-info {
        font-size: 11px;
    }
    
    .progress-bar-container {
        width: 50px;
        height: 8px;
    }
    
    .character {
        transform: scale(0.4);
        transform-origin: bottom center;
        left: 5%;
    }
    
    .obstacle {
        left: 55%;
    }
    
    .obstacle-letter {
        width: 50px;
        height: 50px;
        font-size: 24px;
    }
    
    .flag-sprite {
        transform: scale(0.6);
    }
    
    .current-key-display {
        bottom: auto;
        top: 115px;
        padding: 8px 16px;
        font-size: 14px;
    }
    
    .current-key {
        font-size: 26px;
        padding: 8px 16px;
        min-width: 59px;
    }
    
    .on-screen-keyboard {
        padding: 8px;
        gap: 4px;
    }
    
    .key-btn {
        max-width: 32px;
        height: 38px;
        font-size: 13px;
    }
    
    .sound-toggle,
    .keyboard-toggle {
        font-size: 12px;
        padding: 6px 10px;
    }
    
    .home-button {
        font-size: 14px;
        padding: 10px 15px;
    }
    
    .level-complete-card,
    .player-switch-card {
        padding: 25px;
        margin: 20px;
    }
    
    .level-complete-title,
    .player-switch-title {
        font-size: 24px;
    }
    
    .level-complete-character {
        font-size: 70px;
    }
    
    .switch-char {
        font-size: 60px;
    }
    
    .continue-btn {
        font-size: 18px;
        padding: 12px 30px;
    }
}

/* When keyboard is visible on mobile */
@media (max-width: 600px) {
    .current-key-display {
        bottom: auto;
        top: 115px;
    }
    
    .on-screen-keyboard {
        bottom: 5px;
        padding: 6px;
        gap: 3px;
    }
    
    .key-btn {
        height: 36px;
        font-size: 13px;
    }
}

@media (max-height: 700px) {
    .current-key-display {
        bottom: auto;
        top: 115px;
        padding: 6px 12px;
        font-size: 14px;
    }
    
    .current-key {
        font-size: 22px;
        padding: 6px 12px;
    }
    
    .on-screen-keyboard {
        padding: 4px;
        gap: 2px;
    }
    
    .key-btn {
        height: 32px;
        font-size: 12px;
        max-width: 28px;
    }
}
