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

html, body {
  height: 100%;
  background: #3a3a32;
  font-family: Georgia, "Times New Roman", serif;
  overflow: hidden;
}

#game {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  width: 100%;
}

#board-wrapper {
  position: relative;
  height: min(92vh, 95vw / 1.3337);
  aspect-ratio: 2390 / 1792;
  background: url('assets/board.png') 0 0 / 100% 100% no-repeat;
}

#board {
  position: absolute;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(8, 1fr);
  left: 21.59%;
  top: 22.6%;
  width: 57.15%;
  height: 54.5%;
}

.cell {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: default;
}

.cell--light,
.cell--dark {
  background: transparent;
}

.cell img {
  width: 75%;
  height: 75%;
  object-fit: contain;
  pointer-events: none;
  will-change: transform, opacity;
}

.cell img[data-piece="white"] {
  border-radius: 50%;
  object-fit: cover;
}

.cell--selected {
  box-shadow: inset 0 0 0 3px rgba(255, 210, 80, 0.7);
}

.cell--valid {
  cursor: pointer;
}

.cell--valid::after {
  content: "";
  position: absolute;
  width: 36%;
  height: 36%;
  border-radius: 50%;
  background: rgba(255, 210, 80, 0.35);
  pointer-events: none;
}

.cell--clickable {
  cursor: pointer;
}

/* Blood splatter */
.blood-drop {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  z-index: 3;
  animation: blood-splat 450ms ease-out forwards;
}

@keyframes blood-splat {
  0% {
    transform: translate(0, 0) scale(1);
    opacity: 0.9;
  }
  60% {
    opacity: 0.8;
  }
  100% {
    transform: translate(var(--dx), var(--dy)) scale(0.2);
    opacity: 0;
  }
}

.blood-stain {
  position: absolute;
  width: 60%;
  height: 60%;
  border-radius: 50%;
  background: radial-gradient(ellipse, rgba(120, 0, 0, 0.45) 0%, rgba(80, 0, 0, 0.15) 60%, transparent 100%);
  pointer-events: none;
  z-index: 1;
}

/* Splash screen */
#splash {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #1a1a1a;
  z-index: 20;
  cursor: pointer;
  transition: opacity 600ms ease;
}

#splash.fade-out {
  opacity: 0;
  pointer-events: none;
}

#splash.hidden {
  display: none;
}

#splash img {
  max-width: 80%;
  max-height: 80%;
  object-fit: contain;
}

/* Overlay */
#overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(20, 20, 20, 0.85);
  z-index: 10;
  cursor: pointer;
}

#overlay.hidden {
  display: none;
}

#overlay-text {
  color: #d4c5a9;
  font-size: clamp(1.4rem, 4vw, 2.4rem);
  text-align: center;
  max-width: 80%;
  line-height: 1.6;
  letter-spacing: 0.03em;
}
