/* ============================================================
   game3d.css — AI狼人杀 5.0 3D模式样式
   ============================================================ */

/* ---- 首页风格选择器 ---- */
.view-style-selector {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    justify-content: center;
}

.view-style-btn {
    padding: 12px 20px;
    border-radius: 12px;
    border: 2px solid rgba(108, 92, 231, 0.35);
    background: rgba(45, 27, 78, 0.7);
    color: #fff;
    cursor: pointer;
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    transition: all 0.25s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    min-width: 110px;
    user-select: none;
}

.view-style-btn:hover {
    border-color: rgba(108, 92, 231, 0.7);
    background: rgba(108, 92, 231, 0.2);
    transform: translateY(-2px);
}

.view-style-btn.active {
    border-color: #6c5ce7;
    background: rgba(108, 92, 231, 0.3);
    box-shadow: 0 0 18px rgba(108, 92, 231, 0.45), inset 0 0 12px rgba(108, 92, 231, 0.15);
}

.view-style-btn .style-icon { font-size: 26px; }
.view-style-btn .style-name { font-weight: 700; font-size: 13px; letter-spacing: 0.5px; }
.view-style-btn .style-desc { font-size: 10px; color: var(--text-muted); }

/* ---- 3D Canvas ---- */
#canvas3d {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 1;
    cursor: crosshair;
}

body.mode-3d #canvas3d { display: block; }

/* ---- Nameplate Layer ---- */
#nameplate-layer {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    pointer-events: none;
    z-index: 20;
}

body.mode-3d #nameplate-layer { display: block; }

.nameplate-3d {
    position: absolute;
    transform: translate(-50%, -100%);
    margin-top: -8px;
    background: rgba(10, 5, 25, 0.88);
    border: 1px solid rgba(108, 92, 231, 0.5);
    border-radius: 8px;
    padding: 4px 10px 5px;
    font-size: 12px;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
    pointer-events: none;
    text-shadow: 0 1px 4px rgba(0,0,0,0.9);
    backdrop-filter: blur(6px);
    transition: opacity 0.4s ease, border-color 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
    line-height: 1.3;
}

.nameplate-3d .np-number {
    color: rgba(255,255,255,0.45);
    font-size: 9px;
    font-weight: 400;
}

.nameplate-3d .np-name {
    font-size: 12px;
    font-weight: 700;
}

.nameplate-3d .np-role {
    font-size: 10px;
    color: rgba(255, 215, 80, 0.85);
    font-weight: 400;
}

.nameplate-3d.dead {
    opacity: 0.35;
    border-color: rgba(255,255,255,0.1);
    background: rgba(10,10,10,0.7);
}

.nameplate-3d.speaking {
    border-color: #00cec9;
    background: rgba(0, 80, 80, 0.88);
    box-shadow: 0 0 12px rgba(0, 206, 201, 0.5);
}

/* ---- 3D Speech Bubble ---- */
.speech-bubble-3d {
    position: absolute;
    transform: translate(-50%, calc(-100% - 55px));
    max-width: 240px;
    min-width: 120px;
    background: rgba(10, 5, 25, 0.94);
    border: 1px solid rgba(0, 206, 201, 0.55);
    border-radius: 14px;
    padding: 10px 14px;
    font-size: 13px;
    color: #fff;
    pointer-events: none;
    z-index: 30;
    backdrop-filter: blur(10px);
    box-shadow: 0 6px 24px rgba(0, 206, 201, 0.2);
    animation: bubble3dIn 0.2s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes bubble3dIn {
    from { opacity: 0; transform: translate(-50%, calc(-100% - 45px)) scale(0.88); }
    to   { opacity: 1; transform: translate(-50%, calc(-100% - 55px)) scale(1); }
}

.speech-bubble-3d::after {
    content: '';
    position: absolute;
    bottom: -9px; left: 50%;
    transform: translateX(-50%);
    width: 0; height: 0;
    border: 9px solid transparent;
    border-bottom: none;
    border-top-color: rgba(0, 206, 201, 0.55);
}

.speech-bubble-3d .sb-name {
    font-size: 11px;
    color: #00cec9;
    margin-bottom: 5px;
    font-weight: 700;
    letter-spacing: 0.3px;
}

.speech-bubble-3d .sb-text {
    line-height: 1.55;
    color: rgba(255,255,255,0.92);
    word-break: break-word;
}

.speech-bubble-3d.thinking-3d .sb-text {
    color: rgba(255,255,255,0.55);
    font-style: italic;
}

.speech-bubble-3d .sb-auto {
    font-size: 10px;
    color: rgba(255,200,100,0.7);
    margin-top: 5px;
}

/* ---- body.mode-3d 全局布局覆盖 ---- */
body.mode-3d .stars { display: none; }

body.mode-3d header {
    position: fixed;
    z-index: 200;
    background: rgba(10, 5, 25, 0.78);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid rgba(108, 92, 231, 0.22);
}

/* 隐藏2D arena区域 */
body.mode-3d .arena-column {
    display: none !important;
}

body.mode-3d .death-list { display: none !important; }
body.mode-3d .mobile-death-btn { display: none !important; }

/* game-container 不再作为 3D 模式的侧边栏容器，改为透传 */
body.mode-3d .game-container {
    position: static;
    width: auto;
    height: auto;
    background: transparent !important;
    backdrop-filter: none !important;
    border-left: none !important;
    pointer-events: none;
}

/* 3D 模式下的日志面板使用 main.css 的浮动样式，这里仅微调层级 */
body.mode-3d .chronicles {
    z-index: 1000;
    pointer-events: auto;
}

body.mode-3d .chronicles-toggle {
    z-index: 1001;
    pointer-events: auto !important;
    cursor: pointer !important;
}

body.mode-3d .chronicles-header {
    /* 如果需要，可以在这里针对3D顶部做微调 */
}

/* 浮动操作面板 */
body.mode-3d #actionPanel {
    position: fixed !important;
    bottom: 0; left: 0;
    right: 0; /* 取消右侧偏移，恢复全宽 */
    z-index: 200;
    background: rgba(10, 5, 25, 0.88) !important;
    backdrop-filter: blur(14px);
    border-top: 1px solid rgba(108, 92, 231, 0.28);
    border-radius: 0 !important;
    padding: 12px 16px;
}

/* 3D模式统计悬浮卡片 (左下角) */
.stats-overlay-3d {
    display: none;
    position: fixed;
    bottom: 16px; left: 16px;
    z-index: 150;
    background: rgba(10, 5, 25, 0.82);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(108, 92, 231, 0.3);
    border-radius: 12px;
    padding: 10px 14px;
    font-size: 12px;
    color: var(--text-muted);
    min-width: 130px;
    pointer-events: none;
}

body.mode-3d .stats-overlay-3d { display: block; }

body.mode-3d #actionPanel ~ .stats-overlay-3d,
body.mode-3d .stats-overlay-3d {
    bottom: 80px; /* above action panel when shown */
}

.stats-overlay-3d .s3-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 5px;
}

.stats-overlay-3d .s3-row:last-child { margin-bottom: 0; }
.stats-overlay-3d .s3-icon { font-size: 14px; }
.stats-overlay-3d .s3-label { flex: 1; font-size: 11px; color: rgba(255,255,255,0.45); }
.stats-overlay-3d .s3-val { font-size: 18px; font-weight: 700; color: #fff; min-width: 22px; text-align: right; }

/* 模式模态 z-index 确保在3D层上 */
body.mode-3d .modal-overlay { z-index: 500; }
body.mode-3d .countdown-overlay { z-index: 400; }
body.mode-3d #phase-overlay-3d { z-index: 350; }

/* 3D标注：相位公告层级 */
body.mode-3d .phase-announcement {
    z-index: 360;
    text-shadow: 0 0 40px currentColor, 0 0 80px currentColor;
}

/* ---- 3D模式 header 布局修正 ---- */
body.mode-3d header {
    flex-wrap: nowrap;
    gap: 8px;
    padding: 10px 16px;
}

/* 相位label改为相对定位，不再 absolute 居中（避免叠在按钮上） */
body.mode-3d .header-phase {
    position: relative;
    left: auto;
    transform: none;
    flex-shrink: 0;
    font-size: 12px;
    padding: 5px 12px;
}

body.mode-3d .header-actions {
    gap: 6px;
    flex-shrink: 1;
    flex-wrap: nowrap;
    overflow: hidden;
}

body.mode-3d .speed-control {
    gap: 4px;
    margin-right: 4px;
}

body.mode-3d .speed-btn {
    padding: 4px 8px;
    font-size: 11px;
}

body.mode-3d header .btn {
    font-size: 12px;
    padding: 5px 10px;
    white-space: nowrap;
}

body.mode-3d .logo {
    font-size: 18px;
    flex-shrink: 0;
}

body.mode-3d .logo-icon {
    font-size: 22px;
}

/* 让右侧面板滚动条美化 */
body.mode-3d .chronicles-log::-webkit-scrollbar {
    width: 4px;
}
body.mode-3d .chronicles-log::-webkit-scrollbar-track {
    background: transparent;
}
body.mode-3d .chronicles-log::-webkit-scrollbar-thumb {
    background: rgba(108,92,231,0.4);
    border-radius: 2px;
}

/* 3D模式下右侧面板不要遮住action panel */
body.mode-3d #actionPanel:not([style*="display: none"]) ~ .stats-overlay-3d {
    bottom: 80px;
}
