@import url('https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100..900;1,100..900&display=swap');

/* 🌙 Gaya dasar */
body {
  margin: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
  background-color: #2c2c2b;
}

#calculator {
  border-radius: 15px;
  overflow: hidden;
  width: 90%;              /* 🔹 gunakan persentase agar fleksibel */
  max-width: 350px;        /* 🔹 batasi ukuran maksimum */
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

#display {
  font-family: "Roboto", sans-serif;
  width: 100%;
  padding: 15px;
  font-size: 2rem;
  text-align: right;
  background-color: hsl(0, 0%, 20%);
  color: white;
  border: none;
  outline: none;
  box-sizing: border-box;
}

#history {
  width: 100%;
  text-align: right;
  font-size: 1rem;
  color: #bbb;
  background-color: hsl(0, 0%, 18%);
  padding: 8px 15px 0 15px;
  box-sizing: border-box;
  min-height: 20px;
}


#keys {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  padding: 12px;
  box-sizing: border-box;
}

button {
  font-family: "Roboto", sans-serif;
  width: 100%;
  aspect-ratio: 1 / 1;
  border: none;
  border-radius: 20%;
  background-color: hsl(0, 0%, 30%);
  color: #fff;
  font-size: 1.5rem;
  font-weight: bold;
  cursor: pointer;
  transition: 0.2s;
}

button:hover {
  background-color: hsl(0, 0%, 40%);
}

button:active {
  background-color: hsl(0, 0%, 50%);
}

.operator-btn {
  background-color: #0a89ff;
}

.operator-btn:hover {
  background-color: #0663ba;
}

.operator-btn:active {
  background-color: #388fdf;
}

/* 📱 Responsif untuk layar kecil */
@media (max-width: 480px) {
  #display {
    font-size: 1.5rem;   /* kurangi ukuran teks */
    padding: 10px;
  }

  #keys {
    gap: 6px;
    padding: 10px;
  }

  button {
    font-size: 1.2rem;
  }
}

/* 💻 Responsif untuk layar besar */
@media (min-width: 768px) {
  #calculator {
    max-width: 400px;
  }

  #display {
    font-size: 2.2rem;
  }

  button {
    font-size: 1.6rem;
  }
}
