:root {
  --border: white;
}

html, body {
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
}

body {
  --current-player-color: white;
  --current-player-color-dark: #1a1a1aff;
  background-color: var(--current-player-color-dark);

  transition-duration: 500ms;
  transition-property: background-color;

  display: flex;
  align-items: center;
  padding: 1rem;
  box-sizing: border-box;
}

a { color: white }

.popup {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  backdrop-filter: blur(0.5rem);

  display: flex;
  align-items: center;
  justify-content: center;

  transition-duration: 500ms;
  transition-property: opacity;

  overflow-y: scroll;
}

.popup-inner {
  width: 100%;
  max-width: 800px;
  display: flex;
  flex-direction: column;
  justify-content: stretch;
  padding-left: 1rem;
  padding-right: 1rem;
}

.popup-inner > button {
  background-color: #1a1a1aff;
  padding: 0.5rem;
  font-size: 200%;
  border: 0.1rem solid white;
  border-radius: 0.5rem;
}

.popup-inner > * {
  color: white;
  width: 100%;
  flex-shrink: 1;
  box-sizing: border-box;
  margin-top: 0.5rem;
  margin-bottom: 0.5rem;
}

.topboard {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;

  width: 100%;
  height: auto;
  aspect-ratio: 1;

  margin-top: auto;
  margin-bottom: auto;
}

.subboard {
  border: 0.3rem solid;
  border-color: var(--border);

  transition-duration: 500ms;
  transition-property: border-color;

  padding: 0.3rem;
  border-collapse: collapse;
  box-sizing: border-box;
  background-size: contain;

  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
}

.subboard.inactive {
  opacity: 70%;
}

.subboard:not(*.inactive) {
  border-color: var(--current-player-color);
}

.subboard.wonX {
  background-image: url('assets/cross.svg')
}

.subboard.wonO {
  background-image: url('assets/nought.svg')
}

#board00, #board10, #board20 {
  border-top-color: transparent;
}

#board02, #board12, #board22 {
  border-bottom-color: transparent;
}

#board00, #board01, #board02 {
  border-left-color: transparent;
}

#board20, #board21, #board22 {
  border-right-color: transparent;
}

.cell {
  box-sizing: border-box;
  border: 0.1rem solid var(--border);
  background-size: contain;
  border-collapse: collapse;
}

.cell.setX {
  background-image: url('assets/cross.svg')
}

.cell.setO {
  background-image: url('assets/nought.svg')
}

.cell00, .cell10, .cell20 {
  border-top-color: transparent;
}

.cell02, .cell12, .cell22 {
  border-bottom-color: transparent;
}

.cell00, .cell01, .cell02 {
  border-left-color: transparent;
}

.cell20, .cell21, .cell22 {
  border-right-color: transparent;
}

.undo-button {
  background-color: transparent;
  padding: 0.5rem;
  font-size: 200%;
  border: 0.1rem solid white;
  border-radius: 0.5rem;
  color: white;

  transition-duration: 500ms;
  transition-property: opacity;
  opacity: 0.5;
}

#undo-button {
  position: absolute;
  top: 1rem;
  left: 1rem;
  transform: rotate(180deg);
}

#undo-button2 {
  position: absolute;
  bottom: 1rem;
  right: 1rem;
}

.undo-button[disabled], .undo-button:disabled {
  opacity: 0;
}
