/* styles.css - 基本樣式 */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #2a6cd4;
    --secondary-color: #333;
    --danger-color: #ff4444;
    --success-color: #00ff00;
    --warning-color: #ffd700;
    --text-color: #ffffff;
    --background-color: #1a1a1a;
    --ui-background: rgba(0, 0, 0, 0.7);
    --ui-hover: rgba(80, 80, 80, 0.8);
}

body {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
    background: var(--background-color);
    font-family: Arial, sans-serif;
    overflow: hidden;
    color: var(--text-color);
}

#gameContainer {
    position: relative;
    width: 100vw;
    height: 100vh;
}

#effectsContainer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 50;
}

#uiOverlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 100;
}

#statusBar {

    display: flex;
    gap: 20px;
    background: var(--ui-background);
    padding: 10px 15px;
    border-radius: 5px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    z-index: 101;
    align-items: center;
}

#healthBar, #weaponDisplay, #stats {
    font-size: 16px;
}

#healthBar span { color: var(--danger-color); font-weight: bold; }
#weaponDisplay span { color: var(--warning-color); font-weight: bold; }
#stats span { color: var(--success-color); font-weight: bold; }

#fullscreenBtnContainer { margin-left: auto; pointer-events: auto; }

#fullscreenBtn {
    padding: 4px 10px;
    background: var(--secondary-color);
    border: none;
    border-radius: 5px;
    color: var(--text-color);
    cursor: pointer;
    font-size: 14px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

#fullscreenBtn:hover { background: var(--ui-hover); }

#gameOverScreen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    pointer-events: auto;
    z-index: 999;
}

#gameOverScreen.hidden { display: none; }

#gameOverScreen h1 {
    font-size: 48px;
    color: var(--danger-color);
    margin-bottom: 20px;
}

#gameStats {
    background: var(--ui-background);
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 30px;
    min-width: 300px;
    text-align: center;
}

#gameStats p { margin: 10px 0; font-size: 18px; }
#gameStats span { font-weight: bold; color: var(--warning-color); }

#restartBtn {
    padding: 12px 30px;
    font-size: 20px;
    background: var(--primary-color);
    border: none;
    border-radius: 5px;
    color: var(--text-color);
    cursor: pointer;
}

#restartBtn:hover { background: #3a7ce5; }

/* 載入畫面的主容器樣式 */
#loadingScreen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 998;
    pointer-events: auto;
}

#startScreenControls {
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
}

/* 左右面板的 flexbox 容器 */
.loading-screen-container {
    display: flex;
    flex-direction: row;
    gap: 30px;
    align-items: stretch;
}

/* 左側面板: 遊戲簡介 */
.left-panel {
    flex: 1;
    max-width: 50%;
}

/* 右側面板: 玩家資訊和陣營選擇 */
.right-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    background: rgba(30, 30, 30, 0.7);
    border-radius: 8px;
    padding: 20px;
}

/* 遊戲故事面板 */
.game-story {
    background: rgba(20, 20, 20, 0.8);
    border-radius: 8px;
    padding: 25px;
    margin: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.game-story h3 {
    color: #64c8ff;
    font-size: 28px;
    margin-bottom: 20px;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 2px;
    text-shadow: 0 0 10px rgba(100, 200, 255, 0.5);
    border-bottom: 2px solid #64c8ff;
    padding-bottom: 15px;
}

.game-story p {
    margin: 12px 0;
    font-size: 14px;
    line-height: 1.7;
    color: #eee;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}

/* 名稱輸入區塊 */
.name-input-section {
    margin-bottom: 25px;
}

.name-input-section h4 {
    color: #fff;
    margin-bottom: 15px;
    font-size: 22px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

#playerNameInput {
    width: 100%;
    padding: 12px 15px;
    font-size: 16px;
    border: 2px solid #2a6cd4;
    border-radius: 5px;
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    outline: none;
    transition: all 0.3s ease;
    box-shadow: 0 0 10px rgba(42, 108, 212, 0.3);
}

#playerNameInput:focus {
    border-color: #64c8ff;
    box-shadow: 0 0 15px rgba(100, 200, 255, 0.5);
}

/* 陣營選擇區塊 */
.faction-selection {
    margin-bottom: 25px;
}

.faction-selection h4 {
    color: #fff;
    margin-bottom: 15px;
    font-size: 22px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.faction-options {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
}

.faction-option {
    background: rgba(0, 0, 0, 0.7);
    border: 2px solid #444;
    border-radius: 8px;
    padding: 15px;
    flex: 1;
    cursor: pointer;
    transition: all 0.3s ease;
}

.faction-option:hover {
    transform: translateY(-5px);
    border-color: #666;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.faction-option.selected {
    border-color: var(--primary-color);
    box-shadow: 0 0 15px var(--primary-color);
}

#human-faction.selected {
    border-color: #64c8ff;
    box-shadow: 0 0 15px #64c8ff;
}

#mutant-faction.selected {
    border-color: #ff4444;
    box-shadow: 0 0 15px #ff4444;
}

.faction-icon {
    width: 60px;
    height: 60px;
    margin: 0 auto 10px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.faction-name {
    font-weight: bold;
    font-size: 18px;
    color: #fff;
    margin-bottom: 10px;
    text-align: center;
}

.faction-description {
    font-size: 14px;
    color: #ccc;
    line-height: 1.4;
    text-align: center;
}

/* 送出按鈕容器 */
.submit-button-container {
    text-align: center;
    margin-top: auto;
    padding-top: 15px;
}

#submitNameBtn {
    padding: 14px 30px;
    font-size: 18px;
    background: linear-gradient(to bottom, #2a6cd4, #1a5cb4);
    border: none;
    border-radius: 8px;
    color: #fff;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: bold;
    transition: all 0.3s ease;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    min-width: 200px;
}

#submitNameBtn:hover {
    background: linear-gradient(to bottom, #3a7ce5, #2468cc);
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.4);
}

#submitNameBtn:active {
    transform: translateY(1px);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.4);
}

#securityWarning {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 0, 0, 0.8);
    padding: 15px 30px;
    border-radius: 5px;
    font-size: 18px;
    font-weight: bold;
    color: white;
    z-index: 400;
}

#securityWarning.hidden { display: none; }

#controlsBtn {

    padding: 8px 12px;
    background: var(--secondary-color);
    border: none;
    border-radius: 50%;
    color: var(--text-color);
    cursor: pointer;
    font-size: 18px;
    width: 40px;
    height: 40px;
    z-index: 403;
    pointer-events: auto;
}

#controlsBtn:hover { background: var(--ui-hover); }

#controlsPanel {
    background: var(--ui-background);
    padding: 15px;
    border-radius: 8px;
    text-align: left;
}

#controlsPanel.hidden { display: none; }

#controlsPanel h3 {
    font-size: 18px;
    margin-bottom: 10px;
    color: var(--primary-color);
}

#controlsPanel ul { list-style-type: none; padding: 0; }
#controlsPanel li { margin-bottom: 8px; font-size: 14px; }
#controlsPanel li strong { color: var(--warning-color); }

#controlsPanel button {
    display: block;
    margin: 15px auto 0;
    padding: 6px 12px;
    background: var(--primary-color);
    border: none;
    border-radius: 5px;
    color: var(--text-color);
    cursor: pointer;
}

#controlsPanel button:hover { background: #3a7ce5; }

.desktop-only{
    display: block;
}
.mobile-only{
    display: none;
}

@media (max-width: 768px) {
    #statusBar { flex-direction: column; gap: 10px; top: 5px; right: 5px; }
    .desktop-only{
        display: none;
    }
    .mobile-only{
        display: block;
    }
    #gameOverScreen h1 { font-size: 36px; }
    #gameStats { min-width: 250px; }

    /* 手機版的武器欄調整 */
    .weapons-container {
        bottom: 80px;
        right: 10px;
        padding: 5px;
        gap: 5px;
    }

    .weapon-slot {
        width: 40px;
        height: 40px;
    }

    .weapon-icon {
        width: 25px;
        height: 25px;
    }


}

/* 響應式佈局 */
@media (max-width: 900px) {
    .loading-screen-container {
        flex-direction: column;
        gap: 20px;
    }

    .left-panel, .right-panel {
        max-width: 100%;
    }

    .game-story {
        padding: 15px;
    }

    .game-story h3 {
        font-size: 24px;
    }

    .game-story p {
        font-size: 14px;
    }

    .name-input-section h4, .faction-selection h4 {
        font-size: 20px;
    }
}

@media (max-width: 600px) {
    .faction-options {
        flex-direction: column;
    }

    #submitNameBtn {
        width: 100%;
        padding: 12px;
        font-size: 16px;
    }
}

/* ===== 全局樣式增強 ===== */
:root {
    --primary-color: #2a6cd4;
    --secondary-color: #333;
    --danger-color: #ff4444;
    --success-color: #00ff00;
    --warning-color: #ffd700;
    --text-color: #ffffff;
    --background-color: #1a1a1a;
    --ui-background: rgba(0, 0, 0, 0.7);
    --ui-hover: rgba(80, 80, 80, 0.8);
    --accent-blue: #64c8ff;
    --accent-orange: #ff8800;
}

body {
    font-family: 'Arial', sans-serif;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5); /* 添加文字陰影 */
}

/* ===== 列表排列整齊樣式 ===== */
#controlsPanel ul,
#startScreenControls ul {
    list-style-type: none;
    padding: 0;
    margin: 0 0 15px 0;
    width: 100%;
    border-radius: 5px;
    overflow: hidden; /* 保持圓角邊框 */
    background-color: rgba(0, 0, 0, 0.3);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

#controlsPanel li,
#startScreenControls li {
    margin: 0; /* 移除外邊距 */
    padding: 8px 10px;
    display: flex;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    transition: background-color 0.2s ease;
}

#controlsPanel li:hover,
#startScreenControls li:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

#controlsPanel li:last-child,
#startScreenControls li:last-child {
    border-bottom: none;
}

#controlsPanel li strong,
#startScreenControls li strong {
    color: var(--accent-blue);
    min-width: 100px;
    display: inline-block;
    text-align: right;
    margin-right: 15px;
    flex-shrink: 0;
    font-weight: 600;
}

#controlsPanel li span,
#startScreenControls li span {
    flex-grow: 1;
    color: #eee;
}

#controlsPanel li::before,
#startScreenControls li::before {
    content: '';
    width: 6px;
    height: 6px;
    background-color: var(--accent-blue);
    border-radius: 50%;
    margin-right: 10px;
    display: inline-block;
    flex-shrink: 0;
}

#controlsPanel li:nth-child(odd),
#startScreenControls li:nth-child(odd) {
    background-color: rgba(255, 255, 255, 0.03);
}

/* 標題樣式 */
#controlsPanel h3,
#startScreenControls h3 {
    text-align: center;
    margin: 5px 0 15px 0;
    padding-bottom: 10px;
    color: var(--accent-blue);
    border-bottom: 2px solid var(--accent-blue);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 16px;
    font-weight: 600;
}

/* 面板容器樣式 */
#controlsPanel,
#startScreenControls {
    background-color: rgba(0, 0, 0, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 15px;
    margin: 0 auto;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
}

/* ===== 按鈕樣式增強 ===== */
button {
    background: linear-gradient(to bottom, var(--primary-color), #1a5cb4);
    border: none;
    border-radius: 5px;
    color: var(--text-color);
    padding: 8px 15px;
    cursor: pointer;
    font-weight: bold;
    letter-spacing: 0.5px;
    transition: all 0.2s ease;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    outline: none;
    text-transform: uppercase;
    font-size: 14px;
}

button:hover {
    background: linear-gradient(to bottom, #3a7ce5, #2468cc);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

button:active {
    transform: translateY(1px);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

#submitNameBtn, #restartBtn {
    display: block;
    margin: 15px auto 20px;
    min-width: 120px;
}

/* ===== 武器選擇器增強 ===== */
.weapons-container {
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 10px;
    gap: 8px;
}

.weapon-slot {
    background: rgba(40, 40, 40, 0.9);
    border: 2px solid #555;
    border-radius: 8px;
    transition: all 0.3s ease;
    overflow: hidden;
}

.weapon-slot.active {
    border-color: var(--warning-color);
    box-shadow: 0 0 12px var(--warning-color);
    transform: scale(1.1);
}

.weapon-slot:not(.empty):hover {
    background: rgba(60, 60, 60, 0.9);
    transform: translateY(-4px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

@keyframes weaponSwitch {
    0% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-10px) scale(1.1); }
    100% { transform: translateY(0) scale(1); }
}

.weapon-slot.switching {
    animation: weaponSwitch 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* ===== 狀態欄樣式增強 ===== */
#statusBar {
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.9), rgba(20, 20, 20, 0.8));
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 12px 15px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.4);
}

#healthBar span {
    color: var(--danger-color);
    font-weight: bold;
    text-shadow: 0 0 5px rgba(255, 0, 0, 0.5);
}

#weaponDisplay span {
    color: var(--warning-color);
    font-weight: bold;
    text-shadow: 0 0 5px rgba(255, 215, 0, 0.5);
}

#stats span {
    color: var(--success-color);
    font-weight: bold;
    text-shadow: 0 0 5px rgba(0, 255, 0, 0.5);
}

/* ===== 遊戲結束界面增強 ===== */
#gameOverScreen {
    background: radial-gradient(circle, rgba(0, 0, 0, 0.7) 0%, rgba(0, 0, 0, 0.9) 100%);
}

#gameOverScreen h1 {
    font-size: 52px;
    color: var(--danger-color);
}

@keyframes pulsate {
    0% { opacity: 0.7; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.05); }
    100% { opacity: 0.7; transform: scale(1); }
}

#gameStats {
    background: rgba(0, 0, 0, 0.8);
    padding: 25px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
    min-width: 300px;
}

#gameStats p {
    margin: 15px 0;
    font-size: 18px;
    display: flex;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 10px;
}

#gameStats p:last-child {
    border-bottom: none;
}

#gameStats span {
    font-weight: bold;
    color: var(--warning-color);
    text-shadow: 0 0 5px rgba(255, 215, 0, 0.5);
}

#restartBtn {
    font-size: 20px;
    padding: 12px 30px;
    background: linear-gradient(to bottom, #ff3333, #cc0000);
    border-radius: 8px;
    margin-top: 25px;
    letter-spacing: 1px;
}

#restartBtn:hover {
    background: linear-gradient(to bottom, #ff5555, #ff0000);
}

/* 為陣營標誌添加顏色 */
#human-faction .faction-name {
    color: #64c8ff;
}

#mutant-faction .faction-name {
    color: #ff4444;
}

.faction-icon.human {
    background: #64c8ff;
    position: relative;
}



.faction-icon.mutant {
    background: #ff4444;
    position: relative;
}

@media (max-width: 768px) {
    #statusBar{
        flex-direction: unset;
    }
    #fullscreenBtnContainer{
        display: none;
    }
    #startScreenControls{
        overflow: auto;
        width: 100%;
        max-width: 100vw;
    }
}