@media (max-width: 768px) {
    body {
        flex-direction: column;
        overflow: auto;
        height: auto;
        min-height: 100vh;
    }

    .content {
        width: 100%;
        height: 50vh;
        overflow: hidden;
    }

    .result {
        max-width: 100%;
        max-height: 100%;
        display: flex;
        justify-content: center;
        align-items: center;
    }

    .result img {
        max-width: 100%;
        max-height: 100%;
        object-fit: contain;
    }

    .panel {
        width: 100%;
        min-height: auto;
        height: auto;
        max-height: none;
        order: 2;
        position: relative;
        display: flex;
        flex-direction: column;
        padding: 10px;
    }


    .panel-content {
        overflow-y: auto;
        max-height: calc(100vh - 50vh - 130px);
        /* Điều chỉnh chiều cao */
    }

    .top-buttons,
    .size-buttons,
    .model-buttons,
    .Tu-khoa-nhanh-container {
        margin-bottom: 10px;
        /* Giảm margin bottom */
    }

    .button {
        padding: 5px 10px;
        /* Giảm padding */
        margin: 2px 5px;
        /* Giảm margin */
        font-size: 10px;
        /* Giảm font size */
    }

    .size-buttons .button {
        width: 40px;
        /* Giảm kích thước nút */
        height: 40px;
        padding: 3px;
        font-size: 10px;
        margin: 2px;
    }

    .model-buttons .button {
        width: 70px;
        /* Giảm kích thước nút */
        height: 70px;
        padding: 5px;
        font-size: 10px;
        margin: 2px;
    }

    .Tu-khoa-nhanh .button {
        width: 60px;
        /* Giảm kích thước nút */
        height: 60px;
        padding: 5px;
        font-size: 10px;
        margin: 2px;
    }

    .form-container {
        padding: 5px;
        /* Giảm padding */
        position: relative;
        bottom: auto;
        /* Loại bỏ định vị tuyệt đối */
        left: auto;
        display: flex;
        justify-content: center;
        align-items: center;
    }

    textarea {
        height: auto;
        min-height: 8vh;
        /* Giảm chiều cao textarea */
        font-size: 12px;
        /* Giảm font size */
        margin-bottom: 5px;
        padding: 3px;
        /* Giảm padding */
        width: calc(100% - 6px);
        /* Điều chỉnh chiều rộng */
    }

    input[type="submit"],
    input[type="button"] {
        padding: 3px 6px;
        /* Giảm padding */
        font-size: 10px;
        /* Giảm font size */
    }
}
