

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  font-family: 'Inter', sans-serif;
  color: #f8fafc;
  background: #0b0b14;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(ellipse at 15% 15%, #36205c 0%, transparent 38%),
    radial-gradient(ellipse at 85% 85%, #142d53 0%, transparent 38%),
    #0b0b14;
}

button {
  font: inherit;
}

.calculator-container {
  width: 100%;
  max-width: 390px;
}

.calculator-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
}

.eyebrow {
  color: #a78bfa;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 2.5px;
  margin-bottom: 6px;
}

.calculator-header h1 {
  font-size: 29px;
  font-weight: 800;
  letter-spacing: -1px;
}

.calculator-icon {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 15px;
  background: linear-gradient(135deg, #8b5cf6, #6d28d9);
  color: white;
  font-size: 29px;
  box-shadow: 0 8px 25px #8b5cf640;
}

.calculator {
  padding: 20px;
  border: 1px solid #ffffff16;
  border-radius: 27px;
  background: #171724;
  box-shadow: 0 24px 70px #00000070;
}

.display {
  height: 125px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: flex-end;
  gap: 12px;
  overflow: hidden;
  padding: 12px 8px 20px;
  margin-bottom: 14px;
  border-bottom: 1px solid #ffffff16;
}

.previous-operand {
  min-height: 20px;
  max-width: 100%;
  color: #9998b1;
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.current-operand {
  max-width: 100%;
  color: #ffffff;
  font-size: clamp(30px, 9vw, 46px);
  font-weight: 700;
  letter-spacing: -1.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.keypad {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.key {
  min-width: 0;
  height: 64px;
  border: 1px solid #ffffff08;
  border-radius: 17px;
  background: #242432;
  color: #f8fafc;
  font-size: 21px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease,
              box-shadow 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

.key:hover {
  background: #343447;
  transform: translateY(-2px);
}

.key:active {
  transform: scale(0.95);
}

.key:focus-visible {
  outline: 3px solid #c4b5fd;
  outline-offset: 3px;
}

.key.utility {
  background: #343044;
  color: #c4b5fd;
  font-size: 16px;
}

.key.utility:hover {
  background: #46405d;
}

.key.operator {
  background: #35265b;
  color: #c4b5fd;
  font-size: 25px;
}

.key.operator:hover {
  background: #4b347e;
}

.key.equals {
  background: linear-gradient(145deg, #a78bfa, #7c3aed);
  color: #ffffff;
  font-size: 27px;
  box-shadow: 0 6px 18px #8b5cf633;
}

.key.equals:hover {
  background: linear-gradient(145deg, #b69fff, #8b5cf6);
  box-shadow: 0 8px 22px #8b5cf655;
}

.keyboard-hint {
  margin-top: 18px;
  text-align: center;
  color: #85849b;
  font-size: 11px;
  letter-spacing: 0.3px;
}

@media (max-width: 420px) {
  body {
    padding: 16px;
  }

  .calculator {
    padding: 15px;
    border-radius: 23px;
  }

  .keypad {
    gap: 9px;
  }

  .key {
    height: 59px;
    border-radius: 14px;
  }

  .calculator-header h1 {
    font-size: 25px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}