/* DASAR (FIT SCREEN) */
body {
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #ffffff;
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* HEADER COMPACT (TENGAH SEMUA)  */
.game-info {
    padding: 10px;
    background-color: #f39c12; 
    color: #ffffff; 
    flex-shrink: 0;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    z-index: 20;
    text-align: center; /* KUNCI SEMUA KE TENGAH */
}

.game-info h1 {
    margin: 0;
    font-size: 24px;
    font-weight: 800;
}

.game-info p {
    font-size: 12px;
    margin: 4px 0;
    opacity: 0.9;
}

#score {
    font-size: 20px;
    font-weight: bold;
    border: 2px solid #ffffff;
    display: inline-block;
    padding: 2px 15px;
    border-radius: 8px;
    margin-top: 5px;
}

/* CONTAINER GAME (THICK BORDER) */
#game-container {
    width: 350px;
    flex-grow: 1;
    max-height: 72vh;
    margin: 10px auto;
    position: relative;
    overflow: hidden;
    border-radius: 20px;
    border: 12px solid #f39c12;
    background-color: #ffffff;
}

/* LOGIKA JALANAN MULUS */
.road-bg {
    position: absolute;
    top: -100%;
    left: 0;
    width: 100%;
    height: 200%;
    background-image: url('Jalan.jpg');
    background-repeat: repeat-y;
    background-size: 100% 50%;
    z-index: 1;
    animation: smoothRoad 1.2s linear infinite;
    will-change: transform;
}

@keyframes smoothRoad {
    0% { transform: translateY(0); }
    100% { transform: translateY(50%); }
}

/* PLAYER & OBSTACLE SPRITES */
#player {
    width: 150px;
    height: 150px;
    position: absolute;
    bottom: 20px;
    transition: left 0.1s ease-out;
    z-index: 10;
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.2));
}

.obstacle {
    width: 130px;
    height: 130px;
    position: absolute;
    z-index: 5;
}

#player img, .obstacle img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* GAME OVER */
#game-over {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    padding: 25px;
    border-radius: 20px;
    border: 5px solid #f39c12;
    z-index: 100;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    min-width: 280px;
}

input#nickname {
    padding: 10px;
    width: 80%;
    margin-bottom: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
}

button {
    padding: 10px 20px;
    background: #f39c12;
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: bold;
    cursor: pointer;
    margin: 5px;
}

.hidden { display: none; }

@media (max-width: 450px) {
    #game-container { width: 90vw; }
}