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

body {
    display: flex;
    justify-content: center; /* 左右の中央揃え */
    align-items: center;     /* 上下の中央揃え */
    min-height: 100vh;       /* 画面の高さいっぱいに広げる */
    background-color: #f8f9fa; /* お好みで背景色を指定 */
}

.calculator {
    background-color: #f2f2f2;
    padding: 20px;
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
    border: solid 1px #ccc;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
    border-radius: 5px;
}

#result {
    width: 100%;
    padding: 10px;
    font-size: 24px;
    border: none;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3)inset;
    border-radius: 5px;
}

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

button {
    padding: 10px;
    font-size: 24px;
    border: none;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.all-clear, .clear, .percent, .operator {
    background-color: #aaa;
    color: #333
}

.equals {
    background-color: #0074d9;
    color: #fff
}

.number, .parentheses {
    background-color: #fff;
    color: #333
}

/* PCなど、マウス操作ができるデバイスのみ hover を効かせる */
@media (hover: hover) {
    button:hover {
        background-color: #ddd;
    }
    .all-clear, .clear, .operator, .percent {
    background-color: #aaa;
    }

    /* ＝ ボタン（青色） */
    .equals {
        background-color: #0074d9;
        color: white; /* 文字を白にして見やすく */
    }
}

/* スマホなどで押した瞬間の手応えが欲しい場合は :active を使う */
button:active {
    background-color: #bbb;
}