* {
  box-sizing: border-box;
}
body {
  font-family: Arial, sans-serif;
  text-align: center;
  background: #f0f4f8;
  padding: 15px;
  margin: 0;
}
.card {
  background: white;
  padding: 20px 15px;
  border-radius: 14px;
  max-width: 440px;
  margin: auto;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
}
h1 {
  margin-top: 0;
  font-size: 26px;
}
h3 {
  margin-bottom: 12px;
}
.attempts {
  color: #64748b;
  font-size: 15px;
  margin-bottom: 15px;
}
/* =========================
   COULEURS
   ========================= */
.picker {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.btn-color {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 3px solid white;
  margin: 4px;
  cursor: pointer;
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.25);
  transition: transform 0.1s;
}
.btn-color:hover {
  transform: scale(1.08);
}
.btn-color:active {
  transform: scale(0.95);
}
/* =========================
   COMBINAISON EN COURS
   ========================= */
.guess {
  min-height: 40px;
  margin: 15px 0;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: nowrap;
}
.peg {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: inline-block;
  margin: 3px;
  vertical-align: middle;
  flex-shrink: 0;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.25);
}
.empty {
  border: 2px dashed #ccc;
  box-shadow: none;
}
/* =========================
   BOUTONS
   ========================= */
.actions {
  margin: 12px 0;
}
.action {
  padding: 10px 15px;
  margin: 4px;
  border: none;
  background: #2563eb;
  color: white;
  border-radius: 7px;
  font-weight: bold;
  cursor: pointer;
}
.action:hover {
  opacity: 0.9;
}
.action:active {
  transform: scale(0.97);
}
.secondary {
  background: #64748b;
}
.danger {
  background: #dc2626;
}
.action:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
/* =========================
   MESSAGES
   ========================= */
#message {
  min-height: 25px;
  margin: 12px;
  font-weight: bold;
}
#win {
  display: none;
  color: #16a34a;
  margin: 15px 0;
}
/* =========================
   HISTORIQUE
   ========================= */
#board {
  margin-top: 15px;
  text-align: left;
}
.row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #eee;
  padding: 8px 0;
  gap: 8px;
}
/* Les 4 couleurs restent toujours ensemble */
.row > div:first-child {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  flex-shrink: 0;
}
.row .peg {
  flex-shrink: 0;
}
.result {
  font-size: 12px;
  white-space: nowrap;
  flex-shrink: 0;
}
/* =========================
   PETITS ÉCRANS
   ========================= */
@media (max-width: 380px) {
  body {
    padding: 8px;
  }
  .card {
    padding: 15px 8px;
  }
  h1 {
    font-size: 23px;
  }
  .btn-color {
    width: 40px;
    height: 40px;
    margin: 3px;
  }
  .row {
    gap: 4px;
  }
  .row .peg {
    width: 22px;
    height: 22px;
    margin: 2px;
  }
  .result {
    font-size: 9px;
  }
}
/* =========================
   TRÈS PETITS ÉCRANS
   ========================= */
@media (max-width: 320px) {
  .card {
    padding: 12px 5px;
  }
  .row .peg {
    width: 20px;
    height: 20px;
    margin: 1px;
  }
  .result {
    font-size: 8px;
  }
}
