/* --- CONFIGURAÇÃO GLOBAL --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box; 
    -webkit-tap-highlight-color: transparent; /* Remove o brilho azul do toque */
}

html, body {
    width: 100vw;
    height: 100vh;
    background-color: #000;
    overflow: hidden; 
    font-family: 'Orbitron', sans-serif;
    color: #fff;
    user-select: none;
    -webkit-user-select: none;
}

/* --- GAME CONTAINER (TELA CHEIA) --- */
#game-container {
    position: relative;
    width: 100%;
    height: 100%;
    
    /* Mágica do Layout: Empilha o jogo (em cima) e os controles (embaixo) */
    display: flex;
    flex-direction: column;
}

/* --- CAMADA DE FUNDO (ESTRELAS) --- */
#backgroundCanvas {
    position: fixed; /* Fixo atrás de tudo */
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1; 
}

/* --- 1. WRAPPER DO JOGO (Onde o canvas e os menus ficam) --- */
#game-wrapper {
    position: relative;
    width: 100%;
    
    /* Ocupa todo o espaço disponível, MENOS a altura dos controles */
    flex-grow: 1; 
    
    /* Garante que o canvas não vaze */
    overflow: hidden; 
    
    /* Centraliza o canvas (que tem object-fit) */
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2; /* Acima do fundo */
}

#gameCanvas {
    /* O canvas agora se ajusta DENTRO do wrapper */
    width: 100%;
    height: 100%;
    
    /* A MÁGICA: Mantém a proporção 4:3 (800x600) e adiciona barras pretas
       (letterbox) DENTRO do wrapper. Isso força o "mapa todo". */
    object-fit: contain; 
}

/* --- 2. CONTAINER DE CONTROLES (EMBAIXO) --- */
#controls-container {
    position: relative;
    width: 100%;
    height: 90px; /* Altura fixa para os botões */
    flex-shrink: 0; /* Não deixa encolher */
    background-color: #05050A; /* Cor de fundo da barra de controle */
    border-top: 2px solid #00ff7f;
    
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    z-index: 3; /* Acima do fundo */
}

.control-btn {
    height: 100%;
    width: 33%;
    background-color: rgba(0, 255, 127, 0.1);
    border: 2px solid #00ff7f;
    border-radius: 10px;
    color: #00ff7f;
    font-size: 2.5rem; /* Tamanho do ícone < > */
    font-weight: bold;
    display: flex;
    justify-content: center;
    align-items: center;
    padding-bottom: 5px; /* Ajuste visual do ícone */
}
.control-btn.fire {
    width: 30%; /* Botão de tiro um pouco menor */
    font-size: 2rem; /* Tamanho do ícone O */
    background-color: rgba(255, 65, 190, 0.1); /* Cor rosa */
    border-color: #ff41be;
    color: #ff41be;
}
/* Feedback de toque para os botões HTML */
.control-btn:active {
    background-color: rgba(0, 255, 127, 0.4);
}
.control-btn.fire:active {
    background-color: rgba(255, 65, 190, 0.4);
}


/* --- TELAS DE MENU (MODAIS) --- */
.modal {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 10; /* Acima do canvas */
    background-color: rgba(10, 4, 13, 0.95);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 20px;
    text-align: center;
}

#highScoreFormContainer {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 11; /* Acima dos outros menus */
    background-color: rgba(10, 4, 13, 0.95);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.hidden {
    display: none !important; 
}

/* --- ESTILO DOS ELEMENTOS DOS MENUS --- */
h1, h2 {
    color: #00ff7f;
    text-shadow: 0 0 15px #00ff7f;
    margin-bottom: 20px;
    font-size: 2.5rem;
}
h2 { font-size: 2rem; }

#storyText {
    font-size: 1rem;
    line-height: 1.6;
    max-width: 600px;
    margin-bottom: 30px;
    color: #eee;
}

.modal button {
    background-color: transparent;
    border: 2px solid #00ff7f;
    color: #00ff7f;
    border-radius: 8px;
    padding: 15px 30px;
    font-size: 1.2rem;
    font-family: 'Orbitron', sans-serif;
    font-weight: bold;
    cursor: pointer;
    margin: 8px;
    min-width: 250px; 
}
.modal button:active, .modal button:hover {
    background-color: #00ff7f;
    color: #000;
    box-shadow: 0 0 20px #00ff7f;
}

/* Form de High Score */
#highScoreForm {
    border: 2px solid #00ff7f;
    box-shadow: 0 0 15px #00ff7f;
    padding: 25px;
    text-align: center;
    border-radius: 15px;
    width: 90%;
    max-width: 400px;
}
#highScoreForm input {
    background-color: #0a040d;
    color: #f0f6fc;
    border: 1px solid #00ff7f;
    padding: 12px;
    font-size: 1.1em;
    text-transform: uppercase;
    width: 150px;
    text-align: center;
    font-family: 'Orbitron', sans-serif;
    margin-right: 10px;
    border-radius: 5px;
}
#highScoreForm button {
    background-color: #00ff7f;
    color: #0a040d;
    border: none;
    border-radius: 5px;
    padding: 12px 18px;
    font-size: 1em;
    font-weight: bold;
    cursor: pointer;
    font-family: 'Orbitron', sans-serif;
}