* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  background: #222;
  font-family: 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
  display: flex;
  justify-content: center;
  align-items: center;
}

#calculator-container {
  width: 100%;
  max-width: 360px;
  overflow: hidden;
}

.calculator {
  width: 100%;
  background: #333;
  padding: 20px;  
  box-sizing: border-box;
}

.display {
  background: #000;
  color: #0f0;
  font-size: 1.1rem;
  padding: 15px 20px;
  border-bottom-left-radius: 8px;
  border-bottom-right-radius: 8px;
  text-align: right;
  user-select: none;
  min-height: 60px;
  overflow-x: auto;
  white-space: nowrap;
}

.operand {
  background: #060606;
  color: #ff9500;
  font-size: 0.85rem;
  padding: 10px 20px;
  border-top-left-radius: 8px;
  border-top-right-radius: 8px;
  text-align: right;
  user-select: none;
  min-height: 40px;
}

.buttons {
  margin-top: 20px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

button {
  width: 100%;
  padding: 16px;
  font-size: 1.2rem;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  background: #555;
  color: #eee;
  transition: background 0.2s ease;
  user-select: none;
  min-width: 0; /* 🔑 allow shrinking */
}

button.operator {
  background: #ff9500;
  color: #fff;
}

button.operator:hover {
  background: #e08900;
}

button.number:hover {
  background: #777;
}

button.equals {
  background: #00b894;
  color: white;
  grid-column: span 4;
  font-size: 1.5rem;
}

button.equals:hover {
  background: #019f7a;
}

button.clear {
  background: #d63031;
  color: white;
}

button.clear:hover {
  background: #b0201f;
}

button.del {
  background: #f39c12;
  color: white;
}

button.del:hover {
  background: #e67e22;
}
