/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: none;
  border-radius: var(--radius);
  font-family: inherit;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 0.1s, opacity 0.1s, background 0.15s;
  min-height: 44px;
  padding: 0 20px;
  user-select: none;
}
.btn:active { transform: scale(0.96); }
.btn:disabled { opacity: 0.4; pointer-events: none; }

.btn-primary {
  background: var(--terracotta);
  color: #fff;
  box-shadow: 0 3px 10px rgba(231,111,81,0.4);
}
.btn-primary:hover { background: #d4634a; }

.btn-secondary {
  background: var(--amber);
  color: var(--brown);
  box-shadow: 0 2px 8px rgba(244,162,97,0.3);
}
.btn-secondary:hover { background: #e8924d; }

.btn-ghost {
  background: transparent;
  color: var(--brown-light);
  border: 2px solid var(--amber);
}
.btn-ghost:hover { background: rgba(244,162,97,0.1); }

.btn-sm { font-size: 0.85rem; min-height: 36px; padding: 0 12px; }
.btn-large { width: 100%; font-size: 1.1rem; min-height: 52px; border-radius: var(--radius-lg); }

/* ===== CARD BADGE ===== */
.player-name-badge {
  background: var(--gold);
  color: var(--brown);
  font-weight: 800;
  font-size: 1rem;
  border-radius: 999px;
  padding: 4px 14px;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: inline-block;
}

/* ===== MODE TOGGLE ===== */
.mode-toggle-bar {
  display: flex;
  gap: 6px;
  padding: 4px 0 6px;
}
.mode-btn {
  flex: 1;
  padding: 5px 0;
  border-radius: 8px;
  border: 2px solid transparent;
  background: rgba(255,255,255,0.15);
  color: var(--beige);
  font-family: inherit;
  font-size: 0.8rem;
  cursor: pointer;
  touch-action: manipulation;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.mode-btn.active {
  background: rgba(233,196,106,0.25);
  border-color: var(--gold);
  color: var(--gold);
  font-weight: 600;
}

/* ===== AI BADGE ===== */
.ai-badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.6rem;
  font-weight: 800;
  padding: 1px 5px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  flex-shrink: 0;
}
.ai-badge.novice     { background: #d4edda; color: #155724; }
.ai-badge.normal     { background: #cce5ff; color: #004085; }
.ai-badge.expert     { background: #fff3cd; color: #856404; }
.ai-badge.imbattable { background: #f8d7da; color: #721c24; }

/* ===== SETUP MODE TOGGLE ===== */
.setup-mode-toggle {
  display: flex;
  background: #ede3d6;
  border-radius: var(--radius);
  padding: 3px;
  gap: 3px;
}

.setup-mode-btn {
  flex: 1;
  padding: 10px 8px;
  border-radius: calc(var(--radius) - 3px);
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--brown-light);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
  touch-action: manipulation;
}

.setup-mode-btn.active {
  background: var(--white);
  color: var(--brown);
  box-shadow: 0 2px 6px rgba(61,43,31,0.12);
}

/* ===== PLAYER TYPE SECTION (draft mode) ===== */
.player-entry {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.player-type-section {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  padding-left: 40px; /* aligner avec l'input (après .player-avatar) */
}

.player-type-toggle {
  display: flex;
  background: #ede3d6;
  border-radius: 8px;
  padding: 2px;
  gap: 2px;
  flex-shrink: 0;
}

.player-type-btn {
  padding: 5px 10px;
  border-radius: 6px;
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--brown-light);
  cursor: pointer;
  touch-action: manipulation;
  transition: background 0.15s, color 0.15s;
}

.player-type-btn.active {
  background: var(--white);
  color: var(--brown);
  box-shadow: 0 1px 3px rgba(61,43,31,0.1);
}

.ai-difficulty-rating {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
}

.ai-difficulty-stars {
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(61, 43, 31, 0.07);
  border-radius: 10px;
  padding: 4px;
}

.ai-star {
  width: 40px;
  height: 40px;
  border: none;
  background: transparent;
  font-size: 1.25rem;
  cursor: pointer;
  padding: 0;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.3;
  transition: opacity 0.15s, background 0.15s, transform 0.15s, box-shadow 0.15s;
}

/* Couleurs par niveau */
.ai-star.novice.selected     { background: rgba(100, 170, 100, 0.18); box-shadow: 0 0 0 2px #64aa64; }
.ai-star.normal.selected     { background: rgba(244, 162, 97, 0.18);  box-shadow: 0 0 0 2px var(--amber); }
.ai-star.expert.selected     { background: rgba(210, 100, 30, 0.18);  box-shadow: 0 0 0 2px #d2641e; }
.ai-star.imbattable.selected { background: rgba(155, 40, 40, 0.18);   box-shadow: 0 0 0 2px #9b2828; }

.ai-star.selected {
  opacity: 1;
  transform: scale(1.08);
}

.ai-star:hover:not(.selected) {
  opacity: 0.6;
  background: rgba(61, 43, 31, 0.07);
}

.ai-star:active {
  transform: scale(0.88);
  transition-duration: 0.05s;
}

.ai-difficulty-header {
  font-size: 0.72rem;
  font-weight: 700;
  padding-left: 2px;
  transition: color 0.2s;
}

/* ===== DIALOG DE CONFIRMATION ===== */
.confirm-dialog {
  border: none;
  border-radius: 0;
  padding: 0;
  max-width: 320px;
  width: calc(100% - 40px);
  box-shadow: 0 8px 32px rgba(61,43,31,0.4);
  position: fixed;
  margin: 0;
  top: 0;
  left: 0;
}
.confirm-dialog--right {
  left: auto;
  right: 0;
}
.confirm-dialog::backdrop {
  background: rgba(20,10,5,0.65);
  backdrop-filter: blur(3px);
}
.confirm-dialog-inner {
  padding: 24px 20px 18px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.confirm-dialog-text {
  font-size: 0.95rem;
  color: var(--brown);
  line-height: 1.65;
}
.confirm-dialog-text strong {
  color: var(--terracotta);
}
.confirm-dialog-actions {
  display: flex;
  gap: 10px;
}
.confirm-dialog-actions .btn {
  flex: 1;
}

/* ============================================================
   DRAFT-OPPONENTS — joueur actuel + vue agrandie adversaire
   ============================================================ */

/* Outline amber sur la mini-grille du joueur actuel */
.draft-opponent--me .mini-grid {
  outline: 2px solid var(--amber);
  outline-offset: 2px;
  border-radius: 3px;
}
/* Flèche directionnelle entre les joueurs du draft */
.draft-pass-arrow {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--amber);
  font-size: 0.8rem;
  opacity: 0.75;
}
.draft-dir--left .draft-pass-arrow::before { content: '▶'; }
.draft-dir--right .draft-pass-arrow::before { content: '◀'; }
.draft-dir--two  .draft-pass-arrow::before { content: '▶'; }
/* Cursor pointer + hover uniquement sur les adversaires */
.draft-opponent:not(.draft-opponent--me) {
  cursor: pointer;
}
.draft-opponent:not(.draft-opponent--me):hover .mini-grid {
  outline: 2px solid rgba(255,255,255,0.35);
  outline-offset: 2px;
  border-radius: 3px;
}
.draft-opponent:not(.draft-opponent--me):active .mini-grid {
  outline-color: var(--gold);
}

/* Dialog vue adversaire agrandie */
.opponent-view-dialog {
  border: none;
  /* border-radius: var(--radius-lg);*/
  padding: 0;
  width: calc(100% - 32px);
  max-width: 380px;
  max-height: calc(100svh - 32px);
  box-shadow: 0 12px 40px rgba(61,43,31,0.5);
  overflow: hidden;
  background: var(--white);
}
.opponent-view-dialog::backdrop {
  background: rgba(20,10,5,0.65);
  backdrop-filter: blur(3px);
}
.opponent-view-inner {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px 16px 20px;
  padding-bottom: calc(20px + env(safe-area-inset-bottom));
  max-height: calc(100svh - 32px);
  box-sizing: border-box;
}
.opponent-view-header {
  display: flex;
  align-items: center;
  gap: 8px;
  position: relative;
  padding-right: 36px;
}
.opponent-view-title {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 0;
  flex-wrap: wrap;
}
.opponent-nav-btn {
  background: rgba(244,162,97,0.15);
  border: 2px solid var(--amber);
  color: var(--brown);
  font-size: 1.4rem;
  font-weight: 900;
  line-height: 1;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  touch-action: manipulation;
  transition: background 0.15s;
}
.opponent-nav-btn:hover  { background: rgba(244,162,97,0.28); }
.opponent-nav-btn:active { background: rgba(244,162,97,0.45); }
.opponent-nav-btn:disabled { opacity: 0.2; pointer-events: none; }
.opponent-close-btn {
  position: absolute;
  top: 0;
  right: 0;
  background: transparent;
  border: none;
  color: var(--brown-light);
  font-size: 1rem;
  font-weight: 700;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: 8px;
  touch-action: manipulation;
  transition: background 0.15s, color 0.15s;
}
.opponent-close-btn:hover  { background: rgba(61,43,31,0.08); color: var(--brown); }
.opponent-close-btn:active { background: rgba(61,43,31,0.15); }
.opponent-view-indicator {
  text-align: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--brown-light);
  letter-spacing: 0.05em;
}
.opponent-view-grid-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
}
.opponent-view-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  grid-template-rows: repeat(4, 1fr);
  gap: 4px;
  width: min(calc(100vw - 64px), 300px);
  aspect-ratio: 5/4;
}
.opponent-view-cell {
  border-radius: 6px;
  background: rgba(61,43,31,0.08);
  border: 1px solid rgba(61,43,31,0.15);
  background-size: cover;
  background-position: center 20%;
  background-repeat: no-repeat;
  aspect-ratio: 1;
}
.opponent-view-cell.has-card { border-color: rgba(61,43,31,0.3); }
@media (min-width: 420px) {
  .opponent-view-grid  { width: min(calc(100vw - 64px), 340px); }
  .opponent-view-dialog { max-width: 420px; }
}
