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

body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #1a1a2e;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

.calculator {
  width: 320px;
  background: #16213e;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

.display {
  padding: 24px 24px 16px;
  text-align: right;
  min-height: 120px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.expression {
  color: #8892b0;
  font-size: 16px;
  min-height: 24px;
  word-break: break-all;
}

.result {
  color: #e6f1ff;
  font-size: 42px;
  font-weight: 300;
  margin-top: 4px;
  word-break: break-all;
}

.buttons {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  padding: 1px;
  background: #0f1a30;
}

.btn {
  background: #1a2744;
  border: none;
  color: #ccd6f6;
  font-size: 20px;
  padding: 22px;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}

.btn:hover { background: #233554; }
.btn:active { background: #2d4266; transform: scale(0.96); }

.btn.fn {
  background: #1e3a5f;
  color: #64ffda;
}
.btn.fn:hover { background: #264d73; }

.btn.op {
  background: #e94560;
  color: #fff;
}
.btn.op:hover { background: #f05675; }
.btn.op:active { background: #ff6b81; }

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