/* 五子棋游戏样式 */

/* 游戏棋盘 */
#gameBoard {
    position: relative;
    width: 450px;
    height: 450px;
    background-color: #F0F0F0; /* 淡灰色 */
    border: 2px solid #8B4513;
    border-radius: 8px;
    overflow: hidden;
}

/* 游戏未开始时的棋盘样式 */
#gameBoard:not(.game-started) {
    cursor: not-allowed;
    opacity: 0.7;
}

/* 棋盘网格 */
#gameBoard::before {
    content: '';
    position: absolute;
    top: 25px;
    left: 25px;
    right: 25px;
    bottom: 25px;
    background-image: 
        linear-gradient(to right, #000 1px, transparent 1px),
        linear-gradient(to bottom, #000 1px, transparent 1px);
    background-size: 30px 30px;
    background-position: center center;
}

/* 棋盘中心点 */
#gameBoard::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 8px;
    height: 8px;
    background-color: #000;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    z-index: 1;
}

/* 棋子 */
.chess-piece {
    position: absolute;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    z-index: 2;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    transition: all 0.2s ease;
    /* 调整定位，确保棋子中心精确对准十字交叉点 */
    transform: translate(calc(-50% + 1px), calc(-50% + 1px));
}

/* 黑子 */
.chess-piece.black {
    background-color: #000;
    border: 1px solid #333;
}

/* 白子 */
.chess-piece.white {
    background-color: #fff;
    border: 1px solid #ccc;
}

/* 可落子提示 */
.chess-piece.hint {
    background-color: rgba(0, 0, 0, 0.1);
    border: 1px dashed #666;
    pointer-events: none;
}

/* 获胜提示线 */
.win-line {
    position: absolute;
    background-color: #FF0000;
    height: 3px;
    z-index: 3;
    transform-origin: left center;
    animation: winLineShow 0.5s ease-out forwards;
}

@keyframes winLineShow {
    from {
        width: 0;
        opacity: 0;
    }
    to {
        width: 100%;
        opacity: 1;
    }
}

/* 玩家信息项 */
.player-item {
    display: flex;
    align-items: center;
    padding: 8px;
    background-color: #f3f4f6;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.player-item.active {
    background-color: #dbeafe;
    border-left: 4px solid #3b82f6;
}

.player-item.ready {
    background-color: #d1fae5;
    border-left: 4px solid #10b981;
}

/* 玩家颜色标记 */
.player-color {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    margin-right: 8px;
}

.player-color.black {
    background-color: #000;
}

.player-color.white {
    background-color: #fff;
    border: 1px solid #ccc;
}

/* 聊天消息 */
.chat-message {
    margin-bottom: 8px;
    padding: 6px 10px;
    background-color: #f3f4f6;
    border-radius: 8px;
    font-size: 14px;
}

.chat-message.system {
    background-color: #eff6ff;
    color: #1d4ed8;
    font-style: italic;
}

.chat-message.other {
    background-color: #fef3c7;
}

.chat-message.self {
    background-color: #dbeafe;
    text-align: right;
    margin-left: auto;
    max-width: 80%;
}

/* 游戏结束模态框 */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background-color: white;
    padding: 24px;
    border-radius: 12px;
    text-align: center;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.modal-content h2 {
    margin-bottom: 16px;
    color: #1f2937;
}

.modal-content p {
    margin-bottom: 24px;
    color: #4b5563;
    font-size: 16px;
}

.modal-content button {
    padding: 8px 20px;
    border: none;
    border-radius: 6px;
    background-color: #3b82f6;
    color: white;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.modal-content button:hover {
    background-color: #2563eb;
}

/* 响应式设计 */
@media (max-width: 768px) {
    #gameBoard {
        width: 300px;
        height: 300px;
    }
    
    #gameBoard::before {
        top: 16.67px;
        left: 16.67px;
        right: 16.67px;
        bottom: 16.67px;
        background-size: 20px 20px;
    }
    
    .chess-piece {
        width: 18px;
        height: 18px;
    }
}

/* 房间ID输入框 */
#joinRoomInput {
    width: 120px;
}

/* 按钮样式 */
button {
    font-weight: 500;
}

button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}