/* =========================================
   1. 規則說明區
   ========================================= */
.rule-box {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 30px;
}

.rule-box h3 {
    margin-top: 0;
    color: var(--primary-gold, #fbb750);
    margin-bottom: 15px;
    font-size: 1.2rem;
    border-bottom: 1px dashed rgba(255, 255, 255, 0.1);
    padding-bottom: 10px;
}

/* 顏色工具 */
.text-green { color: #81c784; }
.text-red { color: #ff5252; }
.text-blue { color: #64b5f6; }
.text-gold { color: #ffd700; }
.text-gray { color: #888; }
.highlight { color: #ffd700; font-weight: bold; }

/* =========================================
   2. 機率表 & 加成表 (電腦版)
   ========================================= */
.wiki-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.wiki-table th {
    background: rgba(0, 0, 0, 0.5);
    white-space: nowrap;
    padding: 12px 10px;
    font-size: 0.9rem;
    color: #aaa;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.wiki-table td {
    vertical-align: middle;
    padding: 12px 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.scroll-name, .tier-name {
    font-weight: bold;
    color: #fff;
    text-align: left;
}

.scroll-name i { margin-right: 8px; color: var(--primary-gold, #fbb750); }

.rate-val {
    color: #81c784;
    font-weight: bold;
    font-family: monospace;
    font-size: 1rem;
    text-align: center;
}

.tier-bonus { color: #ffcc80; }

.link-btn.small {
    display: inline-block;
    padding: 4px 10px;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    text-decoration: none;
    border-radius: 4px;
    font-size: 0.85rem;
    transition: 0.2s;
}
.link-btn.small:hover { background: var(--primary-gold, #fbb750); color: #000; }

/* =========================================
   3. RWD 手機版優化 (轉為卡片式列表)
   ========================================= */
@media (max-width: 768px) {
    
    /* --- 通用：隱藏表頭 --- */
    .wiki-table thead {
        display: none;
    }

    /* --- 通用：表格元素區塊化 --- */
    .wiki-table, .wiki-table tbody, .wiki-table tr, .wiki-table td {
        display: block;
        width: 100%;
    }

    /* --- 通用：每一列變成一張卡片 --- */
    .wiki-table tr {
        margin-bottom: 20px;
        background: rgba(255, 255, 255, 0.03);
        border: 1px solid rgba(255, 255, 255, 0.1);
        border-radius: 8px;
        overflow: hidden;
    }

    /* --- 機率表樣式 --- */
    /* 第一格 (卷軸名稱) */
    .rate-table td.scroll-name {
        background: rgba(0, 0, 0, 0.4);
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        padding: 12px 15px;
        font-size: 1.1rem;
        color: var(--primary-gold, #fbb750);
        text-align: center;
    }

    /* 數據格 (Flex 左右排列) */
    .rate-table td.rate-val {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 10px 15px;
        border-bottom: 1px solid rgba(255, 255, 255, 0.05);
        text-align: right;
    }

    /* 利用 data-label 顯示左側標題 */
    .rate-table td.rate-val::before {
        content: attr(data-label);
        font-weight: normal;
        color: #aaa;
        font-size: 0.95rem;
    }

    /* --- 加成表樣式 --- */
    .bonus-table td {
        padding: 10px 15px;
        border-bottom: 1px solid rgba(255, 255, 255, 0.05);
        display: flex;
        justify-content: space-between;
        align-items: center;
    }
    
    .bonus-table td::before {
        content: attr(data-label);
        font-weight: normal;
        color: #888;
        font-size: 0.9rem;
        margin-right: 15px;
        min-width: 80px; /* 標題固定寬度 */
    }

    .bonus-table td.tier-name {
        background: rgba(0, 0, 0, 0.2);
        color: var(--primary-gold, #fbb750);
        font-size: 1rem;
        border-bottom: 1px solid rgba(255,255,255,0.1);
    }
    
    /* 隱藏重複的 data-label (例如標題已經是階級名稱了) */
    .bonus-table td.tier-name::before { display: none; }
    
    /* 最後一格去底線 */
    .wiki-table td:last-child { border-bottom: none; }
}