* {
  font-family: "Georgia", "Garamond", "Times New Roman", serif;
}
body {
  margin: 0;
  padding: 0;
}

/* on the wrapper around all tiles */
.tiles {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 0;
  /* no gaps */
}

.tile {
  width: 100%;
  aspect-ratio: 1 / 1; /* Keeps it square */
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  background-color: beige;
  border: 0.25px solid #eda711;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  position: relative; /* needed for absolute faces */
  overflow: hidden; /* keep content clipped */
  perspective: 900px; /* depth for the flip */
}

.tile:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  z-index: 1;
}

.tile__inner {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.5s ease;
}

.tile__locked,
.tile__back {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tile.is-locked .tile__front {
  display: none;
}
.tile.is-locked .tile__back {
  display: none;
}
.tile.is-unlocked .tile__locked {
  display: none;
}


.tile.is-flipped .tile__front {
  display: none;
}
.tile.is-flipped .tile__back {
  display: flex;
}


.tile__front {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tile__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.tile__frontNum {
  position: absolute;
  bottom: 5%;
  right: 5%;
  z-index: 2;
  color: white;
  -webkit-text-stroke: 1px black;
  font-size: 1.5em;
  font-weight: bold;
  pointer-events: none;
}

.tile__unlock {
  position: absolute;
  inset: 0;
  display: none;
  /* shown on click if locked */
  align-items: center;
  justify-content: center;
  padding: 10px;
  size: 8px;
}

.tile:hover .tile__unlock {
  display: flex;
}

.tile__unlock.is-visible {
  display: flex;
}

.tile__unlock form {
  display: flex;
  gap: 8px;
  background: #fff;
  padding: 2px 2px;
  border-radius: 6px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
  margin-top: 50%;
  size: 8px;
}

.tile__unlock input[type="password"] {
  min-width: 120px;
  border: 1px solid #aaa;
  outline: none;
  border-radius: 4px;
  padding: 6px 8px;
}

/* optional micro-feedback */
@keyframes shake {
  25% {
    transform: translateX(-2px);
  }

  50% {
    transform: translateX(2px);
  }

  75% {
    transform: translateX(-1px);
  }
}

/* Keep hover scale without fighting the flip */
.tile:hover .tile__inner {
  transform: translateZ(0) rotateY(var(--rot, 0deg));
}