/* Duel : adversaire en ligne, choix d'amélioration de l'écran scindé, commandes tactiles à deux,
   écran du vainqueur */

body.versus #controls {
  display: none !important;
}

/* --- En ligne : partie de l'adversaire, sous le minuteur de vague --- */
.duel-rival {
  display: none;
  position: absolute;
  top: calc(70px + env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  width: min(240px, calc(100% - 24px));
  padding: 6px 10px;
  border-radius: 10px;
  border: 1px solid #ff2a6d;
  background: rgba(10, 5, 20, 0.8);
  color: #ff2a6d;
  font-family: "Orbitron", sans-serif;
  font-size: 11px;
  text-align: center;
  z-index: 10;
  pointer-events: none;
}
.duel-rival b {
  display: block;
  font-size: 12px;
  letter-spacing: 1px;
}
.rival-info {
  display: block;
  margin: 2px 0 4px;
  color: #ddd;
  font-size: 10px;
}
.vs-bar {
  height: 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.12);
}
.vs-fill {
  height: 100%;
  width: 100%;
  border-radius: 3px;
  background: currentColor;
  box-shadow: 0 0 8px currentColor;
}

/* --- Écran scindé : choix d'amélioration dans la moitié d'écran du joueur --- */
#duelPicks {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 30; /* au-dessus des zones tactiles, sous les menus */
}
.duel-pick {
  display: none;
  position: absolute;
  top: 0;
  bottom: 0;
  width: 50%;
  left: 0;
  padding: 12px;
  background: rgba(5, 0, 15, 0.82);
  font-family: "Orbitron", sans-serif;
  text-align: center;
  pointer-events: auto;
  overflow-y: auto;
}
.duel-pick2 {
  left: 50%;
}
@media (orientation: portrait) {
  .duel-pick {
    width: 100%;
    height: 50%;
    top: 50%;
  }
  .duel-pick2 {
    left: 0;
    top: 0;
  }
}
.dp-title {
  display: block;
  margin-top: 8px;
  font-size: 16px;
  letter-spacing: 2px;
}
.dp-sub {
  display: block;
  margin: 4px 0 10px;
  color: #bbb;
  font-size: 11px;
}
.dp-cards {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 360px;
  margin: 0 auto;
}
.dp-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 2px solid #555;
  border-radius: 10px;
  background: rgba(20, 10, 40, 0.9);
  text-align: left;
  cursor: pointer;
}
.dp-card.selected {
  background: rgba(170, 102, 255, 0.25);
  box-shadow: 0 0 14px rgba(170, 102, 255, 0.6);
}
.dp-card .icon {
  flex: none;
  font-size: 26px;
}
.dp-info h4 {
  margin: 0 0 2px;
  color: #fff;
  font-size: 12px;
}
.dp-info p {
  margin: 0;
  color: #bbb;
  font-size: 10px;
  line-height: 1.3;
}
@media (max-height: 500px) {
  .dp-info p {
    display: none;
  }
}

/* Temps restant pour choisir (duel) */
.pick-timer {
  height: 4px;
  max-width: 360px;
  margin: 10px auto 0;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.12);
}
.pick-timer div {
  height: 100%;
  width: 100%;
  border-radius: 2px;
  background: #ffd700;
}
#upgradeTimer {
  display: none;
  margin: 0 auto 12px;
}

/* --- Écran du vainqueur --- */
.versus-table {
  margin: 0 auto 14px;
  border-collapse: collapse;
  font-family: "Orbitron", sans-serif;
  font-size: 12px;
}
.versus-table th,
.versus-table td {
  padding: 4px 12px;
  text-align: right;
}
.versus-table td:first-child {
  color: #999;
  text-align: left;
}
.versus-table th.winner::after {
  content: " ★";
  color: #ffd700;
}

/* --- Écran « Duel » : sur cet écran ou en ligne --- */
#duelMenu {
  border-color: #aa66ff;
  max-width: 460px;
}
#duelMenu .menu-sub {
  margin-bottom: 14px;
}
.duel-online {
  margin: 16px 0;
  padding: 14px;
  border: 1px solid rgba(170, 102, 255, 0.45);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.3);
}
.duel-online h3 {
  margin: 0 0 10px;
  font-size: 14px;
  letter-spacing: 2px;
  color: #aa66ff;
}
.duel-join {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}
.duel-join input {
  flex: 1;
  min-width: 0;
  padding: 10px;
  border-radius: 8px;
  border: 1px solid #555;
  background: rgba(0, 0, 0, 0.5);
  color: #fff;
  font-family: "Press Start 2P", monospace;
  font-size: 16px;
  text-align: center;
  letter-spacing: 6px;
  text-transform: uppercase;
}
.duel-join button {
  width: auto;
  margin: 0;
}
.duel-code {
  margin: 12px 0 0;
  font-family: "Press Start 2P", monospace;
  font-size: 30px;
  letter-spacing: 8px;
  color: #ffd700;
  text-shadow: 0 0 12px #ffd700;
}
.duel-code:empty {
  display: none;
}
.duel-status {
  min-height: 1.2em;
  margin: 10px 0 0;
  font-size: 12px;
  color: #ccc;
}

#versusOver h1 {
  font-size: clamp(24px, 6vw, 44px);
  text-shadow: 0 0 18px currentColor;
}

/* --- Tactile : une moitié d'écran par joueur (gauche / droite, ou bas / haut en portrait) --- */
#versusTouch {
  display: none;
  position: absolute;
  inset: 0;
  z-index: 20;
  pointer-events: none;
}
.vs-zone {
  position: absolute;
  pointer-events: auto;
  touch-action: none;
  left: 0;
  top: 0;
  width: 50%;
  height: 100%;
}
.vs-zone2 {
  left: 50%;
}
@media (orientation: portrait) {
  .vs-zone {
    width: 100%;
    height: 50%;
  }
  .vs-zone1 {
    top: 50%;
  }
  .vs-zone2 {
    left: 0;
    top: 0;
  }
}
.vs-stick {
  display: none;
  position: absolute;
  width: 110px;
  height: 110px;
  margin: -55px 0 0 -55px;
  border-radius: 50%;
  border: 2px solid currentColor;
  background: rgba(255, 255, 255, 0.06);
  pointer-events: none;
}
.vs-stick.active {
  display: block;
}
.vs-stick div {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 50px;
  height: 50px;
  margin: -25px 0 0 -25px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.6;
  box-shadow: 0 0 15px currentColor;
}
.vs-stick1 {
  color: #00ffff;
}
.vs-stick2 {
  color: #ff2a6d;
}
#versusTouch .vs-skill {
  background: rgba(20, 10, 40, 0.75);
  color: #aaa;
}
.vs-skill {
  pointer-events: auto;
  position: absolute;
  bottom: calc(14px + env(safe-area-inset-bottom));
  left: 14px;
  width: 52px;
  height: 52px;
  font-size: 22px;
  opacity: 0.5;
}
.vs-skill.ready {
  opacity: 1;
  color: #ffaa00;
  box-shadow: 0 0 14px #ffaa00;
}
.vs-skill2 {
  left: auto;
  right: 14px;
}
@media (orientation: portrait) {
  .vs-skill2 {
    bottom: calc(50% + 14px); /* bas de la moitié du haut */
  }
}
#versusTouch .touch-pause {
  pointer-events: auto;
  right: auto;
  left: 50%;
  margin-left: -22px;
  top: auto;
  bottom: calc(12px + env(safe-area-inset-bottom));
}
@media (orientation: portrait) {
  .vs-skill {
    pointer-events: auto;
    position: absolute;
    bottom: calc(14px + env(safe-area-inset-bottom));
    left: 14px;
    width: 52px;
    height: 52px;
    font-size: 22px;
    opacity: 0.5;
  }
  .vs-skill.ready {
    opacity: 1;
    color: #ffaa00;
    box-shadow: 0 0 14px #ffaa00;
  }
  .vs-skill2 {
    left: auto;
    right: 14px;
  }
  @media (orientation: portrait) {
    .vs-skill2 {
      bottom: auto;
      top: calc(14px + env(safe-area-inset-top));
    }
  }
  #versusTouch .touch-pause {
    bottom: auto;
    top: 50%;
    margin-top: -22px;
  }
}
