/* ============================================
   LocalPulse — Игра "Мемори"
   Стили для игры Memory Match
   ============================================ */

:root {
  --card-size: 70px;
  --card-gap: 8px;
  --card-radius: 8px;
  --card-bg: #2D3748;
  --card-back: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --card-flip-duration: 0.6s;
}

/* Секция игры */
.memory-game-section {
  padding: 3rem 1rem;
  background: linear-gradient(135deg, #1a202c 0%, #2d3748 100%);
  border-top: 2px solid #4a5568;
  border-bottom: 2px solid #4a5568;
}

.memory-game-section h2 {
  color: #fff;
  margin-bottom: 1.5rem;
  text-align: center;
  font-size: 1.75rem;
  font-weight: 700;
}

/* Панель управления */
.game-controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 2rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.game-stat {
  background: rgba(255, 255, 255, 0.1);
  padding: 0.75rem 1.5rem;
  border-radius: 10px;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.game-stat label {
  color: #a0aec0;
  font-size: 0.875rem;
  margin-right: 0.5rem;
}

.game-stat strong {
  color: #fff;
  font-size: 1.25rem;
  font-weight: 700;
}

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

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

.game-btn:active {
  transform: translateY(0);
}

/* Игровое поле */
.memory-game-board {
  display: grid !important;
  grid-template-columns: repeat(4, var(--card-size)) !important;
  gap: var(--card-gap) !important;
  justify-content: center !important;
  margin: 0 auto !important;
  max-width: calc(var(--card-size) * 4 + var(--card-gap) * 3) !important;
  padding: 12px !important;
  background: rgba(31, 41, 55, 0.3) !important;
  backdrop-filter: blur(10px) !important;
  border: 1px solid rgba(75, 85, 99, 0.5) !important;
  border-radius: 16px !important;
}

/* Светлая тема - игровое поле */
.light .memory-game-board {
  background: rgba(243, 244, 246, 0.8) !important;
  border: 1px solid rgba(209, 213, 219, 0.5) !important;
}

/* Карта */
.memory-card {
  width: var(--card-size) !important;
  height: var(--card-size) !important;
  position: relative !important;
  cursor: pointer !important;
  perspective: 1000px !important;
}

.memory-card-inner {
  width: 100%;
  height: 100%;
  position: relative;
  transition: transform var(--card-flip-duration) cubic-bezier(0.4, 0, 0.2, 1);
  transform-style: preserve-3d;
}

.memory-card.flipped .memory-card-inner {
  transform: rotateY(180deg);
}

.memory-card.matched .memory-card-inner {
  transform: rotateY(180deg);
}

.memory-card.matched .memory-card-front {
  box-shadow: 0 0 20px rgba(74, 222, 128, 0.6);
  border-color: #48bb78;
}

/* Стороны карты */
.memory-card-front,
.memory-card-back {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  border-radius: var(--card-radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
  border: 3px solid transparent;
  transition: all 0.3s ease;
}

/* Рубашка карты (видима когда не перевёрнута) */
.memory-card-back {
  background: var(--card-back);
  background-size: 200% 200%;
  animation: gradient 3s ease infinite;
}

.memory-card-back::after {
  content: '🎴';
  font-size: 2rem;
  opacity: 0.8;
}

/* Лицо карты (видима когда перевёрнута) */
.memory-card-front {
  background: #fff;  /* Белый фон для контраста */
  transform: rotateY(180deg);
  border-color: #4a5568;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Изображение на карте */
.card-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 8px;
}

/* Смайлик на карте */
.card-emoji {
  font-size: 2.5rem;
  line-height: 1;
}

.memory-card:hover .memory-card-back {
  transform: scale(1.05);
  box-shadow: 0 8px 25px rgba(102, 126, 234, 0.5);
}

/* Анимация градиента рубашки */
@keyframes gradient {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* Модальное окно победы */
.game-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.game-modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.game-modal {
  background: linear-gradient(135deg, #1a202c 0%, #2d3748 100%);
  padding: 2.5rem;
  border-radius: 20px;
  text-align: center;
  max-width: 400px;
  width: 90%;
  border: 2px solid #667eea;
  box-shadow: 0 20px 60px rgba(102, 126, 234, 0.5);
  transform: scale(0.8);
  transition: transform 0.3s ease;
}

.game-modal-overlay.active .game-modal {
  transform: scale(1);
}

.game-modal h3 {
  color: #fff;
  font-size: 1.75rem;
  margin-bottom: 1rem;
}

.game-modal p {
  color: #a0aec0;
  margin-bottom: 0.75rem;
  font-size: 1rem;
}

.game-modal .stat-row {
  display: flex;
  justify-content: center;
  gap: 2rem;
  margin: 1.5rem 0;
}

.game-modal .stat-box {
  background: rgba(255, 255, 255, 0.1);
  padding: 1rem 1.5rem;
  border-radius: 10px;
}

.game-modal .stat-box label {
  display: block;
  color: #a0aec0;
  font-size: 0.875rem;
  margin-bottom: 0.25rem;
}

.game-modal .stat-box strong {
  display: block;
  color: #fff;
  font-size: 1.5rem;
  font-weight: 700;
}

.game-modal-buttons {
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin-top: 1.5rem;
}

.game-modal-btn {
  padding: 0.75rem 1.5rem;
  border-radius: 10px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  border: none;
}

.game-modal-btn.primary,
.game-btn.primary {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff;
}

.game-modal-btn.secondary,
.game-btn.secondary {
  background: transparent;
  color: #a0aec0;
  border: 2px solid #4a5568;
}

.game-modal-btn:hover,
.game-btn:hover {
  transform: translateY(-2px);
}

/* Стили для mystery teaser */
.mystery-teaser {
  font-style: italic;
  color: #a0aec0;
}

/* Тайна Черного моря */
.mystery-overlay {
  animation: mysteryFadeIn 0.8s ease-out;
}

@keyframes mysteryFadeIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Адаптивность */
@media (max-width: 768px) {
  :root {
    --card-size: 75px; /* Увеличено на 25%: 60px → 75px */
    --card-gap: 10px;
  }

  .memory-game-section {
    padding: 2rem 1rem;
  }

  .memory-game-section h2 {
    font-size: 1.5rem;
  }

  .game-controls {
    gap: 1rem;
  }

  .game-stat {
    padding: 0.5rem 1rem;
  }

  .game-stat label {
    font-size: 0.75rem;
  }

  .game-stat strong {
    font-size: 1rem;
  }

  .game-btn {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
  }

  .memory-card-front,
  .memory-card-back {
    font-size: 2rem;
  }
}

@media (max-width: 480px) {
  :root {
    --card-size: 62px; /* Увеличено на 25%: 50px → 62px */
    --card-gap: 8px;
  }

  .memory-game-board {
    grid-template-columns: repeat(4, var(--card-size));
  }
}

/* Скрытие секции на маленьких экранах (опционально) */
@media (max-width: 350px) {
  .memory-game-section {
    display: none;
  }
}
