.game-container {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
  width: 100%;
  max-width: 520px;
  gap: 16px;
}

@media (max-width: 768px) {
  .game-container {
    gap: 8px;
  }
}


.game-board {
  display: grid;
  gap: 24px;
  aspect-ratio: 1;
  grid-template-columns: repeat(4, 1fr);
  background-color: #f9f9f9;
  border-radius: 16px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  padding: 16px
}

.card {
  background-color: #e0e0e0;
  color: #333;
  /* font-size: 1.5rem; */
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
  border-radius: 12px;
  cursor: pointer;
  user-select: none;
  transition: transform 0.3s ease, background-color 0.3s ease, box-shadow 0.3s ease;
  aspect-ratio: 1;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
  width: 100%;
  padding: 0.25rem;
  box-sizing: border-box;
}

.card p {
  overflow-wrap: anywhere;
  hyphens: auto;
  font-weight: 500;
  max-width: 100%;
  line-height: 1.1;
}

.card:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.card.selected {
  background-color: #58d68d;
  color: #fff;
}

.card.matched {
  background-color: #007bff;
  color: #fff;
  cursor: default;
  pointer-events: none;
  transform: scale(1.0);
}

.card.incorrect {
  background-color: hsl(356, 76%, 48%);
  color: #fff;
}

.card.empty {
  background-color: transparent;
  box-shadow: none;
  cursor: default;
  pointer-events: none;
}

.card.empty:hover {
  transform: none;
  box-shadow: none;
}

@media (max-width: 768px) {
  .game-board {
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
  }
}

.game-controls {
  display: flex;
  align-items: flex-end;
}

.game-controls-left {
  display: flex;
  flex-direction: column;
  text-align: center;
  padding: 16px;
  background: #f9f9f9;
  border-radius: 16px;
  box-shadow: 0px 4px 15px rgba(0, 0, 0, 0.1);
  font-weight: 600;
  color: #007aff;
  line-height: 3rem;
}

#timer {
  display: flex;
  flex-direction: column;
  font-size: 4rem;
  height: 4.1rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.5px;
  position: relative;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
}

#timer.timer-complete::after {
  content: "🎊";
  position: absolute;
  left: 30%;
  top: -1.5rem;
  z-index: -1;
  color: white;
  font-size: 3rem;
}

.timer-complete {
  background: linear-gradient(135deg, #007aff, #00b4d8);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: pulse 2s infinite;
}

.difficulty-buttons {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 0 1 50%;
  padding: 16px;
  margin-left: auto;
}

.difficulty-btn {
  padding: 8px 16px;
  border-radius: 8px;
  border: none;
  background: #e0e0e0;
  color: #666;
  font-size: 0.7rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.difficulty-btn:hover {
  background: #d0d0d0;
  transform: translateY(-1px);
}

.difficulty-btn.selected {
  background: #007aff;
  color: white;
}

#restart-button {
  padding: 10px 24px;
  border-radius: 8px;
  border: none;
  background: #007aff;
  color: white;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  opacity: 0.5;
}

#restart-button:not(:disabled) {
  opacity: 1;
}

#restart-button:not(:disabled):hover {
  background: #0056b3;
  transform: translateY(-1px);
}

@keyframes pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

@media (max-width: 768px) {
  .controls-right {
    width: 100%;
  }

}