body {
  font-family: Arial, sans-serif;
  background-color: #f0f8ff;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  margin: 0;
}

html[dir="rtl"] body {
  direction: rtl;
  text-align: right;
}

html[dir="ltr"] body {
  direction: ltr;
  text-align: left;
}

.game-container {
    background-color: #ffffff;
    border-radius: 15px;
    box-shadow: 0 10px 20px rgba(0,0,0,0.1);
    padding: 20px;
    max-width: 800px;
}

.game-board {
    display: grid;
    grid-template-columns: repeat(5, 120px);
    gap: 10px;

    /* Keep cards visually centered in each cell and center the grid */
    justify-content: center;
    justify-items: center;
    align-items: center;
}

.card {
    width: 120px;
    height: 120px;
    cursor: pointer;
    position: relative;
}

.card-inner {
    width: 100%;
    height: 100%;
    position: relative;
}

.card-front, .card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 0.3s ease, transform 0.6s ease;
}

.card-back {
    background-color: #4682B4;
    border: 3px solid #4682B4;
    transform: rotateY(0deg);
    opacity: 1;
}

.card-front {
    background-color: white;
    border: 3px solid #4682B4;
    transform: rotateY(180deg);
    opacity: 0;
}

/* When flipped, fade front in and back out without moving the card */
.card.flipped .card-front {
    transform: rotateY(0deg);
    opacity: 1;
}

.card.flipped .card-back {
    transform: rotateY(180deg);
    opacity: 0;
}

.card-front img, .card-back img {
    max-width: 90%;
    max-height: 90%;
}

.card-back {
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

.card-back img {
    /* width: 110px;
    height: 110px; */
    border-radius: 10px;
    object-fit: contain;
}

.game-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
    font-size: 18px;
}

.game-result {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(255,255,255,0.9);
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 10px 20px rgba(0,0,0,0.2);
}

.hidden {
    display: none;
}