/* Reset et configuration de base */
* {
  padding: 0;
  margin: 0;
  box-sizing: border-box;
}

body {
  max-width: 100vw;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  font-family: 'Segoe UI', sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

/* Container de la calculatrice - AJOUTE max-width */
.calculatrice {
  background-color: #222222;
  display: flex;
  flex-direction: column;
  padding: 20px;
  border-radius: 15px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  max-width: 320px; /* Empêche l'agrandissement */
  width: 100%;
}

/* Écran avec défilement automatique */
.ecran {
  width: 100%;
  height: 100px;
  background-color: #ffffff;
  margin-bottom: 15px;
  border-radius: 10px;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  padding: 15px;
  font-size: 28px;
  font-weight: 500;
  color: #222;
  /* Solution pour le défilement SANS agrandir */
  overflow-x: auto;
  overflow-y: hidden;
  white-space: nowrap;
  text-align: right;
  /* CRITIQUE : empêche l'agrandissement */
  min-width: 0;
  max-width: 100%;
  /* Cache la barre de défilement */
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE/Edge */
}

/* Cache la barre de défilement pour Chrome/Safari */
.ecran::-webkit-scrollbar {
  display: none;
}

/* Grille des boutons */
.touches {
  display: grid;
  grid-template-columns: repeat(4, 60px);
  grid-template-rows: repeat(5, 60px);
  grid-gap: 10px;
}

/* Style de base des boutons */
button {
  border: none;
  outline: none;
  border-radius: 10px;
  background-color: #f7f7f7;
  box-shadow: 0 4px #a8a8a8;
  font-size: 20px;
  cursor: pointer;
  transition: all 0.1s;
  font-weight: 500;
}

/* Effet au clic */
button:active {
  box-shadow: 0 2px #a8a8a8;
  transform: translateY(2px);
}

/* Bouton supprimer (C) */
.bouton-suppr {
  background-color: #ff6b6b;
  color: white;
  font-weight: bold;
}

/* Boutons opérateurs */
.bouton-operateur {
  background-color: #4ecdc4;
  color: white;
  font-weight: bold;
}

/* Bouton égal */
.bouton-egal {
  grid-column: span 2;
  background-color: #51cf66;
  color: white;
  font-weight: bold;
  font-size: 32px;
}

/* Hover effects */
button:hover {
  opacity: 0.9;
}