﻿/* QQ 风格模板 */
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
    font-family: -apple-system, 'PingFang SC', 'Microsoft YaHei', sans-serif;
    background: #f0f0f0; color: #333; height: 100vh; height: 100dvh; overflow: hidden;
}
.wx-login {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: linear-gradient(135deg, #12B7F5, #0e9dd4);
    display: flex; align-items: center; justify-content: center;
}
.wx-login-box {
    background: #fff; padding: 2.5rem 2rem; border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.15); 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: #12B7F5; 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: 8px; font-size: 0.95rem; outline: none;
}
.wx-input-group input:focus { border-color: #12B7F5; }
.wx-btn-primary {
    width: 100%; padding: 0.7rem; background: #12B7F5; color: #fff;
    border: none; border-radius: 8px; font-size: 1rem; cursor: pointer; margin-top: 0.5rem;
}
.wx-btn-primary:hover { background: #0e9dd4; }
.wx-btn-link {
    display: block; margin: 1rem auto 0; background: none; border: none;
    color: #12B7F5; font-size: 0.9rem; cursor: pointer;
}
.wx-chat { height: 100vh; height: 100dvh; display: flex; flex-direction: column; }
.wx-header {
    background: #fff; border-bottom: 1px solid #e0e0e0;
    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; }
.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: #f0f0f0; }
.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.08); color: #888; font-size: 0.8rem;
    border-radius: 4px; padding: 0.2rem 0.6rem;
}
.wx-avatar {
    width: 38px; height: 38px; border-radius: 6px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.9rem; color: #fff; font-weight: 600;
    background: linear-gradient(135deg, #12B7F5, #0e9dd4);
}
.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: 8px;
    font-size: 0.95rem; line-height: 1.5; word-break: break-word;
    border: 1px solid #e8e8e8;
}
.wx-bubble img { max-width: 100%; border-radius: 6px; cursor: pointer; }
.wx-bubble video { max-width: 100%; border-radius: 6px; }
.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: #fff; border-top: 1px solid #e0e0e0;
    padding: 0.5rem 0.8rem; display: flex; align-items: center; gap: 0.5rem;
}
.wx-input-icon { background: none; border: none; font-size: 1.3rem; cursor: pointer; padding: 0.2rem; }
.wx-input-bar textarea {
    flex: 1; border: 1px solid #e0e0e0; border-radius: 8px;
    padding: 0.5rem 0.7rem; font-size: 0.95rem; resize: none;
    max-height: 100px; outline: none; font-family: inherit;
}
.wx-input-bar textarea:focus { border-color: #12B7F5; }
.wx-send {
    background: #12B7F5; color: #fff; border: none; border-radius: 8px;
    padding: 0.5rem 1rem; font-size: 0.9rem; cursor: pointer;
}
.wx-send:hover { background: #0e9dd4; }

/* 自己的消息：右对齐 */
.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; }
}


/* ===== v20260904j：两行式输入栏（上：输入框+发送，下：功能图标） + 按住说话 + 登录页备案号流式 ===== */
.wx-login { flex-direction: column; justify-content: center; overflow-y: auto; }
.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; }
.wx-input-bar { display: block; padding: 0.45rem 0.6rem 0.25rem; }
.wx-input-row { display: flex; align-items: center; gap: 0.5rem; }
.wx-input-row textarea {
    flex: 1; border: 1px solid #e0e0e0; border-radius: 8px; padding: 0.55rem 0.7rem;
    font-size: 0.95rem; resize: none; max-height: 100px; outline: none;
    font-family: inherit; background: #fff; min-width: 0;
}
.wx-send { flex-shrink: 0; border-radius: 8px; padding: 0.55rem 1.1rem; font-size: 0.95rem; }
.wx-toolbar { display: flex; justify-content: space-around; padding: 0.3rem 0.5rem 0.15rem; }
.wx-input-icon {
    background: none; border: none; font-size: 1.45rem; cursor: pointer;
    padding: 0.25rem 0.7rem; color: #333;
    -webkit-user-select: none; user-select: none; touch-action: none;
}
.wx-input-icon.recording { color: #e74c3c; transform: scale(1.15); }

@media (max-width: 480px) {
    .wx-input-bar { padding: 0.4rem 0.45rem 0.2rem; }
    .wx-input-row textarea { font-size: 1rem; padding: 0.5rem 0.6rem; }
    .wx-send { padding: 0.5rem 0.85rem; }
    .wx-input-icon { font-size: 1.35rem; padding: 0.2rem 0.6rem; }
    .wx-toolbar { padding: 0.25rem 0.2rem 0.1rem; }
}

/* ===== 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: #12B7F5; }
.wx-msg.self .voice-wave i { background: #0e9dd4; }
.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; 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; }
}

/* ===== v20260905：微信风格输入栏（语音切换+加号面板） ===== */
.wx-input-bar { background: #f7f7f7; border-top: 1px solid #d8d8d8; padding: 0.5rem 0.6rem; display: block; }
.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: #12B7F5; 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; }
.wx-hold-talk:active, .wx-hold-talk.recording { background: #0e9dd4; }
.wx-send { background: #12B7F5; color: #fff; border: none; border-radius: 6px; padding: 0.5rem 1rem; font-size: 0.9rem; cursor: pointer; flex-shrink: 0; }
.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; }
@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; } }

/* ===== 五子棋邀请/接受消息卡片 ===== */
.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); width: 100%; }
.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; display: block; }

/* ===== 房间弹窗 ===== */
.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); }

.tpl-icp { margin-top: 1.2rem; font-size: 12px; color: #999; text-align: center; padding: 0 12px; }
.tpl-icp a { color: #999; text-decoration: none; }


/* ===== 首页 ===== */
.room-screen {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    z-index: 100; overflow-y: auto; padding: 20px; box-sizing: border-box;
}
.room-card {
    width: 100%; max-width: 400px;
    display: flex; flex-direction: column; align-items: center;

    background: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(18,183,245,0.15);
}
.room-icon {
    font-size: 3rem; margin-bottom: 12px;
}
.room-title {
    font-size: 1.5rem; font-weight: 700; color: #333; margin: 0 0 6px 0;
}
.room-desc {
    font-size: 0.9rem; color: #999; margin: 0 0 8px 0;
}

/* 免责声明样式 */
.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: #4080ff; color: #fff; border: none; border-radius: 10px; font-size: 1rem; cursor: pointer; transition: background 0.15s, transform 0.1s; }
.core-alert-btn:hover { background: #3570e0; }
.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: #4080ff; color: #fff; border-radius: 8px; cursor: pointer; font-size: 0.85rem; transition: background 0.15s, transform 0.1s; }
.online-panel-close-btn:hover { background: #3570e0; }
.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: #4080ff; 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: #4080ff; color: #fff; }
.pwd-btn-ok:hover { background: #3570e0; }
.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: #4080ff; outline: none; }
