* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Arial', sans-serif;
  background-color: #f5f5f5;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
}

.game-container {
  width: 100%;
  max-width: 900px;
}

.header {
  text-align: center;
  color: #333;
  margin-bottom: 30px;
  position: relative;
}

.header h1 {
  font-size: 2.5rem;
  margin-bottom: 10px;
}

.home-btn {
  position: absolute;
  top: 10px;
  left: 0;
  background-color: #111;
  color: white;
  padding: 10px 20px;
  border-radius: 25px;
  text-decoration: none;
  transition: all 0.3s ease;
  font-weight: bold;
}

.home-btn:hover {
  background-color: #2b2b2b;
  transform: translateX(-5px);
}

#game-content {
  perspective: 1000px;
}

.screen {
  background: white;
  border-radius: 10px;
  padding: 40px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  display: none;
  animation: slideIn 0.4s ease;
}

.screen.active {
  display: block;
}

#start-screen h2 {
  font-size: 2.5rem;
  color: #333;
  margin-bottom: 15px;
  text-align: center;
}

.timeline-intro {
  text-align: center;
  color: #666;
  font-size: 1.1rem;
  margin-bottom: 30px;
}

.difficulty-selector {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 15px;
  margin-top: 30px;
}

.difficulty-btn {
  background: #d32f2f;
  color: white;
  border: none;
  padding: 20px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: bold;
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.difficulty-btn span {
  font-size: 1.2rem;
}

.difficulty-btn small {
  font-size: 0.85rem;
  opacity: 0.9;
}

.difficulty-btn:hover {
  background-color: #c71c1c;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.game-stats {
  display: flex;
  justify-content: space-around;
  margin-bottom: 30px;
  background-color: #f5f5f5;
  padding: 15px;
  border-radius: 8px;
}

.stat {
  text-align: center;
}

.stat-label {
  display: block;
  color: #666;
  font-size: 0.9rem;
  margin-bottom: 5px;
}

.stat-value {
  display: block;
  font-size: 1.8rem;
  font-weight: bold;
  color: #d32f2f;
}

.game-board {
  display: grid;
  gap: 10px;
  margin-bottom: 25px;
  padding: 20px;
  background-color: #f9f9f9;
  border-radius: 8px;
  min-height: 300px;
  border: 2px dashed #ddd;
}

.card {
  background: white;
  border: 3px dashed #d32f2f;
  color: #d32f2f;
  font-size: 1.5rem;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  border-radius: 8px;
  transition: all 0.25s ease;
  user-select: none;
  font-weight: bold;
  min-height: 100px;
  padding: 10px;
}

.card:hover:not(.matched) {
  border-color: #d32f2f;
  background-color: #fff9f9;
  transform: translateY(-2px);
}

.card.flipped {
  background: #d32f2f;
  color: white;
  border-style: solid;
}

.card.matched {
  background-color: #4caf50;
  color: white;
  border-color: #4caf50;
  border-style: solid;
  animation: matchPulse 0.5s ease;
  cursor: default;
}

@keyframes matchPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

.card.disappearing {
  animation: cardDisappear 0.6s ease forwards;
}

@keyframes cardDisappear {
  0% { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(0.3); }
}

.win-content h2 {
  color: #333;
  font-size: 2.5rem;
  margin-bottom: 20px;
  text-align: center;
}

.win-stats {
  text-align: center;
  background-color: #f5f5f5;
  padding: 20px;
  border-radius: 8px;
  margin-bottom: 25px;
}

.win-stats p {
  font-size: 1.1rem;
  color: #555;
  margin: 10px 0;
}

.win-stats strong {
  color: #d32f2f;
  font-size: 1.3rem;
}

.rating {
  text-align: center;
  font-size: 1.5rem;
  font-weight: bold;
  margin-bottom: 30px;
  padding: 15px;
  background: #f1f8f5;
  border: 2px solid #4caf50;
  color: #2e7d32;
  border-radius: 8px;
}

.button-group {
  display: flex;
  gap: 15px;
  justify-content: center;
  flex-wrap: wrap;
}

.btn-primary, .btn-secondary {
  padding: 12px 35px;
  font-size: 1.1rem;
  border: none;
  border-radius: 25px;
  cursor: pointer;
  font-weight: bold;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.btn-primary {
  background: #d32f2f;
  color: white;
}

.btn-primary:hover {
  background-color: #c71c1c;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.btn-secondary {
  background-color: #666;
  color: white;
}

.btn-secondary:hover {
  background-color: #555;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

@keyframes slideIn {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

@media (max-width: 768px) {
  .header h1 {
    font-size: 1.8rem;
  }
  .home-btn {
    position: static;
    display: inline-block;
    margin-bottom: 20px;
  }
  .screen {
    padding: 20px;
  }
  .stat-value {
    font-size: 1.4rem;
  }
  .card {
    font-size: 1.1rem;
    min-height: 80px;
  }
  .difficulty-selector, .button-group {
    grid-template-columns: 1fr;
    flex-direction: column;
  }
  .btn-primary, .btn-secondary {
    width: 100%;
  }
}