body {
    font-family: 'Arial', 'Hiragino Sans', 'Meiryo', sans-serif; /* 日本語フォントを優先 */
    margin: 0;
    padding: 20px;
    background-color: #f4f7f6;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 700px;
    margin: 0 auto;
    background-color: #fff;
    padding: 25px;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

h1 {
    color: #0056b3;
    text-align: center;
    margin-bottom: 10px;
    font-size: 2em;
}

h2 {
    color: #0056b3;
    text-align: center;
    margin-top: 30px;
    margin-bottom: 15px;
    font-size: 1.5em;
}

p {
    text-align: center;
    margin-bottom: 25px;
    color: #666;
}

.form-group {
    margin-bottom: 20px;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
    color: #555;
    font-size: 1.05em;
}

input[type="text"],
textarea {
    width: calc(100% - 24px); /* パディングとボーダーを考慮 */
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 1rem;
    box-sizing: border-box; /* パディングとボーダーを幅に含める */
    transition: border-color 0.3s ease;
}

input[type="text"]:focus,
textarea:focus {
    border-color: #007bff;
    outline: none;
}

textarea {
    resize: vertical; /* 縦方向のみリサイズ可能にする */
    min-height: 100px;
}

button {
    background-color: #007bff;
    color: white;
    padding: 12px 22px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    width: 100%;
    margin-top: 15px;
    transition: background-color 0.3s ease, transform 0.2s ease;
}

button:hover {
    background-color: #0056b3;
    transform: translateY(-1px);
}

button:active {
    transform: translateY(0);
}

.button-group {
    display: flex;
    flex-wrap: wrap; /* 小さい画面で折り返す */
    gap: 10px; /* ボタン間のスペース */
    margin-top: 20px;
}

.button-group button {
    flex: 1; /* 等しい幅にする */
    min-width: 150px; /* 最小幅を設定して小さくなりすぎないように */
    margin-top: 0; /* 親のmargin-topを無効化 */
}

/* 各ボタンの色 */
.red-button {
    background-color: #dc3545;
}
.red-button:hover {
    background-color: #c82333;
}
.green-button {
    background-color: #28a745;
}
.green-button:hover {
    background-color: #218838;
}
.orange-button { /* 画像保存ボタン用 */
    background-color: #fd7e14;
}
.orange-button:hover {
    background-color: #e66a00;
}
.purple-button {
    background-color: #6f42c1;
}
.purple-button:hover {
    background-color: #563d7c;
}

hr {
    border: 0;
    height: 1px;
    background: #eee;
    margin: 30px 0;
}

#savedData {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px dashed #ccc;
}

#displayArea {
    white-space: pre-wrap; /* 改行を保持 */
    /* 以前の基本的なスタイル */
    background-color: #fcfcfc; /* やや明るい背景色 */
    padding: 25px; /* パディング */
    border-radius: 12px; /* 角丸 */
    border: 2px solid #ddd; /* 薄いグレーの枠線 */
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08); /* わずかな影 */

    line-height: 1.9; /* 行の高さを調整して読みやすく */
    letter-spacing: 0.5px; /* 文字間隔を微調整 */
    font-size: 1.0em; /* 全体のフォントサイズをやや調整 */
    color: #2c3e50; /* 少し濃いめの文字色 */
    min-height: 150px; /* 最低限の高さを確保 */
}

/* スマートフォン向けの調整 */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    .container {
        padding: 15px;
        margin: 0 5px; /* 左右に少し余白 */
    }
    input[type="text"],
    textarea {
        width: calc(100% - 20px); /* パディングを考慮して調整 */
    }
    button {
        padding: 10px 15px;
        font-size: 0.95rem;
    }
    .button-group button {
        min-width: unset; /* 最小幅を解除して柔軟にする */
        flex-basis: calc(50% - 5px); /* 2列表示 */
    }
    h1 {
        font-size: 1.8em;
    }
    h2 {
        font-size: 1.3em;
    }
    #displayArea {
        padding: 18px; /* スマホでパディングを調整 */
    }
}

@media (max-width: 480px) {
    .button-group button {
        flex-basis: 100%; /* 1列表示 */
    }
}