* { padding: 0; margin: 0; box-sizing: border-box; }

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-image: url('img/game_background.png');
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  font-family: sans-serif;
}

/* OVERLAYS */
.overlay { 
  position: fixed; top: 0; left: 0; width: 100%; height: 100%; 
  background: linear-gradient(rgba(255,255,255,0.8), rgba(255,255,255,0.8)), url('img/game_background.png');
  background-size: cover; background-position: center;
  display: flex; flex-direction: column; justify-content: center; align-items: center; 
  z-index: 9999; color: black; text-align: center;
}

#intro-logo { width: 200px; margin-bottom: 20px; }
#count-num { display: block; font-size: 5rem; color: #f39c12; font-weight: bold; }

/* BOARD & CARDS */
.memory-game { 
  width: 900px; max-width: 95%; margin: 20px auto; 
  display: flex; flex-wrap: wrap; perspective: 1000px; justify-content: center; 
}

.memory-card { 
  width: calc(16.6% - 10px); height: 120px; margin: 5px; 
  position: relative; transform-style: preserve-3d; transition: transform .4s; cursor: pointer;
}

.memory-card.flip { transform: rotateY(180deg); }

/* SHAKE ANIMATION FOR MISMATCH */
.memory-card.shake {
  animation: shake 0.5s cubic-bezier(.36,.07,.19,.97) both;
}

@keyframes shake {
  10%, 90% { transform: translate3d(-1px, 0, 0) rotateY(180deg); }
  20%, 80% { transform: translate3d(2px, 0, 0) rotateY(180deg); }
  30%, 50%, 70% { transform: translate3d(-4px, 0, 0) rotateY(180deg); }
  40%, 60% { transform: translate3d(4px, 0, 0) rotateY(180deg); }
}

.front-face, .back-face { 
  width: 100%; height: 100%; position: absolute; border-radius: 5px; 
  backface-visibility: hidden;
  padding: 0; /* NO WHITE PADDING */
  overflow: hidden;
}

.front-face { 
  transform: rotateY(180deg); 
  background: none; /* TRANSPARENT BACKGROUND */
}

.front-face img { 
  width: 100%; height: 100%; 
  object-fit: cover; /* FILL CARD COMPLETELY */
  display: block;
}

.back-face { 
  background-image: url('img/back-face.png'); 
  background-size: 100% 100%; 
  background-repeat: no-repeat;
  background-color: transparent; 
}

/* UI ELEMENTS */
.game-header { text-align: center; color: white; padding: 10px; text-shadow: 2px 2px 4px rgba(0,0,0,0.6); }
.stats-container { display: flex; justify-content: center; align-items: center; gap: 15px; }

.modal-overlay {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0,0,0,0.8); display: flex; justify-content: center; align-items: center; z-index: 10010;
}
.audio-card { 
  background: #222; border: 2px solid #f39c12; border-radius: 15px; 
  padding: 30px; width: 340px; color: white; text-align: center; 
}
.control-group { margin-bottom: 20px; }
.btn-orange { background: #f39c12; color: white; border: none; padding: 10px 18px; border-radius: 5px; cursor: pointer; font-weight: bold; margin: 5px; }
.btn-mute { background: #e74c3c; color: white; border: none; padding: 10px 20px; border-radius: 20px; cursor: pointer; margin-bottom: 15px; font-weight: bold; }
.btn-close { background: #444; color: white; border: none; padding: 8px 25px; border-radius: 20px; cursor: pointer; }
input[type=range] { width: 100%; accent-color: #3498db; cursor: pointer; }
