/* ============================================================================
   12-gomoku.css - 五子棋游戏样式
   ============================================================================ */

/* ============================================================================
   游戏选择模态框（拟态风格）
   ============================================================================ */
.game-select-modal {
    position: fixed;
    inset: 0;
    z-index: 2200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(15, 23, 42, 0.52);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

.game-select-modal.hidden {
    display: none;
}

body.dark .game-select-modal {
    background: rgba(2, 6, 23, 0.7);
}

.game-select-dialog {
    width: min(400px, 100%);
    border-radius: 24px;
    border: 1px solid rgba(148, 163, 184, 0.22);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.97), rgba(248, 250, 252, 0.94));
    box-shadow: 0 26px 70px rgba(15, 23, 42, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.7);
    padding: 28px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

body.dark .game-select-dialog {
    border-color: rgba(100, 116, 139, 0.34);
    background: linear-gradient(180deg, rgba(30, 41, 59, 0.96), rgba(15, 23, 42, 0.94));
    box-shadow: 0 32px 76px rgba(0, 0, 0, 0.42), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.game-select-title {
    text-align: center;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

body.dark .game-select-title {
    color: var(--text-primary);
}

.game-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 14px;
}

.game-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 20px 14px;
    border-radius: 18px;
    border: 2px solid rgba(148, 163, 184, 0.18);
    background: rgba(248, 250, 252, 0.7);
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 4px 4px 12px rgba(0, 0, 0, 0.06), -2px -2px 8px rgba(255, 255, 255, 0.8);
}

body.dark .game-card {
    background: rgba(30, 41, 59, 0.7);
    border-color: rgba(100, 116, 139, 0.25);
    box-shadow: 4px 4px 12px rgba(0, 0, 0, 0.2), -2px -2px 8px rgba(255, 255, 255, 0.03);
}

.game-card:hover {
    border-color: var(--accent, #3b82f6);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2), 4px 4px 12px rgba(0, 0, 0, 0.1), -2px -2px 8px rgba(255, 255, 255, 0.8);
    transform: translateY(-2px);
}

body.dark .game-card:hover {
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.3), 4px 4px 12px rgba(0, 0, 0, 0.3), -2px -2px 8px rgba(255, 255, 255, 0.04);
}

.game-card-icon {
    font-size: 2rem;
    letter-spacing: 4px;
    line-height: 1;
}

.game-card-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
}

.game-select-footer {
    display: flex;
    justify-content: center;
}

/* ============================================================================
   五子棋棋盘模态框
   ============================================================================ */
.gomoku-modal {
    position: fixed;
    inset: 0;
    z-index: 2200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(15, 23, 42, 0.52);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

.gomoku-modal.hidden {
    display: none;
}

body.dark .gomoku-modal {
    background: rgba(2, 6, 23, 0.7);
}

.gomoku-dialog {
    width: min(600px, 100%);
    border-radius: 24px;
    border: 1px solid rgba(148, 163, 184, 0.22);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.97), rgba(248, 250, 252, 0.94));
    box-shadow: 0 26px 70px rgba(15, 23, 42, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.7);
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

body.dark .gomoku-dialog {
    border-color: rgba(100, 116, 139, 0.34);
    background: linear-gradient(180deg, rgba(30, 41, 59, 0.96), rgba(15, 23, 42, 0.94));
    box-shadow: 0 32px 76px rgba(0, 0, 0, 0.42), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.gomoku-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.gomoku-title-area {
    flex: 1;
}

.gomoku-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.gomoku-subtitle {
    font-size: 0.78rem;
    color: var(--text-secondary);
    margin: 2px 0 0;
}

.gomoku-players {
    display: flex;
    align-items: center;
    gap: 10px;
}

.gomoku-player-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 700;
    background: rgba(100, 116, 139, 0.12);
    color: var(--text-secondary);
    transition: all 0.2s;
}

.gomoku-player-badge.is-active {
    background: var(--accent, #3b82f6);
    color: #fff;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.3);
}

.gomoku-player-badge.is-black .gomoku-stone-indicator {
    background: radial-gradient(circle at 35% 35%, #444, #000);
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

.gomoku-player-badge.is-white .gomoku-stone-indicator {
    background: radial-gradient(circle at 35% 35%, #fff, #ccc);
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
    box-shadow: 0 0 0 1px rgba(0,0,0,0.15);
}

.gomoku-board-wrap {
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: auto;
}

.gomoku-board {
    display: grid;
    grid-template-columns: repeat(15, 1fr);
    grid-template-rows: repeat(15, 1fr);
    background: #DEB887;
    border-radius: 4px;
    padding: 6px;
    box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.3), 0 4px 16px rgba(0, 0, 0, 0.15);
    user-select: none;
    position: relative;
}

/* 木纹纹理叠加 */
.gomoku-board::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 4px;
    background: repeating-linear-gradient(
        90deg,
        transparent,
        transparent 2px,
        rgba(0,0,0,0.02) 2px,
        rgba(0,0,0,0.02) 4px
    );
    pointer-events: none;
}

.gomoku-cell {
    position: relative;
    width: min(32px, calc((100vw - 80px) / 15));
    height: min(32px, calc((100vw - 80px) / 15));
    cursor: pointer;
}

/* 网格线 */
.gomoku-cell::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    width: 1px;
    height: 100%;
    background: rgba(0, 0, 0, 0.28);
    transform: translateX(-50%);
    pointer-events: none;
    z-index: 1;
}

.gomoku-cell::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    width: 100%;
    height: 1px;
    background: rgba(0, 0, 0, 0.28);
    transform: translateY(-50%);
    pointer-events: none;
    z-index: 1;
}

/* 边缘不画线 */
.gomoku-cell[data-col="0"]::before { display: none; }
.gomoku-cell[data-col="14"]::before { display: none; }
.gomoku-cell[data-row="0"]::after { display: none; }
.gomoku-cell[data-row="14"]::after { display: none; }

/* 星位点 */
.gomoku-cell.star-point .star-dot {
    position: absolute;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.45);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 2;
    pointer-events: none;
}

/* 棋子 */
.gomoku-stone {
    position: absolute;
    width: 88%;
    height: 88%;
    border-radius: 50%;
    top: 6%;
    left: 6%;
    z-index: 3;
    pointer-events: none;
}

.gomoku-stone.is-black {
    background: radial-gradient(circle at 33% 33%, #555, #111);
    box-shadow: 1px 2px 4px rgba(0, 0, 0, 0.5);
}

.gomoku-stone.is-white {
    background: radial-gradient(circle at 33% 33%, #fff, #ccc);
    box-shadow: 1px 2px 4px rgba(0, 0, 0, 0.25);
}

.gomoku-stone.is-winning {
    box-shadow: 0 0 0 3px #f59e0b, 0 0 14px rgba(245, 158, 11, 0.7);
}

/* 轮到己方时可以预览落子 */
.gomoku-board.my-turn .gomoku-cell:hover .gomoku-stone:not(.is-placed) {
    opacity: 0.4;
    transform: scale(0.9);
}

.gomoku-board.my-turn .gomoku-cell:hover .gomoku-stone.is-black:not(.is-placed) {
    background: radial-gradient(circle at 33% 33%, #333, #000);
}

.gomoku-board.my-turn .gomoku-cell:hover .gomoku-stone.is-white:not(.is-placed) {
    background: radial-gradient(circle at 33% 33%, #f0f0f0, #aaa);
}

/* 等待中禁止交互 */
.gomoku-board.waiting {
    cursor: not-allowed;
    opacity: 0.85;
}

.gomoku-board.waiting .gomoku-cell:hover .gomoku-stone:not(.is-placed) {
    opacity: 0;
    transform: none;
}

.gomoku-board.game-over {
    cursor: default;
    opacity: 0.9;
}

.gomoku-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.gomoku-turn-text {
    font-size: 0.82rem;
    color: var(--text-secondary);
}

.gomoku-turn-text.your-turn {
    color: var(--accent, #3b82f6);
    font-weight: 600;
}

.gomoku-move-info {
    font-size: 0.78rem;
    color: var(--text-secondary);
}

.gomoku-actions {
    display: flex;
    gap: 8px;
}

/* ============================================================================
   邀请横幅（聊天区顶部）
   ============================================================================ */
.game-invite-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 14px;
    margin: 8px;
    border-radius: 14px;
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.25);
    font-size: 0.85rem;
    animation: slideDownFade 0.25s ease;
}

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

.game-invite-banner-text {
    flex: 1;
    color: var(--text-primary);
}

.game-invite-banner-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.game-invite-banner .mini-btn {
    padding: 4px 12px;
    font-size: 0.78rem;
}

/* ============================================================================
   活跃游戏指示器（房间内）
   ============================================================================ */
.room-game-indicator {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 999px;
    background: rgba(59, 130, 246, 0.12);
    color: var(--accent, #3b82f6);
    font-size: 0.72rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.room-game-indicator:hover {
    background: rgba(59, 130, 246, 0.2);
}

/* 成员卡片上的游戏状态 */
.member-game-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 1px 6px;
    border-radius: 999px;
    font-size: 0.68rem;
    background: rgba(59, 130, 246, 0.15);
    color: var(--accent, #3b82f6);
    margin-left: 4px;
    vertical-align: middle;
}
