/* ==========================================================================
   EnchèreMax — Terminaux Rétro & Adversaires IA
   ========================================================================== */

.bots-grid {
  display: grid;
  gap: 1rem;
  width: 100%;
}

.bots-grid.grid-count-1 {
  grid-template-columns: 1fr;
  max-width: 450px;
  margin: 0 auto;
}

.bots-grid.grid-count-2 {
  grid-template-columns: repeat(2, 1fr);
}

.bots-grid.grid-count-3 {
  grid-template-columns: repeat(3, 1fr);
}

.bots-grid.grid-count-4 {
  grid-template-columns: repeat(4, 1fr);
}

@media (max-width: 992px) {
  .bots-grid.grid-count-3,
  .bots-grid.grid-count-4 {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 600px) {
  .bots-grid.grid-count-2,
  .bots-grid.grid-count-3,
  .bots-grid.grid-count-4 {
    grid-template-columns: 1fr;
  }
}

/* Boîtier du Terminal IA */
.bot-terminal {
  background: var(--bg-panel);
  border: 2px solid var(--border-metallic);
  border-radius: 8px;
  padding: 0.8rem;
  display: flex;
  flex-direction: column;
  position: relative;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
  transition: transform var(--trans-smooth), border-color var(--trans-smooth);
}

.bot-terminal.is-locked {
  border-color: #4b5563;
  opacity: 0.95;
}

/* Bulle de Dialogue Intox / Psychologique */
.bot-speech-bubble {
  position: absolute;
  bottom: calc(100% + 12px);
  left: 50%;
  transform: translateX(-50%) translateY(8px) scale(0.95);
  background: #1e293b;
  color: #f8fafc;
  border: 1px solid #475569;
  border-radius: 6px;
  padding: 0.6rem 0.8rem;
  font-size: 0.75rem;
  font-weight: 500;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.6);
  z-index: 50;
  width: 90%;
  max-width: 240px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 180ms ease, transform 180ms cubic-bezier(0.18, 0.89, 0.32, 1.28);
}

.bot-speech-bubble.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0) scale(1);
}

.bot-speech-bubble .speech-quote {
  color: var(--vfd-amber);
  font-weight: 700;
  margin-right: 2px;
}

.bot-speech-bubble .speech-tail {
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 6px solid #475569;
}

/* Écran du Terminal */
.bot-terminal-screen {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.bot-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.bot-name {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: #cbd5e1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bot-inspect-btn {
  background: var(--bg-panel-sunken);
  border: 1px solid var(--border-metallic);
  color: var(--text-muted);
  width: 20px;
  height: 20px;
  border-radius: 50%;
  font-size: 0.7rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--trans-fast);
}

.bot-inspect-btn:hover {
  background: var(--btn-face-hover);
  color: #fff;
  border-color: var(--border-metallic-light);
}

/* Zone Avatar CRT */
.bot-avatar-container {
  background: #090d10;
  border: 2px solid #1a2228;
  border-radius: 6px;
  padding: 0.4rem;
  height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.bot-portrait-svg {
  width: 68px;
  height: 68px;
  display: block;
}

.bot-scanlines {
  position: absolute;
  inset: 0;
  background: linear-gradient(rgba(255,255,255,0.03) 50%, rgba(0,0,0,0.4) 50%);
  background-size: 100% 2px;
  pointer-events: none;
}

/* Badge de statut */
.bot-status-badge {
  position: absolute;
  bottom: 4px;
  right: 4px;
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(0, 0, 0, 0.75);
  padding: 0.15rem 0.4rem;
  border-radius: 3px;
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.status-led {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #64748b;
}

.bot-status-badge.status-bidding .status-led {
  background: #10b981;
  box-shadow: 0 0 6px #10b981;
  animation: blink-fast 800ms infinite alternate;
}

.bot-status-badge.status-hesitating .status-led {
  background: #f59e0b;
  box-shadow: 0 0 6px #f59e0b;
}

.bot-status-badge.status-locked .status-led {
  background: #ef4444;
  box-shadow: 0 0 6px #ef4444;
}

@keyframes blink-fast {
  from { opacity: 0.4; }
  to { opacity: 1; }
}

/* Boîte Tally Digitale du Bot */
.bot-tally-box {
  background: #090c0e;
  border: 1px solid #1e262c;
  border-radius: 4px;
  padding: 0.4rem 0.6rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.tally-label {
  font-size: 0.62rem;
  color: #64748b;
  letter-spacing: 1px;
}

.tally-value {
  font-family: var(--font-vfd);
  font-size: 1.15rem;
  font-weight: 700;
  color: #f1f5f9;
  letter-spacing: 1px;
}

.tally-value.blind-value {
  color: #94a3b8;
  letter-spacing: 2px;
  font-size: 0.95rem;
}

/* ==========================================================================
   Adversaires IA — Version Mobile (carrousel horizontal)
   Empiler 2 à 4 terminaux verticalement forcerait un long défilement
   pendant le compte à rebours : on les aligne en bande défilante à la place.
   ========================================================================== */
@media (max-width: 700px) {
  .bots-grid.grid-count-1,
  .bots-grid.grid-count-2,
  .bots-grid.grid-count-3,
  .bots-grid.grid-count-4 {
    display: flex;
    flex-wrap: nowrap;
    max-width: none;
    margin: 0;
    overflow-x: auto;
    overflow-y: visible;
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 0.2rem;
    scrollbar-width: none;
  }

  .bots-grid.grid-count-1::-webkit-scrollbar,
  .bots-grid.grid-count-2::-webkit-scrollbar,
  .bots-grid.grid-count-3::-webkit-scrollbar,
  .bots-grid.grid-count-4::-webkit-scrollbar {
    display: none;
  }

  .bot-terminal {
    flex: 0 0 40vw;
    max-width: 190px;
    min-width: 148px;
    scroll-snap-align: start;
    padding: 0.6rem;
  }

  .bot-avatar-container { height: 62px; }
  .bot-portrait-svg { width: 48px; height: 48px; }
  .bot-name { font-size: 0.68rem; }
  .bot-tally-box { padding: 0.35rem 0.5rem; }
  .tally-label { font-size: 0.58rem; }
  .tally-value { font-size: 0.92rem; }
  .bot-status-badge { font-size: 0.55rem; padding: 0.12rem 0.35rem; }

  /* La bulle flotte au-dessus de la bande défilante : la clipper la rendrait
     invisible, donc on la réancre en overlay à l'intérieur du terminal. */
  .bot-speech-bubble {
    position: absolute;
    top: 0.35rem;
    left: 0.35rem;
    right: 0.35rem;
    bottom: auto;
    width: auto;
    max-width: none;
    transform: translateY(-6px) scale(0.96);
    padding: 0.4rem 0.55rem;
    font-size: 0.64rem;
    line-height: 1.25;
    z-index: 5;
  }

  .bot-speech-bubble.visible {
    transform: translateY(0) scale(1);
  }

  .bot-speech-bubble .speech-tail {
    display: none;
  }
}
