:root {
  --bg-color: #030321;
  --btn-bg: #fff;
  --btn-color: #300e0e;
  --operator-color: #020524;
  --equal-bg: #04164b;
  --equal-color: #fff;
  --display-bg: #111;
  --display-color: #fff;
  --border-radius: 15px;
  --font-size: 1.5rem;
  --button-size: 70px;
  --shadow-color: rgba(233, 227, 227, 0.5);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #797982 0%, #03235b 100%);
  overflow: hidden;
  perspective: 1000px;
}

.scene {
  position: relative;
  width: 100%;
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  transform-style: preserve-3d;
}

.calculator-container {
  position: relative;
  transform: translateZ(50px);
  animation: float 6s ease-in-out infinite;
}

.calculator {
  background-color: var(--bg-color);
  padding: 20px;
  border-radius: var(--border-radius);
  box-shadow: 
    0 20px 50px rgba(0, 0, 0, 0.5),
    0 0 0 2px rgba(255, 255, 255, 0.1);
  transform: rotateX(5deg) rotateY(5deg);
  transform-style: preserve-3d;
  transition: transform 0.3s ease;
}

.calculator:hover {
  transform: rotateX(7deg) rotateY(7deg) translateZ(10px);
}

.display {
  background-color: var(--display-bg);
  color: var(--display-color);
  padding: 20px;
  font-size: 2rem;
  text-align: right;
  border-radius: var(--border-radius);
  margin-bottom: 15px;
  min-width: calc(var(--button-size) * 4);
  box-shadow: inset 0 0 15px rgba(0, 0, 0, 0.5);
  position: relative;
  overflow: hidden;
}

.display::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(to right, transparent, rgba(255, 255, 255, 0.2), transparent);
}

.previous {
  font-size: 1rem;
  opacity: 0.7;
  min-height: 1.2rem;
}

.current {
  min-height: 2.5rem;
  font-weight: 500;
  letter-spacing: 1px;
}

.buttons {
  display: grid;
  grid-template-columns: repeat(4, var(--button-size));
  gap: 10px;
  transform-style: preserve-3d;
}

.btn {
  font-size: var(--font-size);
  padding: 15px;
  border: none;
  border-radius: var(--border-radius);
  background-color: var(--btn-bg);
  color: var(--btn-color);
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  transform-style: preserve-3d;
  box-shadow: 
    0 6px 0 rgba(0, 0, 0, 0.2),
    0 4px 8px rgba(0, 0, 0, 0.3);
  outline: none;
  user-select: none;
}

.btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(to bottom, rgba(255,255,255,0.3), transparent);
  border-radius: var(--border-radius);
  z-index: 1;
  pointer-events: none;
}

.btn:hover {
  background-color: #f0f0f0;
  transform: translateY(-3px) translateZ(5px);
  box-shadow: 
    0 8px 0 rgba(0, 0, 0, 0.2),
    0 6px 12px rgba(0, 0, 0, 0.4);
}

.btn:active {
  transform: translateY(4px) translateZ(0);
  box-shadow: 
    0 2px 0 rgba(0, 0, 0, 0.2),
    0 1px 4px rgba(0, 0, 0, 0.2);
  transition: all 0.1s ease;
}

.btn.function {
  background-color: #a5a5a5;
  color: #000;
}

.btn.function:hover {
  background-color: #c5c5c5;
}

.operator {
  color: var(--operator-color);
  font-weight: bold;
}

.equal {
  background-color: var(--equal-bg);
  color: var(--equal-color);
  font-weight: bold;
}

.equal:hover {
  background-color: #2980b9;
}

.zero {
  grid-column: span 2;
}

.footer {
  position: fixed;
  bottom: 20px;
  width: 100%;
  text-align: center;
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.8);
  font-family: Arial, sans-serif;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
  pointer-events: none;
  z-index: 10;
}

.btn::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: var(--border-radius);
  background: linear-gradient(145deg, #ffffff, #e6e6e6);
  transform: translateZ(-5px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  z-index: -1;
}

@keyframes float {
  0% {
    transform: translateY(0px) translateZ(50px);
  }
  50% {
    transform: translateY(-15px) translateZ(50px);
  }
  100% {
    transform: translateY(0px) translateZ(50px);
  }
}

.particles {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: -1;
}

.particle {
  position: absolute;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 50%;
  animation: particle-float linear infinite;
}

@keyframes particle-float {
  to {
    transform: translateY(-100vh);
  }
}

@media (max-width: 480px) {
  :root {
    --button-size: 60px;
    --font-size: 1.3rem;
  }
  
  .calculator {
    padding: 15px;
  }
  
  .display {
    padding: 15px;
    font-size: 1.8rem;
  }
}