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

body {
    font-family: 'Arial', sans-serif;
    background: linear-gradient(135deg, #87CEEB 0%, #98FB98 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

.game-container {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    padding: 20px;
    text-align: center;
    max-width: 900px;
    width: 100%;
}

.game-header {
    margin-bottom: 20px;
}

.game-header h1 {
    color: #2c3e50;
    font-size: 2.5em;
    margin-bottom: 15px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.score-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.score-display span {
    font-size: 1.5em;
    font-weight: bold;
    color: #e74c3c;
}

.progress-bar {
    width: 300px;
    height: 20px;
    background: #ecf0f1;
    border-radius: 10px;
    overflow: hidden;
    border: 2px solid #bdc3c7;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #f39c12, #e67e22);
    width: 0%;
    transition: width 0.3s ease;
    border-radius: 8px;
}

.streak-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    margin-top: 10px;
}

.streak-display span {
    font-size: 1.2em;
    font-weight: bold;
    color: #e74c3c;
}

.streak-bar {
    width: 300px;
    height: 15px;
    background: #ecf0f1;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid #bdc3c7;
}

.streak-fill {
    height: 100%;
    background: linear-gradient(90deg, #e74c3c, #c0392b);
    width: 0%;
    transition: width 0.3s ease;
    border-radius: 6px;
}

.fullscreen-button-container {
    display: none;
    justify-content: center;
    margin-top: 10px;
}

.game-area {
    position: relative;
    display: inline-block;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

#gameCanvas {
    display: block;
    background: linear-gradient(180deg, #87CEEB 0%, #98FB98 70%, #8FBC8F 100%);
    border: 3px solid #34495e;
}

.game-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10;
    padding: 20px;
    box-sizing: border-box;
    overflow-y: auto;
    overflow-x: hidden;
}

.game-overlay.hidden {
    display: none;
}

/* Intro Screen */
.intro-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #ff6b6b, #feca57, #48dbfb, #ff9ff3);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 15;
    animation: introBackground 7s ease-in-out;
}

.intro-overlay.hidden {
    display: none;
}

.intro-content {
    text-align: center;
    color: white;
    padding: 40px;
    background: rgba(0, 0, 0, 0.8);
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
    max-width: 90vw;
    animation: introPulse 2s ease-in-out infinite;
}

.intro-chicken {
    font-size: 4em;
    margin-bottom: 20px;
    animation: introBounce 1s ease-in-out infinite;
}

.intro-title {
    font-size: 2.5em;
    margin-bottom: 20px;
    color: #feca57;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.intro-desktop {
    font-size: 1.3em;
    margin-bottom: 10px;
    color: #48dbfb;
}

.intro-mobile {
    font-size: 1.3em;
    margin-bottom: 20px;
    color: #ff9ff3;
    display: none;
}

.intro-countdown {
    font-size: 3em;
    font-weight: bold;
    color: #ff6b6b;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    animation: introCountdown 1s ease-in-out;
}

/* Intro Animations */
@keyframes introBackground {
    0% { background: linear-gradient(135deg, #ff6b6b, #feca57); }
    25% { background: linear-gradient(135deg, #feca57, #48dbfb); }
    50% { background: linear-gradient(135deg, #48dbfb, #ff9ff3); }
    75% { background: linear-gradient(135deg, #ff9ff3, #ff6b6b); }
    100% { background: linear-gradient(135deg, #ff6b6b, #feca57); }
}

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

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

@keyframes introCountdown {
    0% { transform: scale(0.5); opacity: 0; }
    50% { transform: scale(1.2); opacity: 1; }
    100% { transform: scale(1); opacity: 1; }
}

/* Show mobile intro text on mobile */
@media (max-width: 768px) {
    .intro-desktop {
        display: none;
    }
    
    .intro-mobile {
        display: block;
    }
    
    .intro-content {
        padding: 30px 20px;
    }
    
    .intro-title {
        font-size: 2em;
    }
    
    .intro-chicken {
        font-size: 3em;
    }
    
    .intro-countdown {
        font-size: 2.5em;
    }
}

.overlay-content {
    text-align: center;
    color: white;
    padding: 30px;
    background: rgba(52, 73, 94, 0.95);
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    max-width: 90vw;
    max-height: 85vh;
    min-height: 300px;
    min-width: 280px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    margin: auto;
}

/* Full-screen mode */
.fullscreen {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 9999 !important;
    margin: 0 !important;
    padding: 10px !important;
    border-radius: 0 !important;
}

.fullscreen .game-area {
    width: 100% !important;
    height: calc(100vh - 20px) !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    align-items: center !important;
}

.fullscreen #gameCanvas {
    width: 100% !important;
    height: auto !important;
    max-height: calc(100vh - 200px) !important;
    max-width: 100% !important;
}

/* Square mobile fullscreen */
@media (max-width: 768px) {
    .fullscreen #gameCanvas {
        width: 100vw !important;
        height: 100vw !important;
        max-width: 100vw !important;
        max-height: 100vw !important;
        object-fit: cover;
    }
    
    .fullscreen .game-area {
        width: 100vw !important;
        height: 100vw !important;
        display: flex !important;
        flex-direction: column !important;
        justify-content: center !important;
        align-items: center !important;
    }
}

.fullscreen .mobile-controls {
    position: fixed !important;
    bottom: 10px !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    width: 90% !important;
    max-width: 500px !important;
    z-index: 10000 !important;
}

.fullscreen .game-header {
    position: fixed !important;
    top: 10px !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    width: 90% !important;
    z-index: 10000 !important;
    background: rgba(255, 255, 255, 0.95) !important;
    border-radius: 10px !important;
    padding: 10px !important;
}

.fullscreen .controls {
    display: none !important;
}

.overlay-content h2 {
    font-size: 2.5em;
    margin-bottom: 20px;
    color: #f39c12;
}

.overlay-content p {
    font-size: 1.2em;
    margin-bottom: 25px;
    color: #ecf0f1;
}

#startButton {
    background: linear-gradient(45deg, #e74c3c, #c0392b);
    color: white;
    border: none;
    padding: 15px 30px;
    font-size: 1.2em;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 5px 15px rgba(231, 76, 60, 0.4);
    min-height: 50px;
    min-width: 120px;
    touch-action: manipulation;
}

#startButton:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(231, 76, 60, 0.6);
    background: linear-gradient(45deg, #c0392b, #a93226);
}

#startButton:active {
    transform: translateY(0);
    background: linear-gradient(45deg, #a93226, #922b21);
}

.controls {
    margin-top: 20px;
    color: #7f8c8d;
    font-size: 1.1em;
}

.controls p {
    background: rgba(52, 73, 94, 0.1);
    padding: 10px 20px;
    border-radius: 10px;
    display: inline-block;
    margin: 5px;
}

.mobile-instructions {
    font-size: 0.9em;
    color: #7f8c8d;
    margin-top: 10px;
}

.mobile-controls-text {
    font-size: 0.8em;
    color: #95a5a6;
    margin-top: 5px;
}

/* Animation for score updates */
@keyframes scoreUpdate {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); color: #27ae60; }
    100% { transform: scale(1); }
}

.score-update {
    animation: scoreUpdate 0.3s ease;
}

/* Mobile touch controls */
.mobile-controls {
    display: none;
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 400px;
    justify-content: space-between;
    padding: 0 20px;
    z-index: 5;
}

.mobile-button {
    background: rgba(52, 73, 94, 0.8);
    color: white;
    border: 2px solid #34495e;
    border-radius: 50px;
    padding: 15px 25px;
    font-size: 1.2em;
    font-weight: bold;
    text-align: center;
    cursor: pointer;
    user-select: none;
    touch-action: manipulation;
    transition: all 0.2s ease;
    min-width: 60px;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mobile-button:active {
    background: rgba(231, 76, 60, 0.9);
    transform: scale(0.95);
}

.mobile-jump {
    background: rgba(46, 204, 113, 0.8);
    border-color: #27ae60;
    font-size: 1em;
    padding: 15px 20px;
}

.mobile-jump:active {
    background: rgba(39, 174, 96, 0.9);
}

.mobile-fullscreen {
    background: rgba(155, 89, 182, 0.8);
    border-color: #9b59b6;
    font-size: 1.1em;
    padding: 10px 15px;
    min-width: 45px;
    min-height: 45px;
}

.mobile-fullscreen:active {
    background: rgba(142, 68, 173, 0.9);
}

/* Fullscreen button in header */
.fullscreen-button-container .mobile-fullscreen {
    font-size: 1em;
    padding: 8px 12px;
    min-width: 40px;
    min-height: 40px;
    opacity: 0.8;
}

.fullscreen-button-container .mobile-fullscreen:hover {
    opacity: 1;
}

/* Show mobile controls on mobile devices */
@media (max-width: 768px) {
    .mobile-controls {
        display: flex;
    }
    
    .fullscreen-button-container {
        display: flex;
    }
    
    .controls p {
        font-size: 0.9em;
        padding: 8px 15px;
    }
    
    .game-overlay {
        align-items: flex-start;
        padding-top: 50px;
        padding-bottom: 50px;
    }
    
    /* Hide header in mobile fullscreen to avoid overlap */
    .fullscreen .game-header {
        display: none !important;
    }
    
    .overlay-content {
        padding: 20px 15px;
        margin: 10px;
        max-width: 95vw;
        max-height: 80vh;
        min-height: 350px;
        min-width: 280px;
        width: 90vw;
        height: auto;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: thin;
    }
    
    .overlay-content::-webkit-scrollbar {
        width: 6px;
    }
    
    .overlay-content::-webkit-scrollbar-track {
        background: rgba(255, 255, 255, 0.1);
        border-radius: 3px;
    }
    
    .overlay-content::-webkit-scrollbar-thumb {
        background: rgba(255, 255, 255, 0.3);
        border-radius: 3px;
    }
    
    .overlay-content h2 {
        font-size: 2.2em;
        margin-bottom: 15px;
    }
    
    .overlay-content p {
        font-size: 1.1em;
        margin-bottom: 20px;
        line-height: 1.4;
    }
    
    .mobile-instructions {
        font-size: 1em;
        margin-bottom: 25px;
    }
    
    #startButton {
        padding: 20px 40px;
        font-size: 1.4em;
        min-height: 70px;
        min-width: 180px;
        margin-top: 10px;
    }
}

/* Responsive design */
@media (max-width: 900px) {
    .game-container {
        margin: 10px;
        padding: 15px;
    }
    
    #gameCanvas {
        width: 100%;
        height: auto;
        max-width: 800px;
    }
    
    .game-header h1 {
        font-size: 2em;
    }
    
    .progress-bar, .streak-bar {
        width: 250px;
    }
}

@media (max-width: 768px) {
    .game-container {
        margin: 5px;
        padding: 10px;
    }
    
    .game-header h1 {
        font-size: 1.8em;
        margin-bottom: 10px;
    }
    
    .score-display {
        gap: 8px;
    }
    
    .score-display span {
        font-size: 1.3em;
    }
    
    .progress-bar, .streak-bar {
        width: 200px;
        height: 18px;
    }
    
    .streak-bar {
        height: 12px;
    }
    
    .overlay-content {
        padding: 20px;
        margin: 10px;
    }
    
    .overlay-content h2 {
        font-size: 2em;
    }
    
    .overlay-content p {
        font-size: 1.1em;
    }
    
    #startButton {
        padding: 12px 25px;
        font-size: 1.1em;
    }
}

@media (max-width: 600px) {
    .game-header h1 {
        font-size: 1.5em;
    }
    
    .progress-bar, .streak-bar {
        width: 180px;
    }
    
    .overlay-content {
        padding: 15px 10px;
        margin: 5px;
        max-height: 75vh;
        min-height: 300px;
        min-width: 260px;
        width: 95vw;
        overflow-y: auto;
    }
    
    .overlay-content h2 {
        font-size: 1.8em;
        margin-bottom: 12px;
    }
    
    .overlay-content p {
        font-size: 1em;
        margin-bottom: 15px;
        line-height: 1.3;
    }
    
    .mobile-instructions {
        font-size: 0.9em;
        margin-bottom: 20px;
    }
    
    #startButton {
        padding: 18px 35px;
        font-size: 1.3em;
        min-height: 65px;
        min-width: 160px;
        margin-top: 5px;
    }
    
    .mobile-button {
        padding: 12px 20px;
        font-size: 1.1em;
        min-width: 50px;
        min-height: 50px;
    }
    
    .mobile-jump {
        font-size: 0.9em;
        padding: 12px 15px;
    }
}

@media (max-width: 480px) {
    .game-container {
        margin: 2px;
        padding: 8px;
    }
    
    .game-header h1 {
        font-size: 1.3em;
    }
    
    .score-display span {
        font-size: 1.1em;
    }
    
    .streak-display span {
        font-size: 1em;
    }
    
    .progress-bar, .streak-bar {
        width: 150px;
        height: 15px;
    }
    
    .streak-bar {
        height: 10px;
    }
    
    .overlay-content {
        padding: 12px 8px;
        margin: 3px;
        max-height: 70vh;
        min-height: 280px;
        min-width: 240px;
        width: 98vw;
        overflow-y: auto;
    }
    
    .overlay-content h2 {
        font-size: 1.6em;
        margin-bottom: 10px;
    }
    
    .overlay-content p {
        font-size: 0.9em;
        margin-bottom: 12px;
        line-height: 1.2;
    }
    
    .mobile-instructions {
        font-size: 0.8em;
        margin-bottom: 15px;
    }
    
    #startButton {
        padding: 16px 30px;
        font-size: 1.2em;
        min-height: 60px;
        min-width: 140px;
        margin-top: 5px;
    }
    
    .mobile-button {
        padding: 10px 15px;
        font-size: 1em;
        min-width: 45px;
        min-height: 45px;
    }
    
    .mobile-jump {
        font-size: 0.8em;
        padding: 10px 12px;
    }
}
