@import url("https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700&family=Press+Start+2P&display=swap");

:root {
  --primary: #00f7ff;
  --secondary: #ff00aa;
  --bg: #0a0a20;
  --display-bg: #001515;
  --button-bg: #1a1a3a;
}

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

body {
  background-color: var(--bg);
  font-family: "Orbitron", sans-serif;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  overflow: hidden;
  color: var(--primary);
  perspective: 1000px;
}

.stars {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
}

.star {
  position: absolute;
  background-color: white;
  border-radius: 50%;
  animation: twinkle var(--duration, 5s) infinite ease-in-out;
}

@keyframes twinkle {
  0%,
  100% {
    opacity: 0.2;
  }
  50% {
    opacity: 1;
  }
}

.calculator {
  width: 320px;
  background: rgba(10, 10, 40, 0.8);
  border-radius: 20px;
  padding: 20px;
  box-shadow: 0 0 30px rgba(0, 247, 255, 0.5), 0 0 60px rgba(255, 0, 170, 0.3);
  backdrop-filter: blur(10px);
  border: 1px solid var(--primary);
  transform-style: preserve-3d;
  transition: transform 0.5s;
  position: relative;
  overflow: hidden;
}

.calculator::before {
  content: "";
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(
    to bottom right,
    transparent,
    transparent,
    transparent,
    var(--primary),
    transparent,
    transparent,
    transparent
  );
  transform: rotate(30deg);
  animation: shine 6s infinite;
  opacity: 0.3;
}

@keyframes shine {
  0% {
    transform: rotate(30deg) translate(-30%, -30%);
  }
  100% {
    transform: rotate(30deg) translate(30%, 30%);
  }
}

.display {
  background-color: var(--display-bg);
  border: 2px solid var(--primary);
  border-radius: 10px;
  padding: 20px;
  margin-bottom: 20px;
  text-align: right;
  font-size: 2rem;
  font-weight: bold;
  height: 100px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: inset 0 0 10px rgba(0, 247, 255, 0.3);
  position: relative;
  overflow: hidden;
}

.display::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--primary), transparent);
  animation: scanline 4s linear infinite;
}

@keyframes scanline {
  0% {
    top: 0;
  }
  100% {
    top: 100%;
  }
}

.previous-operand {
  font-size: 1rem;
  color: rgba(0, 247, 255, 0.7);
  min-height: 1.2rem;
}

.current-operand {
  font-size: 2.5rem;
  color: var(--primary);
  word-wrap: break-word;
  word-break: break-all;
}

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

button {
  position: relative;
  height: 60px;
  border: none;
  border-radius: 10px;
  background-color: var(--button-bg);
  color: var(--primary);
  font-size: 1.5rem;
  font-family: "Orbitron", sans-serif;
  cursor: pointer;
  transition: all 0.3s;
  overflow: hidden;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(0, 247, 255, 0.2);
}

button::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(0, 247, 255, 0.4),
    transparent
  );
  transition: 0.5s;
}

button:hover::before {
  left: 100%;
}

button:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(0, 247, 255, 0.4);
  color: white;
}

button:active {
  transform: translateY(1px);
}

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

.operation {
  background-color: rgba(255, 0, 170, 0.2);
  color: var(--secondary);
}

.equals {
  background-color: var(--secondary);
  color: white;
}

.ac,
.del {
  background-color: rgba(255, 0, 170, 0.3);
}

.glow {
  animation: glow 2s infinite alternate;
}

@keyframes glow {
  from {
    box-shadow: 0 0 10px -10px var(--secondary);
  }
  to {
    box-shadow: 0 0 20px 5px var(--secondary);
  }
}

.floating {
  animation: floating 3s ease-in-out infinite;
}

@keyframes floating {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
}

.title {
  font-family: "Press Start 2P", cursive;
  text-align: center;
  margin-bottom: 15px;
  font-size: 1rem;
  color: var(--secondary);
  text-shadow: 0 0 10px var(--secondary);
  letter-spacing: 2px;
}

.power-light {
  width: 10px;
  height: 10px;
  background-color: #0f0;
  border-radius: 50%;
  display: inline-block;
  margin-right: 10px;
  box-shadow: 0 0 10px #0f0;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}
