html,
body {
  height: 100dvh;
  margin: 0;
  padding: 0;
  font-family: Arial, sans-serif;
  box-sizing: border-box;
}
body {
  background-color: #121212;
  color: #e0e0e0;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 10px;
  height: 100%;
  box-sizing: border-box;
  background-image: radial-gradient(
    circle at 50% 0%,
    rgba(42, 50, 77, 0.5),
    transparent 60%
  );
  background-repeat: no-repeat;
}

.btn-home {
  position: absolute;
  top: 15px;
  left: 15px;
  z-index: 10;

  text-decoration: none;
  color: #888;
  background-color: transparent;
  border: 1px solid #555;
  width: 50px;
  height: 50px;
  border-radius: 50%;

  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6em;
  transition: all 0.2s ease;
}

.btn-home:hover {
  background-color: #333;
  color: #fff;
  border-color: #777;
  transform: scale(1.1);
}

.container {
  position: relative;
  width: 100%;
  max-width: 500px;
  height: 100%;
  max-height: 800px;
  background-color: #1e1e1e;
  padding: 20px;
  border-radius: 10px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  backdrop-filter: blur(5px);
  border: 1px solid rgba(255, 255, 255, 0.1);
}
.hidden {
  display: none !important;
}
h1,
h2 {
  font-size: 2.8em;
  font-weight: 700;
  margin: 0 0 40px 0;
  text-align: center;
  background: linear-gradient(90deg, #00aaff, #aa55ff);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
}
section,
main {
  width: 100%;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
}
#tela-inicial,
#tela-nomes,
#tela-setup,
#tela-transicao,
#tela-vitoria,
#tela-online-lobby,
#tela-criar-sala {
  justify-content: center;
}
#tela-inicial h1 {
  margin-bottom: 40px;
}
.menu-opcoes {
  width: 100%;
  max-width: 300px;
  display: flex;
  align-self: center;
  flex-direction: column;
  gap: 15px;
}
#btn-jogar-online {
  background-color: #28a745;
}
#btn-jogar-online:hover {
  background-color: #1a9b38;
}
.btn-voltar {
  position: absolute;
  top: 15px;
  left: 15px;
  width: 30px;
  height: 30px;
  padding: 0;
  margin: 0;
  font-size: 1em;
  font-weight: bold;
  line-height: 0px;
  text-align: center;
  border-radius: 50%;
  background-color: transparent;
  border: 1px solid #555;
  color: #888;
  z-index: 10;
  transition: all 0.2s ease;
}
.btn-voltar:hover {
  background-color: #333;
  color: #fff;
  border-color: #777;
}
.input-group {
  margin-bottom: 15px;
}
.input-group label {
  display: block;
  margin-bottom: 5px;
  font-weight: bold;
  color: #a0a0a0;
}
.input-group input {
  width: 100%;
  padding: 10px;
  border-radius: 5px;
  background-color: #2a2a2a;
  border: 1px solid #444;
  color: #e0e0e0;
  box-sizing: border-box;
}
button {
  width: 100%;
  padding: 12px;
  margin-top: 10px;
  margin-bottom: 0.5%;
  border: none;
  background-color: #007bff;
  color: white;
  border-radius: 5px;
  cursor: pointer;
  font-weight: bold;
  font-size: 1em;
  flex-shrink: 0;
}

button:hover {
  background-color: #0068d8;
}

button:disabled {
  background-color: #444;
  color: #888;
  cursor: not-allowed;
}
.error-message {
  color: #dc3545;
  text-align: center;
  min-height: 20px;
}

.feedback-row {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 15px;
}

.feedback-counter {
  font-size: 0.9em;
  font-weight: bold;
  color: #a0a0a0;
  width: 100px;
  text-align: left;
}

/* Lobby Online */
.lobby-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
  flex-shrink: 0;
}
.lobby-actions button {
  margin-top: 0;
}
#btn-atualizar-salas {
  background-color: #50b07b;
}
#btn-atualizar-salas:hover {
  background-color: #439468;
}
.lista-salas {
  list-style: none;
  padding: 0;
  margin: 0;
  overflow-y: auto;
  flex-grow: 1;
  border: 1px solid #333;
  border-radius: 5px;
  background-color: #1a1a1a;
}
.lista-salas li {
  padding: 15px;
  border-bottom: 1px solid #333;
  font-size: small;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  transition: background-color 0.2s ease;
}
.lista-salas li:hover {
  background-color: #2a2a2a;
}
.sala-info .sala-nome {
  font-weight: bold;
  font-size: 1.1em;
}
.sala-info .sala-criador {
  font-size: 0.9em;
  padding: 0%;
  color: #a0a0a0;
  margin-top: 4px;
  margin-left: 10px;
}
.sala-status {
  color: #28a745;
}

/* Telas de Espera e Aguardando */
#tela-espera,
#tela-aguardando-oponente {
  text-align: center;
}
.aguardando-animado {
  font-size: 1.2em;
  animation: piscar 1.5s infinite;
}
@keyframes piscar {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.4;
  }
}

/* Jogo */
#tela-jogo {
  flex-grow: 1;
  overflow: hidden;
}
.placar-header {
  display: flex;
  justify-content: space-around;
  align-items: center;
  width: 100%;
  padding-bottom: 15px;
  margin-bottom: 15px;
  border-bottom: 1px solid #333;
  font-size: 1.2em;
  font-weight: bold;
  flex-shrink: 0;
}
.player-status {
  transition: opacity 0.4s ease, color 0.4s ease;
  opacity: 0.5;
}
.player-status.active-turn {
  opacity: 1;
  color: #1cde49;
  border: 2px solid rgba(51, 34, 205, 0.778);
  border-radius: 10%;
  background-color: #44505d81;
  padding: 2%;
}
.player-board {
  width: 100%;
  margin-bottom: 15px;
  padding: 10px;
  border: 1px solid #333;
  border-radius: 8px;
  flex-grow: 1;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.player-board.active {
  border-color: #1cde49;
  box-shadow: 0 0 8px rgba(28, 222, 73, 0.4);
}
.player-board h2 {
  color: #a0a0a0;
  font-size: 1em;
  text-transform: uppercase;
  text-align: left;
  margin: 0 0 15px 0;
  padding-bottom: 5px;
  border-bottom: 1px solid #333;
  font-weight: normal;
}
.word-list {
  padding: 0;
  margin: 0;
  flex-grow: 1;
  overflow-y: auto;
  padding-right: 5px;
}
.word-list li {
  list-style: none;
  padding: 5px 0;
}

/* FEEDBACK DE SENHAS */
.feedback-digits {
  display: flex;
  justify-content: center;
  gap: 8px;
}
.feedback-digits span {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  width: 35px;
  height: 35px;
  border-radius: 6px;
  font-size: 1.1em;
  font-family: "Courier New", Courier, monospace;
  font-weight: bold;
  color: #e0e0e0;
}
.correct-digit {
  background-color: rgba(129, 116, 152, 0.3);
  border: 1px solid #c4b6d6;
  opacity: 0.7;
}
.wrong-digit {
  background-color: rgba(129, 116, 152, 0.3);
  border: 1px solid #c4b6d6;
  opacity: 0.7;
}

/* ÁREA DE INPUT */
.input-area {
  display: flex;
  gap: 10px;
  flex-shrink: 0;
  margin-top: auto;
}
#guess-input {
  flex-grow: 1;
  padding: 12px;
  margin-bottom: 0.5%;
  color: white;
  background-color: #2a2a2a;
  border: 1px solid #444;
  border-radius: 5px;
  text-align: center;
  letter-spacing: 0.5em;
}
#submit-guess-btn {
  margin-top: 0;
  width: auto;
  padding: 0 20px;
}

/* TELA DE VITÓRIA */
#tela-vitoria {
  text-align: center;
}
#tela-vitoria h2 {
  color: #28a745;
  font-size: 2.5em;
  margin-bottom: 10px;
}
#btn-novo-jogo {
  background-color: #28a745;
}
#btn-novo-jogo:hover {
  background-color: #218839;
}

#btn-revanche-vitoria {
  background-color: #28a745;
}
#btn-revanche-vitoria:hover {
  background-color: #218839;
}

/* NOTIFICAÇÃO TOAST */
#toast-notification {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  padding: 15px 30px;
  border-radius: 8px;
  color: white;
  font-size: 1.1em;
  font-weight: bold;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
  z-index: 1000;
  opacity: 0;
  transition: opacity 0.4s ease;
  pointer-events: none;
}
#toast-notification.show {
  opacity: 1;
}
.toast-success {
  background-color: #28a745;
}
.toast-error {
  background-color: #dc3545;
}
