/* Match‑3 Game styles */

body {
  font-family: 'Poppins', Arial, sans-serif;
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(135deg, #ff5722, #e91e63);
  display: flex;
  justify-content: center;
  align-items: flex-start;
  color: #333;
  /* improve touch experience on mobile */
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
}

#page {
  width: 100%;
  max-width: 1000px;
  padding: 20px;
}

header {
  text-align: center;
  color: #ffffff;
  margin-bottom: 20px;
}

header h1 {
  margin: 0;
  font-family: 'Fredoka One', cursive;
  font-weight: 400;
  font-size: 2.5rem;
}

header p {
  margin: 5px 0 0;
  font-weight: 400;
}

main {
  display: flex;
  justify-content: center;
}

#game-card {
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  padding: 20px;
  text-align: center;
}

#game-container {
  display: grid;
  grid-template-columns: repeat(8, 50px);
  grid-template-rows: repeat(8, 50px);
  gap: 4px;
  background: #e0e0e0;
  padding: 4px;
  margin-bottom: 15px;
  border-radius: 8px;
}

.cell {
  width: 50px;
  height: 50px;
  border-radius: 8px;
  cursor: pointer;
  transition: transform 0.2s;
}

/* Responsive adjustments for mobile screens */
@media (max-width: 600px) {
  #game-container {
    grid-template-columns: repeat(8, 40px);
    grid-template-rows: repeat(8, 40px);
  }
  .cell {
    width: 40px;
    height: 40px;
  }
}

@media (max-width: 400px) {
  #game-container {
    grid-template-columns: repeat(8, 32px);
    grid-template-rows: repeat(8, 32px);
  }
  .cell {
    width: 32px;
    height: 32px;
  }
}

.cell.selected {
  outline: 2px solid #5e35b1;
  transform: scale(1.1);
}

.cell.matched {
  opacity: 0;
  transform: scale(0.4);
  transition: transform 0.3s ease, opacity 0.3s ease;
}

#score-container {
  font-family: 'Fredoka One', cursive;
  font-size: 1.2rem;
  font-weight: 400;
  color: #e53935;
}

#mission-container {
  margin-top: 10px;
}

#mission-info,
#moves-info {
  font-size: 0.95rem;
  color: #555;
  margin: 2px 0;
}

#timer-info {
  font-size: 1rem;
  color: #1e88e5;
  margin-top: 4px;
  font-family: 'Fredoka One', cursive;
}

#popup {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  background: rgba(0, 0, 0, 0.6);
  z-index: 100;
}

#popup.hidden {
  display: none;
}

.popup-content {
  background: #ffffff;
  padding: 20px 30px;
  border-radius: 12px;
  text-align: center;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.popup-content p {
  font-family: 'Poppins', Arial, sans-serif;
  font-size: 1.1rem;
  color: #333;
  margin-bottom: 20px;
}

.popup-buttons {
  display: flex;
  justify-content: center;
  gap: 20px;
}

.popup-buttons button {
  font-family: 'Fredoka One', cursive;
  font-size: 1rem;
  padding: 8px 20px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s;
  color: #ffffff;
}

.popup-buttons button#btn-retry {
  background: #e53935;
}

.popup-buttons button#btn-retry:hover {
  background: #d32f2f;
}

.popup-buttons button#btn-next {
  background: #43a047;
}

.popup-buttons button#btn-next:hover {
  background: #388e3c;
}