*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  background-image: url("./images/hexagon.avif");
  background-repeat: no-repeat;
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  background-color: rgb(111, 154, 192);
  font-family: Verdana, Geneva, Tahoma, sans-serif;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 20px;
}

/* ── Top icon ── *

/* ── Main row: board + history side by side ── */
.main-row {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 40px;
}

/* ── Board wrapper: holds the grid + number/letter labels ── */
.board-wrapper {
  position: relative;
  padding-left: 36px;   /* room for numbers */
  padding-bottom: 36px; /* room for letters */
}

.board {
  display: grid;
  grid-template-columns: repeat(8, clamp(50px, 8vw, 78px));
  grid-template-rows: repeat(8, clamp(50px, 8vw, 78px));
  outline: 3px solid rgb(53, 2, 2);
  position: relative;
}

.numbers {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%; /* will be set to board height via grid */
  width: 32px;
  display: flex;
  flex-direction: column-reverse;
  align-items: center;
  justify-content: space-around;
  font-size: clamp(0.6rem, 1.5vw, 1rem);
  font-weight: bold;
  list-style: none;
  color: white;
  background: transparent;
}

.letters {
  position: absolute;
  bottom: 0;
  left: 36px; /* align with board start */
  width: calc(8 * clamp(50px, 8vw, 78px));
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: space-around;
  font-size: clamp(0.6rem, 1.5vw, 1rem);
  font-weight: bold;
  list-style: none;
  color: white;
  background: transparent;
}

.square {
  font-size: clamp(22px, 4vw, 44px);
  align-content: center;
  text-align: center;
  cursor: pointer;
  user-select: none;
  color: rgb(38, 15, 209);
  background: rgb(180, 210, 220);
}

.black {
  background: rgb(133, 60, 78) !important;
}

.selected {
  background: rgb(230, 230, 154) !important;
}

.move {
  background: rgba(19, 245, 53, 0.5) !important;
}

.check {
  background: rgb(241, 76, 35) !important;
}

/* ── Move history ── */
#display {
  display: flex;
  flex-direction: column;
  width: clamp(180px, 20vw, 260px);
  height: calc(8 * clamp(50px, 8vw, 78px)); /* match board height */
  overflow-y: auto;
  border-radius: 4px;
  font-family: "Verdana";
  letter-spacing: 0.1em;
  font-weight: bold;
  background-color: rgb(180, 210, 220);
  border: 4px solid rgba(175, 21, 60, 0.4);
  flex-shrink: 0;
}

#moveheader {
  color:  rgb(133, 60, 78);
  text-align: center;
  padding: 8px;
  font-size: clamp(0.7rem, 1.5vw, 1rem);
  flex-shrink: 0;
}

.moveline {
  display: grid;
  grid-template-columns: 28px 1fr 1fr;
  align-items: center;
  padding: 5px 6px;
  color: rgb(133, 60, 78);
  background: transparent;
  font-size: clamp(0.65rem, 1.2vw, 0.85rem);
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.moveline span {
  background: transparent;
  color: rgb(133, 60, 78)
}

/* ── Controls ── */
#controls {
  display: flex;
  gap: 12px;
 height: 30px;

}

.control-button {
  width: 100px;
  padding: 6px 0;
  cursor: pointer;
  background: rgb(13, 11, 86);
  color: white;
  border: 1px solid rgba(175, 21, 60, 0.5);
  border-radius: 4px;
  font-family: Verdana, Geneva, Tahoma, sans-serif;

}

.control-button:hover {
  background: rgb(30, 25, 120);
}

/* ── Responsive: stack on small screens ── */
@media (max-width: 700px) {
  .main-row {
    flex-direction: column;
    align-items: center;
  }

  #display {
    width: calc(8 * clamp(50px, 8vw, 78px));
    height: 200px;
  }
}
