/* Базові стилі для мінігри «Дві істини» */
html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: 'Arial', sans-serif;
  color: #f5f5f5;
  /* Прозорий фон для видимості зображення */
  background: transparent;
  overflow-x: hidden;
}

/* Приховує елемент повністю */
.hidden {
  display: none !important;
}

/* Перекриття для стартового та фінального екранів */
.overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 1rem;
  box-sizing: border-box;
  background: rgba(0, 0, 0, 0.45);
}

/* Вміст початкового та фінального екранів */
.start-content,
.finish-content {
  max-width: 520px;
  background: rgba(0, 0, 0, 0.6);
  padding: 2rem 1.5rem;
  border-radius: 1rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
}

.start-character {
  width: 140px;
  height: auto;
  margin-bottom: 1rem;
}

.start-title,
.finish-title {
  font-size: 1.5rem;
  color: #f5e6c6;
  margin: 0;
}

.finish-text {
  font-size: 1rem;
  color: #f5e6c6;
  margin: 0.5rem 0 1rem;
  line-height: 1.4;
}

/* Підсвітка ключових слів у фінальному тексті */
.finish-text strong {
  color: #ffd27f;
  font-weight: 700;
}

/* Універсальні кнопки: старт, CTA, опції */
.start-btn,
.cta-btn,
.option-btn {
  padding: 0.7rem 1.5rem;
  font-size: 1rem;
  font-weight: 600;
  border: none;
  border-radius: 0.5rem;
  color: #1e1e1e;
  background: linear-gradient(90deg, #f7c84d 0%, #a07c4a 100%);
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  transition: transform 0.1s ease;
}

.start-btn:hover,
.cta-btn:hover,
.option-btn:hover {
  transform: scale(1.05);
}

/* Група CTA‑кнопок */
.cta-buttons {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  width: 100%;
  align-items: center;
}

/* Фонове зображення з динамічним рухом */
#background {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -2;
  background-image: url('./background.png');
  background-size: cover;
  background-position: center;
  /* Рухаємо фон повільно вгору-вниз */
  animation: bgMove 40s linear infinite alternate;
  overflow: hidden;
}

@keyframes bgMove {
  from {
    background-position: 50% 0%;
  }
  to {
    background-position: 50% 100%;
  }
}

/* Шар мерехтливих зірок */
#stars {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: hidden;
  z-index: -1;
}

.star {
  position: absolute;
  width: 2px;
  height: 2px;
  background: rgba(255, 255, 255, 0.8);
  border-radius: 50%;
  box-shadow: 0 0 4px rgba(255, 255, 255, 0.8);
  animation: twinkle 2s infinite ease-in-out;
}

@keyframes twinkle {
  0%,
  100% {
    opacity: 0.8;
    transform: scale(0.8);
  }
  50% {
    opacity: 0.2;
    transform: scale(1.2);
  }
}

/* Основний контейнер гри */
.container {
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 1rem;
  box-sizing: border-box;
  z-index: 1;
}

header {
  text-align: center;
  margin-bottom: 1rem;
  width: 100%;
}

h1 {
  margin: 0.5rem 0;
  font-size: 1.6rem;
  font-weight: 700;
  color: #ffd27f;
}

#instructions {
  margin: 0.3rem 0 1rem;
  font-size: 1rem;
  color: #f5e6c6;
}

/* Смуга щита (прогрес) */
.shield-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.shield-bar {
  position: relative;
  width: 200px;
  height: 12px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  overflow: hidden;
}

.shield-fill {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #7bc67b 0%, #4e8f4e 100%);
  transition: width 0.4s ease;
}

.shield-text {
  font-size: 1rem;
  color: #f5e6c6;
  min-width: 40px;
  text-align: left;
}

/* Дошка з парами слів */
.board {
  position: relative;
  width: 90%;
  max-width: 640px;
  margin: 0 auto;
  padding: 1.5rem 1rem;
  background: rgba(0, 0, 0, 0.4);
  border-radius: 1rem;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  justify-content: center;
  gap: 0.8rem;
  min-height: 220px;
}

/* Карти-пари */
.pair-card {
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.9);
  color: #2e2e2e;
  padding: 0.5rem 1rem;
  border-radius: 0.4rem;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.1s ease;
  border: none;
  white-space: nowrap;
  user-select: none;
  /* Розміщення в дві колонки на мобільних */
  flex: 0 1 calc(50% - 0.8rem);
}

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

.pair-card.correct {
  background: linear-gradient(90deg, #7bc67b 0%, #4e8f4e 100%);
  color: #f5f5f5;
}

.pair-card.incorrect {
  background: linear-gradient(90deg, #da5c5c 0%, #9b2d2d 100%);
  color: #fff;
}

/* Пояснення під дошкою */
.explanation {
  margin-top: 1rem;
  font-size: 1rem;
  color: #f5e6c6;
  background: rgba(0, 0, 0, 0.5);
  padding: 0.6rem 1rem;
  border-radius: 0.5rem;
  max-width: 640px;
  margin-left: auto;
  margin-right: auto;
}

/* Вибір відповіді */
.answer-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.55);
  z-index: 6;
}

.answer-box {
  background: rgba(0, 0, 0, 0.75);
  padding: 1.5rem;
  border-radius: 1rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.6);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  max-width: 340px;
  width: 90%;
}

#current-pair {
  font-size: 1.4rem;
  font-weight: 700;
  color: #ffd27f;
  margin: 0;
}

.options {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  width: 100%;
}

/* Кнопки варіантів відповіді */
.option-btn {
  flex: 1;
}

/* Загальний прогрес на фінальному екрані */
.general-progress {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 1rem;
}

.general-progress-bar {
  position: relative;
  width: 180px;
  height: 8px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  overflow: hidden;
}

.general-progress-fill {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #f7c84d 0%, #a07c4a 100%);
  transition: width 0.4s ease;
}

.general-progress-text {
  font-size: 0.9rem;
  color: #f5e6c6;
}

/* Адаптація для мобільних пристроїв */
@media (max-width: 480px) {
  .start-title,
  .finish-title {
    font-size: 1.4rem;
  }
  h1 {
    font-size: 1.4rem;
  }
  .shield-bar {
    width: 180px;
  }
  .board {
    padding: 1rem;
    gap: 0.6rem;
  }
  .pair-card {
    font-size: 0.95rem;
    padding: 0.45rem 0.8rem;
    flex: 0 1 calc(50% - 0.6rem);
    text-align: center;
  }
  .answer-box {
    padding: 1rem;
  }
  #current-pair {
    font-size: 1.2rem;
  }
  .options {
    gap: 0.4rem;
  }
}