body {
    font-family: sans-serif;
    line-height: 1.6;
    margin: 0;
    padding: 15px;
    background-color: #F8F8F8;
    color: #333;
    box-sizing: border-box;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}
*, *::before, *::after {
    box-sizing: inherit;
}
#container {
    width: 100%;
    margin: 0 auto;
    background-color: #FFF;
    border: 1px solid #DDD;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    height: calc(100vh - 30px);
    overflow: hidden;
}
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px #555 solid;
    padding-bottom: 10px;
    margin-bottom: 20px;
    flex-shrink: 0;
}
h1 {
    color: #555;
    margin: 0;
    padding: 0;
    flex-grow: 1;
}
.menu-container {
    position: relative;
    flex-shrink: 0;
}
.hamburger-menu {
    width: 30px;
    height: 20px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    cursor: pointer;
    padding: 0;
}
.hamburger-menu .bar {
    width: 100%;
    height: 4px;
    background-color: #555;
    border-radius: 2px;
}
.dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    background-color: #FFF;
    border: 1px solid #DDD;
    border-radius: 4px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    min-width: 150px;
    padding: 10px 0;
}
.dropdown-menu.show {
    display: block;
}
.dropdown-menu ul {
    list-style: none;
    padding: 0;
    margin: 0;
}
.dropdown-menu li {
    padding: 0;
}
.dropdown-menu li a {
    text-decoration: none;
    color: #333;
    display: block;
    padding: 5px 15px;
}
.dropdown-menu li a:hover {
    background-color: #F0F0F0;
}
#historyArea {
    flex-grow: 1;
    overflow-y: auto;
    margin-bottom: 10px;
    padding: 0 5px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.message {
    padding: 10px;
    border-radius: 5px;
    max-width: 90%;
    width: fit-content;
    word-break: break-word;
    overflow-wrap: break-word;
    box-sizing: border-box;
    position: relative;
}
.user-message {
    background-color: #E0E0E0;
    align-self: flex-end; 
}
.model-message {
    background-color: #E9ECEF;
    align-self: flex-start; 
}
.message > div {
    padding: 0;
}
.model-message > div {
    padding-right: 15px;
    padding-left: 5px;
    padding-top: 5px;
    padding-bottom: 5px;
}
#historyArea .message div > *:first-child {
    margin-top: 0;
}
#historyArea .message div > *:last-child {
    margin-bottom: 0;
}
#historyArea .message div p {
    margin-top: 0;
    margin-bottom: 1em;
}
#historyArea .message div ul, #historyArea .message div ol {
    padding-left: 20px;
    margin-top: 10px;
    margin-bottom: 10px;
}
#historyArea .message div ul ul, #historyArea .message div ol ol {
    margin-top: 5px;
    margin-bottom: 5px;
}
#historyArea .message div strong {
    font-weight: bold;
}
#historyArea .message div em {
    font-style: italic;
}
#historyArea .message div code {
    background-color: #F0F0F0;
    padding: 1px 4px;
    border-radius: 3px;
    font-family: monospace;
    white-space: pre-wrap;
}
#historyArea .message div pre code {
    display: block;
    padding: 10px;
    background-color: #F0F0F0;
    border: 1px solid #CCC;
    border-radius: 4px;
    overflow-x: auto;
    white-space: pre;
    word-break: normal;
}
#historyArea .message div a {
    color: #000;
    text-decoration: none;
    font-weight: bold;
}
#historyArea .message div a:hover {
    text-decoration: underline;
}
#historyArea .message div img {
    max-width: 100%;
    height: auto;
    display: block;
    margin-top: 10px;
    margin-bottom: 10px;
    border-radius: 4px;
    object-fit: contain;
}
.file-content-display {
    background-color: #F0F0F0;
    border-left: 4px solid #666;
    padding: 10px;
    margin-top: 10px;
    margin-bottom: 10px;
    font-family: monospace;
    white-space: pre-wrap;
    max-height: 150px;
    overflow-y: auto;
    font-size: 0.9em;
    line-height: 1.4;
}
.file-content-display pre {
    margin: 0;
}
.file-content-display pre code {
    background-color: transparent;
    border: none;
    padding: 0;
    max-height: none;
     
}
.copy-button {
    position: absolute;
    bottom: 4px;
    right: 4px;
    background-color: rgba(200, 200, 200, 0.5);
    border: 1px solid #BBB;
    border-radius: 4px;
    padding: 2px;
    cursor: pointer;
    opacity: 0.4;
    transition:
        opacity 0.2s ease-in-out,
        background-color 0.2s ease-in-out;
    z-index: 10;
    line-height: 0;
    width: 16px;
    height: 16px;
    box-sizing: content-box;
}
.copy-button svg {
    width: 14px;
    height: 14px;
    vertical-align: middle;
    fill: #666;
}
.copy-button:hover {
    background-color: rgba(180, 180, 180, 0.8);
}
.copy-button:active {
    background-color: rgba(160, 160, 160, 1);
}
#inputArea {
    flex-shrink: 0;
    padding-top: 10px;
    border-top: 1px solid #EEE;
    margin-bottom: 5px;
}
#infoAndClear {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
    gap: 5px;
    flex-wrap: wrap;
}
#clearHistoryButton {
    background-color: #A0A0A0;
    border: 1px solid #FFF;
    border-radius: 3px;
    cursor: pointer;
    padding: 2px 5px;
    margin: 0;
     
    font-size: 0.9em;
    transition: background-color 0.2s ease;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    white-space: nowrap;
    color: #FFF;
    height: 30px;
    padding-left: 10px;
    padding-right: 10px;
}
#clearHistoryButton:hover {
    background-color: #555;
    border: 1px solid #555;
}
#inputInfo {
    font-size: 0.9em;
    color: #555;
    margin: 0;
}
#inputControls {
    display: flex;
    align-items: flex-start;
    margin-bottom: 10px;
}
textarea {
    flex-grow: 1;
    height: 80px;
    padding: 10px;
    border: 1px solid #CCC;
    border-radius: 4px;
    resize: none;
    font-size: 1rem;
    box-sizing: border-box;
    margin-bottom: 0;
}
textarea:focus {
    outline: none;
    border-color: #555;
}
input.hidden-file-input {
    display: none;
}
.file-upload-container {
    display: flex;
    align-items: center;
    gap: 5px;
    flex-wrap: wrap;
}
.upload-file-label {
    display: inline-block;
    padding: 4px 10px;
    font-size: 0.9em;
     
    color: #000;
    background-color: #E0E0E0;
    border: 1px solid #CCC;
    border-radius: 4px;
    cursor: pointer;
    height: 30px;
    line-height: 20px;
    text-align: center;
    box-sizing: border-box;
    white-space: nowrap;
}
.file-attachment-info {
    font-size: 0.8em;
    color: #555;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin: 0;
    padding: 10px;
    max-width: 200px;
    flex-shrink: 0;
}
#fileAttachmentClear {
    flex-shrink: 0;
    cursor: pointer;
    font-size: 1.2em;
    color: #DC3545;
    font-weight: bold;
    display: none;
    line-height: 1;
    padding: 0 10px;
    margin: 0;
}
#actionControlArea {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
    justify-content: space-between;
}
 
#submitContainer {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}
button#sendButton {
    padding: 10px 15px;
    background-color: #555;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    transition: background-color 0.3s ease;
    flex-shrink: 0;
}
button#sendButton:disabled {
    background-color: #CCC;
    cursor: not-allowed;
}
#responseArea {
    min-height: 1em;
    flex-shrink: 0;
    margin-top: 5px;
}
#liveResponseArea {
    padding: 0 5px;
}
#liveResponseArea.error {
    color: #DC3545;
    font-weight: bold;
}
#liveResponseArea.warning {
    color: #FFC107;
    font-weight: bold;
}
#liveResponseArea.info {
    color: #666;
    font-style: italic;
}
.warning {
     
    font-family: Arial, Helvetica, sans-serif;
    color: #FFF;
    margin-bottom: 15px;
    padding: 8px 15px;
    background-color: #A0A0A0;
    border: 1px solid #555;
    border-radius: 4px;
    flex-shrink: 0;
}
.warning p {
    margin: 0;
}
code {
    background-color: #F0F0F0;
    padding: 2px 4px;
    border-radius: 4px;
    font-family: monospace;
}
@keyframes shake {
    0%, 100% {
        transform: translateX(0);
    }
    20%, 60% {
        transform: translateX(-5px);
    }
    40%, 80% {
        transform: translateX(5px);
    }
}
.shake-on-empty {
    animation: shake 0.4s ease-in-out;
    border-color: #DC3545 !important;
}
@media (min-width: 769px) {
    body {
        padding: 20px;
        justify-content: center;
    }
    #container {
        max-width: 900px;
        height: calc(100vh - 40px);
        max-height: 800px;
        padding: 20px 30px;
    }
    header {
        padding-bottom: 10px;
    }
    h1 {
        font-size: 1.8em;
    }
    #historyArea {
        gap: 15px;
        padding: 0 15px 15px 0;
    }
    .message {
        padding: 15px;
        max-width: 800px;
    }
    #inputInfo {
        margin-bottom: 0;
    }
    #inputControls {
        flex-direction: row;
        align-items: flex-end;
    }
    textarea {
        height: 120px;
        font-size: 1rem;
    }
    .file-upload-container {
        width: auto;
        flex-direction: row;
    }
    .file-attachment-info {
        font-size: 0.9em;
    }
    button#sendButton {
        padding: 12px 20px;
        font-size: 1rem;
    }
    .file-attachment-info {
        max-width: 500px;
    }
    #liveResponseArea {
        padding: 0 15px;
    }
    #historyArea .message .file-content-display {
        max-height: 200px;
        font-size: 1em;
    }
}