/* Reset and base */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

body {
  background: #121212;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
  user-select: none;
}

/* Calculator container */
#calculator {
  background: #1f1f2e;
  border-radius: 14px;
  padding: 28px;
  width: 340px;
  max-width: 95vw;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* Display */
#display-container {
  background: #2a2a3b;
  color: #fdfdfd;
  font-size: clamp(1.8rem, 3vw, 2.5rem);
  text-align: right;
  padding: 24px 28px;
  border-radius: 12px;
  height: 130px;
  overflow-x: hidden;
  white-space: normal;
  word-break: break-word;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  font-family: "Roboto Mono", monospace;
  letter-spacing: 1.2px;
}

/* Buttons container */
#buttons-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Rows */
.button-row {
  display: flex;
  gap: 12px;
}

/* Buttons - base style */
.button-row button {
  flex: 1;
  padding: 18px 0;
  font-size: 1.3rem;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  background: #3a3a4f;
  color: #eaeaea;
  transition: background 0.3s ease, transform 0.1s ease;
  user-select: none;
  letter-spacing: 0.04em;
  text-align: center;
}

.button-row button:hover:not(:disabled) {
  background: #4a4a63;
}

.button-row button:active:not(:disabled) {
  transform: scale(0.95);
}

/* Operator buttons */
button[data-key="/"],
button[data-key="*"],
button[data-key="-"],
button[data-key="+"] {
  background: #f39c12;
  color: white;
  font-weight: 700;
  letter-spacing: 0.05em;
}

button[data-key="/"]:hover:not(:disabled),
button[data-key="*"]:hover:not(:disabled),
button[data-key="-"]:hover:not(:disabled),
button[data-key="+"]:hover:not(:disabled) {
  background: #e08e0b;
}

/* Equals */
button[data-key="="] {
  background: #3498db;
  color: white;
  font-weight: 700;
  letter-spacing: 0.05em;
}

button[data-key="="]:hover:not(:disabled) {
  background: #2980b9;
}

/* Clear */
#clear {
  background: #e74c3c;
  color: white;
  font-weight: 700;
  letter-spacing: 0.06em;
}

#clear:hover:not(:disabled) {
  background: #c0392b;
}

/* Backspace */
#backspace-btn {
  background: #9b59b6;
  color: white;
  font-weight: 700;
  letter-spacing: 0.05em;
}

#backspace-btn:hover:not(:disabled) {
  background: #884ea0;
}

/* Decimal disabled */
#decimal-btn:disabled {
  background: #777;
  cursor: not-allowed;
  color: #bbb;
}

/* Focus outline */
.button-row button:focus-visible {
  outline: 3px solid #f39c12;
  outline-offset: 3px;
}

/* Responsive small screens */
@media (max-width: 460px) {
  #calculator {
    width: 95vw;
    padding: 20px;
  }

  #display-container {
    height: 110px;
    font-size: 1.8rem;
    padding: 18px 22px;
  }

  .button-row button {
    font-size: 1.1rem;
    padding: 14px 0;
  }

  #clear,
  #backspace-btn {
    font-size: 1.1rem;
  }
}
