html, body.cs-chat-page {
    background: #f0f2f5;
    height: 100%;
    margin: 0;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
    -webkit-text-size-adjust: 100%;
}

.cs-topbar {
    align-items: center;
    background: linear-gradient(135deg, #e73b3b, #c62828);
    box-sizing: border-box;
    color: #fff;
    display: flex;
    gap: 10px;
    height: 48px;
    padding: 0 12px;
    padding-top: env(safe-area-inset-top, 0);
    position: relative;
    z-index: 10;
}

.cs-back {
    color: #fff;
    flex-shrink: 0;
    font-size: 14px;
    text-decoration: none;
}

.cs-title-wrap {
    flex: 1;
    min-width: 0;
    text-align: center;
}

.cs-title {
    display: block;
    font-size: 16px;
    font-weight: 600;
}

.cs-sub {
    display: block;
    font-size: 11px;
    margin-top: 1px;
    opacity: .85;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cs-end {
    background: rgba(255, 255, 255, .18);
    border: 0;
    border-radius: 14px;
    color: #fff;
    cursor: pointer;
    flex-shrink: 0;
    font-size: 12px;
    padding: 5px 10px;
}

.cs-messages {
    box-sizing: border-box;
    height: calc(100% - 48px - env(safe-area-inset-top, 0px));
    overflow-x: hidden;
    overflow-y: auto;
    padding: 12px 12px 80px;
    -webkit-overflow-scrolling: touch;
}

.cs-msg {
    display: flex;
    margin-bottom: 12px;
}

.cs-msg.is-me {
    flex-direction: row-reverse;
}

.cs-msg.is-system {
    justify-content: center;
}

.cs-avatar {
    background: #ddd;
    border-radius: 50%;
    flex-shrink: 0;
    height: 36px;
    object-fit: cover;
    width: 36px;
}

.cs-bubble-wrap {
    margin: 0 8px;
    max-width: 72%;
}

.cs-name {
    color: #888;
    font-size: 11px;
    margin-bottom: 4px;
}

.cs-msg.is-me .cs-name {
    text-align: right;
}

.cs-bubble {
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .06);
    color: #222;
    font-size: 14px;
    line-height: 1.5;
    padding: 8px 12px;
    word-break: break-word;
    white-space: pre-wrap;
}

.cs-msg.is-me .cs-bubble {
    background: #ffecec;
    color: #222;
}

.cs-sys {
    background: rgba(0, 0, 0, .06);
    border-radius: 12px;
    color: #888;
    font-size: 12px;
    padding: 4px 10px;
}

.cs-composer {
    align-items: flex-end;
    background: #fff;
    border-top: 1px solid #e8e8e8;
    bottom: 0;
    box-sizing: border-box;
    display: flex;
    gap: 8px;
    left: 0;
    padding: 8px 10px;
    padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
    position: fixed;
    right: 0;
    z-index: 20;
}

.cs-composer textarea {
    background: #f5f6f8;
    border: 0;
    border-radius: 8px;
    box-sizing: border-box;
    flex: 1;
    font-family: inherit;
    font-size: 15px;
    line-height: 1.4;
    max-height: 96px;
    min-height: 36px;
    min-width: 0;
    outline: none;
    padding: 8px 10px;
    resize: none;
}

.cs-image-btn {
    background: #f5f6f8;
    border: 0;
    border-radius: 8px;
    color: #666;
    cursor: pointer;
    flex-shrink: 0;
    font-size: 22px;
    font-weight: 300;
    height: 36px;
    line-height: 34px;
    padding: 0;
    width: 36px;
}

.cs-image-btn:disabled {
    opacity: .5;
}

.cs-bubble.is-image {
    background: transparent;
    box-shadow: none;
    padding: 0;
}

.cs-bubble .cs-img {
    border-radius: 8px;
    display: block;
    max-height: 220px;
    max-width: 100%;
    object-fit: contain;
}

.cs-send {
    background: #e73b3b;
    border: 0;
    border-radius: 8px;
    color: #fff;
    cursor: pointer;
    flex-shrink: 0;
    font-size: 14px;
    height: 36px;
    padding: 0 14px;
}

.cs-send:disabled {
    opacity: .5;
}

.cs-guest {
    padding: 80px 24px;
    text-align: center;
}

.cs-guest p {
    color: #666;
    font-size: 15px;
}

.cs-login-btn {
    background: #e73b3b;
    border-radius: 22px;
    color: #fff;
    display: inline-block;
    font-size: 15px;
    margin-top: 16px;
    padding: 10px 28px;
    text-decoration: none;
}

body.cs-chat-page.has-composer .cs-messages {
    height: calc(100% - 48px - 56px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
}
