
#ziwei-container{
    margin-top: 20px;display: flex;flex-direction: column;align-items: center;
}
    /* 命盤 Grid 容器：4欄 x 4列 */
    .chart-grid {
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        grid-template-rows: repeat(4, 1minmax(120px, auto)); /* 最小高度 */
        gap: 5px;
        max-width: 800px;
        margin: 0 auto;
        border: none;
        background-color: #fdf5e6; /* 米色底 */
        padding: 5px;
    }

    /* 單一宮位格子 */
    .palace-box {
        border: 1px solid #8d6e63;
        padding: 5px;
        position: relative;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        background-color: #fff;
        font-size: 14px;
        width: 120px;
        height: 120px;
    }

    /* 命盤中間的大空位 (中宮) */
    .center-zone {
        grid-column: 2 / 4; /* 跨越第2到第3欄 */
        grid-row: 2 / 4;    /* 跨越第2到第3列 */
        border: none;
        background-color: transparent;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        text-align: center;
        padding: 10px;
    }

    /* 宮位名稱 (如：命宮) - 右下角 */
    .palace-name {
        position: absolute;
        top: 5px;
        right: 5px;
        font-weight: bold;
        color: var(--main-font-color);
        font-size: 1.1em;
    }

    /* 干支 (如：戊子) - 左下角 */
    .palace-ganzhi {
        position: absolute;
        bottom: 5px;
        left: 5px;
        color: #888;
        font-size: 0.9em;
        display: flex;
        flex-direction:column;
        align-items:flex-end;
    }

    /* 主星 (紅色) - 左上 */
    .major-stars {
        color: rgb(216, 67, 21);
        display: flex;
        flex-direction: column; /* 直排或橫排看需求 */
    }
    
    /* 輔星 (藍色) */
    .minor-stars {
        color: var(--active-green);
        font-size: 1rem;
        margin-top: 2px;
        display:flex; flex-direction: column;
    }

    /* 煞星 (灰色或深色) */
    .bad-stars {
        color: #424242;
        font-size: 1rem;
        display:flex; flex-direction: column;
    }
    
    /* 四化標記 (祿權科忌) */
    .hua-tag {
        background-color: #e91e63;
        color: white;
        border-radius: 50%;
        padding: 1px 3px;
        font-size: 0.7em;
        margin-left: 2px;
    }

    /*Google Ads*/
    /* Loading Modal */
    .ad-modal-overlay {
        position: fixed; top: 0; left: 0; width: 100%; height: 100%!important;
        background: rgba(0,0,0,0.8); z-index: 1000;
        display: flex; justify-content: center; align-items: center;
    }
    .ad-modal-content {
        background: white; padding: 30px; border-radius: 12px;
        width: 90%; max-width: 500px; text-align: center;
    }

    /* 命盤 Grid */
    .chart-grid {
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        grid-template-rows: repeat(4, 1minmax(130px, auto));
        gap: 5px;
        background-color: #fdf5e6;
        /*
        border: 2px solid #8d6e63;
        padding: 5px;*/
        margin: 2rem auto;
    }
    /* 手機版 RWD: 變成單欄 */
    @media (max-width: 768px) {
        .chart-grid { display: none; flex-direction: column; }
        .palace-box { min-height: auto; border-bottom: 1px dashed #ccc; }
        .center-zone { order: -1; border-bottom: 2px solid #8d6e63; margin-bottom: 10px;}
    }

    /* 單一宮位 */
    .palace-box {
        border: 1px solid #d7ccc8;
        background: #fff;
        padding: 5px;
        position: relative;
        font-size: 14px;
        display: flex; flex-direction: column; justify-content: space-between;
    }
    .center-zone {
        grid-column: 2 / 4; grid-row: 2 / 4; /* 跨欄置中 */
        display: flex; flex-direction: column; 
        justify-content: center; align-items: center;
        background: transparent; border: none;
    }
    .major-stars { color: #c62828; font-weight: bold; }
    .minor-stars { color: #1565c0; font-size: 0.9em; }
    .bad-stars { color: #424242; font-size: 0.85em; }
    .palace-name { position: absolute; bottom: 5px; right: 5px; font-weight: bold; color: #e65100; font-size: 1.1em; }
    .palace-ganzhi { position: absolute; bottom: 5px; left: 5px; color: #999; font-size: 0.9em; }
    .hua-tag { background: #e91e63; color: white; font-size: 0.75em; border-radius: 4px; padding: 0 2px; margin-left: 2px; }

    /* AI 文章樣式 */
    .fate-intro-container {
        background: #fff; padding: 25px; 
        border-radius: 15px; box-shadow: 0 4px 15px rgba(0,0,0,0.05);
        width: 70% ; 
    }
    .intro-title { text-align: center; color: #4a148c; margin-bottom: 30px; }
    .intro-section { margin-bottom: 40px; }
    .intro-section h3 { border-bottom: 2px solid #eee; padding-bottom: 10px; margin-bottom: 15px; color: var(--hight-font-color); }
    .point-card {
        background: #f3e5f5; padding: 15px; border-radius: 8px; margin-bottom: 10px;
    }
    .point-card h5 { color: #7b1fa2; margin: 0 0 5px 0; font-size: 1.05em; }
    .conclusion { background: #fff3e0; padding: 20px; border-radius: 10px; border-left: 5px solid #ff9800; }
    /* 手機版 RWD: 變成單欄顯示，方便閱讀 */
    @media (max-width: 600px) {
        .chart-grid {
            display: none; /* 取消 Grid */
        }
        .palace-box {
            margin-bottom: 10px;
            min-height: auto;
            border: 1px solid #ccc;
        }
        .center-zone {
            display: block;
            margin-bottom: 20px;
            border-bottom: 2px dashed #ccc;
        }
        .palace-name, .palace-ganzhi {
            position: static; /* 手機版不絕對定位 */
            display: inline-block;
            margin-right: 10px;
        }
    }
