/* Grund-Reset und Basis-Stile */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Arial', sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  margin: 0;
  padding: 20px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

h1 {
  text-align: center;
  margin: 0;
  font-size: 2.5rem;
  text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
  flex: 1;
}

/* Theme Selector Styles - Positioned at bottom */
.theme-selector {
  background: #fff;
  padding: 15px 20px;
  border-radius: 12px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
  margin-top: 20px;
  text-align: center;
  width: 100%;
  max-width: 500px;
}

.theme-selector h2 {
  margin-bottom: 12px;
  color: #2e3d49;
  font-size: 1.2rem;
}

.theme-buttons {
  display: flex;
  gap: 15px;
  justify-content: center;
  flex-wrap: wrap;
}

.theme-btn {
  padding: 10px 20px;
  border: 3px solid #e0e0e0;
  border-radius: 8px;
  background: #f8f9fa;
  color: #495057;
  font-size: 1rem;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s ease;
  min-width: 110px;
}

.theme-btn:hover {
  border-color: #007bff;
  background: #e3f2fd;
  transform: translateY(-2px);
}

.theme-btn.active {
  border-color: #007bff;
  background: #007bff;
  color: white;
  box-shadow: 0 4px 8px rgba(0, 123, 255, 0.3);
}

.theme-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* Add this after the h1 styles */
.stats {
  background: rgba(255, 255, 255, 0.9);
  color: #2d3748;
  padding: 8px 16px;
  border-radius: 8px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  margin-bottom: 15px;
  font-size: 1.1rem;
  font-weight: 600;
}

/* Einstellungen (Spielstart) */
/* .settings {
  background: #fff;
  padding: 20px;
  border-radius: 8px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  margin-bottom: 20px;
}

.settings label,
.settings input,
.settings button {
  font-size: 1.2rem;
}

.settings input {
  width: 60px;
  margin: 0 10px;
  padding: 5px;
}

.settings button {
  padding: 5px 15px;
  cursor: pointer;
} */

/* Spielbrett - Optimized for tablets */
.game-board {
  display: grid;
  gap: 15px;
  width: 95%;
  max-width: 1200px;
  margin: 0 auto;
  grid-template-columns: repeat(5, 1fr);
  flex: 1;
  align-content: center;
}

/* Karten-Stile */
.card {
  perspective: 1000px;
  cursor: pointer;
}

.card-inner {
  position: relative;
  width: 100%;
  padding-top: 100%; /* Quadrat */
  transition: transform 0.6s;
  transform-style: preserve-3d;
}

/* Wenn umgedreht */
.card.flip .card-inner {
  transform: rotateY(180deg);
}

.card-front,
.card-back {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 8px;
  backface-visibility: hidden;
}

.card-front {
  background-color: #2e3d49;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 2rem;
}

.card-back {
  transform: rotateY(180deg);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background-color: #fdfdfd;
  padding: 0;
  overflow: hidden;
}

.card-back img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card-name {
  position: absolute;
  bottom: 5px;
  left: 5px;
  right: 5px;
  background-color: rgba(0, 0, 0, 0.5);
  color: white;
  padding: 3px;
  border-radius: 3px;
  text-align: center;
  font-size: 0.8em;
  font-weight: bold;
}

/* Verdeckte (gefundene) Karten */
/* .card.matched {
  visibility: hidden;
} */

/* Add this new rule to style matched cards */
.card.matched {
  cursor: default;
  opacity: 0.8;
}

/* Tablet optimized styles (768px - 1024px) */
@media screen and (min-width: 768px) and (max-width: 1024px) {
  body {
    padding: 10px;
    height: 100vh; /* Fallback for older browsers */
    height: 100dvh; /* Dynamic viewport height */
    overflow: hidden; /* Prevent scrolling */
  }
  
  h1 {
    margin: 10px 0 5px; /* Reduce vertical margin */
    font-size: 2.2rem;
  }
  
  .game-board {
    width: 98%;
    max-width: 95vw;
    gap: 10px; /* Reduce gap between cards */
    grid-template-columns: repeat(5, 1fr);
    flex: 1; /* Allow the board to grow and fill space */
    min-height: 0; /* Prevent overflow issue with flexbox */
  }
  
  .stats {
    font-size: 1.2rem;
    padding: 10px 20px;
    margin-bottom: 10px; /* Reduce vertical margin */
  }
  
  .card-front {
    font-size: 2.5rem;
  }
  
  .theme-selector {
    margin-top: 10px; /* Reduce top margin */
    padding: 12px 16px;
  }
  
  .theme-selector h2 {
    font-size: 1.1rem;
    margin-bottom: 10px;
  }
  
  .theme-btn {
    padding: 8px 16px;
    font-size: 0.95rem;
  }
}

/* Large tablet/iPad Pro specific styles */
@media screen and (min-width: 1025px) {
  .game-board {
    gap: 20px;
    max-width: 1000px;
  }

  .card-front {
    font-size: 3rem;
  }
  
  h1 {
    font-size: 2.5rem;
  }
  
  .stats {
    font-size: 1.3rem;
  }
}

/* Standard tablet portrait orientation */
@media screen and (min-width: 768px) and (max-width: 1023px) and (orientation: portrait) {
  .game-board {
    grid-template-columns: repeat(4, 1fr);
    max-height: 75vh;
    gap: 15px;
  }
}

/* Standard tablet landscape orientation */
@media screen and (min-width: 768px) and (max-width: 1023px) and (orientation: landscape) {
  .game-board {
    grid-template-columns: repeat(5, 1fr);
    max-height: 65vh;
    gap: 10px;
  }
  
  body {
    padding: 5px;
  }
  
  h1 {
    margin: 5px 0;
    font-size: 1.8rem;
  }
  
  .stats {
    margin-bottom: 8px;
  }
  
  .theme-selector {
    margin-top: 10px;
  }
}

/* Remove the old media queries and replace with these */
@media screen and (max-width: 767px) {
  .game-board {
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    width: 95%;
  }
  
  .card-front {
    font-size: 1.5rem;
  }
  
  h1 {
    font-size: 1.8rem;
  }
  
  .theme-btn {
    min-width: 100px;
    padding: 8px 16px;
    font-size: 0.9rem;
  }
}

/* Modal Styles */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  animation: modalFadeIn 0.3s ease;
}

.modal-content {
  background: white;
  margin: 10% auto;
  border-radius: 20px;
  width: 90%;
  max-width: 400px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
  animation: modalSlideIn 0.3s ease;
  overflow: hidden;
}

.modal-header {
  padding: 1.5rem 2rem 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: #2d3748;
}

.modal-close {
  font-size: 1.5rem;
  font-weight: bold;
  color: #a0aec0;
  cursor: pointer;
  transition: color 0.2s ease;
}

.modal-close:hover {
  color: #2d3748;
}

.modal-body {
  padding: 1.5rem 2rem;
  text-align: center;
}

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

.modal-text {
  color: #4a5568;
  line-height: 1.6;
  margin: 0;
}

.modal-footer {
  padding: 0 2rem 2rem;
  text-align: center;
}

.modal-btn {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  padding: 0.75rem 2rem;
  border-radius: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.modal-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.modal-btn.success {
  background: linear-gradient(135deg, #10b981 0%, #34d399 100%);
  box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

.modal-btn.success:hover {
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
}

@keyframes modalFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes modalSlideIn {
  from { 
    opacity: 0;
    transform: translateY(-50px) scale(0.9);
  }
  to { 
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.game-header {
  width: 100%;
  max-width: 1000px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.back-btn {
  background: rgba(255, 255, 255, 0.2);
  color: white;
  border: 2px solid rgba(255, 255, 255, 0.3);
  padding: 8px 16px;
  border-radius: 25px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
}

.back-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  border-color: rgba(255, 255, 255, 0.5);
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
} 