body {
  font-family: Arial, sans-serif;
  text-align: center;
  background-color: #f0f0f0;
  margin: 0;
  padding: 20px;
  background-image: url('../bg-connect4.jpg');
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
}
h1, h2, p, label, select, #message, #turn-indicator {
    color: #000;
    text-shadow: 1px 1px 2px rgba(255, 255, 255, 0.9);
}
.board {
  display: grid;
  grid-template-columns: repeat(10, 40px);
  grid-template-rows: repeat(10, 40px);
  gap: 5px;
  justify-content: center;
  margin: 10px auto;
}
.cell {
  width: 40px;
  height: 40px;
  background-color: lightblue;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: 1px solid #000;
  transition: background-color 0.3s ease;
}
.cell:hover {
  background-color: #add8e6;
}
@keyframes hitFade {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes popIn {
  0% {
    transform: scale(0.8);
    opacity: 0;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}
@keyframes splashFade {
  from { opacity: 0; }
  to { opacity: 1; }
}
#message {
  margin-top: 20px;
  font-size: 1.2em;
  white-space: pre-line;
}
#turn-indicator {
  text-align: center;
  font-size: 1.2em;
  font-weight: bold;
  color: black;
  margin-bottom: 10px;
}
#reset-button,
.menu-button {
  margin-top: 20px;
  padding: 10px 20px;
  font-size: 1em;
  font-weight: bold;
  color: #fff;
  background-color: #333;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  transition: background-color 0.3s ease;
}
#reset-button:hover,
.menu-button:hover {
  background-color: #555;
}
.hidden {
  display: none !important;
}
.game-container {
  display: flex;
  justify-content: center;
  gap: 50px;
  flex-wrap: wrap;
  align-items: flex-start;
  margin-top: 30px;
}
.board-column {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}
#player1-board {
  background-image: url('../attack-grid-bg.png');
  background-size: 100% 100%;
  background-position: center;
  background-repeat: no-repeat;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  grid-template-rows: repeat(7, 1fr);
  aspect-ratio: 1 / 1;
  width: 90vw;
  max-width: 490px;
  margin: 0 auto;
  border: none;
}
#player1-board .cell {
  width: 100%;
  height: 100%;
  aspect-ratio: 1 / 1;
  background-color: rgba(255, 255, 255, 0.01); 
  border: 1px solid rgba(0, 0, 0, 0.2);
  box-sizing: border-box;
}
.top-text-container {
  background-color: rgba(255, 255, 255, 0.8);
  display: inline-block;
  padding: 20px 30px;
  border-radius: 12px;
  box-shadow: 0 0 12px rgba(0, 0, 0, 0.2);
  margin-top: 20px;
  margin-bottom: 10px;
}
.mute-button {
  position: fixed;
  top: 15px;
  right: 15px;
  z-index: 1000;
  background-color: rgba(255, 255, 255, 0.85);
  border: none;
  border-radius: 50%;
  font-size: 22px;
  cursor: pointer;
  padding: 10px;
  box-shadow: 0 0 8px rgba(0, 0, 0, 0.2);
  transition: background-color 0.2s ease;
}
.mute-button:hover {
  background-color: rgba(255, 255, 255, 1);
}
.confirm-button:hover {
  background-color: #284a63;
  border-color: #ffffff;
  transform: translateY(-2px);
}
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(20, 20, 20, 0.8);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}
.modal-content.fancy-modal {
  background-color: #ffffff;
  padding: 40px 30px;
  border-radius: 20px;
  text-align: center;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
  animation: popIn 0.4s ease-out;
}
#victory-message {
  font-size: 2em;
  color: #222;
  margin-bottom: 20px;
  animation: popIn 0.4s ease-out;
}
.victory-buttons {
  margin-top: 30px;
  display: flex;
  gap: 20px;
  justify-content: center;
}
.victory-btn {
  background-color: #1c2f45;
  color: #f0f0f0;
  padding: 12px 28px;
  border: 2px solid #ccc;
  border-radius: 10px;
  font-size: 1.1em;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.2s ease;
}
.victory-btn:hover {
  background-color: #2e4f70;
  border-color: #fff;
  transform: translateY(-2px);
}
.modal.show {
  display: flex !important;
}
@keyframes drop {
  0% {
    transform: translateY(-500px);
    opacity: 0;
  }
  100% {
    transform: translateY(0);
    opacity: 1;
  }
}
.cell.drop-anim {
  animation: drop 0.3s ease-out;
}
#player1-board {
  position: relative;
}
.cell.red-chip {
  z-index: 2;
  background-image: url('../red-chip.jpg');
  background-size: 160% 160%;    
  background-position: center;
  background-repeat: no-repeat;
  animation: drop 0.3s ease-out;
}
.cell.yellow-chip {
  z-index: 2;
  background-image: url('../yellow-chip.jpg');
  background-size: 160% 160%;    
  background-position: center;
  background-repeat: no-repeat;
  animation: drop 0.3s ease-out;
}
.winning-chip {
    box-shadow: 0 0 10px 4px gold;
    border: 2px solid gold;
    z-index: 10;
}
#matchmaking-timer {
  font-family: Impact, sans-serif;
  font-size: 28px;
  font-weight: bold;
  color: white;
  text-align: center;
  text-shadow: -1px -1px 0 #000, 1px -1px 0 #000,
               -1px  1px 0 #000, 1px  1px 0 #000;
  margin-top: 8px;
  min-height: 32px;
  line-height: 32px;
  transition: color 0.3s ease;
}
#matchmaking-status {
  display: inline-block;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin-top: 100px;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  font-size: 1.6rem;
  color: #ffffff;
  text-shadow: 0 0 5px #000;
  background: rgba(0, 0, 0, 0.3);
  padding: 10px 20px;
  border-radius: 16px;
  box-shadow: 0 0 12px rgba(255, 255, 255, 0.2);
  animation: pulse 2s infinite;
}
#waiting-dots::after {
  content: '';
  display: inline-block;
  animation: dots 1.5s steps(3, end) infinite;
}

@keyframes dots {
  0%, 20% { content: ''; }
  40%     { content: '.'; }
  60%     { content: '..'; }
  80%, 100% { content: '...'; }
}

@keyframes pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.02); }
  100% { transform: scale(1); }
}
.popup {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  animation: fadeIn 0.3s ease-out;
}

.popup-content {
  background: #fff;
  border-radius: 16px;
  padding: 24px 32px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
  text-align: center;
  font-family: "Segoe UI", sans-serif;
  max-width: 400px;
  width: 90%;
  animation: scaleIn 0.2s ease-out;
}

.popup-content .emoji {
  font-size: 40px;
  display: block;
  margin-bottom: 12px;
}

.popup-content .text {
  font-size: 18px;
  color: #333;
  line-height: 1.4;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes scaleIn {
  from { transform: scale(0.95); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}

@keyframes fadeInPop {
  from { transform: scale(0.8); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
/* ===== Lobby-selection (fully scoped) ===== */
#lobby-selection.lobby-popup {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  justify-content: center;
  align-items: center;
  z-index: 999;
}

#lobby-selection.lobby-popup.show {
  display: flex;
}

/* card */
#lobby-selection.lobby-popup .popup-content {
  background: #ffffff;
  border-radius: 20px;
  padding: 32px 24px;
  max-width: 360px;
  width: 90%;
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
  text-align: center;
  animation: lobbyPop 0.35s ease-out forwards;
  opacity: 0;
  transform: translateY(-20px);
}
@keyframes lobbyPop {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* heading */
#lobby-selection.lobby-popup .popup-content h2 {
  margin-bottom: 20px;
  font-size: 1.6rem;
  font-weight: 700;
  color: #222;
}
#lobby-selection.lobby-popup .lobby-option {
  width: 100%;
  max-width: 240px;
  margin: 0 auto;
  padding: 12px 0;
  font-size: 1rem;
  font-weight: 600;
  color: #fff;
  background-color: #007acc;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.2s, transform 0.1s;
}
#lobby-selection.lobby-popup .lobby-option:hover {
  background-color: #005f99;
  transform: translateY(-1px);
}

/* ensure the back-to-menu below the lobby-option just gets your global .menu-button styling */
#lobby-selection.lobby-popup #back-to-menu-btn {
  margin-top: 20px;  /* spacing only */
}
