/* ==========================================================================
   🐸 SDG6 青蛙村跳格子題 - 森林大自然風格樣式 (index.css)
   已整合 style.css 與全域導覽列樣式，移除所有內聯樣式
   ========================================================================== */
* { 
    box-sizing: border-box; 
    margin: 0; 
    padding: 0; 
}

body {
    margin: 0;
    padding: 0;
    /* 核心修改：每一頁都完美套用 bg01.png 背景圖（加上溫暖的羊皮紙遮罩） */
    background-image: linear-gradient(rgba(245, 242, 235, 0.85), rgba(245, 242, 235, 0.85)), url('../img/bg01.png');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    color: #3e2723; /* 深咖啡色字體，比純黑更溫柔 */
    font-size: var(--base-font-size, 19px);
    line-height: 1.8;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    /* 為頂部固定導覽列預留空間，防止內容被擋住 */
    padding-top: 95px; 
}

header {
    background-color: transparent; /* 改為透明，露出漂亮的背景底色 */
    padding: 15px 30px;
    display: flex;
    justify-content: center; /* 讓大標題置中 */
    align-items: center;
    z-index: 10;
    margin-bottom: 10px;
}

header h1 { 
    color: var(--wood-brown, #755229); 
    font-size: 2.2rem; 
    display: flex; 
    align-items: center; 
    gap: 10px; 
    text-shadow: 1px 1px 0px #ffffff;
    font-weight: bold;
}

/* ==========================================================================
   🧱 雙欄版面配置優化 (主遊戲區)
   ========================================================================== */
.main-wrapper {
    display: flex;
    flex: 1;
    height: calc(100vh - 120px);
    width: 100vw;
    gap: 20px;
    padding: 0 30px 30px 30px;
}

.left-panel {
    flex: 1.1;
    background-color: transparent; /* 移除死白背景，呈現自然風 */
    padding: 20px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    overflow-y: auto;
}

.right-panel {
    flex: 1;
    background-color: transparent; /* 移除死白背景 */
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* ==========================================================================
   🗺️ 5x5 地圖網格與格子樣式 (核心視覺修正)
   ========================================================================== */
#map-grid { 
    display: grid; 
    grid-template-columns: repeat(5, 1fr); 
    gap: 10px; 
    width: 460px; 
    height: 460px; 
    background-color: #6c584c; /* 原木泥土褐 */
    padding: 15px; 
    border-radius: 24px; 
    box-shadow: 0 8px 25px rgba(108, 88, 76, 0.3);
    margin-bottom: 20px;
    
}

/* 每個網格方塊 */
.cell { 
    display: flex; 
    flex-direction: column; 
    justify-content: center; 
    align-items: center; 
    font-size: 14px; 
    font-weight: bold; 
    /* 修正點：基礎格改為帶透明度的白，字體改深褐，解決文字隱形問題 */
    background-color: rgba(255, 255, 255, 0.75); 
    color: #3e2723; 
    border-radius: 12px; 
    position: relative; 
    text-shadow: 1px 1px 2px rgba(255, 255, 255, 0.8);
    border: 2px solid #b2dfdb;
    transition: all 0.2s ease;
}

/* 主角小青蛙樣式 */
.player { 
    font-size: 32px; 
    position: absolute; 
    top: 50%; 
    left: 50%; 
    transform: translate(-50%, -50%);
    animation: frogFloat 1s ease-in-out infinite alternate;
    z-index: 5;
}
@keyframes frogFloat {
    0% { transform: translate(-50%, -42%); }
    100% { transform: translate(-50%, -58%); }
}

/* ==========================================================================
   🎨 各生態單元配色與狀態同步 (加上 !important 確保顯色)
   ========================================================================== */
.NONE { 
    color: #3e2723; 
    background-color: rgba(255, 255, 255, 0.75) !important; 
}

/* 踩中或啟動時的全域作用 */
.cell.active {
    background-color: #4ba3e3 !important; /* 澄澈池塘藍 */
    color: #ffffff !important;
    text-shadow: none !important;
    box-shadow: inset 0 0 10px rgba(255,255,255,0.5);
}

.RESERVOIR { 
    background-color: #4ba3e3 !important; /* 翡翠湧泉：池塘藍 */
    color: #ffffff !important;
    text-shadow: none;
} 

.FARM { 
    background-color: #5c9c38 !important; /* 荷花田：活潑青蛙綠 */
    color: #ffffff !important;
    text-shadow: none;
} 

.FACTORY { 
    background-color: #f39c12 !important; /* 蘑菇磨坊：溫暖蘑菇橘 */
    color: #ffffff !important;
    text-shadow: none;
} 

.HOUSE { 
    background-color: #89c542 !important; /* 青蛙小屋：嫩荷葉綠 */
    color: #ffffff !important;
    text-shadow: none;
} 

.POLLUTION { 
    background-color: #2c3e50 !important; /* 劇毒泥潭：深沉泥潭黑 */
    color: #ffffff !important;
    text-shadow: none;
} 

.BROKEN_PIPE { 
    background-color: #b81d24 !important; /* 漏水乾涸地：樹莓警告紅 */
    color: #ffffff !important;
    text-shadow: none;
} 

.SAVE_VALVE { 
    background-color: #00f2fe !important; /* 省水葉片：魔力螢光青綠色 */
    color: #1b4332 !important; 
    text-shadow: none;
    box-shadow: 0 0 8px rgba(0, 242, 254, 0.6);
}

/* ==========================================================================
   📋 說明圖例與功能面板優化 (同步地圖視覺)
   ========================================================================== */
.legend { 
    display: flex; 
    flex-wrap: wrap; 
    justify-content: center; 
    gap: 15px; 
    font-size: 14px; 
    max-width: 550px;
    padding: 15px; 
    background: rgba(255, 255, 255, 0.8); 
    border-radius: 20px; 
    border: 2px solid #89c542; /* 嫩荷葉綠外框 */
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
}

.legend-item { 
    display: flex; 
    align-items: center; 
    gap: 8px; 
    font-weight: bold; 
    color: #3e2723; 
}

/* 圖例小圓點同步地圖方塊質感 */
.legend-item .dot { 
    width: 18px; 
    height: 18px; 
    border-radius: 50%; /* 改為正圓形小鈕扣 */
    display: inline-block; 
    border: 2px solid rgba(255, 255, 255, 0.6);
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

/* 圖例圓點顏色精準指定 */
.dot.RESERVOIR  { background-color: #4ba3e3; }
.dot.FARM       { background-color: #5c9c38; }
.dot.FACTORY    { background-color: #f39c12; }
.dot.HOUSE      { background-color: #89c542; }
.dot.POLLUTION  { background-color: #2c3e50; }
.dot.BROKEN_PIPE{ background-color: #b81d24; }
.dot.SAVE_VALVE { background-color: #00f2fe; box-shadow: 0 0 6px rgba(0, 242, 254, 0.5); }

/* 資訊卡片 */
.info-card {
    background: rgba(255, 255, 255, 0.85);
    padding: 22px;
    border-radius: 20px;
    border: 3px solid #5c9c38;
    box-shadow: 0 6px 15px rgba(92, 156, 56, 0.05);
}
.info-card h3 { 
    margin-bottom: 10px; 
    color: #755229; /* 橡木樁褐 */
    font-size: 18px; 
}
.info-card p, .info-card ul { 
    font-size: 15px; 
    color: #3e2723; 
    line-height: 1.7; 
}
.info-card ul { 
    padding-left: 20px; 
    margin-top: 8px; 
}

/* 即時狀態面板 */
.live-status-box {
    background: rgba(255, 255, 255, 0.85);
    border: 3px solid #5c9c38;
    border-radius: 20px;
    padding: 22px;
    box-shadow: 0 6px 15px rgba(92, 156, 56, 0.05);
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.live-status-box h4 {
    color: #755229;
    font-size: 16px;
    margin-bottom: 4px;
}
.status-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    background: #fbf7ed;
    padding: 12px;
    border-radius: 12px;
    border: 1px solid #edf2f7;
}
.status-item {
    font-size: 14px;
    color: #3e2723;
    font-weight: bold;
}
.status-item span {
    font-weight: 800;
    color: #4ba3e3;
}

.valve-status-wrapper {
    font-size: 14px;
    color: #3e2723;
    background: #edf7ed;
    padding: 10px 14px;
    border-radius: 10px;
    font-weight: bold;
    border: 1px dashed #89c542;
}
#live-valve {
    font-weight: 800;
    color: #5c9c38;
}
.active-valve {
    color: #38a169 !important;
    animation: valvePulse 1.5s infinite;
}
@keyframes valvePulse {
    0% { opacity: 0.7; }
    50% { opacity: 1; }
    100% { opacity: 0.7; }
}

/* 胖嘟嘟木頭重置按鈕 */
.btn-reset-game {
    display: block;
    width: 100%;
    padding: 12px;
    font-size: 1.1rem;
    font-weight: bold;
    border-radius: 25px;
    border: none;
    border-bottom: 4px solid #6b421e;
    color: white;
    background: #755229; /* 橡木樁褐 */
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    margin-top: 10px;
    text-align: center;
}
.btn-reset-game:hover {
    background-color: #89c542; /* 嫩荷葉綠 */
    border-bottom: 4px solid #5c9c38;
    transform: translateY(-2px);
}
.btn-reset-game:active {
    transform: translateY(1px);
    border-bottom-width: 1px;
}
#game-message {
    padding: 18px;
    border-radius: 16px;
    font-weight: bold;
    font-size: 15px;
    line-height: 1.6;
    display: none; 
    white-space: pre-line; 
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}
.msg-success {
    background-color: #d8f3dc;
    color: #1b4332;
    border: 2px solid #52b788;
}
.msg-danger {
    background-color: #fde2e4;
    color: #5c0d12;
    border: 2px solid #ffb3c1;
}
