/* 全体 */
body {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  min-height: 100vh;
  margin: 0;
  padding: 20px;
  background: #f0f0f0;
  font-family: sans-serif;
}

h1 {
  margin-bottom: 20px;
  font-size: 2em;
  text-align: center;
  color: #333;
}

/* 電卓本体 */
.calculator {
  display: inline-block;
  text-align: center;
  background: #fff;
  padding: 20px;
  border-radius: 12px;
  box-shadow: 0 3px 10px rgba(0,0,0,0.15);
}

/* ディスプレイ */
#display {
  width: 100%;
  max-width: 320px;
  height: 80px;
  margin-bottom: 20px;
  text-align: right;
  font-size: 36px;
  padding: 0 15px;
  border-radius: 12px;
  border: 2px solid #ccc;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  background: #f9f9f9;
  box-sizing: border-box;
}

/* ボタングリッド */
.buttons {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-auto-rows: 70px;
  grid-gap: 5px;
}

/* ボタン共通 */
.buttons button {
  font-size: 1.5rem;
  border-radius: 8px;
  border: 1px solid #ccc;
  cursor: pointer;
  background: #f1f1f1;
  width: 100%;
  height: 100%;
}

.buttons button:hover {
  background: #007bff;
  color: #fff;
}

/* 0ボタン横2マス */
.buttons button.span2 {
  grid-column: span 2;
}

/* +ボタン縦2マス */
.buttons button.plus {
  grid-row: span 2;
}

/* =ボタン縦2マス */
.buttons button.equals {
  grid-row: span 2;
}

/* レスポンシブ調整 */
@media (max-width: 480px) {
  #display {
    height: 60px;
    font-size: 28px;
  }
  .buttons {
    grid-auto-rows: 50px;
  }
  .buttons button {
    font-size: 1.2rem;
  }
}
