/* ========== BODY - BACKGROUND ========== */
body {
  background-color: #130617;
  background-image: 
    linear-gradient(135deg, rgba(19, 6, 23, 0.8) 0%, rgba(26, 6, 37, 0.8) 50%, rgba(37, 5, 43, 0.8) 75%, rgba(42, 6, 44, 0.8) 100%),
    url('../../img/coverBlockhero.png');
  background-size: cover, cover;
  background-position: center, center;
  background-repeat: no-repeat, no-repeat;
  background-attachment: fixed, fixed;
  background-blend-mode: normal, normal;
  color: #ffffff;
  padding-top: 80px;
  min-height: 100vh;
}

/* Стили для демо интерактивной сказки */
.motion-demo {
  max-width: 100%;
  margin: 0;
  padding: 40px 24px 80px;
  min-height: calc(100vh - 80px);
  display: flex;
  justify-content: center;
}

.demo-content-wrapper {
  max-width: 900px;
  width: 100%;
  margin: 0 auto;
  background-color: white;
  border-radius: 20px;
  padding: 40px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  color: #620080; /* Фиолетовый цвет по умолчанию для всего текста на белом фоне */
}

.demo-header {
  text-align: center;
  padding: 30px 24px;
  background: linear-gradient(135deg, rgba(147, 51, 234, 0.1) 0%, rgba(98, 0, 128, 0.15) 100%);
  border-radius: 20px;
  margin-bottom: 30px;
}

.back-link {
  display: inline-block;
  color: #620080;
  text-decoration: none;
  font-weight: 500;
  margin-bottom: 15px;
  transition: color 0.3s;
}

.back-link:hover {
  color: #9333ea;
}

.demo-header h1 {
  font-size: 2.2rem;
  color: #620080;
  margin-bottom: 8px;
  font-weight: 700;
}

.demo-subtitle {
  font-size: 1rem;
  color: #620080;
  opacity: 0.9;
  font-weight: 500;
  opacity: 0.9;
}

/* Информационный блок */
.demo-info-box {
  background: linear-gradient(135deg, rgba(147, 51, 234, 0.15) 0%, rgba(98, 0, 128, 0.2) 100%);
  border: 2px solid rgba(147, 51, 234, 0.3);
  border-radius: 20px;
  padding: 24px;
  margin: 24px;
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

.info-icon {
  font-size: 1.5rem;
  flex-shrink: 0;
}

.info-content h3 {
  font-size: 1.1rem;
  color: #620080;
  margin-bottom: 10px;
  font-weight: 700;
}

.info-content p {
  color: #620080;
  line-height: 1.6;
  margin-bottom: 10px;
  font-size: 0.95rem;
}

.info-note {
  background: rgba(98, 0, 128, 0.15);
  padding: 10px 14px;
  border-radius: 8px;
  border-left: 3px solid rgba(147, 51, 234, 0.5);
  margin-top: 10px;
}

.info-note strong {
  color: #620080;
}

/* Игровая секция */
.game-section {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px;
}

.game-section.hidden {
  display: none;
}

/* Главное меню */
.menu-container {
  background: white;
  border-radius: 20px;
  padding: 40px 32px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  text-align: center;
}

.menu-container h2 {
  font-size: 2.5rem;
  color: #28a745;
  margin-bottom: 32px;
  font-family: 'Amatic SC', cursive;
}

.menu-buttons {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 500px;
  margin: 0 auto;
}

.menu-btn {
  position: relative;
  width: 100%;
  height: 70px;
  padding: 0;
  border: none;
  border-radius: 16px;
  color: white;
  font-size: 22px;
  font-weight: bold;
  cursor: pointer;
  overflow: hidden;
  transition: all 0.3s;
  font-family: 'Amatic SC', cursive;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.menu-btn .ru,
.menu-btn .fa {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: opacity 0.3s ease;
  z-index: 2;
}

.menu-btn .ru {
  opacity: 1;
}

.menu-btn .fa {
  opacity: 0;
  direction: ltr;
}

.menu-btn:hover .ru {
  opacity: 0;
}

.menu-btn:hover .fa {
  opacity: 1;
}

.menu-btn::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 140%;
  height: 500%;
  background: white;
  opacity: 0.4;
  transform: translateX(-98%) translateY(-25%) rotate(45deg);
  transition: transform 0.5s ease-in-out;
  z-index: 1;
}

.menu-btn:hover::after {
  transform: translateX(-9%) translateY(-25%) rotate(45deg);
}

.menu-btn:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

.listen-btn {
  background: linear-gradient(135deg, #4caf50, #388e3c);
}

.learn-btn {
  background: linear-gradient(135deg, #ff9800, #f57c00);
}

.play-btn {
  background: linear-gradient(135deg, #f44336, #d32f2f);
}

/* Видео режим */
.video-container {
  background: white;
  border-radius: 20px;
  padding: 32px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  text-align: center;
}

.video-container h2 {
  font-size: 2rem;
  color: #28a745;
  margin-bottom: 24px;
  font-family: 'Amatic SC', cursive;
}

.video-wrapper {
  position: relative;
  width: 100%;
  max-width: 900px;
  margin: 0 auto 24px;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.video-wrapper video {
  width: 100%;
  height: auto;
  display: block;
}

/* Викторина */
.game-container {
  display: flex;
  gap: 24px;
  background: white;
  border-radius: 20px;
  padding: 24px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.scene-panel,
.reaction-panel {
  flex: 1;
  min-width: 300px;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.scene-panel {
  flex: 1.2;
}

.reaction-panel {
  flex: 0.8;
}

.scene-panel h2 {
  font-size: 1.6rem;
  color: #28a745;
  margin-bottom: 12px;
  text-align: center;
  padding: 0 8px;
}

.scene {
  width: 100%;
  height: 350px;
  background: #f0f9f0;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0;
}

.scene-placeholder {
  text-align: center;
  color: #666;
}

.scene-icon {
  font-size: 4rem;
  margin-bottom: 10px;
}

.scene img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.options {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-top: 12px;
  padding: 0;
}

.option-btn {
  padding: 12px 32px 12px 24px;
  font-size: 16px;
  font-weight: bold;
  background: #e8f4e8;
  border: 2px solid #28a745;
  border-radius: 50px;
  cursor: pointer;
  transition: all 0.2s;
  color: #28a745;
  font-family: "PT Sans", sans-serif;
  position: relative;
  white-space: nowrap;
}

.option-btn:hover:not(:disabled) {
  background: #d4edda;
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(40, 167, 69, 0.3);
}

.option-btn:disabled {
  cursor: not-allowed;
}

.option-btn.correct {
  background: #d4edda !important;
  border-color: #28a745 !important;
  color: #155724 !important;
  opacity: 1 !important;
  animation: correctPulse 0.5s ease;
  position: relative;
}

.option-btn.correct::after {
  content: "✓";
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 18px;
  color: #28a745;
  font-weight: bold;
}

.option-btn.incorrect {
  background: #f8d7da !important;
  border-color: #dc3545 !important;
  color: #721c24 !important;
  opacity: 1 !important;
  animation: incorrectShake 0.5s ease;
  position: relative;
}

.option-btn.incorrect::after {
  content: "✗";
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 18px;
  color: #dc3545;
  font-weight: bold;
}

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

@keyframes incorrectShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-10px); }
  75% { transform: translateX(10px); }
}

/* Реакция */
.reaction-panel {
  display: flex;
  align-items: center;
  justify-content: center;
}

.reaction-area {
  width: 100%;
  min-height: 350px;
  max-height: 350px;
  background: linear-gradient(135deg, #e8f4e8 0%, #d4edda 100%);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  border: 2px solid #28a745;
  position: relative;
  overflow: hidden;
}

.reaction-placeholder {
  text-align: center;
  padding: 32px 24px;
  z-index: 2;
}

.character-icon {
  font-size: 5rem;
  margin-bottom: 16px;
  animation: bounce 2s infinite;
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-20px); }
}

.reaction-placeholder p {
  font-size: 1.1rem;
  color: #28a745;
  font-weight: 600;
  margin: 0;
}

#reactionVideo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  position: absolute;
  top: 0;
  left: 0;
  z-index: 1;
}

.reaction-success {
  background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
  border-color: #28a745;
}

.reaction-error {
  background: linear-gradient(135deg, #f8d7da 0%, #f5c6cb 100%);
  border-color: #dc3545;
}

/* Навигация */
.game-navigation {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  background: white;
  padding: 16px 24px;
  border-radius: 20px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.nav-btn,
.back-menu-btn {
  padding: 10px 20px;
  font-size: 0.95rem;
  font-weight: 600;
  background: #28a745;
  color: white;
  border: none;
  border-radius: 50px;
  cursor: pointer;
  transition: all 0.3s;
  font-family: "PT Sans", sans-serif;
  text-decoration: none;
  display: inline-block;
}

.nav-btn:hover:not(:disabled),
.back-menu-btn:hover {
  background: #218838;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(40, 167, 69, 0.3);
}

.nav-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.progress-indicator {
  font-size: 1.1rem;
  color: #28a745;
  font-weight: 600;
}

/* Игра "Пары" */
.pairs-game-container {
  background: white;
  border-radius: 20px;
  padding: 24px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.stage {
  position: relative;
  width: 100%;
  max-width: 900px;
  height: 100px;
  background: linear-gradient(to right, #8B5E3C, #A67C52, #8B5E3C);
  border-radius: 16px;
  box-shadow: 0 6px 16px rgba(0,0,0,0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 24px;
  overflow: visible;
  z-index: 1;
}

.stage-title {
  font-size: 1.8rem;
  font-weight: bold;
  color: #fff;
  text-shadow: 0 2px 4px rgba(0,0,0,0.4);
  background: rgba(0,0,0,0.25);
  padding: 8px 20px;
  border-radius: 14px;
  z-index: 2;
  text-align: center;
  font-family: 'Amatic SC', cursive;
}

.character {
  position: absolute;
  bottom: -20px;
  width: 120px;
  height: auto;
  z-index: 3;
  filter: drop-shadow(0 4px 6px rgba(0,0,0,0.25));
}

.character.stage-left {
  left: 24px;
}

.character.stage-right {
  right: 24px;
}

.main-content {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

#pairsBoard {
  background: rgba(0, 0, 0, 0.65);
  padding: 16px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(2, 1fr);
  gap: 10px;
  width: 100%;
  max-width: 900px;
  border-radius: 18px;
  box-shadow: 0 8px 28px rgba(0,0,0,0.45);
  position: relative;
  min-height: 350px;
}

.pair-card {
  cursor: pointer;
  user-select: none;
  background: transparent;
  border: none;
  padding: 0;
  border-radius: 14px;
  overflow: hidden;
  transition: transform 0.25s ease;
  aspect-ratio: 1;
}

.pair-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.pair-card:hover img {
  transform: scale(1.06);
}

.pair-card.wrong {
  animation: shake 0.6s cubic-bezier(0.36, 0.07, 0.19, 0.96);
}

.pair-card.matched {
  opacity: 0.5;
  pointer-events: none;
}

.pair-card.moving {
  position: absolute;
  z-index: 100;
  animation: walkLike 1.8s cubic-bezier(0.2, 0.9, 0.3, 1) forwards;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}

@keyframes walkLike {
  0% { transform: translate(0,0) rotate(0deg); }
  20% { transform: translate(var(--dx), var(--dy)) translateY(-10px) rotate(-2deg); }
  40% { transform: translate(var(--dx), var(--dy)) translateY(0) rotate(1deg); }
  60% { transform: translate(var(--dx), var(--dy)) translateY(-6px) rotate(-1deg); }
  80% { transform: translate(var(--dx), var(--dy)) translateY(-2px) rotate(0.5deg); }
  100% { transform: translate(var(--dx), var(--dy)) translateY(0) rotate(0deg) scale(0.85); }
}

.controls {
  display: flex;
  gap: 12px;
  margin-top: 16px;
  flex-wrap: wrap;
  justify-content: center;
}

.btn {
  padding: 10px 24px;
  font-size: 1rem;
  font-weight: bold;
  border: none;
  border-radius: 50px;
  cursor: pointer;
  background: linear-gradient(135deg, #5a9e4f, #447a3a);
  color: white;
  transition: all 0.3s ease;
  box-shadow: 0 4px 10px rgba(0,0,0,0.2);
  font-family: "PT Sans", sans-serif;
}

.btn:hover {
  transform: translateY(-4px) scale(1.03);
  box-shadow: 0 6px 16px rgba(0,0,0,0.3);
}

.win-screen {
  width: 100%;
  max-width: 900px;
  padding: 32px 24px;
  text-align: center;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 20px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
}

.win-message {
  font-size: 1.8rem;
  color: #447a3a;
  font-weight: bold;
  text-shadow: 0 2px 4px rgba(0,0,0,0.2);
  line-height: 1.4;
  font-family: 'Amatic SC', cursive;
  margin: 0;
}

/* Адаптивность */
@media (max-width: 768px) {
  .demo-info-box {
    margin: 16px;
    padding: 20px;
    flex-direction: column;
  }

  .game-section {
    padding: 16px;
  }

  .menu-container {
    padding: 32px 24px;
  }

  .menu-container h2 {
    font-size: 2rem;
    margin-bottom: 24px;
  }

  .menu-btn {
    height: 60px;
    font-size: 20px;
  }

  .video-container {
    padding: 24px 16px;
  }

  .game-container {
    flex-direction: column;
    padding: 16px;
    gap: 16px;
  }

  .scene-panel,
  .reaction-panel {
    width: 100%;
  }

  .scene {
    height: 250px;
  }

  .reaction-area {
    min-height: 250px;
  }

  .game-navigation {
    flex-direction: column;
    text-align: center;
    padding: 16px;
    gap: 12px;
  }

  .options {
    flex-direction: column;
    gap: 8px;
  }

  .option-btn {
    width: 100%;
    padding: 10px 20px;
    font-size: 15px;
  }

  .stage {
    height: 80px;
    margin-bottom: 20px;
  }

  .stage-title {
    font-size: 1.4rem;
    padding: 6px 16px;
  }

  .character {
    width: 90px;
    bottom: -16px;
  }

  .character.stage-left {
    left: 16px;
  }

  .character.stage-right {
    right: 16px;
  }

  #pairsBoard {
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(4, 1fr);
    padding: 12px;
    gap: 8px;
    min-height: 300px;
  }

  .pairs-game-container {
    padding: 16px;
  }

  .controls {
    gap: 10px;
    margin-top: 12px;
  }
}
