* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: sans-serif;
  background-color: #000;
  color: #fff;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
  transition: background 0.3s, color 0.3s;
}

.calculator {
  width: 320px;
  background-color: #101010;
  border-radius: 10px;
  padding: 20px 15px;
  position: relative;
}

.toggle-mode {
  position: absolute;
  top: 10px;
  right: 10px;
  background-color: #333;
  color: white;
  border: none;
  padding: 5px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 1.4rem;
}

.display {
  color: #fff;
  text-align: right;
  padding: 40px 0 5px 0;
  overflow: hidden;
}

.expression {
  font-size: 1.5em;
  color: #aaa;
  min-height: 30px;
  white-space: nowrap;
  overflow-x: auto;
}

.result {
  font-size: 2.5em;
  font-weight: bold;
  color: #fff;
  min-height: 40px;
  white-space: nowrap;
  overflow-x: auto;
}

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

button {
  font-size: 1.4em;
  padding: 15px;
  background-color: #000;
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s;
}

button:hover {
  background-color: #222;
  border-radius: 8px;
}

body.light-mode {
  background: #C9CCD3;
 background-image: linear-gradient(-180deg, rgba(255,255,255,0.50) 0%, rgba(0,0,0,0.50) 100%);
 background-blend-mode: lighten;
  color: #000;
}

body.light-mode .calculator {
  background-color: #f0f0f0;
}

body.light-mode .display {
  color: #000;
}

body.light-mode .expression {
  color: #666;
}

body.light-mode .result {
  color: #000;
}

body.light-mode button {
  background-color: #ddd;
  color: #000;
}

body.light-mode button:hover {
  background-color: #ccc;
}

body.light-mode .toggle-mode {
  background-color: #ccc;
  color: #000;
}

/* ✅ RESPONSIVE DESIGN */
@media (max-width: 480px) {
  .calculator {
    width: 90%;
    padding: 15px;
  }

  .expression {
    font-size: 1.2em;
  }

  .result {
    font-size: 2em;
  }

  button {
    font-size: 1.2em;
    padding: 12px;
  }

  .buttons {
    gap: 10px;
  }
}

@media (max-width: 350px) {
  .expression {
    font-size: 1em;
  }

  .result {
    font-size: 1.6em;
  }

  button {
    font-size: 1em;
    padding: 10px;
  }

  .toggle-mode {
    font-size: 0.7em;
    padding: 3px 6px;
  }
}
