/* ===== 全局重置 ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    color: #333; min-height: 100vh;
    -webkit-tap-highlight-color: transparent;
}

/* ===== 身份选择页 ===== */
.select-page {
    max-width: 430px; margin: 0 auto; min-height: 100vh;
    display: flex; flex-direction: column;
}
.select-header {
    background: linear-gradient(135deg, #e83e8c 0%, #c2185b 100%);
    padding: 50px 30px 35px; text-align: center; color: #fff;
}
.select-header h1 { font-size: 26px; font-weight: 600; margin-bottom: 8px; }
.select-header .sub-title { font-size: 14px; opacity: 0.85; }
.account-list { flex: 1; padding: 25px 20px; }
.account-list .loading { text-align: center; color: #999; padding: 60px 0; font-size: 15px; }
.account-list .loading.error { color: #e74c3c; }
.account-card {
    display: flex; align-items: center; background: #fff;
    border-radius: 12px; padding: 16px 18px; margin-bottom: 14px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04); cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s; position: relative;
}
.account-card:active { transform: scale(0.98); box-shadow: 0 1px 4px rgba(0,0,0,0.06); }
.card-avatar { width: 50px; height: 50px; border-radius: 50%; overflow: hidden; flex-shrink: 0; background: #f5f5f5; }
.card-avatar img { width: 100%; height: 100%; object-fit: cover; }
.card-info { flex: 1; margin-left: 14px; }
.card-name { font-size: 17px; font-weight: 600; color: #1a1a1a; margin-bottom: 3px; }
.card-id { font-size: 12px; color: #999; }
.card-lang-badge {
    width: 36px; height: 36px; border-radius: 50%;
    background: #e83e8c; color: #fff; font-size: 12px; font-weight: 600;
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.select-footer { text-align: center; padding: 16px 20px 30px; color: #aaa; font-size: 12px; }

/* ================================================================
   聊天页 - 暗色主题（1:1还原参考图）
   ================================================================ */

/* 手机容器 + 暗色背景质感 */
.chat-app {
    width: 375px; height: 812px; border-radius: 40px;
    overflow: hidden; position: relative;
    box-shadow: 0 25px 70px rgba(0,0,0,0.35);
    display: flex; flex-direction: column; flex-shrink: 0;
    background:
        radial-gradient(ellipse at top center, rgba(255,0,82,0.22) 0%, transparent 45%),
        linear-gradient(160deg, #5a5c61 0%, #484a4f 55%, #3a3c40 100%);
}
.chat-app::before {
    content: ''; position: absolute; pointer-events: none; z-index: 0;
    width: 680px; height: 680px; top: -380px; right: -220px;
    background: linear-gradient(140deg, rgba(255,0,82,0.28), transparent 65%);
    transform: rotate(-20deg); border-radius: 45%; filter: blur(1px);
}
.chat-app::after {
    content: ''; position: absolute; pointer-events: none; z-index: 0;
    width: 620px; height: 620px; bottom: -260px; left: -200px;
    background: linear-gradient(160deg, rgba(0,0,0,0.28), transparent 65%);
    transform: rotate(25deg); border-radius: 40%; filter: blur(1px);
}

/* 状态栏 */
.status-bar {
    height: 44px; padding: 0 28px;
    display: flex; justify-content: space-between; align-items: center;
    color: #fff; font-size: 17px; font-weight: 600;
    background: linear-gradient(90deg, #ff0d55 0%, #d90040 100%);
    z-index: 10; flex-shrink: 0;
}
.status-icons { display: flex; gap: 6px; align-items: center; }

/* 顶部导航 */
.nav-bar {
    height: 56px; background: linear-gradient(90deg, #ff0d55 0%, #d90040 100%);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 16px; color: #fff; z-index: 10; flex-shrink: 0;
}
.nav-back, .nav-more { font-size: 26px; cursor: pointer; width: 32px; text-align: center; font-weight: 300; }
.nav-title { font-size: 22px; font-weight: 600; }

/* 聊天内容区 */
.chat-container {
    flex: 1; padding: 20px 14px; overflow-y: auto; z-index: 1;
    display: flex; flex-direction: column; gap: 18px;
}
.chat-container::-webkit-scrollbar { width: 4px; }
.chat-container::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 2px; }

.chat-container .msg-loading { text-align: center; color: rgba(255,255,255,0.5); font-size: 13px; padding: 30px 0; }

/* 系统消息 */
.msg-system { text-align: center; z-index: 2; }
.msg-system span {
    display: inline-block; background: rgba(255,255,255,0.12);
    color: rgba(255,255,255,0.55); font-size: 12px;
    padding: 4px 10px; border-radius: 4px; max-width: 85%;
}

/* 消息行 */
.msg-row {
    display: flex; align-items: flex-start; gap: 10px;
    max-width: 82%; z-index: 2;
}
.msg-row.self { align-self: flex-end; flex-direction: row-reverse; }
.msg-row.other { align-self: flex-start; }

/* 头像 */
.msg-row .msg-avatar {
    width: 62px; height: 62px; border-radius: 50%;
    object-fit: cover; flex-shrink: 0;
    border: 1px solid rgba(255,255,255,0.15);
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

/* 消息主体 */
.msg-row .msg-body { max-width: 100%; }

/* 昵称 */
.msg-row .msg-nick { font-size: 11px; color: rgba(255,255,255,0.5); margin-bottom: 3px; padding: 0 4px; }

/* 气泡 */
.msg-row .msg-bubble {
    padding: 12px 18px; border-radius: 20px;
    font-size: 18px; line-height: 1.45; word-break: break-word;
}
.msg-row.other .msg-bubble {
    background: linear-gradient(135deg, #ff1659 0%, #c2003b 100%);
    color: #fff; border-top-left-radius: 6px;
}
.msg-row.self .msg-bubble {
    background: linear-gradient(135deg, #86f0f0 0%, #5fe0e0 100%);
    color: #000; border-top-right-radius: 6px;
}

/* 译文 */
.msg-row.other .msg-trans {
    margin-top: 6px; padding: 6px 10px;
    background: rgba(128,128,128,0.25); border-radius: 8px;
    font-size: 13px; color: #fff; line-height: 1.4;
}
.msg-row.other .msg-trans .trans-label { font-size: 11px; opacity: 0.7; margin-right: 4px; }

/* 图片消息 */
.msg-row .msg-image { max-width: 200px; border-radius: 10px; cursor: pointer; display: block; }

/* 文件消息 */
.msg-row .msg-file {
    display: flex; align-items: center;
    padding: 10px 14px; background: rgba(255,255,255,0.2);
    border-radius: 10px; cursor: pointer;
}
.msg-row .msg-file .file-icon { font-size: 28px; margin-right: 10px; }
.msg-row .msg-file .file-info { flex: 1; min-width: 0; }
.msg-row .msg-file .file-name { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-bottom: 2px; }
.msg-row .msg-file .file-size { font-size: 11px; opacity: 0.7; }

/* 位置消息 */
.msg-row .msg-location {
    padding: 10px 14px; background: rgba(255,255,255,0.2);
    border-radius: 10px; cursor: pointer; font-size: 13px;
    display: flex; align-items: center;
}
.msg-row .msg-location .loc-icon { margin-right: 8px; font-size: 16px; }

/* 语音消息 */
.msg-row .msg-voice {
    display: flex; align-items: center;
    padding: 8px 14px; background: rgba(255,255,255,0.2);
    border-radius: 10px; cursor: pointer; min-width: 80px;
}
.msg-row .msg-voice .voice-icon { font-size: 18px; margin-right: 8px; }
.msg-row .msg-voice .voice-dur { font-size: 13px; }
.msg-row.self .msg-voice { flex-direction: row-reverse; }
.msg-row.self .msg-voice .voice-icon { margin-right: 0; margin-left: 8px; }
.msg-row .msg-voice.playing .voice-icon { animation: voicePulse 0.8s ease-in-out infinite; }
@keyframes voicePulse { 0%,100%{opacity:1;transform:scale(1)} 50%{opacity:.5;transform:scale(1.15)} }

/* 消息时间 */
.msg-row .msg-time { font-size: 11px; color: rgba(255,255,255,0.4); text-align: right; margin-top: 3px; padding: 0 4px; }

/* 底部输入栏 */
.input-bar {
    background: linear-gradient(90deg, #ff0d55 0%, #d90040 100%);
    padding: 12px 14px; display: flex; align-items: center;
    gap: 12px; z-index: 10; flex-shrink: 0;
}
.icon-btn {
    width: 42px; height: 42px; display: flex; align-items: center;
    justify-content: center; color: #fff; cursor: pointer;
    flex-shrink: 0; background: transparent; border: none;
}
.icon-btn svg { stroke: #fff; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; fill: none; }
.icon-btn.recording { background: #ff4444; border-radius: 50%; }
.icon-btn.recording svg { stroke: #fff; }
.input-wrap {
    flex: 1; height: 46px; background: #fff; border-radius: 23px;
    padding: 0 18px; display: flex; align-items: center;
}
.input-wrap input {
    width: 100%; height: 100%; border: none; outline: none;
    font-size: 16px; background: transparent;
}
.input-wrap input::placeholder { color: #999; }

/* 表情面板 */
.emoji-panel {
    display: grid; grid-template-columns: repeat(8, 1fr);
    gap: 10px 0; z-index: 5;
    max-height: 0; overflow-y: auto; padding: 0 12px;
    transition: all 0.3s ease;
}
.emoji-panel.open { max-height: 180px; padding: 10px 12px; }
.emoji-item {
    text-align: center; font-size: 26px; cursor: pointer;
    padding: 4px 0; user-select: none;
}
.emoji-item:active { transform: scale(1.3); }

/* 扩展功能面板 */
.function-panel {
    display: grid; grid-template-columns: repeat(4, 1fr);
    gap: 22px 0; z-index: 5;
    max-height: 0; overflow: hidden; padding: 0 16px;
    transition: all 0.3s ease; background: transparent;
}
.function-panel.open { max-height: 220px; padding: 16px 16px 28px; }
.func-item {
    display: flex; flex-direction: column; align-items: center;
    gap: 8px; color: #fff; font-size: 14px; cursor: pointer;
}
.func-item.empty { visibility: hidden; }
.func-icon {
    width: 50px; height: 50px; display: flex; align-items: center;
    justify-content: center; background: transparent;
}
.func-icon svg { stroke: #fff; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; fill: none; }

/* 底部Home指示条 */
.home-indicator {
    height: 5px; width: 134px; background: rgba(255,255,255,0.85);
    border-radius: 3px; margin: 0 auto 8px; z-index: 10; flex-shrink: 0;
}

/* 大图预览 */
.img-preview-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.95); z-index: 500;
    display: flex; align-items: center; justify-content: center;
}
.img-preview-overlay img { max-width: 95%; max-height: 85%; object-fit: contain; cursor: pointer; }

/* 模拟模式提示条 */
.mock-banner {
    text-align: center; padding: 5px; background: rgba(255,255,255,0.08);
    color: rgba(255,255,255,0.5); font-size: 11px; flex-shrink: 0; z-index: 10;
}

/* ================================================================
   音视频通话界面
   ================================================================ */

.call-incoming-overlay {
    display: flex; align-items: center; justify-content: center;
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.65); z-index: 300;
}
.call-incoming-card {
    background: #fff; border-radius: 16px;
    width: 300px; padding: 30px 20px; text-align: center;
}
.call-incoming-avatar { width: 68px; height: 68px; border-radius: 50%; margin-bottom: 12px; object-fit: cover; background: #eee; }
.call-incoming-name { font-size: 18px; font-weight: 600; color: #1a1a1a; margin-bottom: 6px; }
.call-incoming-type { font-size: 14px; color: #888; margin-bottom: 24px; }
.call-incoming-btns { display: flex; justify-content: center; gap: 30px; }
.call-btn-reject, .call-btn-accept {
    width: 60px; height: 60px; border-radius: 50%; border: none;
    font-size: 14px; font-weight: 600; cursor: pointer;
}
.call-btn-reject { background: #e74c3c; color: #fff; }
.call-btn-accept { background: #2ecc71; color: #fff; }

.call-active-overlay {
    display: flex; flex-direction: column;
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: #1a1a2e; z-index: 300; color: #fff;
}
.call-active-video { flex: 1; background: #000; min-height: 0; }
.call-active-members {
    display: flex; flex-wrap: wrap; justify-content: center;
    padding: 16px 16px; gap: 12px; flex: 1; align-content: center;
}
.call-active-members .call-member-item {
    display: flex; flex-direction: column; align-items: center; font-size: 12px;
}
.call-active-members .call-member-item img {
    width: 56px; height: 56px; border-radius: 50%;
    border: 2px solid #e83e8c; margin-bottom: 4px; background: #555;
}
.call-active-info { text-align: center; padding: 8px 0; }
.call-active-timer { font-size: 20px; font-weight: 600; }
.call-active-hint { font-size: 12px; color: #aaa; }
.call-subtitle-area {
    height: 100px; overflow-y: auto;
    background: rgba(0,0,0,0.5); padding: 8px 14px;
    font-size: 13px; line-height: 1.6;
}
.call-subtitle-item { padding: 4px 0; border-bottom: 1px solid rgba(255,255,255,0.08); }
.call-subtitle-item .sub-speaker { color: #e83e8c; font-weight: 600; }
.call-subtitle-item .sub-source { color: #ddd; font-size: 13px; }
.call-subtitle-item .sub-target { color: #888; font-size: 12px; margin-top: 2px; }
.call-controls {
    display: flex; justify-content: center; align-items: center;
    gap: 28px; padding: 16px 0 20px; background: #16213e;
}
.call-controls .call-ctrl-btn {
    width: 50px; height: 50px; border-radius: 50%; border: none;
    background: rgba(255,255,255,0.2); cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: background 0.2s;
}
.call-ctrl-hangup { background: #e74c3c !important; }
.call-ctrl-btn:active { opacity: 0.7; }
.call-ctrl-btn.muted { background: #ff4444; }
.call-ctrl-btn.disabled { background: #ff4444; }

/* 移动端小屏适配 */
@media (max-width: 420px) {
    .chat-app { width: 100vw; height: 100vh; height: 100dvh; border-radius: 0; }
    body { padding: 0; background: #f0f2f5; }
}
