:root {
    --game-speed: 2s;
}

body {
    text-align: center;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f5f5f5;
    margin: 0;
    padding: 20px;
}

h1 {
    color: #333;
    margin-bottom: 30px;
}

button {
    background-color: #4CAF50;
    color: white;
    padding: 12px 24px;
    border: none;
    border-radius: 25px;
    font-size: 16px;
    margin: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

button:hover {
    background-color: #45a049;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

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

.game-container {
    position: relative;
    width: 600px;
    height: 200px;
    border: 2px solid #333;
    border-radius: 10px;
    margin: 0;
    overflow: hidden;
    background-color: #fff;
    display: none;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.penguin {
    width: 40px;
    height: 40px;
    position: absolute;
    bottom: 0;
    left: 50px;
    background-image: url('/assets/images/penguin-walk-1.png');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    animation: walk 0.5s steps(2) infinite;
}

.obstacle {
    width: 20px;
    height: 30px;
    background-color: #e74c3c;
    position: absolute;
    bottom: 0;
    left: 600px;
    border-radius: 4px;
    transition: height 0.2s ease;
    animation: moveObstacle var(--game-speed) infinite linear;
}

.game-over-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 24px;
    font-weight: bold;
    color: #e74c3c;
    display: none;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.1);
}

.score {
    position: absolute;
    top: 10px;
    left: 10px;
    font-size: 20px;
    font-weight: bold;
    color: #333;
}

.webcam-container {
    margin: 0;
    display: none;
    width: 600px;
    height: 400px;
}

video {
    width: 600px;
    height: 400px;
    object-fit: cover;
    border: 2px solid #333;
    border-radius: 10px;
    background-color: #000;
}

#gesture-output {
    text-align: center;
    margin-top: 10px;
    padding: 5px;
    background-color: #f0f0f0;
    border-radius: 5px;
}

#game-instruction {
    color: #666;
    margin: 15px 0;
    font-size: 16px;
}

@keyframes moveObstacle {
    from { left: 600px; }
    to { left: 0; }
}

/* Ultra-smooth jump animation with maximum smoothness */
@keyframes jump {
    0% { bottom: 0; transform: rotate(0deg); }
    5% { bottom: 20px; transform: rotate(18deg); }
    10% { bottom: 40px; transform: rotate(36deg); }
    15% { bottom: 60px; transform: rotate(54deg); }
    20% { bottom: 75px; transform: rotate(72deg); }
    25% { bottom: 90px; transform: rotate(90deg); }
    30% { bottom: 100px; transform: rotate(108deg); }
    35% { bottom: 108px; transform: rotate(126deg); }
    40% { bottom: 115px; transform: rotate(144deg); }
    45% { bottom: 118px; transform: rotate(162deg); }
    50% { bottom: 120px; transform: rotate(180deg); }
    55% { bottom: 118px; transform: rotate(198deg); }
    60% { bottom: 115px; transform: rotate(216deg); }
    65% { bottom: 108px; transform: rotate(234deg); }
    70% { bottom: 100px; transform: rotate(252deg); }
    75% { bottom: 90px; transform: rotate(270deg); }
    80% { bottom: 75px; transform: rotate(288deg); }
    85% { bottom: 60px; transform: rotate(306deg); }
    90% { bottom: 40px; transform: rotate(324deg); }
    95% { bottom: 20px; transform: rotate(342deg); }
    100% { bottom: 0; transform: rotate(360deg); }
}

/* Refined jump class with ultra-smooth easing */
.jump {
    animation: jump 0.6s cubic-bezier(0.45, 0.05, 0.55, 0.95);
    background-image: url('/assets/images/penguin-jump.png') !important;
    will-change: transform, bottom;
    transform-origin: center;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    -webkit-transform-style: preserve-3d;
    transform-style: preserve-3d;
    -webkit-perspective: 1000;
    perspective: 1000;
}

.instruction-container, .webcam-section {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin: 20px auto;
    max-width: 1000px;
}

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

.gesture-img {
    width: 100px;
    height: 100px;
    object-fit: contain;
    border: 2px solid #333;
    border-radius: 10px;
    padding: 10px;
    background-color: white;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    transition: transform 0.3s ease;
}

.gesture-img:hover {
    transform: scale(1.05);
}

.instruction-text {
    font-size: 18px;
    font-weight: bold;
    color: #333;
    text-transform: uppercase;
    background-color: #f0f0f0;
    padding: 5px 10px;
    border-radius: 5px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.button-container {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin: 20px 0;
}

.initial-instruction {
    font-size: 20px;
    color: #e74c3c;
    margin: 15px 0;
    padding: 10px;
    background-color: #ffeaea;
    border-radius: 8px;
    display: inline-block;
}

.primary-btn, .secondary-btn {
    background-color: #4CAF50;
    color: white;
    padding: 12px 24px;
    border: none;
    border-radius: 25px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.primary-btn:hover {
    background-color: #45a049;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.secondary-btn {
    background-color: #3498db;
}

.secondary-btn:hover {
    background-color: #2980b9;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.secondary-btn:disabled {
    background-color: #bdc3c7;
    cursor: wait;
    transform: none;
    box-shadow: none;
    position: relative;
}

.secondary-btn:disabled::after {
    content: '...';
    position: absolute;
    right: 10px;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% { content: '.'; }
    33% { content: '..'; }
    66% { content: '...'; }
}

.loading-status {
    margin: 10px 0;
    color: #666;
    font-style: italic;
    display: none;
}

.footer {
    margin-top: 40px;
    padding: 20px;
    clear: both;
    position: relative;
    bottom: 0;
    width: 100%;
}

.footer-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.coffee-section {
    margin-top: 10px;
}

.coffee-button {
    display: inline-block;
    transition: transform 0.3s ease;
}

.coffee-button:hover {
    transform: translateY(-3px);
}

.coffee-button img {
    height: 40px;
    width: auto;
}

.developer-link {
    color: #3498db;
    text-decoration: none;
    font-size: 16px;
    transition: all 0.3s ease;
    padding: 5px 10px;
    border-radius: 5px;
    display: inline-block;
}

.developer-link:hover {
    color: #2980b9;
    background-color: #f0f0f0;
    text-decoration: underline;
}

.spacebar-instruction {
    margin: 10px 0;
    color: #666;
    font-size: 14px;
    font-style: italic;
    margin-bottom: 20px;
}

.webcam-section {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    gap: 20px;
    margin: 20px auto;
    max-width: 1000px;
    margin-bottom: 60px;
}

#webcam-container {
    margin-bottom: 0;
}

@keyframes walk {
    0% {
        background-image: url('/assets/images/penguin-walk-1.png');
    }
    50% {
        background-image: url('/assets/images/penguin-walk-2.png');
    }
    100% {
        background-image: url('/assets/images/penguin-walk-1.png');
    }
}

/* Base responsive styles */
@media screen and (max-width: 768px) {
    /* Game container adjustments */
    .game-container {
        width: 100%;
        max-width: 400px;
        height: 150px;
        margin: 0 auto;
    }

    /* Webcam container adjustments */
    .webcam-container {
        width: 100%;
        max-width: 400px;
        height: auto;
    }

    video {
        width: 100%;
        height: auto;
        max-width: 400px;
    }

    /* Instruction layout adjustments */
    .instruction-container, .webcam-section {
        flex-direction: column;
        gap: 10px;
        margin: 10px auto;
    }

    .gesture-instruction {
        flex-direction: row;
        gap: 15px;
    }

    .gesture-img {
        width: 60px;
        height: 60px;
    }

    /* Text size adjustments */
    h1 {
        font-size: 24px;
        margin: 15px 0;
    }

    .instruction-text {
        font-size: 14px;
    }

    /* Button adjustments */
    .button-container {
        flex-direction: column;
        align-items: center;
    }

    .primary-btn, .secondary-btn {
        width: 80%;
        max-width: 300px;
        margin: 5px 0;
    }

    /* Mobile version with proportional smoothness */
    @keyframes jump {
        0% { bottom: 0; transform: rotate(0deg); }
        5% { bottom: 15px; transform: rotate(18deg); }
        10% { bottom: 30px; transform: rotate(36deg); }
        15% { bottom: 45px; transform: rotate(54deg); }
        20% { bottom: 55px; transform: rotate(72deg); }
        25% { bottom: 65px; transform: rotate(90deg); }
        30% { bottom: 75px; transform: rotate(108deg); }
        35% { bottom: 80px; transform: rotate(126deg); }
        40% { bottom: 85px; transform: rotate(144deg); }
        45% { bottom: 88px; transform: rotate(162deg); }
        50% { bottom: 90px; transform: rotate(180deg); }
        55% { bottom: 88px; transform: rotate(198deg); }
        60% { bottom: 85px; transform: rotate(216deg); }
        65% { bottom: 80px; transform: rotate(234deg); }
        70% { bottom: 75px; transform: rotate(252deg); }
        75% { bottom: 65px; transform: rotate(270deg); }
        80% { bottom: 55px; transform: rotate(288deg); }
        85% { bottom: 45px; transform: rotate(306deg); }
        90% { bottom: 30px; transform: rotate(324deg); }
        95% { bottom: 15px; transform: rotate(342deg); }
        100% { bottom: 0; transform: rotate(360deg); }
    }
}

/* Small mobile devices */
@media screen and (max-width: 480px) {
    body {
        padding: 10px;
    }

    .game-container {
        max-width: 300px;
        height: 120px;
    }

    .webcam-container {
        max-width: 300px;
    }

    video {
        max-width: 300px;
    }

    .gesture-img {
        width: 50px;
        height: 50px;
    }

    h1 {
        font-size: 20px;
    }

    #gesture-output {
        font-size: 14px;
    }
}

/* Update game animations for mobile */
@media screen and (max-width: 768px) {
    @keyframes moveObstacle {
        from { left: 100%; }
        to { left: -20px; }
    }

    .penguin {
        left: 30px;
    }

    @keyframes jump {
        0% { bottom: 0; transform: rotate(0deg); }
        5% { bottom: 15px; transform: rotate(18deg); }
        10% { bottom: 30px; transform: rotate(36deg); }
        15% { bottom: 45px; transform: rotate(54deg); }
        20% { bottom: 55px; transform: rotate(72deg); }
        25% { bottom: 65px; transform: rotate(90deg); }
        30% { bottom: 75px; transform: rotate(108deg); }
        35% { bottom: 80px; transform: rotate(126deg); }
        40% { bottom: 85px; transform: rotate(144deg); }
        45% { bottom: 88px; transform: rotate(162deg); }
        50% { bottom: 90px; transform: rotate(180deg); }
        55% { bottom: 88px; transform: rotate(198deg); }
        60% { bottom: 85px; transform: rotate(216deg); }
        65% { bottom: 80px; transform: rotate(234deg); }
        70% { bottom: 75px; transform: rotate(252deg); }
        75% { bottom: 65px; transform: rotate(270deg); }
        80% { bottom: 55px; transform: rotate(288deg); }
        85% { bottom: 45px; transform: rotate(306deg); }
        90% { bottom: 30px; transform: rotate(324deg); }
        95% { bottom: 15px; transform: rotate(342deg); }
        100% { bottom: 0; transform: rotate(360deg); }
    }
} 