/* ==========================================================================
   WindBlog Relax Games / 摸鱼小游戏中心样式
   ========================================================================== */

/* 1. 左下角悬浮按钮 */
.wb-game-trigger {
    position: fixed;
    bottom: 24px;
    left: 24px;
    z-index: 99990;
    width: 48px;
    height: 48px;
    border-radius: 9999px;
    background: rgb(var(--card-bg-channels, 24 24 27) / 0.88);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgb(var(--border-channels, 255 255 255) / calc(var(--border-alpha, 0.12) * 1.5));
    box-shadow: 0 8px 24px -4px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(var(--accent-channels, 99 102 241), 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    user-select: none;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    outline: none;
    padding: 0;
    color: rgb(var(--accent-channels, 99 102 241));
}

.wb-game-trigger:hover {
    transform: translateY(-2px) scale(1.08);
    box-shadow: 0 12px 30px -4px rgba(0, 0, 0, 0.4), 0 0 20px rgba(var(--accent-channels, 99 102 241), 0.45);
    border-color: rgb(var(--accent-channels, 99 102 241) / 0.6);
}

.wb-game-trigger:active {
    transform: translateY(0) scale(0.96);
}

.wb-game-trigger-icon {
    font-size: 1.25rem;
    line-height: 1;
    transition: transform 0.3s ease;
}

.wb-game-trigger:hover .wb-game-trigger-icon {
    transform: rotate(-8deg) scale(1.1);
}

/* 呼吸微光点 */
.wb-game-trigger-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 10px;
    height: 10px;
    background: #10b981;
    border-radius: 9999px;
    border: 2px solid rgb(var(--card-bg-channels, 24 24 27));
    box-shadow: 0 0 8px #10b981;
}

/* 悬停气泡提示 */
.wb-game-trigger-tooltip {
    position: absolute;
    left: calc(100% + 12px);
    top: 50%;
    transform: translateY(-50%) translateX(-8px);
    background: rgb(var(--card-bg-channels, 24 24 27) / 0.95);
    backdrop-filter: blur(8px);
    border: 1px solid rgb(var(--border-channels, 255 255 255) / 0.15);
    color: rgb(var(--text-main-channels, 244 244 245));
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
    transition: all 0.25s ease;
}

.wb-game-trigger:hover .wb-game-trigger-tooltip {
    opacity: 1;
    transform: translateY(-50%) translateX(0);
}

/* 2. 游戏中心弹窗菜单 (Game Hub Menu) */
.wb-game-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 99995;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.wb-game-modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.wb-game-menu-panel {
    position: fixed;
    bottom: 84px;
    left: 24px;
    z-index: 99996;
    width: 380px;
    max-width: calc(100vw - 48px);
    background: rgb(var(--card-bg-channels, 24 24 27) / 0.94);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgb(var(--border-channels, 255 255 255) / calc(var(--border-alpha, 0.15) * 1.5));
    border-radius: 20px;
    box-shadow: 0 20px 45px -10px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.05);
    padding: 20px;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    transform-origin: bottom left;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.wb-game-menu-panel.active {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

/* 菜单头部 */
.wb-game-menu-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 14px;
    border-bottom: 1px solid rgb(var(--border-channels, 255 255 255) / 0.1);
    margin-bottom: 14px;
}

.wb-game-menu-title-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
}

.wb-game-menu-title-icon {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: rgba(var(--accent-channels, 99 102 241), 0.15);
    color: rgb(var(--accent-channels, 99 102 241));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}

.wb-game-menu-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: rgb(var(--text-main-channels, 244 244 245));
    letter-spacing: -0.01em;
}

.wb-game-menu-subtitle {
    font-size: 0.72rem;
    color: rgb(var(--text-meta-channels, 161 161 170));
    margin-top: 1px;
}

.wb-game-menu-close {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgb(var(--text-meta-channels, 161 161 170));
    background: transparent;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.wb-game-menu-close:hover {
    background: rgb(var(--border-channels, 255 255 255) / 0.1);
    color: rgb(var(--text-main-channels, 244 244 245));
}

/* 游戏卡片列表 */
.wb-game-cards-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 360px;
    overflow-y: auto;
    padding-right: 4px;
}

.wb-game-cards-list::-webkit-scrollbar {
    width: 4px;
}

.wb-game-cards-list::-webkit-scrollbar-thumb {
    background: rgb(var(--border-channels, 255 255 255) / 0.2);
    border-radius: 4px;
}

.wb-game-card {
    position: relative;
    background: rgb(var(--input-bg-channels, 39 39 42) / 0.45);
    border: 1px solid rgb(var(--border-channels, 255 255 255) / 0.08);
    border-radius: 14px;
    padding: 14px;
    transition: all 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.wb-game-card:hover {
    background: rgb(var(--input-bg-channels, 39 39 42) / 0.8);
    border-color: rgba(var(--accent-channels, 99 102 241), 0.4);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px -4px rgba(0, 0, 0, 0.25);
}

.wb-game-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.wb-game-card-header {
    display: flex;
    align-items: center;
    gap: 8px;
}

.wb-game-card-icon {
    font-size: 1.15rem;
    line-height: 1;
}

.wb-game-card-name {
    font-size: 0.88rem;
    font-weight: 700;
    color: rgb(var(--text-main-channels, 244 244 245));
}

.wb-game-card-badge {
    font-size: 0.65rem;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 6px;
    background: rgba(var(--accent-channels, 99 102 241), 0.15);
    color: rgb(var(--accent-channels, 99 102 241));
    border: 1px solid rgba(var(--accent-channels, 99 102 241), 0.3);
}

.wb-game-card-desc {
    font-size: 0.75rem;
    color: rgb(var(--text-body-channels, 212 212 216));
    line-height: 1.45;
}

.wb-game-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 4px;
    padding-top: 8px;
    border-top: 1px solid rgb(var(--border-channels, 255 255 255) / 0.05);
}

.wb-game-card-controls {
    font-size: 0.68rem;
    color: rgb(var(--text-meta-channels, 161 161 170));
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.wb-game-card-btn {
    font-size: 0.72rem;
    font-weight: 700;
    padding: 5px 12px;
    border-radius: 8px;
    background: rgb(var(--accent-channels, 99 102 241));
    color: #ffffff;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 4px;
}

.wb-game-card:hover .wb-game-card-btn {
    opacity: 0.95;
    transform: scale(1.04);
}

/* 菜单底部操作栏 */
.wb-game-menu-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid rgb(var(--border-channels, 255 255 255) / 0.1);
}

.wb-game-footer-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    background: transparent;
    border: 1px solid rgb(var(--border-channels, 255 255 255) / 0.12);
    border-radius: 8px;
    padding: 5px 10px;
    font-size: 0.72rem;
    color: rgb(var(--text-meta-channels, 161 161 170));
    cursor: pointer;
    transition: all 0.2s ease;
}

.wb-game-footer-btn:hover {
    background: rgb(var(--border-channels, 255 255 255) / 0.08);
    color: rgb(var(--text-main-channels, 244 244 245));
    border-color: rgb(var(--border-channels, 255 255 255) / 0.25);
}

.wb-game-footer-btn.active {
    color: rgb(var(--accent-channels, 99 102 241));
    border-color: rgba(var(--accent-channels, 99 102 241), 0.4);
}

/* 3. 游戏全屏画布与 HUD */
#wb-game-canvas {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    z-index: 99991;
    pointer-events: none;
}

/* 游戏 HUD 状态条 */
.wb-game-hud {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-30px);
    z-index: 99994;
    background: rgb(var(--card-bg-channels, 24 24 27) / 0.92);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(var(--accent-channels, 99 102 241), 0.3);
    border-radius: 9999px;
    padding: 8px 18px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.4), 0 0 16px rgba(var(--accent-channels, 99 102 241), 0.2);
    opacity: 0;
    pointer-events: none;
    transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.wb-game-hud.active {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
    pointer-events: auto;
}

.wb-game-hud-stat {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    font-weight: 700;
    color: rgb(var(--text-main-channels, 244 244 245));
}

.wb-game-hud-stat-value {
    color: rgb(var(--accent-channels, 99 102 241));
    font-weight: 800;
    font-size: 0.92rem;
}

.wb-game-hud-combo {
    font-size: 0.78rem;
    font-weight: 800;
    color: #f59e0b;
    padding: 2px 8px;
    border-radius: 9999px;
    background: rgba(245, 158, 11, 0.15);
    border: 1px solid rgba(245, 158, 11, 0.35);
    display: none;
    transition: transform 0.15s ease;
}

.wb-game-hud-combo.active {
    display: inline-flex;
    animation: wbComboPop 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes wbComboPop {
    0% { transform: scale(0.8); }
    50% { transform: scale(1.25); }
    100% { transform: scale(1); }
}

.wb-game-hud-divider {
    width: 1px;
    height: 16px;
    background: rgb(var(--border-channels, 255 255 255) / 0.15);
}

.wb-game-hud-hint {
    font-size: 0.72rem;
    color: rgb(var(--text-meta-channels, 161 161 170));
}

.wb-game-hud-btn {
    background: transparent;
    border: 1px solid rgb(var(--border-channels, 255 255 255) / 0.15);
    border-radius: 9999px;
    padding: 4px 10px;
    font-size: 0.72rem;
    font-weight: 600;
    color: rgb(var(--text-main-channels, 244 244 245));
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 4px;
}

.wb-game-hud-btn:hover {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.4);
    color: #ef4444;
}

.wb-game-hud-btn-restore:hover {
    background: rgba(var(--accent-channels, 99 102 241), 0.15);
    border-color: rgba(var(--accent-channels, 99 102 241), 0.4);
    color: rgb(var(--accent-channels, 99 102 241));
}

/* 4. 目标 DOM 碎裂震颤消失动画 */
@keyframes wbDomShatter {
    0% {
        opacity: 1;
        transform: scale(1) rotate(0deg);
        filter: brightness(1);
    }
    30% {
        opacity: 0.85;
        transform: scale(1.05) translate(calc(var(--wb-vx, 4px) * 0.5), calc(var(--wb-vy, -4px) * 0.5)) rotate(calc(var(--wb-rot, 3deg)));
        filter: brightness(2) contrast(1.5);
    }
    100% {
        opacity: 0;
        transform: scale(0.6) translate(var(--wb-vx, 10px), var(--wb-vy, -15px)) rotate(calc(var(--wb-rot, 15deg) * 2));
        filter: blur(2px) brightness(3);
    }
}

.wb-dom-shattering {
    pointer-events: none !important;
    animation: wbDomShatter 0.22s cubic-bezier(0.25, 1, 0.5, 1) forwards !important;
}

/* 屏幕微震 */
@keyframes wbScreenShake {
    0% { transform: translate(0, 0); }
    20% { transform: translate(-2px, 1.5px); }
    40% { transform: translate(2px, -1px); }
    60% { transform: translate(-1px, -1.5px); }
    80% { transform: translate(1px, 1px); }
    100% { transform: translate(0, 0); }
}

.wb-screen-shake {
    animation: wbScreenShake 0.14s ease-out !important;
}

/* 射击准星与鼠标样式控制 */
body.wb-game-active {
    user-select: none !important;
    -webkit-user-select: none !important;
}

body.wb-game-cursor-crosshair {
    cursor: crosshair !important;
}

body.wb-game-cursor-none {
    cursor: none !important;
}

/* 响应式适配 */
@media (max-width: 640px) {
    .wb-game-trigger {
        bottom: 16px;
        left: 16px;
        width: 44px;
        height: 44px;
    }
    .wb-game-menu-panel {
        bottom: 72px;
        left: 16px;
        width: calc(100vw - 32px);
    }
    .wb-game-hud {
        top: 12px;
        width: calc(100vw - 24px);
        border-radius: 14px;
        justify-content: space-between;
        padding: 6px 12px;
    }
    .wb-game-hud-hint {
        display: none;
    }
}
