:root {
  --bg-color: #39cdbe88;
  --container-bg: #539ec4c2;
  --text-color: #000000;
  --cell-bg: #2d87a54c;
  --cell-hover: #4e59aac5;
  --cell-hover: hsla(188, 52%, 53%, 0.278);
  --button-bg: hsla(188, 52%, 53%, 0.278);
  --button-hover: #5a62d3d4;
  --button-text: #fcfeff;
  --border-color: #2371e6;
  --radius: 10px;
  --spacing: 12px;
}

body {
  background-color: var(--bg-color);
  color: var(--text-color);
  font-family: 'Segoe UI', sans-serif;
  padding: var(--spacing);
  transition: all 0.3s ease;
}

.container {
  background-color: var(--container-bg);
  border-radius: var(--radius);
  padding: calc(var(--spacing) * 2);
  box-shadow: 0 4px 15px rgba(0,0,0,0.08);
  transition: all 0.3s ease;
}

.cell {
  background-color: var(--cell-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: var(--spacing);
  text-align: center;
  cursor: pointer;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.05);
  transition: all 0.25s ease;
}

.cell:hover {
  background-color: var(--cell-hover);
  transform: scale(1.03);
}

.button {
  background-color: var(--button-bg);
  color: var(--button-text);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: calc(var(--spacing) * 0.75) calc(var(--spacing) * 1.5);
  cursor: pointer;
  transition: all 0.2s ease;
}

.button:hover {
  background-color: var(--button-hover);
  transform: scale(1.02);
}

.button:active {
  transform: scale(0.97);
}



body.dark-mode {
  --bg-color: #0b0b0b;
  --container-bg: rgba(20, 20, 20, 0.4);
  --text-color: #fff;
  --cell-bg: rgba(255, 255, 255, 0.1);
  --cell-hover: rgba(255, 255, 255, 0.2);
  --button-bg: #222;
  --button-hover: #4cc9f0;
  --button-text: #fff;
  --border-color: rgba(255, 255, 255, 0.2);
  --win-highlight: rgba(0, 255, 150, 0.4);
  --win-glow: rgba(0, 255, 150, 0.8);
}


/* Global reset */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Segoe UI', 'Roboto', sans-serif;
}

body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  /* header -> main -> footer */
  background-color: var(--bg-color);
  transition: background-color 0.6s ease;
}


body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(120deg, #3a0ca3, #7209b7, #4361ee, #4cc9f0);
  background-size: 400% 400%;
  animation: bgAnimation 15s ease infinite;
  z-index: -1;
  opacity: 0.15;
}
main {
  margin-top: 20px;
}

@keyframes bgAnimation {
  0% {
    background-position: 0% 50%
  }

  50% {
    background-position: 100% 50%
  }

  100% {
    background-position: 0% 50%
  }
}

.header {
  position: sticky;
  /* stays visible when scrolling */
  top: 0;
  z-index: 10;
  height: 70px;
  padding: 12px 30px;
  background: rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(20px);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.neon-title {
  font-size: 2.2rem;
  font-weight: bold;
  color: #4cc9f0;
  /* base neon color */
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-bottom: 20px;

  /* Neon glow */
  text-shadow:
    0 0 5px #4cc9f0,
    0 0 10px #7209b7,
    0 0 20px #4361ee,
    0 0 40px #4cc9f0,
    0 0 60px #7209b7,
    0 0 80px #4361ee;

  /* Floating animation */
  animation: floatNeon 3s ease-in-out infinite, neonPulse 1.5s ease-in-out infinite alternate;
}

.logo .neon-glow {
  color: #4cc9f0;
  /* Neon Blue */
  text-shadow:
    0 0 5px #4cc9f0,
    0 0 10px #7209b7,
    0 0 20px #4cc9f0,
    0 0 40px #7209b7;
  font-weight: bold;
  font-size: 1.8rem;
  animation: floatLogo 3s ease-in-out infinite;
  text-decoration: none;
}

@keyframes floatNeon {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-5px);
  }
}

@keyframes neonPulse {
  0% {
    text-shadow:
      0 0 5px #4cc9f0,
      0 0 10px #7209b7,
      0 0 20px #4361ee,
      0 0 40px #4cc9f0,
      0 0 60px #7209b7,
      0 0 80px #4361ee;
  }

  50% {
    text-shadow:
      0 0 10px #4cc9f0,
      0 0 20px #7209b7,
      0 0 30px #4361ee,
      0 0 50px #4cc9f0,
      0 0 70px #7209b7,
      0 0 100px #4361ee;
  }

  100% {
    text-shadow:
      0 0 5px #4cc9f0,
      0 0 10px #7209b7,
      0 0 20px #4361ee,
      0 0 40px #4cc9f0,
      0 0 60px #7209b7,
      0 0 80px #4361ee;
  }
}

.header {
  position: sticky;
  /* stays visible when scrolling */
  top: 0;
  z-index: 10;
  height: 83px;
  padding: 12px 30px;
  background: rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(20px);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: inherit;
}
header, .player-name-container {
  width: 100%;
  max-width: 100%;
  padding: 0 12px;
  box-sizing: border-box;
}
/* ===== Responsive Header ===== */


.header-left h1 {
  margin: 0;
  font-size: 22px;
}

.header-right {
  display: flex;
  align-items: center;
  flex-wrap: wrap; /* allow player input + toggle button to wrap */
  gap: 8px;
  flex: 1 1 auto; /* grow/shrink to available space */
  min-width: 0;   /* very important to prevent overflow cutting */
}

.player-name-container {
  flex: 1 1 auto;
  min-width: 120px; /* minimum width so input stays usable */
  flex-wrap: wrap;
}

.player-name-container input {
  width: 100%;
  padding: 8px 12px;
  font-size: 16px;
  border: 1px solid #ccc;
  border-radius: 8px;
  box-sizing: border-box;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.toggle-btn {
  padding: 8px 12px;
  font-size: 18px;
  cursor: pointer;
  border: none;
  border-radius: 6px;
  background-color: #f0f0f0;
  transition: all 0.2s ease;
}

.toggle-btn:hover {
  background-color: #e0e0e0;
}


.player-name-container input {
  width: 100%;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-wrap: wrap;
}
/* Nav container */
.nav {
  display: flex;
  align-items: center;
  gap: 15px;
}

/* Nav links on left side of buttons */
.nav ul {
  display: flex;
  gap: 15px;
  list-style: none;
  margin: 0;
  padding: 0;
}

/* Buttons on right side */
.nav-buttons {
  display: flex;
  gap: 10px;
}


/* Nav links neon */
.nav ul li a {
  text-decoration: none;
  color: #4cc9f0;
  /* Neon blue */
  font-weight: bold;
  text-shadow:
    0 0 5px #4cc9f0,
    0 0 10px #7209b7,
    0 0 20px #4cc9f0,
    0 0 40px #7209b7;
  transition: all 0.3s ease;
  list-style: none
}

.nav ul li a:hover {
  color: #fff;
  text-shadow:
    0 0 10px #4cc9f0,
    0 0 20px #7209b7,
    0 0 30px #4cc9f0,
    0 0 60px #7209b7;
}

/* Nav buttons neon */
.nav button {
  background: rgba(0, 0, 0, 0.3);
  color: #4cc9f0;
  border: 1px solid #4cc9f0;
  border-radius: 10px;
  padding: 10px 18px;
  cursor: pointer;
  text-shadow:
    0 0 5px #4cc9f0,
    0 0 10px #7209b7,
    0 0 20px #4cc9f0,
    0 0 40px #7209b7;
  transition: all 0.3s ease;
}

.nav button:hover {
  background: rgba(76, 201, 240, 0.2);
  color: #fff;
  text-shadow:
    0 0 10px #4cc9f0,
    0 0 20px #7209b7,
    0 0 30px #4cc9f0,
    0 0 60px #7209b7;
  transform: scale(1.05);
}
.cell {
  border: 2px solid var(--border-color);
  box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.05);
  transition: all 0.25s ease;
}

.cell:hover {
  background: var(--cell-hover);
  transform: scale(1.03);
}

.container {
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
  backdrop-filter: blur(15px);
}
.container {
  flex: 1;
  /* take remaining vertical space */
  background: var(--container-bg);
  border-radius: 20px;
  backdrop-filter: blur(20px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  text-align: center;
  width: 90%;
  max-width: 400px;
  margin: 50px auto 30px;
  /* keeps clear gap below header */
  padding: 30px 20px;
  transition: background 0.2s ease;
}

.container h1 {
  color: #4cc9f0;
  text-shadow:
    0 0 5px #4cc9f0,
    0 0 10px #7209b7,
    0 0 20px #4cc9f0,
    0 0 40px #7209b7;
  font-size: 2rem;
  margin-bottom: 20px;
  animation: glowPulse 1.5s infinite alternate;
}

@keyframes glowPulse {
  0% {
    text-shadow: 0 0 5px #4cc9f0, 0 0 10px #7209b7, 0 0 20px #4cc9f0, 0 0 40px #7209b7;
  }

  50% {
    text-shadow: 0 0 10px #4cc9f0, 0 0 20px #7209b7, 0 0 30px #4cc9f0, 0 0 60px #7209b7;
  }

  100% {
    text-shadow: 0 0 5px #4cc9f0, 0 0 10px #7209b7, 0 0 20px #4cc9f0, 0 0 40px #7209b7;
  }
}

.container h1,
.container h2 {
  color: #4cc9f0;
  text-shadow:
    0 0 5px #4cc9f0,
    0 0 10px #7209b7,
    0 0 20px #4cc9f0,
    0 0 40px #7209b7;
}


button {
  background: var(--button-bg);
  color: var(--button-text);
  padding: 12px 25px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 10px;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
}

button:hover {
  background: var(--button-hover);
  color: var(--bg-color);
  transform: scale(1.05);
}

.player-names {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 15px;
  flex-wrap: wrap;
}

.player-names input {
  flex: 1;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  background: var(--cell-bg);
  color: var(--text-color);
  outline: none;
  text-align: center;
}

.player-names input::placeholder {
  color: rgba(255, 255, 255, 0.5);
}

.board {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}

.cell {
  height: 80px;
  /* smaller height for mobile */
  font-size: 2rem;
}

.board {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 20px;
  position: relative;
}

.cell {
  background: var(--cell-bg);
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 12px;
  height: clamp(60px, 12vw, 120px);
  font-size: clamp(1.6rem, 4vw, 2.5rem);
  color: var(--text-color);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.25s ease;
  box-shadow: inset 0 0 10px rgba(255, 255, 255, 0.06);
}

.cell:hover {
  background: var(--cell-hover);
  transform: scale(1.05);
}

.cell.animate {
  animation: popIn 0.3s ease;
}

.board {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  /* smaller gap on mobile */
}

.cell {
  height: 80px;
  /* smaller height for mobile */
  font-size: 2rem;
}

@keyframes popIn {
  0% {
    transform: scale(0);
    opacity: 0;
  }

  80% {
    transform: scale(1.2);
    opacity: 1;
  }

  100% {
    transform: scale(1);
  }
}

.cell.winner {
  background: var(--win-highlight);
  box-shadow: 0 0 15px var(--win-glow);
  animation: pulse 0.8s infinite;
}

@keyframes pulse {
  0% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.07);
  }

  100% {
    transform: scale(1);
  }
}

.status {
  font-size: 1.2rem;
  color: var(--text-color);
  margin-bottom: 20px;
}

/* Winning line */
.winning-line {
  position: absolute;
  height: 6px;
  border-radius: 10px;
  filter: drop-shadow(0 0 10px #4cc9f0);
}

@keyframes lineGlow {
  0% {
    filter: drop-shadow(0 0 8px #4cc9f0);
  }

  50% {
    filter: drop-shadow(0 0 20px #7209b7);
  }

  100% {
    filter: drop-shadow(0 0 8px #4cc9f0);
  }
}

.scoreboard {
  margin-top: 20px;
  background: var(--container-bg);
  padding: 15px 10px;
  border-radius: 15px;
  box-shadow: 0 0 20px rgba(76, 201, 240, 0.2);
}

.scoreboard h2 {
  margin-bottom: 10px;
  color: #4cc9f0;
  text-shadow:
    0 0 5px #4cc9f0,
    0 0 10px #7209b7,
    0 0 20px #4cc9f0,
    0 0 40px #7209b7;
}

.scoreboard p {
  font-size: 1rem;
  margin: 5px 0;
  color: var(--text-color);
}

.scoreboard p.top-scorer {
  text-shadow: 0 0 5px #4cc9f0, 0 0 10px #7209b7, 0 0 20px #4cc9f0, 0 0 40px #7209b7;
  animation: glowPulse 1.5s infinite alternate;
  font-weight: bold;
}

@keyframes glowPulse {
  0% {
    text-shadow: 0 0 5px #4cc9f0, 0 0 10px #7209b7, 0 0 20px #4cc9f0, 0 0 40px #7209b7;
  }

  50% {
    text-shadow: 0 0 10px #4cc9f0, 0 0 20px #7209b7, 0 0 30px #4cc9f0, 0 0 60px #7209b7;
  }

  100% {
    text-shadow: 0 0 5px #4cc9f0, 0 0 10px #7209b7, 0 0 20px #4cc9f0, 0 0 40px #7209b7;
  }
}

.footer {
  background: var(--container-bg);
  color: var(--text-color);
  text-align: center;
  padding: 30px 15px;
  border-top: 1px solid var(--border-color);
  margin-top: 40px;
  box-shadow: 0 -4px 10px rgba(0, 0, 0, 0.05);
}

.footer h2 {
  font-size: 1.4rem;
  margin-bottom: 8px;
  color: var(--accent-color, #007bff);
}

.footer p {
  margin: 5px 0;
}

.footer .disclaimer {
  font-size: 13px;
  opacity: 0.8;
  margin: 12px 0;
}

.footer-links {
  margin-top: 10px;
}

.footer-links a {
  color: var(--accent-color, #007bff);
  text-decoration: none;
  margin: 0 6px;
  font-weight: 500;
  transition: color 0.2s ease;
}

.footer-links a:hover {
  color: var(--button-hover, #4cc9f0);
  text-decoration: underline;
}

.footer .copyright {
  font-size: 12px;
  opacity: 0.7;
  margin-top: 12px;
}

/* 📱 Responsive */
@media (max-width: 600px) {
  .footer {
    font-size: 13px;
  }

  .footer-links {
    display: flex;
    flex-direction: column;
    gap: 6px;
    line-height: 1.4;
  }
}


.footer-content {
  position: relative;
  background: var(--container-bg);
  padding: 30px 20px;
  border-radius: 20px 20px 0 0;
  text-align: center;
  color: var(--text-color);
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.2);
  max-width: 800px;
  margin: 0 auto;
}

/* ================================
   🌐 Responsive / Mobile Optimized
   ================================ */

/* Small devices (mobiles) */
@media (max-width: 480px) {
  body {
    font-size: 14px;
    padding: 8px;
  }

  .container {
    max-width: 100%;
    padding: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05); /* lighter shadow */
    backdrop-filter: none; /* remove heavy blur for performance */
  }

  .cell {
    padding: 8px;
    font-size: 14px;
    box-shadow: inset 0 0 2px rgba(0,0,0,0.03); /* lighter shadow */
    transform: none; /* remove hover scale for performance */
  }

  .button {
    padding: 6px 12px;
    font-size: 14px;
    transform: none; /* remove hover scale */
  }
}


/* Medium devices (tablets) */
@media (min-width: 481px) and (max-width: 768px) {
  body {
    font-size: 15px;
    padding: 10px;
  }

  .container {
    max-width: 95%;
    padding: 16px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.07);
    backdrop-filter: blur(5px); /* mild blur */
  }

  .cell {
    padding: 10px;
    font-size: 15px;
    transform: scale(1.01); /* subtle hover effect */
  }

  .button {
    padding: 8px 14px;
    font-size: 15px;
    transform: scale(1.01);
  }
}
@media (max-width: 480px) {
  header, .player-name-container {
    padding: 0 8px;
  }

  .player-name-container input {
    font-size: 14px;  /* adjust font size for mobile */
  }

  header h1 {
    font-size: 18px;  /* shrink header text */
  }
}

