body {
    font-family: sans-serif;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 15px;
    touch-action: manipulation; /* ダブルタップズーム防止 */
}

.controls {
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px; /* 要素間のスペース */
    flex-wrap: wrap; /* 画面が狭い時に折り返す */
}

.controls label {
    font-weight: bold;
}

.controls input[type="number"] {
    width: 60px;
    padding: 5px;
    font-size: 1em;
}

.controls button {
    padding: 8px 15px;
    font-size: 1em;
    cursor: pointer;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 4px;
}
.controls button:hover {
    background-color: #0056b3;
}
#resetButton {
    background-color: #6c757d;
}
#resetButton:hover {
    background-color: #5a6268;
}


.canvas-container {
    position: relative; /* 結果表示の基準点 */
    width: 95%;
    max-width: 500px; /* 最大幅 */
    margin-bottom: 15px;
    border: 1px solid #ccc;
    /* Aspect ratio (e.g., 1:1.5 for height) - adjust as needed */
    /* height is set via JavaScript based on width */
}

canvas {
    display: block; /* 余計なスペースをなくす */
    width: 100%;
    height: 100%; /* JavaScriptで設定 */
    background-color: #f8f9fa;
}

.result-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none; /* 下のCanvasをクリック可能にする */
    z-index: 10; /* Canvasより手前に表示 */
}

.result-text {
    margin-top: 10px;
    text-align: center;
    font-size: 1.1em;
    width: 95%;
    max-width: 500px;
}

.result-text span {
    font-weight: bold;
    color: #dc3545; /* 目立つ色 */
}
