/* ===== CSS Custom Properties (из PSD VALUEV01) ===== */
:root {
  /* Цвета из слоёв PSD */
  --color-yes: #52D612;
  --color-no: #EA2424;
  --color-btn: #3FE020;
  --color-btn-hover: #2BBF12;
  --color-gold: #E5AD66;
  --color-gold-light: #D0B299;
  --color-gold-dark: #7A5C3A;
  --color-panel-bg: #27221B;
  --color-text: #FFFFFF;
  --color-text-dark: #15110E;
  --color-card-bg: #FFFFFF;
  --color-card-border: #D0B299;
  --color-correct: #52D612;
  --color-wrong: #EA2424;
  --color-missed: #FFD54F;
  --color-skipped: rgba(255, 255, 255, 0.3);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: "DIN Pro", "Arial Black", "Impact", sans-serif;
  background: #15110E url("/BG7.png") center / cover no-repeat fixed;
  color: var(--color-text);
  min-height: 100vh;
  overflow: hidden;
  /* Запрещаем выделение текста при перетаскивании */
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  /* Запрещаем контекстное меню на долгый тап (мобильные) */
  -webkit-touch-callout: none;
}

/* Safari-specific: предотвращаем bounce-скролл */
.game-container {
  position: relative;
  width: 100%;
  height: 100vh;
  max-width: 1920px;
  max-height: 1080px;
  margin: 0 auto;
  overflow: hidden;
  -webkit-overflow-scrolling: auto; /* Отключаем惯性 скролл в iOS */
}

/* Safari: предотвращаем zoom по двойному тапу */
@media screen and (max-width: 1024px) {
  html, body {
    overscroll-behavior: none;
  }

  .image-card {
    -webkit-tap-highlight-color: transparent;
  }
}

/* ===== Главный контейнер ===== */
.game-container {
  position: relative;
  width: 100%;
  height: 100vh;
  max-width: 1920px;
  max-height: 1080px;
  margin: 0 auto;
  overflow: visible;
}

/* ===== Заголовок "КТО БЫЛ ВЕДУЩИМ?" ===== */
.question {
  position: absolute;
  top: 40px;
  left: 50%;
  transform: translateX(-50%);
  font-family: "DIN Pro Condensed", "DIN Pro", "Arial Black", "Impact", sans-serif;
  font-size: 50px;
  font-weight: 900;
  text-transform: uppercase;
  color: var(--color-text);
  text-shadow:
    0 2px 8px rgba(0, 0, 0, 0.7),
    0 0 20px rgba(0, 0, 0, 0.5);
  letter-spacing: 2px;
  white-space: nowrap;
  z-index: 10;
}

/* ===== Зона ДА (левый верхний угол) ===== */
.zone-yes {
  position: absolute;
  top: 40px;
  left: 55px;
  width: 400px;
  height: calc(100vh - 40px);
  display: flex;
  flex-direction: column;
  align-items: center;
  z-index: 10;
  border: none;
  border-radius: 0;
  background: rgba(82, 214, 18, 0.1);
  transition: background 0.2s, border-color 0.2s;
}

.zone-yes .zone-label {
  display: block;
  width: 100%;
  text-align: center;
  padding: 0;
  line-height: 70px;
  /* background: var(--color-yes); */
  color: var(--color-yes);
  font-family: "DIN Pro Condensed", "DIN Pro", "Arial Black", "Impact", sans-serif;
  font-size: 50px;
  font-weight: 900;
  text-transform: uppercase;
  border-radius: 0;
}

/* ===== Зона НЕТ (правый верхний угол) ===== */
.zone-no {
  position: absolute;
  top: 40px;
  right: 55px;
  width: 400px;
  height: calc(100vh - 40px);
  display: flex;
  flex-direction: column;
  align-items: center;
  z-index: 10;
  border: none;
  border-radius: 0;
  background: rgba(234, 36, 36, 0.1);
  transition: background 0.2s, border-color 0.2s;
}

.zone-no .zone-label {
  display: block;
  width: 100%;
  text-align: center;
  padding: 0;
  line-height: 70px;
  /* background: var(--color-no); */
  color: var(--color-no);
  font-family: "DIN Pro Condensed", "DIN Pro", "Arial Black", "Impact", sans-serif;
  font-size: 50px;
  font-weight: 900;
  text-transform: uppercase;
  border-radius: 0;
}

/* ===== Центральная панель ===== */
.center-panel {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 5;
}

.panel-frame {
  display: flex;
  padding: 16px;
  /* background: linear-gradient(
    135deg,
    var(--color-gold) 0%,
    var(--color-gold-light) 30%,
    var(--color-gold-dark) 60%,
    var(--color-gold) 100%
  );
  border-radius: 16px;
  box-shadow:
    0 0 30px rgba(229, 173, 102, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
  border: 2px solid var(--color-gold); */
}

.panel-header {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  padding: 8px 0 12px;
  font-size: 18px;
  font-weight: 700;
  color: var(--color-text);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

.counter-label {
  text-transform: uppercase;
  letter-spacing: 1px;
}

.counter-value {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  background: var(--color-panel-bg);
  color: var(--color-gold);
  font-size: 22px;
  font-weight: 900;
  border-radius: 50%;
  padding: 0 8px;
}

/* ===== Зона пула (центральная, для перетаскивания) ===== */
.drop-zone-pool {
  flex: 1;
  min-width: 520px;
  min-height: 382px;
  /* background: var(--color-panel-bg); */
  border-radius: 10px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  /* border: 2px solid rgba(229, 173, 102, 0.3); */
  /* Предотвращаем скролл при перетаскивании внутри пула */
  touch-action: none;
}

/* ===== Сетка изображений ===== */
.images-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  align-content: center;
}

/* ===== Карточка изображения ===== */
.image-card {
  width: 450px;
  background: var(--color-card-bg);
  border: 3px solid var(--color-card-border);
  border-radius: 10px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  overflow: hidden;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  /* Критично для touch-перетаскивания: запрещаем браузерный скролл/зум */
  touch-action: none;
  transition: transform 0.15s ease, border-color 0.15s ease, opacity 0.15s ease, box-shadow 0.15s ease;
}

.image-card:hover {
  transform: translateY(-4px) scale(1.02);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
}

.image-card.dragging {
  cursor: grabbing;
  opacity: 0.85;
  transform: scale(1.08) !important;
  z-index: 1000;
}

/* Карточка, «оторванная» пальцем от сетки (touch-перетаскивание) */
.image-card.touch-dragging {
  position: fixed;
  z-index: 10000;
  margin: 0;
  pointer-events: none;
  transform: scale(1.08);
  opacity: 0.9;
  cursor: grabbing;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5);
  transition: none;
}

.image-card.touch-dragging img {
  width: 100%;
  object-fit: cover;
}

.image-card img {
  display: block;
  width: 100%;
  height: 450px;
  object-fit: cover;
  pointer-events: none;
}

.image-caption {
  display: block;
  padding: 8px 10px;
  font-family: "DIN Pro", "Arial Black", "Impact", sans-serif;
  font-size: 13px;
  font-weight: 500;
  text-align: center;
  min-height: 2em;
  color: var(--color-text-dark);
  background: #F5F0E8;
}

/* ===== Подсветка зон при перетаскивании ===== */
.drop-zone-hover {
  background: rgba(229, 173, 102, 0.15) !important;
  border-color: var(--color-gold) !important;
}

/* Анимация пульсации для зон при drag */
.drop-zone-hover.zone-yes {
  background: rgba(82, 214, 18, 0.2) !important;
  border-color: var(--color-yes) !important;
  box-shadow: 0 0 20px rgba(82, 214, 18, 0.3);
}

.drop-zone-hover.zone-no {
  background: rgba(234, 36, 36, 0.2) !important;
  border-color: var(--color-no) !important;
  box-shadow: 0 0 20px rgba(234, 36, 36, 0.3);
}

/* Анимация появления карточек */
@keyframes cardAppear {
  from {
    opacity: 0;
    transform: scale(0.8);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.image-card {
  animation: cardAppear 0.2s ease;
}

/* Скрываем drag-призрак на мобильных */
@media (pointer: coarse) {
  .image-card {
    cursor: grab;
  }

  .image-card:active {
    cursor: grabbing;
  }
}

/* ===== Подсказки в зонах ===== */
.drop-hint {
  color: rgba(255, 255, 255, 0.5);
  font-size: 12px;
  text-align: center;
  padding: 8px 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ===== Карточки в зонах ДА/НЕТ (2 столбца) ===== */
.zone-yes .images-grid,
.zone-no .images-grid {
  display: grid;
  /* 2 столбца по ширине карточки (150px картинка + 2*3px рамки) */
  grid-template-columns: repeat(2, 180px);
  gap: 6px;
  width: 100%;
  align-content: start;
  justify-content: center;
  flex: 1;
}

.zone-yes .image-card,
.zone-no .image-card {
  width: 180px;
}

.zone-yes .image-card img,
.zone-no .image-card img {
  width: 174px;
  height: 174px;
}

.zone-yes .image-caption,
.zone-no .image-caption {
  font-size: 9px;
  padding: 4px 4px;
}

/* ===== Скрытые карточки в пуле ===== */
.drop-zone-pool .images-grid .image-card[hidden] {
  display: none;
}

/* ===== Сообщение "Все картинки разложены" ===== */
/* .pool-done {
  margin-top: 16px;
  text-align: center;
  font-size: 16px;
  font-weight: 700;
  color: var(--color-gold);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.pool-done[hidden] {
  display: none;
} */

/* ===== Результаты после "УЗНАТЬ ОТВЕТ" ===== */
.card-correct {
  border-color: var(--color-correct) !important;
  box-shadow: 0 0 12px rgba(82, 214, 18, 0.6) !important;
}

.card-wrong {
  border-color: var(--color-wrong) !important;
  box-shadow: 0 0 12px rgba(234, 36, 36, 0.6) !important;
  opacity: 0.85;
}

.card-missed {
  border-color: var(--color-missed) !important;
  box-shadow: 0 0 12px rgba(255, 213, 79, 0.6) !important;
}

.card-skipped {
  opacity: 0.4;
}

/* ===== Кнопка "УЗНАТЬ ОТВЕТ" ===== */
.answer-section {
  position: absolute;
  bottom: 50px;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  z-index: 10;
}

.btn-answer {
  display: block;
  width: 400px;
  padding: 18px 40px;
  background: var(--color-btn);
  color: var(--color-text-dark);
  border: none;
  border-radius: 12px;
  font-family: "DIN Pro Condensed", "DIN Pro", "Arial Black", "Impact", sans-serif;
  font-size: 28px;
  font-weight: 900;
  letter-spacing: 3px;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow:
    0 4px 15px rgba(63, 224, 32, 0.4),
    inset 0 2px 0 rgba(255, 255, 255, 0.3);
  transition: background 0.2s, transform 0.1s, box-shadow 0.2s;
}

.btn-answer:hover {
  background: var(--color-btn-hover);
  box-shadow:
    0 6px 20px rgba(63, 224, 32, 0.5),
    inset 0 2px 0 rgba(255, 255, 255, 0.3);
}

.btn-answer:active {
  transform: translateY(2px);
  box-shadow: 0 2px 8px rgba(63, 224, 32, 0.3);
}

.btn-answer:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

.btn-answer:disabled:hover {
  background: var(--color-btn);
  box-shadow: none;
}

/* ===== Сводка ответов ===== */
.answer-summary {
  margin-top: 12px;
  font-size: 18px;
  font-weight: 700;
  color: var(--color-gold);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
  display: none;
}

/* ===== Адаптивность ===== */
@media (max-width: 768px) {
  .question {
    font-size: 24px;
    top: 20px;
  }

  .zone-yes,
  .zone-no {
    position: relative;
    top: auto;
    left: auto;
    right: auto;
    width: 100%;
    height: auto;
    min-height: 80px;
    margin-bottom: 8px;
  }

  .zone-yes .zone-label,
  .zone-no .zone-label {
    line-height: normal;
    padding: 8px 0;
  }

  .center-panel {
    position: relative;
    top: auto;
    left: auto;
    transform: none;
    margin: 0 16px;
  }

  .drop-zone-pool {
    min-width: unset;
    min-height: 200px;
    padding: 12px;
  }

  .image-card {
    width: 150px;
  }

  .image-card img {
    height: 120px;
  }

  .btn-answer {
    width: 280px;
    font-size: 20px;
    padding: 14px 24px;
  }

  .answer-section {
    position: relative;
    bottom: auto;
    left: auto;
    transform: none;
    margin-top: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  .game-container {
    height: auto;
    max-height: none;
    padding-bottom: 40px;
    overflow: visible;
    display: flex;
    flex-direction: column;
    align-items: center;
  }
}

