:root {
  --primary-color: #4a6fa5;
  --secondary-color: #6b8cbc;
  --success-color: #4caf50;
  --error-color: #f44336;
  --warning-color: #ff9800;
  --light-color: #f5f5f5;
  --dark-color: #333;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  line-height: 1.6;
  color: var(--dark-color);
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  padding: 20px;
}

.container {
  max-width: 1000px;
  margin: 0 auto;
  background: white;
  border-radius: 15px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.2);
  overflow: hidden;
}

header {
  background: var(--primary-color);
  color: white;
  padding: 2rem;
  text-align: center;
}

header h1 {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
}

header p {
  font-size: 1.2rem;
  opacity: 0.9;
}

/* Boutons de la page d'accueil */
.boutons-jeux {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  padding: 2rem;
}

.bouton-jeu {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  color: white;
  text-decoration: none;
  padding: 2.5rem 1.5rem;
  border-radius: 15px;
  text-align: center;
  transition: all 0.3s ease;
  border: none;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(0,0,0,0.15);
  min-height: 180px;
}

.bouton-jeu:hover {
  transform: translateY(-8px) scale(1.02);
  box-shadow: 0 15px 30px rgba(0,0,0,0.25);
}

.bouton-jeu:active {
  transform: translateY(-2px);
}

.bouton-jeu .icone {
  font-size: 3.5rem;
  margin-bottom: 1rem;
  display: block;
}

.bouton-jeu .titre {
  font-size: 1.4rem;
  font-weight: bold;
  margin-bottom: 0.5rem;
}

.bouton-jeu .sous-titre {
  font-size: 0.9rem;
  opacity: 0.9;
}

.bouton-jeu.bientot {
  background: linear-gradient(135deg, #95a5a6, #7f8c8d);
  cursor: not-allowed;
  opacity: 0.7;
}

.bouton-jeu.bientot:hover {
  transform: none;
  box-shadow: 0 8px 20px rgba(0,0,0,0.15);
}

.badge-bientot {
  background: var(--warning-color);
  color: white;
  padding: 0.3rem 0.8rem;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: bold;
  margin-top: 0.5rem;
}

/* Styles pour les pages de jeux */
.jeu-container {
  max-width: 800px;
  margin: 0 auto;
  padding: 2rem;
}

.config, .calcul, .resultat {
  background: white;
  border-radius: 8px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
}

select, input[type="number"] {
  width: 100%;
  padding: 0.5rem;
  margin-bottom: 1rem;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 1rem;
}

.range-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.range-group input {
  flex: 1;
  margin-bottom: 0;
}

button {
  background-color: var(--primary-color);
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 1rem;
  transition: background-color 0.3s;
}

button:hover {
  background-color: var(--secondary-color);
}

.btn-reset {
  background-color: var(--warning-color);
}

.btn-reset:hover {
  background-color: #e68900;
}

.calcul {
  text-align: center;
}

.question {
  font-size: 2rem;
  margin-bottom: 1rem;
  font-weight: bold;
}

.calcul-input {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
}

.calcul-input input {
  width: 150px;
  margin-bottom: 0;
}

.message {
  padding: 0.75rem;
  border-radius: 4px;
  margin-bottom: 1rem;
  text-align: center;
  font-weight: 500;
}

.message.correct {
  background-color: rgba(76, 175, 80, 0.1);
  color: var(--success-color);
  border: 1px solid var(--success-color);
}

.message.incorrect {
  background-color: rgba(244, 67, 54, 0.1);
  color: var(--error-color);
  border: 1px solid var(--error-color);
}

.compteurs {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  font-weight: 500;
}

.progress {
  margin-top: 1rem;
  text-align: center;
}

.progress-bar {
  height: 10px;
  background-color: #e0e0e0;
  border-radius: 5px;
  overflow: hidden;
  margin-top: 0.5rem;
}

.progress-fill {
  height: 100%;
  background-color: var(--success-color);
  width: 0%;
  transition: width 0.3s;
}

.stats {
  display: flex;
  justify-content: space-around;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid #eee;
}

.btn-retour {
  background: #6c757d;
  color: white;
  text-decoration: none;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.btn-retour:hover {
  background: #5a6268;
}

@media (max-width: 600px) {
  .boutons-jeux {
    grid-template-columns: 1fr;
    padding: 1.5rem;
  }
  
  .calcul-input {
    flex-direction: column;
  }
  
  .calcul-input input {
    width: 100%;
  }
  
  .compteurs, .stats {
    flex-direction: column;
    gap: 0.5rem;
    text-align: center;
  }
}
/* === STYLES POUR LE CLAVIER NUMÉRIQUE === */

.numeric-keypad-container {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 1rem;
}

.numeric-keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.action-buttons {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
}

.keypad-btn {
  padding: 1rem;
  border: 2px solid var(--border-color);
  border-radius: 8px;
  background: white;
  color: var(--text-color);
  font-size: 1.2rem;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s ease;
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.keypad-btn:hover:not(:disabled) {
  background: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
  transform: translateY(-2px);
}

.keypad-btn:active:not(:disabled) {
  transform: translateY(0);
}

.keypad-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.keypad-btn:disabled:hover {
  background: white;
  color: var(--text-color);
  border-color: var(--border-color);
}

.keypad-btn.btn-validate {
  background: var(--success-color);
  color: white;
  border-color: var(--success-color);
}

.keypad-btn.btn-validate:hover:not(:disabled) {
  background: #45a049;
  border-color: #45a049;
}

.keypad-btn.btn-clear {
  background: var(--warning-color);
  color: white;
  border-color: var(--warning-color);
}

.keypad-btn.btn-clear:hover:not(:disabled) {
  background: #e68900;
  border-color: #e68900;
}

.keypad-btn.btn-backspace {
  background: var(--error-color);
  color: white;
  border-color: var(--error-color);
}

.keypad-btn.btn-backspace:hover:not(:disabled) {
  background: #d32f2f;
  border-color: #d32f2f;
}

/* Styles responsives */
@media (max-width: 768px) {
  .keypad-btn {
    padding: 0.8rem;
    font-size: 1.1rem;
    min-height: 50px;
  }
  
  .numeric-keypad,
  .action-buttons {
    gap: 0.3rem;
  }
}