/* ==========================================================================
   BrainTrain - Styles Mastermind (Plateau de jeu & Sélecteur de Couleurs)
   ========================================================================== */

.mastermind-container {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  gap: 0.875rem;
}

/* --------------------------------------------------------------------------
   Plateau d'Historique des Tentatives
   -------------------------------------------------------------------------- */
.mastermind-board {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.75rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column-reverse; /* Les tentatives récentes en bas, ou chronologique */
  gap: 0.5rem;
  max-height: 46vh;
  overflow-y: auto;
  overscroll-behavior: contain;
}

/* Rangée de tentative passée */
.attempt-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.625rem;
  background-color: var(--bg-subtle);
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  transition: all var(--transition-fast);
}

.attempt-number {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  width: 24px;
}

.attempt-pegs {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

/* Pions de couleur */
.color-peg {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  box-shadow: inset 0 2px 4px rgba(255, 255, 255, 0.4), 0 2px 4px rgba(0, 0, 0, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #FFFFFF;
  font-size: 0.75rem;
  font-weight: 800;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* Verdict Pions Noirs / Blancs */
.verdict-box {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background-color: var(--bg-surface);
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border-subtle);
}

.verdict-item {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.75rem;
  font-weight: 700;
}

.verdict-item.exact {
  color: #1C1917;
}

.verdict-item.misplaced {
  color: var(--text-muted);
}

.verdict-dot {
  width: 12px;
  height: 12px;
  border-radius: var(--radius-full);
  display: inline-block;
}

.verdict-dot.exact-dot {
  background-color: #1C1917;
}

.verdict-dot.misplaced-dot {
  background-color: #FFFFFF;
  border: 2px solid #78716C;
}

/* --------------------------------------------------------------------------
   Rangée Active (En cours de composition)
   -------------------------------------------------------------------------- */
.active-guess-card {
  background: linear-gradient(135deg, #FFFFFF 0%, #FAF8F5 100%);
  border: 2px solid var(--accent-primary);
  border-radius: var(--radius-md);
  padding: 0.875rem;
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

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

.active-guess-title {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--accent-primary);
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

.attempts-left-badge {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-secondary);
  background-color: var(--bg-subtle);
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-full);
}

.active-slots-container {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.625rem;
}

.guess-slot {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-full);
  border: 2px dashed var(--border-strong);
  background-color: var(--bg-surface);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.04);
}

.guess-slot:hover {
  border-color: var(--accent-primary);
}

.guess-slot.selected-slot {
  border-style: solid;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--accent-primary-subtle);
  transform: scale(1.05);
}

.guess-slot.filled {
  border-style: solid;
  border-color: transparent;
  box-shadow: inset 0 2px 4px rgba(255, 255, 255, 0.4), 0 3px 8px rgba(0, 0, 0, 0.15);
  animation: popIn 200ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes popIn {
  from { transform: scale(0.6); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.active-guess-actions {
  display: flex;
  gap: 0.5rem;
}

.btn-validate-guess {
  flex: 1;
  min-height: 46px;
  background: var(--accent-primary);
  color: #FFFFFF;
  border: none;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 0.9375rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.25);
  transition: all var(--transition-fast);
}

.btn-validate-guess:disabled {
  background-color: var(--border-subtle);
  color: var(--text-muted);
  box-shadow: none;
  cursor: not-allowed;
}

.btn-validate-guess:not(:disabled):active {
  transform: scale(0.97);
}

.btn-clear-slot {
  width: 46px;
  min-height: 46px;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.125rem;
  transition: all var(--transition-fast);
}

.btn-clear-slot:hover {
  background-color: var(--bg-subtle);
  border-color: var(--border-strong);
}

.btn-clear-slot:active {
  transform: scale(0.95);
}

/* --------------------------------------------------------------------------
   Palette de Sélection de Couleurs (Bottom Color Picker)
   -------------------------------------------------------------------------- */
.color-picker-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.75rem;
  box-shadow: var(--shadow-sm);
}

.color-picker-palette {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.625rem;
}

.color-choice-btn {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-full);
  border: 2.5px solid #FFFFFF;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15), inset 0 2px 4px rgba(255, 255, 255, 0.4);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8125rem;
  font-weight: 800;
  color: #FFFFFF;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
  user-select: none;
  touch-action: manipulation;
}

.color-choice-btn:hover {
  transform: translateY(-2px) scale(1.06);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2);
}

.color-choice-btn:active {
  transform: scale(0.92);
}

/* Tokens de couleurs officielles Mastermind */
.color-1 { background: linear-gradient(135deg, #EF4444 0%, #DC2626 100%); } /* Rouge */
.color-2 { background: linear-gradient(135deg, #3B82F6 0%, #2563EB 100%); } /* Bleu */
.color-3 { background: linear-gradient(135deg, #10B981 0%, #059669 100%); } /* Vert */
.color-4 { background: linear-gradient(135deg, #F59E0B 0%, #D97706 100%); } /* Jaune */
.color-5 { background: linear-gradient(135deg, #8B5CF6 0%, #7C3AED 100%); } /* Violet */
.color-6 { background: linear-gradient(135deg, #F97316 0%, #EA580C 100%); } /* Orange */
.color-7 { background: linear-gradient(135deg, #06B6D4 0%, #0891B2 100%); } /* Cyan */
.color-8 { background: linear-gradient(135deg, #EC4899 0%, #DB2777 100%); } /* Rose */
