/* Fondo degradado moderno */
body {
  font-family: 'Poppins', sans-serif;
  background: linear-gradient(135deg, #e718d6, #2db4dd, #33e441);
  background-size: 400% 400%;
  animation: gradientMove 12s ease infinite;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
  margin: 0;
}

@keyframes gradientMove {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* Caja principal */
.calculator {
  background: rgba(30, 30, 50, 0.9);
  backdrop-filter: blur(10px);
  padding: 25px;
  border-radius: 20px;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
  width: 340px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  color: #fff;
  transition: transform 0.3s ease;
}

.calculator:hover {
  transform: scale(1.02);
}

.title {
  text-align: center;
  margin: 0;
  font-weight: 600;
  color: #00e6b8;
  text-shadow: 0 0 10px rgba(0, 255, 200, 0.7);
}

#display {
  width: 100%;
  height: 65px;
  font-size: 26px;
  text-align: right;
  border: none;
  background: #141426;
  color: #00ffe1;
  border-radius: 10px;
  padding: 12px;
  box-shadow: inset 0 0 10px rgba(0, 255, 200, 0.3);
}

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

.btn {
  background: #26264d;
  color: #fff;
  font-size: 20px;
  border: none;
  border-radius: 10px;
  padding: 15px;
  cursor: pointer;
  transition: all 0.25s ease;
}

.btn:hover {
  background: #3b3b78;
  transform: translateY(-2px);
}

.btn:active {
  background: #5656b8;
  transform: scale(0.96);
}

.btn.op {
  background: #0077b6;
}

.btn.op:hover {
  background: #00b4d8;
}

.equal {
  background: #00ffd1;
  color: #1e1e2f;
  font-weight: 600;
}

.equal:hover {
  background: #00e6b8;
}

/* Historial */
#history {
  background: #1a1a33;
  border-radius: 12px;
  padding: 10px;
  color: #d9faff;
  font-size: 14px;
  max-height: 180px;
  overflow-y: auto;
  box-shadow: inset 0 0 8px rgba(0, 255, 200, 0.1);
}

.history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.clear-history {
  background: #ff5555;
  color: white;
  border: none;
  border-radius: 8px;
  padding: 5px 10px;
  cursor: pointer;
  transition: background 0.2s ease;
  font-size: 13px;
}

.clear-history:hover {
  background: #ff7777;
}

#historyList {
  list-style: none;
  padding: 0;
  margin: 8px 0 0;
}

#historyList li {
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
  padding: 4px 0;
}

.hint {
  display: block;
  text-align: center;
  margin-top: 6px;
  color: #7fffd4;
  font-size: 12px;
  opacity: 0.8;
}

/* Responsive */
@media (max-width: 400px) {
  .calculator {
    width: 90%;
  }

  #display {
    font-size: 22px;
  }

  .btn {
    font-size: 18px;
  }
}
