* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  font-family: 'Space Grotesk', -apple-system, BlinkMacSystemFont, sans-serif;
  background: linear-gradient(145deg, #0f0f1a 0%, #1a1a2e 50%, #16213e 100%);
  min-height: 100vh;
}

.calculator {
  width: 100%;
  max-width: 320px;
  background: linear-gradient(165deg, #2d2d44 0%, #1f1f2e 100%);
  border-radius: 28px;
  padding: 20px;
  box-shadow: 
    0 25px 60px rgba(0, 0, 0, 0.5),
    0 0 0 1px rgba(255, 255, 255, 0.05),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.display-container {
  background: linear-gradient(180deg, #0d0d14 0%, #141420 100%);
  border-radius: 16px;
  padding: 16px 20px;
  margin-bottom: 16px;
  min-height: 100px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: flex-end;
  box-shadow: 
    inset 0 2px 8px rgba(0, 0, 0, 0.5),
    0 1px 0 rgba(255, 255, 255, 0.05);
}

.expression {
  font-family: 'JetBrains Mono', monospace;
  font-size: 14px;
  color: #6b7280;
  margin-bottom: 4px;
  min-height: 20px;
  font-weight: 400;
}

.display {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 300;
  color: #ffffff;
  text-align: right;
  word-break: break-all;
  transition: font-size 0.15s ease;
  text-shadow: 0 0 20px rgba(255, 255, 255, 0.1);
}

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

.calc-btn {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 22px;
  font-weight: 500;
  border: none;
  border-radius: 16px;
  height: 64px;
  cursor: pointer;
  transition: all 0.1s ease;
  position: relative;
  overflow: hidden;
}

.calc-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(180deg, rgba(255,255,255,0.1) 0%, transparent 50%);
  border-radius: 16px;
  pointer-events: none;
}

.calc-btn:active,
.calc-btn.pressed {
  transform: scale(0.95);
}

.btn-number {
  background: linear-gradient(165deg, #3d3d52 0%, #2a2a3d 100%);
  color: #ffffff;
  box-shadow: 
    0 4px 12px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.btn-number:hover {
  background: linear-gradient(165deg, #4a4a62 0%, #353548 100%);
}

.btn-number:active,
.btn-number.pressed {
  background: linear-gradient(165deg, #2a2a3d 0%, #1f1f2e 100%);
  box-shadow: 
    0 2px 6px rgba(0, 0, 0, 0.4),
    inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

.btn-function {
  background: linear-gradient(165deg, #505068 0%, #3d3d52 100%);
  color: #ffffff;
  box-shadow: 
    0 4px 12px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.btn-function:hover {
  background: linear-gradient(165deg, #5d5d78 0%, #4a4a62 100%);
}

.btn-function:active,
.btn-function.pressed {
  background: linear-gradient(165deg, #3d3d52 0%, #2a2a3d 100%);
}

.btn-operator {
  background: linear-gradient(165deg, #ff9f43 0%, #ee5a24 100%);
  color: #ffffff;
  box-shadow: 
    0 4px 16px rgba(238, 90, 36, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.btn-operator:hover {
  background: linear-gradient(165deg, #ffab5c 0%, #f56c3e 100%);
}

.btn-operator:active,
.btn-operator.pressed {
  background: linear-gradient(165deg, #e8912f 0%, #d94d1a 100%);
  box-shadow: 
    0 2px 8px rgba(238, 90, 36, 0.5),
    inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

.btn-equals {
  background: linear-gradient(165deg, #00d2d3 0%, #0984e3 100%);
  color: #ffffff;
  box-shadow: 
    0 4px 16px rgba(9, 132, 227, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.btn-equals:hover {
  background: linear-gradient(165deg, #1ae5e5 0%, #2d9cef 100%);
}

.btn-equals:active,
.btn-equals.pressed {
  background: linear-gradient(165deg, #00b8b8 0%, #0770c4 100%);
  box-shadow: 
    0 2px 8px rgba(9, 132, 227, 0.5),
    inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

.col-span-2 {
  grid-column: span 2;
}

.footer {
  margin-top: 24px;
  text-align: center;
}

.footer a {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.3);
  text-decoration: none;
  transition: color 0.2s ease;
}

.footer a:hover {
  color: rgba(255, 255, 255, 0.6);
}

@media (max-width: 380px) {
  .calculator {
    padding: 16px;
    border-radius: 24px;
  }
  
  .calc-btn {
    height: 58px;
    font-size: 20px;
    border-radius: 14px;
  }
  
  .display {
    font-size: 42px;
  }
  
  .display.text-4xl {
    font-size: 32px;
  }
  
  .display.text-3xl {
    font-size: 24px;
  }
}

@media (min-width: 768px) {
  .calculator {
    max-width: 340px;
  }
  
  .calc-btn {
    height: 70px;
    font-size: 24px;
  }
}