* {
  -webkit-tap-highlight-color: transparent;
  outline: none;
  user-select: none;
  box-sizing: border-box;
}

body {
  background-color: #121212;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
  height: 100dvh;
  margin: 0;
  font-family: Arial, sans-serif;
  overflow: hidden;
}

.calculator {
  width: 100%;
  max-width: 400px;
  height: 100%;
  max-height: 100dvh;
  background-color: #121212;
  padding: 8px 12px;
  border-radius: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.display {
  text-align: right;
  padding: 5px;
  color: white;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

#history {
  font-size: 1rem;
  color: #888;
  margin-bottom: 2px;
  min-height: 1.2rem;
}

#result {
  font-size: 2.8rem;
  font-weight: bold;
  overflow-x: auto;
}

.buttons {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  padding-bottom: env(safe-area-inset-bottom);
}

.btn {
  aspect-ratio: 1 / 1;
  width: 100%;
  border: none;
  border-radius: 14px;
  font-size: 1.3rem;
  font-weight: bold;
  cursor: pointer;
  background-color: #383838;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: filter 0.1s;
}

.btn:active {
  filter: brightness(1.4);
}

.btn-blue {
  background-color: #2196f3;
  font-weight: bold;
}
.btn-orange {
  background-color: #ff9800;
  color: #000;
  font-size: 2rem;
}
.btn-purple {
  background-color: #5e5ce6;
  font-size: 2rem;
}

.btn-zero {
  grid-column: span 2;
  aspect-ratio: auto;
  height: 100%;
}

@media (min-width: 1024px) {
  body {
    background-color: #121212;
  }

  .calculator {
    width: 350px;
    height: auto;
    max-height: none;
    background-color: #000;
    padding: 18px;
    border-radius: 20px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
  }
}
