body {
    margin: 0;
    padding: 0;
    overflow: hidden;
    background-color: #602F11; /* The land */
    user-select: none; /* Prevent text selection for the entire page */
}

canvas {
    display: block;
    margin: 0 auto;
    background-color: #3C7EBB; /*Sky background */
    border: 2px solid black;
    width: 100%; /* Responsive canvas */
    height: auto; /* Maintain aspect ratio */
}

.basketball {
    width: 50px; /* Width of the basketball */
    height: 50px; /* Height of the basketball */
    background-color: #D2650D; /* Basketball color */
    border-radius: 50%; /* Make it round */
    position: absolute;
    border: 3px solid #000; /* Black border */
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5); /* Shadow effect */
}

.obstacle {
    width: 50px; /* Width of obstacle */
    height: 50px; /* Height of obstacle */
    background-color: #8B4513; /* Brown color for obstacles */
    position: absolute;
}

.spring {
    background-color: #00FF00; /* Green color for springs */
}

.finish-line {
    background-color: #FFD700; /* Gold color for finish line */
}

.score {
    position: absolute;
    top: 10px;
    left: 10px;
    font-size: 24px;
    color: white; /* Change text color to white */
    font-weight: bold; /* Make text bold */
    font-family: 'Arial', sans-serif;
}

@media (max-width: 768px) {
    canvas {
        height: 80vh; /* Adjust height for smaller screens */
    }
}

@media (orientation: portrait) {
    body::before {
        content: "Puter layarnya, dong. Harus horizontal biar panjang lapangannya.";
        position: fixed;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        font-size: 20px;
        color: white;
        background-color: rgba(0, 0, 0, 0.8);
        padding: 20px;
        border-radius: 10px;
        text-align: center;
        z-index: 1000;
    }

    canvas {
        display: none; /* Hide the game canvas in portrait mode */
    }
}

.touch-controls {
    position: fixed;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    display: flex;
    justify-content: space-between;
    pointer-events: none; /* Allow clicks to pass through except on buttons */
}

.left-controls, .right-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    pointer-events: auto; /* Enable interaction for buttons */
}

.left-controls {
    position: absolute;
    bottom: 20%; /* Position buttons 20% from the bottom */
    left: 5%; /* Slightly away from the left edge */
    flex-direction: row; /* Arrange left and right arrows side by side */
    gap: 10px; /* Add spacing between buttons */
}

.right-controls {
    position: absolute;
    bottom: 20%; /* Position buttons 20% from the bottom */
    right: 5%; /* Slightly away from the right edge */
    flex-direction: row; /* Arrange buttons on the same line */
    gap: 10px; /* Add spacing between buttons */
    justify-content: flex-end;
}

.control-button {
    background-color: rgba(0, 0, 0, 0.5); /* Semi-transparent black */
    color: transparent; /* Hide text */
    border: none;
    border-radius: 50%;
    width: 70px; /* Button width */
    height: 70px; /* Button height */
    font-size: 28px; /* Larger font for better visibility */
    margin: 10px;
    cursor: pointer;
    outline: none;
    user-select: none; /* Prevent text selection */
    -webkit-user-select: none; /* Prevent text selection on WebKit browsers */
    -webkit-tap-highlight-color: transparent; /* Remove tap highlight on mobile */
    position: relative; /* For pseudo-elements */
    display: flex;
    justify-content: center;
    align-items: center;
    touch-action: manipulation; /* Prevent text selection on long press */
    pointer-events: auto; /* Ensure buttons are clickable */
}

.control-button:before {
    content: '';
    position: absolute;
    width: 0;
    height: 0;
    border-style: solid;
    pointer-events: none; /* Prevent interaction with the chevron */
    display: block; /* Ensure visibility on all devices */
    background-color: transparent; /* Ensure no background issues */
}

#leftButton:before {
    border-width: 15px 20px 15px 0; /* Chevron shape */
    border-color: transparent white transparent transparent;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
}

#rightButton:before {
    border-width: 15px 0 15px 20px; /* Chevron shape */
    border-color: transparent transparent transparent white;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
}

#jumpButton:before {
    border-width: 0 15px 20px 15px; /* Chevron shape */
    border-color: transparent transparent white transparent;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
}

.control-button:active {
    background-color: rgba(255, 255, 255, 0.5); /* Change color on press */
}

/* Only show touch controls on touch devices */
@media (hover: none) and (pointer: coarse) {
    .touch-controls {
        display: flex;
    }
}

@media (hover: hover) and (pointer: fine) {
    .touch-controls {
        display: none;
    }
}

.fullscreen-button {
    position: fixed;
    bottom: 1%; /* Lower the button further */
    left: 50%; /* Center horizontally */
    transform: translateX(-50%); /* Adjust for centering */
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    border-radius: 10px;
    padding: 10px 20px;
    font-size: 16px;
    cursor: pointer;
    z-index: 1000;
    user-select: none; /* Prevent text selection */
}

.fullscreen-button:active {
    background-color: rgba(255, 255, 255, 0.5);
}

#exitFullscreenButton {
    position: fixed;
    bottom: 5%;
    right: 15%; /* Slightly left of the fullscreen button */
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    border-radius: 10px;
    padding: 10px 20px;
    font-size: 16px;
    cursor: pointer;
    z-index: 1000;
    user-select: none; /* Prevent text selection */
}

#exitFullscreenButton:active {
    background-color: rgba(255, 255, 255, 0.5);
}