body {
    font-family: sans-serif;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 0;
    background-color: #f0f0f0;
}

h1 {
    margin-top: 10px;
    color: #333;
}

.controls {
    margin: 10px 0 5px 0; /* 下マージンを少し減らす */
    display: flex;
    flex-wrap: wrap; /* Allow wrapping on smaller screens */
    gap: 15px; /* Spacing between controls */
    align-items: center;
    justify-content: center; /* Center controls */
    background-color: #fff;
    padding: 10px;
    border-radius: 5px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* 追加: オプションエリアのスタイル */
.options {
    margin: 5px 0 15px 0;
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    justify-content: center;
    align-items: flex-start; /* fieldsetの高さが違っても上揃え */
    background-color: #fff;
    padding: 5px 15px; /* 少し小さめに */
    border-radius: 5px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.options fieldset {
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: 5px 10px;
    margin: 0; /* デフォルトのマージンをリセット */
}

.options legend {
    font-size: 0.9em;
    font-weight: bold;
    padding: 0 5px;
    color: #555;
}

.options label {
    display: inline-block; /* チェックボックスとテキストを横並び */
    margin-right: 10px;
    font-size: 0.9em;
    cursor: pointer;
}
.options input[type="radio"],
.options input[type="checkbox"] {
     margin-right: 4px;
     vertical-align: middle; /* テキストと高さを合わせる */
}
/* --- */


.slider-container {
    display: flex;
    align-items: center;
    gap: 5px; /* Spacing within slider group */
}


button {
    padding: 8px 15px;
    font-size: 1em;
    cursor: pointer;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 4px;
    transition: background-color 0.2s;
}

button:hover {
    background-color: #0056b3;
}

button:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
}


#nDisplay {
    font-weight: bold;
    min-width: 50px; /* Ensure space */
    text-align: right;
}

label {
     font-size: 0.9em;
}

input[type="range"] {
    cursor: pointer;
}

span[id$="Value"] { /* Select spans ending with "Value" */
    font-weight: bold;
    min-width: 30px; /* Ensure space for value */
    text-align: right;
    background-color: #e9ecef;
    padding: 2px 5px;
    border-radius: 3px;
    font-size: 0.9em;
}


#drawingCanvas {
    border: 1px solid #ccc;
    background-color: #fff;
    cursor: crosshair;
    touch-action: none; /* Prevent default touch actions like scrolling */
}