/* 見本画像に準拠したデザイン */
:root {
    --bg-color: #ffffff;
    --display-bg: #ffffff;
    --display-text: #000000;
    --btn-blue-bg: #1a4a8d;
    --btn-text: #ffffff;
    --header-bg: #000000;
    --active-size-bg: #ff9d00;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: "Meiryo", "メイリオ", sans-serif;
    overflow: hidden; /* スクロール禁止 */
}

body {
    background-color: #fff;
    height: 100vh;
}

.calculator-container {
    background-color: #fff;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
}

/* タイトルバー */
.calculator-title {
    background-color: #ffffff;
    color: #000000;
    padding: 2px 10px;
    font-size: 0.8rem;
    font-weight: bold;
    border-bottom: 2px solid #ff4500;
}

/* 黒いヘッダー */
.calculator-header {
    background-color: var(--header-bg);
    display: flex;
    flex-direction: column;
    padding: 2px 10px;
}

.header-row {
    display: flex;
}

.header-top {
    justify-content: flex-end;
}

.header-bottom {
    justify-content: flex-start;
    min-height: 1.5rem;
    align-items: center;
}

.formula-display {
    color: #ffffff;
    font-size: 1rem;
    width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.size-controls {
    display: flex;
    gap: 2px;
}

.size-btn {
    border: 1px solid #000;
    background: var(--btn-blue-bg);
    color: white;
    padding: 1px 8px;
    font-size: 0.7rem;
    cursor: pointer;
}

.size-btn.active {
    background: var(--active-size-bg);
    color: #000;
}

/* 表示エリア */
.display-container {
    background-color: var(--display-bg);
    padding: 5px 10px;
    border-bottom: 1px solid #000;
}

.display {
    color: var(--display-text);
    font-size: 1.8rem;
    text-align: right;
    min-height: 2.2rem;
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

/* ボタン配置 */
.keypad {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    background-color: #000;
    gap: 1px;
    border-top: 1px solid #000;
}

.btn {
    border: none;
    font-size: 1.3rem;
    color: var(--btn-text);
    background-color: var(--btn-blue-bg);
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
}

.btn:active {
    opacity: 0.7;
}

/* 小サイズ時の調整 */
.size-small .display { font-size: 1.5rem; min-height: 1.8rem; }
.size-small .btn { font-size: 1.1rem; }

/* 中サイズ時の調整 (Default) */
.size-medium .display { font-size: 1.8rem; min-height: 2.2rem; }
.size-medium .btn { font-size: 1.3rem; }

/* 大サイズ時の調整 */
.size-large .display { font-size: 2.2rem; min-height: 2.6rem; }
.size-large .btn { font-size: 1.5rem; }
