/* --- 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;
}

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 {
      font-family: "Inter", sans-serif;
    }

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

    .online {
      /* max-width: 1000px; */
      /* width: 100%; */
      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;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  
  /* --- 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 */
  font-family: 'Lora', serif; /* A classic serif for body text */
  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 */
}

h1, h2, h3 {
  font-family: 'Lato', sans-serif; /* A clean sans-serif for headings */
}