/* Css reset */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

body {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #a1c4fd, #c2e9fb);
  padding: 20px;
  color: #333;
}

.game-container {
  background-color: #ffffff;
  border-radius: 15px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  padding: 20px 30px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 15px;
  max-width: 450px;
  width: 100%;
}

.game-header {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  position: relative;
  gap: 1rem;
}

h1 {
  margin: 0;
  font-size: 2.5em;
  color: #007bff;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.05);
}

.sound-toggle-button {
  color: #6c757d;
  font-size: 1.5em;
  cursor: pointer;
  transition: color 0.3s ease;
}

.sound-toggle-button:hover,
.computer-button:hover {
  color: #007bff;
}

.computer-button {
  color: #6c757d;
  font-size: 1.5em;
  cursor: pointer;
  transition: color 0.3s ease;
}

#message {
  font-size: 1.5em;
  font-weight: 700;
  color: #495057;
}

.game-scoreboard {
  display: flex;
  justify-content: space-around;
  width: 100%;
  background-color: #f8f9fa;
  border-radius: 8px;
  padding: 10px 0;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.05);
}

.score-player,
.score-draws {
  font-size: 1.1em;
  font-weight: 500;
  color: #555;
}

#board {
  display: grid;
  grid-template-columns: repeat(3, 90px);
  grid-template-rows: repeat(3, 90px);
  gap: 8px;
  background-color: #e9ecef;
  border-radius: 10px;
  padding: 8px;
  box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.1);
}

.cell {
  width: 90px;
  height: 90px;
  background-color: #ffffff;
  border: none;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3.5em;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.2s ease-in-out;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.08);
}

.cell:hover {
  background-color: #f1f3f5;
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
}

.cell.X {
  color: #007bff;
}

.cell.O {
  color: #dc3545;
}

.game-controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 15px;
  margin-top: 20px;
  width: 100%;
}

.button {
  padding: 12px 25px;
  font-size: 1.1em;
  font-weight: 600;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 0.3s ease, transform 0.2s ease,
    box-shadow 0.3s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.button-primary {
  background-color: #28a745;
  color: #fff;
}

.button-primary:hover {
  background-color: #218838;
  transform: translateY(-2px);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.button-secondary {
  background-color: #6c757d;
  color: #fff;
}

.button-secondary:hover {
  background-color: #5a6268;
  transform: translateY(-2px);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

/* Animations */
@keyframes highlight {
  0% {
    background-color: #ffed99;
  }
  50% {
    background-color: #ffe066;
  }
  100% {
    background-color: #ffed99;
  }
}

.cell.win {
  animation: highlight 0.8s ease-in-out infinite alternate;
}

@keyframes fadeInOut {
  0%,
  100% {
    opacity: 0;
  }
  50% {
    opacity: 1;
  }
}

#message.draw {
  animation: fadeInOut 3s ease forwards;
  color: #888;
  font-style: italic;
}

@keyframes fadeInOutWin {
  0%,
  100% {
    opacity: 0;
    transform: scale(0.9);
  }
  50% {
    opacity: 1;
    transform: scale(1.1);
  }
}

#message.win-message {
  animation: fadeInOutWin 3s ease forwards;
  color: #28a745;
  font-weight: bold;
  text-shadow: 0 0 8px rgba(40, 167, 69, 0.5);
}

footer.copyright {
  margin-top: 1rem;
}

footer.copyright a {
  text-align: center;
  font-size: 0.75rem;
  color: #999;
  text-decoration: none;
}

footer.copyright a:hover {
  text-decoration: underline;
  font-weight: 700;
}

/* Modal overlay */
.modal {
  display: none; /* escondida por padrão */
  position: fixed;
  z-index: 2000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  justify-content: center;
  align-items: center;
}

/* Conteúdo da modal */
.modal-content {
  background: #fff;
  padding: 5px 25px;
  border-radius: 12px;
  text-align: center;
  max-width: 265px;
  width: 90%;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}

.modal-content h2 {
  font-size: 1.5rem;
  color: #495057;
}

/* Modal de aviso centralizada */
.modal-info {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: #fff;
  padding: 5px 10px;
  border-radius: 10px;
  min-width: 100px;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
  display: none;
  z-index: 1000;
}

/* Linha animada no título */
.modal-content-info h3 {
  position: relative;
  display: inline-block;
  margin-bottom: 10px;
  padding-bottom: 5px;
}

.modal-content-info h3::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 4px;
  border-radius: 2px;
  background: linear-gradient(
    270deg,
    #ff4d4f,
    #ffd700,
    #4caf50,
    #1e90ff,
    #ff4d4f
  );
  background-size: 1000% 100%;
  animation: animateLine 3s linear infinite;
}

/* Barra de progresso */
.progress-bar {
  height: 4px;
  background-color: #4caf50;
  width: 100%;
  border-radius: 2px;
  margin-top: 10px;
  animation: progressBar 5s linear forwards;
}

@keyframes progressBar {
  from {
    width: 100%;
  }
  to {
    width: 0%;
  }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-body {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 0;
}

.box-modal-body {
  display: flex;
  flex-direction: column;
  align-items: start;
  gap: 5px;
  width: 100%;
}

.difficulty {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.close-button {
  background: transparent;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: #333;
  transition: all 0.3s ease;
}

.close-button:hover i {
  color: #ff4d4f;
}

/* Estilo para os títulos h3/h4 com linha animada */
.modal-header h3,
.game-title {
  position: relative;
  display: inline-block;
  padding-bottom: 5px;
  color: #333;
}

/* Linha animada */
.modal-header h3::after,
.game-title::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 3px;
  border-radius: 2px;
  background: linear-gradient(
    270deg,
    #ff4d4f,
    #ffd700,
    #4caf50,
    #1e90ff,
    #ff4d4f
  );
  background-size: 1000% 100%;
  animation: animateLine 3s linear infinite;
}

/* Animação do gradiente */
@keyframes animateLine {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

#infoMessage {
  font-size: 1rem;
  color: #333;
  font-weight: 500;
}

/* Botões de escolha */
.symbol-options {
  display: flex;
  gap: 10px;
}

.symbol-button {
  padding: 7px 15px;
  font-size: 1rem;
  font-weight: bold;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.3s ease;
}

.symbol-button:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.symbol-button.x-choice {
  background-color: #007bff;
  color: #fff;
}

.symbol-button.o-choice {
  background-color: #dc3545;
  color: #fff;
}

.computer-button,
.sound-toggle-button {
  position: relative;
  cursor: pointer;
}

/* Tooltip */
.computer-button::after,
.sound-toggle-button::after {
  content: attr(aria-label);
  position: absolute;
  bottom: 100%; /* acima do botão */
  left: 50%;
  transform: translateX(-50%);
  background-color: #333;
  color: #fff;
  padding: 5px 10px;
  border-radius: 5px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  font-size: 12px;
  z-index: 100;
}

.computer-button:hover::after,
.sound-toggle-button:hover::after {
  opacity: 1;
}

@media (max-width: 480px) {
  html,
  body {
    height: 100%;
  }

  body {
    padding: 0px 10px;
    min-height: unset;
  }
  .game-container {
    padding: 20px;
    margin: 10px;
  }

  h1 {
    font-size: 1.5em;
  }

  .sound-toggle-button,
  .computer-button {
    font-size: 1rem;
  }

  #board {
    grid-template-columns: repeat(3, 80px);
    grid-template-rows: repeat(3, 80px);
    gap: 6px;
  }

  .cell {
    width: 80px;
    height: 80px;
    font-size: 3em;
  }

  #message {
    font-size: 1rem;
  }

  .score-player,
  .score-draws {
    font-size: 0.8rem;
  }

  .button {
    width: 100%;
    margin-left: 0 !important;
    font-size: 0.8rem;
  }

  .game-controls {
    flex-direction: column;
  }

  footer.copyright {
    margin-top: 0;
  }
}
