/* ==================== 摸鱼专区 - 游戏样式 ==================== */
/* 从 lounge.css 拆分：小游戏样式 */

/* ====== 小游戏 ====== */
/* 游戏 Tab 切换栏 */
.lg-game-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 20px;
    background: var(--card-bg);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    overflow: hidden;
    padding: 4px;
}

.lg-game-tab {
    flex: 1;
    padding: 12px 20px;
    border: none;
    border-radius: 10px;
    background: transparent;
    color: var(--text-mid);
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
    font-family: inherit;
    letter-spacing: 0.5px;
    position: relative;
}

.lg-game-tab:hover {
    color: var(--text-bright);
    background: rgba(78, 110, 242, 0.06);
}

.lg-game-tab.active {
    background: linear-gradient(135deg, var(--ice), var(--gold));
    color: #fff;
    box-shadow: 0 4px 12px rgba(78, 110, 242, 0.25);
}

/* 游戏面板容器 */
.lg-games-container {
    position: relative;
}

.lg-game-panel {
    display: none;
}

.lg-game-panel.active {
    display: block;
    animation: gameFadeIn 0.3s ease;
}

@keyframes gameFadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.lg-game-card {
    /* 游戏卡片 */
}

.lg-game-scores {
    display: flex;
    gap: 16px;
    font-size: 0.9rem;
    color: var(--text-mid);
}

.lg-game-scores strong {
    color: var(--ice);
    font-weight: 800;
}

.lg-game-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

#snakeCanvas {
    border: 2px solid var(--border-subtle);
    border-radius: 12px;
    max-width: 100%;
    display: block;
    background: var(--bg-deep);
}

.lg-game-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
}

.lg-game-btn {
    padding: 10px 28px;
    border: none;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--ice), var(--gold));
    color: #fff;
    font-size: 0.92rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
    font-family: inherit;
    letter-spacing: 1px;
}

.lg-game-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(78, 110, 242, 0.3);
}

.lg-game-mobile-pad {
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    margin-top: 4px;
}

.lg-pad-row {
    display: flex;
    gap: 6px;
}

.lg-pad-btn {
    width: 68px;
    height: 68px;
    border: 1px solid var(--border-subtle);
    border-radius: 16px;
    background: var(--card-bg);
    font-size: 1.7rem;
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
}

.lg-pad-btn:active {
    background: var(--ice);
    color: #fff;
    transform: scale(0.92);
    border-color: var(--ice);
}

/* 游戏区域禁止触摸滚动（仅在游戏画布/棋盘上，防止游戏操作时误触页面滚动） */
#snakeCanvas,
.lg-2048-board {
    touch-action: none;
}

.lg-game-mobile-pad {
    touch-action: manipulation;
}

/* 游戏焦点高亮 - 已移除，不再需要蓝色高亮 */
.lg-game-card {
    transition: border-color 0.3s, box-shadow 0.3s;
    border: 1px solid var(--border-subtle);
}

/* 标题栏操作按钮区域 */
.lg-game-head-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.lg-game-btn-sm {
    padding: 6px 14px !important;
    font-size: 0.82rem !important;
    letter-spacing: 0.3px;
}

/* 难度选择器 */
.lg-game-difficulty {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    color: var(--text-mid);
}

.lg-game-difficulty label {
    font-weight: 600;
    white-space: nowrap;
}

.lg-game-difficulty select {
    padding: 6px 12px;
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    background: var(--card-bg);
    color: var(--text-bright);
    font-size: 0.9rem;
    font-family: inherit;
    cursor: pointer;
    outline: none;
    transition: border-color 0.2s;
}

.lg-game-difficulty select:focus {
    border-color: var(--ice);
}

/* 游戏说明按钮 */
.lg-game-tips-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border: 1px solid var(--border-subtle);
    border-radius: 50%;
    background: var(--bg-deep);
    color: var(--text-mid);
    font-size: 0.88rem;
    cursor: pointer;
    transition: all 0.2s;
    vertical-align: middle;
    margin-left: 6px;
    padding: 0;
    line-height: 1;
}

.lg-game-tips-btn:hover {
    background: var(--ice);
    color: #fff;
    border-color: var(--ice);
    transform: scale(1.1);
}

/* 游戏说明弹窗 */
.game-tips-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn 0.2s ease;
}

.game-tips-modal {
    background: var(--card-bg);
    border: 1px solid var(--border-subtle);
    border-radius: 16px;
    width: 90%;
    max-width: 420px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease;
}

.game-tips-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 22px;
    border-bottom: 1px solid var(--border-subtle);
}

.game-tips-modal-header h3 {
    margin: 0;
    font-size: 1.05rem;
    color: var(--text-bright);
}

.game-tips-modal-close {
    width: 30px;
    height: 30px;
    border: none;
    border-radius: 50%;
    background: var(--bg-deep);
    color: var(--text-mid);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.game-tips-modal-close:hover {
    background: #e74c3c;
    color: #fff;
}

.game-tips-modal-body {
    padding: 20px 22px;
}

.game-tips-content {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.game-tips-section h4 {
    margin: 0 0 8px 0;
    font-size: 0.95rem;
    color: var(--ice);
}

.game-tips-section p {
    margin: 0;
    font-size: 0.88rem;
    color: var(--text-mid);
    line-height: 1.6;
}

.game-tips-section ul {
    margin: 0;
    padding-left: 18px;
    font-size: 0.88rem;
    color: var(--text-mid);
    line-height: 1.8;
}

.game-tips-section kbd {
    display: inline-block;
    padding: 1px 6px;
    font-size: 0.88rem;
    font-family: 'SF Mono', 'Courier New', monospace;
    background: var(--bg-deep);
    border: 1px solid var(--border-subtle);
    border-radius: 4px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    color: var(--text-bright);
    min-width: 20px;
    text-align: center;
}

@keyframes slideUp {
    from { transform: translateY(30px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* 排行榜按钮 */
.lg-game-rank-btn {
    background: linear-gradient(135deg, #f6d365, #fda085) !important;
}

.lg-game-rank-btn:hover {
    box-shadow: 0 6px 20px rgba(253, 160, 133, 0.35) !important;
}

/* 响应式 */
@media (max-width: 768px) {
    .lg-game-mobile-pad {
        display: flex;
    }

    /* 标题栏操作按钮移动端排列 */
    .lg-card-head {
        flex-wrap: wrap;
    }

    .lg-game-head-actions {
        width: 100%;
        justify-content: flex-start;
        gap: 8px;
        margin-top: 6px;
    }

    /* 贪吃蛇 Canvas 自适应 */
    #snakeCanvas {
        max-width: 100%;
        height: auto !important;
    }

    /* 2048 棋盘移动端优化 */
    .lg-2048-board {
        max-width: 320px;
        gap: 6px;
        padding: 8px;
    }

    .tile-2048 {
        font-size: 1.2rem;
    }

    .tile-128, .tile-256, .tile-512 {
        font-size: 1rem;
    }

    .tile-1024, .tile-2048 {
        font-size: 0.9rem;
    }

    .tile-4096, .tile-8192, .tile-16384, .tile-32768 {
        font-size: 0.8rem;
    }

    /* 游戏说明弹窗移动端优化 */
    .game-tips-modal {
        width: 95%;
        max-height: 85vh;
    }

    .game-tips-modal-header {
        padding: 14px 18px;
    }

    .game-tips-modal-body {
        padding: 16px 18px;
    }
}

@media (max-width: 480px) {
    /* 贪吃蛇 Canvas 小屏幕进一步缩小 */
    #snakeCanvas {
        max-width: 280px;
    }

    /* 2048 棋盘超小屏幕 */
    .lg-2048-board {
        max-width: 280px;
        gap: 5px;
        padding: 6px;
    }

    .tile-2048 {
        font-size: 1rem;
        border-radius: 6px;
    }

    .tile-128, .tile-256, .tile-512 {
        font-size: 0.88rem;
    }

    .tile-1024, .tile-2048, .tile-4096, .tile-8192, .tile-16384, .tile-32768 {
        font-size: 0.75rem;
    }

    /* 方向键按钮小屏幕微调 */
    .lg-pad-btn {
        width: 62px;
        height: 62px;
        font-size: 1.5rem;
    }

    /* 游戏按钮小屏幕 */
    .lg-game-btn {
        padding: 8px 20px;
        font-size: 0.88rem;
    }

    /* 游戏分数 */
    .lg-game-scores {
        font-size: 0.85rem;
        gap: 10px;
    }
}

/* 游戏排行榜弹窗 */
.gl-modal {
    max-width: 480px;
}

.gl-diff-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 16px;
}

.gl-diff-tab {
    padding: 5px 12px;
    border: 1.5px solid var(--border-color, #e8e8e8);
    border-radius: 16px;
    background: var(--bg-color, #f8f9fa);
    color: var(--text-secondary, #999);
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s;
    font-family: inherit;
}

.gl-diff-tab:hover {
    border-color: var(--ice);
    color: var(--ice);
}

.gl-diff-tab.active {
    background: var(--ice);
    color: #fff;
    border-color: var(--ice);
}

.gl-my-info {
    margin-bottom: 12px;
}

.gl-my-rank {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    padding: 10px 14px;
    background: linear-gradient(135deg, rgba(78, 110, 242, 0.08), rgba(246, 211, 101, 0.08));
    border: 1px solid rgba(78, 110, 242, 0.15);
    border-radius: 10px;
    font-size: 0.9rem;
    color: var(--text-mid);
}

.gl-my-rank strong {
    color: var(--ice);
    font-weight: 800;
}

.gl-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 400px;
    overflow-y: auto;
}

.gl-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 10px;
    background: var(--bg-deep);
    transition: all 0.2s;
}

.gl-item:hover {
    background: rgba(78, 110, 242, 0.06);
}

.gl-rank-top.gl-rank-1 {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.12), rgba(255, 215, 0, 0.04));
    border: 1px solid rgba(255, 215, 0, 0.2);
}

.gl-rank-top.gl-rank-2 {
    background: linear-gradient(135deg, rgba(192, 192, 192, 0.12), rgba(192, 192, 192, 0.04));
    border: 1px solid rgba(192, 192, 192, 0.2);
}

.gl-rank-top.gl-rank-3 {
    background: linear-gradient(135deg, rgba(205, 127, 50, 0.12), rgba(205, 127, 50, 0.04));
    border: 1px solid rgba(205, 127, 50, 0.2);
}

.gl-rank {
    width: 28px;
    text-align: center;
    font-size: 1rem;
    font-weight: 800;
    color: var(--text-mid);
    flex-shrink: 0;
}

.gl-rank-top .gl-rank {
    font-size: 1.2rem;
}

.gl-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--ice), var(--gold));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    color: #fff;
    font-weight: 700;
    flex-shrink: 0;
}

.gl-info {
    flex: 1;
    min-width: 0;
}

.gl-name {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--text-bright);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.gl-plays {
    font-size: 0.9rem;
    color: var(--text-mid);
    margin-top: 2px;
}

.gl-score {
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--ice);
    flex-shrink: 0;
}

.gl-loading, .gl-empty {
    text-align: center;
    padding: 30px 0;
    color: var(--text-mid);
    font-size: 0.88rem;
}

/* 2048 棋盘 */
.lg-2048-board {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    max-width: 380px;
    width: 100%;
    padding: 10px;
    background: var(--bg-deep);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
}

.tile-2048 {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-weight: 800;
    font-size: 1.4rem;
    transition: all 0.15s;
    background: var(--card-bg);
    color: var(--text-bright);
}

.tile-0 { background: rgba(78, 110, 242, 0.03); color: transparent; }
.tile-2 { background: #eee4da; color: #776e65; }
.tile-4 { background: #ede0c8; color: #776e65; }
.tile-8 { background: #f2b179; color: #f9f6f2; }
.tile-16 { background: #f59563; color: #f9f6f2; }
.tile-32 { background: #f67c5f; color: #f9f6f2; }
.tile-64 { background: #f65e3b; color: #f9f6f2; }
.tile-128 { background: #edcf72; color: #f9f6f2; font-size: 1.2rem; box-shadow: 0 0 8px 2px rgba(237, 207, 114, 0.3); }
.tile-256 { background: #66bb6a; color: #f9f6f2; font-size: 1.2rem; box-shadow: 0 0 8px 2px rgba(102, 187, 106, 0.3); }
.tile-512 { background: #42a5f5; color: #f9f6f2; font-size: 1.2rem; box-shadow: 0 0 10px 3px rgba(66, 165, 245, 0.35); }
.tile-1024 { background: #ab47bc; color: #f9f6f2; font-size: 1rem; box-shadow: 0 0 12px 3px rgba(171, 71, 188, 0.4); }
.tile-2048 { background: #ef5350; color: #f9f6f2; font-size: 1rem; box-shadow: 0 0 15px 4px rgba(239, 83, 80, 0.45); }
.tile-4096 { background: #26c6da; color: #f9f6f2; font-size: 0.9rem; box-shadow: 0 0 18px 5px rgba(38, 198, 218, 0.5); }
.tile-8192 { background: #ff7043; color: #f9f6f2; font-size: 0.9rem; box-shadow: 0 0 20px 5px rgba(255, 112, 67, 0.5); }
.tile-16384 { background: #5c6bc0; color: #f9f6f2; font-size: 0.88rem; box-shadow: 0 0 22px 6px rgba(92, 107, 192, 0.5); }
.tile-32768 { background: #ec407a; color: #f9f6f2; font-size: 0.88rem; box-shadow: 0 0 25px 6px rgba(236, 64, 122, 0.5); }

/* ====== 扫雷 ====== */
.ms-board {
    display: grid;
    gap: 1px;
    background: var(--border-subtle);
    border: 2px solid var(--border-subtle);
    border-radius: 8px;
    overflow: hidden;
    max-width: 100%;
    overflow-x: auto;
    user-select: none;
    -webkit-user-select: none;
}

.ms-cell {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--card-bg);
    cursor: pointer;
    transition: background 0.1s;
    font-weight: 700;
    border: 1px solid rgba(255,255,255,0.05);
    position: relative;
}

.ms-cell:not(.ms-revealed):hover {
    background: rgba(78, 110, 242, 0.12);
}

.ms-cell:not(.ms-revealed):active {
    background: rgba(78, 110, 242, 0.2);
}

.ms-revealed {
    background: var(--bg-deep);
    cursor: default;
    border-color: transparent;
}

.ms-mine {
    background: rgba(244, 67, 54, 0.15) !important;
}

.ms-flagged {
    background: rgba(255, 193, 7, 0.08);
}

/* ====== 俄罗斯方块 ====== */
.tetris-wrapper {
    display: flex;
    gap: 16px;
    align-items: flex-start;
}

#tetrisCanvas {
    border: 2px solid var(--border-subtle);
    border-radius: 12px;
    background: var(--bg-deep);
    max-width: 100%;
}

.tetris-side {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.tetris-next-label {
    font-size: 0.85rem;
    color: var(--text-mid);
    font-weight: 700;
}

#tetrisNextCanvas {
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    background: var(--bg-deep);
}

.lg-pad-btn-wide {
    width: 148px !important;
    height: 48px !important;
    font-size: 1rem !important;
    border-radius: 12px !important;
}

/* 扫雷和俄罗斯方块触摸禁止滚动 */
.ms-board,
#tetrisCanvas {
    touch-action: none;
}

/* 响应式 - 扫雷和俄罗斯方块 */
@media (max-width: 768px) {
    .ms-board {
        max-width: 100%;
        overflow-x: auto;
    }

    .tetris-wrapper {
        flex-direction: column;
        align-items: center;
    }

    #tetrisCanvas {
        max-width: 250px;
    }

    .tetris-side {
        flex-direction: row;
        gap: 12px;
    }
}

@media (max-width: 480px) {
    #tetrisCanvas {
        max-width: 200px;
    }

    .lg-pad-btn-wide {
        width: 132px !important;
        height: 44px !important;
    }
}

