/* Matching Game Styles - FIXED MOBILE OVERFLOW */
.matching-game {
  max-width: 900px;
  margin: 10px auto;
  padding: 1rem;
  min-height: auto;
  height: auto;
  position: relative;
}

.game-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin: 1rem 0;
  min-height: auto; /* Remove fixed height */
}

.game-column {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-height: auto; /* Remove fixed height */
}

.game-column h4 {
  color: #0050ef;
  font-size: 1rem;
  margin-bottom: 0.5rem;
  text-align: center;
  font-weight: 600;
}

.game-card {
  background: white;
  border: 2px solid #e9ecef;
  padding: 0.75rem;
  cursor: pointer;
  text-align: center;
  min-height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  transition: all 0.3s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  position: relative;
  width: 100%;
  box-sizing: border-box;
}

.game-card:hover:not(.matched) {
  border-color: #0050ef;
  transform: translateY(-1px);
}

.game-card.selected {
  background: rgba(0, 80, 239, 0.1);
  border-color: #0050ef;
}

.game-card.matched {
  background: #d4edda;
  border-color: #28a745;
  opacity: 0.6;
  cursor: default;
}

.card-text {
  font-weight: 600;
  color: #333;
  font-size: 0.9rem;
  word-break: break-word;
  line-height: 1.2;
  padding: 0 0.5rem;
}

/* Better Audio Indicator */
.audio-indicator {
  position: absolute;
  top: 0.25rem;
  right: 0.25rem;
  width: 16px;
  height: 16px;
  background: #0050ef;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 0.6rem;
  font-weight: bold;
}

.audio-indicator::before {
  content: "♪";
}

/* Game Completion - Fixed Positioning */
.game-complete {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: white;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  border: 2px solid #e9ecef;
  z-index: 1000;
  width: 90%;
  max-width: 400px;
  padding: 2rem;
  text-align: center;
}

.completion-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}

.new-round-button {
  padding: 0.75rem 1.5rem;
  background: #0050ef;
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.3s ease;
  margin-top: 1rem;
}

.new-round-button:hover {
  background: #0040c7;
  transform: translateY(-2px);
}

/* Mobile Responsive - NO OVERFLOW */
@media (max-width: 768px) {
  .matching-game {
    margin: 5px;
    padding: 0.5rem;
    height: auto;
    min-height: auto;
    overflow: visible;
  }
  
  .game-container {
    gap: 0.5rem;
    min-height: auto;
    height: auto;
  }
  
  .game-column {
    min-height: auto;
    height: auto;
  }
  
  .game-card {
    min-height: 45px;
    padding: 0.6rem 0.4rem;
    height: auto;
  }
  
  .card-text {
    font-size: 0.85rem;
    padding: 0 0.25rem;
  }
  
  .audio-indicator {
    width: 14px;
    height: 14px;
    font-size: 0.5rem;
  }
  
  .game-complete {
    padding: 1.5rem;
    margin: 0;
    width: 95%;
  }
}

@media (max-width: 480px) {
  .matching-game {
    padding: 0.25rem;
  }
  
  .game-container {
    gap: 0.25rem;
  }
  
  .game-card {
    min-height: 40px;
    padding: 0.5rem 0.3rem;
  }
  
  .card-text {
    font-size: 0.8rem;
  }
  
  .audio-indicator {
    width: 12px;
    height: 12px;
  }
}

/* Nuclear option - ensure no overflow */
.content .matching-game,
.content .game-container,
.content .game-column {
  overflow: visible !important;
  max-height: none !important;
  height: auto !important;
}

body, html {
  overflow-x: hidden;
}