/*
We want to have the game div in the middle of the screen.

height&width 100vh makes the body take the full viewport.
[margin: 0] and [padding: 0]removes default margins&paddings.
Flexbox centers it both horizontally and vertically

It is possible to use instead:
[display: grid; place-items: center;]
The flexbox approach is probably more widely supported,
while the Grid approach with place-items: center is more concise.
*/
:root {
  --board-brown: #cf752b;
  --pit-brown: #ab5130;
  --dark-brown: #7d3833;
  --selection-blue: #a1c5ff;
}

body {
  background-color: rgb(250, 250, 250);
  margin: 0;
  padding: 0;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  position: fixed !important;
  display: flex;
  justify-content: center;
  align-items: center;
  font-family: Arial;
}
/*
min(100vw, 100vh) ensures the square fits within both screen dimensions.
If your game isn't square, you can change the aspect ratio, see [aspect-ratio: 1].
We give it [position: relative] so that the inside elements can be [position:absolute].
*/
.game {
  width: min(100vw, 100vh);
  height: min(100vw, 100vh);
  aspect-ratio: 1;
  position: relative;
}

/* To prevent long-press that will bring up copy-paste dialog.
user-select: none prevents text selection
-webkit-touch-callout: none specifically prevents the iOS long-press callout
-webkit-tap-highlight-color: transparent removes tap highlights on mobile
*/
* {
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  -moz-touch-callout: none;
  -ms-touch-callout: none;
  outline: 0; /* To prevent blue-box outline after click: http://stackoverflow.com/questions/21719306/getting-rid-of-a-blue-box-around-button-when-pressed */
}
textarea,
input {
  -webkit-user-select: text !important;
  -moz-user-select: text !important;
  -ms-user-select: text !important;
  user-select: text !important;
}

/* For tictactoe, to make a right/bottom border.
E.g., to make:

X| |
-----
 | |
-----
O| |

We add right&bottom borders to the top-left cell (with X),
but only right borrder to the bottom-left cell (with O), etc.
*/
.border_right {
  border-right: min(1vw, 1vh) solid black;
}
.border_bottom {
  border-bottom: min(1vw, 1vh) solid black;
}
.row {
  position: absolute;
  left: 0%;
  width: 100%;
}
.column {
  position: absolute;
  top: 0;
  height: 100%;
}

.max_size {
  width: 100%;
  height: 100%;
}

svg {
  width: 100%;
  height: 100%;
}

#board {
  width: 100%;
  height: 30%;
  padding: 2.5%;
  padding-left: 5%;
  padding-right: 5%;
  translate: -5%;
  background-color: var(--board-brown);
  border-color: var(--dark-brown);
  border-width: 0 0 1.5vh 0;
  border-style: none none solid none;
  border-radius: 4vh;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.goal, .pit {
  background-color: var(--pit-brown);
  border-color: var(--dark-brown);
  border-radius: 10vh;
  border-style: solid none solid none;
  border-width: 0.75vh 0vh 0.25vh 0vh;
}

.goal {
  height: 80%;
  width: 10%;
}

.pit {
  display: flex;
  align-items: center;
  justify-content: center;
}

#middle_rows {
  display: flex;
  justify-content: space-evenly;
  align-items: center;
  flex-wrap: wrap;
  height: 100%;
  width: 70%;
}

#top_row, #bottom_row {
  display: flex;
  gap: 1vh;
  height: 36%;
}

/* CSS animations to make the X/O appear slowly
   (the opacity will change from 0.1 to 1 in 0.5s). */
.slowly_appear {
  animation: slowly_appear 0.5s linear;
}

@keyframes slowly_appear {
  from {
    opacity: 0.1;
  }
  to {
    opacity: 1;
  }
}

/* The HUD contains each player's score and a turn indicator */
.hud {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  font-size: 4vh;
  text-align: center;
}

.score {
  max-width: 25vh;
  transition: transform 0.1s;
}

/* The game status is slightly larger than the rest of the HUD text */
#game_status {
  font-size: 5vh;
  font-weight: bold;
  max-width: 20vw;
}

/* All of these elements are interactable and expand on hover */
.pit, .score, #game_status {
  transition: transform 0.1s;
}

.pit:hover, .score:hover, #game_status:hover {
  transform: scale(1.1);
}

/* Align the bead counts above and below the board */
#top_numbers, #bottom_numbers {
  margin-left: 9vh;
  margin-right: 9vh;
  display: flex;
  flex-direction: row;
  justify-content: space-evenly;
  color: black;
  font-size: 3vh;
}

#button_panel {
  margin-top: 6vh;
  max-width: 100%;
  display: flex;
  justify-content: space-evenly;
}

button {
  padding: 2vh;
  max-width: 100%;
  font-size: 3vh;
}

button.active {
  background-color: var(--selection-blue);
}