body {
    margin: 0;
    padding: 0;
    background-color: #222;
    /* Fundo escuro fora do jogo */
    color: white;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    overflow: hidden;
    /* Remove barras de rolagem */
    touch-action: none;
    /* Impede zoom e arrastar no celular */
    width: 100vw;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Container do Jogo (Garante que a UI siga o Canvas) */
#game-container {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 0;
    /* Remove espaços extras sob o canvas */
}

canvas {
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.8);
}

/* Interface (Pontos e Nível) */
#ui-layer {
    position: absolute;
    top: 10px;
    /* Ajustado para ficar dentro da graminha */
    left: 0;
    width: 100%;
    display: flex;
    justify-content: space-between;
    padding: 0 10px;
    /* Margem interna em relação as bordas do canvas */
    box-sizing: border-box;
    font-weight: bold;
    font-size: 1.3rem;
    /* Um pouco menor para caber melhor no canvas */
    text-shadow: 2px 2px 2px #000;
    pointer-events: none;
    z-index: 5;
}

/* Telas de Aviso (Start / Game Over) */
#overlay-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 20;
    transition: opacity 0.3s;
}

.hidden {
    opacity: 0;
    pointer-events: none;
}

h1 {
    margin: 0 0 15px 0;
    color: #4cd137;
    text-transform: uppercase;
    font-size: 2.5rem;
    text-align: center;
}

p {
    text-align: center;
    max-width: 90%;
    line-height: 1.6;
    color: #ddd;
    font-size: 1.1rem;
}

button.btn-start {
    margin-top: 25px;
    padding: 15px 50px;
    font-size: 1.3rem;
    background: #e1b12c;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    font-weight: bold;
    color: #2f3640;
    box-shadow: 0 4px 15px rgba(225, 177, 44, 0.4);
}

button.btn-start:active {
    transform: scale(0.96);
}

/* Controles Mobile Flutuantes */
#mobile-controls {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: grid;
    grid-template-areas:
        ". up ."
        "left down right";
    gap: 10px;
    z-index: 10;
    opacity: 0.5;
}

/* Ocultar controles se estiver no PC (opcional, removi para facilitar testes) */
@media (min-width: 1024px) {
    /* #mobile-controls { display: none; } */
    /* Deixei visível para testar redimensionamento no PC também */
}

.dpad-btn {
    width: 60px;
    height: 60px;
    background: rgba(255, 255, 255, 0.15);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    cursor: pointer;
    backdrop-filter: blur(2px);
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.dpad-btn:active {
    background: rgba(76, 209, 55, 0.5);
    border-color: #4cd137;
}

/* Posicionamento do Grid dos botões */
#btn-up {
    grid-area: up;
}

#btn-left {
    grid-area: left;
}

#btn-down {
    grid-area: down;
}

#btn-right {
    grid-area: right;
}



/* MODULO homeimg */
.homeimg {
    position: absolute;
    left: 0.4vh;
    top: 1.1vh;
    z-index: 333;
    width: auto;
    height: 5vh;
    display: flex;
    opacity: 0.4;
    transition: all 0.2s ease-in-out;
}

.homeimg img {
    display: block;
    object-fit: contain;
    height: 100%;
}

.homeimg:hover {
    height: 6vh;
    cursor: pointer;
    opacity: 1;
}

/*-----------------------------------------------------------------------*/