/* 基本樣式重置和全域設定 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Arial', 'Microsoft JhengHei', sans-serif;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s ease;
    cursor: default;
    user-select: none;
}

/* 遊戲狀態背景顏色 */
body.start {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

body.waiting {
    background-color: #6b7280; /* 灰色 - 等待中 */
}

body.ready {
    background-color: #10b981; /* 綠色 - 可以點擊 */
    cursor: pointer;
}

body.result {
    background-color: #3b82f6; /* 藍色 - 顯示結果 */
}

body.error {
    background-color: #ef4444; /* 紅色 - 錯誤 */
}

/* 主要遊戲容器 */
#game-container {
    text-align: center;
    color: white;
    max-width: 600px;
    width: 90%;
    padding: 2rem;
}

/* 標題區域 */
header h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

header p {
    font-size: 1.2rem;
    margin-bottom: 2rem;
    opacity: 0.9;
}

/* 最佳紀錄顯示 */
#best-score-display {
    background: rgba(255, 255, 255, 0.95);
    color: #333;
    padding: 1rem;
    border-radius: 15px;
    margin-bottom: 2rem;
    backdrop-filter: blur(10px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    display: inline-block;
    min-width: 200px;
}

.score-label {
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
    opacity: 0.7;
}

#best-score {
    font-size: 1.8rem;
    font-weight: bold;
    color: #3b82f6;
}

/* 主要遊戲區域 */
#game-area {
    min-height: 300px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin-bottom: 2rem;
}

/* 開始按鈕 */
#start-button {
    font-size: 1.5rem;
    font-weight: bold;
    padding: 1rem 2rem;
    border: none;
    border-radius: 20px;
    background: white;
    color: #3b82f6;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
    margin-bottom: 1rem;
}

#start-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.3);
    background: #f8fafc;
}

#start-button:active {
    transform: translateY(-1px);
}

/* 遊戲狀態文字 */
#game-status {
    font-size: 2.5rem;
    font-weight: bold;
    margin-bottom: 1rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

/* 遊戲說明文字 */
#game-instructions {
    font-size: 1.2rem;
    opacity: 0.9;
    animation: pulse 1.5s ease-in-out infinite;
}

/* 結果容器 */
#result-container {
    background: rgba(255, 255, 255, 0.95);
    color: #333;
    padding: 2rem;
    border-radius: 20px;
    backdrop-filter: blur(10px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    margin-bottom: 1rem;
    display: none;
}

#result-container.show {
    display: block;
}

/* 反應時間顯示 */
#reaction-time {
    font-size: 3rem;
    font-weight: bold;
    color: #3b82f6;
    margin-bottom: 1rem;
}

/* 結果訊息 */
#result-message {
    font-size: 1.3rem;
    margin-bottom: 1.5rem;
    white-space: pre-line;
    line-height: 1.4;
}

/* 再玩一次按鈕 */
#play-again-button {
    font-size: 1.2rem;
    font-weight: bold;
    padding: 0.8rem 1.5rem;
    border: none;
    border-radius: 15px;
    background: #3b82f6;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
}

#play-again-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
    background: #2563eb;
}

#play-again-button:active {
    transform: translateY(0);
}

/* 底部說明 */
footer {
    opacity: 0.8;
}

footer p {
    font-size: 0.9rem;
    line-height: 1.5;
    max-width: 400px;
    margin: 0 auto;
}

/* 動畫效果 */
@keyframes pulse {
    0%, 100% { 
        opacity: 1; 
    }
    50% { 
        opacity: 0.7; 
    }
}

/* 等待中的可點擊區域提示 */
body.ready #game-area {
    cursor: pointer;
}

body.ready #game-area:hover {
    transform: scale(1.02);
    transition: transform 0.1s ease;
}

/* 響應式設計 */
@media (max-width: 768px) {
    #game-container {
        padding: 1rem;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    header p {
        font-size: 1rem;
    }
    
    #game-status {
        font-size: 2rem;
    }
    
    #game-instructions {
        font-size: 1rem;
    }
    
    #reaction-time {
        font-size: 2.5rem;
    }
    
    #result-message {
        font-size: 1.1rem;
    }
    
    #start-button {
        font-size: 1.2rem;
        padding: 0.8rem 1.5rem;
    }
}

@media (max-width: 480px) {
    header h1 {
        font-size: 1.8rem;
    }
    
    #reaction-time {
        font-size: 2rem;
    }
    
    #result-container {
        padding: 1.5rem;
    }
}
