/* 基本樣式 */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 20px;
    background-color: #f4f4f4;
    color: #333;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
    user-select: none; /* 防止拖拽時選中文本 */
}

.container {
    background-color: #fff;
    padding: 25px;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    width: 90%;
    max-width: 600px; /* 華容道棋盤不需要太寬 */
    text-align: center;
}

h1, h2 { color: #333; margin-bottom: 20px; }
.error-message { color: #dc3545; font-size: 0.9em; }
.success-message { color: #28a745; font-size: 0.9em; font-weight: bold; }
.info-message { color: #6c757d; font-style: italic; }

/* 登入區塊 (可沿用之前的樣式) */
#login-section { margin-bottom: 30px; }
#login-section div { margin-bottom: 12px; text-align: left; }
#login-section label { display: inline-block; width: 80px; font-weight: 500; }
#login-section input[type="text"],
#login-section input[type="password"] { padding: 10px; border: 1px solid #ced4da; border-radius: 4px; width: calc(100% - 125px); box-sizing: border-box;}
.captcha-line { display: flex; align-items: center; }
.captcha-display { margin-left: 10px; padding: 10px; background-color: #e9ecef; border-radius: 4px; font-weight: bold; letter-spacing: 1px;}
.captcha-refresh-btn { margin-left: 8px; padding: 10px; cursor: pointer; background-color: #007bff; color: white; border: none; border-radius: 4px; }
#loginBtn { padding: 12px 20px; background-color: #28a745; color: white; border: none; border-radius: 5px; cursor: pointer; display: block; margin: 15px auto 0; font-size: 1em; }
#loginBtn:hover { background-color: #218838; }


/* 遊戲區塊 */
#game-section { margin-top: 20px; border-top: 1px solid #eee; padding-top: 20px; }
.game-info {
    display: flex;
    justify-content: space-around;
    margin-bottom: 15px;
    font-size: 1.2em;
    background-color: #e9f7fd;
    padding: 12px;
    border-radius: 5px;
    color: #0056b3;
}
.game-info span span { font-weight: bold; }

.game-controls { margin-bottom: 15px; }
#resetGameBtn {
    padding: 10px 20px;
    font-size: 1em;
    background-color: #dc3545;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}
#resetGameBtn:hover { background-color: #c82333; }

#gameBoard {
    width: 240px;  /* 4 units * 60px/unit */
    height: 300px; /* 5 units * 60px/unit */
    background-color: #e0e0e0; /* 棋盤背景色 */
    border: 3px solid #7a5c3e; /* 木質邊框色 */
    margin: 0 auto;
    position: relative; /* 為了棋子的絕對定位 */
    box-shadow: inset 0 0 10px rgba(0,0,0,0.2);
    background-image: repeating-linear-gradient(45deg, #d3d3d3, #d3d3d3 10px, #e0e0e0 10px, #e0e0e0 20px); /* 可選的棋盤紋理 */
}

#gameExit {
    width: 120px; /* 2 units */
    height: 30px;
    line-height: 30px;
    background-color: #c3e6cb;
    color: #155724;
    text-align: center;
    margin: 5px auto 0 auto;
    border: 2px dashed #155724;
    border-radius: 4px;
    font-weight: bold;
}

.piece {
    position: absolute;
    background-color: #f0a04b; /* 棋子基礎顏色 */
    border: 2px solid #c8790a; /* 棋子邊框 */
    box-sizing: border-box; /* 邊框包含在寬高內 */
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: bold;
    color: white;
    cursor: grab;
    transition: background-color 0.2s, transform 0.1s; /* 平滑過渡 */
    border-radius: 4px; /* 棋子圓角 */
    box-shadow: 2px 2px 5px rgba(0,0,0,0.3);
}
.piece:active {
    cursor: grabbing;
    z-index: 10; /* 拖拽時置於頂層 */
    transform: scale(1.02); /* 拖拽時輕微放大 */
    box-shadow: 4px 4px 8px rgba(0,0,0,0.4);
}

/* 不同棋子的特定樣式 */
.piece[data-name="曹操"] { background-color: #d9534f; border-color: #b52b27; }
.piece[data-name="關羽"] { background-color: #5cb85c; border-color: #3d8b3d; }
.piece[data-name*="將"] { background-color: #f0ad4e; border-color: #d68910; } /* 張飛, 趙雲, 馬超, 黃忠 */
.piece[data-name="兵"] { background-color: #5bc0de; border-color: #31b0d5; }


/* 排行榜區塊 (可沿用之前的樣式) */
#leaderboard-section { margin-top: 30px; border-top: 1px solid #eee; padding-top: 20px; }
.leaderboard-filters button { margin: 0 5px 10px 5px; padding: 10px 15px; cursor: pointer; background-color: #007bff; color:white; border:none; border-radius: 4px; }
.leaderboard-filters button:hover { background-color: #0056b3;}
#leaderboardTable { width: 100%; border-collapse: collapse; margin-top: 15px; }
#leaderboardTable th, #leaderboardTable td { border: 1px solid #ddd; padding: 10px; text-align: left; }
#leaderboardTable th { background-color: #f8f9fa; font-weight: 600; }