@import url('https://fonts.googleapis.com/css2?family=Open+Sans:ital,wght@0,300..800;1,300..800&display=swap');

* {
  --cell_size: 60px;
  --wall_size: 9px;
  font-family: "Open Sans", Arial, Helvetica, sans-serif;
}

body {
  margin: 0;
  padding: 25px 0;
}

.reserves {
  height: calc(2 * var(--cell_size) + var(--wall_size) + 10px);
}

/* .reserves::after {
  content: "";
  background: linear-gradient(45deg, #181818, #282828);
  position: absolute;
  height: 100%;
  width: calc(100% + 100px + 2 * var(--wall_size) + 4px);
  top: -2px;
  left: calc(-50px - var(--wall_size) - 2px);
  border-radius: 15px 15px 0 0;
  clip-path: polygon(0 0, 100% 0, 100% 10%, 93.5% 100%, 6.5% 100%, 0 10%);
} */

/* .reserves#r1::after {
  top: unset;
  bottom: -2px;
  border-radius: 0 0 15px 15px;
  clip-path: polygon(6.5% 0, 93.5% 0, 100% 90%, 100% 100%, 0 100%, 0 90%);
} */

.reserves td div.wall {
  top: 2px;
  z-index: 10;
}

#board {
  display: flex;
  justify-content: center;
  flex-direction: row;
  align-items: center;
}

#game {
  padding: 0 calc(var(--wall_size) + 50px);
  background: linear-gradient(45deg, hsl(29 55% 25% / 1), #A1662F);
  border-radius: 15px;
  rotate: 0;
  transition: rotate 1s;
}

#game.flip {
  rotate: 180deg;
}

#game td {
  position: relative;
}

td.square {
  height: var(--cell_size);
  width: var(--cell_size);
  background: linear-gradient(45deg, #181818, #282828);
  box-shadow: -2px 2px 5px -2px;
  border-radius: 2px;
  /* display: inline-flex;
  justify-content: center;
  align-items: center; */
}

tr:not(.reserves) td.square {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

tr.reserves td.square {
  padding-bottom: calc(var(--cell_size) / 2 - 15px);
  padding-top: calc(var(--cell_size) / 2 + var(--wall_size) + 25px);
  display: inline-flex;
  justify-content: center;
  align-items: flex-end;
}

tr.reserves:last-of-type td.square {
  padding-top: calc(var(--cell_size) / 2 - 15px);
  padding-bottom: calc(var(--cell_size) / 2 + var(--wall_size) + 25px);
  align-items: flex-start;
}

tr td.square::after {
  content: "";
  display: block;
  height: 30px;
  width: 30px;
  border-radius: 50%;
  background: radial-gradient(rgba(255, 255, 255, 0.8), rgba(255, 255, 255, 0.5));
  opacity: 0;
  box-shadow: 0 0 10px 2px rgba(255, 255, 255, 0.5);;
  transition: opacity 0.1s;
}

tr td.square.move::after {
  /* content: "";
  display: block;
  height: 30px;
  width: 30px; */
  /* border-radius: 50%; */
  /* background: radial-gradient(rgba(255, 255, 255, 0.8), rgba(255, 255, 255, 0.5));
  box-shadow: 0 0 10px 2px rgba(255, 255, 255, 0.5); */
  opacity: 1;
}

tr:not(.hwall) td.wall {
  width: var(--wall_size);
}

tr.hwall td.wall {
  height: var(--wall_size);
}

.piece {
  height: calc(var(--cell_size) - 10px);
  width: calc(var(--cell_size) - 10px);
  background: linear-gradient(45deg, #878787, #efefef);
  border-radius: 50%;
  box-shadow: 2px -2px 5px -2px rgba(200, 200, 200, 0.5);
  transition: top 1s, left 1s;
  position: absolute;
  margin-top: 5px;
  margin-left: 5px;
  top: 0;
  left: 0;
  transition: top 0.5s, left 0.5s, transform 0.25s, box-shadow 0.25s;
  z-index: 100;
}

.piece.hov {
  transform: scale(1.15);
  cursor: pointer;
  box-shadow: 0px 0px 5px rgba(200, 200, 200, 0.5);
}

.piece#p1 {
  background: linear-gradient(45deg, hsl(0, 78%, 10%), #670d0d);
}

div.wall {
  background: rgb(207, 146, 13);
  height: var(--wall_size);
  width: calc(2 * var(--cell_size) + var(--wall_size) + 8px);
  position: absolute;
  top: 1px;
  left: 0;
  box-shadow: -2px 2px 5px 2px rgba(0, 0, 0, 0.5);
}

div.wall.vert {
  width: var(--wall_size);
  height: calc(2 * var(--cell_size) + var(--wall_size) + 8px);  
  left: 1px;
  top: calc(-8px - var(--cell_size) - var(--wall_size))
}

div.wall.temp {
  opacity: 0.7;
  cursor: pointer;
  transform: scale(1.1);
}

div.wall.invalid {
  opacity: 0.7;
  transform: scale(1.1);
  background: rgb(255, 42, 42) !important;
  animation: blink-half 1s infinite;
}

@keyframes blink-half {
  from {
    opacity: 0.7;
  }
  50% {
    opacity: 0.2;
  }
  to {
    opacity: 0.7;
  }
}

div.wall.side0 {
  background: rgb(248, 201, 99);
}

div.wall.side1 {
  background: rgb(207, 91, 13)
}

#popup {
  position: fixed;
  top: 0;
  left: 0;
  height: 100%;
  width: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  display: none;
}

#popup.open {
  display: flex;
  animation: fade-in 0.5s;
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

#modal {
  width: 400px;
  background: rgba(255, 255, 255, 0.85);
  border-radius: 10px;
  letter-spacing: -0.5px;
}

#modal h1 {
  margin: 0;
  margin-top: 25px;
  text-align: center;
  font-size: 24px;
}

#modal p {
  margin: 0;
  margin-top: 5px;
  text-align: center;
  font-size: 18px;
}

#modal button:first-of-type {
  margin-top: 25px;
}

#modal button {
  height: 55px;
  width: 100%;
  border: 0;
  border-top: 2px solid rgba(150, 150, 150, 0.8);
  background-color: rgba(0, 0, 0, 0);
  font-size: 22px;
  font-weight: 600;
  color: #2572f1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding-bottom: 5px;
  cursor: pointer;
  border-radius: 0 0 10px 10px;
  transition: background-color 0.1s;
}

#modal button:disabled {
  cursor: default;
}

#modal button:not(:disabled):hover {
  background-color: rgba(100, 100, 100, 0.2);
}

#modal form {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 15px;
}

#modal input {
  font-size: 16px;
  font-weight: 600;
  padding: 10px 15px;
  text-align: center;
  width: 150px;
  outline: 0;
  border: 1px solid #777;
  border-radius: 2px;
  transition: border-color 0.1s;
}

#modal input.error {
  border-color: red;
}

#modal input:focus {
  border: 1px solid rgb(0, 82, 170);
}

#infobox {
  align-self: stretch;
  width: 400px;
  margin-left: 25px;
  background: #fafafa;
  border: 1px solid #aaa;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#info {
  text-align: center;
  padding: 15px 25px;
  border-bottom: 1px solid #aaa;
}

#info p {
  margin: 0;
}

#info p:not(:first-child) {
  margin-top: 10px;
}

#chatbox {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

#chatbox form {
  /* padding: 15px 0; */
  border-top: 1px solid #aaa;
  display: flex;
  justify-content: space-between;
}

#chatbox form input {
  flex: 1;
  border: 0;
  padding: 10px 15px;
  font-size: 14px;
  outline: 0;
}

#chatbox form button {
  border: 0;
  outline: 0;
  width: 30px;
  background-color: white;
  background-image: url(./send.png);
  background-size: 25px;
  background-repeat: no-repeat;
  background-position: center;
  cursor: pointer;
  transition: background-size 0.1s;
}

#chatbox form button:hover {
  background-size: 30px;
}

#chat {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 15px 0;
}

#chat .msg {
  margin: 0;
  padding: 5px 15px;
  color: #333;
}

#chat .msg.self {
  background-color: #eee;
}

#chat .msg .name {
  font-weight: 600;
  color: black;
}

#chat .info {
  margin: 0;
  background: #777;
  color: white;
  padding: 5px 15px;
}