/* --- The Main Container --- */

/* * {
  outline: 1px solid red;
} */

/* --- At the top of your CSS --- */
@import url('https://fonts.googleapis.com/css2?family=Source+Sans+Pro:wght@400;700&family=Source+Serif+Pro&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Lato&family=Lora&display=swap');


body {margin:0px;}

body {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    background-color: var(--light-color);
}

html, body { margin: 0; padding: 0; }

html {
  box-sizing: border-box;
}
*, *:before, *:after {
  box-sizing: inherit;
}

#game {
  width: 100vw;
  max-width: 600px;
  /* max-width: 600px; Example max size */
  aspect-ratio: 1 / 1;
  margin: 0px auto;
  background-color: rgb(101 140 136); /* This is the outer frame color */
  
  /* Use Flexbox to perfectly center the child elements */
  display: flex;
  justify-content: center;
  align-items: center;

  position: relative; /* Positioning context for children */
  border-radius: 3px;
  border: 8px solid rgb(98 128 127);
box-shadow: 0px 0px 5px 0px #222;
}

/* --- THE FIX IS HERE --- */
/* This rule applies to both #inside-grid and #zebraGomoku because
   they are direct children of the #game flex container. */
/* #game > div {
  min-width: 0;
} */

.h-line {
  position: absolute;
  width: 100%;
  height: 1px;
  background-color: #333;
  pointer-events: none;
}
.v-line {
  position: absolute;
  height: 100%;
  width: 1px;
  background-color: #333;
  pointer-events: none;
}
.board-intersection {
  width: 30px;
  height: 30px;
  position: absolute;
  transform: translate(-50%, -50%);
  z-index: 3;
  cursor: pointer;
  border-radius: 50%;
}
.board-point {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 10px; /* Slightly smaller than the cell */
  height:10px;
  border-radius: 0px;
  background: #333;
  /* background-color: white; */
  /* border-radius: 50%; */
  /* box-shadow: inset 2px 2px 4px rgba(255, 255, 255, 0.5); */
  /* background: radial-gradient(circle at 25% 25%, #333, #D0D0D0); */
  /* box-shadow: 0px 0px 5px 0px #222; */
}

.board-overlay {
  /* position: absolute;
  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: 10;
  border-radius: 8px; */
}

#online-count {
  /* width: 35px;
  height: 35px;
  border: 2px solid #333;
  border-radius: 30px; */
  font-weight: 600;
  color: rgb(101 140 136);
}

.board-grid-container {
  position: absolute;
  top: 4%;
  left: 4%;
  width: 92%;
  height: 92%;
}

/* --- The Visual Grid Layer --- */
#inside-grid {
  width: 100%;
  height: 100%;
}

/* --- The Interactive Grid Layer (Top) --- */
#zebraGomoku {
  position: absolute;
  display: grid;
  
  /* These now use the perfect --cell-size from the JS */
  grid-template-columns: repeat(15, var(--cell-size));
  grid-template-rows: repeat(15, var(--cell-size));
  
  z-index: 2;
  background-color: transparent;
}

.cell {
 /* No `float`, `display: inline-block`, or `position: absolute` is needed for layout! */
  width: var(--cell-size);
  height: var(--cell-size);
  background-color: transparent; /* So the parent's grid shows through */
  position: relative; /* ONLY needed for positioning pseudo-elements like stones */
}

/* Star points are a simple dot centered in the transparent cell */
.board-intersection.star-point::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 8px;
  height: 8px;
  background-color: rgba(0, 0, 0, 0.4);
  border-radius: 50%;
}

/* Stones are also pseudo-elements or backgrounds */
.board-intersection.p0::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 80%; /* Slightly smaller than the cell */
  height: 80%;
  /* background-color: white; */
  border-radius: 50%;
  /* box-shadow: inset 2px 2px 4px rgba(255, 255, 255, 0.5); */
  background: radial-gradient(circle at 25% 25%, #FFF, #D0D0D0);
  box-shadow: 0px 0px 5px 0px #222;
}
.board-intersection.p1::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 80%; /* Slightly smaller than the cell */
  height: 80%;
  /* background-color: black; */
  border-radius: 50%;
  /* box-shadow: inset 2px 2px 4px rgba(255, 255, 255, 0.5); */
  background: radial-gradient(circle at 25% 25%, #303030, #000);
  box-shadow: 0px 0px 2px 0px #222;
}


/* #zebraGomoku td.p0:after {
      background: radial-gradient(circle at 25% 25%, #FFF, #D0D0D0);
      box-shadow: 0px 0px 5px 0px #222;
    }

    #zebraGomoku td.p1:after {
      background: radial-gradient(circle at 25% 25%, #303030, #000);
      box-shadow: 0px 0px 2px 0px #222;
    } */

/* --- Edge Overrides --- */

    /* #zebraGomoku td:after {
      content: " ";
      color: green;
      position: absolute;
      left: 7.5%;
      top: 7.5%;
      width: 85%;
      height: 85%;
      border-radius: 50%;
    }

    #zebraGomoku td.p0:after {
      background: radial-gradient(circle at 25% 25%, #FFF, #D0D0D0);
      box-shadow: 0px 0px 5px 0px #222;
    }

    #zebraGomoku td.p1:after {
      background: radial-gradient(circle at 25% 25%, #303030, #000);
      box-shadow: 0px 0px 2px 0px #222;
    } */

    


    /* for the head section */
    #gameInfo {
      text-align: center;
      min-height: 80px;
      /* Prevent layout shifts */
    }

    /* styles for the loading screen */
    /* Custom styles for the Gomoku board */
    .gomoku-board {
      display: grid;
      grid-template-columns: repeat(var(--board-size), 1fr);
      border: 1px solid #333;
      background-color: #f0d9b5;
      box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
      border-radius: 8px;
      overflow: hidden;
    }

    .board-cell {
      width: 30px;
      /* Fixed size for animation cells */
      height: 30px;
      /* Fixed size for animation cells */
      border: 0.5px solid #333;
      /* Grid lines */
      display: flex;
      justify-content: center;
      align-items: center;
      position: relative;
      /* For piece positioning */
    }

    .piece {
      width: 80%;
      /* Make piece slightly smaller than cell */
      height: 80%;
      border-radius: 50%;
      position: absolute;
      animation: fadeIn 0.5s ease-out;
      /* Fade-in animation for pieces */
    }

    .piece-black {
      background-color: #000;
    }

    .piece-white {
      background-color: #fff;
      border: 1px solid #333;
      /* Border for white pieces */
    }

    @keyframes fadeIn {
      from {
        opacity: 0;
        transform: scale(0.8);
      }

      to {
        opacity: 1;
        transform: scale(1);
      }
    }

    /* Ensure Inter font is used */
    body {
    }

    .content {
      max-width: 700px;
      width: 100%;
      margin: 0 auto;
    }

    .online {
      margin: 0 auto;
      text-align: center;
    }
    .online ul { 
      list-style: none;
    }
    #rematch {
      margin: 0 auto; 
      text-align: center; 
      display: none;
    }
    #sendRematch {
      margin: 0 auto; 
      text-align: center; 
      display: none;
    }
    /* A utility class to hide elements */
.hidden {
  display: none;
}
    
    /* Style for the cell that contains the last move */
.last-move {
  outline: 3px solid #ffcc00; /* A bright, noticeable color */
  outline-offset: -3px; /* Pulls the outline inside the cell padding */
  border-radius: 50%; /* Make the outline circular if your cells are square */
  box-shadow: 0 0 10px #ffcc00; /* Optional: Add a glow for more emphasis */
}

/* You could also use a simple background change */
.last-move-bg {
  background-color: rgba(255, 255, 0, 0.3); /* A subtle yellow highlight */
}


.cell.star-point {
  background-image:
    radial-gradient(circle 8px, #555 100%, transparent 100%), /* [0] The Dot */
    linear-gradient(#333, #333),                               /* [1] Vertical Line */
    linear-gradient(#333, #333);                               /* [2] Horizontal Line */
  
  background-size:
    8px 8px,     /* Dot size */
    2px 100%,    /* V-Line size */
    100% 2px;    /* H-Line size */

  background-position:
    center,      /* Dot position */
    center,      /* V-Line position */
    center;      /* H-Line position */
}


#zebraGomoku.my-turn-white div:not(.p0):not(.p1):hover,
#zebraGomoku.my-turn-black div:not(.p0):not(.p1):hover {
  /* Make the cursor a pointer to show it's a clickable area */
  cursor: pointer;
}

/* --- STEP 1: Define ALL the common styles for the ghost stone --- */
#zebraGomoku.my-turn-black div:not(.p0):not(.p1):hover::after,
#zebraGomoku.my-turn-white div:not(.p0):not(.p1):hover::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 80%;
  height: 80%;
  border-radius: 50%;
  /* The background-color will be overridden below */
}

/* --- STEP 2: Override ONLY the background-color for each turn --- */
#zebraGomoku.my-turn-black div:not(.p0):not(.p1):hover::after {
  background-color: rgba(0, 0, 0, 0.4); /* Black ghost stone */
}

#zebraGomoku.my-turn-white div:not(.p0):not(.p1):hover::after {
  background-color: rgba(255, 255, 255, 0.4); /* White ghost stone */
}

/* ======================================================
   STYLE 2: 3D PUSHABLE BUTTON
   ====================================================== */

.actionBtn {
  /* --- Color Variables --- */
  --btn-color-top: #49a8de; /* The main button color */
  --btn-color-bottom: #2e7ca8; /* The shadow/3D part */
  --btn-text-color: #ffffff;
  --btn-color-top-hover: #59b8ef;
  
  /* --- Base Styles --- */
  background-color: var(--btn-color-top);
  color: var(--btn-text-color);
  border: none;
  border-radius: 12px;
  
  /* --- Sizing and Spacing --- */
  padding: 16px 32px;
  font-size: 20px;
  font-weight: 700;
  text-transform: uppercase;
  
  /* --- Effects and Transitions --- */
  cursor: pointer;
  /* The key to the 3D effect: a solid box shadow on the bottom */
  box-shadow: 0 6px 0 var(--btn-color-bottom);
  transition: transform 0.1s ease-out, box-shadow 0.1s ease-out;
  position: relative; /* For the top property in :active state */
}

/* --- Interactive States --- */

.actionBtn:hover {
  background-color: var(--btn-color-top-hover);
  transform: translateY(-2px);
  box-shadow: 0 8px 0 var(--btn-color-bottom);
}

.actionBtn:active {
  /* Move the button down to 'crush' the shadow */
  transform: translateY(6px);
  /* The shadow disappears because the button is now on top of it */
  box-shadow: 0 0px 0 var(--btn-color-bottom);
  transition-duration: 0.05s; /* Make the press instant */
}

/* --- Disabled/Searching State --- */
/* Add this class with JavaScript */
.actionBtn.is-searching {
  cursor: wait;
  background-color: #95a5a6; /* A disabled gray */
  box-shadow: 0 6px 0 #7f8c8d;
  color: #ecf0f1;
}

.actionBtn.is-searching:hover,
.actionBtn.is-searching:active {
  /* Disable all hover/active effects when searching */
  transform: translateY(0);
  box-shadow: 0 6px 0 #7f8c8d;
}
#timers {
  /* display:none; */
}
.timers {
  display:none;
  width: 100vw; 
  max-width: 600px;
  margin: 10px auto;
}

/* #status {
  display:none;
} */

#searchForGameEl {
  display: none;
}
.timer {
  display:flex;
  justify-items: center;
  margin: 0px 15px;
}
.time {
  padding: 10px;
  font-weight: 500;
}
.player-label {
  padding: 10px;
}

.active-timer {
  /* border: 2px solid red; */
  color: white;
  background-color: #333;
  border-radius: 5px;
}

#user-name {
  display: none;
}

.online-users {
  max-width: 600px;
  margin: 15px auto;
}

@media (max-width: 768px) {
 #game {
  width: 100%;
  max-width: 100%;
  /* max-width: 75%; */
  /* margin: 0px 10px; */
  /* padding: 400px; */
  /* background-color: blue; */
 }
 .content {
  /* margin: 0px 10px; */
  padding: 10px;
  max-width: 100%;
  /* max-width: 75%; */
 }
 .online-users {
  margin: 15px;
 }
}

#findMatchBtn {
  margin-top: 10px;
}

p {
  /* Add space only on the bottom */
  margin-top: 0;
  margin-bottom: 1rem; /* About one line of space */
  color: #333333; /* A soft, dark grey instead of pure black */
  max-width: 65ch; /* Limits the line to about 65 characters */
  line-height: 1.6; /* Excellent for most fonts */
  font-size: 1.125rem; /* Equivalent to 18px */
}



/* Header Styles */





header {
  background-color: white;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  position: sticky;
  top: 0;
  z-index: 100;
}

header .container {
  display:flex;
  justify-content: space-between;
  align-items: center;
  padding: 5px 20px;
}

.container {
  width: 100%;
  max-width: 1000px;
  margin: 0 auto;
}

.logo h1 {
  font-size: 18px;
  font-weight: 600;
  color: var(--primary-color);
  margin: 0px auto;
}

a { 
  text-decoration: none;
  color: var(--primary-color);
  transition: var(--transition);
}


nav ul {
  display: flex;
  margin: 0 auto;
}

ul {
  list-style: none;
}

nav ul li {
  margin-left: 20px;
}

nav ul li a {
  color: var(--dark-color);
  font-weight: 500;
  padding: 5px 10px;
  border-radius: 4px;
  font-size: 14px;
}

.menu-toggle {
  display: none;
}

:root {
  --primary-color: #3498db;
  --secondary-color: #2c3e50;
  --accent-color: #e74c3c;
  --light-color: #f5f5f5;
  --dark-color: #333;
  --gray-color: #7f8c8d;
  --border-color: #ddd;
  --success-color: #2ecc71;
  --warning-color: #f39c12;
  --danger-color: #e74c3c;
  --shadow: 0 2px 10px rgba(0,0,0,0.1);
  --transition: all 0.3s ease;
}

/* Header mobile responsive styles */

@media (min-width: 769px) and (max-width: 1024px) {
  nav ul li a {
    font-size: 14px;
    padding: 4px 8px;
  }
  .logo h1 {
    font-size: 20px !important;
  }
}

@media (max-width: 768px) {
  header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 20px;
    flex-wrap: wrap;
    position: relative;
  }
  header .container > *:first-child {
  margin: auto;
  }
  nav {
    order: 3;
    width: 100%;
    margin-top: 15px;
    display: none;
  }
  .menu-toggle {
    order: 1;
    display: block;
    font-size: 18px;
    cursor: pointer;
    /* margin-left: 15px; */
    flex-shrink: 0;
  }
  nav.active { 
    display: block;
  }
  nav ul {
    flex-direction: column;
    width: 100%;
    padding: 0;
  }
  nav ul li {
    margin: 0;
  }
  nav ul li a {
    display: block;
    padding: 10px;
    border-bottom: 1px solid var(--border-color)
  }
}



/* These are all of the footer styles */
footer {
  background-color: var(--secondary-color);
  color: white;
  padding: 50px 0 20px;
}

footer .container {
  max-width: 1200px;
  padding: 20px;
}

.footer-content {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  margin-bottom: 30px;
}

.footer-logo, .footer-links, .footer-social {
  margin-bottom: 20px;
}

.footer-logo h2 {
  font-size: 24px;
  margin-bottom: 10px;
}

.footer-links ul li {
  margin-bottom: 10px;
}

.footer-links ul { 
  padding: 0px;
}

.footer-logo p {
  color: rgba(255,255,255,0.7);
  font-size: 1rem;
}

.language-dropdown {
  margin-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.language-dropdown label {
  color: #bdc3c7;
  font-size: 0.9rem;
  font-weight: bold;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.language-dropdown label i {
  font-size: 1rem;
}

.fa-solid, .fas {
  font-weight: 900;
}

.language-dropdown select {
  background-color: #34495e;
  color: #bdc3c7;
  border: 1px solid #4a5f7a;
  border-radius: 5px;
  padding: 0.5rem;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.3s ease;
}

.language-dropdown select option {
  background-color: #34495e;
  color: #bdc3c7;
  padding: 0.5rem;
}

.footer-links ul li a {
  color: rgba(255,255,255,0.7);
  transition: var(--transition);
}

.footer-links ul li a:hover {
  color: white;
}

.footer-bottom {
  text-align: center;
  padding-top: 20px;
  border-top: 1px solid rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.5);
}

.footer-bottom p {
  width: 100%;
  max-width: 100%;
  color: rgba(255,255,255,0.5);
  font-size: 1rem;
}

main {
  /* min-height: calc(100vh - 70px - 250px); */
  padding: 40px 0 0 0;
}

.social-icons { 
  display: flex;
  gap: 15px;
}

.social-icons a {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  color: white;
  transition: var(--transition);
}
.social-icons a:hover {
  background-color: var(--primary-color);
}

@media (max-width: 768px) {
  .container {
    width: 100%;
    padding: 0 0;
    max-width: 100%;
  }
}

@media (max-width: 992px) {
  .footer-content {
    flex-direction: column;
  }
  /* footer .container {
    padding: 20px;
  } */
}

/* styles for the main page */
.hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 50px;
}
.hero-content {
  padding-right: 40px;
  flex: 1 1 0%;
}
.hero-content h2 {
  font-size: 42px;
  font-weight: 700;
  margin-bottom: 15px;
  color: var(--secondary-color);
}
.hero-content p {
  font-size: 18px;
  margin-bottom: 30px;
  color: var(--gray-color);
}
.hero-buttons {
  display: flex;
  gap: 15px;
}
.primary-btn {
  background-color: var(--primary-color);
  color: white;
}
.secondary-btn {
  background-color: var(--secondary-color);
  color: white;
}
.secondary-btn:hover {
  background-color: #1a2530;
  color: white;
}
.btn {
  display: inline-block;
  cursor: pointer;
  font-size: 16px;
  font-weight: 600;
  text-align: center;
  padding: 10px 20px;
  border-width: initial;
  border-style: none;
  border-color: initial;
  border-image: initial;
  border-radius: 4px;
  transition: var(--transition);
}
.hero-image {
  text-align: center;
  flex: 1 1 0%;
}
.hero-image img {
  max-width: 100%;
  box-shadow: var(--shadow);
  border-radius: 8px;
}

.features { 
  display: flex; 
  justify-content: space-between;
  margin-bottom: 50px;
  gap: 20px;
}
.feature-card { 
  background-color: white;
  text-align: center;
  box-shadow: var(--shadow);
  flex: 1 1 0%;
  border-radius: 8px;
  padding: 30px;
  transition: var(--transition);
}
.feature-card i { 
  font-size: 36px;
  color: var(--primary-color);
  margin-bottom: 15px;
}
.feature-card h3 { 
  font-size: 20px;
  margin-bottom: 10px;
  color: var(--secondary-color);
}
.feature-card p {
  color: var(--gray-color);
  font-size: 1em;
}
.leaderboard-preview { 
  background-color: white;
  box-shadow: var(--shadow);
  border-radius: 8px;
  padding: 30px;
}
.leaderboard-preview h2 {
  font-size: 24px;
  margin-bottom: 20px;
  color: var(--secondary-color);
  text-align: center;
}
.leaderboard-table {
  width: 100%;
  margin-bottom: 20px;
}
.leaderboard-header {
  display: flex;
  background-color: var(--secondary-color);
  color: white;
  font-weight: 600;
  border-radius: 4px 4px 0px 0px;
}
.leaderboard-header div { 
  padding: 12px 15px;
}
.leaderboard-header div, .leaderboard-row div { 
  padding: 12px 15px;
}
.rank {
  width: 15%;
  text-align: center;
}
.player {
  width: 55%;
}
.wins {
  width: 15%;
  text-align: center;
}
.leaderboard-row {
  display: flex;
  border-bottom: 1px solid var(--border-color);
  transition: var(--transition);
  cursor: pointer;
}
.leaderboard-row:hover {
  background-color: rgba(52,152,219,0.05);
}
.leaderboard-preview .btn {
  display: block;
  width: 200px;
  margin: 0px auto;
}