/* ===========================================
   MINIGAME SECTION - PUZZLE GAME
   =========================================== */

/* Основной контейнер секции */
.minigame-section {
  padding: 6rem 0;
  background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
  position: relative;
  overflow: hidden;
}

.minigame-section::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: 
    radial-gradient(circle at 20% 20%, rgba(255, 255, 255, 0.1) 0%, transparent 50%),
    radial-gradient(circle at 80% 80%, rgba(255, 255, 255, 0.1) 0%, transparent 50%);
  animation: backgroundFloat 20s ease-in-out infinite;
  z-index: 1;
}

@keyframes backgroundFloat {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-20px) rotate(2deg); }
}

/* Контейнер - УВЕЛИЧЕННЫЙ РАЗМЕР */
.minigame-container {
  max-width: 1600px;
  margin: 0 auto;
  padding: 0 3rem;
  position: relative;
  z-index: 2;
}

/* Заголовок секции */
.minigame-header {
  text-align: center;
  margin-bottom: 4rem;
  animation: headerSlideIn 1s ease-out;
}

@keyframes headerSlideIn {
  0% {
    opacity: 0;
    transform: translateY(-50px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

.minigame-title {
  font-size: 3rem;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 1rem;
  text-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
  font-family: 'Montserrat', sans-serif;
}

.minigame-subtitle {
  font-size: 1.3rem;
  color: rgba(255, 255, 255, 0.9);
  max-width: 600px;
  margin: 0 auto;
  line-height: 1.6;
}

/* Контейнер игры - УВЕЛИЧЕННЫЙ РАЗМЕР */
.game-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5rem;
  align-items: center;
  margin-bottom: 4rem;
  max-width: 1400px;
  margin-left: auto;
  margin-right: auto;
}

/* Левая часть - описание */
.game-info {
  animation: infoSlideIn 1.2s ease-out 0.3s both;
}

.game-description {
  font-size: 1.2rem;
  color: rgba(255, 255, 255, 0.9);
  margin-bottom: 2rem;
  line-height: 1.7;
}

.game-features {
  list-style: none;
  padding: 0;
  margin: 0;
}

.game-features li {
  color: rgba(255, 255, 255, 0.8);
  margin-bottom: 1rem;
  padding-left: 2rem;
  position: relative;
  font-size: 1.1rem;
}

.game-features li::before {
  content: '⚡';
  position: absolute;
  left: 0;
  top: 0;
  font-size: 1.2rem;
  color: #ffd700;
}

/* Правая часть - игра */
.game-area {
  background: linear-gradient(135deg, 
    rgba(255, 255, 255, 0.15) 0%, 
    rgba(255, 255, 255, 0.05) 100%);
  border-radius: 25px;
  padding: 2.5rem;
  backdrop-filter: blur(20px);
  border: 3px solid rgba(255, 255, 255, 0.3);
  box-shadow: 
    0 20px 40px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
  animation: gameSlideIn 1.2s ease-out 0.6s both;
  position: relative;
  overflow: hidden;
}

.game-area::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(45deg, 
    rgba(255, 255, 255, 0.1) 0%, 
    transparent 25%, 
    transparent 75%, 
    rgba(255, 255, 255, 0.1) 100%);
  animation: shimmer 3s ease-in-out infinite;
  z-index: 1;
}

@keyframes shimmer {
  0%, 100% { transform: translateX(-100%); }
  50% { transform: translateX(100%); }
}

/* Переключатель типов игр */
.game-type-selector {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 2rem;
  position: relative;
  z-index: 2;
}

.game-type-btn {
  padding: 0.8rem 1.5rem;
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.8);
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 25px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-weight: 600;
  font-size: 1rem;
  backdrop-filter: blur(10px);
  position: relative;
  overflow: hidden;
}

.game-type-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.5s ease;
}

.game-type-btn:hover::before {
  left: 100%;
}

.game-type-btn.active {
  background: linear-gradient(135deg, #ff6b6b 0%, #ee5a24 100%);
  color: white;
  border-color: rgba(255, 255, 255, 0.4);
  box-shadow: 0 5px 15px rgba(255, 107, 107, 0.3);
}

.game-type-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.game-title {
  font-size: 1.8rem;
  color: #ffffff;
  text-align: center;
  margin-bottom: 2rem;
  font-weight: 700;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  position: relative;
  z-index: 2;
}

/* Пазл контейнер - УВЕЛИЧЕННЫЙ РАЗМЕР 4x4 */
.puzzle-container {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 15px;
  max-width: 700px;
  margin: 0 auto;
  background: linear-gradient(135deg, 
    rgba(0, 0, 0, 0.4) 0%, 
    rgba(0, 0, 0, 0.2) 100%);
  padding: 25px;
  border-radius: 25px;
  border: 4px solid rgba(255, 255, 255, 0.3);
  box-shadow: 
    0 15px 40px rgba(0, 0, 0, 0.6),
    inset 0 3px 6px rgba(255, 255, 255, 0.1);
  position: relative;
  z-index: 2;
}

/* Контейнер для игры на память - УВЕЛИЧЕННЫЙ РАЗМЕР */
.memory-container {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 15px;
  max-width: 700px;
  margin: 0 auto;
  background: linear-gradient(135deg, 
    rgba(0, 0, 0, 0.4) 0%, 
    rgba(0, 0, 0, 0.2) 100%);
  padding: 25px;
  border-radius: 25px;
  border: 4px solid rgba(255, 255, 255, 0.3);
  box-shadow: 
    0 15px 40px rgba(0, 0, 0, 0.6),
    inset 0 3px 6px rgba(255, 255, 255, 0.1);
  position: relative;
  z-index: 2;
}

.puzzle-piece {
  width: 120px;
  height: 120px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.2rem;
  font-weight: bold;
  color: white;
  cursor: pointer;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  border: 4px solid rgba(255, 255, 255, 0.4);
  position: relative;
  overflow: hidden;
  box-shadow: 
    0 6px 12px rgba(0, 0, 0, 0.4),
    inset 0 2px 4px rgba(255, 255, 255, 0.2);
}

/* Карточки для игры на память - УВЕЛИЧЕННЫЕ */
.memory-card {
  width: 130px;
  height: 130px;
  background: linear-gradient(135deg, #4ecdc4 0%, #44a08d 100%);
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.8rem;
  font-weight: bold;
  color: white;
  cursor: pointer;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  border: 4px solid rgba(255, 255, 255, 0.4);
  position: relative;
  overflow: hidden;
  box-shadow: 
    0 6px 12px rgba(0, 0, 0, 0.4),
    inset 0 2px 4px rgba(255, 255, 255, 0.2);
  transform-style: preserve-3d;
}

.memory-card.flipped {
  background: linear-gradient(135deg, #ff6b6b 0%, #ee5a24 100%);
  transform: rotateY(180deg);
}

.memory-card.matched {
  background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
  animation: matchPulse 0.6s ease-in-out;
}

@keyframes matchPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

.puzzle-piece::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
  transition: left 0.5s ease;
}

.puzzle-piece:hover::before {
  left: 100%;
}

.puzzle-piece:hover {
  transform: scale(1.1);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.puzzle-piece.empty {
  background: rgba(255, 255, 255, 0.1);
  border: 2px dashed rgba(255, 255, 255, 0.3);
}

.puzzle-piece.correct {
  background: linear-gradient(135deg, #4ecdc4 0%, #44a08d 100%);
  animation: correctPulse 0.6s ease-in-out;
}

@keyframes correctPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.2); }
}

/* Кнопки управления */
.game-controls {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-top: 2rem;
}

.game-btn {
  padding: 0.8rem 1.5rem;
  background: linear-gradient(135deg, #ff6b6b 0%, #ee5a24 100%);
  color: white;
  border: none;
  border-radius: 25px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 1rem;
}

.game-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.game-btn.secondary {
  background: linear-gradient(135deg, #4ecdc4 0%, #44a08d 100%);
}

/* Статистика */
.game-stats {
  display: flex;
  justify-content: space-around;
  margin-top: 2rem;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 15px;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.stat-item {
  text-align: center;
  color: rgba(255, 255, 255, 0.9);
}

.stat-value {
  font-size: 1.5rem;
  font-weight: bold;
  color: #ffd700;
  display: block;
}

.stat-label {
  font-size: 0.9rem;
  margin-top: 0.5rem;
}

/* Адаптивность */
@media (max-width: 1200px) {
  .minigame-container {
    max-width: 1400px;
    padding: 0 2rem;
  }
  
  .game-container {
    max-width: 1200px;
    gap: 4rem;
  }
  
  .puzzle-container {
    max-width: 600px;
  }
  
  .memory-container {
    max-width: 600px;
  }
  
  .puzzle-piece {
    width: 100px;
    height: 100px;
    font-size: 2rem;
  }
  
  .memory-card {
    width: 110px;
    height: 110px;
    font-size: 2.2rem;
  }
}

@media (max-width: 768px) {
  .minigame-container {
    max-width: 100%;
    padding: 0 1rem;
  }
  
  .game-container {
    grid-template-columns: 1fr;
    gap: 2rem;
    max-width: 100%;
  }
  
  .minigame-title {
    font-size: 2.5rem;
  }
  
  .puzzle-container {
    max-width: 500px;
    padding: 20px;
    gap: 10px;
  }
  
  .memory-container {
    max-width: 500px;
    padding: 20px;
    gap: 10px;
  }
  
  .puzzle-piece {
    width: 90px;
    height: 90px;
    font-size: 1.6rem;
  }
  
  .memory-card {
    width: 100px;
    height: 100px;
    font-size: 2rem;
  }
}

@media (max-width: 600px) {
  .minigame-container {
    padding: 0 0.8rem;
  }
  
  .puzzle-container {
    max-width: 400px;
    padding: 18px;
    gap: 9px;
  }
  
  .memory-container {
    max-width: 400px;
    padding: 18px;
    gap: 9px;
  }
  
  .puzzle-piece {
    width: 75px;
    height: 75px;
    font-size: 1.4rem;
  }
  
  .memory-card {
    width: 85px;
    height: 85px;
    font-size: 1.6rem;
  }
}

@media (max-width: 480px) {
  .minigame-section {
    padding: 4rem 0;
  }
  
  .minigame-container {
    padding: 0 0.5rem;
  }
  
  .minigame-title {
    font-size: 2rem;
  }
  
  .game-container {
    gap: 1.5rem;
  }
  
  .puzzle-container {
    max-width: 320px;
    padding: 15px;
    gap: 8px;
  }
  
  .memory-container {
    max-width: 320px;
    padding: 15px;
    gap: 8px;
  }
  
  .puzzle-piece {
    width: 60px;
    height: 60px;
    font-size: 1.2rem;
  }
  
  .memory-card {
    width: 60px;
    height: 60px;
    font-size: 1.2rem;
  }
}
