/* --- Mastermind Modal (поверх всех) --- */
.mastermind-modal {
  position: fixed;
  z-index: 12010 !important;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  pointer-events: auto;
  background: none !important;
}

.mastermind-bg {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: url('/static/images/games/mastermind/mmbg.webp') center center/cover no-repeat;
  opacity: 1;
  pointer-events: none;
  filter: brightness(0.4); /* от 0.3 (очень темно) до 0.7 (легкое затемнение) */
}


/* Главное окно: всё выравнено по центру, padding убран */
.mastermind-content {
  position: relative;
  z-index: 2;
  background: transparent !important;
  border-radius: 14px;
  min-width: 325px;
  max-width: 90vw;
  width: 90%;
  max-height: 95vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0; /* убран, всё через маргины у детей */
  color: #fff;
  box-sizing: border-box;
}


/* Заголовок — строго по центру, не сливается с крестиком */
.mastermind-content .modal-header {
  margin-top: 24px;
  margin-bottom: 22px;
  text-align: center;
  font-size: 22px;
  color: #fff;
  font-family: inherit;
  background: none;
  letter-spacing: 0.01em;
  font-weight: 700;
  line-height: 1.1;
  z-index: 2;
}

/* Основной контент */
.mastermind-content .mastermind-main {
  width: 100%;
  margin-top: 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  z-index: 2;
}

/* Сетка для ячеек-кода */
.mastermind-modal .equipment {
  display: flex;
  flex-wrap: nowrap;
  gap: 10px;
  justify-content: center;
  margin-bottom: 20px;
  margin-top: 5px;
}
.mastermind-modal .slot,
.mastermind-modal .inventory-item {
  width: 50px;
  height: 50px;
  border: 2px dashed #777;
  border-radius: 5px;
  background: #444;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  overflow: hidden;
  position: relative;
  transition: border-color .2s, box-shadow .2s;
}

#mastermindModal .slot img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

/* selected */
.mastermind-modal .slot.selected {
  border-color: #ffe67a !important;
  box-shadow: 0 0 0 2px #ffe67a77;
}
.mastermind-modal .slot.double-selected {
  border-color: #ffe67a !important;
  box-shadow: 0 0 0 3px #ffe67acc, 0 0 16px 6px #ffe67a77 !important;
  transition: box-shadow .18s, border-color .18s;
  animation: none !important;
}

/* Плитки */
.mastermind-modal .inventory-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-bottom: 14px;
  margin-top: 8px;
  padding: 0;
}

/* Кнопка Проверить всегда по центру */
.mastermind-check-btn-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 120px;
  min-width: 120px;
  max-width: 120px;
  margin: 0 auto 10px auto;
}
.mastermind-check-btn {
  width: 120px;
  height: 54px;
  background: transparent;
  border-radius: 16px;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  box-shadow: none;
  transition: filter .16s;
}
.mastermind-check-btn img {
  width: 120px;
  height: 54px;
  object-fit: contain;
  display: block;
}
.mastermind-check-btn:active {
  filter: brightness(0.94);
}

/* Хинт */
.mastermind-hint {
  width: 100%;
  text-align: center;
  font-size: 15px;
  color: #ffe67a;
  margin-top: 10px;
  min-height: 22px;
}

/* --- Мобилка: крестик меньше, паддинги поуже --- */
@media (max-width: 480px) {
  .mastermind-content {
    min-width: 0;
    max-width: 100vw;
    width: 99vw;
    border-radius: 9px;
  }
  .mastermind-content .modal-close {
    top: 9px;
    right: 11px;
    width: 40px;
    height: 40px;
    background-size: 65%;
  }
  .mastermind-content .modal-header {
    font-size: 18px;
    margin-top: 15px;
    margin-bottom: 15px;
  }
}

