/* 全局樣式 */
:root {
    --primary-color: #afafaf; /* 主要文字顏色 */
    --navbar-bg: #300000; /* 導航欄背景色 */
    --highlight-color: #c8b478; /* 高亮顏色 */
    --button-color: #800000c0; /* 按鈕預設紅色 */
    --button-hover-color: #3e8e41; /* 懸停時綠色 */
}
body {
    background-color: #101010; /* 或其他深色背景，與網站主題一致 */
}


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

/* 表格樣式 */
table {
    width: 100%;
    max-width: 1225px;
    margin: 0 auto;
    border-collapse: collapse;
    background-color: #300000;
    color: #d6d6d6;
    font-size: 16px;
    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 (max-width: 600px) {
    html {
        font-size: 14px;
    }
    body {
        padding: 0.6rem; /* 手機端內邊距 */
    }
    table {
        font-size: 0.8rem; /* 手機端字體大小 */
        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);
    }
    td {
        position: relative;
        padding: 0.5rem !important; /* 覆蓋內聯 padding: 0px 50px 0px 50px */
        text-align: center;
        font-size: 0.875rem;
        border: none; /* 移除 singly 單元格邊框 */
    }
    /* 為每個欄位添加標籤 */
    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;
        font-size: 0.875rem;
        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;
        font-size: 0.875rem;
        text-align: center;
        background-color: #402040;
    }
    tr:not(:nth-child(1)):not(:nth-child(2)) 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;
        font-size: 0.875rem;
        text-align: center;
        background-color: #402040;
    }
    tr:not(:nth-child(1)):not(:nth-child(2)) 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;
        font-size: 0.875rem;
        text-align: center;
        background-color: #402040;
    }
    /* 奇偶行不同背景色 */
    tr:not(:nth-child(1)):not(:nth-child(2)):nth-child(odd) td:before {
        background-color: #402040;
    }
    tr:not(:nth-child(1)):not(:nth-child(2)):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)) td:nth-child(1) font br {
        display: none; /* 移除不必要的換行 */
    }
    tr:not(:nth-child(1)):not(:nth-child(2)) td:nth-child(1) img {
        margin-top: 0.5rem;
        max-width: 100%; /* 確保圖片適應卡片寬度 */
    }
    /* 特性欄位左對齊 */
    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(3) font {
        text-align: left;
        display: block;
    }
    /* 備註欄位左對齊 */
    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(4) font {
        text-align: left;
        display: block;
    }
    /* 手機端按鈕和滾動按鈕調整 */
    .btn-group button {
        font-size: 0.75rem;
        padding: 8px 16px; /* 手機端縮小內距 */
    }
    .scroll-to-top {
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
    }
}