:root {
  --bg-gradient: linear-gradient(135deg, #0f0c29 0%, #302b63 50%, #24243e 100%);
  --glass-bg: rgba(255, 255, 255, 0.05);
  --glass-border: rgba(255, 255, 255, 0.1);
  --text-color: #ffffff;
  --x-color: #00f2fe;
  --o-color: #fa709a;
}

body {
  font-family: "Segoe UI", system-ui, sans-serif;
  background: var(--bg-gradient);
  height: 100vh;
  margin: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  color: var(--text-color);
  overflow: hidden;
}

/* Setup Screen Overlay */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(15px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 100;
}

.setup-card {
  background: var(--glass-bg);
  padding: 40px;
  border-radius: 24px;
  border: 1px solid var(--glass-border);
  text-align: center;
  width: 340px;
  animation: fadeInUp 0.5s ease-out;
}

input {
  display: block;
  width: 90%;
  padding: 12px;
  margin: 10px auto;
  border-radius: 12px;
  border: 1px solid var(--glass-border);
  background: rgba(255, 255, 255, 0.08);
  color: white;
  font-size: 1rem;
  outline: none;
  transition: 0.3s;
}

input:focus {
  border-color: var(--x-color);
  background: rgba(255, 255, 255, 0.15);
}

#error-msg {
  color: var(--o-color);
  font-size: 0.85rem;
  min-height: 1.2rem;
  margin: 10px 0;
  font-weight: bold;
}

/* Buttons */
#start-game-btn {
  background: linear-gradient(135deg, var(--x-color), #764ba2);
  color: white;
  border: none;
  padding: 14px 40px;
  border-radius: 50px;
  font-size: 1rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(0, 242, 254, 0.3);
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  position: relative;
  overflow: hidden;
  margin-top: 10px;
}

#start-game-btn:hover {
  transform: scale(1.05) translateY(-3px);
  box-shadow: 0 8px 25px rgba(0, 242, 254, 0.5);
}

/* Audio Controls */
.audio-controls {
  position: absolute;
  top: 20px;
  right: 20px;
  z-index: 10;
}

.icon-btn {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  color: white;
  width: 45px;
  height: 45px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.2rem;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: 0.3s;
}

/* Game Board */
.game-container {
  position: relative;
  animation: fadeInUp 0.6s ease-out;
}

.hidden {
  display: none;
}

.score-tracker {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 40px;
  margin-bottom: 20px;
}

.score-box div {
  font-size: 3rem;
  font-weight: 800;
}
.score-box span {
  font-size: 0.8rem;
  opacity: 0.6;
  text-transform: uppercase;
}

.game-card {
  background: var(--glass-bg);
  backdrop-filter: blur(15px);
  border: 1px solid var(--glass-border);
  border-radius: 28px;
  padding: 30px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
}

#status {
  margin-bottom: 20px;
  font-size: 1.2rem;
  font-weight: 500;
  text-align: center;
}

.board {
  display: grid;
  grid-template-columns: repeat(3, 100px);
  gap: 12px;
  margin: 20px 0;
}

.cell {
  width: 100px;
  height: 100px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 16px;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 2.8rem;
  cursor: pointer;
  transition: 0.2s;
  border: 1px solid var(--glass-border);
}

.cell:hover {
  background: rgba(255, 255, 255, 0.1);
  transform: translateY(-2px);
}
.cell.x {
  color: var(--x-color);
  text-shadow: 0 0 15px var(--x-color);
}
.cell.o {
  color: var(--o-color);
  text-shadow: 0 0 15px var(--o-color);
}

/* Centered Reset Button */
#restartBtn {
  display: block;
  margin: 0 auto;
  background: rgba(255, 255, 255, 0.1);
  color: white;
  border: 1px solid var(--glass-border);
  padding: 10px 25px;
  border-radius: 12px;
  cursor: pointer;
  transition: 0.3s;
}

#restartBtn:hover {
  background: white;
  color: #0f0c29;
}

.winner-cell {
  background: rgba(255, 255, 255, 0.15) !important;
  animation: pulse 1s infinite alternate;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulse {
  from {
    transform: scale(1);
  }
  to {
    transform: scale(1.05);
  }
}

.tip {
  display: block;
  margin-top: 15px;
  opacity: 0.5;
  font-size: 0.75rem;
}

/* Online Specific Styles */
#online-fields label {
  cursor: pointer;
}
#room-id-input[readonly] {
  border-color: var(--x-color);
  color: var(--x-color);
  font-weight: bold;
}
#generated-room-msg {
  display: block;
  margin-bottom: 5px;
  font-weight: 500;
}

#active-room-display {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  padding: 5px 15px;
  border-radius: 50px;
  display: inline-block;
  left: 50%;
  transform: translateX(-50%);
  position: relative;
}

#current-room-id {
  font-weight: bold;
  letter-spacing: 1px;
}

/* Developer Attribution */
.developer-container {
  margin-top: 30px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  animation: fadeIn 1.5s ease-in-out;
}

.dev-label {
  font-size: 0.65rem;
  letter-spacing: 3px;
  color: rgba(255, 255, 255, 0.3);
  font-weight: 600;
}

.dev-link {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--x-color);
  text-decoration: none;
  letter-spacing: 1px;
  position: relative;
  transition: all 0.4s ease;
  text-shadow: 0 0 8px rgba(0, 242, 254, 0.2);
}

.dev-link::after {
  content: "";
  position: absolute;
  width: 0%;
  height: 1.5px;
  bottom: -4px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--x-color);
  transition: width 0.4s ease;
  box-shadow: 0 0 10px var(--x-color);
  border-radius: 10px;
}

.dev-link:hover {
  color: #fff;
  transform: translateY(-2px);
  text-shadow: 0 0 10px var(--x-color), 0 0 20px rgba(0, 242, 254, 0.4);
}

.dev-link:hover::after {
  width: 100%;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
