/* ===== SÉLECTION DE MODE + VUES MODE ===== */

.battle-mode-overlay,
.battle-mode-view-overlay {
  position: fixed;
  inset: 0;
  z-index: 270;
  background: rgba(0, 0, 0, 0.88);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.battle-mode-overlay.visible,
.battle-mode-view-overlay.visible {
  display: flex;
}

/* --- Popup modes (4 boutons) --- */
.battle-mode-box {
  background: #1a1510;
  border: 1px solid #555;
  border-radius: 14px;
  padding: 28px 32px 24px;
  width: min(1100px, 94vw);
  max-height: min(90vh, 920px);
  overflow-y: auto;
  text-align: center;
  color: #eee;
}
.battle-mode-title {
  font-size: 26px;
  color: #f0d78c;
  letter-spacing: 2px;
  margin-bottom: 24px;
}
.battle-mode-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
  margin-bottom: 22px;
}
@media (max-width: 900px) {
  .battle-mode-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.battle-mode-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  background: #2a2218;
  border: 1px solid #c9a227;
  border-radius: 12px;
  padding: 12px 10px 14px;
  cursor: pointer;
  color: #f0d78c;
  font-family: Georgia, serif;
  font-size: 15px;
  transition: background 0.15s, border-color 0.15s, transform 0.12s;
}
.battle-mode-btn:hover {
  background: #3a3218;
  border-color: #e8c84a;
  transform: translateY(-2px);
}
.battle-mode-btn img {
  width: 100%;
  max-width: 220px;
  height: auto;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border-radius: 8px;
  display: block;
  box-shadow: 0 6px 18px #000;
}

.battle-mode-prev {
  display: inline-block;
  margin: 8px auto 0;
  padding: 10px 28px;
  background: transparent;
  border: 1px solid #555;
  color: #ccc;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-family: Georgia, serif;
}
.battle-mode-prev:hover {
  border-color: #888;
  color: #fff;
}

/* --- Vue mode (fond + contenu) --- */
.battle-mode-view-box {
  position: relative;
  width: min(1200px, 96vw);
  height: min(85vh, 900px);
  border-radius: 14px;
  border: 1px solid #555;
  overflow: hidden;
  background: #111;
}
.battle-mode-view-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  opacity: 0.55;
  z-index: 0;
}
.battle-mode-view-content {
  position: relative;
  z-index: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px 28px 20px;
  box-sizing: border-box;
}
.battle-mode-view-title {
  font-size: 28px;
  color: #f0d78c;
  letter-spacing: 2px;
  margin-bottom: 18px;
  text-shadow: 0 2px 8px #000;
}
.battle-mode-view-body {
  flex: 1;
  width: 100%;
  max-width: 520px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.battle-mode-placeholder {
  color: #aaa;
  font-size: 16px;
  text-align: center;
  line-height: 1.5;
  text-shadow: 0 1px 4px #000;
}

/* Formulaire entraînement */
.battle-training-form {
  width: 100%;
  background: rgba(20, 16, 12, 0.88);
  border: 1px solid #555;
  border-radius: 12px;
  padding: 24px 28px;
  text-align: left;
  margin-top: 400px; /* augmente pour descendre */
}
.battle-training-form label {
  display: block;
  color: #aaa;
  font-size: 13px;
  margin-bottom: 14px;
}
.battle-training-form select {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 10px 12px;
  background: #2a2a2a;
  border: 1px solid #555;
  color: #eee;
  border-radius: 6px;
  font-size: 15px;
}
.battle-training-start {
  display: block;
  width: 100%;
  margin-top: 8px;
  padding: 14px;
  background: #2a2218;
  border: 1px solid #c9a227;
  color: #f0d78c;
  border-radius: 8px;
  cursor: pointer;
  font-size: 16px;
  font-family: Georgia, serif;
}
.battle-training-start:hover:not(:disabled) {
  background: #3a3218;
  border-color: #e8c84a;
}
.battle-training-start:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}


/* Modes verrouillés */
.battle-mode-btn.is-locked {
  cursor: not-allowed;
  opacity: 0.75;
}
.battle-mode-btn.is-locked:hover {
  background: #2a2218;
  border-color: #c9a227;
  transform: none;
}
.battle-mode-btn-art {
  position: relative;
  width: 100%;
  max-width: 220px;
}
.battle-mode-btn-art img {
  width: 100%;
  max-width: 220px;
  height: auto;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border-radius: 8px;
  display: block;
  box-shadow: 0 6px 18px #000;
}
.battle-mode-btn.is-locked .battle-mode-btn-art img {
  filter: grayscale(0.55) brightness(0.7);
}
.battle-mode-lock {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: rgba(0, 0, 0, 0.55);
  border-radius: 8px;
  opacity: 0;
  transition: opacity 0.15s ease;
  pointer-events: none;
}
.battle-mode-btn.is-locked:hover .battle-mode-lock,
.battle-mode-btn.is-locked:focus .battle-mode-lock {
  opacity: 1;
}
.battle-mode-lock-icon {
  font-size: 36px;
  line-height: 1;
  filter: drop-shadow(0 2px 4px #000);
}
.battle-mode-lock-text {
  font-size: 14px;
  font-weight: bold;
  color: #f0d78c;
  letter-spacing: 0.5px;
  text-shadow: 0 1px 4px #000;
}

/* ===== MODE DÉFIS ===== */
.battle-mode-view-body.is-challenges {
  max-width: none;
  width: 100%;
  height: 100%;
  justify-content: stretch;
  align-items: stretch;
  overflow: hidden;
}

.chal-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 16px;
  width: 100%;
  height: 100%;
  min-height: 0;
}

/* Liste missions */
.chal-list {
  overflow-y: auto;
  background: rgba(12, 10, 8, 0.82);
  border: 1px solid #444;
  border-radius: 10px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.chal-list-item {
  display: grid;
  grid-template-columns: 32px 1fr 20px;
  gap: 8px;
  align-items: center;
  text-align: left;
  padding: 10px 8px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  color: #ddd;
  cursor: pointer;
  font-family: Georgia, serif;
  font-size: 13px;
}
.chal-list-item:hover {
  background: rgba(201, 162, 39, 0.12);
  border-color: #555;
}
.chal-list-item.is-active {
  background: rgba(201, 162, 39, 0.22);
  border-color: #c9a227;
  color: #f0d78c;
}
.chal-list-num {
  color: #888;
  font-size: 12px;
}
.chal-list-item.is-active .chal-list-num {
  color: #c9a227;
}
.chal-list-texts {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.chal-list-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chal-list-short {
  font-size: 11px;
  color: #888;
}
.chal-list-status {
  color: #2ecc71;
  font-weight: bold;
  text-align: center;
}

/* Détail */
.chal-detail {
  min-height: 0;
  overflow-y: auto;
  background: rgba(12, 10, 8, 0.72);
  border: 1px solid #444;
  border-radius: 10px;
  padding: 16px 18px;
}
.chal-detail-empty {
  color: #888;
  text-align: center;
  margin-top: 40px;
}
.chal-detail-inner {
  display: flex;
  flex-direction: column;
  gap: 14px;
  height: 100%;
  min-height: 0;
}
.chal-title {
  margin: 0;
  color: #f0d78c;
  font-size: 24px;
  letter-spacing: 1px;
}

/* Image 2/3 + objectifs 1/3 */
.chal-hero {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 10px;
  align-items: stretch;
  flex-shrink: 0;
}
.chal-illu {
  width: 100%;
  aspect-ratio: 16 / 9;
  height: auto;
  border-radius: 8px;
  background: #111 center/contain no-repeat;
  border: 1px solid #555;
  box-shadow: 0 6px 16px #000;
}
.chal-objectives {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0;
  min-width: 0;
}
.chal-obj {
  position: relative;
  flex: 1;
  min-height: 0;
  padding: 10px 10px;
  background: rgba(30, 26, 20, 0.9);
  border: 2px solid #555;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: help;
  color: #ddd;
  font-size: 16px;
}
.chal-obj.is-done {
  border-color: #c9a227;
  color: #e8d08a;
  background: rgba(40, 32, 16, 0.55);
  box-shadow: 0 0 0 1px rgba(201, 162, 39, 0.25);
}
.chal-obj-mark {
  font-size: 26px;
  font-weight: bold;
  line-height: 1;
}
.chal-obj-label {
  line-height: 1.2;
  font-size: 16px;
  text-align: center;
}
.chal-obj[data-tip]::after {
  content: attr(data-tip);
  position: absolute;
  right: calc(100% + 8px);
  top: 50%;
  transform: translateY(-50%);
  background: #1a1510;
  border: 1px solid #c9a227;
  color: #eee;
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 12px;
  width: max-content;
  max-width: 240px;
  white-space: normal;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s;
  z-index: 5;
  box-shadow: 0 4px 12px #000;
}
.chal-obj:hover[data-tip]::after {
  opacity: 1;
}

.chal-desc {
  margin: 0;
  color: #ccc;
  font-size: 13px;
  line-height: 1.45;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
}

/* Bas : deck | démarrer | statut */
.chal-footer {
  margin-top: auto;
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 12px;
  align-items: end;
}
.chal-deck-label {
  display: block;
  color: #aaa;
  font-size: 13px;
  margin: 0;
}
.chal-deck-label select {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 10px 12px;
  background: #2a2a2a;
  border: 1px solid #555;
  color: #eee;
  border-radius: 6px;
  font-size: 14px;
}
.chal-start {
  padding: 12px 28px;
  background: #2a2218;
  border: 1px solid #c9a227;
  color: #f0d78c;
  border-radius: 8px;
  cursor: pointer;
  font-size: 15px;
  font-family: Georgia, serif;
  white-space: nowrap;
  height: 42px;
}
.chal-start:hover:not(:disabled) {
  background: #3a3218;
  border-color: #e8c84a;
}
.chal-start:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.chal-cleared {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  border: 1px solid #555;
  background: rgba(30, 26, 20, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #666;
  font-size: 20px;
  font-weight: bold;
}
.chal-cleared.is-cleared {
  border-color: #2ecc71;
  color: #2ecc71;
}

@media (max-width: 900px) {
  .chal-layout {
    grid-template-columns: 1fr;
  }
  .chal-hero {
    grid-template-columns: 1fr;
    max-height: none;
  }
  .chal-objectives {
    flex-direction: row;
  }
  .chal-footer {
    grid-template-columns: 1fr;
  }
  .chal-obj[data-tip]::after {
    right: auto;
    left: 50%;
    top: auto;
    bottom: calc(100% + 8px);
    transform: translateX(-50%);
  }
}

.chal-obj { cursor: default; text-align: center; }
.chal-obj.is-ready {
  cursor: pointer;
  border-color: #2ecc71;
  color: #2ecc71;
  background: rgba(20, 50, 28, 0.55);
  box-shadow: 0 0 0 2px rgba(46, 204, 113, 0.7), 0 0 14px rgba(46, 204, 113, 0.35);
}
.chal-obj.is-claimed {
  opacity: 1;
  cursor: default;
  border-color: #c9a227;
  color: #e8d08a;
  background: rgba(40, 32, 16, 0.55);
  box-shadow: 0 0 0 1px rgba(201, 162, 39, 0.25);
}
.chal-obj.is-claimed .chal-obj-mark { color: #c9a227; }
.chal-list-item.is-locked { opacity: 0.45; cursor: not-allowed; }