* { box-sizing: border-box; }
html, body { height: 100%; }
body{
  margin:0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans TC", Arial, sans-serif;
  background:#ffffff;
  display:grid;
  place-items:center;
}

.wrap{ padding:16px; }

.calc{
  width: 360px;
  background:#fff;
  border:1px solid #e6e6e6;
  padding:14px;
  box-shadow: 0 2px 10px rgba(0,0,0,.06);
}

.display{
  height:56px;
  border:1px solid #e3e3e3;
  background:#fff;
  margin-bottom:14px;
  display:flex;
  align-items:center;
  justify-content:flex-end;
  padding:10px 12px;
}

.display-text{
  width:100%;
  text-align:right;
  font-size:22px;
  color:#333;
  word-break: break-all;
}

.grid{
  display:grid;
  grid-template-columns: repeat(4, 1fr);
  gap:12px;
}

.btn{
  height:46px;
  border:1px solid #e3e3e3;
  background:#fff;
  color:#555;
  font-size:18px;
  cursor:pointer;
}

.btn:hover{ background:#fafafa; }
.btn:active{ transform: translateY(1px); }

.op{
  background:#dcdcdc;
  border-color:#d0d0d0;
  color:#444;
}

.fn{
  background:#fff;
}

.eq{
  background:#dcdcdc;
  border-color:#d0d0d0;
  color:#444;
  grid-column: 4;
  grid-row: 2 / span 4;   /* 從第2排開始，跨4排，變成右側直條 */
  height: auto;           /* 讓它跟著 grid 高度拉長 */
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:22px;
}
