.ai-window {
    width: 400px;
    height: 600px;
    position: absolute;
    top: calc(50vh - 300px);
    left: calc(50vw - 200px);
    border-radius: 24px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    background-color: #ffffff;
    box-sizing: border-box;
    overflow: hidden;
}

.input-area {
    width: 100%;
    padding: 16px;

    p {
        font-size: calc(11 / 16 * 1rem);
        line-height: 1.4;
        margin-top: 12px;
        color: var(---gray-glyph, #707070);
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }
}

.input-bottom {
    display: flex;
    justify-content: space-between;
    width: 100%;
    height: calc(32px + 12px);
    padding: 12px 0 0;
}

.input-bottom-left,
.input-bottom-right {
    display: block;
    width: 32px;
    height: 32px;
    background-color: #222;
    border-radius: 50%;
}

.textarea-wrapper {
    width: 100%;
    position: relative;
    font-size: 0;
    line-height: 0;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(---line, #E0E0E0);
    background: var(---bg-section, #F6F6F6);
    padding: 12px;

    textarea {
        width: 100%;
        resize: none;
        font-size: 1rem;
        line-height: 1.6;
        overflow-y: auto;
        min-height: 4em;
        max-height: 10em;
        background: transparent;
        padding: 0 8px;
        font-family: var(--sans-serif);
    }
}

@media (pointer: fine) {

    /*Firefox用*/
    @-moz-document url-prefix() {
        .textarea-wrapper {
            textarea {
                scrollbar-gutter: stable;
                scrollbar-color: transparent transparent;
            }

            textarea:hover,
            textarea:focus {
                scrollbar-color: #CCC transparent;
            }
        }
    }

    /*Chrome,Edge,Safari用*/
    .textarea-wrapper {

        textarea::-webkit-scrollbar,
        textarea::-webkit-scrollbar-corner {
            background-color: transparent;
            width: 10px;
            height: 10px;
        }

        textarea::-webkit-scrollbar-button {
            height: 0;
            width: 0;
        }

        textarea::-webkit-scrollbar-track {
            background-color: transparent;
            border: none;
        }

        textarea::-webkit-scrollbar-thumb {
            background: transparent;
            border-radius: 99px;
            will-change: background;
        }

        textarea:hover,
        textarea:focus {
            background: var(---bg-section, #F6F6F6);
        }

        textarea:hover::-webkit-scrollbar-thumb,
        textarea:focus::-webkit-scrollbar-thumb {
            background: #CCC;
            will-change: background;
        }
    }
}

.attached-files {
    display: flex;
    flex-direction: row;
    gap: 4px;
    flex-wrap: nowrap;
    width: 100%;
    overflow-x: auto;
    padding: 0 0 4px 0;
    margin-bottom: 8px;

    &>div {
        width: 100px;
        height: 48px;
        flex-shrink: 0;
        border-radius: 4px;
        border: 1px solid var(---line, #E0E0E0);
        background: var(---bg-section, #FAFAFA);
    }
}

@media (pointer: fine) {
    @-moz-document url-prefix() {
        .attached-files {
            scrollbar-color: transparent transparent;
            scrollbar-gutter: auto;
        }

        .attached-files:hover,
        .attached-files:focus {
            scrollbar-color: #CCC transparent;
        }
    }


    .attached-files::-webkit-scrollbar,
    .attached-files::-webkit-scrollbar-corner {
        background-color: transparent;
        width: 10px;
        height: 10px;
    }

    .attached-files::-webkit-scrollbar-track {
        background-color: transparent;
        border: none;
    }

    .attached-files::-webkit-scrollbar-thumb {
        background: transparent;
        border-radius: 99px;
        will-change: background;
    }

    .attached-files:hover,
    .attached-files:focus {
        background: var(---bg-section, #F6F6F6);
    }

    .attached-files:hover::-webkit-scrollbar-thumb,
    .attached-files:focus::-webkit-scrollbar-thumb {
        background: #CCC;
        will-change: background;
    }
}

.ai-error-message {
    display: flex;
    padding: 8px 12px;
    justify-content: center;
    align-items: center;
    align-self: stretch;
    border-radius: 12px;
    background: #FFEEE9;
    margin-bottom: 8px;

    p {
        color: var(---caution, #FC5821);
        font-size: calc(13 / 16 * 1rem);
        line-height: 1.5;
        margin: 0;
    }
}

.ai-content-wrapper {
    display: flex;
    flex-direction: column;
    height: 100%;
    justify-content: space-between;
}

.ai-content {
    padding: 16px;
    flex: 1;
    overflow-y: auto;

    p {
        font-size: calc(15 / 16 * 1rem);
        line-height: 1.5;
    }
}

.ai-first-message {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 16px 0;

    h2 {
        font-size: calc(21 / 16 * 1rem);
        line-height: 1.3;
        font-weight: 500;
        margin-bottom: 0.5em;
    }
}

.ai-window-header {
    cursor: move;
    display: flex;
    align-items: center;
    justify-content: space-between;
    user-select: none;
    font-size: 0;
    padding: 16px 16px 8px 16px;
    width: 100%;
}

.ai-close-button,
.ai-history-button {
    display: flex;
    width: 32px;
    height: 32px;
    justify-content: center;
    align-items: center;
    gap: 10px;
    aspect-ratio: 1/1;
    border-radius: 8px;
    border: 1px solid var(---line, #E0E0E0);
    background-color: #FFF;
}

.resizer {
    position: absolute;
}

.resizer-n {
    top: -5px;
    left: 0;
    width: 100%;
    height: 10px;
    cursor: n-resize;
}

.resizer-e {
    top: 0;
    right: -5px;
    width: 10px;
    height: 100%;
    cursor: e-resize;
}

.resizer-s {
    bottom: -5px;
    left: 0;
    width: 100%;
    height: 10px;
    cursor: s-resize;
}

.resizer-w {
    top: 0;
    left: -5px;
    width: 10px;
    height: 100%;
    cursor: w-resize;
}

.resizer-ne {
    top: -5px;
    right: -5px;
    width: 15px;
    height: 15px;
    cursor: ne-resize;
    z-index: 10;
}

.resizer-nw {
    top: -5px;
    left: -5px;
    width: 15px;
    height: 15px;
    cursor: nw-resize;
    z-index: 10;
}

.resizer-se {
    bottom: -5px;
    right: -5px;
    width: 15px;
    height: 15px;
    cursor: se-resize;
    z-index: 10;
}

.resizer-sw {
    bottom: -5px;
    left: -5px;
    width: 15px;
    height: 15px;
    cursor: sw-resize;
    z-index: 10;
}