* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px 12px;
  font-family: Arial, sans-serif;
  background: #0b1220;
}

.calc {
  width: min(360px, 92vw);
  background: #111a2e;
  padding: 16px;
  border-radius: 16px;
}

#d {
  background: #0b1220;
  color: white;
  padding: 14px;
  border-radius: 12px;
  text-align: right;
  font-size: clamp(22px, 6vw, 32px);
  font-weight: bold;
  margin-bottom: 12px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.center-row {
  grid-column: 1 / -1;
  display: flex;
  justify-content: center;
  gap: 10px;
}

.center-row button {
  width: 100%;
}

button {
  padding: clamp(10px, 2.6vw, 14px);
  font-size: clamp(14px, 3.5vw, 18px);
  border: 0;
  border-radius: 12px;
  background: #172342;
  color: white;
  cursor: pointer;
}

button:active {
  transform: scale(0.98);
}

.danger {
  background: #4a1f2a;
}

.equal {
  background: #2a6df6;
}

.op {
  background: #1a2a55;
}

@media (max-width: 360px) {
  .grid {
    gap: 8px;
  }
  .center-row {
    gap: 8px;
  }
}
