/**
 * 聊天窗口样式 - 绿色简洁风格
 */

/* 聊天窗口遮罩层 */
.onlinelive-chat-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    max-width: 100vw;
    max-height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2147483647 !important; /* 最高优先级，确保在移动端图标之上 */
    display: none;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
    margin: 0;
    padding: 0;
    overflow: hidden;
}

.onlinelive-chat-overlay.active {
    display: flex;
}

.onlinelive-chat-overlay.onlinelive-avatar-picker-behind {
    z-index: 2147483645 !important;
}

/* 聊天窗口主容器 */
.onlinelive-chat-window {
    width: 90%;
    max-width: 800px;
    height: 85vh;
    max-height: 700px;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    overflow: hidden;
    animation: slideUp 0.3s ease;
    min-height: 0;
    margin: 0;
    padding: 0;
    position: relative;
    box-sizing: border-box; /* 确保 padding 不影响尺寸 */
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* 顶部标题栏 */
.onlinelive-chat-header {
    background: #10b981;
    color: #ffffff;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
    flex-grow: 0;
    position: relative;
    z-index: 10005;
    min-height: 56px;
    height: auto;
}

.onlinelive-chat-header-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.onlinelive-chat-close {
    width: 36px;
    height: 36px;
    background: transparent;
    border: none;
    color: #ffffff;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: background 0.2s;
    -webkit-tap-highlight-color: transparent;
    /* 移动端：确保按钮可点击 */
    touch-action: manipulation;
    -webkit-touch-callout: none;
    user-select: none;
}

.onlinelive-chat-close svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
}

.onlinelive-chat-close:hover {
    background: rgba(255, 255, 255, 0.1);
}

.onlinelive-chat-close:active {
    background: rgba(255, 255, 255, 0.2);
}

.onlinelive-chat-header-avatar {
    flex-shrink: 0;
}

.onlinelive-chat-avatar-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #ffffff;
    border: 2px solid rgba(255, 255, 255, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: #10b981;
    overflow: hidden;
}

.onlinelive-chat-avatar-circle img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.onlinelive-chat-header-info {
    flex: 1;
    min-width: 0;
    overflow: hidden; /* 确保子元素单行截断生效 */
}

.onlinelive-chat-header-name {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 2px;
}

.onlinelive-chat-header-subtitle {
    font-size: 12px;
    opacity: 0.9;
}

.onlinelive-chat-menu {
    width: 36px;
    height: 36px;
    background: transparent;
    border: none;
    color: #ffffff;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: background 0.2s;
    -webkit-tap-highlight-color: transparent;
    position: relative;
}

.onlinelive-chat-menu:hover {
    background: rgba(255, 255, 255, 0.1);
}

.onlinelive-chat-menu:active {
    background: rgba(255, 255, 255, 0.2);
}

/* 消息显示区域 */
.onlinelive-chat-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    background: #f9fafb;
    padding: 16px;
    -webkit-overflow-scrolling: touch;
}

.onlinelive-chat-messages {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* 消息项 */
.onlinelive-chat-message {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    max-width: 75%;
}

.onlinelive-chat-message-left {
    align-self: flex-start;
}

.onlinelive-chat-message-right {
    align-self: flex-end;
    flex-direction: row-reverse;
}

/* 消息头像 */
.onlinelive-chat-message-avatar {
    flex-shrink: 0;
}

.onlinelive-chat-avatar-circle-small {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: #10b981;
    overflow: hidden;
}

.onlinelive-chat-avatar-circle-small img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* 用户头像（绿色圆形，白色字母） */
.onlinelive-user-avatar {
    background: #10b981 !important;
    color: #ffffff !important;
    border: none !important;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    outline: none;
}

.onlinelive-user-avatar:focus-visible {
    box-shadow: 0 0 0 3px rgba(239, 137, 47, .3);
}

.onlinelive-avatar-picker-backdrop {
    position: fixed;
    inset: 0;
    z-index: 2147483647;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
    background: rgba(17, 24, 39, .45);
    backdrop-filter: blur(3px);
}

.onlinelive-avatar-picker-panel {
    width: min(420px, 100%);
    max-height: min(620px, calc(100vh - 36px));
    overflow: auto;
    padding: 18px;
    color: #20252b;
    border: 1px solid rgba(239, 137, 47, .25);
    border-radius: 20px;
    background: #fffaf6;
    box-shadow: 0 20px 60px rgba(17, 24, 39, .22);
}

.onlinelive-avatar-picker-panel header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

.onlinelive-avatar-picker-panel header > div {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.onlinelive-avatar-picker-panel header strong { font-size: 17px; }
.onlinelive-avatar-picker-panel header span,
.onlinelive-avatar-picker-panel > p { margin: 0; color: #7a7f87; font-size: 12px; }
.onlinelive-avatar-picker-panel > p { margin-top: 14px; text-align: center; }

.onlinelive-avatar-picker-close {
    width: 34px;
    height: 34px;
    padding: 0;
    color: #656b73;
    border: 0;
    border-radius: 50%;
    background: #fff;
    font-size: 25px;
    line-height: 1;
    cursor: pointer;
}

.onlinelive-avatar-picker-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 10px;
}

.onlinelive-avatar-choice {
    position: relative;
    aspect-ratio: 1;
    overflow: hidden;
    padding: 3px;
    border: 2px solid transparent;
    border-radius: 50%;
    background: #fff;
    cursor: pointer;
    transition: transform .16s ease, border-color .16s ease;
}

.onlinelive-avatar-choice:hover { transform: translateY(-2px); border-color: #f5b276; }
.onlinelive-avatar-choice.active { border-color: #ef892f; }
.onlinelive-avatar-choice.saving { opacity: .55; pointer-events: none; }
.onlinelive-avatar-choice img { width: 100%; height: 100%; display: block; border-radius: 50%; object-fit: cover; }
.onlinelive-avatar-choice span {
    position: absolute;
    right: 0;
    bottom: 0;
    display: none;
    width: 20px;
    height: 20px;
    color: #fff;
    border: 2px solid #fff;
    border-radius: 50%;
    background: #ef892f;
    font-size: 12px;
    line-height: 16px;
}
.onlinelive-avatar-choice.active span { display: block; }

@media (max-width: 420px) {
    .onlinelive-avatar-picker-backdrop { align-items: flex-end; padding: 10px; }
    .onlinelive-avatar-picker-panel { border-radius: 20px 20px 14px 14px; }
    .onlinelive-avatar-picker-grid { gap: 8px; }
}

/* 消息气泡 */
.onlinelive-chat-message-bubble {
    background: #ffffff;
    border-radius: 12px;
    padding: 10px 14px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    border: 1px solid #e5e7eb;
}

.onlinelive-chat-message-bubble-right {
    background: #10b981;
    color: #ffffff;
    border: none;
}

.onlinelive-chat-message-name {
    font-size: 12px;
    font-weight: 600;
    color: #10b981;
    margin-bottom: 4px;
}

.onlinelive-chat-message-text {
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
    word-break: break-word;
    color: #374151;
}

.onlinelive-chat-message-bubble-right .onlinelive-chat-message-text {
    color: #ffffff;
}

/* 消息内链接：可点击，新窗口打开 */
.onlinelive-chat-message-text .chat-message-link {
    color: inherit;
    text-decoration: underline;
    cursor: pointer;
    word-break: break-all;
}
.onlinelive-chat-message-bubble-right .chat-message-link {
    color: rgba(255,255,255,0.95);
}
.onlinelive-chat-message-bubble:not(.onlinelive-chat-message-bubble-right) .chat-message-link {
    color: #059669;
}

/* 表情消息样式 - 显示大一号 */
.onlinelive-chat-message-emoji {
    font-size: 32px !important;
    line-height: 1.2 !important;
    text-align: center;
    padding: 4px 0;
}

/* 临时消息样式（发送中） */
.onlinelive-chat-message.temp-message {
    opacity: 0.7;
    transition: opacity 0.3s;
}

/* 点赞消息 */
.onlinelive-chat-like-message {
    font-size: 24px;
    padding: 8px;
    text-align: center;
}

/* 图片消息 */
.onlinelive-chat-message-image {
    margin: -10px -14px;
    position: relative;
}

.onlinelive-chat-message-image img {
    max-width: 200px;
    max-height: 200px;
    border-radius: 12px;
    display: block;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

/* 文件消息 */
.onlinelive-chat-message-file {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    cursor: pointer;
    max-width: 300px;
    transition: background 0.2s ease;
    margin: -10px -14px;
}

.onlinelive-chat-message-file:hover {
    background: rgba(255, 255, 255, 0.15);
}

.onlinelive-chat-message-bubble-right .onlinelive-chat-message-file {
    background: rgba(255, 255, 255, 0.2);
}

.onlinelive-chat-message-bubble-right .onlinelive-chat-message-file:hover {
    background: rgba(255, 255, 255, 0.25);
}

.onlinelive-chat-message-file-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.onlinelive-chat-message-file-link {
    color: #ffffff;
    text-decoration: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    font-size: 14px;
}

.onlinelive-chat-message-bubble:not(.onlinelive-chat-message-bubble-right) .onlinelive-chat-message-file-link {
    color: #374151;
}

/* 缩略图样式 */
.onlinelive-chat-image-thumbnail {
    max-width: 150px !important;
    max-height: 150px !important;
    width: auto;
    height: auto;
    object-fit: cover;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.onlinelive-chat-image-thumbnail:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

/* 图片加载失败提示 */
.onlinelive-image-error {
    color: #999;
    padding: 10px;
    font-size: 12px;
    text-align: center;
    background: #f5f5f5;
    border-radius: 8px;
}

/* 图片预览层：必须在聊天窗口之上，浏览器正中间 */
.onlinelive-image-preview-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 2147483647 !important; /* 与聊天窗口同值，预览后插入 DOM 故显示在上层，勿改小否则会被聊天窗口挡住 */
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.onlinelive-image-preview-overlay img {
    max-width: 90vw;
    max-height: 90vh;
    object-fit: contain;
    display: block;
    /* 直接显示图片，无白色画布效果，图片大小适应浏览器窗口 */
}

/* 底部输入区域 */
.onlinelive-chat-footer {
    background: #ffffff;
    border-top: 1px solid #e5e7eb;
    padding: 12px 16px;
    flex-shrink: 0;
    flex-grow: 0;
    box-shadow: 0 -2px 4px rgba(0, 0, 0, 0.05);
    position: relative;
    z-index: 10002;
    min-height: auto;
    height: auto;
}

.onlinelive-chat-input-wrapper {
    display: flex;
    align-items: flex-end;
    gap: 8px;
}

.onlinelive-chat-input {
    flex: 1;
    min-height: 40px;
    max-height: 120px;
    padding: 10px 14px;
    font-size: 14px;
    color: #374151;
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    border-radius: 20px;
    resize: none;
    font-family: inherit;
    line-height: 1.5;
    transition: all 0.2s;
    -webkit-appearance: none;
    appearance: none;
}

.onlinelive-chat-input:focus {
    outline: none;
    border-color: #10b981;
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

.onlinelive-chat-tools {
    display: flex;
    align-items: center;
    gap: 4px;
}

.onlinelive-chat-tool-btn {
    width: 36px;
    height: 36px;
    background: transparent;
    border: none;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: background 0.2s;
    -webkit-tap-highlight-color: transparent;
    color: #6b7280;
}

.onlinelive-chat-tool-btn:hover {
    background: #f3f4f6;
}

.onlinelive-chat-tool-btn:active {
    background: #e5e7eb;
}

/* 滚动条样式 */
.onlinelive-chat-body::-webkit-scrollbar {
    width: 6px;
}

.onlinelive-chat-body::-webkit-scrollbar-track {
    background: transparent;
}

.onlinelive-chat-body::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 3px;
}

.onlinelive-chat-body::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .onlinelive-chat-overlay {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        width: 100vw !important;
        height: 100vh !important;
        padding: 0 !important;
        margin: 0 !important;
        overflow: hidden !important;
        align-items: center !important;
        justify-content: center !important;
        z-index: 2147483647 !important; /* 最高优先级，确保在移动端图标（2147483000）之上 */
    }
    
    .onlinelive-chat-overlay.active {
        display: flex !important;
    }
    
    .onlinelive-chat-window {
        width: 90% !important;
        max-width: 500px !important;
        height: 80vh !important;
        max-height: 600px !important;
        border-radius: 12px !important;
        margin: 0 !important;
        padding: 0 !important;
        display: flex !important;
        flex-direction: column !important;
        overflow: hidden !important;
        position: relative !important;
        box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3) !important;
    }
    
    .onlinelive-chat-header {
        flex-shrink: 0 !important;
        min-height: 56px !important;
        height: auto !important;
        border-radius: 12px 12px 0 0 !important;
    }
    
    /* 手机端：公司名称栏限制一行显示 */
    .onlinelive-chat-header-name {
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        max-width: 100% !important;
    }
    
    .onlinelive-chat-header-subtitle {
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        max-width: 100% !important;
    }
    
    .onlinelive-chat-body {
        flex: 1 1 auto !important;
        min-height: 0 !important;
        max-height: none !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        -webkit-overflow-scrolling: touch !important;
    }
    
    .onlinelive-chat-footer {
        flex-shrink: 0 !important;
        height: auto !important;
        border-radius: 0 0 12px 12px !important;
    }
    
    .onlinelive-chat-message {
        max-width: 85%;
    }
    
    .onlinelive-chat-message-image img {
        max-width: 150px;
        max-height: 150px;
    }
}

@media (max-width: 480px) {
    .onlinelive-chat-window {
        width: 95% !important;
        height: 85vh !important;
        max-height: 600px !important;
        border-radius: 12px !important;
    }
}

/* 动画效果 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.onlinelive-chat-message {
    animation: fadeIn 0.3s ease;
}

/* 表情选择器 */
.onlinelive-emoji-picker {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 0;
    right: 0;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    max-height: 300px;
    overflow-y: auto;
    display: none !important;
    z-index: 10003;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.15);
    -webkit-overflow-scrolling: touch;
    margin-bottom: 8px;
}

.onlinelive-emoji-picker.active {
    display: block !important;
}

.onlinelive-emoji-picker-content {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 4px;
    padding: 12px;
}

.onlinelive-emoji-item {
    width: 100%;
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s;
    -webkit-tap-highlight-color: transparent;
    background: transparent;
    user-select: none;
}

.onlinelive-emoji-item:hover {
    background: #f3f4f6;
    transform: scale(1.1);
}

.onlinelive-emoji-item:active {
    background: #e5e7eb;
    transform: scale(0.95);
}

.onlinelive-chat-tool-btn.active {
    background: #10b981;
    color: #ffffff;
}

/* Configurable chat-window themes */
.onlinelive-chat-window {
    --onlinelive-chat-accent: #10b981;
    --onlinelive-chat-accent-dark: #059669;
    --onlinelive-chat-accent-ring: rgba(16, 185, 129, .14);
    --onlinelive-chat-body: #f9fafb;
}

.onlinelive-chat-window.onlinelive-chat-style-2 {
    --onlinelive-chat-accent: #3398cc;
    --onlinelive-chat-accent-dark: #247da9;
    --onlinelive-chat-accent-ring: rgba(51, 152, 204, .15);
    --onlinelive-chat-body: #f5f9fb;
    border-radius: 7px;
}

.onlinelive-chat-window.onlinelive-chat-style-3 {
    --onlinelive-chat-accent: #475569;
    --onlinelive-chat-accent-dark: #334155;
    --onlinelive-chat-accent-ring: rgba(71, 85, 105, .16);
    --onlinelive-chat-body: #f3f5f7;
    border-radius: 10px;
    box-shadow: 0 18px 48px rgba(15, 23, 42, .28);
}

.onlinelive-chat-window.onlinelive-chat-style-4 {
    --onlinelive-chat-accent: #e58b3a;
    --onlinelive-chat-accent-dark: #c66e22;
    --onlinelive-chat-accent-ring: rgba(229, 139, 58, .16);
    --onlinelive-chat-body: #fffaf5;
    border-radius: 16px;
}

.onlinelive-chat-window.onlinelive-chat-style-5 {
    --onlinelive-chat-accent: #7666b3;
    --onlinelive-chat-accent-dark: #5f5198;
    --onlinelive-chat-accent-ring: rgba(118, 102, 179, .16);
    --onlinelive-chat-body: #f8f7fc;
    border-radius: 12px;
}

.onlinelive-chat-window .onlinelive-chat-header,
.onlinelive-chat-window .onlinelive-user-avatar,
.onlinelive-chat-window .onlinelive-chat-message-bubble-right,
.onlinelive-chat-window .onlinelive-chat-tool-btn.active {
    background: var(--onlinelive-chat-accent) !important;
}

.onlinelive-chat-window .onlinelive-chat-body {
    background: var(--onlinelive-chat-body);
}

.onlinelive-chat-window .onlinelive-chat-avatar-circle,
.onlinelive-chat-window .onlinelive-chat-avatar-circle-small,
.onlinelive-chat-window .onlinelive-chat-message-name {
    color: var(--onlinelive-chat-accent);
}

.onlinelive-chat-window .onlinelive-chat-message-text .chat-message-link {
    color: var(--onlinelive-chat-accent-dark);
}

.onlinelive-chat-window .onlinelive-chat-input:focus {
    border-color: var(--onlinelive-chat-accent);
    box-shadow: 0 0 0 3px var(--onlinelive-chat-accent-ring);
}

.onlinelive-chat-window.onlinelive-chat-style-2 .onlinelive-chat-message-bubble,
.onlinelive-chat-window.onlinelive-chat-style-3 .onlinelive-chat-message-bubble {
    border-radius: 5px 11px 11px 11px;
}

.onlinelive-chat-window.onlinelive-chat-style-4 .onlinelive-chat-message-bubble {
    border-radius: 15px;
}

.onlinelive-chat-window.onlinelive-chat-style-5 .onlinelive-chat-message-bubble {
    border-radius: 4px 14px 14px 14px;
}

/* 表情选择器滚动条 */
.onlinelive-emoji-picker::-webkit-scrollbar {
    width: 6px;
}

.onlinelive-emoji-picker::-webkit-scrollbar-track {
    background: #f9fafb;
}

.onlinelive-emoji-picker::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 3px;
}

.onlinelive-emoji-picker::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* 访客姓名/邮箱聊天条件覆盖层 */
.onlinelive-chat-identity-gate {
    position: absolute;
    inset: 0;
    z-index: 10004;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 82px 24px 24px;
    background: rgba(15, 23, 42, .52);
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
    box-sizing: border-box;
}

.onlinelive-chat-identity-gate.active {
    display: flex;
}

.onlinelive-chat-identity-panel {
    width: min(100%, 390px);
    padding: 26px;
    background: #fff;
    border: 1px solid rgba(255, 255, 255, .82);
    border-radius: 16px;
    box-shadow: 0 22px 64px rgba(15, 23, 42, .28);
    box-sizing: border-box;
    animation: onlineliveIdentityEnter .22s ease-out;
}

@keyframes onlineliveIdentityEnter {
    from { opacity: 0; transform: translateY(10px) scale(.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.onlinelive-chat-identity-icon {
    width: 46px;
    height: 46px;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    background: var(--onlinelive-chat-accent);
    border-radius: 13px;
    font-size: 22px;
    box-shadow: 0 8px 20px var(--onlinelive-chat-accent-ring);
}

.onlinelive-chat-identity-title {
    color: #18212b;
    font-size: 20px;
    font-weight: 700;
    line-height: 1.3;
}

.onlinelive-chat-identity-title .onlinelive-identity-zh {
    margin-top: 3px;
    display: block;
    color: #66727d;
    font-size: 12px;
    font-weight: 500;
}

.onlinelive-chat-identity-description {
    margin: 7px 0 20px;
    color: #66727d;
    font-size: 13px;
    line-height: 1.65;
}

.onlinelive-chat-identity-description .onlinelive-identity-en,
.onlinelive-chat-identity-description .onlinelive-identity-zh {
    display: block;
}

.onlinelive-chat-identity-description .onlinelive-identity-zh {
    margin-top: 2px;
    color: #8a949d;
    font-size: 11px;
}

.onlinelive-chat-identity-field {
    margin-top: 12px;
    display: block;
}

.onlinelive-chat-identity-field > span {
    margin-bottom: 6px;
    display: block;
    color: #34414c;
    font-size: 12px;
    font-weight: 600;
}

.onlinelive-chat-identity-field > .onlinelive-identity-zh {
    margin: -3px 0 6px;
    display: block;
    color: #8a949d;
    font-size: 10px;
    font-weight: 400;
}

.onlinelive-chat-identity-field input {
    width: 100%;
    height: 44px;
    padding: 0 13px;
    color: #1f2933;
    background: #fff;
    border: 1px solid #d5dde3;
    border-radius: 9px;
    outline: none;
    font: inherit;
    font-size: 14px;
    transition: border-color .2s ease, box-shadow .2s ease;
    box-sizing: border-box;
}

.onlinelive-chat-identity-field input:focus {
    border-color: var(--onlinelive-chat-accent);
    box-shadow: 0 0 0 3px var(--onlinelive-chat-accent-ring);
}

.onlinelive-chat-identity-error {
    min-height: 18px;
    margin-top: 8px;
    color: #d14343;
    font-size: 12px;
    line-height: 18px;
}

.onlinelive-chat-identity-submit {
    width: 100%;
    height: 44px;
    margin-top: 3px;
    color: #fff;
    background: var(--onlinelive-chat-accent);
    border: 0;
    border-radius: 9px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: filter .2s ease, transform .2s ease, opacity .2s ease;
}

.onlinelive-chat-identity-submit:hover {
    filter: brightness(.94);
}

.onlinelive-chat-identity-submit:active {
    transform: translateY(1px);
}

.onlinelive-chat-identity-submit:disabled {
    cursor: wait;
    opacity: .68;
}

.onlinelive-chat-identity-submit .onlinelive-identity-en,
.onlinelive-chat-identity-submit .onlinelive-identity-zh {
    display: block;
}

.onlinelive-chat-identity-submit .onlinelive-identity-zh {
    margin-top: 1px;
    font-size: 10px;
    font-weight: 400;
    opacity: .82;
}

.onlinelive-identity-language-en .onlinelive-identity-zh,
.onlinelive-identity-language-zh .onlinelive-identity-en {
    display: none !important;
}

.onlinelive-identity-language-zh .onlinelive-chat-identity-title .onlinelive-identity-zh {
    margin-top: 0;
    color: #18212b;
    font-size: 20px;
    font-weight: 700;
}

.onlinelive-identity-language-zh .onlinelive-chat-identity-description .onlinelive-identity-zh {
    margin-top: 0;
    color: #66727d;
    font-size: 13px;
}

.onlinelive-identity-language-zh .onlinelive-chat-identity-field > .onlinelive-identity-zh {
    margin: 0 0 6px;
    color: #34414c;
    font-size: 12px;
    font-weight: 600;
}

.onlinelive-identity-language-zh .onlinelive-chat-identity-submit .onlinelive-identity-zh {
    margin-top: 0;
    font-size: 14px;
    font-weight: 600;
    opacity: 1;
}

@media (max-width: 600px) {
    .onlinelive-chat-identity-gate {
        padding: 76px 16px 16px;
    }

    .onlinelive-chat-identity-panel {
        padding: 22px 20px;
        border-radius: 14px;
    }
}

/* 手机端使用独立全屏聊天页面，跟随 visualViewport 避免软键盘遮住输入区。 */
@media (max-width: 768px) {
    html.onlinelive-chat-mobile-open,
    body.onlinelive-chat-mobile-open {
        width: 100% !important;
        height: 100% !important;
        overflow: hidden !important;
        overscroll-behavior: none !important;
    }

    .onlinelive-chat-overlay,
    .onlinelive-chat-overlay.active {
        inset: 0 !important;
        width: 100vw !important;
        height: var(--onlinelive-mobile-viewport-height, 100dvh) !important;
        max-width: none !important;
        max-height: none !important;
        padding: 0 !important;
        align-items: stretch !important;
        justify-content: stretch !important;
        background: #fff !important;
    }

    .onlinelive-chat-window {
        width: 100vw !important;
        max-width: none !important;
        height: var(--onlinelive-mobile-viewport-height, 100dvh) !important;
        max-height: none !important;
        margin: 0 !important;
        border: 0 !important;
        border-radius: 0 !important;
        box-shadow: none !important;
    }

    .onlinelive-chat-header {
        min-height: calc(58px + env(safe-area-inset-top)) !important;
        padding: calc(9px + env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) 9px max(12px, env(safe-area-inset-left)) !important;
        border-radius: 0 !important;
        box-sizing: border-box !important;
    }

    .onlinelive-chat-header-actions,
    .onlinelive-chat-close {
        min-width: 44px !important;
        min-height: 44px !important;
    }

    .onlinelive-chat-body {
        padding-right: max(14px, env(safe-area-inset-right)) !important;
        padding-left: max(14px, env(safe-area-inset-left)) !important;
        overscroll-behavior: contain !important;
    }

    .onlinelive-chat-footer {
        padding: 10px max(12px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left)) !important;
        border-radius: 0 !important;
        box-sizing: border-box !important;
    }

    .onlinelive-chat-input {
        min-height: 44px !important;
        max-height: 96px !important;
    }

    .onlinelive-chat-tool-btn {
        width: 40px !important;
        height: 44px !important;
    }

    .onlinelive-chat-identity-gate {
        inset: 0 !important;
        padding: calc(72px + env(safe-area-inset-top)) 14px max(14px, env(safe-area-inset-bottom)) !important;
        overflow-x: hidden !important;
        overflow-y: auto !important;
        box-sizing: border-box !important;
        -webkit-overflow-scrolling: touch !important;
    }

    .onlinelive-chat-identity-panel {
        width: min(100%, 390px) !important;
        max-height: none !important;
        margin: auto !important;
        padding: 20px 18px !important;
        border-radius: 14px !important;
        box-sizing: border-box !important;
    }
}
