/* 全局樣式 */
:root {
    --primary-color: #afafaf; /* 主要文字顏色 */
    --navbar-bg: #300000; /* 導航欄背景色 */
    --highlight-color: #c8b478; /* 高亮顏色 */
    --button-color: #800000c0; /* 按鈕預設紅色 */
    --button-hover-color: #3e8e41; /* 懸停時綠色 */
}

body {
    font-family: 'Microsoft YaHei', 'Noto Sans CJK SC', sans-serif;
    background-color: #1a1a1a;
    color: #d6d6d6;
    margin: 0;
    padding: 20px;
    line-height: 1.6;
}

/* 標題樣式 */
h3 {
    text-align: center;
    color: #d6d6d6;
    margin: 20px 0;
}

/* 表格樣式 */
table {
    margin: 0 auto;
    border-collapse: collapse;
    background-color: #000000;
    color: #d6d6d6;
    border: 2px solid #000000;
}

/* 表格單元格樣式 */
td {
    padding: 15px;
    text-align: center;
    vertical-align: middle;
    border: 2px solid #000000;
}

/* 黑色背景的單元格 */
td[bgcolor="#181818"] {
    background-color: #181818;
}

/* 紅色背景的單元格 */
td[bgcolor="#300000"] {
    background-color: #300000;
}

/* 文字顏色 */
font[color="orange"] {
    color: #ff8c00;
}

/* 按鈕篩選樣式 */
.btn-group {
    width: 100%; /* 確保按鈕組滿寬 */
}

.btn-group button {
    background-color: #252525; /* 綠色背景 */
    border: 1px solid black; /* 綠色邊框 */
    color: white; /* 白文字 */
    padding: 10px 24px; /* 與範例一致的內距 */
    cursor: pointer; /* 手型游標 */
    float: left; /* 水平排列 */
    font-size: 0.875rem; /* 保持原字體大小 */
    transition: background-color 0.2s ease; /* 懸停平滑過渡 */
}

.btn-group:after {
    content: "";
    clear: both;
    display: table; /* 清除浮動 */
}

.btn-group button:not(:last-child) {
    border-right: none; /* 防止雙邊框 */
}

/* 懸停效果 */
.btn-group button:hover {
    background-color: #3e8e41; /* 懸停變深綠色 */
}

.btn-group button:disabled {
    background: #444444;
    cursor: not-allowed;
    opacity: 0.6;
}

/* 右下角浮動按鈕 */
.scroll-to-top {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    background-color: var(--button-color); /* 紅色 */
    color: #fff; /* 白色箭頭 */
    border: none;
    border-radius: 50%; /* 圓形 */
    font-size: 1.5rem;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    transition: background-color 0.3s ease, transform 0.3s ease;
    z-index: 1000;
}

.scroll-to-top:hover {
    background-color: var(--button-hover-color); /* 懸停時綠色 */
    transform: scale(1.1); /* 輕微放大效果 */
}

/* 電腦版固定表頭 */
@media screen and (min-width: 601px) {
    .table-container {
        position: relative;
    }
    tr:nth-child(2) {
        position: sticky;
        top: 0;
        z-index: 10;
        background-color: #402040;
    }
}

/* 手機端卡片模式 */
@media screen and (max-width: 600px) {
    body {
        padding: 0.6rem;
    }
    table {
        border: 0.06rem solid #000000;
    }
    .table-container {
        max-height: none;
        overflow-y: visible;
    }
    table, tbody, tr, td {
        display: block;
    }
    tr:nth-child(2) {
        display: none !important;
    }
    tr:not(:nth-child(1)):not(:nth-child(2)) {
        margin-bottom: 1.5rem;
        background-color: #101010;
        border: 2px solid #000000;
        border-radius: 8px;
        padding: 0.5rem;
        box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
        position: relative;
        display: flex;
        flex-wrap: wrap;
        box-sizing: border-box;
    }
    td {
        position: relative;
        padding: 0.5rem !important;
        border: none;
        box-sizing: border-box;
    }
    /* 未展開時顯示的欄位 */
    tr:not(:nth-child(1)):not(:nth-child(2)) td:nth-child(1),
    tr:not(:nth-child(1)):not(:nth-child(2)) td:nth-child(2),
    tr:not(:nth-child(1)):not(:nth-child(2)) td:nth-child(9),       
    tr:not(:nth-child(1)):not(:nth-child(2)) td:nth-child(13) {
        display: inline-block;
        width: 50%;
        box-sizing: border-box;
        vertical-align: top;
    }
    tr:not(:nth-child(1)):not(:nth-child(2)) td:nth-child(16),
    tr:not(:nth-child(1)):not(:nth-child(2)) td:nth-child(17), 
    tr:not(:nth-child(1)):not(:nth-child(2)) td:nth-child(15) {
        display: block;
        width: 100%;
        box-sizing: border-box;
    }
    /* 未展開時隱藏其他欄位 */
    tr:not(:nth-child(1)):not(:nth-child(2)) td:nth-child(3),
    tr:not(:nth-child(1)):not(:nth-child(2)) td:nth-child(4),
    tr:not(:nth-child(1)):not(:nth-child(2)) td:nth-child(5),
    tr:not(:nth-child(1)):not(:nth-child(2)) td:nth-child(6),
    tr:not(:nth-child(1)):not(:nth-child(2)) td:nth-child(7),
    tr:not(:nth-child(1)):not(:nth-child(2)) td:nth-child(8),
    tr:not(:nth-child(1)):not(:nth-child(2)) td:nth-child(10),
    tr:not(:nth-child(1)):not(:nth-child(2)) td:nth-child(11),
    tr:not(:nth-child(1)):not(:nth-child(2)) td:nth-child(12),
    tr:not(:nth-child(1)):not(:nth-child(2)) td:nth-child(14) {
        display: none;
    }
    /* 欄位標籤 */
    tr:not(:nth-child(1)):not(:nth-child(2)) td:nth-child(1):before {
        content: "名称";
        display: block;
        font-weight: bold;
        color: white;
        padding: 0.3rem 0.5rem;
        margin-bottom: 0.3rem;
        border-radius: 4px;
        text-align: center;
        background-color: #402040;
    }
    tr:not(:nth-child(1)):not(:nth-child(2)) td:nth-child(2):before {
        content: "类型";
        display: block;
        font-weight: bold;
        color: white;
        padding: 0.3rem 0.5rem;
        margin-bottom: 0.3rem;
        border-radius: 4px;
        text-align: center;
        background-color: #402040;
    }
    tr:not(:nth-child(1)):not(:nth-child(2)) td:nth-child(9):before {
        content: "等级";
        display: block;
        font-weight: bold;
        color: white;
        padding: 0.3rem 0.5rem;
        margin-bottom: 0.3rem;
        border-radius: 4px;
        text-align: center;
        background-color: #402040;
    }
    tr:not(:nth-child(1)):not(:nth-child(2)) td:nth-child(13):before {
        content: "孔数";
        display: block;
        font-weight: bold;
        color: white;
        padding: 0.3rem 0.5rem;
        margin-bottom: 0.3rem;
        border-radius: 4px;
        text-align: center;
        background-color: #402040;
    }
    tr:not(:nth-child(1)):not(:nth-child(2)) td:nth-child(15):before {
        content: "魔法属性";
        display: block;
        font-weight: bold;
        color: white;
        padding: 0.3rem 0.5rem;
        margin-bottom: 0.3rem;
        border-radius: 4px;
        text-align: center;
        background-color: #402040;
    }
    tr:not(:nth-child(1)):not(:nth-child(2)) td:nth-child(16):before {
        content: "职业专属";
        display: block;
        font-weight: bold;
        color: white;
        padding: 0.3rem 0.5rem;
        margin-bottom: 0.3rem;
        border-radius: 4px;
        text-align: center;
        background-color: #402040;
    }
    tr:not(:nth-child(1)):not(:nth-child(2)) td:nth-child(17):before {
        content: "基础装填速度";
        display: block;
        font-weight: bold;
        color: white;
        padding: 0.3rem 0.5rem;
        margin-bottom: 0.3rem;
        border-radius: 4px;
        text-align: center;
        background-color: #402040;
    }        
  
    /* 展開時顯示所有欄位 */
    tr:not(:nth-child(1)):not(:nth-child(2)).expanded td:nth-child(1),
    tr:not(:nth-child(1)):not(:nth-child(2)).expanded td:nth-child(2),
    tr:not(:nth-child(1)):not(:nth-child(2)).expanded td:nth-child(3),
    tr:not(:nth-child(1)):not(:nth-child(2)).expanded td:nth-child(4),
    tr:not(:nth-child(1)):not(:nth-child(2)).expanded td:nth-child(5),
    tr:not(:nth-child(1)):not(:nth-child(2)).expanded td:nth-child(6),
    tr:not(:nth-child(1)):not(:nth-child(2)).expanded td:nth-child(7),
    tr:not(:nth-child(1)):not(:nth-child(2)).expanded td:nth-child(8),
    tr:not(:nth-child(1)):not(:nth-child(2)).expanded td:nth-child(9),
    tr:not(:nth-child(1)):not(:nth-child(2)).expanded td:nth-child(10),
    tr:not(:nth-child(1)):not(:nth-child(2)).expanded td:nth-child(11),
    tr:not(:nth-child(1)):not(:nth-child(2)).expanded td:nth-child(12),
    tr:not(:nth-child(1)):not(:nth-child(2)).expanded td:nth-child(13),
    tr:not(:nth-child(1)):not(:nth-child(2)).expanded td:nth-child(14) {
        display: inline-block;
        width: 50%;
        box-sizing: border-box;
        vertical-align: top;
    }
    tr:not(:nth-child(1)):not(:nth-child(2)).expanded td:nth-child(16),
    tr:not(:nth-child(1)):not(:nth-child(2)).expanded td:nth-child(17),    
    tr:not(:nth-child(1)):not(:nth-child(2)).expanded td:nth-child(15) {
        display: block;
        width: 100%;
        box-sizing: border-box;
    }
    /* 展開時的欄位標籤 */
    tr:not(:nth-child(1)):not(:nth-child(2)).expanded td:nth-child(3):before {
        content: "伤害";
        display: block;
        font-weight: bold;
        color: white;
        padding: 0.3rem 0.5rem;
        margin-bottom: 0.3rem;
        border-radius: 4px;
        text-align: center;
        background-color: #402040;
    }
    tr:not(:nth-child(1)):not(:nth-child(2)).expanded td:nth-child(4):before {
        content: "平均伤害";
        display: block;
        font-weight: bold;
        color: white;
        padding: 0.3rem 0.5rem;
        margin-bottom: 0.3rem;
        border-radius: 4px;
        text-align: center;
        background-color: #402040;
    }
    tr:not(:nth-child(1)):not(:nth-child(2)).expanded td:nth-child(5):before {
        content: "耐久度";
        display: block;
        font-weight: bold;
        color: white;
        padding: 0.3rem 0.5rem;
        margin-bottom: 0.3rem;
        border-radius: 4px;
        text-align: center;
        background-color: #402040;
    }
    tr:not(:nth-child(1)):not(:nth-child(2)).expanded td:nth-child(6):before {
        content: "范围";
        display: block;
        font-weight: bold;
        color: white;
        padding: 0.3rem 0.5rem;
        margin-bottom: 0.3rem;
        border-radius: 4px;
        text-align: center;
        background-color: #402040;
    }
    tr:not(:nth-child(1)):not(:nth-child(2)).expanded td:nth-child(7):before {
        content: "武器速度";
        display: block;
        font-weight: bold;
        color: white;
        padding: 0.3rem 0.5rem;
        margin-bottom: 0.3rem;
        border-radius: 4px;
        text-align: center;
        background-color: #402040;
    }
    tr:not(:nth-child(1)):not(:nth-child(2)).expanded td:nth-child(8):before {
        content: "品质等级";
        display: block;
        font-weight: bold;
        color: white;
        padding: 0.3rem 0.5rem;
        margin-bottom: 0.3rem;
        border-radius: 4px;
        text-align: center;
        background-color: #402040;
    }
    tr:not(:nth-child(1)):not(:nth-child(2)).expanded td:nth-child(10):before {
        content: "需求力量";
        display: block;
        font-weight: bold;
        color: white;
        padding: 0.3rem 0.5rem;
        margin-bottom: 0.3rem;
        border-radius: 4px;
        text-align: center;
        background-color: #402040;
    }
    tr:not(:nth-child(1)):not(:nth-child(2)).expanded td:nth-child(11):before {
        content: "需求敏捷";
        display: block;
        font-weight: bold;
        color: white;
        padding: 0.3rem 0.5rem;
        margin-bottom: 0.3rem;
        border-radius: 4px;
        text-align: center;
        background-color: #402040;
    }
    tr:not(:nth-child(1)):not(:nth-child(2)).expanded td:nth-child(12):before {
        content: "力量/敏捷加成";
        display: block;
        font-weight: bold;
        color: white;
        padding: 0.3rem 0.5rem;
        margin-bottom: 0.3rem;
        border-radius: 4px;
        text-align: center;
        background-color: #402040;
    }
    tr:not(:nth-child(1)):not(:nth-child(2)).expanded td:nth-child(14):before {
        content: "宝石类型";
        display: block;
        font-weight: bold;
        color: white;
        padding: 0.3rem 0.5rem;
        margin-bottom: 0.3rem;
        border-radius: 4px;
        text-align: center;
        background-color: #402040;
    }

    /* 奇偶行不同背景色 */
    /* 未展開時的奇偶行背景色 */
    tr:not(:nth-child(1)):not(:nth-child(2)):nth-child(odd) td:nth-child(1):before,
    tr:not(:nth-child(1)):not(:nth-child(2)):nth-child(odd) td:nth-child(2):before,
    tr:not(:nth-child(1)):not(:nth-child(2)):nth-child(odd) td:nth-child(3):before,
    tr:not(:nth-child(1)):not(:nth-child(2)):nth-child(odd) td:nth-child(4):before,
    tr:not(:nth-child(1)):not(:nth-child(2)):nth-child(odd) td:nth-child(5):before,
    tr:not(:nth-child(1)):not(:nth-child(2)):nth-child(odd) td:nth-child(6):before,
    tr:not(:nth-child(1)):not(:nth-child(2)):nth-child(odd) td:nth-child(7):before,
    tr:not(:nth-child(1)):not(:nth-child(2)):nth-child(odd) td:nth-child(8):before,
    tr:not(:nth-child(1)):not(:nth-child(2)):nth-child(odd) td:nth-child(9):before,
    tr:not(:nth-child(1)):not(:nth-child(2)):nth-child(odd) td:nth-child(10):before,
    tr:not(:nth-child(1)):not(:nth-child(2)):nth-child(odd) td:nth-child(11):before,
    tr:not(:nth-child(1)):not(:nth-child(2)):nth-child(odd) td:nth-child(12):before,
    tr:not(:nth-child(1)):not(:nth-child(2)):nth-child(odd) td:nth-child(13):before,
    tr:not(:nth-child(1)):not(:nth-child(2)):nth-child(odd) td:nth-child(14):before,
    tr:not(:nth-child(1)):not(:nth-child(2)):nth-child(odd) td:nth-child(15):before,
    tr:not(:nth-child(1)):not(:nth-child(2)):nth-child(odd) td:nth-child(16):before,            
    tr:not(:nth-child(1)):not(:nth-child(2)):nth-child(odd) td:nth-child(17):before {
        background-color: #402040;
    }
    tr:not(:nth-child(1)):not(:nth-child(2)):nth-child(even) td:nth-child(1):before,
    tr:not(:nth-child(1)):not(:nth-child(2)):nth-child(even) td:nth-child(2):before,
    tr:not(:nth-child(1)):not(:nth-child(2)):nth-child(even) td:nth-child(3):before,
    tr:not(:nth-child(1)):not(:nth-child(2)):nth-child(even) td:nth-child(4):before,
    tr:not(:nth-child(1)):not(:nth-child(2)):nth-child(even) td:nth-child(5):before,
    tr:not(:nth-child(1)):not(:nth-child(2)):nth-child(even) td:nth-child(6):before,
    tr:not(:nth-child(1)):not(:nth-child(2)):nth-child(even) td:nth-child(7):before,
    tr:not(:nth-child(1)):not(:nth-child(2)):nth-child(even) td:nth-child(8):before,
    tr:not(:nth-child(1)):not(:nth-child(2)):nth-child(even) td:nth-child(9):before,
    tr:not(:nth-child(1)):not(:nth-child(2)):nth-child(even) td:nth-child(10):before,
    tr:not(:nth-child(1)):not(:nth-child(2)):nth-child(even) td:nth-child(11):before,
    tr:not(:nth-child(1)):not(:nth-child(2)):nth-child(even) td:nth-child(12):before,
    tr:not(:nth-child(1)):not(:nth-child(2)):nth-child(even) td:nth-child(13):before,
    tr:not(:nth-child(1)):not(:nth-child(2)):nth-child(even) td:nth-child(14):before,       
    tr:not(:nth-child(1)):not(:nth-child(2)):nth-child(even) td:nth-child(15):before,
    tr:not(:nth-child(1)):not(:nth-child(2)):nth-child(even) td:nth-child(16):before, 
    tr:not(:nth-child(1)):not(:nth-child(2)):nth-child(even) td:nth-child(17):before {
        background-color: #3F2020;
    }
    /* 展開時的奇偶行背景色 */
    tr:not(:nth-child(1)):not(:nth-child(2)).expanded:nth-child(odd) td:before,
    tr:not(:nth-child(1)):not(:nth-child(2)).expanded:nth-child(even) td:before {
        background-color: #402040; /* 奇數行 */
    }
    tr:not(:nth-child(1)):not(:nth-child(2)).expanded:nth-child(even) td:before {
        background-color: #3F2020; /* 偶數行 */
    }
    /* 調整名稱欄位的顯示 */
    tr:not(:nth-child(1)):not(:nth-child(2)) td:nth-child(1) font,
    tr:not(:nth-child(1)):not(:nth-child(2)) td:nth-child(1) font b,
    tr:not(:nth-child(1)):not(:nth-child(2)) td:nth-child(1) font a {
        display: block;
        text-align: center;
    }

    /* 詳細資料按鈕 */
    tr:not(:nth-child(1)):not(:nth-child(2)):after {
        content: "詳細資料";
        display: block;
        text-align: center;
        padding: 0.5rem;
        margin: 0.5rem 0;
        background-color: var(--button-color);
        color: white;
        border-radius: 4px;
        cursor: pointer;
        transition: background-color 0.2s ease;
        width: 100%;
    }
    tr:not(:nth-child(1)):not(:nth-child(2)):hover:after {
        background-color: var(--button-hover-color);
    }
    tr:not(:nth-child(1)):not(:nth-child(2)).expanded:after {
        content: "收起資料";
    }
}

