* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
}

.game-wrapper {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 10px;
    flex: 1; /* Takes available space pushing footer down */
    width: 100%;
}

h1 {
    color: white;
    margin: 10px 0;
    font-size: clamp(24px, 8vw, 48px);
    text-align: center;
}

#gameContainer {
    background-color: #000;
    border: 3px solid #fff;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
    max-width: 100%;
    width: 100%;
    max-height: calc(100vh - 250px); /* Adjusted for nav/footer */
    max-height: calc(100dvh - 250px);
    aspect-ratio: 1;
}

canvas {
    display: block;
    background-color: #111;
    width: 100%;
    height: 100%;
}

.info {
    color: white;
    text-align: center;
    margin-top: 20px;
}

.score {
    font-size: clamp(18px, 5vw, 24px);
    font-weight: bold;
    margin: 10px;
}

.controls {
    color: white;
    text-align: center;
    margin: 10px;
    font-size: clamp(12px, 3vw, 14px);
}

.button-group {
    margin-top: 20px;
    display: flex;
    gap: 10px;
    justify-content: center;
}

button {
    padding: clamp(8px, 2vw, 10px) clamp(16px, 4vw, 20px);
    font-size: clamp(14px, 3vw, 16px);
    background-color: #667eea;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s;
}

button:hover {
    background-color: #764ba2;
}

.back-link {
    display: none; /* Hidden as we have navbar now */
}

.analog-stick {
    display: none;
    width: clamp(100px, 30vmin, 140px);
    height: clamp(100px, 30vmin, 140px);
    background-color: rgba(255, 255, 255, 0.1);
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    margin-top: 20px;
    position: relative;
    cursor: grab;
    touch-action: none;
}

.analog-knob {
    width: 35%;
    height: 35%;
    background-color: #667eea;
    border: 2px solid white;
    border-radius: 50%;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 0 10px rgba(102, 126, 234, 0.5);
}

.analog-stick.active {
    background-color: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.6);
}

@media (max-width: 1024px) {
    #gameContainer {
        width: 90vw;
        max-width: 500px;
    }
    
    .button-group {
        flex-wrap: wrap;
    }

    .analog-stick {
        display: block;
    }
}

@media (max-width: 768px) {
    .game-wrapper {
        padding: 8px;
    }
    
    #gameContainer {
        width: 95vw;
        max-width: 400px;
    }
    
    .button-group {
        margin-top: 15px;
        gap: 8px;
    }
}

@media (max-width: 600px) {
    .game-wrapper {
        padding: 10px;
    }
    
    #gameContainer {
        width: 100%;
        max-width: 90vw;
        border-width: 2px;
    }
    
    .info {
        margin-top: 15px;
    }
    
    .button-group {
        margin-top: 15px;
        gap: 8px;
        width: 100%;
        flex-wrap: wrap;
    }
    
    .button-group button {
        flex: 1;
        min-width: 100px;
    }
    
    .mobile-controls {
        display: grid;
    }
    
    .analog-stick {
        display: block;
    }
    
    .controls {
        display: none;
    }
    
    .score {
        margin: 8px;
    }
}

@media (max-width: 480px) {
    h1 {
        margin: 8px 0;
    }
    
    #gameContainer {
        border-width: 2px;
    }
    
    .info {
        margin-top: 12px;
    }
    
    .button-group {
        margin-top: 12px;
        gap: 6px;
    }
    
    .button-group button {
        min-width: 80px;
    }
    
    .mobile-controls {
        margin-top: 15px;
        gap: clamp(6px, 1vw, 8px);
    }
    
    .analog-stick {
        margin-top: 15px;
    }
}

@media (max-width: 360px) {
    .button-group button {
        min-width: 70px;
        padding: 6px 12px;
    }
    
    .mobile-controls {
        grid-template-columns: repeat(3, minmax(45px, 1fr));
    }
}