:root {
    --bg: #0f1115;
    --s1: #171a21;
    --s2: #1e232b;
    --s3: #252b34;

    --br: rgba(255, 255, 255, 0.08);
    --br-hi: rgba(255, 255, 255, 0.14);

    --ac: #4b5563;
    --ac-hi: #6b7280;
    --ac-dim: rgba(107, 114, 128, 0.15);

    --t1: #e5e7eb;
    --t2: #9ca3af;
    --t3: #6b7280;

    --ok: #22c55e;
    --warn: #f59e0b;
    --err: #ef4444;

    --me: #9ca3af;
    --sys: #93c5fd;

    --r: 8px;
    --rl: 14px;
    --sh: 0 10px 30px rgba(0, 0, 0, 0.35);
    --shs: 0 4px 14px rgba(0, 0, 0, 0.22);
}

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0
}

html,
body {
    height: 100%;
    overflow: hidden
}

body {
    font-family: 'Outfit', system-ui, sans-serif;
    background: var(--bg);
    color: var(--t1);
    font-size: 14px;
    line-height: 1.5;
}

.scr {
    position: fixed;
    inset: 0;
    z-index: 10;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: var(--bg);
}

.scr.vis {
    display: flex;
    animation: rise .32s cubic-bezier(.22, 1, .36, 1);
}

@keyframes rise {
    from {
        opacity: 0;
        transform: translateY(14px)
    }

    to {
        opacity: 1;
        transform: translateY(0)
    }
}

.scr::before {
    background: none;
}

.card {
    background: var(--s1);
    border: 1px solid var(--br);
    border-radius: var(--rl);
    padding: 40px;
    width: 100%;
    max-width: 470px;
    box-shadow: var(--sh);
    position: relative;
    overflow: hidden;
}

.card::before {
    background: none;
}

.card-ico {
    font-size: 2.2rem;
    margin-bottom: 18px;
    display: block;
}

.card h1 {
    font-size: 1.55rem;
    font-weight: 700;
    letter-spacing: -.02em;
    margin-bottom: 6px;
}

.card h1 span {
    color: var(--ac-hi);
}

.card .sub {
    font-size: .875rem;
    color: var(--t2);
    margin-bottom: 28px;
    line-height: 1.65;
}

.field {
    margin-bottom: 20px;
}

.field label {
    display: block;
    font-size: .72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--t3);
    margin-bottom: 8px;
}

input,
textarea {
    width: 100%;
    background: var(--s2);
    border: 1.5px solid var(--br);
    border-radius: var(--r);
    color: var(--t1);
    padding: 11px 14px;
    font-size: .9rem;
    font-family: inherit;
    outline: none;
    transition: border-color .2s, box-shadow .2s;
}

input:focus,
textarea:focus {
    border-color: var(--ac-hi);
    box-shadow: 0 0 0 3px var(--ac-dim);
}

input::placeholder,
textarea::placeholder {
    color: var(--t3);
}

textarea {
    height: 128px;
    resize: vertical;
    font-family: 'JetBrains Mono', monospace;
    font-size: .78rem;
}

.ferr {
    font-size: .78rem;
    color: var(--err);
    margin-top: 5px;
    display: none;
}

.ferr.on {
    display: block;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    border: none;
    border-radius: var(--r);
    font-size: .9rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    padding: 11px 20px;
    transition: all .18s;
    white-space: nowrap;
}

.btn.w {
    width: 100%;
}

.bp {
    background: var(--ac);
    color: #fff;
}

.bp:hover:not(:disabled),
#send:hover:not(:disabled) {
    background: var(--ac-hi);
    box-shadow: none;
}

.bs {
    background: var(--s2);
    color: var(--t1);
    border: 1.5px solid var(--br);
}

.bs:hover:not(:disabled) {
    border-color: var(--br-hi);
    background: var(--s3);
}

.bg {
    background: none;
    color: var(--t2);
    font-size: .82rem;
    padding: 8px;
}

.bg:hover {
    color: var(--t1);
}

.bd {
    background: rgba(240, 82, 82, .12);
    color: var(--err);
    border: 1.5px solid rgba(240, 82, 82, .25);
}

.bd:hover:not(:disabled) {
    background: rgba(240, 82, 82, .22);
}

.sm {
    padding: 6px 12px;
    font-size: .78rem;
}

.btn:disabled {
    opacity: .4;
    cursor: not-allowed;
}

.btn:active:not(:disabled) {
    transform: scale(.97);
}

.div {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--t3);
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .06em;
    margin: 22px 0;
}

.div::before,
.div::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--br);
}

.code-i {
    text-transform: uppercase;
    letter-spacing: .25em;
    text-align: center;
    font-weight: 700;
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.1rem;
}

.instruct {
    background: var(--s2);
    border: 1px solid var(--br);
    border-radius: var(--r);
    padding: 14px 16px;
    margin-bottom: 22px;
    font-size: .8rem;
    color: var(--t2);
    line-height: 1.7;
}

.instruct ol {
    padding-left: 16px;
}

.instruct li {
    margin-bottom: 3px;
}

.instruct a {
    color: var(--ac-hi);
    text-decoration: none;
}

.instruct a:hover {
    text-decoration: underline;
}

#chat {
    position: fixed;
    inset: 0;
    z-index: 10;
    flex-direction: column;
    display: none;
}

#chat.vis {
    display: flex;
}

.offbar {
    background: rgba(240, 82, 82, .1);
    border-bottom: 1px solid rgba(240, 82, 82, .22);
    color: var(--err);
    font-size: .78rem;
    font-weight: 500;
    padding: 7px 20px;
    display: none;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.offbar.on {
    display: flex;
}

.hdr {
    background: var(--s1);
    border-bottom: 1px solid var(--br);
    padding: 0 18px;
    height: 56px;
    display: flex;
    align-items: center;
    gap: 14px;
    flex-shrink: 0;
    z-index: 5;
}

.hico {
    width: 36px;
    height: 36px;
    border-radius: var(--r);
    background: var(--ac-dim);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.05rem;
    flex-shrink: 0;
}

.hinf {
    flex: 1;
    min-width: 0;
}

.hinf h2 {
    font-size: .95rem;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.hmeta {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: .72rem;
    color: var(--t2);
    margin-top: 1px;
    flex-wrap: wrap;
}

.cpill {
    display: flex;
    align-items: center;
    gap: 5px;
}

.cdot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--ok);
    flex-shrink: 0;
    transition: background .3s;
}

.cdot.off {
    background: var(--err);
}

#ctag {
    font-family: 'JetBrains Mono', monospace;
    color: var(--t1);
    font-size: .8rem;
    font-weight: 500;
}

#ctag:hover {
    background: rgba(99, 102, 241, .22);
    cursor: pointer;
    text-decoration: underline;
}

.cbody {
    display: flex;
    flex: 1;
    min-height: 0;
}

.ma {
    flex: 1;
    overflow-y: auto;
    padding: 12px 18px 18px;
    display: flex;
    flex-direction: column;
}

.ma::-webkit-scrollbar {
    width: 4px;
}

.ma::-webkit-scrollbar-track {
    background: transparent;
}

.ma::-webkit-scrollbar-thumb {
    background: var(--br);
    border-radius: 2px;
}

.sidebar {
    width: 210px;
    background: var(--s1);
    border-left: 1px solid var(--br);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.sbhdr {
    padding: 14px 14px 10px;
    font-size: .68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--t3);
    border-bottom: 1px solid var(--br);
}

.sbbody {
    flex: 1;
    overflow-y: auto;
    padding: 10px 8px;
}

.sbbody::-webkit-scrollbar {
    width: 3px;
}

.sbbody::-webkit-scrollbar-thumb {
    background: var(--br);
}

.sbsec {
    margin-bottom: 14px;
}

.sbsec-lbl {
    font-size: .65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--t3);
    padding: 0 6px;
    margin-bottom: 4px;
}

.mem {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 6px;
    border-radius: 6px;
    cursor: default;
    transition: background .1s;
}

.mem:hover {
    background: var(--s2);
}

.mav {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .72rem;
    font-weight: 700;
    flex-shrink: 0;
    position: relative;
}

.pdot {
    position: absolute;
    bottom: -1px;
    right: -1px;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    border: 2px solid var(--s1);
}

.pdot.on {
    background: var(--ok);
}

.pdot.off {
    background: var(--t3);
}

.mname {
    font-size: .82rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

.mname.isme {
    color: var(--me);
}

.mrole {
    font-size: .65rem;
    color: var(--t3);
}

.daysep {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 14px 0 6px;
    font-size: .68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--t3);
}

.daysep::before,
.daysep::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--br);
}

.sysmsg {
    text-align: center;
    padding: 5px 0;
    margin: 3px 0;
}

.sysmsg span {
    font-size: .74rem;
    color: var(--t3);
    background: var(--s2);
    border: 1px solid var(--br);
    padding: 3px 12px;
    border-radius: 20px;
}

.msg {
    display: flex;
    gap: 12px;
    padding: 2px 8px 2px 4px;
    border-radius: var(--r);
    position: relative;
    transition: background .1s;
}

.msg:hover {
    background: rgba(255, 255, 255, .025);
}

.msg:hover .mtoolbar {
    opacity: 1;
    pointer-events: all;
}

.msg.compact {
    padding-left: 56px;
}

.msg.compact .av {
    display: none;
}

.av {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .85rem;
    font-weight: 700;
    flex-shrink: 0;
    margin-top: 2px;
}

.mc {
    flex: 1;
    min-width: 0;
}

.mhdr {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 2px;
}

.mun {
    font-size: .88rem;
    font-weight: 700;
    cursor: default;
}

.mun.isme {
    color: var(--me);
}

.mts {
    font-size: .68rem;
    color: var(--t3);
    white-space: nowrap;
}

.mtxt {
    font-size: .875rem;
    line-height: 1.55;
    word-break: break-word;
    white-space: pre-wrap;
    color: var(--t1);
}

.mtxt.del {
    color: var(--t3);
    font-style: italic;
}

.etag {
    font-size: .68rem;
    color: var(--t3);
    margin-left: 4px;
    cursor: pointer;
}

.etag:hover {
    color: var(--ac-hi);
    text-decoration: underline;
}

.mst {
    font-size: .68rem;
    margin-top: 2px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.mst.sending {
    color: var(--t3);
}

.mst.sent {
    color: var(--ok);
}

.mst.failed {
    color: var(--err);
}

.retry {
    cursor: pointer;
    color: var(--ac-hi);
    text-decoration: underline;
    margin-left: 2px;
}

.retry:hover {
    color: var(--me);
}

.edit-area {
    margin-top: 5px;
}

.edit-area textarea {
    padding: 8px 10px;
    min-height: 38px;
    font-family: 'Outfit', system-ui, sans-serif;
    font-size: .875rem;
}

.ekeys {
    font-size: .7rem;
    color: var(--t3);
    margin-top: 4px;
    display: flex;
    gap: 14px;
}

kbd {
    font-family: 'JetBrains Mono', monospace;
    font-size: .65rem;
    background: var(--s3);
    border: 1px solid var(--br-hi);
    border-radius: 3px;
    padding: 1px 5px;
}

.ebtns {
    display: flex;
    gap: 6px;
    margin-top: 8px;
}

.mtoolbar {
    opacity: 0;
    pointer-events: none;
    position: absolute;
    right: 6px;
    top: -17px;
    background: var(--s2);
    border: 1px solid var(--br-hi);
    border-radius: 7px;
    display: flex;
    gap: 1px;
    padding: 3px;
    box-shadow: var(--shs);
    z-index: 5;
    transition: opacity .12s;
}

.tbb {
    background: none;
    border: none;
    border-radius: 5px;
    color: var(--t2);
    cursor: pointer;
    padding: 4px 9px;
    font-size: .74rem;
    font-family: inherit;
    font-weight: 500;
    transition: all .12s;
    white-space: nowrap;
}

.tbb:hover {
    background: var(--s3);
    color: var(--t1);
}

.tbb.del:hover {
    background: rgba(240, 82, 82, .12);
    color: var(--err);
}

.iarea {
    padding: 10px 18px 14px;
    background: var(--bg);
    flex-shrink: 0;
}

.ibox {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    background: var(--s2);
    border: 1.5px solid var(--br);
    border-radius: var(--rl);
    padding: 10px 14px;
    transition: border-color .2s, box-shadow .2s;
}

.ibox:focus-within {
    border-color: rgba(130, 140, 255, .32);
    box-shadow: 0 0 0 3px var(--ac-dim);
}

#min {
    flex: 1;
    background: none;
    border: none;
    color: var(--t1);
    font-size: .9rem;
    font-family: inherit;
    outline: none;
    resize: none;
    min-height: 22px;
    max-height: 130px;
    line-height: 1.55;
    padding: 0;
}

#min::placeholder {
    color: var(--t3);
}

#send {
    background: var(--ac);
    color: #fff;
    border: none;
    border-radius: 7px;
    padding: 7px 16px;
    font-size: .82rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    flex-shrink: 0;
    transition: all .18s;
}

#send:disabled {
    opacity: .35;
    cursor: not-allowed;
}

#send:active:not(:disabled) {
    transform: scale(.96);
}

#toast {
    position: fixed;
    bottom: 80px;
    left: 50%;
    z-index: 100;
    transform: translateX(-50%) translateY(8px);
    background: var(--s2);
    border: 1px solid var(--br-hi);
    border-radius: 8px;
    padding: 9px 18px;
    font-size: .82rem;
    color: var(--t1);
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: all .25s;
    box-shadow: var(--shs);
}

#toast.on {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .65);
    align-items: center;
    justify-content: center;
    z-index: 200;
    padding: 20px;
}

.overlay.on {
    display: flex;
}

.modal {
    background: var(--s1);
    border: 1px solid var(--br);
    border-radius: var(--rl);
    padding: 28px;
    max-width: 400px;
    width: 100%;
    box-shadow: var(--sh);
    animation: rise .22s cubic-bezier(.22, 1, .36, 1);
}

.modal h3 {
    font-size: 1.05rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.modal p {
    color: var(--t2);
    font-size: .875rem;
    margin-bottom: 20px;
    line-height: 1.65;
}

.mft {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.mft .btn {
    width: auto;
}

.hist-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 260px;
    overflow-y: auto;
    margin-top: 12px;
}

.hist-list::-webkit-scrollbar {
    width: 3px;
}

.hist-list::-webkit-scrollbar-thumb {
    background: var(--br);
}

.hi {
    background: var(--s2);
    border: 1px solid var(--br);
    border-radius: var(--r);
    padding: 10px 12px;
}

.hi-txt {
    font-size: .85rem;
    white-space: pre-wrap;
    word-break: break-word;
}

.hi-ts {
    font-size: .68rem;
    color: var(--t3);
    margin-top: 3px;
}

.curr {
    display: inline-block;
    font-size: .62rem;
    background: var(--ac-dim);
    color: var(--ac-hi);
    padding: 1px 6px;
    border-radius: 4px;
    margin-left: 5px;
}

@media (max-width: 640px) {
    .sidebar {
        display: none;
    }

    .card {
        padding: 24px;
    }

    .hdr {
        padding: 0 14px;
    }

    .ma {
        padding: 8px 12px 12px;
    }

    .iarea {
        padding: 8px 12px 12px;
    }
}
