/* ============================================================
   对局页样式（room.html）
   等待遮罩 / 右上角齿轮 / 设置面板 / 棋盘容器 / 状态栏
   ============================================================ */

/* ---- 等待遮罩：全屏半透明黑色 ---- */
.wait-mask {
    position: fixed; inset: 0; z-index: 200;
    background: rgba(0, 0, 0, 0.72);
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    color: #fff; text-align: center; padding: 20px;
}
.wait-mask .wait-title { font-size: clamp(1.2rem, 4vw, 1.6rem); font-weight: 700; letter-spacing: 0.15em; }
.wait-mask .wait-sub { margin-top: 10px; color: rgba(255,255,255,0.75); font-size: 0.92rem; }
.wait-mask .wait-room {
    margin-top: 22px; background: rgba(255,255,255,0.12);
    border: 1px solid rgba(255,255,255,0.25); border-radius: 12px;
    padding: 14px 26px; backdrop-filter: blur(4px);
}
.wait-mask .room-no { font-size: 1.6rem; font-weight: 800; letter-spacing: 0.5em; margin-top: 4px; color: #ffe08a; }
.wait-mask .code-box { margin-top: 14px; font-size: 0.9rem; }
.wait-mask .code-value { font-size: 1.3rem; font-weight: 700; letter-spacing: 0.3em; color: #7ee0a3; }
.wait-mask .code-tip { font-size: 0.75rem; color: rgba(255,255,255,0.55); margin-top: 4px; }
.wait-mask .spinner { margin-bottom: 16px; color: #ffe08a; animation: spin 1.1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- 对局页主体 ---- */
.room-body { position: relative; z-index: 1; min-height: 100vh; display: flex; flex-direction: column; }
.room-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 18px; background: rgba(255,255,255,0.85);
    box-shadow: 0 2px 10px rgba(0,0,0,0.06); backdrop-filter: blur(6px);
}
.room-header .rh-left { display: flex; align-items: center; gap: 14px; }
.room-header .rh-game { font-weight: 700; color: var(--primary-dark); font-size: 1rem; }
.room-header .rh-room { font-size: 0.8rem; color: var(--gray); }
.room-header .rh-room b { letter-spacing: 0.2em; color: var(--text); }

/* 右上角齿轮设置按钮 */
.gear-btn {
    width: 44px; height: 44px; border: none; border-radius: 50%;
    background: transparent; color: var(--primary-dark); cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: transform 0.5s cubic-bezier(0.34,1.56,0.64,1), background 0.2s;
}
.gear-btn:hover { background: rgba(70,130,180,0.1); transform: rotate(60deg); }

/* ---- 状态栏 ---- */
.status-bar {
    display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px;
    padding: 10px 18px; font-size: 0.88rem; color: var(--text);
}
.status-bar .turn-info { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.turn-info.highlight { color: var(--success); }
.turn-dot { width: 14px; height: 14px; border-radius: 50%; display: inline-block; }
.turn-dot.me { background: var(--success); }
.turn-dot.op { background: var(--danger); }
.timer { display: flex; align-items: center; gap: 6px; color: var(--primary-dark); font-weight: 700; }
.timer.danger { color: var(--danger); animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: 0.4; } }

/* ---- 棋盘容器 ---- */
.board-wrap {
    flex: 1; display: flex; align-items: center; justify-content: center;
    padding: 12px 16px 24px;
}
.board-box {
    background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
    padding: 18px; max-width: 100%; overflow: auto;
}
.board-box svg.board-svg { display: block; max-width: 100%; height: auto; cursor: pointer; }

/* 棋盘坐标/提示 */
.board-hint { text-align: center; font-size: 0.82rem; color: var(--gray); padding: 6px 0 0; }

/* ---- 结果横幅 ---- */
.result-banner {
    position: fixed; inset: 0; z-index: 150;
    background: rgba(0,0,0,0.6);
    display: flex; align-items: center; justify-content: center;
}
.result-card {
    background: #fff; border-radius: 16px; padding: 30px 42px; text-align: center;
    box-shadow: 0 20px 60px rgba(0,0,0,0.35); max-width: 90vw;
}
.result-card .r-icon { width: 64px; height: 64px; margin: 0 auto 12px; }
.result-card .r-title { font-size: 1.4rem; font-weight: 800; margin-bottom: 6px; }
.result-card .r-sub { color: var(--gray); font-size: 0.9rem; margin-bottom: 18px; }
.result-card .r-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* ---- 设置面板（齿轮弹出） ---- */
.settings-overlay {
    position: fixed; inset: 0; z-index: 300;
    background: rgba(0,0,0,0.35);
    display: flex; align-items: flex-start; justify-content: flex-end;
}
.settings-panel {
    width: min(360px, 92vw); background: #fff;
    height: 100%; overflow-y: auto;
    box-shadow: -8px 0 30px rgba(0,0,0,0.2);
    animation: slideIn 0.28s cubic-bezier(0.22,1,0.36,1);
}
@keyframes slideIn { from { transform: translateX(60px); opacity: 0; } to { transform: none; opacity: 1; } }
.sp-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 18px; border-bottom: 1px solid #e8eef5;
}
.sp-header h3 { font-size: 1rem; color: var(--primary-dark); display: flex; align-items: center; gap: 8px; }
.sp-close {
    width: 34px; height: 34px; border: none; border-radius: 50%;
    background: transparent; color: var(--gray); cursor: pointer;
    display: flex; align-items: center; justify-content: center;
}
.sp-close:hover { background: #f0f4f8; color: var(--text); }
.sp-body { padding: 16px 18px; }

/* 设置项：开关行 */
.setting-row {
    display: flex; align-items: center; justify-content: space-between;
    padding: 13px 0; border-bottom: 1px solid #f0f4f8;
}
.setting-row .s-label { font-size: 0.92rem; }
.setting-row .s-desc { font-size: 0.76rem; color: var(--gray); margin-top: 2px; }

/* 开关样式 */
.switch { position: relative; width: 46px; height: 26px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider {
    position: absolute; inset: 0; border-radius: 999px;
    background: #cfd8e3; transition: background 0.25s; cursor: pointer;
}
.switch .slider::before {
    content: ''; position: absolute; width: 20px; height: 20px;
    left: 3px; top: 3px; border-radius: 50%; background: #fff;
    transition: transform 0.25s; box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}
.switch input:checked + .slider { background: var(--success); }
.switch input:checked + .slider::before { transform: translateX(20px); }

/* 限时选择 */
.time-limit-row { padding: 14px 0; border-bottom: 1px solid #f0f4f8; }
.time-limit-row .tl-label { font-size: 0.92rem; margin-bottom: 8px; display: flex; align-items: center; gap: 6px; }
.time-presets { display: flex; gap: 8px; flex-wrap: wrap; }
.time-presets button {
    padding: 6px 14px; border-radius: 999px; border: 1.5px solid #c5d8e8;
    background: #fff; color: var(--primary-dark); font-size: 0.82rem; cursor: pointer; font-weight: 600;
}
.time-presets button.active { background: var(--primary-dark); color: #fff; border-color: var(--primary-dark); }

/* 实时进度 */
.progress-block { padding: 14px 0; border-bottom: 1px solid #f0f4f8; }
.progress-block .p-label { font-size: 0.92rem; margin-bottom: 8px; display: flex; align-items: center; gap: 6px; }
.progress-bar { height: 10px; background: #e8eef5; border-radius: 999px; overflow: hidden; }
.progress-bar .p-fill {
    height: 100%; width: 0%; background: linear-gradient(90deg, var(--primary), var(--primary-dark));
    border-radius: 999px; transition: width 0.4s;
}
.progress-block .p-meta { display: flex; justify-content: space-between; font-size: 0.76rem; color: var(--gray); margin-top: 5px; }
.progress-block .p-time { font-size: 1rem; font-weight: 800; color: var(--primary-dark); }
.progress-block .p-time.danger { color: var(--danger); }

/* 面板内按钮区 */
.sp-actions { padding: 16px 0; display: flex; flex-direction: column; gap: 10px; }
.sp-actions .btn { width: 100%; }

/* 设置面板下拉框 */
.select-box {
    padding: 7px 10px; border: 1.5px solid #c5d8e8; border-radius: 8px;
    background: #fff; color: var(--primary-dark); font-size: 0.85rem; font-weight: 600;
    cursor: pointer; outline: none; max-width: 140px;
}
.select-box:disabled { opacity: 0.55; cursor: not-allowed; }

/* 设置项徽标（对局人数等） */
.s-badge {
    font-size: 0.8rem; font-weight: 800; color: var(--primary-dark);
    background: rgba(135,206,235,0.18); padding: 3px 10px; border-radius: 999px;
    white-space: nowrap;
}

/* 对局页公共房间列表浮层 */
.pub-overlay {
    position: fixed; inset: 0; z-index: 340;
    background: rgba(0,0,0,0.45);
    display: flex; align-items: center; justify-content: center; padding: 16px;
}
.pub-card {
    width: min(640px, 94vw); max-height: 82vh;
    background: #fff; border-radius: 14px; overflow: hidden;
    box-shadow: 0 18px 60px rgba(0,0,0,0.35);
    display: flex; flex-direction: column;
    animation: popIn 0.25s cubic-bezier(0.34,1.56,0.64,1);
}
@keyframes popIn { from { transform: scale(0.92); opacity: 0; } to { transform: none; opacity: 1; } }
.pub-card-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 18px; border-bottom: 1px solid #e8eef5;
}
.pub-card-head b { color: var(--primary-dark); font-size: 1rem; }
.pub-card-body { padding: 14px 18px; overflow-y: auto; }

/* 等待界面队伍选择 */
.team-pick { margin-top: 14px; }
.team-opt {
    padding: 9px 22px; border-radius: 10px; border: 1.5px solid rgba(255,255,255,0.4);
    background: rgba(255,255,255,0.12); color: #fff; font-size: 0.95rem; font-weight: 700;
    cursor: pointer; transition: all 0.2s; min-width: 90px;
}
.team-opt:hover { background: rgba(255,255,255,0.22); }
.team-opt.active { background: #ffe08a; color: #5a3d00; border-color: #ffe08a; }
.team-opt.mine { border-color: #ffe08a; }
.team-opt:disabled { opacity: 0.5; cursor: not-allowed; }

/* 等待界面 AI 陪练 */
.ai-pick { margin-top: 18px; padding-top: 14px; border-top: 1px dashed rgba(255,255,255,0.25); }
.ai-diff-row { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; margin-bottom: 6px; }
.ai-opt {
    padding: 6px 10px; border-radius: 8px; border: 1.5px solid rgba(255,255,255,0.4);
    background: rgba(255,255,255,0.12); color: #fff; font-size: 0.8rem; font-weight: 700;
    cursor: pointer; transition: all 0.2s; min-width: 34px;
}
.ai-opt:hover { background: rgba(255,255,255,0.22); }
.ai-opt.active { background: #ffe08a; color: #5a3d00; border-color: #ffe08a; }

/* 房间成员列表 */
.member-list { margin-top: 8px; display: flex; flex-direction: column; gap: 8px; }
.member-item {
    border: 1px solid #e3ecf5; border-radius: 10px; padding: 8px 12px;
    background: #fbfdff; font-size: 0.8rem;
}
.m-head { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.m-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.m-dot.online { background: var(--success); box-shadow: 0 0 0 3px rgba(76,175,80,0.18); }
.m-dot.offline { background: #b9c2cc; }
.m-name { font-weight: 700; }
.m-role {
    font-size: 0.7rem; color: var(--gray); background: #eef3f8;
    padding: 1px 7px; border-radius: 999px;
}
.m-role.m-player { color: var(--primary-dark); background: rgba(135,206,235,0.18); }
.m-me { font-size: 0.68rem; color: #fff; background: var(--danger); padding: 1px 6px; border-radius: 999px; }
.m-status { font-size: 0.7rem; font-weight: 600; margin-left: auto; }
.m-status.online { color: var(--success); }
.m-status.offline { color: var(--danger); }
.m-meta { margin-top: 5px; color: var(--gray); font-size: 0.74rem; word-break: break-all; }
.m-meta b { color: var(--text); font-weight: 600; }

/* ---- 请求弹窗（悔棋/和约） ---- */
.req-modal {
    position: fixed; inset: 0; z-index: 260;
    background: rgba(0,0,0,0.45);
    display: flex; align-items: center; justify-content: center;
}
.req-card {
    background: #fff; border-radius: 14px; padding: 24px 30px; text-align: center;
    box-shadow: 0 16px 50px rgba(0,0,0,0.3); max-width: 86vw;
}
.req-card .q-title { font-size: 1.05rem; font-weight: 700; margin-bottom: 8px; }
.req-card .q-sub { color: var(--gray); font-size: 0.85rem; margin-bottom: 16px; }
.req-card .q-actions { display: flex; gap: 12px; justify-content: center; }

/* ---- 响应式 ---- */
@media (max-width: 560px) {
    .board-box { padding: 10px; }
    .status-bar { font-size: 0.8rem; padding: 8px 12px; }
    .room-header { padding: 10px 12px; }
}
