/* Add pixel font and apply across the UI */
@font-face {
    font-family: 'Computer Pixel 7';
    /*src: url('computer_pixel-7.ttf') format('truetype');*/
    src: url('half_bold_pixel-7.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

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

body {
    font-family: /*'Computer Pixel 7', */'Courier New', monospace;
    background-color: #000;
    color: #fff;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 800px;
    width: 100%;
}

.game-header {
    text-align: center;
    margin-bottom: 20px;
    background-color: #0000AA;
    border: 4px solid #fff;
    padding: 15px;
}

.game-header h1 {
    font-size: 2em;
    color: #FFFF00;
    text-shadow: 2px 2px #AA0000;
    margin-bottom: 10px;
}

.score-panel {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 10px;
}

.score {
    font-size: 1.2em;
    background-color: #000;
    padding: 5px 10px;
    border: 2px solid #00AAAA;
}

.musicians-status {
    display: flex;
    flex-direction: column;
    gap: 5px;
    text-align: left;
}

.musician-status {
    font-size: 0.9em;
    background-color: #000;
    padding: 3px 8px;
    border: 1px solid #00AA00;
}

#gameCanvas {
    display: block;
    width: 100%;
    max-width: 650px;
    height: auto;
    margin: 0 auto;
    border: 4px solid #fff;
    background-color: #000;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    image-rendering: -moz-crisp-edges;
    -ms-interpolation-mode: nearest-neighbor;
}

.controls {
    text-align: center;
    margin-top: 20px;
    background-color: #0000AA;
    border: 4px solid #fff;
    padding: 15px;
}

.instructions {
    margin-bottom: 15px;
}

.instructions h3 {
    color: #FFFF00;
    margin-bottom: 10px;
}

.instructions p {
    margin: 5px 0;
    font-size: 0.9em;
}

.btn {
    font-family: /*'Computer Pixel 7', */'Courier New', monospace;
    font-size: 1em;
    padding: 10px 20px;
    margin: 5px;
    background-color: #AA0000;
    color: #fff;
    border: 3px solid #fff;
    cursor: pointer;
    text-transform: uppercase;
    transition: all 0.2s;
}

.btn:hover:not(:disabled) {
    background-color: #FF0000;
    transform: scale(1.05);
}

.btn:active:not(:disabled) {
    transform: scale(0.95);
}

.btn:disabled {
    background-color: #555;
    cursor: not-allowed;
    opacity: 0.5;
}

.game-info {
    margin-top: 15px;
    padding: 15px;
    background-color: #550055;
    border: 3px solid #AA00AA;
    text-align: center;
}

.game-info p {
    margin: 5px 0;
    font-size: 0.9em;
}

/* Mobile controls */
.mobile-controls {
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin-top: 20px;
    padding: 20px;
    background-color: #0000AA;
    border: 4px solid #fff;
}

.middle-row {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.direction-btn {
    width: 60px;
    height: 60px;
    font-size: 24px;
    font-weight: bold;
    background-color: #AA0000;
    color: #FFFF00;
    border: 3px solid #fff;
    cursor: pointer;
    font-family: /*'Computer Pixel 7', */'Courier New', monospace;
    transition: all 0.1s;
    user-select: none;
    touch-action: manipulation;
}

.direction-btn:active:not(:disabled) {
    background-color: #FF0000;
    transform: scale(0.95);
}

.direction-btn:disabled {
    background-color: #0000AA;
    border-color: #0000AA;
    cursor: default;
}

.center-btn {
    width: 60px;
}

a {
    color: #00FFFF;
    /*text-decoration: none;  */
}

@media (max-width: 600px) {
    /* Make the game fill the full device width in portrait mobile. */
    /* Remove horizontal page padding and let the main container span 100vw. */
    body {
        /* Respect safe area on iOS but remove extra horizontal paddings */
        padding-top: env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-bottom);
        padding-left: 0;
        padding-right: 0;
    }

    .container {
        max-width: none;
        width: 100vw; /* fill the viewport width */
        padding: 0;    /* avoid extra spacing that would shrink the canvas */
        margin: 0 auto;
    }

    .canvas-container {
        /* keep vertical padding but allow full width for the canvas */
        padding: 10px 0;
        width: 100%;
    }

    /* Make canvas use the full viewport width but maintain aspect ratio */
    #gameCanvas {
        width: 100%;
        max-width: 100vw;
        height: auto;
        display: block;
        margin: 0 auto;
        box-sizing: border-box;
    }

    .mobile-controls {
        display: flex;
    }

    .direction-btn {
        width: 50px;
        height: 50px;
        font-size: 20px;
    }

    .game-header h1 {
        font-size: 1.5em;
    }

    .score-panel {
        flex-direction: column;
        align-items: center;
    }

    /* Hide musician status on mobile to save space */
    .musicians-status {
        display: none;
    }

    .canvas-container {
        padding: 0 !important;
    }
}

.canvas-container {
    background-image: url("img/back-game.jpg");
    background-position: center center;
    background-size: cover;
    background-repeat: no-repeat;
    padding: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 315px;
}
