* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: monospace;
  user-select: none;
}

:root {
  --primary-color: oklch(54.6% 0.245 262.881);
  --secondary-color: oklch(54.6% 0.245 262.881);
  --bg-color: oklch(80.9% 0.105 251.813);
}

body {
  background-color: hsl(240, 100%, 85%);
  height: 100dvh;
  width: 100%;
}

.body {
  width: 100%;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  /* border: 2px solid red; */
}

#calculatorcont {
  width: 30%;
  max-width: 50%;
  height: 500px;
  display: flex;
  flex-direction: column;
  margin: auto;
  padding: 15px;
  background-color: black;
  border-radius: 1rem;
}

@media screen and (max-width: 350px) {
  #calculatorcont {
    width: 90%;
  }
}

#display {
  width: 100%;
  height: 7rem;
  color: white;
  background-color: hsl(0, 0%, 30%);
  font-size: 4rem;
  border: none;
  padding-left: 1rem;
  border-radius: 0.5rem;
}

#keyscont {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-top: 10px;
}

.numbtn,
#operator {
  width: 75px;
  height: 75px;
  border-radius: 50px;
  border: none;
  font-size: 3rem;
  font-weight: 800;
  background-color: hsl(0, 0%, 40%);
  color: white;
  text-shadow: 2px 3px rgb(8, 8, 8);
  transition: all ease-in 0.1s;
  cursor: pointer;
}

#operator {
  background-color: var(--primary-color);
  font-weight: 900;
  transition: all ease-in 0.1s;
}
#operator {
  background-color: coral;
}

#operator:hover {
  background-color: oklch(50.349% 0.23714 262.88);
  font-size: 3.4rem;
}
#operator:active {
  background-color: hsl(20, 80%, 90%);
  scale: 96%;
}

.numbtn:hover {
  background-color: hsl(0, 0%, 70%);
  font-size: 3.4rem;
}
.numbtn:active {
  background-color: hsl(0, 0%, 90%);
  scale: 96%;
}

#clearbackbtns {
  margin-top: 1.5rem;
  display: flex;
  width: 80%;
  margin-inline: auto;
  justify-content: center;
  align-items: center;
  align-content: space-between;
  gap: 2rem;
  /* border: 2px solid white; */
}

.clearbtn,
.backbtn {
  flex-grow: 1;
  padding: 0.7rem 1rem;
  border-radius: 10px;
  background-color: var(--primary-color);
  color: white;
  border: none;
  font-weight: 700;
  cursor: pointer;
  font-size: 1.4rem;
  /* text-shadow: 2px 2px rgb(8, 8, 8); */
}

.clearbtn {
  background-color: rgb(174, 16, 16);
}

/* Tablet (601px – 1024px) */
@media screen and (max-width: 1024px) {
  #calculatorcont {
    width: 55%;
    max-width: 70%;
    height: auto;
  }

  .numbtn,
  #operator {
    width: 100%;
    height: 60px;
    font-size: 2rem;
  }

  #operator:hover {
    font-size: 2.3rem;
  }

  .numbtn:hover {
    font-size: 2.3rem;
  }

  #display {
    font-size: 3rem;
    height: 5.5rem;
  }

  .clearbtn,
  .backbtn {
    font-size: 1.2rem;
  }
}

/* Mobile (max 600px) */
@media screen and (max-width: 600px) {
  #calculatorcont {
    width: 92%;
    max-width: 100%;
    height: auto;
    padding: 12px;
    margin-top: 6%;
  }

  #display {
    height: 4.5rem;
    font-size: 2.2rem;
  }

  #keyscont {
    gap: 8px;
    margin-top: 8px;
  }

  .numbtn,
  #operator {
    width: 100%;
    height: 55px;
    font-size: 1.6rem;
    border-radius: 30px;
  }

  #operator:hover {
    font-size: 1.8rem;
  }

  .numbtn:hover {
    font-size: 1.8rem;
  }

  #clearbackbtns {
    width: 100%;
    gap: 1rem;
    margin-top: 1rem;
  }

  .clearbtn,
  .backbtn {
    font-size: 1rem;
    padding: 0.6rem 0.8rem;
  }
}

/* Very small screens (max 350px) — extends existing rule */
@media screen and (max-width: 350px) {
  #calculatorcont {
    width: 96%;
    padding: 8px;
  }

  #display {
    height: 4rem;
    font-size: 1.8rem;
  }

  .numbtn,
  #operator {
    height: 48px;
    font-size: 1.4rem;
  }

  #keyscont {
    gap: 6px;
  }

  .clearbtn,
  .backbtn {
    font-size: 0.9rem;
  }
}
