* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --x-color: rgba(65, 185, 131, 1);
  --o-color: rgba(0, 212, 255, 1);
  --bg-gradient: linear-gradient(90deg, var(--x-color) 0%, var(--o-color) 100%);
  --white: #fff;
  --black-overlay: rgba(0, 0, 0, 0.9);
}

body {
  height: 100vh;
  width: 100vw;
  background: var(--bg-gradient);
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  overflow: hidden;
  /* Evitar scrollbar */
}

/* Container Principal */
.game-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
  align-items: center;
}

/* Cabeçalho */
.game-header {
  width: 100%;
  padding: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
  z-index: 10;
}

/* Botões de Ícone (Voltar e Reset) */
.icon-button {
  color: var(--white);
  background: rgba(255, 255, 255, 0.2);
  padding: 8px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.3s, transform 0.2s;
  text-decoration: none;
  border: none;
  cursor: pointer;
  width: 40px;
  height: 40px;
}

.icon-button:hover {
  background: rgba(255, 255, 255, 0.4);
  transform: scale(1.1);
}

/* Placar */
.scoreboard {
  display: flex;
  gap: 15px;
  background: rgba(255, 255, 255, 0.2);
  padding: 10px 20px;
  border-radius: 30px;
  align-items: center;
  font-weight: bold;
  color: var(--white);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.score-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.score-divider {
  font-size: 1.5rem;
  opacity: 0.8;
}

.score-value {
  font-size: 1.5rem;
  min-width: 20px;
  text-align: center;
}

/* Inputs de Nome */
.player-input {
  background: transparent;
  border: none;
  border-bottom: 2px solid rgba(255, 255, 255, 0.5);
  color: var(--white);
  width: 100px;
  text-align: center;
  font-size: 1rem;
  font-weight: bold;
  padding: 2px 5px;
  outline: none;
  transition: border-color 0.3s;
}

.player-input::placeholder {
  color: rgba(255, 255, 255, 0.7);
}

.player-input:focus {
  border-bottom-color: var(--white);
}

/* Responsividade Mobile */
@media (max-width: 600px) {
  .game-header {
    padding: 0.5rem;
  }

  .scoreboard {
    padding: 8px 15px;
    gap: 8px;
  }

  .player-input {
    width: 70px;
    /* Menor em mobile */
    font-size: 0.9rem;
  }

  .score-value,
  .score-divider {
    font-size: 1.2rem;
  }

  .icon-button {
    width: 36px;
    height: 36px;
    padding: 6px;
  }
}

/* Área do Tabuleiro */
.board-container {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  padding-bottom: 60px;
  /* Espaço visual */
}

.board {
  display: grid;
  justify-content: center;
  align-content: center;
  justify-items: center;
  align-items: center;
  grid-template-columns: repeat(3, auto);
  position: relative;
  /* Para a linha de vitória */
}

/* Célula */
.cell {
  width: 100px;
  height: 100px;
  border: 2px solid var(--white);
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  cursor: pointer;
}

/* Remoção de bordas externas */
.cell:nth-child(1),
.cell:nth-child(2),
.cell:nth-child(3) {
  border-top: none;
}

.cell:nth-child(1),
.cell:nth-child(4),
.cell:nth-child(7) {
  border-left: none;
}

.cell:nth-child(7),
.cell:nth-child(8),
.cell:nth-child(9) {
  border-bottom: none;
}

.cell:nth-child(3),
.cell:nth-child(6),
.cell:nth-child(9) {
  border-right: none;
}

.cell.x,
.cell.circle {
  cursor: not-allowed;
}

/* Efeitos de Hover */
.board.x .cell:not(.x):not(.circle):hover::after,
.board.x .cell:not(.x):not(.circle):hover::before,
.board.circle .cell:not(.x):not(.circle):hover::after {
  background: rgba(255, 255, 255, 0.3) !important;
}

/* X */
.cell.x::before,
.cell.x::after,
.board.x .cell:not(.x):not(.circle):hover::after,
.board.x .cell:not(.x):not(.circle):hover::before {
  content: "";
  height: calc(100px * 0.15);
  width: calc(100px * 0.9);
  background: var(--white);
  position: absolute;
}

.cell.x::before,
.board.x .cell:not(.x):not(.circle):hover::before {
  transform: rotate(45deg);
}

.cell.x::after,
.board.x .cell:not(.x):not(.circle):hover::after {
  transform: rotate(-45deg);
}

/* Circle */
.cell.circle::before,
.cell.circle::after,
.board.circle .cell:not(.x):not(.circle):hover::after,
.board.circle .cell:not(.x):not(.circle):hover::after {
  content: "";
  height: calc(100px * 0.9);
  width: calc(100px * 0.9);
  background: var(--white);
  position: absolute;
  border-radius: 50%;
}

.cell.circle::after,
.board.circle .cell:not(.x):not(.circle):hover::after {
  background: transparent;
  /* Apenas o anel */
  width: calc(100px * 0.6);
  /* Buraco interno */
  height: calc(100px * 0.6);
  box-shadow: 0 0 0 15px var(--white);
  /* Borda simulada */
}

/* Correção para o circulo hover que estava estranho no original */
.board.circle .cell:not(.x):not(.circle):hover::after {
  background: transparent !important;
  box-shadow: 0 0 0 15px rgba(255, 255, 255, 0.3) !important;
}



/* Mensagem de Vitória */
.winning-message {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  justify-content: center;
  align-items: center;
  background-color: var(--black-overlay);
  flex-direction: column;
  z-index: 20;
}

.winning-message-button {
  font-size: 2.5rem;
  background-color: var(--x-color);
  padding: 10px 15px;
  cursor: pointer;
  border-radius: 5px;
  border: none;
  margin-top: 16px;
  color: var(--white);
  transition: 0.3s;
}

.winning-message-button:hover {
  background-color: var(--white);
  color: var(--x-color);
}

.winning-message-text {
  color: var(--white);
  font-size: 3rem;
}

.show-winning-message {
  display: flex;
}

/* Modal de Reset */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  justify-content: center;
  align-items: center;
  z-index: 30;
  padding: 20px;
}

.modal.show {
  display: flex;
}

.modal-content {
  background: var(--white);
  padding: 2rem;
  border-radius: 15px;
  text-align: center;
  max-width: 300px;
  width: 100%;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

.modal-content p {
  font-size: 1.2rem;
  color: #333;
  margin-bottom: 20px;
  font-weight: bold;
}

.modal-buttons {
  display: flex;
  justify-content: center;
  gap: 15px;
}

.modal-btn {
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  cursor: pointer;
  transition: transform 0.2s, opacity 0.2s;
  font-weight: bold;
}

.modal-btn:hover {
  transform: scale(1.05);
  opacity: 0.9;
}

.modal-btn.confirm {
  background-color: var(--x-color);
  color: var(--white);
}

.modal-btn.cancel {
  background-color: #ff4757;
  color: var(--white);
}