@import url('https://fonts.googleapis.com/css2?family=DM+Mono:wght@400;500&family=Syne:wght@500;700&display=swap');

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  background: #0f0f0f;
  font-family: 'Syne', sans-serif;
}

.calculator {
  width: 320px;
  background: #161616;
  border-radius: 24px;
  padding: 1.5rem;
  border: 1px solid #2a2a2a;
}

.display-area {
  background: #0a0a0a;
  border-radius: 16px;
  padding: 1.25rem 1.25rem 1rem;
  margin-bottom: 1.25rem;
  min-height: 100px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: flex-end;
  border: 1px solid #222;
}

#expr {
  font-family: 'DM Mono', monospace;
  font-size: 13px;
  color: #555;
  margin-bottom: 6px;
  min-height: 18px;
  word-break: break-all;
  text-align: right;
}

#display {
  font-family: 'DM Mono', monospace;
  font-size: 36px;
  font-weight: 500;
  color: #f0f0f0;
  word-break: break-all;
  text-align: right;
  line-height: 1.1;
}

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

button {
  border: none;
  border-radius: 14px;
  font-family: 'Syne', sans-serif;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  padding: 18px 0;
  transition: transform 0.08s, background 0.1s;
  color: #e0e0e0;
  background: #222;
}

button:hover { background: #2c2c2c; }
button:active { transform: scale(0.93); }

.btn-op { background: #1e1e2e; color: #a78bfa; }
.btn-op:hover { background: #252535; }

.btn-eq {
  background: #7c3aed;
  color: #fff;
  grid-column: span 2;
}
.btn-eq:hover { background: #6d28d9; }

.btn-clear { background: #2a1a1a; color: #f87171; }
.btn-clear:hover { background: #331f1f; }

.btn-back { background: #1a1a2a; color: #818cf8; }
.btn-back:hover { background: #222233; }

.btn-zero { grid-column: span 2; }

.history {
  width: 320px;
  margin-top: 1rem;
}

.history-title {
  font-family: 'Syne', sans-serif;
  font-size: 12px;
  color: #444;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 0.5rem;
}

.history-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid #1f1f1f;
}

.history-expr {
  font-family: 'DM Mono', monospace;
  font-size: 13px;
  color: #444;
}

.history-result {
  font-family: 'DM Mono', monospace;
  font-size: 14px;
  font-weight: 500;
  color: #a78bfa;
}

.history-empty {
  font-family: 'DM Mono', monospace;
  font-size: 13px;
  color: #2a2a2a;
  text-align: center;
  padding: 1rem 0;
}