/* 基本設定 */
body {
    font-family: '微軟正黑體', 'Arial', sans-serif;
    background-color: #e8f5e9; 
    color: #333;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    padding: 10px;
}

.game-container {
    width: 100%;
    max-width: 600px;
    background: #fff;
    padding: 20px;
    border-radius: 15px;
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.1);
    text-align: center;
}

h1 {
    color: #00796b; 
    margin-bottom: 15px;
}

.info-panel {
    background: #c8e6c9; 
    padding: 10px;
    border-radius: 10px;
    margin-bottom: 20px;
}

.timer-display {
    font-size: 1.8em;
    font-weight: bold;
    color: #d32f2f; 
    margin-top: 5px;
}

/* 修正：划槳次數的獨立顯示區 */
.click-count-info {
    font-size: 1.2em;
    font-weight: bold;
    color: #00796b; 
    margin-top: 5px;
    padding-top: 5px;
    border-top: 1px dashed #a5d6a7; 
}

/* 賽道區：使用 Grid 佈局，設定固定高度，確保終點線精準定位 */
.race-track {
    position: relative;
    padding: 5px; 
    border: 2px solid #ccc; 
    border-radius: 8px;
    margin-bottom: 20px;
    
    display: grid;
    grid-template-rows: 1fr 1fr; /* 兩行平均分配空間 */
    gap: 5px; 
    height: 120px; /* 固定高度，終點線參考此高度 */
    background-color: #f0ffff; 
}

/* 龍舟賽道：填滿網格空間 */
.boat-lane {
    display: flex;
    align-items: center;
    margin-bottom: 0; 
    background-color: white; 
    border-radius: 6px;
    padding: 3px;
    position: static; 
}

/* 終點線標記：精確定位在 race-track 內部的右側 */
.finish-marker {
    position: absolute;
    right: 0; 
    top: 0;
    height: 100%; 
    width: 15px; 
    background-color: #ffc107; 
    color: #333;
    writing-mode: vertical-rl; 
    font-weight: bold;
    font-size: 0.9em;
    padding-left: 3px;
    border-radius: 0 8px 8px 0; 
    z-index: 10;
    box-sizing: border-box; 
}

.boat-icon {
    min-width: 80px;
    text-align: left;
    font-size: 1em;
    font-weight: bold;
}

.progress-bar {
    flex-grow: 1; /* 讓兩個進度條填滿剩餘空間，確保長度一致 */
    height: 25px;
    background-color: #ddd;
    border-radius: 12px;
    overflow: hidden;
    margin: 0 10px;
    border: 1px solid #aaa;
}

.progress-fill {
    height: 100%;
    width: 0%; 
    transition: width 0.1s linear;
}
#player-progress {
    background-color: #4caf50; 
}
#computer-progress {
    background-color: #2196f3; 
}


/* 點擊按鈕 (適合手機觸控) */
.paddle-button {
    width: 90%;
    height: 100px;
    background-color: #ff5722; 
    color: white;
    border: none;
    border-radius: 50px; 
    font-size: 2.5em;
    font-weight: 900;
    cursor: pointer;
    box-shadow: 0 6px 0 #d84315; 
    transition: all 0.1s;
    touch-action: manipulation; 
}

/* 按下按鈕時的效果 */
.paddle-button:active {
    box-shadow: 0 2px 0 #d84315;
    transform: translateY(4px);
}

/* 遊戲結束/提示畫面 */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: none; 
    justify-content: center;
    align-items: center;
    z-index: 100;
}

.overlay.visible {
    display: flex;
}

.message-box {
    background: white;
    padding: 30px;
    border-radius: 15px;
    text-align: center;
    width: 80%;
    max-width: 350px;
    box-shadow: 0 0 25px rgba(255, 255, 255, 0.5);
}

.message-box h2 {
    color: #ff5722;
}

.message-box button {
    padding: 12px 25px;
    background-color: #4caf50;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.2em;
    margin-top: 20px;
}