/* --- CORRECCIÓN PRINCIPAL: Evita que el padding sume ancho --- */
* {
  box-sizing: border-box;
}

body {
  background: linear-gradient(135deg, #f5f7fa 0%, #00233b 100%);
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  min-height: 100vh; /* Cambiado a min-height para evitar cortes */
  font-family: "Orbitron", sans-serif;
  margin: 0;
  gap: 20px;
  overflow-x: hidden; /* --- CORRECCIÓN: Evita deslizamiento lateral --- */
}

#titulo {
  color: #1a1892;
  font-size: 40px;
  text-align: center;
}

#Calculator {
  background: linear-gradient(135deg, #1e1e2f 0%, #2c3e50 50%, #4b6cb7 100%);
  width: 320px;
  border-radius: 30px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.96);
  overflow: hidden;
  padding: 20px;
  /* Asegura que no se expanda más de 320px */
  flex-shrink: 0; 
}

#Display {
  background: linear-gradient(300deg, #101010fc 0%, #6f7477 50%, #d9dbe0 100%);
  color: white;
  text-align: right;
  padding: 20px;
  border-radius: 15px;
  margin-bottom: 20px;
  font-size: 2.5rem;
  height: 100px; /* Altura fija para que no salte */
  width: 100%;   /* Ocupa exactamente el espacio disponible */
  
  display: flex;
  justify-content: flex-end;
  align-items: center;
  overflow: hidden; /* Corta lo que sobre si falla el JS */
  position: relative;
}

#Display h1 {
  margin: 0;
  white-space: nowrap;
  transform-origin: right center;
  transition: transform 0.1s ease;
  position: absolute; /* Evita que el texto empuje el contenedor */
  right: 20px; /* Mantiene el texto pegado a la derecha */
}

#Buttons {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-gap: 10px;
}

button {
  font-size: 1.5rem;
  border: none;
  border-radius: 50%;
  height: 65px; /* Ajustado ligeramente */
  width: 65px;  /* Ajustado ligeramente */
  cursor: pointer;
  transition: transform 0.1s, background-color 0.2s;
}

button:hover {
  transform: scale(1.05);
}

.dark {
  background: linear-gradient(135deg, #2b2b2b 0%, #6f7477 50%, #d9dbe0 100%);
  color: rgb(0, 0, 0);
}

.Numbergray, .gray {
  background: linear-gradient(135deg, #000000 0%, #2f2f2f 50%, #6b6b6b 100%);
  color: white;
}

.Symbolorange, .orange {
  background: linear-gradient(135deg, #cc5a00 0%, #ff8d01 50%, #ffd59a 100%);
  color: white;
}

/* --- CORRECCIÓN BOTÓN CERO --- */
/* Usamos tu selector, pero ajustamos el ancho para que respete el Grid */
.Numbergray:nth-child(17) {
  grid-column: span 2;
  border-radius: 35px;
  width: 100%; /* Cambiado de 150px a 100% para no romper el layout */
}

small {
  color: white;
  text-decoration: underline;
  font-size: 20px;
}

/* TUS MEDIA QUERIES ORIGINALES (Respetadas) */
@media (max-width: 480px) {
  #Calculator {
    width: 90%;
    max-width: 300px;
  }
  button {
    height: 55px;
    width: 55px;
  }
}

@media (max-width: 900px) { #Calculator { transform: scale(0.9); } }
@media (max-width: 700px) { #Calculator { transform: scale(0.8); } }
@media (max-width: 550px) { #Calculator { transform: scale(0.7); } }
@media (max-width: 430px) { #Calculator { transform: scale(0.6); } }
@media (max-width: 350px) { #Calculator { transform: scale(0.5); } }



