body { margin: 0; background-color: #1a1a1a; color: white; font-family: sans-serif; }
canvas { display: block; }
.hidden { display: none !important; }

#info { position: absolute; top: 10px; width: 100%; text-align: center; z-index: 100; font-size: 24px; pointer-events: none; }
#reset-button { position: absolute; top: 50px; left: 50%; transform: translateX(-50%); padding: 10px 20px; font-size: 16px; cursor: pointer; z-index: 100; }

#setup-modal-backdrop { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(0, 0, 0, 0.7); display: flex; justify-content: center; align-items: center; z-index: 200; }
#setup-modal { background-color: #2c2c2c; padding: 20px 40px; border-radius: 8px; text-align: center; }

#color-picker { display: flex; justify-content: center; gap: 15px; margin: 20px 0; }
.color-btn { width: 50px; height: 50px; border-radius: 50%; border: 3px solid #fff; cursor: pointer; transition: transform 0.2s; }
.color-btn:hover { transform: scale(1.1); }
.color-btn[data-color="e74c3c"] { background-color: #e74c3c; }
.color-btn[data-color="f1c40f"] { background-color: #f1c40f; }
.color-btn[data-color="2ecc71"] { background-color: #2ecc71; }
.color-btn[data-color="3498db"] { background-color: #3498db; }

.color-btn.selected { border-color: #f1c40f; box-shadow: 0 0 15px #f1c40f; transform: scale(1.1); }
.color-btn:disabled { opacity: 0.3; cursor: not-allowed; transform: none; }

#waiting-message { font-size: 16px; min-height: 24px; }
/* ... (保留原本的 css) ... */
/* Lobby Styles */
/* 全局重置與基礎字體 */
body {
    margin: 0;
    background-color: #121212; /* 更深的背景色 */
    color: #e0e0e0;
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    overflow: hidden;
}

.hidden { display: none !important; }

/* --- 容器佈局 --- */
#lobby-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100vh;
    width: 100%;
    background: radial-gradient(circle at center, #2a2a2a 0%, #121212 100%); /* 背景漸層 */
}

/* --- 登入卡片與共用面板樣式 --- */
#login-screen, #room-selection-screen {
    background: #1e1e1e;
    padding: 40px;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    border: 1px solid #333;
    text-align: center;
    transition: all 0.3s ease;
}

#login-screen {
    width: 320px;
}

#room-selection-screen {
    width: 80%;
    max-width: 1000px;
    height: 80vh;
    display: flex;
    flex-direction: column;
}

/* --- 輸入框與按鈕優化 --- */
h1, h2 { margin-top: 0; font-weight: 600; letter-spacing: 1px; }

input[type="text"] {
    padding: 12px 15px;
    margin: 20px 0;
    width: 85%;
    background: #2c2c2c;
    border: 1px solid #444;
    border-radius: 8px;
    color: white;
    font-size: 16px;
    outline: none;
    transition: border-color 0.2s;
}
input[type="text"]:focus { border-color: #3498db; }

button {
    padding: 12px 24px;
    border-radius: 8px;
    border: none;
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.1s, box-shadow 0.2s;
    box-shadow: 0 4px 6px rgba(0,0,0,0.2);
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0,0,0,0.3);
}
button:active { transform: translateY(0); }
button:disabled {
    background: #555;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* --- 大廳頭部 --- */
.lobby-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 1px solid #333;
}

#create-room-btn {
    background: linear-gradient(135deg, #2ecc71, #27ae60); /* 綠色按鈕 */
}

/* --- 房間列表：Grid 佈局 (卡片式) --- */
#room-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); /* 自動填滿，最小寬度250px */
    gap: 20px;
    overflow-y: auto;
    padding: 10px;
    flex-grow: 1; /* 佔滿剩餘高度 */
}

/* 滾動條樣式 */
#room-list::-webkit-scrollbar { width: 8px; }
#room-list::-webkit-scrollbar-track { background: #1e1e1e; }
#room-list::-webkit-scrollbar-thumb { background: #444; border-radius: 4px; }

/* --- 單個房間卡片樣式 --- */
.room-card {
    background: #2c2c2c;
    border-radius: 12px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
    border: 1px solid #3a3a3a;
    transition: transform 0.2s, border-color 0.2s;
    min-height: 140px;
}

.room-card:hover {
    transform: translateY(-5px);
    border-color: #3498db;
    box-shadow: 0 10px 20px rgba(0,0,0,0.4);
}

.room-info h3 {
    margin: 0 0 5px 0;
    font-size: 20px;
    color: #fff;
}

.room-info p {
    margin: 0;
    color: #aaa;
    font-size: 14px;
}

.room-status-badge {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(52, 152, 219, 0.2);
    color: #3498db;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: bold;
}

.room-join-btn {
    margin-top: 15px;
    width: 100%;
    background: #3a3a3a; /* 預設低調 */
}
.room-card:hover .room-join-btn {
    background: linear-gradient(135deg, #3498db, #2980b9); /* hover時變亮 */
}

/* 錯誤訊息 */
.error { color: #e74c3c; margin-top: 10px; font-size: 14px; }

/* --- 等待室覆蓋層 (保持簡潔) --- */
#waiting-room-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.85); z-index: 150;
    display: flex; justify-content: center; align-items: center;
    backdrop-filter: blur(5px); /* 毛玻璃效果 */
}
.modal {
    background: #2c2c2c; padding: 40px; border-radius: 16px;
    text-align: center; min-width: 350px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.6);
}
.player-tag {
    background: #3498db; color: #fff;
    padding: 8px 16px; border-radius: 20px;
    margin: 10px 5px; display: inline-block; font-weight: bold;
}
.secondary-btn { background: transparent; border: 1px solid #e74c3c; color: #e74c3c; }
.secondary-btn:hover { background: #e74c3c; color: white; }

/* Setup Modal Backdrop (選色) */
#setup-modal-backdrop {
    /* ... (保持不變) ... */
    background-color: rgba(0, 0, 0, 0.8);
    display: flex; justify-content: center; align-items: center;
    z-index: 200;
}
#setup-modal { background-color: #2c2c2c; padding: 30px; border-radius: 12px; text-align: center; }
#color-picker { display: flex; justify-content: center; gap: 15px; margin: 20px 0; }

.color-btn { 
    width: 50px; 
    height: 50px; 
    border-radius: 50%; 
    border: 3px solid #fff; 
    cursor: pointer; 
    transition: transform 0.2s; 
    padding: 0; 
    
    /* === 修正點：重設背景，避免被通用 button 的藍色漸層覆蓋 === */
    background: none; 
    
}
.color-btn:hover { transform: scale(1.1); }

/* 下方的 [data-color] 樣式保持不變，它們將會正確地應用背景色 */
.color-btn[data-color="e74c3c"] { background-color: #e74c3c; }
.color-btn[data-color="f1c40f"] { background-color: #f1c40f; }
.color-btn[data-color="2ecc71"] { background-color: #2ecc71; }
.color-btn[data-color="3498db"] { background-color: #3498db; }
/* --- Audio Control Styles (請加入到您的 style.css 中) --- */
#audio-controls {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 300; /* 確保在所有 UI 元素之上 */
    background: rgba(44, 44, 44, 0.8);
    backdrop-filter: blur(4px);
    padding: 10px 15px;
    border-radius: 10px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    color: #e0e0e0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.volume-slider-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

#audio-controls label {
    font-size: 14px;
    min-width: 50px;
}

/* 簡化的拉條樣式，確保在各種瀏覽器中可用 */
input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 120px;
    height: 4px;
    background: #555;
    border-radius: 5px;
    outline: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 12px;
    height: 12px;
    background: #3498db;
    border-radius: 50%;
    cursor: pointer;
}
/* --- 版權資訊樣式 (加入到 style.css) --- */
#license-info {
    position: fixed;
    left: 20px;
    bottom: 20px;
    z-index: 300; /* 確保在 canvas 頂部 */
    color: rgba(255, 255, 255, 0.5); /* 半透明文字 */
    font-size: 12px;
    background: rgba(0, 0, 0, 0.4);
    padding: 8px;
    border-radius: 5px;
    pointer-events: none; /* 讓滑鼠點擊可以穿透 */
    line-height: 1.5;
}
/* --- Game View UI Layout --- */
#game-controls-panel {
    position: absolute;
    top: 100px; /* 位於 #info 和 #reset-button 下方 */
    right: 20px;
    z-index: 100;
    width: 200px;
    padding: 15px;
    background: rgba(44, 44, 44, 0.7);
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

#instructions h3 {
    margin-top: 0;
    color: #3498db;
    border-bottom: 1px solid #555;
    padding-bottom: 5px;
    margin-bottom: 10px;
}

#instructions ul {
    list-style: none;
    padding: 0;
    margin-bottom: 20px;
    font-size: 14px;
}

#instructions li {
    margin-bottom: 5px;
    color: #e0e0e0;
}

#game-action-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* 投降按鈕使用紅色警示 */
#surrender-button { 
    background: linear-gradient(135deg, #e74c3c, #c0392b); /* 紅色漸變 */
}

/* 離開按鈕使用次要/低調風格 */
#leave-game-button {
    background: #3a3a3a; /* 深灰色 */
}

/* 玩家編號顯示 (底部) */
#player-id-display {
    position: fixed;
    left: 20px;
    bottom: 110px; /* 位於 License 資訊上方 */
    z-index: 300;
    font-size: 16px;
    font-weight: bold;
    color: #f1c40f; /* 黃色強調 */
    background: rgba(44, 44, 44, 0.7);
    padding: 5px 10px;
    border-radius: 5px;
}   