* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

/* ======================
   BLOQUE SELECTION TEXTE
====================== */
html, body, .btn, .display {
  -webkit-user-select: none;
  -ms-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

/* ======================
   BODY
====================== */
body {
  margin: 0;
  background: #000;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, sans-serif;
  overflow: hidden; /* évite scroll parasite mobile */
}

/* ======================
   APP CONTAINER
====================== */
.app {
  width: 100%;
  max-width: 390px;
  padding:
    env(safe-area-inset-top)
    16px
    env(safe-area-inset-bottom);
}

/* ======================
   DISPLAY
====================== */
.display-wrapper {
  min-height: 140px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: flex-end;
  padding: 0 10px 20px 10px;
}

.display {
  color: #fff;
  font-size: 64px;
  font-weight: 300;
  word-break: break-all;
  transition: font-size 0.2s ease;
  pointer-events: none; /* empêche sélection */
}

/* ======================
   GRID BOUTONS
====================== */
.buttons {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

/* ======================
   BOUTONS GENERAUX
====================== */
.btn {
  height: 78px;
  border-radius: 50%;
  border: none;
  font-size: 28px;
  cursor: pointer;
  transition: transform 0.08s ease, filter 0.08s ease;
  touch-action: manipulation; /* améliore tactile */
  display: flex;
  justify-content: center;
  align-items: center;
}

/* Effet pression */
.btn:active {
  transform: scale(0.96);
  filter: brightness(1.2);
}

/* ======================
   COULEURS
====================== */

.number {
  background: #333;
  color: #fff;
}

.function {
  background: #a5a5a5;
  color: #000;
}

.operator {
  background: #ff9f0a;
  color: #fff;
}

.equals {
  background: #ff9f0a;
}

/* ======================
   ZERO LARGE
====================== */
.zero {
  grid-column: span 2;
  border-radius: 50px;
  justify-content: flex-start;
  padding-left: 28px;
}

/* ======================
   RESPONSIVE PETITS ECRANS
====================== */
@media (max-height: 650px) {
  .btn {
    height: 65px;
    font-size: 24px;
  }

  .display {
    font-size: 48px;
  }
}