/* =========================================
   1. 分頁按鈕 (Tab Navigation)
   ========================================= */
.tab-nav {
    margin-top: 5px;
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 20px;
}

.tab-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #aaa;
    padding: 10px 30px;
    border-radius: 30px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s;
}

.tab-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}

.tab-btn.active {
    background: var(--primary-gold, #fbb750);
    color: #000;
    font-weight: bold;
    border-color: var(--primary-gold, #fbb750);
    box-shadow: 0 0 15px rgba(251, 183, 80, 0.4);
}

/* 分頁內容切換邏輯 */
.tab-content {
    display: none;
    animation: fadeIn 0.5s;
}

.tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* =========================================
   2. 規則說明區 (Rule Box)
   ========================================= */
.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;
}

.legend-rule {
    background: rgba(255, 215, 0, 0.05);
    /* 傳說規則帶點金色背景 */
    border-color: rgba(255, 215, 0, 0.2);
}

.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;
}

.check-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.check-list li {
    margin-bottom: 12px;
    color: #ddd;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    line-height: 1.5;
    font-size: 0.95rem;
}

.check-list i {
    margin-top: 4px;
    flex-shrink: 0;
    width: 20px;
    text-align: center;
}

.check-list li div {
    flex: 1;
}

/* 確保文字不跑版 */

.npc-img-small {
    height: 60px;
    margin-top: 5px;
    border-radius: 4px;
    border: 1px solid #555;
}

.npc-group {
    display: flex;
    gap: 10px;
    margin-top: 5px;
}

.npc-group img {
    height: 60px;
    border-radius: 4px;
    border: 1px solid #555;
}

/* 顏色工具 */
.text-gold {
    color: #ffd700;
}

.text-red {
    color: #ff5252;
}

.text-blue {
    color: #64b5f6;
}

.text-green {
    color: #81c784;
}

.highlight {
    color: #ffd700;
    font-weight: bold;
}

/* =========================================
   3. 特殊變身等級卡片 (Special Levels)
   ========================================= */
.level-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.level-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.2s;
}

.level-card:hover {
    transform: translateY(-3px);
    border-color: var(--primary-gold, #fbb750);
}

.card-header {
    background: rgba(0, 0, 0, 0.4);
    padding: 10px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.lv-badge {
    background: var(--primary-gold, #fbb750);
    color: #000;
    font-weight: bold;
    padding: 2px 10px;
    border-radius: 12px;
}

.cost-badge {
    color: #aaa;
    font-size: 0.9rem;
}

.card-body {
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.bonus-text {
    font-size: 1rem;
    color: #ddd;
}

.dmg-val {
    color: #ff5252;
    font-weight: bold;
    font-size: 1.2rem;
}

.names-text {
    color: #81c784;
    font-size: 0.95rem;
}

.morph-imgs {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 5px;
}

.morph-imgs img {
    border-radius: 4px;
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.5);
    max-height: 80px;
    /* 限制高度，避免圖片太大 */
    object-fit: contain;
}

/* =========================================
   4. 傳說變身網格 (Legendary Grid)
   ========================================= */
.legend-section {
    margin-top: 30px;
}

.sub-title {
    color: #fff;
    font-size: 1.1rem;
    border-left: 4px solid var(--primary-gold, #fbb750);
    padding-left: 10px;
    margin: 20px 0 15px 0;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.05), transparent);
    padding-top: 5px;
    padding-bottom: 5px;
}

.legend-grid {
    display: grid;
    /* 電腦版：自動適應，一排約 6 個 */
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 10px;
    margin-bottom: 30px;
}

.morph-item {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    padding: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100px;
    transition: transform 0.2s;
}

.morph-item:hover {
    transform: scale(1.05);
    border-color: var(--primary-gold, #fbb750);
    background: rgba(255, 255, 255, 0.1);
}

.morph-item img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

/* =========================================
   5. RWD 手機版優化
   ========================================= */
@media (max-width: 768px) {
    .tab-btn {
        padding: 8px 20px;
        font-size: 0.9rem;
    }

    .level-card .card-body {
        gap: 5px;
    }

    .morph-imgs img {
        max-height: 60px;
    }

    /* 手機版圖片縮小 */

    /* 傳說變身手機版改為 4 欄 */
    .legend-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 5px;
    }

    .morph-item {
        height: 70px;
    }
}