/* 微信风格模板 */
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
    font-family: -apple-system, 'PingFang SC', 'Microsoft YaHei', sans-serif;
    background: #ededed;
    color: #333;
    height: 100vh; height: 100dvh;
    overflow: hidden;
}

/* 登录页 */
.wx-login {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: #ededed; display: flex; align-items: center; justify-content: center;
}
.wx-login-box {
    background: #fff; padding: 2.5rem 2rem; border-radius: 8px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08); text-align: center;
    max-width: 360px; width: 90%;
}
.wx-logo { font-size: 3rem; margin-bottom: 1rem; }
.wx-login-box h2 { font-size: 1.3rem; color: #333; margin-bottom: 0.3rem; }
.wx-sub { font-size: 0.85rem; color: #999; margin-bottom: 1.5rem; }
.wx-input-group { margin-bottom: 0.8rem; }
.wx-input-group input {
    width: 100%; padding: 0.7rem 0.8rem; border: 1px solid #e0e0e0;
    border-radius: 6px; font-size: 0.95rem; outline: none;
}
.wx-input-group input:focus { border-color: #07c160; }
.wx-btn-primary {
    width: 100%; padding: 0.7rem; background: #07c160; color: #fff;
    border: none; border-radius: 6px; font-size: 1rem; cursor: pointer;
    margin-top: 0.5rem;
}
.wx-btn-primary:hover { background: #06ad56; }
.wx-btn-link {
    display: block; margin: 1rem auto 0; background: none; border: none;
    color: #576b95; font-size: 0.9rem; cursor: pointer;
}

/* 聊天页 */
.wx-chat { height: 100vh; height: 100dvh; display: flex; flex-direction: column; }
.wx-header {
    background: #ededed; border-bottom: 1px solid #d8d8d8;
    padding: 0.6rem 1rem; display: flex; align-items: center; gap: 0.8rem;
    min-height: 3rem;
}
.wx-back {
    background: none; border: none; font-size: 1.8rem; color: #333;
    cursor: pointer; line-height: 1; padding: 0 0.3rem;
}
.wx-title { flex: 1; display: flex; flex-direction: column; align-items: center; min-width: 0; text-align: center; }
.wx-title span { font-size: 1rem; font-weight: 600; color: #333; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.wx-title small { font-size: 0.7rem; color: #999; white-space: nowrap; }
.wx-actions { display: flex; gap: 0.5rem; }
.wx-icon-btn {
    background: none; border: none; font-size: 1.1rem; cursor: pointer;
    padding: 0.3rem;
}

/* 消息区 */
.wx-messages {
    flex: 1; overflow-y: auto; padding: 1rem; background: #ededed;
}
.wx-msg {
    display: flex; gap: 0.5rem; margin-bottom: 1rem; align-items: flex-start;
}
.wx-msg.system { justify-content: center; }
.wx-msg.system .wx-bubble {
    display: inline-block;
    max-width: 100%;
    width: fit-content;
    background: rgba(0,0,0,0.1); color: #666; font-size: 0.8rem;
    border-radius: 4px; padding: 0.2rem 0.6rem;
}
.wx-avatar {
    width: 36px; height: 36px; border-radius: 4px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.9rem; color: #fff; font-weight: 600;
    background: linear-gradient(135deg, #667eea, #764ba2);
}
.wx-msg-body { display: flex; flex-direction: column; max-width: 70%; }
.wx-username { font-size: 0.75rem; color: #999; margin-bottom: 0.2rem; }
.wx-bubble {
    display: inline-block;
    max-width: 100%;
    width: fit-content;
    background: #fff; padding: 0.6rem 0.8rem; border-radius: 4px;
    font-size: 0.95rem; line-height: 1.5; word-break: break-word;
    position: relative;
}
.wx-bubble::before {
    content: ''; position: absolute; left: -5px; top: 10px;
    border: 5px solid transparent; border-right-color: #fff;
}
.wx-bubble img { max-width: 100%; border-radius: 4px; cursor: pointer; }
.wx-bubble video { max-width: 100%; border-radius: 4px; }
.wx-time { font-size: 0.7rem; color: #b2b2b2; margin-top: 0.2rem; }
.wx-loc { font-size: 0.7rem; color: #b2b2b2; margin-top: 0.1rem; }

/* 输入栏 - 微信风格 */
.wx-input-bar {
    background: #f7f7f7; border-top: 1px solid #d8d8d8;
    padding: 0.5rem 0.6rem;
}
.wx-input-row {
    display: flex; align-items: center; gap: 0.5rem;
}
.wx-circle-btn {
    width: 36px; height: 36px; min-width: 36px; border-radius: 50%;
    border: 1.5px solid #333; background: #fff; color: #333;
    font-size: 1.1rem; cursor: pointer; display: flex;
    align-items: center; justify-content: center; padding: 0;
    flex-shrink: 0; transition: all .15s;
}
.wx-circle-btn:active { background: #e8e8e8; transform: scale(.95); }
.wx-input-bar textarea {
    flex: 1; border: none; border-radius: 8px;
    padding: 0.55rem 0.8rem; font-size: 0.95rem; resize: none;
    max-height: 100px; outline: none; font-family: inherit;
    background: #fff; min-height: 38px; line-height: 1.4;
}
.wx-hold-talk {
    flex: 1; background: #e83a7f; border: none;
    border-radius: 8px; padding: 0.55rem; font-size: 0.95rem;
    color: #fff; cursor: pointer; user-select: none;
    min-height: 38px; font-weight: 600; transition: all .1s;
    display: flex; align-items: center; justify-content: center; gap: 8px;
}
.wx-hold-icon { width: 22px; height: 22px; vertical-align: middle; display: none; }
.wx-hold-text { font-size: 0.95rem; }
.wx-hold-talk:active, .wx-hold-talk.recording {
    background: #c72e6b;
}
.wx-hold-talk.recording .wx-hold-text { color: #fff; }
.wx-send {
    background: #07c160; color: #fff; border: none; border-radius: 6px;
    padding: 0.5rem 1rem; font-size: 0.9rem; cursor: pointer;
    flex-shrink: 0;
}
.wx-send:hover { background: #06ad56; }

/* 加号功能面板 */
.wx-plus-panel {
    background: #f7f7f7; padding: 0.8rem 0.5rem 0.5rem;
    border-top: 1px solid #e8e8e8; margin-top: 0.4rem;
}
.wx-plus-grid {
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.6rem;
}
.wx-plus-item {
    display: flex; flex-direction: column; align-items: center; gap: 0.3rem;
    cursor: pointer;
}
.wx-plus-icon {
    width: 52px; height: 52px; border-radius: 12px;
    background: #fff; border: 1px solid #e8e8e8;
    font-size: 1.5rem; cursor: pointer; display: flex;
    align-items: center; justify-content: center; padding: 0;
    transition: all .15s;
}
.wx-plus-icon:active { background: #e8e8e8; transform: scale(.95); }
.wx-plus-item span {
    font-size: 0.75rem; color: #888;
}

/* 自己的消息：右对齐 */
.wx-msg.self {
    flex-direction: row-reverse;
}
.wx-msg.self .wx-msg-body {
    text-align: right;
}
.wx-msg.self .wx-bubble {
    display: inline-block;
    max-width: 100%;
    width: fit-content;
    background: #95ec69;
    color: #000;
}
.wx-msg.self .wx-bubble::before {
    left: auto;
    right: -5px;
    border-right-color: transparent;
    border-left-color: #95ec69;
}
.wx-msg.self .wx-username {
    text-align: right;
}

/* 修复气泡宽度自适应 */
.wx-msg-body {
    display: flex;
    flex-direction: column;
    max-width: 70%;
}
.wx-bubble {
    display: inline-block;
    max-width: 100%;
    width: fit-content;
}
.wx-msg.self .wx-msg-body {
    align-items: flex-end;
}
.wx-msg.self .wx-bubble::before {
    left: auto;
    right: -5px;
    border-right-color: transparent;
    border-left-color: #95ec69;
}

/* 美观滚动条 */
.wx-messages::-webkit-scrollbar { width: 6px; }
.wx-messages::-webkit-scrollbar-track { background: transparent; }
.wx-messages::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.15); border-radius: 3px; }
.wx-messages::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,0.25); }

/* ===== v20260904：修复自己消息换行左对齐 + 撤回/已读样式 ===== */
.wx-bubble { text-align: left; }
.wx-msg.self .wx-bubble { text-align: left; }
.wx-recall { color: #999; background: rgba(0,0,0,0.06); text-align: center; font-style: italic; }
.wx-read { font-size: 0.7rem; color: #b2b2b2; margin-top: 0.1rem; text-align: left; cursor: pointer; }
.wx-read:hover { color: #667eea; }


/* ===== v20260904h：手机端输入栏优化（图标/按钮缩小，给输入框让出宽度） ===== */
@media (max-width: 480px) {
    .wx-input-bar { padding: 0.4rem 0.45rem; gap: 0.25rem; }
    .wx-input-icon { font-size: 1.05rem; padding: 0.12rem; }
    .wx-input-bar textarea { padding: 0.42rem 0.6rem; font-size: 1rem; min-height: 2.1rem; }
    .wx-send { padding: 0.42rem 0.7rem; font-size: 0.85rem; }
}


/* ===== v20260905：微信风格输入栏（语音切换+加号面板） ===== */
.wx-login { flex-direction: column; justify-content: center; overflow-y: auto; position: relative; }
.wx-icp { position: absolute; bottom: 15px; left: 0; right: 0; font-size: 12px; color: #aaa; text-align: center; padding: 0 12px; }
.wx-icp a { color: #aaa; text-decoration: none; }

@media (max-width: 480px) {
    .wx-input-bar { padding: 0.4rem 0.45rem 0.2rem; }
    .wx-input-row { gap: 0.35rem; }
    .wx-circle-btn { width: 34px; height: 34px; min-width: 34px; font-size: 1rem; }
    .wx-input-bar textarea { font-size: 1rem; padding: 0.5rem 0.65rem; min-height: 36px; }
    .wx-hold-talk { font-size: 0.9rem; padding: 0.5rem; min-height: 36px; }
    .wx-send { padding: 0.5rem 0.85rem; font-size: 0.88rem; }
    .wx-plus-icon { width: 48px; height: 48px; font-size: 1.35rem; }
    .wx-plus-grid { gap: 0.4rem; }
}

/* ===== v20260904k：微信风格语音条 + 紧凑输入栏 + 禁止横向滚动 ===== */
.voice-msg {
    display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
    padding: 5px 10px; border-radius: 6px;
    -webkit-user-select: none; user-select: none; max-width: 210px;
    vertical-align: middle;
}
.voice-play { font-size: 11px; color: #333; width: 14px; text-align: center; flex-shrink: 0; }
.voice-wave { display: inline-flex; align-items: center; gap: 2px; height: 22px; }
.voice-wave i { width: 3px; border-radius: 2px; background: #07c160; }
.wx-msg.self .voice-wave i { background: #0a8f4e; }
.voice-wave.playing i { animation: voicewave 0.8s ease-in-out infinite; }
@keyframes voicewave { 0%,100%{transform:scaleY(0.5);} 50%{transform:scaleY(1.2);} }
.voice-dur { font-size: 11px; color: #888; flex-shrink: 0; min-width: 28px; text-align: right; }

/* 图标行更紧凑 */
.wx-toolbar { justify-content: space-evenly; padding: 0.2rem 0.2rem 0.1rem; }
.wx-input-icon { padding: 0.15rem 0.5rem; }

/* 禁止横向滚动 + 气泡更紧凑 */
html, body, .wx-chat, .wx-messages, .wx-input-bar { max-width: 100%; overflow-x: hidden; }
.wx-bubble { max-width: 100%; word-break: break-word; white-space: pre-wrap; padding: 0.45rem 0.6rem; font-size: 0.9rem; }

@media (max-width: 480px) {
    .wx-toolbar { padding: 0.15rem 0 0.05rem; }
    .wx-input-icon { font-size: 1.25rem; padding: 0.1rem 0.45rem; }
    .voice-msg { padding: 4px 8px; }
}

/* ===== v20260904l：气泡进一步缩小 ===== */
.wx-bubble { padding: 0.35rem 0.5rem; font-size: 0.85rem; line-height: 1.45; }
.wx-avatar { width: 32px; height: 32px; font-size: 0.8rem; }
.wx-msg { gap: 0.4rem; margin-bottom: 0.7rem; }
.wx-msg-body { max-width: 75%; }
.wx-time { font-size: 0.65rem; }
@media (max-width: 480px) {
    .wx-bubble { padding: 0.32rem 0.45rem; font-size: 0.88rem; }
}

/* ===== v20260919：首页入口卡片优化（去左边框色条，图标彩色渐变） ===== */
.wx-login-box {
    background: rgba(255,255,255,0.96);
    border-radius: 20px;
    box-shadow: 0 12px 40px rgba(0,0,0,0.1);
    padding: 2.5rem 2rem;
    backdrop-filter: blur(10px);
}
.wx-login-box h2 { font-size: 1.4rem; font-weight: 700; color: #1a1a1a; letter-spacing: 1px; }
.wx-logo {
    width: 64px; height: 64px; margin: 0 auto 0.8rem;
    background: linear-gradient(135deg, #07c160, #06ad56);
    border-radius: 18px; display: flex; align-items: center; justify-content: center;
    font-size: 2rem; box-shadow: 0 6px 20px rgba(7,193,96,0.3);
}
.home-action-btn {
    background: #fff;
    border: 1.5px solid #f0f0f0;
    border-left: 1.5px solid #f0f0f0 !important;
    border-radius: 14px;
    padding: 14px 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
.home-action-btn:hover {
    border-color: #07c160;
    box-shadow: 0 6px 20px rgba(7,193,96,0.12);
    transform: translateY(-2px);
}
.home-action-icon {
    width: 44px; height: 44px;
    border-radius: 12px;
    font-size: 1.4rem;
    color: #fff;
}
.home-action-btn.create .home-action-icon {
    background: linear-gradient(135deg, #07c160, #06ad56);
    box-shadow: 0 4px 12px rgba(7,193,96,0.3);
}
.home-action-btn.join .home-action-icon {
    background: linear-gradient(135deg, #4080ff, #60a5fa);
    box-shadow: 0 4px 12px rgba(64,128,255,0.3);
}
.home-action-btn.public .home-action-icon {
    background: linear-gradient(135deg, #ff9500, #ffb340);
    box-shadow: 0 4px 12px rgba(255,149,0,0.3);
}

/* ===== 五子棋邀请/接受消息卡片 ===== */
.gomoku-invite-card {
    padding: 12px 16px; text-align: center; min-width: 180px;
}
.gomoku-invite-card .gk-icon {
    font-size: 2rem; margin-bottom: 6px; display: block;
}
.gomoku-invite-card .gk-title {
    font-size: 0.9rem; font-weight: 600; color: #333; margin-bottom: 4px;
}
.gomoku-invite-card .gk-sub {
    font-size: 0.75rem; color: #999;
}
.gomoku-invite-card .gk-sub .gk-dot {
    display: inline-block; width: 5px; height: 5px; border-radius: 50%;
    background: #07c160; margin-right: 4px; vertical-align: middle;
    animation: gomoku-pulse 1.2s ease-in-out infinite;
}
@keyframes gomoku-pulse { 0%,100%{opacity:1;} 50%{opacity:0.3;} }
.gomoku-accept-btn {
    margin-top: 10px; padding: 8px 24px; background: linear-gradient(135deg, #07c160, #06ad56);
    color: #fff; border: none; border-radius: 20px; font-size: 0.88rem;
    cursor: pointer; font-weight: 500; letter-spacing: 0.5px;
    box-shadow: 0 2px 8px rgba(7,193,96,0.3);
    transition: all 0.2s;
}
.gomoku-accept-btn:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(7,193,96,0.4); }
.gomoku-accept-btn:active { transform: scale(0.96); }
.gomoku-accept-btn:disabled { background: #ccc; box-shadow: none; transform: none; cursor: default; }
.gomoku-accept-card {
    padding: 12px 16px; text-align: center;
}
.gomoku-accept-card .gk-icon {
    font-size: 2rem; margin-bottom: 6px; display: block;
    animation: gomoku-popIn 0.3s ease;
}
@keyframes gomoku-popIn { 0%{transform:scale(0);} 60%{transform:scale(1.2);} 100%{transform:scale(1);} }
.gomoku-accept-card .gk-text {
    font-size: 0.88rem; font-weight: 500; color: #07c160;
}

/* ===== 五子棋状态卡片 ===== */
.gomoku-status-card {
    position: fixed; top: 56px; left: 50%; transform: translateX(-50%);
    z-index: 100; width: 280px;
    background: #fff; border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.12);
    padding: 16px; animation: gomoku-cardIn 0.3s ease;
}
@keyframes gomoku-cardIn { from{opacity:0;transform:translateX(-50%) translateY(-10px);} to{opacity:1;transform:translateX(-50%) translateY(0);} }
.gomoku-card-header {
    display: flex; align-items: center; gap: 12px; margin-bottom: 12px;
}
.gomoku-card-icon {
    font-size: 1.8rem; flex-shrink: 0;
}
.gomoku-card-title-group {
    flex: 1;
}
.gomoku-card-title {
    font-size: 1rem; font-weight: 600; color: #222;
}
.gomoku-card-subtitle {
    font-size: 0.78rem; color: #888; margin-top: 2px;
}
.gomoku-card-players {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 0; border-top: 1px solid #f0f0f0; border-bottom: 1px solid #f0f0f0;
    margin-bottom: 12px;
}
.gomoku-player {
    display: flex; align-items: center; gap: 6px; flex: 1;
}
.gomoku-player-dot {
    width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0;
}
.gomoku-player-dot.black { background: #222; }
.gomoku-player-dot.white { background: #fff; border: 1.5px solid #ccc; }
.gomoku-player-name {
    font-size: 0.85rem; color: #333; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.gomoku-vs {
    font-size: 0.75rem; color: #999; font-weight: 600; padding: 0 8px;
}
.gomoku-card-actions {
    display: flex; justify-content: flex-end;
}
.gomoku-action-btn {
    background: #f5f5f5; color: #666; border: none; border-radius: 6px;
    padding: 6px 16px; font-size: 0.82rem; cursor: pointer;
    transition: all 0.2s;
}
.gomoku-action-btn:hover { background: #e8e8e8; }
.gomoku-action-btn.primary {
    background: #4080ff; color: #fff;
}
.gomoku-action-btn.primary:hover { background: #3070ef; }

/* ===== 五子棋对战窗口 ===== */
.gomoku-window {
    position: fixed; inset: 0; z-index: 9990; background: #f5f5f5;
    display: flex; flex-direction: column; animation: gomoku-slideIn 0.25s ease;
}
@keyframes gomoku-slideIn { from{transform:translateX(100%);} to{transform:translateX(0);} }
.gomoku-window-header {
    display: flex; align-items: center; padding: 10px 12px; background: #fff;
    border-bottom: 1px solid #eee; min-height: 48px; flex-shrink: 0;
    position: relative; z-index: 30;}
.gomoku-back-btn {
    position: relative; z-index: 40;
    background: none; border: none; font-size: 1.5rem; color: #333;
    cursor: pointer; padding: 4px 8px; line-height: 1; flex-shrink: 0;
}
.gomoku-window-title {
    flex: 1; text-align: center; margin-left: -32px;
}
.gomoku-window-title .main { font-size: 1rem; font-weight: 600; color: #222; display: block; }
.gomoku-window-title .sub { font-size: 0.72rem; color: #888; display: block; margin-top: 1px; }
.gomoku-sync-wrap {
    display: flex; align-items: center; gap: 6px; flex-shrink: 0;
}
.gomoku-sync-label { font-size: 0.72rem; color: #666; white-space: nowrap; }
.gomoku-switch {
    position: relative; width: 40px; height: 22px; background: #ddd;
    border-radius: 11px; cursor: pointer; transition: background 0.2s; flex-shrink: 0;
}
.gomoku-switch.active { background: #07c160; }
.gomoku-switch::after {
    content: ''; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px;
    background: #fff; border-radius: 50%; transition: left 0.2s; box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.gomoku-switch.active::after { left: 20px; }

/* 玩家信息栏 */
.gomoku-players {
    display: flex; gap: 10px; padding: 10px 12px; background: #f5f5f5; flex-shrink: 0;
}
.gomoku-player-card {
    flex: 1; display: flex; align-items: center; gap: 8px;
    background: #fff; border-radius: 10px; padding: 8px 10px;
    border: 2px solid transparent; transition: border-color 0.2s;
}
.gomoku-player-card.active { border-color: #4080ff; box-shadow: 0 0 0 2px rgba(64,128,255,0.15); }
.gomoku-player-avatar {
    width: 36px; height: 36px; border-radius: 50%; background: linear-gradient(135deg,#667eea,#764ba2);
    display: flex; align-items: center; justify-content: center; color: #fff;
    font-size: 0.9rem; font-weight: 600; flex-shrink: 0; overflow: hidden;
}
.gomoku-player-info { flex: 1; min-width: 0; }
.gomoku-player-name { font-size: 0.85rem; font-weight: 600; color: #222; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gomoku-player-role { font-size: 0.7rem; color: #888; margin-top: 1px; }
.gomoku-player-role .black { color: #222; }
.gomoku-player-role .white { color: #999; }

/* 棋盘区域 */
.gomoku-board-wrap {
    flex: 1; display: flex; align-items: center; justify-content: center;
    padding: 10px; overflow: auto; background: #f5f5f5;
}
.gomoku-board-container {
    background: #e6c88a; border-radius: 8px; padding: 10px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15); border: 3px solid #c9a860;
}
.gomoku-board-container canvas { display: block; cursor: pointer; }

/* 底部操作区 */
.gomoku-bottom {
    padding: 10px 16px 16px; background: #f5f5f5; text-align: center; flex-shrink: 0;
}
.gomoku-bottom-status { font-size: 0.82rem; color: #666; margin-bottom: 10px; }
.gomoku-resign-btn {
    background: #e84035; color: #fff; border: none; border-radius: 8px;
    padding: 9px 32px; font-size: 0.9rem; cursor: pointer; font-weight: 500;
    display: inline-flex; align-items: center; gap: 6px;
}
.gomoku-resign-btn:disabled { background: #ccc; cursor: not-allowed; }

/* 聊天悬浮按钮 */
.gomoku-chat-fab {
    position: absolute; right: 16px; bottom: 80px; width: 44px; height: 44px;
    border-radius: 50%; background: #fff; border: 1px solid #ddd;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.2rem; cursor: pointer; box-shadow: 0 2px 10px rgba(0,0,0,0.15);
    z-index: 10;
}
.gomoku-chat-badge {
    position: absolute; top: -2px; right: -2px; min-width: 16px; height: 16px;
    background: #e84035; color: #fff; border-radius: 8px; font-size: 0.6rem;
    display: flex; align-items: center; justify-content: center; padding: 0 4px;
    border: 2px solid #f5f5f5;
}

/* 对局聊天面板 */
.gomoku-chat-panel {
    position: absolute; left: 0; right: 0; bottom: 0; top: 0;
    background: #f5f5f5; z-index: 20; display: flex; flex-direction: column;
    animation: gomoku-chatSlide 0.2s ease;
}
@keyframes gomoku-chatSlide { from{transform:translateY(100%);} to{transform:translateY(0);} }
.gomoku-chat-header {
    display: flex; align-items: center; padding: 12px 14px; background: #fff;
    border-bottom: 1px solid #eee; flex-shrink: 0;
}
.gomoku-chat-title { flex: 1; }
.gomoku-chat-title .t { font-size: 0.95rem; font-weight: 600; color: #222; }
.gomoku-chat-title .s { font-size: 0.7rem; color: #999; margin-top: 2px; }
.gomoku-chat-close {
    background: none; border: none; font-size: 1.2rem; color: #999;
    cursor: pointer; padding: 4px 8px; line-height: 1;
}
.gomoku-chat-messages {
    flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 10px;
}
.gomoku-chat-msg { display: flex; flex-direction: column; gap: 3px; max-width: 80%; }
.gomoku-chat-msg.self { align-self: flex-end; align-items: flex-end; }
.gomoku-chat-msg.other { align-self: flex-start; align-items: flex-start; }
.gomoku-chat-msg-name { font-size: 0.7rem; color: #888; padding: 0 4px; }
.gomoku-chat-msg-bubble {
    padding: 8px 12px; border-radius: 10px; font-size: 0.85rem; line-height: 1.4;
    word-break: break-word; background: #fff; color: #222;
}
.gomoku-chat-msg.self .gomoku-chat-msg-bubble { background: #95ec69; }
.gomoku-chat-msg-time { font-size: 0.62rem; color: #bbb; padding: 0 4px; }
.gomoku-chat-input-bar {
    display: flex; align-items: center; gap: 8px; padding: 8px 10px;
    background: #fff; border-top: 1px solid #eee; flex-shrink: 0;
}
.gomoku-chat-input-bar .icon-btn {
    width: 34px; height: 34px; border-radius: 50%; background: #f0f0f0;
    border: none; font-size: 1rem; cursor: pointer; display: flex;
    align-items: center; justify-content: center; flex-shrink: 0;
}
.gomoku-chat-input {
    flex: 1; border: 1px solid #ddd; border-radius: 18px; padding: 8px 14px;
    font-size: 0.85rem; outline: none; background: #f8f8f8;
}
.gomoku-chat-input:focus { border-color: #07c160; background: #fff; }

/* 通用弹窗（确认/结算） */
.gomoku-modal-mask {
    position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 10000;
    display: flex; align-items: center; justify-content: center; padding: 20px;
}
.gomoku-modal {
    background: #fff; border-radius: 16px; width: 100%; max-width: 320px;
    padding: 28px 20px 20px; text-align: center; animation: gomoku-modalIn 0.2s ease;
}
@keyframes gomoku-modalIn { from{transform:scale(0.85);opacity:0;} to{transform:scale(1);opacity:1;} }
.gomoku-modal-icon {
    width: 52px; height: 52px; border-radius: 50%; margin: 0 auto 14px;
    display: flex; align-items: center; justify-content: center; font-size: 1.6rem;
}
.gomoku-modal-icon.warn { background: #fff0f0; color: #e84035; }
.gomoku-modal-icon.win { background: #fff8e1; color: #f5a623; }
.gomoku-modal-icon.lose { background: #fff0f0; color: #e84035; }
.gomoku-modal-title { font-size: 1.1rem; font-weight: 600; color: #222; margin-bottom: 6px; }
.gomoku-modal-desc { font-size: 0.82rem; color: #888; margin-bottom: 22px; line-height: 1.5; }
.gomoku-modal-btns { display: flex; gap: 10px; }
.gomoku-modal-btn {
    flex: 1; padding: 10px; border-radius: 10px; font-size: 0.9rem;
    cursor: pointer; border: none; font-weight: 500;
}
.gomoku-modal-btn.secondary { background: #f0f0f0; color: #555; }
.gomoku-modal-btn.primary { background: #4080ff; color: #fff; }
.gomoku-modal-btn.danger { background: #e84035; color: #fff; }
/* ===== 对局聊天发送按钮与表情面板 ===== */
.gomoku-chat-send {
    flex-shrink: 0;
    padding: 6px 14px;
    background: #07c160;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    margin-left: 6px;
}
.gomoku-chat-send:hover { background: #06ad56; }
.gomoku-chat-send:active { transform: scale(0.96); }
.gk-emoji-panel {
    position: absolute;
    bottom: 52px;
    left: 8px;
    right: 8px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    padding: 10px;
    box-shadow: 0 -2px 12px rgba(0,0,0,0.1);
    z-index: 10;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}
.gk-emoji-item {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    cursor: pointer;
    border-radius: 6px;
    transition: background 0.15s;
}
.gk-emoji-item:hover { background: #f0f0f0; }
.gk-emoji-item:active { background: #e0e0e0; }
/* 对局聊天系统消息 */
.gomoku-chat-system {
    text-align: center;
    padding: 6px 0;
}
.gomoku-chat-system span {
    font-size: 0.75rem;
    color: #999;
    background: rgba(0,0,0,0.05);
    padding: 3px 10px;
    border-radius: 10px;
}
/* ===== 首页三入口 ===== */
.home-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 20px;
    width: 100%;
}
.home-action-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border: none;
    border-radius: 12px;
    background: #fff;
    cursor: pointer;
    text-align: left;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.home-action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}
.home-action-btn:active {
    transform: translateY(0);
}
.home-action-btn.create { border-left: 4px solid #07c160; }
.home-action-btn.join { border-left: 4px solid #4080ff; }
.home-action-btn.public { border-left: 4px solid #ff9500; }
.home-action-icon {
    font-size: 1.5rem;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f5f5f5;
    border-radius: 10px;
    flex-shrink: 0;
}
.home-action-text {
    font-size: 1rem;
    font-weight: 600;
    color: #333;
}
.home-action-desc {
    font-size: 0.75rem;
    color: #999;
    margin-top: 2px;
}

/* ===== 房间弹窗 ===== */
.room-modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}
.room-modal-mask {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.5);
}
.room-modal-box {
    position: relative;
    background: #fff;
    border-radius: 16px;
    padding: 24px;
    width: 90%;
    max-width: 360px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    animation: roomModalIn 0.2s ease;
}
@keyframes roomModalIn {
    from { transform: scale(0.9); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}
.room-modal-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: #333;
    text-align: center;
    margin-bottom: 20px;
}
.room-modal-input-group {
    margin-bottom: 16px;
}
.room-modal-input-group label {
    display: block;
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 6px;
}
.room-modal-optional {
    color: #999;
    font-weight: normal;
}
.room-modal-input-group input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 0.95rem;
    box-sizing: border-box;
    outline: none;
    transition: border-color 0.2s;
}
.room-modal-input-group input:focus {
    border-color: #07c160;
}
.room-modal-btns {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}
.room-modal-btn {
    flex: 1;
    padding: 10px;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s;
}
.room-modal-btn.cancel {
    background: #f5f5f5;
    color: #666;
}
.room-modal-btn.cancel:hover { background: #e8e8e8; }
.room-modal-btn.confirm {
    background: #07c160;
    color: #fff;
}
.room-modal-btn.confirm:hover { background: #06ad56; }
.room-modal-btn:active { transform: scale(0.97); }

/* 免责声明样式 */
.room-modal-disclaimer {
    margin: 12px 0;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}
.disclaimer-title {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
}
.disclaimer-content {
    font-size: 12px;
    color: #666;
    line-height: 1.6;
    max-height: 120px;
    overflow-y: auto;
}
.disclaimer-content p {
    margin: 4px 0;
}
.disclaimer-content strong {
    color: #d9534f;
}
.disclaimer-agree {
    display: flex;
    align-items: center;
    margin-top: 10px;
    font-size: 13px;
    color: #333;
    cursor: pointer;
}
.disclaimer-agree input[type="checkbox"] {
    margin-right: 6px;
    width: 16px;
    height: 16px;
    cursor: pointer;
}

/* ========== 房间设置弹窗 ========== */
.rs-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,.4);
    display: flex; align-items: center; justify-content: center;
    z-index: 9999;
    animation: rsFadeIn .2s ease;
}
@keyframes rsFadeIn { from { opacity: 0; } to { opacity: 1; } }
.rs-box {
    background: #fff; border-radius: 16px; padding: 24px;
    width: 90%; max-width: 360px;
    box-shadow: 0 10px 40px rgba(0,0,0,.3);
    max-height: 85vh; overflow-y: auto; position: relative;
    animation: rsSlideUp .25s ease;
}
@keyframes rsSlideUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
.rs-close {
    position: absolute; top: 12px; right: 14px;
    background: none; border: none; font-size: 1.3rem;
    cursor: pointer; color: #999; line-height: 1;
}
.rs-title { font-size: 1.1rem; font-weight: 600; margin-bottom: 16px; color: #333; padding-right: 24px; }
.rs-section { margin-bottom: 14px; }
.rs-avatar-section { padding: 12px; background: #f9f9f9; border-radius: 10px; }
.rs-avatar-row { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.rs-avatar-preview {
    width: 48px; height: 48px; border-radius: 50%;
    background: #07c160; color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.2rem; overflow: hidden; flex-shrink: 0;
}
.rs-avatar-info { flex: 1; }
.rs-avatar-label { font-size: 0.85rem; color: #333; font-weight: 500; }
.rs-avatar-hint { font-size: 0.7rem; color: #999; margin-top: 2px; }
.rs-avatar-btn-row { display: flex; gap: 8px; }
.rs-avatar-input { flex: 1; padding: 6px 8px; border: 1px solid #ddd; border-radius: 8px; font-size: 13px; box-sizing: border-box; }
.rs-avatar-get-btn { padding: 6px 10px; background: #4080ff; color: #fff; border: none; border-radius: 6px; font-size: 12px; cursor: pointer; flex-shrink: 0; }
.rs-avatar-clear-btn { padding: 6px 8px; background: #f5f5f5; color: #999; border: none; border-radius: 6px; font-size: 11px; cursor: pointer; flex-shrink: 0; }
.rs-field { padding: 10px 12px; border: 1px solid #ddd; border-radius: 8px; font-size: 14px; box-sizing: border-box; width: 100%; }
.rs-field:disabled { background: #f5f5f5; color: #999; }
.rs-label { display: block; font-size: 0.85rem; color: #666; margin-bottom: 6px; }
.rs-input { flex: 1; }
.rs-row { display: flex; gap: 8px; }
.rs-save-row { margin-bottom: 14px; }
.rs-btn { border: none; border-radius: 8px; cursor: pointer; font-size: 13px; transition: opacity .15s; }
.rs-btn:hover { opacity: .88; }
.rs-btn-primary { padding: 10px 14px; background: #07c160; color: #fff; }
.rs-btn-save { flex-shrink: 0; }
.rs-btn-save-room { flex: 1; padding: 10px; font-size: 14px; }
.rs-hint { font-size: 0.75rem; color: #999; margin-top: 4px; }
.rs-toggle-wrap {
    margin-bottom: 14px; padding: 10px 12px;
    background: #f9f9f9; border-radius: 8px;
    display: flex; justify-content: space-between; align-items: center;
    cursor: pointer;
}
.rs-filter-wrap { background: #fff5f5; }
.rs-toggle-title { font-size: 0.85rem; color: #333; }
.rs-toggle-desc { font-size: 0.7rem; color: #999; margin-top: 2px; }
.rs-toggle-btn {
    padding: 5px 14px; border: none; border-radius: 14px;
    font-size: 0.8rem; cursor: pointer;
    background: #e0e0e0; color: #666;
}
.rs-toggle-btn.active { background: #07c160; color: #fff; }
.rs-danger-zone { border-top: 1px solid #eee; padding-top: 14px; }
.rs-danger-title { font-size: 0.85rem; color: #999; margin-bottom: 8px; }
.rs-btn-warn {
    flex: 1; padding: 10px;
    background: #fff3cd; color: #856404;
    border: 1px solid #ffeaa7; border-radius: 8px;
    font-size: 13px; cursor: pointer;
}
.rs-btn-danger {
    flex: 1; padding: 10px;
    background: #f8d7da; color: #721c24;
    border: 1px solid #f5c6cb; border-radius: 8px;
    font-size: 13px; cursor: pointer;
}

/* ========== 游戏弹窗（骰子/真心话/猜拳） ========== */
.game-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,.4);
    display: flex; align-items: center; justify-content: center;
    z-index: 9999;
    animation: rsFadeIn .2s ease;
}
.game-box {
    background: #fff; border-radius: 16px;
    padding: 28px 36px; text-align: center;
    box-shadow: 0 10px 40px rgba(0,0,0,.3);
    animation: rsSlideUp .25s ease;
}
.game-box.wide { max-width: 320px; margin: 0 16px; }
.game-dice-wrap { margin-bottom: 12px; display: flex; justify-content: center; }
.dice-img { width: 56px; height: 56px; }
.dice-img.rolling { animation: diceShake 0.12s infinite; }
.dice-img.result { border-radius: 8px; }
.game-icon { font-size: 2.5rem; margin-bottom: 12px; }
.game-icon-rps { font-size: 3rem; margin-bottom: 12px; transition: transform .1s; }
.game-label { font-size: .95rem; color: #666; }
.game-question {
    font-size: 1rem; color: #333; line-height: 1.6;
    min-height: 48px; display: flex; align-items: center; justify-content: center;
}

/* ========== 消息渲染补充 ========== */
.msg-system {
    text-align: center; padding: 6px 14px;
    font-size: 0.85rem; color: #888;
    background: transparent !important;
    box-shadow: none !important;
    border: none !important;
}
.msg-recall-el {
    justify-content: center;
    background: transparent !important;
    box-shadow: none !important;
    border: none !important;
    padding: 6px 0;
}
.msg-recall-text {
    text-align: center; color: #999; font-size: 12px; line-height: 1.6;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}
.msg-rps { text-align: center; font-size: 1.8rem; padding: 2px 0; }

/* ========== 五子棋白方头像 ========== */
.gk-avatar-white { background: linear-gradient(135deg, #f093fb, #f5576c); }
.gk-avatar-img { width: 100%; height: 100%; object-fit: cover; }

/* ========== Core 组件公共样式 ========== */
.core-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    z-index: 99999; display: flex; align-items: center; justify-content: center;
    background: rgba(0,0,0,0.5);
    animation: coreFadeIn 0.2s ease;
}
@keyframes coreFadeIn { from { opacity: 0; } to { opacity: 1; } }
.chat-notification {
    position: fixed; top: 1.5rem; right: 1.5rem; z-index: 99999;
    padding: 0.7rem 1.2rem; border-radius: 10px; font-size: 0.9rem;
    box-shadow: 0 4px 16px rgba(0,0,0,0.12); max-width: 80vw;
    animation: coreSlideDown 0.3s ease;
    transition: opacity 0.3s ease, transform 0.3s ease;
}
.chat-notification.fade-out { opacity: 0; transform: translateY(-10px); }
.chat-notification.error { background: #f8d7da; color: #721c24; }
.chat-notification.success { background: #d4edda; color: #155724; }
.chat-notification.info { background: #fff; color: #333; border: 1px solid #eee; }
@keyframes coreSlideDown { from { opacity: 0; transform: translateY(-12px); } to { opacity: 1; transform: translateY(0); } }
.core-alert-box {
    background: #fff; padding: 1.8rem 2rem; border-radius: 16px;
    min-width: 280px; max-width: 85vw; text-align: center;
    box-shadow: 0 10px 40px rgba(0,0,0,0.25);
    animation: coreScaleIn 0.25s ease;
}
@keyframes coreScaleIn { from { opacity: 0; transform: scale(0.92); } to { opacity: 1; transform: scale(1); } }
.core-alert-icon { font-size: 2.2rem; margin-bottom: 0.6rem; }
.core-alert-title { margin: 0 0 0.8rem; font-size: 1.1rem; color: #333; }
.core-alert-msg { margin: 0 0 1.3rem; font-size: 0.95rem; color: #666; line-height: 1.7; }
.core-alert-btn {
    padding: 0.55rem 2.5rem; background: #07c160; color: #fff;
    border: none; border-radius: 10px; font-size: 1rem; cursor: pointer;
    transition: background 0.15s, transform 0.1s;
}
.core-alert-btn:hover { background: #06ad56; }
.core-alert-btn:active { transform: scale(0.97); }
.media-viewer {
    display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.92); z-index: 99998;
    align-items: center; justify-content: center;
    animation: coreFadeIn 0.2s ease;
}
.media-viewer-close {
    position: absolute; top: 16px; right: 20px;
    background: rgba(255,255,255,0.15); border: none; color: #fff;
    width: 36px; height: 36px; border-radius: 50%; font-size: 1.2rem;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    transition: background 0.15s; z-index: 1;
}
.media-viewer-close:hover { background: rgba(255,255,255,0.3); }
.media-viewer-content { max-width: 90%; max-height: 90%; border-radius: 8px; }
.online-panel-box {
    background: #fff; border-radius: 16px; width: 320px; max-width: 88vw;
    max-height: 70vh; overflow: hidden; display: flex; flex-direction: column;
    box-shadow: 0 10px 40px rgba(0,0,0,0.25);
    animation: coreScaleIn 0.25s ease;
}
.online-panel-header { padding: 1rem 1.2rem; font-size: 1rem; font-weight: 600; border-bottom: 1px solid #eee; color: #333; }
.online-panel-list { overflow-y: auto; padding: 0 1.2rem; flex: 1; }
.online-panel-row { display: flex; align-items: center; padding: 0.6rem 0; border-bottom: 1px solid #f5f5f5; }
.online-panel-dot { width: 8px; height: 8px; border-radius: 50%; background: #52c41a; margin-right: 0.6rem; flex-shrink: 0; }
.online-panel-name { font-size: 0.95rem; color: #333; }
.online-panel-loc { color: #999; margin-left: 0.4rem; font-size: 0.85rem; }
.online-panel-time { color: #bbb; font-size: 0.75rem; margin-left: 0.4rem; }
.online-panel-empty { padding: 1.2rem 0; color: #999; text-align: center; font-size: 0.9rem; }
.online-panel-footer { padding: 0.8rem 1.2rem; text-align: right; border-top: 1px solid #eee; }
.online-panel-close-btn {
    padding: 0.45rem 1.2rem; border: none; background: #07c160; color: #fff;
    border-radius: 8px; cursor: pointer; font-size: 0.85rem;
    transition: background 0.15s, transform 0.1s;
}
.online-panel-close-btn:hover { background: #06ad56; }
.online-panel-close-btn:active { transform: scale(0.97); }
.emoji-picker {
    position: absolute; bottom: 60px; left: 10px;
    background: #fff; border: 1px solid #eee; border-radius: 12px;
    padding: 8px; display: grid; grid-template-columns: repeat(8, 1fr); gap: 4px;
    z-index: 100; box-shadow: 0 4px 16px rgba(0,0,0,0.1);
    animation: coreScaleIn 0.2s ease;
}
.emoji-btn {
    border: none; background: none; font-size: 1.3rem; cursor: pointer;
    padding: 6px; border-radius: 8px;
    transition: background 0.12s, transform 0.1s;
}
.emoji-btn:hover { background: #f0f0f0; transform: scale(1.15); }
.emoji-btn:active { transform: scale(0.95); }
.pwd-box {
    background: #fff; padding: 1.5rem; border-radius: 14px;
    min-width: 280px; box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    animation: coreScaleIn 0.25s ease;
}
.pwd-title { margin: 0 0 1rem; font-size: 1.1rem; color: #333; }
.pwd-input {
    width: 100%; padding: 0.6rem; border: 1px solid #ddd; border-radius: 8px;
    font-size: 0.95rem; box-sizing: border-box; margin-bottom: 1rem;
    transition: border-color 0.15s;
}
.pwd-input:focus { border-color: #07c160; outline: none; }
.pwd-btn-row { display: flex; gap: 0.5rem; justify-content: flex-end; }
.pwd-btn { padding: 0.5rem 1rem; border-radius: 8px; cursor: pointer; font-size: 0.9rem; transition: background 0.15s, transform 0.1s; }
.pwd-btn:active { transform: scale(0.97); }
.pwd-btn-cancel { border: 1px solid #ddd; background: #fff; color: #666; }
.pwd-btn-cancel:hover { background: #f5f5f5; }
.pwd-btn-ok { border: none; background: #07c160; color: #fff; }
.pwd-btn-ok:hover { background: #06ad56; }
.search-bar { padding: 8px 12px; background: #f5f5f5; border-bottom: 1px solid #e0e0e0; }
.search-input {
    width: 100%; padding: 8px 12px; border: 1px solid #ddd; border-radius: 8px;
    font-size: 14px; box-sizing: border-box; transition: border-color 0.15s;
}
.search-input:focus { border-color: #07c160; outline: none; }

/* ===== v20260928：消息引用 + 气泡旁撤回 + 长按/右键操作菜单 ===== */
/* 引用块（气泡内顶部） */
.msg-quote {
    display: block;
    margin-bottom: 4px;
    padding: 3px 8px;
    background: rgba(0,0,0,0.05);
    border-left: 3px solid #07c160;
    border-radius: 4px;
    font-size: 0.8em;
    color: #777;
    word-break: break-all;
    cursor: default;
}
.wx-msg.self .msg-quote { background: rgba(0,0,0,0.08); border-left-color: rgba(255,255,255,0.7); }
.msg-quote .mq-name { font-weight: 600; color: #555; }
.wx-msg.self .msg-quote .mq-name { color: #333; }

    /* 自己消息的撤回入口：低调文字按钮（桌面 hover 出现，移动端常驻） */
    .msg-recall-btn {
        display: none;
        align-items: center;
        border: none;
        background: transparent;
        color: #a8b0b8;
        font-size: 0.7rem;
        line-height: 1;
        padding: 2px 4px;
        margin: 0;
        border-radius: 3px;
        cursor: pointer;
        letter-spacing: 0.02em;
        transition: background 0.15s ease, color 0.15s ease;
    }
    .msg-recall-btn:hover { background: rgba(127,127,127,0.14); }
    .self:hover .msg-recall-btn { display: inline-flex; }
    .wx-meta { display: flex; align-items: center; gap: 6px; justify-content: flex-start; margin-top: 2px; }
    .self .wx-meta { justify-content: flex-end; }
    .wx-meta .wx-time { margin-top: 0; }
    @media (hover: none), (max-width: 480px) {
        .self .msg-recall-btn {
            display: inline-flex;
            font-size: 0.72rem;
            padding: 4px 6px;
            opacity: 0.85;
        }
    }

/* 输入框下方引用条（单行截断） */
.chat-quote-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    background: #f0f6ff;
    border: 1px solid #d6e4ff;
    border-radius: 8px;
    margin: 4px 8px;
    font-size: 0.82rem;
    color: #555;
    max-width: calc(100% - 16px);
    flex-shrink: 0;
}
.chat-quote-bar .cqb-name { font-weight: 600; color: #07c160; white-space: nowrap; flex-shrink: 0; }
.chat-quote-bar .cqb-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-quote-bar .cqb-close {
    border: none; background: transparent; cursor: pointer;
    color: #999; font-size: 0.9rem; padding: 2px 4px; line-height: 1; flex-shrink: 0;
}
.chat-quote-bar .cqb-close:hover { color: #f56c6c; }

/* 长按/右键底部操作菜单 */
.msg-action-mask {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.4);
    z-index: 9999;
}
.msg-action-sheet {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    background: #fff;
    border-radius: 14px 14px 0 0;
    padding: 8px 12px calc(12px + env(safe-area-inset-bottom));
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    animation: msgSheetUp 0.18s ease-out;
}
@keyframes msgSheetUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}
.msg-action-item {
    display: block;
    width: 100%;
    padding: 12px 0;
    border: none;
    background: #f7f7f7;
    border-radius: 10px;
    font-size: 0.95rem;
    cursor: pointer;
    text-align: center;
    color: #333;
    transition: background 0.12s;
}
.msg-action-item:hover { background: #ececec; }
.msg-action-item.msg-action-cancel { background: transparent; color: #999; font-size: 0.85rem; }

/* ===== v20260928f：视频下载按钮 ===== */
.video-wrap { position: relative; display: inline-block; max-width: 100%; }
.video-wrap video { display: block; }
.video-dl {
    position: absolute;
    right: 6px;
    bottom: 6px;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: rgba(0,0,0,0.55);
    color: #fff;
    font-size: 1rem;
    line-height: 30px;
    text-align: center;
    text-decoration: none;
    z-index: 2;
}
.video-dl:hover { background: rgba(0,0,0,0.75); }

/* ===== v20260929c：文件消息卡片 + 文本预览 ===== */
.chat-file-card {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    background: #fff;
    border: 1px solid #e6e6e6;
    border-radius: 8px;
    min-width: 200px;
    max-width: 260px;
}
.cfc-icon { font-size: 1.6rem; line-height: 1; flex-shrink: 0; }
.cfc-info { flex: 1; min-width: 0; }
.cfc-name {
    font-size: 0.84rem;
    color: #222;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.cfc-size { font-size: 0.72rem; color: #999; margin-top: 2px; }
.cfc-view, .cfc-dl {
    flex-shrink: 0;
    font-size: 0.75rem;
    padding: 4px 8px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    text-decoration: none;
    line-height: 1.2;
}
.cfc-view { background: #eef4ff; color: #3b6fd4; }
.cfc-view:hover { background: #e0ebff; }
.cfc-dl { background: #07c160; color: #fff; }
.cfc-dl:hover { background: #06ad56; }

/* 文本文件预览弹窗 */
.file-preview-mask {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 10002;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}
.file-preview-box {
    width: 100%;
    max-width: 680px;
    max-height: 82vh;
    background: #fff;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.fpb-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    border-bottom: 1px solid #eee;
}
.fpb-title {
    font-size: 0.92rem;
    font-weight: 600;
    color: #222;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.fpb-close {
    border: none;
    background: transparent;
    font-size: 1rem;
    color: #999;
    cursor: pointer;
    padding: 2px 6px;
}
.fpb-body {
    flex: 1;
    overflow: auto;
    margin: 0;
    padding: 14px;
    font-size: 0.82rem;
    line-height: 1.6;
    color: #333;
    white-space: pre-wrap;
    word-break: break-word;
    background: #fafafa;
    font-family: ui-monospace, Menlo, Consolas, monospace;
}
/* PDF preview (iframe reader) */
.file-preview-box.fpb-pdf{width:100%;max-width:960px;height:86vh;max-height:86vh}
.fpb-tools{display:flex;align-items:center;gap:8px;flex-shrink:0}
.fpb-open{font-size:.78rem;color:#0ea5e9;text-decoration:none;border:1px solid currentColor;border-radius:6px;padding:2px 7px;white-space:nowrap}
.fpb-pdf-body{flex:1;min-height:0;display:flex;flex-direction:column;background:#525659}
.fpb-pdf-pages{flex:1;min-height:0;overflow:auto;padding:10px;display:flex;flex-direction:column;align-items:center;gap:10px;-webkit-overflow-scrolling:touch}
.fpb-pdf-pages canvas{width:100%;max-width:820px;height:auto;background:#fff;box-shadow:0 2px 10px rgba(0,0,0,.4)}
.fpb-pages{font-size:.74rem;color:#6b7280;white-space:nowrap}
.fpb-pdf-tip{font-size:.72rem;color:#c9cdd3;padding:6px 12px;background:#3f4144;border-top:1px solid rgba(255,255,255,.08)}
@media(max-width:600px){.file-preview-box.fpb-pdf{height:88vh;max-height:88vh;border-radius:10px}.fpb-open{font-size:.72rem;padding:2px 6px}}
/* ===== 前台聊天记录搜索（🔍 展开搜索栏 + 结果列表） ===== */
#search-results { max-height: 200px; overflow-y: auto; }
.search-result-item {
    display: flex;
    gap: 6px;
    align-items: baseline;
    padding: 6px 8px;
    margin-top: 4px;
    border-radius: 6px;
    font-size: 0.78rem;
    line-height: 1.45;
    cursor: pointer;
    background: rgba(127,127,127,0.07);
}
.search-result-item:hover,
.search-result-item:active { background: rgba(127,127,127,0.16); }
.search-result-item .sri-user {
    flex-shrink: 0;
    max-width: 40%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    opacity: 0.6;
}
.search-result-item .sri-text {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    opacity: 0.9;
}
.search-empty {
    padding: 8px;
    font-size: 0.76rem;
    text-align: center;
    opacity: 0.55;
}
.search-hit {
    outline: 2px solid rgba(7,193,96,0.6);
    outline-offset: 2px;
    border-radius: 6px;
    animation: searchHitFade 1.6s ease forwards;
}
@keyframes searchHitFade {
    0%, 55% { outline-color: rgba(7,193,96,0.65); }
    100% { outline-color: rgba(7,193,96,0); }
}
/* ===== 上传进度卡片（进度条 / 网速 / 剩余时间） ===== */
.up-card {
    position: fixed;
    left: 50%;
    bottom: calc(88px + env(safe-area-inset-bottom, 0px));
    transform: translateX(-50%);
    width: min(340px, calc(100vw - 28px));
    box-sizing: border-box;
    padding: 12px 14px 10px;
    border-radius: 14px;
    background: rgba(28, 30, 34, 0.92);
    color: #fff;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.28);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    z-index: 9600;
    font-size: 0.78rem;
    animation: upCardIn 0.18s ease;
}
@keyframes upCardIn {
    from { opacity: 0; transform: translate(-50%, 6px); }
    to { opacity: 1; transform: translate(-50%, 0); }
}
.up-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.up-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.8rem;
    font-weight: 500;
}
.up-pct { flex-shrink: 0; font-variant-numeric: tabular-nums; color: #7ee0b0; font-size: 0.8rem; }
.up-track { height: 5px; border-radius: 3px; background: rgba(255, 255, 255, 0.16); overflow: hidden; }
.up-bar {
    height: 100%;
    width: 0;
    border-radius: 3px;
    background: linear-gradient(90deg, #34d399, #10b981);
    transition: width 0.18s linear;
}
.up-meta {
    margin-top: 7px;
    font-size: 0.7rem;
    line-height: 1.4;
    color: rgba(255, 255, 255, 0.62);
    word-break: break-all;
}
.up-cancel {
    margin-top: 8px;
    width: 100%;
    padding: 6px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 8px;
    background: transparent;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.72rem;
    cursor: pointer;
}
.up-cancel:hover { background: rgba(255, 255, 255, 0.08); }
.up-done .up-bar { background: linear-gradient(90deg, #4ade80, #22c55e); }
.up-fail .up-bar { background: #ef4444; }
.up-fail .up-pct { color: #fca5a5; }
/* ===== 上传卡片：首包未到时的扫描动画（避免 0% 看起来像没反应） ===== */
.up-card.up-waiting .up-track {
    background-image: linear-gradient(90deg, rgba(255,255,255,0) 0%, rgba(255,255,255,0.45) 50%, rgba(255,255,255,0) 100%);
    background-size: 45% 100%;
    background-repeat: no-repeat;
    background-position: -60% 0;
    animation: upWaiting 1.2s linear infinite;
}
@keyframes upWaiting {
    from { background-position: -60% 0; }
    to { background-position: 160% 0; }
}