body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 40px;
  padding-left: 10px;
  padding-right: 10px;
  min-height: 100vh;
}

h1 {
  margin-bottom: 30px;
  font-size: 48px;
  color: white;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
  font-weight: 700;
}

.controls {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 30px;
  width: 100%;
  max-width: 400px;
  background: white;
  padding: 25px;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.controls input {
  padding: 14px;
  font-size: 16px;
  width: 100%;
  box-sizing: border-box;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  transition:
    border-color 0.3s,
    box-shadow 0.3s;
  font-family: 'Segoe UI', sans-serif;
}

.controls input:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.controls button {
  padding: 14px 20px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  border-radius: 8px;
  background: linear-gradient(135deg, #4caf50 0%, #45a049 100%);
  color: white;
  transition: all 0.3s;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  box-shadow: 0 4px 15px rgba(76, 175, 80, 0.3);
}

.controls button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(76, 175, 80, 0.4);
}

.controls button:active {
  transform: translateY(0);
  box-shadow: 0 2px 10px rgba(76, 175, 80, 0.3);
}

.scoreboard {
  display: flex;
  align-items: center;
  margin-bottom: 25px;
  margin-top: 25px;
  font-size: 20px;
  font-weight: bold;
  justify-content: space-around;
  background: white;
  padding: 15px 40px;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
  width: 436px;
  max-width: 460px;
  margin-left: auto;
  margin-right: auto;
}

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

.game-controls {
  display: flex;
  gap: 15px;
  margin-top: 20px;
  justify-content: center;
}

.game-controls button {
  padding: 14px 30px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  border-radius: 8px;
  background: linear-gradient(135deg, #4caf50 0%, #45a049 100%);
  color: white;
  transition: all 0.3s;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  box-shadow: 0 4px 15px rgba(76, 175, 80, 0.3);
}

.game-controls button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(76, 175, 80, 0.4);
}

.game-controls button:active {
  transform: translateY(0);
  box-shadow: 0 2px 10px rgba(76, 175, 80, 0.3);
}

#nameX {
  color: #2196f3;
  font-weight: 700;
}

#nameO {
  color: #f44336;
  font-weight: 700;
}

.message {
  margin-bottom: 25px;
  font-size: 22px;
  font-weight: bold;
  min-height: 32px;
  text-align: center;
  color: white;
  text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.3);
}

.board {
  display: grid;
  grid-template-columns: repeat(3, 140px);
  grid-template-rows: repeat(3, 140px);
  gap: 8px;
  background: rgba(200, 230, 201, 0.3);
  padding: 12px;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(10px);
}

.cell {
  background: white;
  border: 3px solid #333;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 48px;
  font-weight: bold;
  cursor: pointer;
  user-select: none;
  transition: all 0.2s ease;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  border-radius: 8px;
}

.cell:hover {
  background: #f0f0f0;
  transform: scale(1.05);
}

.cell:active {
  background: #e0e0e0;
  transform: scale(0.98);
}

.cell.x-marker {
  color: #2196f3;
}

.cell.o-marker {
  color: #f44336;
}

.cell.animate {
  animation: pop 0.25s ease-out;
}

@keyframes pop {
  0% {
    transform: scale(0.2);
    opacity: 0;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

.cell.win {
  background: #ffd54f !important;
  border-color: #fbc02d !important;
  transform: scale(1.1);
  box-shadow: 0 0 20px rgba(255, 193, 7, 0.8);
}

/* Mobile Responsive */
@media (max-width: 480px) {
  body {
    padding-top: 20px;
  }

  h1 {
    font-size: 32px;
    margin-bottom: 20px;
  }

  .controls {
    gap: 10px;
    margin-bottom: 20px;
    padding: 20px;
  }

  .controls input,
  .controls button {
    padding: 12px;
    font-size: 16px;
  }

  .scoreboard {
    gap: 20px;
    font-size: 16px;
    margin-bottom: 15px;
    margin-top: 15px;
    padding: 10px 15px;
    min-width: auto;
    width: 342px;
    max-width: 460px;
    flex-wrap: nowrap;
  }

  .game-controls {
    gap: 10px;
    margin-top: 15px;
    flex-wrap: wrap;
  }

  .game-controls button {
    flex: 1;
    min-width: 120px;
    padding: 12px 15px;
    font-size: 14px;
  }

  .message {
    font-size: 18px;
    margin-bottom: 20px;
  }

  .board {
    grid-template-columns: repeat(3, 110px);
    grid-template-rows: repeat(3, 110px);
    gap: 6px;
    padding: 10px;
  }

  .cell {
    font-size: 42px;
    border: 2px solid #333;
  }
}

@media (max-width: 360px) {
  .board {
    grid-template-columns: repeat(3, 80px);
    grid-template-rows: repeat(3, 80px);
  }

  .cell {
    font-size: 36px;
  }

  h1 {
    font-size: 24px;
  }
}

@media (max-width: 360px) {
  .board {
    grid-template-columns: repeat(3, 80px);
    grid-template-rows: repeat(3, 80px);
  }

  .cell {
    font-size: 36px;
  }

  h1 {
    font-size: 20px;
  }

  .controls input,
  .controls button {
    font-size: 16px;
  }

  .scoreboard {
    font-size: 14px;
    gap: 12px;
    min-width: auto;
    width: 246px;
    max-width: 460px;
    padding: 8px 12px;
    margin-top: 12px;
    margin-bottom: 12px;
  }

  .game-controls button {
    font-size: 12px;
    padding: 10px 12px;
  }
}
