:root {
  color-scheme: dark;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Helvetica Neue", Arial, sans-serif;
  background: #171717;
}

* { box-sizing: border-box; }

body {
  min-height: 100vh;
  margin: 0;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 50% 15%, #363636 0, #1b1b1b 36%, #101010 100%);
}

.calculator {
  width: min(100vw, 430px);
  min-height: min(100vh, 780px);
  padding: 40px 20px 28px;
  display: flex;
  flex-direction: column;
  justify-content: end;
  background: #000;
}

.display {
  min-height: 154px;
  padding: 0 7px 17px;
  display: flex;
  align-items: end;
  justify-content: end;
  overflow: hidden;
  color: #fff;
  font-size: clamp(3.75rem, 17vw, 6rem);
  font-weight: 300;
  line-height: .95;
  letter-spacing: -0.065em;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.keypad {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 11px;
}

.key {
  aspect-ratio: 1;
  border: 0;
  border-radius: 50%;
  padding: 0;
  display: grid;
  place-items: center;
  cursor: pointer;
  color: #fff;
  background: #333;
  font: 400 clamp(1.85rem, 8vw, 2.35rem)/1 -apple-system, BlinkMacSystemFont, "SF Pro Display", sans-serif;
  transition: filter 90ms ease, transform 90ms ease, background-color 90ms ease;
  -webkit-tap-highlight-color: transparent;
}

.key:hover, .key:focus-visible { filter: brightness(1.25); outline: none; }
.key:active { filter: brightness(1.45); transform: scale(.96); }
.utility { color: #000; background: #a5a5a5; font-size: clamp(1.5rem, 6.4vw, 1.85rem); }
.operator { background: #ff9f0a; font-size: clamp(2.4rem, 9vw, 3rem); font-weight: 300; }
.operator.selected { color: #ff9f0a; background: #fff; }
.zero { grid-column: span 2; aspect-ratio: auto; border-radius: 999px; justify-content: start; padding-left: 28px; }

@media (min-width: 431px) {
  .calculator { border-radius: 38px; min-height: 690px; box-shadow: 0 30px 80px #0009; }
}

@media (max-height: 650px) {
  .calculator { min-height: 100vh; padding-top: 18px; }
  .display { min-height: 82px; padding-bottom: 10px; }
  .keypad { gap: 7px; }
}
