@height: 420px;
@width: 480px;
@margintop: -210px;
@marginleft: -180px;
@leftwidth: 200px;

& {
    box-sizing: content-box;
    margin: @margintop @marginleft;

    &:not([resizing], [dragging]) {
        transition: padding .2s, margin .2s;
    }

    top: 50%;
    left: 50%;
    width: @width;
    height: @height;
    position: absolute;
    border: 1px solid #000;
    box-shadow: 0 0 20px -6px #0003;
    min-width: 200px;
    min-height: 200px;
    max-width: 100%;
    max-height: 100%;
}

.fade {
    filter: grayscale(1);
    opacity: .5;
}

.qrcode {
    position: relative;
    height: 0;
    overflow: visible;
    z-index: 2;
    padding: 0;
    width: 100%;
    text-align: center;
    margin-bottom: -52px;

    >p {
        background: #fff;
    }

    >canvas {
        background: #fff;
        border: 10px solid #fff;
        image-rendering: pixelated;
        display: block;
        margin: 52px auto 10px auto;
        width: 256px;
        height: 256px;
    }
}

>list {
    width: @leftwidth;
    position: absolute;
    top: 0;
    left: 0;

    .id {
        opacity: .6;
        transform: scale(.8);
        transform-origin: left center;
        font-size: 10px;
    }

    .local(@color) {
        font-size: 14px;
        transform: scale(.6) rotate(-45deg);
        text-align: center;
        padding: 0 6px;
        position: absolute;
        left: -6px;
        top: 4px;

        &:after,
        &:before {
            display: block;
            content: "";
            border: 8px solid transparent;
            position: absolute;
            top: 50%;
            margin: -8px 0;
            transform: scaleX(.6);
        }

        &:before {
            left: -8px;
            border-left: 0;
            border-right: 12px solid @color;

        }

        &:after {
            right: -8px;
            border-right: 0;
            border-left: 12px solid @color;
        }

        background-color: @color;
        color: #fff;
    }

    .local {
        .local(#082);
    }

    >.button {
        text-align: left;
        display: block;
        border-radius: 0;
        width: 100%;

        &[type=white].hover {
            color: #09c;

            >.track {
                background: #09c1;
            }
        }
    }
}

&.showList {
    margin: @margintop -380px;
    padding-left: @leftwidth;
}

padding {
    display: block;
    position: relative;

    &:after {
        display: "";
        display: block;
        clear: both;
    }
}

.user {
    padding: 10px 20px 10px 56px;
    line-height: 20px;
    box-shadow: none;

    >avatar {
        width: 42px;
        height: 42px;
        background-repeat: no-repeat;
        background-size: cover;
        display: inline-block;
        position: absolute;
        left: 10px;
    }
}

padding{
    padding: 0 20px;
}
msg {
    max-width: 100%;
    display: block;
    border-radius: 4px;
    padding: 6px 12px;
    line-height: 20px;
    white-space: normal;
    word-break: break-all;
    @color-remote:lch(60 30 90);
    background: @color-remote;
    position: relative;
    margin: 0 -10px;
    float: left;
    user-select: text;

    &:before {
        content: "";
        display: block;
        position: absolute;
        border: 8px solid transparent;
        top: 22px;
        margin: -14px;
    }

    &:not([self]):before {
        left: 0;
        border-right-color: @color-remote;
    }

    &[self] {
        &:before {
            right: 0;
            border-left-color: #77ddaa;
        }

        margin-left: 20px;

        float: right;
        background-color: #77ddaa;
        color: #333;
    }

    &[rtc] {
        color: #0006;
    }
}

msg[files] {

    a {
        display: block;
        border: 1px solid transparent;
        border-left: 0;
        border-right: 0;
        margin: 0 -6px;
        background-color: #fff;
        padding: 0 14px 0 10px;
        text-align: left;
        border-radius: 0;

        >img {
            width: 32px;
            height: 32px;
            margin-left: -10px;
            vertical-align: top;
            line-height: 32px;

            &+* {
                display: inline-block;
                margin-left: 6px;
                line-height: 32px;
                vertical-align: top;
            }
        }

        &:hover {
            border-color: #c80;
            background-color: #ffe;
        }

        &:active {
            background-color: #ffc;
        }

        &:first-child {
            border-top-color: transparent;
            border-top-right-radius: 3px;
            border-top-left-radius: 3px;
        }

        &:last-child {
            border-bottom-color: transparent;
            border-bottom-left-radius: 3px;
            border-bottom-right-radius: 3px;
        }
    }
}

>[head] {
    padding: 9px 16px;
    line-height: 24px;
    text-align: center;

    >span {
        display: inline-block;
    }

    &:before {
        display: none;
    }

    .id {
        font-size: 10px;
        color: #0009;
    }

    .menubtn {
        border-radius: 50%;
        width: 36px;
        height: 36px;
        text-align: center;
        padding: 9px 0;
        margin-right: 6px;
        margin: -6px 6px -6px -6px;
        box-shadow: none;
        float: left;

        >i {
            margin: 0 auto;
            display: block;
            width: 14px;
            border-top: 3px solid transparent;
            border-bottom: 2px solid;
        }
    }
}

>grid {
    padding-top: 0;
    margin-bottom: 0;
    height: 100%;
    background-color: #f2f4f6;
    width: 100%;

    >div {
        height: 100%;
        position: relative;
    }

    >chat {
        padding-top: 50px;
    }
}


.editor-height(@height) {
    >grid:not(:last-child) {
        padding-bottom: @height;
    }

    [textarea] {
        margin-bottom: -@height;
        height: @height;
    }
}

chat {
    height: 100%;
}

.editor-height(96px);

[textarea] {
    display: block;
    position: relative;
    resize: none;
    width: 100%;
    line-height: 20px;
    font-size: 16px;
    border: none;
    outline: none;
    border-top: 1px solid #000;
    border-bottom: 28px solid transparent;
    ime-mode: active;
    overflow: auto;

    >div {
        height: auto;
        min-height: 52px;
        width: 100%;
        vertical-align: top;
        padding: 6px 16px;
        box-sizing: border-box;
        outline: none;
    }
}

>[foot] {
    pointer-events: none;
    background: transparent;
    backdrop-filter: none;
    box-shadow: none;
    box-shadow: none;
    border-top: none;
    margin-top: -34px;
}

>[foot]>.button {
    pointer-events: all;
    bottom: 0;
    margin: 0;
    top: 0;
    padding: 0;
    border-radius: 0;
    min-width: 52px;
}

.unread {
    position: absolute;
    background: #c00;
    color: #fff;
    border-radius: 8px;
    font-size: 10px;
    padding: 0;
    line-height: 1;
    right: 10px;
    top: 10px;
    border: 2px solid #c00;
    min-width: 16px;
    text-align: center;
}

.file>svg {
    line-height: 1;
    vertical-align: top;
    width: 1em;
    height: 1em;
    margin: 7px 2px 0 0;
}

.max-size() {
    margin-top: 0 !important;
    top: 0 !important;
    height: 100% !important;
    margin-left: 0 !important;
    left: 0 !important;
    right: 0;
    width: auto !important;
    border: none;
    .editor-height(42px);

    &.showList {
        >grid:after {
            content: "";
            display: block;
            position: absolute;
            left: 0;
            top: 0;
            bottom: 0;
            right: 0;
            width: 100%;
            height: 100%;
            background: #0002;

        }

        // margin-left: -@leftwidth !important;
    }

    [textarea] {
        border-bottom: none;
        outline: none;
        background: #fff;

        >div {
            background-color: #eee;
            background-clip: padding-box;
            border: 4px solid transparent;
            border-right-width: 52px;
            border-left-width: 12px;
            min-height: 32px;
            padding: 6px;
        }

    }

    >[foot] {
        padding: 0;

        >.button {
            height: 42px;
            line-height: 42px;
        }

        .file {
            min-width: 40px;

            >svg {
                margin-top: 14px;
            }

            >span {
                display: none;
            }
        }

    }
}

@media(max-height: @height) {
    & {
        .max-size();
    }
}

@media(max-width: @width) {
    & {
        .max-size();
    }
}