/* ---------- FONT ---------- */
@import url("https://fonts.googleapis.com/css2?family=Playfair+Display:wght@500;600&family=Inter:wght@400;500&display=swap");

body {
  background: #fbf9e4;
  font-family: "Inter", sans-serif;

  display: flex;
  flex-direction: column;
  justify-content: start;
  align-items: center;
  gap: 0.2rem;
  padding: 1.5rem;
}

/* ---------- HEADING ---------- */
#game-heading {
  font-family: "Playfair Display", serif;
  font-size: 2rem;
  margin-bottom: 0rem;
  text-align: center;
}

/* ---------- GRID ---------- */
.grid {
  display: grid;
  width: 100%;
  max-width: 30rem;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 0rem;
}

/* ---------- TILE STRUCTURE ---------- */
.tile {
  width: 100%;
  aspect-ratio: 1/1;
  perspective: 1000px; /* required for 3D flip */
}

/* Rotating inner container */
.tile-inner {
  width: 100%;
  height: 100%;
  position: relative;
  transition: transform 0.6s ease;
  transform-style: preserve-3d;
}

/* ---------- FACES ---------- */
.tile-front,
.tile-back {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 12px;
  background: #fbf2c6; /* tile color */
  display: flex;
  align-items: center;
  justify-content: center;
  backface-visibility: hidden;
}

/* FRONT */
.tile-front img {
  max-width: 60%;
  max-height: 60%;
}

/* BACK */
.tile-back {
  transform: rotateY(180deg);
}

/* ---------- BUTTON ---------- */
button {
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  border: none;
  font-size: 1rem;
  font-family: "Inter", sans-serif;
  cursor: pointer;
  background: #ff3f00;
  transition: opacity 0.2s ease;
  color: white;
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.tile.selected {
  background-color: #ffa600 !important;
}

.fortune-card {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
}

.fortune-content {
  background: white;
  padding: 2rem;
  border-radius: 16px;
  max-width: 320px;
  text-align: center;
}

.fortune-card.active {
  pointer-events: auto;
}
.fortune-content img {
  width: 80px;
  height: auto;
  margin-bottom: 1rem;
  display: block;
  margin-left: auto;
  margin-right: auto;
}
.instruction-card {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
}

.instruction-card.active {
  pointer-events: auto;
}

.instruction-content {
  background: white;
  padding: 2rem;
  border-radius: 16px;
  max-width: 320px;
  text-align: center;
}
.restart-card {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
}

.restart-card.active {
  pointer-events: auto;
}

.restart-content {
  background: white;
  padding: 2rem;
  border-radius: 16px;
  max-width: 320px;
  text-align: center;
}
