:root {
  --color-btn: #17bebb;
  --color-background: #e0e5ec;
  --color-box-shadow: #a3b1c6;
  --color-shadow-light: rgba(255, 255, 255, 0.6);
  --color-shadow-dark: rgba(163, 177, 198, 0.5);
  box-sizing: border-box;
}

/* Global reset & typography */
*,
*::before,
*::after {
  box-sizing: inherit;
  margin: 0;
  padding: 0;
}

body {
  width: 100%;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  font-family: Verdana, Geneva, Tahoma, sans-serif;
  font-size: 1rem;
  background: linear-gradient(
    120deg,
    var(--color-background) 0%,
    #ffffff 40%,
    #b0b0b0 100%
  );
  background-size: 200% 200%;
  animation: shine 8s ease-in-out infinite alternate;
  overflow-x: hidden;
  color: #333;
  padding: 1rem; /* small padding so content never touches screen edges */
}

/* Brand heading */
h1 {
  margin-bottom: 40px;
  text-align: center;
  font-size: 2.2rem;
  background: linear-gradient(to left, #22d3ee, #9333ea);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Keyframes to “slide” the gradient for a subtle shine */
@keyframes shine {
  0% {
    background-position: 0% 50%;
  }
  100% {
    background-position: 100% 50%;
  }
}

/* Calculator wrapper */
#calculator {
  max-width: 360px;
  width: 90%;
  padding: 25px 30px;
  background: var(--color-background);
  border-radius: 20px;
  box-shadow: 8px 8px 16px var(--color-box-shadow),
    -8px -8px 16px var(--color-shadow-light);
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Display area */
.screen {
  width: 100%;
  border: none;
}

#result {
  width: 100%;
  text-align: right;
  padding: 12px 18px;
  font-size: 1.4rem;
  font-weight: bold;
  border-radius: 12px;
  background: var(--color-background);
  box-shadow: inset 4px 4px 8px var(--color-box-shadow),
    inset -4px -4px 8px var(--color-shadow-light);
  outline: none;
  border: none;
}

/* Button grid */
.buttons {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

/* Individual buttons */
button {
  border: none;
  border-radius: 16px;
  padding: 20px;
  font-size: 1.2rem;
  font-weight: bold;
  background: #e0e5ec;
  box-shadow: 6px 6px 12px var(--color-box-shadow),
    -6px -6px 12px var(--color-shadow-light);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

button:hover {
  background: var(--color-btn);
  color: #fff;
  box-shadow: 6px 6px 12px #98dfea, -6px -6px 12px #98dfea;
  transform: scale(1.05);
  cursor: pointer;
}

.buttons .operator {
  color: var(--color-btn);
}
.buttons .operator:hover {
  color: #fff;
}

/* ---------------------- */
/*      RESPONSIVE        */
/* ---------------------- */

/* For small tablets and large phones */
@media (max-width: 600px) {
  h1 {
    font-size: 1.8rem;
    margin-bottom: 25px;
  }

  #calculator {
    max-width: 95%;
    padding: 20px;
    gap: 16px;
  }

  #result {
    font-size: 1.2rem;
    padding: 10px 14px;
  }

  button {
    padding: 16px;
    font-size: 1.1rem;
  }
}

/* Very small phones (narrower than ~400px) */
@media (max-width: 400px) {
  h1 {
    font-size: 1.5rem;
  }

  .buttons {
    gap: 8px;
  }

  button {
    padding: 14px;
    font-size: 1rem;
  }
}
