body {
    font-family: Arial, sans-serif;
    line-height: 1.6;
    margin: 0;
    padding: 20px;
    background-color: #f4f4f4;
    line-break: anywhere;
}

.container {
    max-width: 80%;
    margin: auto;
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.hamburger-menu {
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    width: 30px;
    height: 25px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
}

.hamburger-menu span {
    width: 100%;
    height: 3px;
    background-color: #333;
    transition: 0.3s;
}

.hamburger-menu:hover span {
    background-color: #007BFF;
}

.input-section {
    transition: all 0.3s ease;
}

h1 {
    color: #333;
    margin: 0;
}

.form-group {
    margin-bottom: 20px;
    padding: 15px;
    border: 1px solid #ccc;
    border-radius: 8px;
    background-color: #fafafa;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

label {
    font-weight: bold;
    margin-bottom: 5px;
    display: block;
    margin-top: 10px;
}

input[type="text"], input[type="file"], textarea {
    width: calc(100% - 20px);
    padding: 10px;
    margin-top: 10px;
    margin-bottom: 20px;
    border-radius: 4px;
    border: 1px solid #ccc;
    box-sizing: border-box;
}

textarea {
    height: 150px;
    display: none;
}

button {
    width: auto;
    background-color: #007BFF;
    color: white;
    padding: 12px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    transition: background-color 0.3s ease;
    margin-top: 10px;
}

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

#output {
    margin-top: 30px;
    border: 1px solid #ddd;
    padding: 15px;
    background-color: #fff;
    border-radius: 4px;
}

.balloon_l, .balloon_r {
    margin: 30px 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: flex-start;
}

.balloon_r { align-items: flex-end; }

.speaker-name {
    font-weight: bold;
    font-size: 14px;
    color: #666;
    margin-bottom: 8px;
    padding-left: 8px;
    padding-right: 8px;
}

.balloon_r .speaker-name {
    text-align: right;
}

.says {
    max-width: 60%;
    display: flex;
    flex-wrap: wrap;
    position: relative;
    padding: 17px 13px 15px 18px;
    border-radius: 12px;
    box-sizing: border-box;
    margin: 0 !important;
    line-height: 1.5;
}

.says_l { background: #e0f0ff; }
.says_r { background: #f0ffe0; }

.says p { margin: 8px 0 0 !important; }
.says p:first-child { margin-top: 0 !important; }

.says:after {
    content: "";
    position: absolute;
    border: 10px solid transparent;
}

.balloon_l .says:after {
    left: -26px;
    border-right: 22px solid #e0f0ff;
}

.balloon_r .says:after {
    right: -26px;
    border-left: 22px solid #f0ffe0;
}

.img {
    width: 100%;
    height: auto;
}

.img img {
    width: 60%;
    height: auto;
    border: 3px solid #FFFFFF;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2), 0 6px 20px rgba(0, 0, 0, 0.19);
    transition: transform 0.3s ease;
}

.hidden {
    display: none;
}

/* 新しく追加したスタイル */
.info-section {
    margin-bottom: 20px;
}

.info-section p {
    margin: 0 0 10px 0;
}

.demo-section {
    display: flex;
    align-items: center;
    margin-top: 10px;
}

.demo-section span {
    margin-right: 10px;
}

.small-button {
    font-size: 14px;
    padding: 5px 10px;
    background-color: #007BFF;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

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

/* Convert ボタンのスタイルを個別に設定 */
button[onclick="convertChat()"] {
    width: 100%;
    margin-top: 20px;
}

/* アイコン入力とプレビューのレイアウト */
.icon-input-container {
    display: flex;
    align-items: center;
    margin-top: 10px;
}

.icon-input-container input[type="file"] {
    flex: 1;
    margin-right: 10px;
    margin-bottom: 0;
}

.icon-preview {
    width: 50px;
    height: 50px;
    border: 1px solid #ccc;
    border-radius: 4px;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

.icon-preview img {
    max-width: 100%;
    max-height: 100%;
    object-fit: cover;
}

/* レスポンシブデザインの調整 */
@media (max-width: 768px) {
    .container {
        max-width: 95%;
        margin: 10px auto;
        padding: 15px;
    }

    input[type="text"], input[type="file"], button {
        width: 100%;
    }

    .demo-section {
        flex-direction: column;
        align-items: flex-start;
    }

    .demo-section span {
        margin-bottom: 10px;
    }

    .small-button {
        width: auto;
    }
    .icon-input-container {
        flex-direction: column;
        align-items: flex-start;
    }

    .icon-input-container input[type="file"] {
        width: 100%;
        margin-right: 0;
        margin-bottom: 10px;
    }

    .icon-preview {
        align-self: center;
    }
    
    /* 吹き出しの幅を広げる */
    .says {
        max-width: 80%;  /* 60%から80%に変更 */
    }
}

/* 縦長画面（高さ > 幅）での追加調整 */
@media (orientation: portrait) {
    body {
        padding-left: 0;
        padding-right: 0;
    }

    .container {
        max-width: 100%;
        margin: 0;
        padding-left: 0;
        padding-right: 0;
    }

    .header {
        padding-left: 15px;
        padding-right: 15px;
    }

    /* 吹き出しの幅を広げる */
    .says {
        max-width: 85%;  /* 縦長画面ではさらに広く */
    }
}

/* さらに小さい画面用 */
@media (max-width: 480px) {
    .says {
        max-width: 90%;  /* より小さい画面では90%まで */
    }
}