body {
    background-color: #2c3e50;
    font-family: 'Press Start 2P', cursive;
    color: #ecf0f1;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    text-align: center;
}

.game-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

h1 {
    color: #27ae60;
    text-shadow: 2px 2px 0px #000;
    font-size: 24px;
    margin-bottom: 10px;
}

.controls-info {
    background: rgba(0, 0, 0, 0.3);
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 12px;
    line-height: 1.5;
}

.canvas-wrapper {
    position: relative;
    border: 4px solid #95a5a6;
    border-radius: 4px;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.5);
    background-color: #34495e;
    /* Wall color */
}

canvas {
    display: block;
    /* Removes bottom spacing */
}

.btn-main {
    background-color: #e67e22;
    color: white;
    border: 4px solid #d35400;
    padding: 15px 30px;
    font-family: inherit;
    font-size: 16px;
    cursor: pointer;
    text-transform: uppercase;
    transition: transform 0.1s;
}

.btn-main:hover {
    background-color: #f39c12;
    transform: scale(1.05);
}

.btn-main:active {
    transform: scale(0.95);
    border-color: #a04000;
}

/* Win Overlay */
.hidden {
    display: none !important;
}

#win-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
}

.win-message {
    background: #2ecc71;
    padding: 30px;
    border: 4px solid #27ae60;
    border-radius: 10px;
    text-align: center;
    color: #fff;
    text-shadow: 2px 2px 0 #000;
}

.win-message h2 {
    margin-top: 0;
    font-size: 20px;
}

#btn-next {
    margin-top: 20px;
    padding: 10px 20px;
    font-family: inherit;
    cursor: pointer;
    background: #f1c40f;
    border: 4px solid #f39c12;
    color: #000;
    font-weight: bold;
}

#btn-next:hover {
    background: #f39c12;
}

/* Mobile Controls */
.touch-controls {
    display: none; /* Hidden by default on desktop */
    flex-direction: column;
    align-items: center;
    margin-top: 20px;
    gap: 5px;
}

.dpad-row {
    display: flex;
    gap: 5px;
}

.dpad-btn {
    width: 60px;
    height: 60px;
    font-size: 24px;
    background-color: rgba(255, 255, 255, 0.2);
    border: 2px solid #ecf0f1;
    color: #ecf0f1;
    border-radius: 10px;
    cursor: pointer;
    touch-action: manipulation; /* Prevent zoom on double tap */
    user-select: none;
    -webkit-user-select: none;
}

.dpad-btn:active {
    background-color: rgba(255, 255, 255, 0.4);
    transform: scale(0.95);
}

.dpad-center {
    width: 60px;
    height: 60px;
}

/* Media Query for Mobile */
@media (max-width: 768px) {
    .touch-controls {
        display: flex;
    }

    .controls-info {
        display: none; /* Hide keyboard info on mobile */
    }

    h1 {
        font-size: 1.5rem;
        margin-bottom: 10px;
    }

    #mazeCanvas {
        width: 100%;
        max-width: 350px; /* Limit size on phone */
        height: auto;
    }

    .game-container {
        padding: 10px;
    }
}