@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(ellipse 70% 55% at 18% 35%, rgba(124, 58, 237, 0.16) 0%, transparent 65%),
    radial-gradient(ellipse 60% 70% at 82% 68%, rgba(37, 99, 235, 0.11) 0%, transparent 65%),
    linear-gradient(165deg, #06061a 0%, #0b0b24 55%, #070718 100%);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* Decorative ambient blobs */
.blob {
  position: fixed;
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
}
.blob-1 {
  width: 580px; height: 580px;
  top: -190px; left: -190px;
  background: radial-gradient(circle, rgba(109, 40, 217, 0.18) 0%, transparent 70%);
  filter: blur(70px);
}
.blob-2 {
  width: 500px; height: 500px;
  bottom: -150px; right: -150px;
  background: radial-gradient(circle, rgba(37, 99, 235, 0.13) 0%, transparent 70%);
  filter: blur(70px);
}

/* ── Calculator shell ── */
.calculator {
  position: relative;
  z-index: 1;
  width: 360px;
  padding: 22px 22px 26px;
  border-radius: 36px;
  background: rgba(255, 255, 255, 0.048);
  backdrop-filter: blur(56px) saturate(1.6);
  -webkit-backdrop-filter: blur(56px) saturate(1.6);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.09),
    inset 0 1px 0 rgba(255, 255, 255, 0.13),
    inset 0 -1px 0 rgba(0, 0, 0, 0.25),
    0 40px 90px rgba(0, 0, 0, 0.72),
    0 12px 32px rgba(0, 0, 0, 0.42);
}

/* ── Display ── */
.display {
  background: rgba(0, 0, 0, 0.44);
  border-radius: 24px;
  padding: 18px 22px 16px;
  margin-bottom: 18px;
  text-align: right;
  min-height: 118px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 4px;
  border: 1px solid rgba(255, 255, 255, 0.045);
  box-shadow:
    inset 0 2px 14px rgba(0, 0, 0, 0.55),
    inset 0 -1px 0 rgba(255, 255, 255, 0.02);
  overflow: hidden;
}

.expression {
  font-size: 13px;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.27);
  min-height: 17px;
  overflor: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  letter-spacing: 0.2px;
}

.result {
  font-size: 54px;
  font-weight: 300;
  color: #ffffff;
  line-height: 1.05;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-feature-settings: 'tnum' 1;
  letter-spacing: -2px;
  transition: font-size 0.12s ease, letter-spacing 0.12s ease;
}

.result.small  { font-size: 36px; letter-spacing: -1px; }
.result.xsmall { font-size: 24px; letter-spacing: 0px; }

@keyframes resultPop {
  0%   { opacity: 0.5;  transform: scale(0.96) translateY(3px); }
  100% { opacity: 1;    transform: scale(1)    translateY(0); }
}
.result.pop {
  animation: resultPop 0.15s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

/* ── Button grid ── */
.buttons {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

/* ── Base button (number defaults) ── */
.btn {
  height: 74px;
  border: none;
  border-radius: 20px;
  font-size: 22px;
  font-weight: 400;
  cursor: pointer;
  outline: none;
  user-select: none;
  position: relative;
  overflow: hidden;
  font-family: inherit;
  -webkit-tap-highlight-color: transparent;
  letter-spacing: 0;

  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow:
    0 2px 8px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);

  transition:
    transform  0.14s cubic-bezier(0.34, 1.56, 0.64, 1),
    background 0.14s ease,
    box-shadow 0.14s ease,
    color      0.14s ease;
}

.btn:hover {
  background: rgba(255, 255, 255, 0.17);
  transform: translateY(-2px);
  box-shadow:
    0 8px 24px rgba(0, 0, 0, 0.36),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.btn:active {
  transform: scale(0.9) !important;
  transition-duration: 0.07s;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35) !important;
}

/* ── Zero button — slightly wider feel ── */
.btn-zero {
  font-size: 24px;
}

/* ── Secondary — AC  +/-  %  ⌫ ── */
.btn-secondary {
  background: rgba(148, 148, 198, 0.18);
  color: rgba(255, 255, 255, 0.88);
  font-size: 18px;
  font-weight: 500;
  border-color: rgba(255, 255, 255, 0.07);
}
.btn-secondary:hover {
  background: rgba(175, 175, 225, 0.28);
}

.btn-backspace {
  font-size: 20px;
}

/* ── Operator — ÷  ×  −  + ── */
.btn-operator {
  background: linear-gradient(150deg, #7c3aed 0%, #5b21b6 100%);
  color: #ffffff;
  font-weight: 600;
  border-color: transparent;
  box-shadow:
    0 4px 20px rgba(91, 33, 182, 0.48),
    inset 0 1px 0 rgba(255, 255, 255, 0.22);
}
.btn-operator:hover {
  background: linear-gradient(150deg, #8b5cf6 0%, #6d28d9 100%);
  transform: translateY(-2px);
  box-shadow:
    0 8px 30px rgba(109, 40, 217, 0.58),
    inset 0 1px 0 rgba(255, 255, 255, 0.27);
}
.btn-operator.active {
  background: linear-gradient(150deg, #f5f3ff 0%, #ede9fe 100%);
  color: #5b21b6;
  box-shadow: 0 4px 18px rgba(91, 33, 182, 0.22);
}

/* ── Equals ── */
.btn-equals {
  background: linear-gradient(150deg, #f59e0b 0%, #b45309 100%);
  color: #ffffff;
  font-size: 26px;
  font-weight: 700;
  border-color: transparent;
  box-shadow:
    0 4px 22px rgba(180, 83, 9, 0.52),
    inset 0 1px 0 rgba(255, 255, 255, 0.26);
}
.btn-equals:hover {
  background: linear-gradient(150deg, #fbbf24 0%, #d97706 100%);
  transform: translateY(-2px);
  box-shadow:
    0 8px 32px rgba(217, 119, 6, 0.62),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

/* ── Scientific — sin  cos ── */
.btn-span2 {
  grid-column: span 2;
}

.btn-scientific {
  background: rgba(16, 185, 129, 0.14);
  color: rgba(255, 255, 255, 0.9);
  font-size: 17px;
  font-weight: 500;
  font-style: italic;
  letter-spacing: 0.5px;
  border-color: rgba(16, 185, 129, 0.2);
  box-shadow:
    0 2px 8px rgba(0, 0, 0, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.07);
}
.btn-scientific:hover {
  background: rgba(16, 185, 129, 0.26);
  border-color: rgba(16, 185, 129, 0.35);
  box-shadow:
    0 8px 24px rgba(0, 0, 0, 0.34),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}
