
/* Estilos Gerais */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
    overflow: hidden;; /* Desativa scroll global */
    font-family: sans-serif;
    background-color: #2c3e50; /* Azul escuro */
    color: #ecf0f1; /* Branco acinzentado */
    position: relative; /* Corrigido: Removido display: flex */
}

.screen {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    width: 100%;
    height: 100%;
    padding: 20px;
    position: absolute; /* Para sobrepor */
    top: 0;
    left: 0;
    background-color: rgba(44, 62, 80, 0.95); /* Fundo semi-transparente */
}

.screen.active {
    display: flex;
}

h1 {
    font-size: 3em;
    margin-bottom: 20px;
    color: #e67e22; /* Laranja */
}

h2 {
    font-size: 2em;
    margin-bottom: 15px;
    color: #e67e22;
}

p, li {
    font-size: 1.1em;
    line-height: 1.6;
    margin-bottom: 10px;
    max-width: 600px; /* Limita largura do texto */
}

ul {
    list-style: none;
    padding-left: 0;
    text-align: left;
}

li::before {
    content: "🧪 "
}

button {
    background-color: #e67e22;
    color: #fff;
    border: none;
    padding: 15px 30px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.2em;
    margin: 10px;
    transition: background-color 0.3s ease, transform 0.1s ease;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
}

button:hover {
    background-color: #d35400;
}

button:active {
    transform: scale(0.95);
}

.high-score-display {
    margin-top: 20px;
    font-size: 1.2em;
    color: #bdc3c7;
}

/* Tela do Jogo */
#game-screen.screen.active {
    min-height: 100vh;
    overflow-y: auto;
    justify-content: flex-start;
    align-items: center;
    display: flex;
    flex-direction: column;
}

#game-container {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 400px;
    height: 100vh; /* agora ocupa toda a tela */
    overflow: hidden; /* impede que role internamente */
    border: 2px solid #fff;
    background-color: #000;
    margin-bottom: 10px;
}
#game-canvas {
    border: 3px solid #ecf0f1;
    background-color: #34495e;
    display: block;
    max-width: 100%;
    height: auto;
}

#score-container {
    margin-top: 2%;
    font-size: 3vw;
    width: 100%;
    display: flex;
    justify-content: space-between;
    padding: 0 2%;
}

#mobile-controls {
    display: flex;
    justify-content: center;
    gap: 2%;
    position: relative;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 400px;
    padding: 2% 0;
    background-color: rgba(0, 0, 0, 0.3);
    border-radius: 5px;
    margin-top: 10px;
}

#mobile-controls button {
    font-size: 4vw;
    padding: 2% 5%;
    margin: 0 1%;
    background-color: #3498db;
    color: #fff;
    border: none;
    border-radius: 5px;
    cursor: pointer;
}

#mobile-controls button:active {
    background-color: #ddd;
}

#how-to-play-screen {
    background-color: rgba(52, 73, 94, 0.98);
}

#how-to-play-screen button.close-how-to-play {
    margin-top: 20px;
}

@media (max-width: 1024px) {
    h1 { font-size: 2.5em; }
    h2 { font-size: 1.8em; }
    p, li { font-size: 1em; }
    button { font-size: 1em; padding: 12px 25px; }
    #game-container { max-width: 95vw; }
    #mobile-controls { display: flex; }
    #score-container { font-size: 1em; }
}

@media (max-width: 768px) {
  #move-left,
  #move-right,
  #move-down {
    font-size: 6vw;
    padding: 4% 8%;
  }
}


@media (max-height: 500px) and (orientation: landscape) {
    h1 { font-size: 2em; margin-bottom: 10px; }
    button { padding: 8px 15px; font-size: 0.9em; }
    #mobile-controls button { font-size: 1.5em; padding: 5px 10px; }
    #score-container { margin-top: 5px; }
}

.atom-H { background-color: #ecf0f1; color: #333; border: 1px solid #bdc3c7; }
.atom-O { background-color: #e74c3c; color: #fff; border: 1px solid #c0392b; }
.atom-C { background-color: #95a5a6; color: #fff; border: 1px solid #7f8c8d; }
.atom-N { background-color: #3498db; color: #fff; border: 1px solid #2980b9; }

.grid-cell { }

.game-container {
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: flex-start;
    gap: 30px;
}

#molecule-targets {
    background: #ecf0f1;
    padding: 15px;
    border-radius: 8px;
    max-width: 200px;
    font-family: sans-serif;
    font-size: 14px;
}

.molecule-diagram {
    background: #fff;
    border: 1px solid #bdc3c7;
    border-radius: 5px;
    padding: 6px 8px;
    margin-bottom: 10px;
    text-align: center;
    white-space: pre;
}

.molecule-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin-bottom: 15px;
}

.molecule-list img {
    height: 80px;
    border: 1px solid #ccc;
    border-radius: 5px;
    background-color: white;
    padding: 5px;
}

.molecule-descriptions {
    font-size: 0.95rem;
    line-height: 1.5;
    padding-left: 20px;
    text-align: left;
}

#molecule-images img {
    max-width: 100px;
    height: auto;
    display: block;
}

#game-back-to-menu-button {
     transform: scale(0.7);
    z-index: 9999;
    display: inline-block !important;
    background-color: red !important;
}

#reset-button {
    
    font-size: 0.6em;
    padding: 7px 15px;
}