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

body {
  min-height: 100vh;
  background: #1a1a1a;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Nunito', sans-serif;
}

/* the whole calculator body */
.calc {
  width: 320px;
  background: #2a2a2a;
  border-radius: 28px;
  padding: 20px;
  box-shadow:
    0 30px 80px rgba(0,0,0,0.6),
    inset 0 1px 0 rgba(255,255,255,0.05);
}

/* ── Display ─────────────────────────────── */
.display-wrap {
  background: #1a1a1a;
  border-radius: 16px;
  padding: 16px 20px 12px;
  margin-bottom: 18px;
  min-height: 100px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: flex-end;
  gap: 4px;
  overflow: hidden;
}

/* small expression line above */
.expr {
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.8rem;
  color: #555;
  min-height: 18px;
  text-align: right;
  word-break: break-all;
}

/* main number display */
.display {
  font-family: 'Share Tech Mono', monospace;
  font-size: 2.6rem;
  color: #f0f0f0;
  text-align: right;
  word-break: break-all;
  line-height: 1.1;
  transition: font-size 0.15s;
}

/* shrink font for long numbers */
.display.small { font-size: 1.7rem; }
.display.xsmall { font-size: 1.2rem; }

/* ── Button Grid ─────────────────────────── */
.calButtons {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

/* base button */
.btn {
  height: 68px;
  border: none;
  border-radius: 16px;
  font-size: 1.3rem;
  font-family: 'Nunito', sans-serif;
  font-weight: 600;
  cursor: pointer;
  background: #3a3a3a;
  color: #e8e8e8;
  position: relative;
  /* subtle top highlight to simulate physical depth */
  box-shadow:
    0 4px 0 #111,
    inset 0 1px 0 rgba(255,255,255,0.07);
  transition: transform 0.08s, box-shadow 0.08s, background 0.15s;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.btn:hover {
  background: #444;
}

/* pressed-down physical feel */
.btn:active,
.btn.pressed {
  transform: translateY(3px);
  box-shadow:
    0 1px 0 #111,
    inset 0 1px 0 rgba(255,255,255,0.04);
}

/* ── Button Variants ─────────────────────── */

/* AC — red-ish */
.btn-ac {
  background: #c0392b;
  color: #fff;
  box-shadow:
    0 4px 0 #7b241c,
    inset 0 1px 0 rgba(255,255,255,0.1);
}
.btn-ac:hover { background: #e74c3c; }
.btn-ac:active, .btn-ac.pressed {
  transform: translateY(3px);
  box-shadow: 0 1px 0 #7b241c;
}

/* % and +/- — slightly lighter gray */
.btn-func {
  background: #4a4a4a;
  color: #ddd;
}
.btn-func:hover { background: #555; }

/* operators — warm amber */
.btn-op {
  background: #e67e22;
  color: #fff;
  font-size: 1.5rem;
  box-shadow:
    0 4px 0 #a04000,
    inset 0 1px 0 rgba(255,255,255,0.12);
}
.btn-op:hover { background: #f39c12; }
.btn-op:active, .btn-op.pressed {
  transform: translateY(3px);
  box-shadow: 0 1px 0 #a04000;
}
/* lit up when that op is active */
.btn-op.active {
  background: #fff;
  color: #e67e22;
}

/* 0 — spans 2 columns, left-aligned text */
.btn-zero {
  grid-column: 1 / 3;
  text-align: left;
  padding-left: 24px;
  font-size: 1.3rem;
}

/* = — green */
.btn-eq {
  background: #27ae60;
  color: #fff;
  font-size: 1.5rem;
  box-shadow:
    0 4px 0 #1a6e3c,
    inset 0 1px 0 rgba(255,255,255,0.1);
}
.btn-eq:hover { background: #2ecc71; }
.btn-eq:active, .btn-eq.pressed {
  transform: translateY(3px);
  box-shadow: 0 1px 0 #1a6e3c;
}
