/* 基礎佈局 */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    display: flex; 
    flex-direction: column; 
    justify-content: flex-start; 
    align-items: center; 
    min-height: 100vh;
    margin: 0;
    padding: 20px 0 50px 0; 
    background-color: #2c3e50; 
    color: #ecf0f1; 
    text-align: center;
}

.container {
    background: #34495e; 
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.4);
    max-width: 600px;
    width: 90%;
    margin-bottom: 40px; 
}

h1 {
    color: #f39c12;
}

.info {
    display: flex;
    justify-content: space-around;
    font-size: 1.2em;
    margin-bottom: 20px;
    color: #ecf0f1;
}

#start-button {
    padding: 10px 20px;
    font-size: 1.2em;
    cursor: pointer;
    background-color: #e74c3c;
    color: white;
    border: none;
    border-radius: 5px;
    transition: background-color 0.2s;
}

#start-button:hover:not(:disabled) {
    background-color: #c0392b;
}

#start-button:disabled {
    background-color: #95a5a6;
    cursor: not-allowed;
}

.game-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-gap: 10px;
    width: 320px;
    height: 320px;
    margin: 20px auto;
}

.hole {
    background: #5d4037;
    border-radius: 50%;
    position: relative;
    overflow: hidden;
    cursor: pointer;
    box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.5);
    transition: transform 0.1s ease-out; 
}

/* 洞口被點擊時的縮放動畫 */
.hole:active {
    transform: scale(0.95); 
}

/* --- 單點回饋：洞口下沉效果 --- */
/*.hole.clicked-feedback {
    transform: translateY(10px); 
    box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.7), 0 0 5px rgba(138, 43, 226, 0.5);
}
*/
/* Emoji 樣式 */
.mole {
    background: #a1887f;
    font-size: 60px; 
    text-align: center;
    position: absolute;
    bottom: -100%; 
    width: 100%;
    height: 100%;
    transition: all 0.3s;
    user-select: none;
    line-height: 1.5; 
    display: flex; 
    justify-content: center;
    align-items: center;
}

.hole.up .mole {
    bottom: 0; 
}

.message {
    margin-top: 15px;
    font-size: 1.1em;
    color: #2ecc71;
}

.message.game-over {
    color: #f1c40f;
    font-weight: bold;
}

/* --- 歷史最高分列表樣式 --- */
.high-score-list-container {
    width: 90%; 
    max-width: 600px; 
    background: #34495e;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4);
    margin-top: 20px;
}

#high-score-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
    /* 調整表格佈局以應對更長的時間字串 */
    table-layout: auto; 
}

#high-score-table th, #high-score-table td {
    padding: 8px;
    border: 1px solid #5d7e97;
    text-align: center;
    font-size: 0.9em;
    /* 讓時間欄位字體小一點，以容納更多資訊 */
}

/* 可選：針對時間欄位 (第四欄) 調整字體大小 */
#high-score-table td:nth-child(4) {
    font-size: 0.8em; 
}


#high-score-table th {
    background-color: #2c3e50;
    color: #e67e22;
}

#high-score-table tr:nth-child(even) {
    background-color: #3b5066;
}

/* --- 自定義 Modal 彈窗樣式 --- */
.modal-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: 1000;
}

.modal-overlay.active {
    display: flex; 
}

.modal-content {
    background: #34495e;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    width: 300px;
    text-align: center;
    color: #ecf0f1;
}

#player-id-input {
    width: 80%;
    padding: 10px;
    margin: 15px 0;
    border: 2px solid #5d7e97;
    border-radius: 5px;
    font-size: 1.2em;
    text-align: center;
    box-sizing: border-box;
    /* 移除輸入框的箭頭 */
    appearance: none; 
    -moz-appearance: textfield; 
    -webkit-appearance: none;
}

#player-id-input::-webkit-outer-spin-button,
#player-id-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.modal-buttons button {
    padding: 10px 15px;
    margin: 0 5px;
    font-size: 1em;
    cursor: pointer;
    border: none;
    border-radius: 5px;
    transition: background-color 0.2s;
}

#modal-start-button {
    background-color: #2ecc71;
    color: white;
}

#modal-cancel-button {
    background-color: #e74c3c;
    color: white;
}

.error-message {
    color: #f1c40f;
    margin-top: 10px;
    font-size: 0.9em;
    min-height: 1em; 
}
