/* 基本樣式 */
body {
    font-family: 'Microsoft JhengHei', sans-serif;
    background-color: #87CEEB;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    padding: 10px;
    box-sizing: border-box;
}

/* 遊戲容器樣式 */
.game-container {
    position: relative;
    text-align: center;
    background-color: #8FBC8F;
    padding: 20px;
    border-radius: 15px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.2);
    width: 100%;
    max-width: 500px;
    margin: 20px 0;
}

/* 全螢幕按鈕的樣式 */
.top-right-controls {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 1000;
}

.fullscreen-button {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 24px;
    color: #FF4500;
    transition: transform 0.2s;
}

.fullscreen-button:hover {
    transform: scale(1.1);
}

.fullscreen-button:active {
    transform: scale(0.95);
}

/* 標題樣式 */
h1 {
    font-family: 'Microsoft JhengHei', sans-serif;
    font-size: 40px;
    font-weight: bold;
    color: #FF4500;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    margin-bottom: 20px;
}

/* 得分和時間樣式 */
.score, .time {
    font-family: 'Microsoft JhengHei', sans-serif;
    font-size: 24px;
    font-weight: bold;
    margin-bottom: 10px;
    color: #8B4513;
    transition: transform 0.2s;
}

.score:hover, .time:hover {
    transform: scale(1.1);
}

/* 地鼠網格樣式 */
.grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
    margin-bottom: 20px;
    justify-content: center;
    margin-left: auto;
    margin-right: auto;
    width: fit-content;
}

/* 地鼠洞樣式 */
.hole {
    position: relative;
    overflow: hidden;
    border-radius: 50%;
    background: radial-gradient(circle, #8B4513 40%, #5a2c0d 100%);
    width: 120px;
    height: 120px;
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.5), 0 4px 6px rgba(0, 0, 0, 0.3);
    z-index: 1;
    cursor: pointer;
}

/* 地鼠樣式 */
.mole {
    width: 100%;
    height: 100%;
    background-image: url('cute-mole.png');
    background-size: cover;
    background-position: center bottom;
    position: absolute;
    top: 60%;
    left: 50%;
    transform: translateX(-50%);
    transition: top 0.3s;
    z-index: 3;
    animation: shake 0.5s infinite;
    color: white;
    font-size: 20px;
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
}

.mole.up {
    top: 8%;
    animation: none;
}

/* 地鼠跳出動畫 */
@keyframes popUp {
    0% { top: 60%; }
    50% { top: 8%; }
    100% { top: 8%; }
}

/* 地鼠回到洞裡動畫 */
@keyframes popDown {
    0% { top: 8%; }
    50% { top: 60%; }
    100% { top: 60%; }
}

.mole.up {
    animation: popUp 0.3s forwards;
}

.mole.down {
    animation: popDown 0.3s forwards;
}

/* 分數提示樣式 */
.score-popup {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 24px;
    font-weight: bold;
    color: #FFD700;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
    opacity: 1;
    z-index: 4;
    animation: scoreAnimation 1s forwards;
}

@keyframes scoreAnimation {
    0% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
    50% { transform: translate(-50%, -50%) scale(1.5); opacity: 1; }
    100% { transform: translate(-50%, -50%) scale(1); opacity: 0; }
}

/* 開始按鈕樣式 */
#startButton {
    padding: 15px 30px;
    font-size: 20px;
    font-family: 'Microsoft JhengHei', sans-serif;
    font-weight: bold;
    cursor: pointer;
    border: none;
    background-color: #FF6347;
    color: white;
    border-radius: 25px;
    width: 100%;
    max-width: 200px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
    transition: background-color 0.3s, transform 0.2s;
}

#startButton:hover {
    background-color: #FF4500;
    transform: scale(1.05);
}

#startButton:active {
    transform: scale(0.95);
    animation: bounce 0.5s;
}

/* 遊戲結束訊息樣式 */
#gameOverMessage {
    margin-top: 20px;
    font-size: 24px;
    font-family: 'Microsoft JhengHei', sans-serif;
    font-weight: bold;
    color: #8B0000;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}

.hidden {
    display: none;
}

/* 倒數計時樣式 */
#countdown {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 10;
}

#countdown.visible {
    display: flex;
}

#countdownText {
    font-size: 100px;
    font-weight: bold;
    color: white;
    font-family: 'Microsoft JhengHei', sans-serif;
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

/* 遊戲結束彈出畫面樣式 */
#gameOverPopup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(255, 255, 255, 0.9);
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.5);
    text-align: center;
    z-index: 100;
    display: none;
    width: 90%;
    max-width: 500px;
}

#gameOverPopup.visible {
    display: block;
}

#finalScoreDisplay {
    font-size: 2.5em;
    font-weight: bold;
    color: #FF4500;
    margin-bottom: 20px;
    white-space: nowrap;
}

#restartButton, #endGameButton {
    padding: 15px 30px;
    font-size: 20px;
    font-family: 'Microsoft JhengHei', sans-serif;
    font-weight: bold;
    cursor: pointer;
    border: none;
    background-color: #FF6347;
    color: white;
    border-radius: 25px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
    transition: background-color 0.3s, transform 0.2s;
    margin: 10px;
}

#restartButton:hover, #endGameButton:hover {
    background-color: #FF4500;
    transform: scale(1.05);
}

#restartButton:active, #endGameButton:active {
    transform: scale(0.95);
}

/* 抖動動畫 */
@keyframes shake {
    0%, 100% { transform: translateX(-50%) translateY(0); }
    25% { transform: translateX(-50%) translateY(-5px); }
    50% { transform: translateX(-50%) translateY(0); }
    75% { transform: translateX(-50%) translateY(5px); }
}

/* 按鈕彈跳動畫 */
@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-10px); }
    60% { transform: translateY(-5px); }
}

/* 媒體查詢：針對小螢幕裝置 */
@media (max-width: 600px) {
    h1 {
        font-size: 32px;
    }

    .score, .time {
        font-size: 20px;
    }

    .grid {
        gap: 20px;
    }

    .hole {
        width: 100px;
        height: 100px;
    }

    #startButton {
        font-size: 18px;
        padding: 12px 24px;
    }

    #countdownText {
        font-size: 60px;
    }

    #finalScoreDisplay {
        font-size: 1.8em;
    }

    #restartButton, #endGameButton {
        font-size: 18px;
        padding: 12px 24px;
    }
}

/* 版權聲明樣式 */
footer {
    text-align: center;
    padding: 10px;
    font-family: 'Microsoft JhengHei', sans-serif;
    font-size: 14px;
    color: #555;
    width: 100%;
    box-sizing: border-box;
    margin-top: auto;
}

/* 社群分享按鈕樣式 */
.social-share {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 20px;
}

.social-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    color: white;
    font-size: 18px;
    text-decoration: none;
    transition: transform 0.2s, background-color 0.3s;
}

.social-button:hover {
    transform: scale(1.1);
}

/* 各社群按鈕的顏色 */
.social-button.facebook {
    background-color: #1877F2;
}

.social-button.twitter {
    background-color: #1DA1F2;
}

.social-button.line {
    background-color: #00C300;
}

.social-button.instagram {
    background-color: #E4405F;
}

.social-button.pinterest {
    background-color: #BD081C;
}

.social-button.linkedin {
    background-color: #0A66C2;
}

/* 設定介面樣式 */
#settings {
    text-align: left;
    background-color: #8FBC8F;
    padding: 20px;
    border-radius: 15px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.2);
    width: 100%;
    max-width: 600px;
    margin: 20px 0;
}

.settings-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-bottom: 20px;
}

.settings-container div {
    background-color: #ffffff;
    padding: 15px;
    border-radius: 10px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}

.settings-container h3 {
    font-size: 24px;
    color: #8B4513;
    margin-bottom: 10px;
}

.settings-container label {
    display: block;
    margin-bottom: 10px;
    font-size: 18px;
    color: #555;
    text-align: left;
}

.settings-container input {
    width: 90%;
    padding: 10px;
    font-size: 16px;
    border: 1px solid #ccc;
    border-radius: 5px;
    margin-top: 5px;
    box-sizing: border-box;
}

.settings-buttons {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin-top: 20px;
}

.settings-button {
    padding: 10px 20px;
    font-size: 16px;
    font-family: 'Microsoft JhengHei', sans-serif;
    font-weight: bold;
    cursor: pointer;
    border: none;
    background-color: #FF6347;
    color: white;
    border-radius: 25px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
    transition: background-color 0.3s, transform 0.2s;
    white-space: nowrap;
}

.settings-button:hover {
    background-color: #FF4500;
    transform: scale(1.05);
}

.settings-button:active {
    transform: scale(0.95);
}

.clear-button {
    background-color: #8B0000;
}

.clear-button:hover {
    background-color: #6B0000;
}

/* 答题结果样式 */
#resultContainer {
    margin-top: 20px;
    max-height: 300px;
    overflow-y: auto;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 10px;
    background-color: #f9f9f9;
}

.result-item {
    margin-bottom: 15px;
    padding: 10px;
    border-bottom: 1px solid #ddd;
}

.result-item h4 {
    margin: 0 0 5px 0;
    font-size: 18px;
    color: #333;
}

.result-item p {
    margin: 5px 0;
    font-size: 16px;
    color: #555;
}

/* 加扣分設定樣式 */
.points-settings {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 20px 0;
    background-color: #ffffff;
    padding: 15px;
    border-radius: 10px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}

.points-settings label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 18px;
    color: #555;
}

.points-input {
    width: 80px;
    padding: 8px;
    font-size: 16px;
    border: 1px solid #ccc;
    border-radius: 5px;
    text-align: center;
    box-sizing: border-box;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.points-input:focus {
    border-color: #FF6347;
    box-shadow: 0 0 5px rgba(255, 99, 71, 0.5);
    outline: none;
}

/* 音樂控制按鈕樣式 */
.music-toggle-button {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 24px;
    color: #FF4500;
    transition: transform 0.2s;
    margin-left: 10px;
}

.music-toggle-button:hover {
    transform: scale(1.1);
}

.music-toggle-button:active {
    transform: scale(0.95);
}

/* 分享對話框樣式 */
#shareDialog {
    border: none;
    border-radius: 15px;
    padding: 20px;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
    background-color: white;
    text-align: center;
}

#shareDialog h2 {
    font-size: 24px;
    color: #FF4500;
    margin-bottom: 15px;
}

#shareDialog p {
    font-size: 18px;
    color: #333;
    word-wrap: break-word;
    margin-bottom: 20px;
}

#shareDialog button {
    padding: 10px 20px;
    font-size: 16px;
    font-family: 'Microsoft JhengHei', sans-serif;
    font-weight: bold;
    cursor: pointer;
    border: none;
    background-color: #FF6347;
    color: white;
    border-radius: 25px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
    transition: background-color 0.3s, transform 0.2s;
    margin: 5px;
}

#shareDialog button:hover {
    background-color: #FF4500;
    transform: scale(1.05);
}

#shareDialog button:active {
    transform: scale(0.95);
}

/* 自定義提示框樣式 */
.custom-alert {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    padding: 15px 30px;
    background-color: #333;
    color: white;
    border-radius: 5px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    z-index: 1000;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.custom-alert.fade-out {
    opacity: 0;
}