body {
    background-color:
        lab(17.26% 3.84 -27.5);
    font-family: 'Courier New', Courier, monospace;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;    
    
    margin: 0;
    margin-top: 5%;
    color: #eee;
}

h1 {
    color: #6e6;
    margin-bottom: 10px;
}

.header {
    width: 100%;
    max-width: 420px;
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 0 10px;
    margin: 0 auto 10px auto;
}

.header h1 {
    margin: 0;
    color: #6e6;
}

.length {
    color: #eee;
    font-size: 18px;
}

.score-container {
    display: flex;
    justify-content: space-around;
    width: 100%;
    max-width: 420px;
    margin-bottom: 10px;
    font-size: 18px;
    color: #eee;
}

.game-container {
    position: relative;
    /* Added for overlay positioning */
    border: 2px solid #6e6;
    padding: 10px;
    border-radius: 5px;
    background-color: #000;
    width: 400px;
    /* Fast storlek för desktop */
    margin: 0 auto;
    aspect-ratio: 1/1;
    /* Behåll kvadratisk form */
    display: flex;
    justify-content: center;
    align-items: center;
}

canvas {
    width: 100%;
    height: 100%;
    display: block;
    background: #111;
}

#gameOverScreen {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.85);
    color: #eee;
    display: none; /* Hidden by default */
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
}

#gameOverScreen h2 {
    font-size: 30px;
    color: #e66;
    margin-bottom: 10px;
}

#gameOverStats {
    font-size: 20px;
    margin-bottom: 20px;
}

#gameOverStats span {
    margin: 0 10px;
}

#replayButtons button {
    background-color: #444;
    color: #eee;
    border: 2px solid #666;
    padding: 10px 20px;
    margin: 5px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 16px;
    cursor: pointer;
    display: block;
    width: 80%;
    max-width: 250px;
}

#replayButtons button:hover {
    background-color: #555;
    border-color: #888;
}

.global-scores-container {
    margin: 20px auto;
    width: 80%;
    max-width: 400px;
    text-align: center;
}

.hidden {
    display: none;
}



/* Media query för mobil stående */
@media (max-width: 600px) and (orientation: portrait) {
    body {
        margin: 0;
        margin-top: 1%;
        padding: 5px;
        overflow: hidden;
    }

    .header {
        padding: 0 5px;
    }

    .header h1 {
        font-size: 1.5em;
    }

    .length {
        font-size: 16px;
    }

    .game-container {
        width: 98vmin;        
        margin: 0 auto;
        box-sizing: border-box;
    }

    h1 {
        margin: 5px 0;
        font-size: 1.5em;
    }

    #canvas {
        width: 100%;
        height: 100%;
        
    }
}

#joystickContainer {
    /* position: fixed; */
    padding-top: 15px;
    bottom: 50px;
    left: 50%;
    /* transform: translateX(-50%); */
    width: 120px;
    height: 120px;
}

#joystickBase {
    width: 160px;
    height: 160px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    border: 3px solid rgba(255, 255, 255, 0.3);
    position: relative;
    backdrop-filter: blur(10px);
}

#joystickKnob {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(145deg, hsl(212, 99%, 67%), #0066cc);
    position: absolute;
    top: calc(50% - 20px);
    left: calc(50% - 20px);
    transition: all 0.1s ease;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    border: 2px solid rgba(255, 255, 255, 0.2);
}

#joystickKnob.active {
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.4);
    transform: scale(1.1);
}

#joystickKnob:before {
    content: '';
    position: absolute;
    top: 5px;
    left: 5px;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.5) 0%, rgba(255, 255, 255, 0) 60%);
}

#replayComment {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(0, 0, 0, 0.8);
    color: #fff;
    padding: 10px 20px;
    border-radius: 5px;
    font-size: 18px;
    text-align: center;
    display: none; /* Hidden by default */
    animation: blink-animation 1s infinite;
    z-index: 10;
    max-width: 90%;
}

@keyframes blink-animation {
    50% {
        opacity: 0.6;
    }
}