/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* 与 .app-container max-width 一致，用于 fixed 定位对齐主栏（避免宽屏落在栏外或被 overflow 裁切） */
    --app-column-max: 600px;
    --primary-color: #8f85fe;
    --primary-hover: #4f46e5;
    --secondary-color: #2cbe60;
    --danger-color: #ef4444;
    --bg-color: #f3f4f6;
    --card-bg: #ffffff;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --border-color: #e5e7eb;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --transition: all 0.3s ease;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

.hidden {
    display: none !important;
}

.guest-name-modal {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.guest-name-card {
    width: 100%;
    max-width: 360px;
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    box-shadow: var(--shadow-lg);
}

.guest-name-card h3 {
    margin-bottom: 8px;
}

.guest-name-card p {
    margin-bottom: 12px;
    color: var(--text-secondary);
    font-size: 14px;
}

.guest-entry-desc {
    margin-bottom: 14px;
}

.guest-entry-field {
    margin-bottom: 12px;
}

.guest-entry-field label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.guest-entry-card .guest-entry-field input {
    margin-bottom: 0;
}

.guest-name-card input {
    width: 100%;
    height: 40px;
    padding: 0 10px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 12px;
}

.guest-name-card button,
.guest-name-card a.btn {
    width: 100%;
    height: 40px;
    border: none;
    border-radius: 8px;
    background: var(--primary-color);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

/* 连接成功：窄卡片、成功色、与访客弹窗同一套按钮比例 */
.connection-success-modal {
    backdrop-filter: blur(3px);
}

.connection-success-card {
    width: 100%;
    max-width: 252px;
    padding: 18px 18px 16px;
    text-align: center;
    border-radius: 14px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-md);
}

.connection-success-card .connection-success-icon {
    width: 44px;
    height: 44px;
    margin: 0 auto 10px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #047857;
    background: rgba(16, 185, 129, 0.12);
}

.connection-success-title {
    margin: 0 0 14px !important;
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    color: var(--text-primary);
}

.connection-success-sub {
    margin: 0 0 22px !important;
    font-size: 0.875rem;
    line-height: 1.45;
    color: var(--text-secondary);
}

.connection-success-btn {
    width: 100% !important;
    height: 40px !important;
    margin: 0;
    padding: 0 16px !important;
    border-radius: 8px !important;
    font-size: 0.9375rem;
    font-weight: 500;
    background: var(--secondary-color) !important;
    box-shadow: none;
    transition: background 0.15s ease, transform 0.12s ease;
}

.connection-success-btn:hover {
    background: #059669 !important;
    box-shadow: none;
}

.connection-success-btn:active {
    transform: scale(0.99);
}

/* 麦克风权限拒绝提示弹窗 */
.mic-permission-card {
    max-width: 420px;
    max-height: 85vh;
    overflow-y: auto;
}

.mic-permission-intro {
    margin-bottom: 12px !important;
}

.mic-permission-steps {
    margin-bottom: 16px;
}

.mic-permission-item {
    margin-bottom: 14px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

.mic-permission-item:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.mic-permission-item strong {
    display: block;
    margin-bottom: 6px;
    color: var(--text-primary);
    font-size: 14px;
}

.mic-permission-item p {
    margin-bottom: 4px !important;
    font-size: 13px;
    line-height: 1.5;
}

/* 房间内自定义确认弹窗（替代原生 confirm） */
.room-confirm-overlay {
    backdrop-filter: blur(4px);
    z-index: 1100;
}

.room-confirm-card {
    max-width: 380px;
}

.room-confirm-card h3 {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-primary);
}

.room-confirm-message {
    margin-bottom: 18px !important;
    font-size: 0.9375rem;
    line-height: 1.55;
    color: var(--text-secondary);
}

.room-confirm-actions {
    display: flex;
    gap: 10px;
    margin-top: 4px;
}

.room-confirm-actions .room-confirm-btn {
    width: auto !important;
    margin: 0 !important;
}

.room-confirm-btn {
    flex: 1;
    min-width: 0;
    height: 42px !important;
    border-radius: 10px !important;
    font-size: 0.9375rem !important;
    font-weight: 500 !important;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}

.room-confirm-btn-cancel {
    background: var(--card-bg) !important;
    color: var(--text-primary) !important;
    border: 1px solid var(--border-color) !important;
}

.room-confirm-btn-cancel:hover {
    background: var(--bg-color) !important;
}

.room-confirm-btn-ok {
    background: var(--primary-color) !important;
    color: #fff !important;
    border: none !important;
}

.room-confirm-btn-ok:hover {
    background: var(--primary-hover) !important;
}

.room-confirm-btn-ok.room-confirm-btn-danger {
    background: var(--danger-color) !important;
}

.room-confirm-btn-ok.room-confirm-btn-danger:hover {
    background: #dc2626 !important;
}

.room-confirm-btn:active {
    transform: scale(0.99);
}

/* 主容器 - 兼容 PC 和手机 */
.app-container {
    width: 100%;
    max-width: var(--app-column-max);
    margin: 0 auto;
    background: var(--card-bg);
    min-height: 100vh;
    min-height: 100dvh;
    /* 限制为视口高度，避免中间区被内容撑满屏导致滚动落在外层而非 #conversationArea */
    height: 100vh;
    height: 100dvh;
    max-height: 100vh;
    max-height: 100dvh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    position: relative;
    /* 去掉左右边框和阴影，实现干净的居中布局 */
    box-shadow: none;
    border-left: 1px solid var(--border-color);
    border-right: 1px solid var(--border-color);
}

@media (max-width: 600px) {
    .app-container {
        border: none;
    }
}

/* 顶部栏 */
.header {
    background: var(--card-bg);
    color: var(--text-primary);
    padding: 0.5rem 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid var(--border-color);
    min-width: 0;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
    flex-shrink: 0;
}

/* 底部连接状态：两节链条 + 断开时斜杠 */
.status-chain {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    color: #9ca3af;
    transition: color 0.25s ease;
}

.status-chain-svg {
    display: block;
}

.status-chain-svg path,
.status-chain-svg line {
    fill: none;
    stroke: currentColor;
}

.status-chain-slash {
    stroke-width: 2.5;
    opacity: 1;
    transition: opacity 0.2s ease;
}

.status-chain.connected {
    color: var(--secondary-color);
}

.status-chain.connected .status-chain-slash {
    opacity: 0;
}

/* 顶栏：房主昵称 + 邀请（昵称在邀请按钮左侧） */
.header-link-group {
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
    margin: 0 0.5rem 0 0;
    min-width: 0;
}

.header-owner-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 8rem;
    flex-shrink: 1;
}

.header-invite-wrap {
    flex-shrink: 0;
}

.header-link-copy {
    height: 1.7rem;
    padding: 0 0.75rem;
    background: #2cbe60;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.header-link-copy:hover {
    background: #059669;
}

.header-icon {
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    transition: var(--transition);
}

.header-icon:hover {
    background: var(--bg-color);
    color: var(--primary-color);
}

.header-participants {
    position: relative;
    margin-right: 0.25rem;
    flex-shrink: 0;
}

/* 顶栏设置（与会者并列）；余额不足时 bottom-controls 隐藏，此处仍可见 */
.header .bottom-settings-icon {
    flex-shrink: 0;
    margin-left: 0.15rem;
}

/* 手机竖屏：顶栏收窄左右边距；房间号区仍按内容宽度，总宽不超过视口 */
@media (max-width: 640px) and (orientation: portrait) {
    .header {
        padding-left: 0.45rem;
        padding-right: 0.45rem;
    }

    .header-link-group {
        margin-left: 0.35rem;
        margin-right: 0.35rem;
    }

    .header-owner-name {
        max-width: 5rem;
    }
}

.participant-count {
    position: absolute;
    top: -2px;
    right: -2px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    font-size: 10px;
    font-weight: 600;
    line-height: 16px;
    text-align: center;
    background: var(--primary-color);
    color: white;
    border-radius: 8px;
}

/* 参会者列表 */
.participants-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.participant-item {
    display: flex;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-color);
}

.participant-item:last-child {
    border-bottom: none;
}

.participant-name {
    font-size: 0.95rem;
    color: var(--text-primary);
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.participant-main {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
    min-width: 0;
}

.participant-tail {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.participant-mic {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    line-height: 0;
}

.participant-mic-svg {
    display: block;
}

.participant-mic-on {
    color: #15803d;
}

.participant-mic-off {
    color: var(--text-muted, #64748b);
}

/* 房主点击他人开麦图标：代关麦 */
button.participant-mic-owner-mute {
    background: none;
    border: none;
    padding: 0;
    margin: 0;
    cursor: pointer;
    font: inherit;
    line-height: 0;
}

button.participant-mic-owner-mute:focus-visible {
    outline: 2px solid var(--accent-color, #2563eb);
    outline-offset: 2px;
    border-radius: 4px;
}

.participant-kick-btn {
    /* 较上一版整体放大 25%（按钮可点区域与字号） */
    padding: 0.29rem 0.625rem;
    font-size: 0.6625rem;
    background: transparent;
    color: var(--danger-color);
    border: 1px solid var(--danger-color);
    border-radius: 5px;
    cursor: pointer;
    transition: var(--transition);
}

.participant-kick-btn:hover {
    background: var(--danger-color);
    color: white;
}

.participant-kick-btn:disabled,
.participant-kick-btn.hidden {
    display: none;
}

/* 房间链接栏 */
.room-link-bar {
    padding: 1rem 1.25rem;
    background: #f8fafc;
    border-bottom: 1px solid var(--border-color);
}

.room-link-label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.room-link-group {
    display: flex;
    gap: 0.5rem;
}

.room-link-input {
    flex: 1;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.9rem;
    background: white;
    color: var(--text-primary);
    transition: var(--transition);
}

.room-link-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.room-link-copy {
    padding: 0 1rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.room-link-copy:hover {
    background: var(--primary-hover);
}

/* 主面板区 */
.main-body {
    flex: 1;
    /* 允许在 flex 列布局中低于内容高度，否则子项会撑开整页，聊天区无法内部滚动（手机竖屏常见） */
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* 语言选择栏（保留旧样式用于其他页面） */
.lang-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
    background: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    z-index: 10;
    box-shadow: var(--shadow-sm);
}

.lang-select {
    padding: 0.5rem 2rem 0.5rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    font-size: 0.95rem;
    font-weight: 500;
    background: white;
    color: var(--text-primary);
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%236b7280'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1rem;
    transition: var(--transition);
}

.lang-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.lang-arrow {
    color: var(--text-secondary);
    display: flex;
    align-items: center;
}

/* 底部栏紧凑型语言选择 */
.lang-group {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.lang-group-label {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    white-space: nowrap;
}

/* 手机窄屏：不显示「我说」，与此前纯下拉布局一致 */
@media (max-width: 520px) {
    .lang-group-label--desktop-only {
        display: none;
    }
}

.lang-select-sm {
    padding: 0.4rem 1.5rem 0.4rem 0.6rem;
    border: 1px solid var(--border-color);
    border-radius: 16px;
    font-size: 0.8rem;
    font-weight: 500;
    background: white;
    color: var(--text-primary);
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%236b7280'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.4rem center;
    background-size: 0.8rem;
    transition: var(--transition);
}

.lang-select-sm:focus {
    outline: none;
    border-color: var(--primary-color);
}

.lang-arrow-sm {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

/* 对话区域 */
.conversation-area {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 1.25rem;
    background: #f9fafb;
    scroll-behavior: smooth;
}

.room-alone-hint {
    text-align: center;
    padding: 0.75rem 1.5rem;
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary-color);
    border-radius: 20px;
    font-size: 0.85rem;
    margin: 1rem auto;
    width: fit-content;
    font-weight: 500;
}

.conversation-list {
    display: flex;
    flex-direction: column;
    /* 原 0.5rem，缩小约 1/3 */
    gap: calc(0.5rem * 2 / 3);
}

/* 聊天流内按分钟居中的时间分隔 */
.message-time-divider {
    align-self: center;
    width: 100%;
    text-align: center;
    padding: calc(0.25rem * 2 / 3) 0;
    flex-shrink: 0;
}

.message-time-divider span {
    display: inline-block;
    padding: calc(0.2rem * 2 / 3) 0.65rem;
    font-size: 0.72rem;
    color: var(--text-secondary, #888);
    background: rgba(0, 0, 0, 0.06);
    border-radius: 10px;
}

/* 同语言原声等系统说明行 */
.chat-system-notice {
    align-self: center;
    width: 100%;
    text-align: center;
    padding: calc(0.35rem * 2 / 3) 0.75rem;
    font-size: 0.78rem;
    color: var(--text-secondary, #888);
    /* 原 1.45，缩小约 1/3 的额外行距：(1.45-1)*2/3+1 ≈ 1.3 */
    line-height: 1.3;
    flex-shrink: 0;
}

.chat-recall-notice .chat-recall-reedit-link {
    color: var(--primary-color, #2563eb);
    text-decoration: none;
    cursor: pointer;
}

.chat-recall-notice .chat-recall-reedit-link:hover {
    text-decoration: underline;
}

.message-context-menu-backdrop {
    position: fixed;
    inset: 0;
    z-index: 10049;
    background: transparent;
    pointer-events: auto;
}

.message-context-menu-backdrop.hidden {
    display: none;
}

.message-context-menu {
    position: fixed;
    z-index: 10050;
    pointer-events: auto;
    min-width: 7rem;
    padding: 0.25rem 0;
    background: var(--surface-elevated, #fff);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.message-context-menu.hidden {
    display: none;
}

.message-context-menu-item {
    display: block;
    width: 100%;
    padding: 0.5rem 1rem;
    border: none;
    background: none;
    font: inherit;
    font-size: 0.9rem;
    text-align: left;
    cursor: pointer;
    color: var(--text-primary, #111);
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.message-context-menu-item:hover {
    background: rgba(0, 0, 0, 0.06);
}

.message-context-menu-item.hidden {
    display: none;
}

html.transtalk-mobile .message-context-menu-item:not(.hidden) {
    min-height: 44px;
    display: flex;
    align-items: center;
}

/* 本地缓存进房预览：展开完整历史 */
.chat-history-expand-row {
    align-self: center;
    width: 100%;
    text-align: center;
    padding: calc(0.35rem * 2 / 3) 0.75rem;
    flex-shrink: 0;
}

.chat-history-expand-btn {
    font: inherit;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--primary-color);
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.chat-history-expand-btn:hover {
    opacity: 0.88;
}

.chat-history-expand-btn:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* 对话气泡 */
.message-bubble {
    max-width: 85%;
    padding: calc(0.425rem * 2 / 3) calc(0.625rem * 2 / 3);
    border-radius: 6px;
    word-wrap: break-word;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    /* 原 1.5 → (1.5-1)*2/3+1 ≈ 1.33 */
    line-height: 1.33;
    font-size: 0.95rem;
    box-shadow: var(--shadow-sm);
}

/* 左侧气泡尾巴（别人发的） */
.message-bubble.original:not(.message-self)::after,
.message-bubble.translated:not(.message-self)::after {
    content: '';
    position: absolute;
    left: -6px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-top: 6px solid transparent;
    border-bottom: 6px solid transparent;
    border-right: 8px solid white;
}

/* 右侧气泡尾巴（自己发的，需在别人之后以覆盖 original） */
.message-bubble.message-self::after,
.message-bubble.translated.message-self::after,
.message-bubble.original.message-self::after {
    content: '';
    position: absolute;
    right: -6px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-top: 6px solid transparent;
    border-bottom: 6px solid transparent;
    border-left: 8px solid #95EC68;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(15px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message-bubble.original {
    align-self: flex-start;
    background: white;
    color: var(--text-primary);
    border-bottom-left-radius: 6px;
}

.message-bubble.translated {
    align-self: flex-end;
    background: var(--primary-color);
    color: white;
    border-bottom-right-radius: 6px;
}

/* 别人说的：统一放左边、白底 */
.message-bubble.translated:not(.message-self) {
    align-self: flex-start;
    background: white;
    color: var(--text-primary);
    border-bottom-left-radius: 6px;
    border-bottom-right-radius: 6px;
}

.message-bubble.translated:not(.message-self) .message-speaker {
    color: var(--text-secondary, #666);
}

/* 自己发的消息：右侧、黄底 #95EC68 */
.message-bubble.message-self,
.message-bubble.translated.message-self {
    align-self: flex-end;
    background: #95EC68;
    color: var(--text-primary);
    border-bottom-right-radius: 6px;
}

.message-bubble.message-self .message-speaker,
.message-bubble.translated.message-self .message-speaker {
    color: rgba(0, 0, 0, 0.6);
}

.message-speaker {
    font-size: 0.8rem;
    color: var(--text-secondary, #666);
    font-weight: 500;
    margin-right: 0.25rem;
}

.message-bubble.translated .message-speaker {
    color: rgba(255, 255, 255, 0.9);
}

.message-text {
    margin-bottom: calc(0.25rem * 2 / 3);
}

.message-text .message-inline-image {
    display: block;
    max-width: min(100%, 280px);
    max-height: 240px;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 8px;
    margin-top: 0.2rem;
    vertical-align: top;
}

.message-text .keyword {
    background: rgba(250, 204, 21, 0.4);
    padding: 0 0.25rem;
    border-radius: 6px;
    font-weight: 600;
}

.message-bubble.translated .message-text .keyword {
    background: rgba(255, 255, 255, 0.2);
}

.message-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
    font-size: 0.8rem;
    justify-content: flex-end;
}

.message-actions button {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    cursor: pointer;
    color: white;
    font-size: 0.75rem;
    transition: var(--transition);
}

.message-actions button:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* 底部控制区 */
.bottom-controls {
    background: var(--card-bg);
    padding: 0.35rem 1rem;
    border-top: 1px solid var(--border-color);
    z-index: 10;
}

.bottom-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

/* 播放模式下拉 */
.bottom-dub-gender-cluster {
    display: flex;
    align-items: center;
    gap: 0.2rem;
    flex-shrink: 0;
}

.bottom-dub-gender-cluster .playback-mode-select {
    max-width: 11rem;
    min-width: 6.5rem;
}

.bottom-status-group {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    /* 窄屏下保证连接状态与设置齿轮不被挤出视口 */
    flex-shrink: 0;
    min-width: fit-content;
}

.bottom-settings-icon {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
}

/* 麦克风组（文字+按钮） */
.mic-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.mic-label-sm {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* 紧凑型麦克风按钮 */
.mic-btn-sm {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: #e5e7eb;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    flex-shrink: 0;
}

.mic-btn-sm .mic-icon {
    display: none;
}

.mic-btn-sm .mic-icon-off {
    display: block;
}

.mic-btn-sm:hover {
    transform: scale(1.05);
    background: #d1d5db;
}

.mic-btn-sm:active {
    transform: scale(0.95);
}

.mic-btn-sm.recording {
    background: var(--secondary-color);
    color: white;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
    animation: micPulseSm 1.5s infinite;
}

.mic-btn-sm.recording .mic-icon {
    display: block;
}

.mic-btn-sm.recording .mic-icon-off {
    display: none;
}

@keyframes micPulseSm {
    0% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4);
    }

    70% {
        box-shadow: 0 0 0 6px rgba(16, 185, 129, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
    }
}

/* 紧凑型原声/配音开关（轨道固定为 --secondary-color，仅滑块左右移动） */
.auto-read-toggle-compact {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    flex-shrink: 0;
}

.auto-read-toggle-compact input {
    display: none;
}

.toggle-label-sm {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.toggle-label-read-left,
.toggle-label-read-right {
    min-width: 2em;
    text-align: center;
    font-size: 0.75rem;
}

.toggle-label-read-left {
    text-align: right;
}

.toggle-label-read-right {
    text-align: left;
}

.toggle-track-sm {
    width: 36px;
    height: 20px;
    background: var(--secondary-color);
    border-radius: 20px;
    position: relative;
    flex-shrink: 0;
    transition: var(--transition);
}

.toggle-thumb-sm {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    background: white;
    border-radius: 50%;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: var(--shadow-sm);
}

.auto-read-toggle-compact input:checked+.toggle-track-sm .toggle-thumb-sm {
    transform: translateX(16px);
}

.auto-read-toggle-compact.auto-read-toggle-disabled {
    cursor: not-allowed;
}

.auto-read-toggle-compact.auto-read-toggle-disabled .toggle-label-sm {
    opacity: 0.75;
}

/* 无效场景：轨道改灰，避免仍呈绿色像「已开启可用」 */
.auto-read-toggle-compact.auto-read-toggle-disabled .toggle-track-sm,
.auto-read-toggle-compact input:disabled+.toggle-track-sm {
    background: #999999;
}

/* 大尺寸麦克风按钮（保留用于其他页面） */
.mic-btn {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: none;
    background: #e5e7eb;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--shadow-md);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    flex-shrink: 0;
}

.mic-btn .mic-icon {
    display: none;
}

.mic-btn .mic-icon-off {
    display: block;
}

.mic-btn:hover {
    transform: scale(1.05);
    background: #d1d5db;
}

.mic-btn:active {
    transform: scale(0.95);
}

.mic-btn.recording {
    background: var(--primary-color);
    color: white;
    box-shadow: 0 0 0 6px rgba(99, 102, 241, 0.2), var(--shadow-lg);
    animation: micPulse 1.5s infinite;
}

.mic-btn.recording .mic-icon {
    display: block;
}

.mic-btn.recording .mic-icon-off {
    display: none;
}

@keyframes micPulse {
    0% {
        box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.4);
    }

    70% {
        box-shadow: 0 0 0 12px rgba(99, 102, 241, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(99, 102, 241, 0);
    }
}

/* 保留旧样式用于其他页面 */
.mic-row {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}

.mic-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.auto-read-toggle {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.auto-read-toggle input {
    display: none;
}

.toggle-track {
    width: 48px;
    height: 26px;
    background: #cbd5e1;
    border-radius: 26px;
    position: relative;
    transition: var(--transition);
}

.toggle-thumb {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: var(--shadow-sm);
}

.auto-read-toggle input:checked+.toggle-track {
    background: var(--secondary-color);
}

.auto-read-toggle input:checked+.toggle-track .toggle-thumb {
    transform: translateX(22px);
}

.toggle-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 500;
}


/* --- 以下为原有工具类和其它页面的样式支持 --- */

.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-secondary {
    background: #e5e7eb;
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: #d1d5db;
}

.btn-danger {
    background: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

.icon-btn {
    background: rgba(0, 0, 0, 0.05);
    border: none;
    color: var(--text-primary);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    transition: var(--transition);
    text-decoration: none;
}

.icon-btn:hover {
    background: rgba(0, 0, 0, 0.1);
}

/* 设置面板等 */
.panel {
    padding: 1.5rem;
}

.settings-panel {
    flex: 1;
}

.settings-content {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.setting-item {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.setting-item label {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-secondary);
    letter-spacing: 0.02em;
}

/* 紧凑单行布局（设置弹窗：略增行距便于扫读） */
.modal-body-compact {
    gap: 0.85rem !important;
    padding: 1.1rem 1.35rem 1.5rem !important;
}

.setting-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-height: 2.25rem;
}

.setting-row.hidden {
    display: none;
}

.setting-row-room-password {
    flex-wrap: wrap;
    align-items: flex-start;
}

.setting-row-room-password .setting-hint {
    flex: 1 1 100%;
    margin: 0.2rem 0 0 0;
    padding-left: calc(33.333% + 0.5rem);
    box-sizing: border-box;
    font-size: 0.8125rem;
    color: #64748b;
    line-height: 1.45;
}

.setting-label {
    flex-shrink: 0;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-align: right;
}

/* 设置弹窗：标签左对齐；左侧标签列 1/3 宽（无标签的整行操作排除） */
.settings-modal-content .setting-label {
    text-align: left;
}

/* 设置弹窗：左侧标签列固定为内容区宽度的 1/3，避免多语言长文案挤压、折行错乱 */
.settings-modal-content .setting-row:not(.setting-row-textarea):not(.setting-row-btn-row):not(.setting-row-feedback-submit):not(.setting-row-owner-balance) .setting-label {
    flex: 0 0 33.333%;
    width: 33.333%;
    max-width: 33.333%;
    min-width: 0;
    box-sizing: border-box;
    padding-right: 0.35rem;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

/* 设置弹窗：输入与标签同向左对齐，正文与占位符层次区分 */
.settings-modal-content .setting-input,
.settings-modal-content .setting-textarea,
.settings-modal-content .setting-select {
    text-align: left;
    color: var(--text-primary);
}

.settings-modal-content .setting-input::placeholder,
.settings-modal-content .setting-textarea::placeholder {
    color: #94a3b8;
    opacity: 1;
}

/* 下拉：左侧文案 + 右侧自定义箭头，边框与单行输入一致 */
.settings-modal-content .setting-select {
    padding-right: 2.5rem;
    color: var(--text-primary);
    border-color: #d1d5db;
}

/* 设置弹窗：标签略深于辅助说明，层次更清晰 */
.settings-modal-content .setting-label {
    color: #334155;
    font-weight: 600;
    font-size: 0.875rem;
}

.settings-modal-content .modal-header {
    padding-bottom: 0.85rem;
}

.settings-modal-content .modal-title {
    color: #0f172a;
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1.35;
}

.setting-input {
    flex: 1;
    min-width: 0;
    padding: 0.45rem 0.65rem;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 0.9rem;
    outline: none;
    background: #fff;
}

.setting-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}

.setting-input-flex {
    flex: 1;
    min-width: 0;
    padding: 0.4rem 1.5rem 0.4rem 0.6rem;
    font-size: 0.9rem;
}

.model-status-inline {
    flex: 1;
    min-width: 0;
    padding: 0.35rem 0.6rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
    background: #f8fafc;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.setting-row-textarea {
    align-items: stretch;
}

.setting-textarea {
    flex: 1;
    min-width: 0;
    width: 100%;
    min-height: 72px;
    padding: 0.55rem 0.65rem;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 0.9rem;
    font-family: inherit;
    line-height: 1.45;
    resize: vertical;
    outline: none;
    background: #fff;
}

.setting-textarea:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}

.btn-sm {
    padding: 0.4rem 0.75rem;
    font-size: 0.82rem;
    flex-shrink: 0;
    border-radius: 8px;
}

/* 提交反馈：单独一行，按钮靠右 */
.settings-modal-content .setting-row-feedback-submit {
    justify-content: flex-end;
    min-height: 2rem;
    margin-top: 0.15rem;
}

/* 导出聊天记录 + 退出登录：与上方表单项区隔 */
.settings-modal-content .setting-row-btn-row {
    justify-content: flex-end;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: 0.5rem;
    padding-top: 0.85rem;
    border-top: 1px solid var(--border-color);
}

.setting-row-center {
    justify-content: center;
}

.setting-select {
    padding: 0.65rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    font-size: 0.95rem;
    background: white;
    outline: none;
    transition: var(--transition);
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%236b7280'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1rem;
}

.setting-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.model-status {
    padding: 0.75rem 1rem;
    background: #f8fafc;
    border-radius: 10px;
    font-size: 0.85rem;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
}

.nickname-edit-row {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.nickname-edit-row input {
    flex: 1;
    padding: 0.65rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    font-size: 0.95rem;
    outline: none;
}

.nickname-edit-row input:focus {
    border-color: var(--primary-color);
}

.feedback-form {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.feedback-form input,
.feedback-form textarea {
    padding: 0.65rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    font-size: 0.95rem;
    outline: none;
    font-family: inherit;
}

.feedback-form input:focus,
.feedback-form textarea:focus {
    border-color: var(--primary-color);
}

.feedback-form textarea {
    resize: vertical;
    min-height: 80px;
}

/* 设置弹窗 */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    align-items: flex-end;
    justify-content: center;
}

.modal.show {
    display: flex;
    animation: modalFadeIn 0.25s ease;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.modal-content {
    background: var(--card-bg);
    width: 100%;
    max-width: 600px;
    border-radius: 20px 20px 0 0;
    max-height: 85vh;
    overflow-y: auto;
    animation: modalSlideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalSlideUp {
    from {
        transform: translateY(100%);
    }

    to {
        transform: translateY(0);
    }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

.modal-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.modal-close-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: var(--bg-color);
    color: var(--text-secondary);
    border-radius: 50%;
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    line-height: 1;
}

.modal-close-btn:hover {
    background: #e5e7eb;
    color: var(--text-primary);
}

.modal-body {
    padding: 1.25rem 1.5rem 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.btn-full {
    width: 100%;
}

@media (min-width: 601px) {
    .modal {
        align-items: center;
    }

    .modal-content {
        border-radius: 16px;
        max-width: 420px;
        max-height: 80vh;
        box-shadow: var(--shadow-lg);
    }

    /* 设置弹窗内容较多，适当加宽 */
    .settings-modal-content {
        max-width: 520px;
    }

    .recharge-modal-content {
        max-width: 520px;
    }

    @keyframes modalSlideUp {
        from {
            opacity: 0;
            transform: translateY(20px) scale(0.97);
        }

        to {
            opacity: 1;
            transform: translateY(0) scale(1);
        }
    }
}

/* 房主：设置内余额与充值（标签 + 分钟数同一行左侧，按钮右侧） */
.setting-row-owner-balance {
    align-items: flex-start;
    min-height: auto;
}

.setting-row-owner-balance>.owner-balance-row-inner {
    width: 100%;
    min-width: 0;
    flex: 1 1 100%;
}

.owner-balance-main {
    width: 100%;
    min-width: 0;
}

.owner-balance-line1 {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem 0.75rem;
    width: 100%;
    min-width: 0;
}

.owner-balance-head {
    display: flex;
    flex-wrap: nowrap;
    align-items: baseline;
    gap: 0.35rem;
    flex: 0 1 auto;
    min-width: 0;
    white-space: nowrap;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* 覆盖设置弹窗默认「标签列 33%」，与本行布局一致 */
.settings-modal-content .setting-row-owner-balance .owner-balance-head .setting-label {
    flex: 0 0 auto;
    width: auto;
    max-width: none;
    padding-right: 0;
    font-weight: 600;
    color: var(--text-primary);
}

.owner-balance-num,
.owner-balance-unit {
    flex-shrink: 0;
}

.owner-balance-num {
    font-variant-numeric: tabular-nums;
}

.owner-balance-unit {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.owner-balance-meta {
    font-size: 0.8rem;
    font-weight: 400;
    color: var(--text-secondary);
}

.owner-balance-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
    flex: 0 0 auto;
}

.recharge-sub-hint,
.recharge-scan-hint {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.45;
    margin: 0;
}

.recharge-preset-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.recharge-preset-row .recharge-amt-preset::after {
    content: ' ¥';
    font-size: 0.85em;
    opacity: 0.85;
}

.recharge-amount-row {
    margin-top: 0.25rem;
}

.recharge-amount-input {
    max-width: 140px;
}

.recharge-gen-wrap {
    margin-top: 0.25rem;
}

.recharge-h5-section {
    margin-top: 0.75rem;
}

.recharge-h5-btn-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.recharge-h5-pay-btn {
    flex: 1 1 140px;
    min-width: 0;
    background: #dcfce7;
    color: #15803d;
}

.recharge-h5-pay-btn:hover {
    background: #bbf7d0;
    color: #15803d;
}

.recharge-qr-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-top: 0.75rem;
}

.recharge-qr-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
}

.recharge-qr-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
}

.recharge-qr-frame {
    width: 200px;
    max-width: 100%;
    min-height: 200px;
    border-radius: 8px;
    position: relative;
    overflow: hidden;
}

.recharge-qr-frame.recharge-qr-frame--fail {
    background-color: #edf0f5;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200' viewBox='0 0 200 200'%3E%3Crect fill='%23edf0f5' width='200' height='200' rx='8'/%3E%3Cpath fill='none' stroke='%23cfd6e0' stroke-width='2.5' d='M52 52h38v38H52zM112 114h38v38h-38z'/%3E%3Ccircle cx='100' cy='100' r='36' fill='none' stroke='%23b8c2d1' stroke-width='2.5'/%3E%3Cpath stroke='%23c45858' stroke-width='5' stroke-linecap='round' d='M76 124l48-48M124 124l-48-48'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 148px;
    outline: 1px dashed rgba(148, 163, 184, 0.55);
}

.recharge-qr-frame.recharge-qr-frame--fail .recharge-qr-canvas {
    visibility: hidden;
    position: absolute;
    inset: 0;
    opacity: 0;
    pointer-events: none;
}

.recharge-qr-canvas {
    display: block;
    width: 200px;
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    background: #fff;
}

@media (max-width: 480px) {
    .recharge-qr-grid {
        grid-template-columns: 1fr;
    }
}

/* 加载提示 */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(4px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading-text {
    margin-top: 1rem;
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 500;
}

/* 提示消息 - 位于顶部栏下方 */
.toast {
    position: fixed;
    top: 3.5rem;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(31, 41, 55, 0.9);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 30px;
    box-shadow: var(--shadow-md);
    z-index: 1500;
    animation: toastSlide 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    font-size: 0.9rem;
    backdrop-filter: blur(4px);
}

@keyframes toastSlide {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-8px);
    }

    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* 右下角文字输入：折叠为笔形 FAB，展开为底栏 + 发送箭头 */
.chat-text-dock {
    position: fixed;
    z-index: 25;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    pointer-events: none;
}

.chat-text-dock>* {
    pointer-events: auto;
}

.chat-text-dock--collapsed {
    /* 高于底部栏，避免笔形 FAB 压住状态/设置等图标 */
    bottom: calc(3.5rem + env(safe-area-inset-bottom, 0px));
    /* 宽屏：笔形 FAB 落在居中主栏内右侧；窄屏：与 1rem 边距一致 */
    right: max(1rem, env(safe-area-inset-right, 0px), calc(50vw - var(--app-column-max) / 2 + 1rem));
    left: auto;
    width: auto;
    padding: 0;
    justify-content: flex-end;
}

.chat-text-dock--collapsed .chat-text-input-wrap {
    display: none;
}

.chat-text-dock:not(.chat-text-dock--collapsed) {
    /* 与主栏同宽，避免展开条在 PC 上铺满整屏视口；+2px 相对主栏左右各缩进 2px */
    left: calc(max(env(safe-area-inset-left, 0px), calc(50vw - var(--app-column-max) / 2)) + 2px);
    right: calc(max(env(safe-area-inset-right, 0px), calc(50vw - var(--app-column-max) / 2)) + 2px);
    bottom: calc(4.75rem + env(safe-area-inset-bottom, 0px));
    padding: 0.35rem 0.75rem 0.25rem;
    /* 与 .conversation-area 主背景一致，避免展开条呈白条 */
    background: #f9fafb;
    justify-content: stretch;
}

.chat-text-input-wrap {
    flex: 1;
    min-width: 0;
    position: relative;
}

.chat-text-input-row {
    display: flex;
    align-items: stretch;
    gap: 0.35rem;
    min-width: 0;
}

.chat-text-input-cell {
    flex: 1;
    min-width: 0;
    position: relative;
}

.chat-text-input-cell .chat-text-input {
    width: 100%;
}

.chat-text-input {
    flex: 1;
    min-width: 0;
    width: auto;
    box-sizing: border-box;
    padding: 0.55rem 0.75rem;
    padding-inline-end: 2rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.95rem;
    background: #fff;
    color: var(--text-primary);
}

.chat-text-clear-btn {
    position: absolute;
    inset-inline-end: 0.35rem;
    top: 50%;
    transform: translateY(-50%);
    width: 1.375rem;
    height: 1.375rem;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: #d1d5db;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.12s ease, transform 0.12s ease;
    -webkit-tap-highlight-color: transparent;
    z-index: 1;
}

.chat-text-clear-btn:hover {
    background: #bfc4cb;
}

.chat-text-clear-btn:active {
    transform: translateY(-50%) scale(0.94);
}

.chat-text-clear-btn:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.chat-text-clear-icon {
    display: block;
    pointer-events: none;
}

.chat-emoji-btn {
    flex-shrink: 0;
    width: 2.5rem;
    min-height: 2.5rem;
    padding: 0;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: #fff;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
    -webkit-tap-highlight-color: transparent;
}

.chat-emoji-btn:hover {
    background: #f3f4f6;
    border-color: #d1d5db;
    color: var(--text-primary);
}

.chat-emoji-btn[aria-expanded="true"] {
    border-color: var(--primary-color);
    color: var(--primary-color);
    background: rgba(99, 102, 241, 0.08);
}

.chat-emoji-picker {
    position: absolute;
    left: 0;
    right: 0;
    bottom: calc(100% + 6px);
    z-index: 30;
    max-height: min(12.5rem, 40vh);
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0.55rem;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: #fff;
    box-shadow: var(--shadow-md);
    display: grid;
    grid-template-columns: repeat(8, minmax(0, 1fr));
    gap: 2px;
    -webkit-overflow-scrolling: touch;
}

.chat-emoji-picker.hidden {
    display: none !important;
}

.chat-emoji-picker[hidden] {
    display: none !important;
}

.chat-emoji-picker button {
    margin: 0;
    padding: 0.2rem;
    border: none;
    border-radius: 6px;
    background: transparent;
    font-size: 1.35rem;
    line-height: 1.2;
    cursor: pointer;
    transition: background 0.12s ease;
}

.chat-emoji-picker button:hover,
.chat-emoji-picker button:focus-visible {
    background: #f3f4f6;
    outline: none;
}

.chat-text-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.15);
}

.chat-text-fab {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: var(--primary-color);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--shadow-md);
    transition: transform 0.15s ease, background 0.15s ease;
    -webkit-tap-highlight-color: transparent;
}

.chat-text-fab:hover {
    background: var(--primary-hover);
    transform: scale(1.03);
}

.chat-text-fab:active {
    transform: scale(0.97);
}

.chat-text-dock:not(.chat-text-dock--collapsed) .chat-text-fab {
    width: 38px;
    height: 38px;
}

/* 安全区域适配 */
@supports (padding: env(safe-area-inset-bottom)) {
    .bottom-controls {
        padding-bottom: calc(0.5rem + env(safe-area-inset-bottom));
    }
}

/* 窄屏：压缩语言下拉宽度，避免底栏横向溢出、右侧设置按钮被裁切 */
@media (max-width: 520px) {
    .bottom-controls {
        padding-left: 0.45rem;
        padding-right: 0.45rem;
    }

    .bottom-bar {
        gap: 0.3rem;
    }

    .bottom-bar>.lang-group:first-child {
        flex: 0 1 auto;
        min-width: 0;
        max-width: min(21vw, 4rem);
    }

    .bottom-bar>.lang-group:first-child #fromLang.lang-select-sm {
        width: 100%;
        min-width: 0;
        max-width: 100%;
        font-size: 0.72rem;
        padding: 0.32rem 1.2rem 0.32rem 0.4rem;
    }

    .bottom-dub-gender-cluster {
        flex-shrink: 1;
        min-width: 0;
        gap: 0.12rem;
    }

    .peerGender-group .lang-select-sm {
        max-width: 3.8rem;
        padding-left: 0.35rem;
        padding-right: 1.28rem;
        font-size: 0.72rem;
    }
}

@media (display-mode: standalone) {
    .header {
        padding-top: calc(0.5rem + env(safe-area-inset-top));
    }
}

/* ---- 屏幕共享 ---- */

.screen-share-group {
    margin-left: 6px;
}

.screen-share-btn-sm {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: #e5e7eb;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.15s, transform 0.1s;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    flex-shrink: 0;
}

.screen-share-btn-sm:hover {
    transform: scale(1.05);
    background: #d1d5db;
}

.screen-share-btn-sm:active {
    transform: scale(0.95);
}

/* 共享中与开麦一致：--secondary-color + 绿色脉动，图标仍为显示器造型 */
.screen-share-btn-sm.sharing {
    background: var(--secondary-color);
    color: white;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
    animation: micPulseSm 1.5s infinite;
}

.screen-share-btn-sm:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* 手机等触摸优先浏览器：隐藏屏幕共享（桌面能力，移动端 getDisplayMedia 支持差） */
@media (hover: none) and (pointer: coarse) {
    #screenShareGroup {
        display: none !important;
    }
}

/* 安卓等部分机型将 pointer 标为 fine，仅靠媒体查询无效；由 room.html 内联脚本设置 class */
html.transtalk-hide-screen-share #screenShareGroup {
    display: none !important;
}

.screen-share-container {
    background: #000;
    border-radius: 0;
    overflow: hidden;
    margin: 0;
    position: relative;
    max-height: 40vh;
}

.screen-share-container:fullscreen,
.screen-share-container:-webkit-full-screen {
    display: flex;
    flex-direction: column;
    max-height: 100vh;
    height: 100%;
    margin: 0;
    border-radius: 0;
}

.screen-share-container:fullscreen .screen-share-header,
.screen-share-container:-webkit-full-screen .screen-share-header {
    flex-shrink: 0;
}

.screen-share-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 8px;
    background: rgba(0, 0, 0, 0.7);
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 2;
}

.screen-share-header-actions {
    display: flex;
    align-items: center;
    gap: 2px;
}

/* 横竖屏切换：仅手机端显示（与 room.html 内联脚本 transtalk-mobile 一致） */
html:not(.transtalk-mobile) .screen-share-orientation-btn {
    display: none !important;
}

/* 手机观看端：不显示全屏（最大化/最小化）按钮 */
html.transtalk-mobile #screenShareFullscreenBtn {
    display: none !important;
}

/* PC 观看端：全屏时切换为「向内」图标（由 JS 加 .screen-share-fullscreen-active，兼容 video 全屏） */
#screenShareFullscreenBtn .screen-share-fs-icon--exit {
    display: none;
}

#screenShareFullscreenBtn.screen-share-fullscreen-active .screen-share-fs-icon--enter {
    display: none;
}

#screenShareFullscreenBtn.screen-share-fullscreen-active .screen-share-fs-icon--exit {
    display: block;
}

.screen-share-orientation-btn.active {
    opacity: 1;
    background: rgba(255, 255, 255, 0.2);
}

.screen-share-video-shell {
    position: relative;
    width: 100%;
    overflow: hidden;
}

/* 无 API 支持时：将画面旋转 90° 以横屏比例观看（竖握手机） */
.screen-share-container.screen-share-landscape-mode:not(:fullscreen) .screen-share-video-shell {
    min-height: min(40vh, 90vw);
    max-height: 56vh;
}

.screen-share-container.screen-share-landscape-mode:not(:fullscreen) .screen-share-video {
    position: absolute;
    width: 100vh;
    height: 100vw;
    top: 50%;
    left: 50%;
    margin-left: -50vh;
    margin-top: -50vw;
    transform: rotate(90deg);
    transform-origin: center center;
    max-height: none;
    object-fit: contain;
}

.screen-share-label {
    color: #fff;
    font-size: 0.8rem;
    white-space: nowrap;
}

.screen-share-control-btn {
    background: none;
    border: none;
    color: #fff;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    opacity: 0.8;
    transition: opacity 0.15s;
}

.screen-share-control-btn:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.15);
}

.screen-share-video {
    width: 100%;
    max-height: 40vh;
    display: block;
    object-fit: contain;
    background: #000;
}

.screen-share-container:fullscreen .screen-share-video-shell,
.screen-share-container:-webkit-full-screen .screen-share-video-shell {
    flex: 1;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.screen-share-container:fullscreen .screen-share-video,
.screen-share-container:-webkit-full-screen .screen-share-video {
    max-height: 100vh;
}

.screen-share-container:fullscreen.screen-share-landscape-mode .screen-share-video,
.screen-share-container:-webkit-full-screen.screen-share-landscape-mode .screen-share-video {
    max-height: 100vh;
    width: auto;
    height: auto;
    margin: 0;
    position: static;
    transform: none;
}

/* PC 全屏观看屏幕共享时：半透明可拖动对话浮层（与 #screenShareChatOverlay 对应） */
.screen-share-chat-overlay {
    position: absolute;
    z-index: 4;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    bottom: auto;
    left: auto;
    width: min(280px, 42vw);
    max-height: min(280px, 36vh);
    display: flex;
    flex-direction: column;
    border-radius: 12px;
    overflow: hidden;
    box-shadow:
        0 4px 6px rgba(0, 0, 0, 0.12),
        0 18px 40px rgba(0, 0, 0, 0.28);
    border: 1px solid rgba(255, 255, 255, 0.22);
    /* 大背景：半透明 + 毛玻璃，便于看清背后共享画面 */
    background: rgba(22, 26, 36, 0.38);
    backdrop-filter: blur(16px) saturate(1.15);
    -webkit-backdrop-filter: blur(16px) saturate(1.15);
    pointer-events: auto;
}

.screen-share-chat-overlay.hidden {
    display: none !important;
}

html.transtalk-mobile .screen-share-chat-overlay:not(.screen-share-chat-overlay--mobile-landscape) {
    display: none !important;
}

/* ---- 手机横屏观看屏幕共享：视频靠左 + 聊天窗靠右 ---- */
html.transtalk-mobile .screen-share-container.screen-share-mobile-landscape-split,
html.transtalk-mobile .screen-share-container.screen-share-mobile-landscape-split:fullscreen,
html.transtalk-mobile .screen-share-container.screen-share-mobile-landscape-split:-webkit-full-screen {
    display: flex;
    flex-direction: row;
    max-height: none;
    height: 100vh;
    height: 100dvh;
    margin: 0;
    border-radius: 0;
    position: fixed;
    inset: 0;
    z-index: 200;
}

html.transtalk-mobile .screen-share-container.screen-share-wechat-landscape-mode {
    width: 100vh;
    width: 100dvh;
    height: 100vw;
    height: 100dvw;
    inset: auto;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(90deg);
    transform-origin: center center;
}

/*
 * 微信将整段共享区旋转 90°，此时「横条」在竖屏视口中的高度 = 短边，应为 100dvw。
 * 若沿用下方 split 的 100dvh，video-shell / video 比父容器（高仅 100dvw）更高 →
 * 裁切错位、顶/底大块黑边、object-fit 看起来「无法垂直居中」。
 * 用三条件选择器盖住 split 的单层高度，使画布与父盒一致后再 contain + center。
 */
html.transtalk-mobile .screen-share-container.screen-share-mobile-landscape-split.screen-share-wechat-landscape-mode .screen-share-video-shell {
    height: 100dvw;
    max-height: 100dvw;
    display: flex;
    align-items: center;
    justify-content: center;
}

html.transtalk-mobile .screen-share-container.screen-share-mobile-landscape-split.screen-share-wechat-landscape-mode .screen-share-video {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    min-height: 0;
    object-fit: contain;
    object-position: center center;
}

html.transtalk-mobile .screen-share-container.screen-share-mobile-landscape-split.screen-share-wechat-landscape-mode .screen-share-chat-overlay--mobile-landscape {
    height: 100dvw;
    max-height: 100dvw;
    flex-basis: clamp(150px, 25.5dvh, 225px);
    width: clamp(150px, 25.5dvh, 225px);
}

html.transtalk-mobile .screen-share-container.screen-share-mobile-landscape-split .screen-share-header {
    display: none;
}

html.transtalk-mobile .screen-share-container.screen-share-mobile-landscape-split .screen-share-video-shell {
    flex: 1 1 0%;
    min-width: 0;
    min-height: 0;
    height: 100vh;
    height: 100dvh;
    display: flex;
    align-items: stretch;
    justify-content: center;
    overflow: hidden;
}

html.transtalk-mobile .screen-share-container.screen-share-mobile-landscape-split .screen-share-video {
    width: 100%;
    height: 100vh;
    height: 100dvh;
    max-height: 100vh;
    max-height: 100dvh;
    min-height: 0;
    object-fit: contain;
    display: block;
    position: static;
    transform: none;
    margin: 0;
}

html.transtalk-mobile .screen-share-container.screen-share-mobile-landscape-split .screen-share-chat-overlay--mobile-landscape {
    display: flex !important;
    position: relative;
    flex: 0 0 auto;
    flex-basis: clamp(150px, 25.5dvh, 225px);
    width: clamp(150px, 25.5dvh, 225px);
    max-height: none;
    height: 100vh;
    height: 100dvh;
    right: auto;
    bottom: auto;
    left: auto;
    top: auto;
    transform: none;
    border-radius: 0;
    border: none;
    border-left: 1px solid rgba(255, 255, 255, 0.18);
    box-shadow: -2px 0 12px rgba(0, 0, 0, 0.18);
}

/* 横竖屏切换按钮：默认隐藏，手机横屏时显示 */
.screen-share-chat-overlay__exit-landscape {
    display: none;
}

/* 手机横屏：聊天窗顶部栏 — 左对齐 */
html.transtalk-mobile .screen-share-mobile-landscape-split .screen-share-chat-overlay__header {
    justify-content: flex-start;
    padding: 2px 4px;
    gap: 12px;
    min-height: 0;
}

html.transtalk-mobile .screen-share-mobile-landscape-split .screen-share-chat-overlay__drag {
    flex: 0 0 auto;
    cursor: default;
    padding: 0;
}

html.transtalk-mobile .screen-share-mobile-landscape-split .screen-share-chat-overlay__drag:active {
    cursor: default;
}

html.transtalk-mobile .screen-share-mobile-landscape-split .screen-share-chat-overlay__title {
    font-size: 0.5625rem;
    font-weight: 500;
    letter-spacing: 0;
}

html.transtalk-mobile .screen-share-mobile-landscape-split .screen-share-chat-overlay__mic {
    width: 18px;
    height: 18px;
}

html.transtalk-mobile .screen-share-mobile-landscape-split .screen-share-chat-overlay__mic svg {
    width: 10px;
    height: 10px;
}

html.transtalk-mobile .screen-share-mobile-landscape-split .screen-share-chat-overlay__exit-landscape {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    padding: 0;
    border: none;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.15);
    color: rgba(255, 255, 255, 0.9);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    transition: background 0.12s ease;
}

html.transtalk-mobile .screen-share-mobile-landscape-split .screen-share-chat-overlay__exit-landscape:active {
    background: rgba(255, 255, 255, 0.3);
}

/* 手机横屏：聊天窗消息体 */
html.transtalk-mobile .screen-share-mobile-landscape-split .screen-share-chat-overlay__body {
    padding: 0.2rem 0.25rem;
}

html.transtalk-mobile .screen-share-mobile-landscape-split .screen-share-chat-overlay__body .conversation-list,
html.transtalk-mobile .screen-share-mobile-landscape-split .conversation-list {
    gap: 0.15rem;
}

html.transtalk-mobile .screen-share-mobile-landscape-split .message-bubble {
    font-size: 0.6rem;
    line-height: 1.3;
    padding: 0.12rem 0.25rem;
    max-width: 98%;
    border-radius: 4px;
    box-shadow: none;
}

html.transtalk-mobile .screen-share-mobile-landscape-split .message-speaker {
    font-size: 0.5rem;
}

html.transtalk-mobile .screen-share-mobile-landscape-split .message-text {
    margin-bottom: 0;
}

html.transtalk-mobile .screen-share-mobile-landscape-split .message-time-divider span {
    font-size: 0.45rem;
    padding: 0 0.35rem;
}

html.transtalk-mobile .screen-share-mobile-landscape-split .chat-system-notice {
    font-size: 0.5rem;
}

html.transtalk-mobile .screen-share-mobile-landscape-split .chat-history-expand-btn {
    font-size: 0.52rem;
}

html.transtalk-mobile .screen-share-mobile-landscape-split .message-inline-image {
    max-height: 50px;
}

.screen-share-chat-overlay__header {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    padding: 6px 8px 6px 11px;
    user-select: none;
    -webkit-user-select: none;
    background: rgba(255, 255, 255, 0.07);
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.screen-share-chat-overlay__drag {
    flex: 1;
    min-width: 0;
    cursor: grab;
    touch-action: none;
    padding: 2px 0;
}

.screen-share-chat-overlay__drag:active {
    cursor: grabbing;
}

.screen-share-chat-overlay__title {
    font-size: 0.8125rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: rgba(255, 255, 255, 0.96);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}

.screen-share-chat-overlay__mic {
    flex-shrink: 0;
    width: 30px;
    height: 30px;
    border: none;
    border-radius: 50%;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.14);
    color: rgba(255, 255, 255, 0.85);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    transition: background 0.15s ease, transform 0.12s ease, box-shadow 0.15s ease;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.screen-share-chat-overlay__mic .mic-icon {
    display: none;
}

.screen-share-chat-overlay__mic .mic-icon-off {
    display: block;
}

.screen-share-chat-overlay__mic:hover {
    background: rgba(255, 255, 255, 0.22);
    transform: scale(1.04);
}

.screen-share-chat-overlay__mic:active {
    transform: scale(0.96);
}

.screen-share-chat-overlay__mic.recording {
    background: var(--secondary-color);
    color: #fff;
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.35);
    animation: micPulseSm 1.5s infinite;
}

.screen-share-chat-overlay__mic.recording .mic-icon {
    display: block;
}

.screen-share-chat-overlay__mic.recording .mic-icon-off {
    display: none;
}

.screen-share-chat-overlay__body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 0.45rem 0.5rem 0.55rem 0.55rem;
    background: rgba(0, 0, 0, 0.06);
    /* Firefox：细滚动条 */
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.38) rgba(255, 255, 255, 0.06);
}

/* WebKit：mini 滚动条 */
.screen-share-chat-overlay__body::-webkit-scrollbar {
    width: 4px;
}

.screen-share-chat-overlay__body::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.04);
    border-radius: 8px;
    margin: 4px 0;
}

.screen-share-chat-overlay__body::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.32);
    border-radius: 8px;
}

.screen-share-chat-overlay__body::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.48);
}

.screen-share-chat-overlay .conversation-list {
    gap: 0.35rem;
}

.screen-share-chat-overlay .message-time-divider span {
    font-size: 0.65rem;
    color: rgba(255, 255, 255, 0.55);
    background: rgba(0, 0, 0, 0.2);
}

.screen-share-chat-overlay .chat-system-notice {
    font-size: 0.68rem;
    color: rgba(255, 255, 255, 0.62);
    background: transparent;
    border-radius: 0;
}

.screen-share-chat-overlay .chat-history-expand-row {
    padding: 0.3rem 0.5rem;
}

.screen-share-chat-overlay .chat-history-expand-btn {
    color: rgba(147, 197, 253, 0.98);
    font-size: 0.72rem;
}

/* 小背景：气泡（偏磨砂玻璃，与主背景对比） */
.screen-share-chat-overlay .message-bubble {
    font-size: 0.8125rem;
    line-height: 1.42;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.screen-share-chat-overlay .message-bubble::after {
    content: none !important;
    display: none !important;
}

/* 左侧「对方」：浅白磨砂 */
.screen-share-chat-overlay .message-bubble.original:not(.message-self),
.screen-share-chat-overlay .message-bubble.translated:not(.message-self) {
    background: rgba(255, 255, 255, 0.82);
    color: #1e293b;
    border-color: rgba(255, 255, 255, 0.45);
}

.screen-share-chat-overlay .message-bubble.original:not(.message-self) .message-speaker,
.screen-share-chat-overlay .message-bubble.translated:not(.message-self) .message-speaker {
    color: #64748b;
    font-size: 0.7rem;
}

/* 自己发送：柔和绿 */
.screen-share-chat-overlay .message-bubble.message-self,
.screen-share-chat-overlay .message-bubble.translated.message-self,
.screen-share-chat-overlay .message-bubble.original.message-self {
    background: rgba(125, 216, 130, 0.88);
    color: #0f3d14;
    border-color: rgba(255, 255, 255, 0.28);
}

.screen-share-chat-overlay .message-bubble.message-self .message-speaker,
.screen-share-chat-overlay .message-bubble.translated.message-self .message-speaker {
    color: rgba(15, 61, 20, 0.6);
    font-size: 0.7rem;
}

.screen-share-chat-overlay .message-text .keyword {
    background: rgba(250, 204, 21, 0.4);
    color: inherit;
}

.screen-share-chat-overlay .message-bubble.translated:not(.message-self) .message-text .keyword {
    background: rgba(255, 255, 255, 0.22);
    color: #fff;
}

.screen-share-chat-overlay .message-inline-image {
    max-height: 120px;
}

/* 参会者列表里的屏幕共享标签 */
.participant-screen-share-badge {
    display: inline-block;
    font-size: 0.7rem;
    color: var(--primary-color);
    margin-left: 4px;
    vertical-align: middle;
}