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

body {
    background-color: #f7f7f7;
    font-family: 'Courier New', Courier, monospace;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    overflow: hidden;
}

#main-layout {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 98vw;
    margin: 0 auto;
}

#game-row {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    gap: 10px;
}

#game-container {
    position: relative;
    flex: 1;
    max-width: 1000px;
    aspect-ratio: 2 / 1;
    background-color: #fff;
    border-bottom: 2px solid #535353;
    overflow: hidden;
}

#controls-row {
    width: 100%;
    display: flex;
    justify-content: center;
    padding-top: 15px;
}

#gameCanvas {
    display: block;
    width: 100%;
    height: 100%;
}

#ui-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10;
    pointer-events: none;
}

#ui-overlay > div {
    pointer-events: auto;
    text-align: center;
    background: rgba(255, 255, 255, 0.9);
    padding: 20px;
    border-radius: 8px;
}

.hidden {
    display: none !important;
}

h1 {
    font-size: 2.5rem;
    color: #535353;
    margin-bottom: 20px;
}

#character-selection {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-bottom: 20px;
}

.char-option {
    width: 60px;
    height: 60px;
    border: 3px solid transparent;
    cursor: pointer;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    transition: transform 0.2s;
}

.char-option:hover {
    transform: scale(1.1);
}

.char-option.selected {
    border-color: #535353;
}

button {
    padding: 10px 20px;
    font-size: 1.2rem;
    background-color: #535353;
    color: white;
    border: none;
    cursor: pointer;
    font-family: inherit;
}

button:hover {
    background-color: #333;
}

/* Touch Controls */
.touch-btn {
    display: none; /* Hidden by default on desktop */
    background-image: url('assets/obstacles/ground_obstacle.png'); /* Placeholder sprite */
    background-size: 60%;
    background-repeat: no-repeat;
    background-position: center 30%;
    background-color: rgba(255, 255, 255, 0.8);
    color: #535353;
    font-weight: bold;
    font-size: 0.8rem;
    border: 2px solid #535353;
    border-radius: 12px;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    padding-bottom: 8px;
}

.side-btn {
    width: 70px;
    height: 70px;
}

.bottom-btn {
    width: 140px;
    height: 60px;
    background-size: 40px;
}

.touch-btn:active {
    background-color: rgba(83, 83, 83, 0.4);
    transform: scale(0.95);
}

/* Show buttons on touch devices or small screens */
@media (hover: none) and (pointer: coarse), (max-width: 1024px) {
    .touch-btn {
        display: block;
    }
}

/* Small phone adjustments */
@media (max-width: 600px) {
    .side-btn {
        width: 60px;
        height: 60px;
    }
    
    #game-row {
        gap: 5px;
    }

    .bottom-btn {
        width: 80%;
        max-width: 300px;
    }
}

