/* public/assets/css/social_office/scrum-poker.css */
:root {
    --primary: #6366f1; --secondary: #a855f7; --success: #10b981; --warning: #f59e0b; --danger: #ef4444;
    --bg: #ffffff; --card: #f8fafc; --text-main: #0f172a; --text-sub: #64748b;
    --border: #e2e8f0; --shadow: 0 10px 25px -5px rgba(0,0,0,0.05);
}

.chat-wrapper { 
    width: 100%; max-width: 1100px; margin: 0 auto;
    background: var(--bg); border-radius: 20px; overflow: hidden; 
    border: 1px solid var(--border); box-shadow: var(--shadow);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; color: var(--text-main);
    display: flex; flex-direction: column;
}
.chat-wrapper *, .chat-wrapper *::before, .chat-wrapper *::after { box-sizing: border-box; }

.chat-header { padding: 24px; text-align: center; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.chat-title { margin: 0 0 10px 0; font-size: 1.7rem; font-weight: 800; color: var(--text-main); }
.chat-subtitle { margin: 0 auto; max-width: 800px; font-size: 0.95rem; color: var(--text-sub); line-height: 1.6; }
.chat-workspace { padding: 24px; flex: 1; display: flex; flex-direction: column; min-height: 0; }

.chat-layout { display: flex; gap: 24px; align-items: stretch; height: 65vh; min-height: 550px; max-height: 800px; flex: 1; transition: 0.3s; }

/* 左侧面板 */
.chat-sys-panel { width: 340px; flex-shrink: 0; background: #0f172a; border-radius: 16px; border: 2px solid #1e293b; padding: 24px; display: flex; flex-direction: column; gap: 16px; box-shadow: inset 0 5px 20px rgba(0,0,0,0.5); overflow-y: auto; transition: 0.3s; }
.chat-sys-panel::-webkit-scrollbar { width: 4px; }
.chat-sys-panel::-webkit-scrollbar-thumb { background: #334155; border-radius: 4px; }
.chat-panel-title { font-size: 1.05rem; font-weight: 800; color: #cbd5e1; text-transform: uppercase; letter-spacing: 0.5px; border-bottom: 2px solid #334155; padding-bottom: 12px; font-family: monospace; margin-bottom: 0; }
.id-display-card { background: #1e293b; border-radius: 12px; padding: 20px; text-align: center; border: 1px solid #334155; }
.id-label { font-size: 12px; color: #94a3b8; letter-spacing: 1px; margin-bottom: 12px; font-weight: bold; }
.id-number { font-size: 42px; font-weight: 900; color: var(--primary); font-family: 'Consolas', monospace; letter-spacing: 8px; text-shadow: 0 2px 10px rgba(99, 102, 241, 0.3); line-height: 1;}
.pc-qr-box { display: flex; justify-content: center; background: white; padding: 10px; border-radius: 12px; margin: 0 auto 15px; width: fit-content; min-height: 130px; align-items: center; }
.mobile-qr-btn { display: none !important; }
.id-actions { display: flex; gap: 10px; margin-top: 15px; }
.id-actions .btn { flex: 1; border-radius: 8px; }

/* 拨号输入改造 */
.dial-card { background: #1e293b; border-radius: 12px; padding: 20px; border: 1px solid #334155; }
.qr-label { font-size: 13px; color: #cbd5e1; margin-bottom: 15px; font-weight: 600; text-align: center;}
.input-group { position: relative; width: 100%; display: flex; align-items: center; }
.input-group i { position: absolute; left: 15px; color: #64748b; font-size: 16px; }
.clean-input { width: 100%; padding: 14px 14px 14px 45px; border-radius: 8px; border: 2px solid #334155; font-size: 16px; font-weight: 700; color: #f8fafc; background: #0f172a; outline: none; transition: 0.2s; }
.clean-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15); }
.btn-connect-action { width: 100%; margin-top: 20px; font-size: 16px; padding: 14px; border-radius: 8px; }

.connection-status-card { display: flex; align-items: center; gap: 10px; background: #1e293b; border-radius: 8px; padding: 12px 16px; border: 1px solid #334155; font-size: 13px; color: #cbd5e1; font-weight: 600; margin-top: auto; flex-wrap: wrap; }
.status-dot { width: 10px; height: 10px; border-radius: 50%; background: #64748b; flex-shrink: 0; }
.status-dot.active { background: var(--success); box-shadow: 0 0 8px var(--success); animation: pulse 2s infinite; }

/* 扑克工作区容器 */
.chat-msg-panel { flex: 1; border-radius: 16px; border: 1px solid #334155; display: flex; flex-direction: column; min-width: 0; overflow: hidden; position: relative; background: #0f172a; color: #f8fafc; }
.poker-view { width: 100%; height: 100%; display: flex; flex-direction: column; }

/* =========================================================
   模式 1: Host 大屏桌台
   ========================================================= */
.table-header { padding: 15px 24px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid #1e293b; background: rgba(0,0,0,0.2); }
.table-title { font-size: 18px; font-weight: 800; display: flex; align-items: center; gap: 10px; color: #e2e8f0; }
.table-title .badge { background: var(--primary); color: white; padding: 4px 10px; border-radius: 12px; font-size: 14px; }
.table-actions { display: flex; gap: 15px; }

.table-surface { flex: 1; position: relative; padding: 40px; background: radial-gradient(circle at center, #1e293b 0%, #0f172a 100%); display: flex; flex-direction: column; align-items: center; overflow-y: auto; }
.table-placeholder { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); text-align: center; }

/* 玩家网格 */
.players-grid { width: 100%; max-width: 1000px; display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 30px; justify-items: center; align-items: center; z-index: 10; padding-bottom: 100px; }

/* 玩家扑克卡片组件 (带 3D 翻转效果) */
.player-slot { display: flex; flex-direction: column; align-items: center; gap: 12px; width: 120px; }
.player-name { font-size: 15px; font-weight: 700; color: #cbd5e1; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-shadow: 0 2px 4px rgba(0,0,0,0.5); }
.player-name .status-dot { display: inline-block; width: 8px; height: 8px; margin-right: 5px; }
.player-name .status-dot.voted { background: var(--success); box-shadow: 0 0 5px var(--success); }

/* 扑克 3D 容器 */
.card-3d-wrapper { perspective: 1000px; width: 100px; height: 140px; }
.poker-card { width: 100%; height: 100%; position: relative; transition: transform 0.6s cubic-bezier(0.4, 0.2, 0.2, 1); transform-style: preserve-3d; }
.card-3d-wrapper.revealed .poker-card { transform: rotateY(180deg); }
.card-3d-wrapper.voted .card-back { border-color: var(--success); box-shadow: 0 0 20px rgba(16, 185, 129, 0.3); }

/* 扑克正反面 */
.card-face { position: absolute; width: 100%; height: 100%; -webkit-backface-visibility: hidden; backface-visibility: hidden; border-radius: 12px; display: flex; align-items: center; justify-content: center; box-shadow: 0 10px 20px rgba(0,0,0,0.5); border: 2px solid; }
.card-back { background: repeating-linear-gradient(45deg, #1e293b, #1e293b 10px, #334155 10px, #334155 20px); border-color: #475569; color: #94a3b8; font-size: 32px; }
.card-front { background: #ffffff; border-color: #e2e8f0; color: var(--primary); font-size: 42px; font-weight: 900; font-family: 'Consolas', monospace; transform: rotateY(180deg); }
.card-front.special { color: var(--warning); } /* ? 或 咖啡图标 */

/* 中央统计结果 */
.result-center { position: absolute; bottom: 30px; left: 50%; transform: translateX(-50%); background: rgba(15, 23, 42, 0.9); border: 1px solid var(--primary); padding: 15px 40px; border-radius: 20px; text-align: center; box-shadow: 0 0 30px rgba(99, 102, 241, 0.4); backdrop-filter: blur(8px); z-index: 20; animation: floatUp 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275); }
@keyframes floatUp { from { opacity: 0; transform: translate(-50%, 50px); } to { opacity: 1; transform: translate(-50%, 0); } }
.result-label { color: #94a3b8; font-size: 14px; font-weight: 700; letter-spacing: 2px; margin-bottom: 5px; }
.result-value { color: #f8fafc; font-size: 48px; font-weight: 900; font-family: 'Consolas', monospace; text-shadow: 0 0 15px var(--primary); }

/* =========================================================
   模式 2: Remote 手机手牌区
   ========================================================= */
.remote-hand { background: #0f172a; position: relative; }
.hand-header { padding: 12px 20px; background: #1e293b; border-bottom: 1px solid #334155; display: flex; justify-content: space-between; align-items: center; flex-shrink: 0;}
.hand-status { color: #f8fafc; font-weight: 600; font-size: 14px; display: flex; align-items: center; gap: 8px;}

.hand-body { padding: 20px; display: flex; flex-direction: column; gap: 20px; flex: 1; overflow-y: auto; }
.hand-instruction { color: #94a3b8; font-size: 15px; font-weight: 600; text-align: center; margin-bottom: 10px; }

/* 供选择的手牌网格 */
.cards-deck { display: grid; grid-template-columns: repeat(3, 1fr); gap: 15px; }
.deck-card-btn { 
    background: #1e293b; border: 2px solid #334155; border-radius: 12px; height: 100px;
    display: flex; align-items: center; justify-content: center;
    color: #f8fafc; font-size: 32px; font-weight: 800; font-family: 'Consolas', monospace;
    cursor: pointer; transition: 0.15s; box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    /* 防误触 */
    -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; touch-action: manipulation;
}
.deck-card-btn:active { transform: scale(0.95); }
.deck-card-btn.selected { background: var(--primary); border-color: #818cf8; box-shadow: 0 10px 25px rgba(99, 102, 241, 0.5); transform: translateY(-5px); }

/* 开牌后的全局锁定遮罩 */
.hand-locked-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: rgba(15,23,42,0.9); z-index: 50; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 30px; backdrop-filter: blur(8px); }
.locked-icon { font-size: 60px; color: var(--success); margin-bottom: 20px; text-shadow: 0 0 20px rgba(16,185,129,0.5); }
.locked-title { font-size: 24px; font-weight: 800; color: #f8fafc; margin-bottom: 10px; }
.locked-desc { color: #94a3b8; font-size: 15px; line-height: 1.5; }

/* Bento Grid 与 弹窗 */
.chat-features-bento { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; padding: 0 24px 24px 24px; }
.bento-card { background: var(--card); border: 1px solid var(--border); border-radius: 16px; padding: 24px; transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s; display: flex; flex-direction: column; gap: 10px; }
.bento-card:hover { transform: translateY(-4px); box-shadow: 0 12px 30px -10px rgba(0,0,0,0.08); border-color: var(--primary); }
.bento-header { display: flex; align-items: center; gap: 12px; }
.bento-icon { width: 36px; height: 36px; background: rgba(99, 102, 241, 0.1); color: var(--primary); border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 16px; flex-shrink: 0; }
.bento-card h3 { margin: 0; font-size: 1.05rem; font-weight: 800; color: var(--text-main); line-height: 1.2; }
.bento-card p { margin: 0; font-size: 0.85rem; color: var(--text-sub); line-height: 1.6; }

.overlay { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background: rgba(0,0,0,0.8); z-index: 99999; display: none; align-items: center; justify-content: center; backdrop-filter: blur(8px); }
.modal-box { background: var(--card); padding: 30px; border-radius: 24px; text-align: center; width: 85%; max-width: 340px; box-shadow: 0 20px 40px rgba(0,0,0,0.5); border: 1px solid var(--border); }
.btn { border: none; padding: 10px 16px; border-radius: 8px; font-weight: 800; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; transition: 0.2s; font-size: 14px; color: white; }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-primary { background: var(--primary); }
.btn-primary:hover { filter: brightness(1.1); }
.btn-secondary { background: #e2e8f0; color: #0f172a; }
.btn-secondary:hover { background: #cbd5e1; }
.btn-success { background: var(--success); }
.btn-success:hover { filter: brightness(1.1); }
.btn-danger { background: var(--danger); }
.btn-danger:hover { filter: brightness(1.1); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; filter: grayscale(100%); }

#toast-container { position: fixed; top: 20px; left: 50%; transform: translateX(-50%); z-index: 100000; pointer-events: none; }
.toast { background: rgba(0,0,0,0.85); color: white; padding: 10px 24px; border-radius: 25px; font-size: 13px; margin-bottom: 10px; box-shadow: var(--shadow); }

/* 移动端全屏响应式霸占 */
@media (max-width: 850px) { 
    .desktop-only { display: none !important; }
    .pc-qr-box { display: none !important; }
    .mobile-qr-btn { display: inline-flex !important; } 

    .chat-wrapper { height: auto; min-height: calc(100vh - 80px); display: flex; flex-direction: column; }
    .chat-header { padding: 16px 12px; flex-shrink: 0; }
    .chat-title { font-size: 1.4rem; }
    .chat-workspace { padding: 10px; display: flex; flex-direction: column; flex: 1; }
    .chat-layout { flex-direction: column; height: 100%; min-height: 600px; gap: 10px; display: flex; } 
    
    .chat-sys-panel { width: 100%; padding: 12px; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; overflow: hidden; border-radius: 12px; flex-shrink: 0; }
    .chat-panel-title { display: none; }
    
    .id-display-card, .dial-card { padding: 10px; margin: 0; display: flex; flex-direction: column; justify-content: center; }
    .id-label, .qr-label { font-size: 10px; margin-bottom: 4px; }
    .id-number { font-size: 22px; letter-spacing: 2px; }
    .id-actions { margin-top: 8px; gap: 6px; }
    .id-actions .btn { font-size: 12px; padding: 6px; }
    .id-actions .btn span, .btn-connect-action span { display: none; }
    .input-group { margin-bottom: 10px; }
    .clean-input { font-size: 14px; padding: 10px 10px 10px 35px;}
    .input-group i { left: 12px; font-size: 14px;}
    .btn-connect-action { font-size: 13px; padding: 8px; margin-top: 5px; }
    .connection-status-card { grid-column: 1 / 3; margin-top: 0; padding: 8px 12px; }
    
    .chat-msg-panel { padding: 0; flex: 1; display: flex; flex-direction: column; border-radius: 12px; border: none;}
    
    /* 手机端彻底霸占全屏作为遥控手牌区 */
    .chat-wrapper.is-remote { 
        position: fixed !important; top: 0; left: 0; right: 0; bottom: 0;
        width: 100vw; height: 100vh; z-index: 99999;
        border-radius: 0; border: none; margin: 0; background: #0f172a;
    }
    .chat-wrapper.is-remote .chat-header { display: none; }
    .chat-wrapper.is-remote .chat-features-bento { display: none; }
    .chat-wrapper.is-remote .chat-sys-panel { display: none !important; }
    .chat-wrapper.is-remote .chat-workspace { padding: 0; height: 100%; display: flex; flex-direction: column;}
    .chat-wrapper.is-remote .chat-layout { height: 100%; min-height: 100%; gap: 0; flex: 1; }
    .chat-wrapper.is-remote .chat-msg-panel { height: 100%; border-radius: 0; flex: 1; }
    .chat-wrapper.is-remote .remote-hand { padding-bottom: max(10px, env(safe-area-inset-bottom)); }

    /* 手机上手牌变两列，点击区域大一点 */
    .cards-deck { grid-template-columns: repeat(2, 1fr); gap: 12px; }

    .chat-features-bento { grid-template-columns: 1fr; padding: 0 10px 20px 10px; gap: 12px; }
    .bento-card { padding: 16px; gap: 8px; border-radius: 12px; }
}

[data-theme="dark"]:root { --bg: #1e293b; --card: #0f172a; --text-main: #f8fafc; --text-sub: #94a3b8; --border: #334155; }
[data-theme="dark"] .chat-msg-panel { border-color: #334155; }
[data-theme="dark"] .btn-secondary { background: #334155; color: #f8fafc; border: 1px solid #475569; }
[data-theme="dark"] .btn-secondary:hover { background: #475569; }
[data-theme="dark"] .bento-card { background: #0f172a; border-color: #334155; }
[data-theme="dark"] .bento-card:hover { border-color: var(--primary); }