/* 보스 수익 계산기 전용 스타일 */
.boss-calculator {
    display: grid;
    grid-template-columns: 280px 1fr 220px;
    gap: 20px;
    padding: 24px 0 40px;
    align-items: start;
}

.panel {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    overflow: hidden;
}
.panel-header {
    background: #3C3744;
    color: white;
    padding: 12px 16px;
    font-size: 14px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}
.panel-header .step-badge {
    background: #B4C5E4;
    color: #3C3744;
    width: 22px; height: 22px;
    border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 700; flex-shrink: 0;
}

/* ① 캐릭터 패널 */
.char-list { padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.char-item {
    background: #f8f9fa;
    border: 2px solid transparent;
    border-radius: 10px;
    padding: 10px 12px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 10px;
}
.char-item:hover { border-color: #B4C5E4; }
.char-item.active { border-color: #3C3744; background: #eef2f8; }
.char-avatar {
    width: 40px; height: 40px;
    background: linear-gradient(135deg, #3C3744, #B4C5E4);
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    font-size: 18px; flex-shrink: 0;
}
.char-info { flex: 1; min-width: 0; }
.char-name { font-size: 13px; font-weight: 700; color: #333; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.char-income { font-size: 12px; color: #888; }
.char-income span { color: #e05050; font-weight: 700; }
.char-delete {
    background: none; border: none; cursor: pointer;
    color: #ccc; font-size: 16px; padding: 2px 4px;
    transition: color 0.2s; flex-shrink: 0;
}
.char-delete:hover { color: #e05050; }

.char-add-btn {
    margin: 0 12px 12px;
    width: calc(100% - 24px);
    padding: 10px;
    background: #f0f4ff;
    border: 2px dashed #B4C5E4;
    border-radius: 10px;
    color: #3C3744;
    font-size: 13px; font-weight: 600;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center; gap: 6px;
    transition: all 0.2s;
}
.char-add-btn:hover { background: #e4ebff; border-color: #3C3744; }

.char-add-input-row {
    display: none;
    margin: 0 12px 12px;
    gap: 6px;
}
.char-add-input-row.visible { display: flex; }
.char-add-input-row input {
    flex: 1;
    padding: 8px 12px;
    border: 1.5px solid #B4C5E4;
    border-radius: 8px;
    font-size: 13px;
    font-family: inherit;
    outline: none;
}
.char-add-input-row button {
    padding: 8px 12px;
    background: #3C3744;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 12px; font-weight: 600;
    cursor: pointer;
}
        .char-add-input-row button.cancel { background: #aaa; }

        /* 서버 선택 버튼 그룹 (우선순위 강화를 위해 부모 클래스 포함) */
        .character-panel .server-select-group {
            display: flex;
            gap: 6px;
            margin-bottom: 10px;
            width: 100%;
        }
        .character-panel .server-mini-btn {
            flex: 1;
            padding: 10px;
            border: 1.5px solid #ddd !important;
            border-radius: 8px;
            font-size: 13px;
            font-weight: 700;
            cursor: pointer;
            background: #f5f5f5 !important; /* 기본은 아주 연한 회색 */
            color: #bbb !important; /* 글자도 아주 연하게 */
            transition: all 0.2s ease;
            box-shadow: none !important;
        }
        /* 활성화 상태: 짙은 남색 배경 + 흰색 글자 (강력한 우선순위) */
        .character-panel .server-mini-btn.active {
            border-color: #3C3744 !important;
            background: #3C3744 !important;
            color: #fff !important;
            box-shadow: 0 4px 10px rgba(60, 55, 68, 0.4) !important;
            transform: translateY(-1px);
        }
        /* 호버 시 효과 */
        .character-panel .server-mini-btn:not(.active):hover {
            background: #eee !important;
            color: #888 !important;
            border-color: #ccc !important;
        }

        /* 캐릭터 입력칸 너비 조정 */
        #charNameInput {
            flex: 1;
            min-width: 0; /* 인풋 축소 허용 */
            padding: 8px 12px;
            border: 1.5px solid #B4C5E4;
            border-radius: 8px;
            font-size: 13px;
            font-family: inherit;
            outline: none;
        }
        /* ② 보스 선택 패널 */
        .boss-table-wrap { overflow-x: auto; }
        .boss-table {
            width: 100%;
            border-collapse: collapse;
            font-size: 13px;
            table-layout: fixed; /* 테이블 레이아웃 고정 */
        }
        .boss-table thead th {
            background: #f5f6fa;
            padding: 10px 12px;
            text-align: left;
            color: #666;
            font-weight: 600;
            border-bottom: 1px solid #eee;
            white-space: nowrap;
        }
        /* 각 열의 너비 지정 */
        .boss-table th:nth-child(1) { width: 180px; } /* 보스 이름 너비 확대 */
        .boss-table th:nth-child(2) { width: auto; }  /* 난이도 (유연하게) */
        .boss-table th:nth-child(3) { width: 85px; }  /* 파티원 */
        .boss-table th:nth-child(4) { width: 100px; } /* 수익 */

        .boss-table thead th:last-child { text-align: right; }
        .boss-table tbody tr { border-bottom: 1px solid #f5f5f5; transition: background 0.15s; }
        .boss-table tbody tr:hover { background: #fafbff; }
        .boss-table td { padding: 9px 12px; vertical-align: middle; }
        .boss-table td:last-child { text-align: right; }

        .boss-name-cell { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
        .boss-img {
            width: 32px;
            height: 32px;
            border-radius: 6px;
            object-fit: contain;
            background: #f0f0f0;
            flex-shrink: 0;
        }
        .boss-img-placeholder {
            width: 32px; height: 32px;
            border-radius: 6px;
            background: linear-gradient(135deg, #3C3744 0%, #6c7a8a 100%);
            display: flex; align-items: center; justify-content: center;
            font-size: 14px; flex-shrink: 0; color: white;
        }
        .boss-label { font-weight: 500; color: #333; white-space: nowrap; }

        .diff-group { 
            display: flex; 
            gap: 4px; 
            flex-wrap: nowrap; /* 절대 줄바꿈 금지 */
            overflow-x: hidden;
        }
        .diff-btn {
            display: inline-flex; align-items: center; justify-content: center;
            padding: 5px 8px; /* 좌우 패딩 축소 (12px -> 8px) */
            border-radius: 6px;
            font-size: 10px; /* 폰트 크기 미세 축소 */
            font-weight: 700;
            cursor: pointer;
            border: 1px solid #ddd;
            transition: all 0.2s;
            user-select: none;
            background: #fdfdfd;
            color: #999;
            outline: none;
            font-family: inherit;
            white-space: nowrap;
            flex-shrink: 0; /* 버튼 크기 유지 */
        }        
        /* 마우스 호버 시 효과 */
        .diff-btn:hover { border-color: #B4C5E4; background: #f0f4ff; }

        /* 각 난이도별 선택 시 색상 */
        .diff-btn.easy.checked { background: #e8f5e9; color: #2e7d32; border-color: #2e7d32; }
        .diff-btn.normal.checked { background: #e3f2fd; color: #1565c0; border-color: #1565c0; }
        .diff-btn.hard.checked { background: #fce4ec; color: #b71c1c; border-color: #b71c1c; }
        .diff-btn.chaos.checked { background: #f3e5f5; color: #6a1b9a; border-color: #6a1b9a; }
        .diff-btn.extreme.checked { background: #fff8e1; color: #e65100; border-color: #e65100; }
.party-select {
    padding: 4px 8px;
    border: 1.5px solid #ddd;
    border-radius: 6px;
    font-size: 12px;
    outline: none;
}

.income-cell { font-weight: 700; color: #e05050; }
.income-cell.empty { color: #ccc; font-weight: 400; }

.monthly-divider td {
    background: #3C3744;
    color: white;
    font-size: 12px;
    font-weight: 700;
    padding: 6px 12px;
}

/* ③ 통계 패널 */
.stat-content { padding: 16px; }
.stat-row {
    display: flex; justify-content: space-between; align-items: center;
    padding: 12px 14px;
    background: #f8f9fa;
    border-radius: 10px;
    margin-bottom: 10px;
}
.stat-label { font-size: 12px; color: #666; }
.stat-value { font-size: 15px; font-weight: 700; color: #e05050; }
.stat-month { background: #fff8e1; }
.stat-month .stat-value { color: #f57c00; }
.stat-monthly-note { font-size: 10px; color: #aaa; }

.char-stat-list { display: flex; flex-direction: column; gap: 6px; }
.char-stat-item {
    display: flex; justify-content: space-between; align-items: center;
    font-size: 12px; padding: 6px 10px;
    background: #f5f6fa; border-radius: 8px;
}

.empty-state { text-align: center; padding: 40px 20px; color: #aaa; }
.page-title-area { padding: 20px 0 4px; }
.page-title-area h1 { font-size: 22px; font-weight: 700; color: #3C3744; }
.help-open-btn {
    background: #f0f2f5;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 600;
    color: #666;
    cursor: pointer;
    transition: all 0.2s;
}
.help-open-btn:hover {
    background: #3C3744;
    color: white;
    border-color: #3C3744;
}
.page-title-area p { font-size: 13px; color: #888; }

.reset-all-btn {
    background: none; border: 1px solid #ddd; border-radius: 6px;
    padding: 5px 10px; font-size: 12px; color: #888; cursor: pointer;
}

        .boss-img.clickable {
            cursor: pointer;
            transition: transform 0.2s;
        }
        .boss-img.clickable:hover {
            transform: scale(1.1);
            box-shadow: 0 0 8px rgba(180, 197, 228, 0.8);
        }
        /* 아이템이 선택된 보스 이미지 스타일 */
        .boss-img.selected {
            border: 2px solid #FF6B6B !important;
            box-shadow: 0 0 8px rgba(255, 107, 107, 0.5);
        }

        /* 드롭 아이템 패널 */
        .drop-panel-row {
            background-color: #fcfcfc;
        }
        .drop-panel-content {
            padding: 10px 20px;
            display: flex;
            align-items: center;
            gap: 15px;
            animation: slideDown 0.2s ease-out;
        }
        .drop-label {
            font-size: 12px;
            font-weight: 700;
            color: #666;
        }
        .drop-items-list {
            display: flex;
            gap: 10px;
            flex: 1;
        }
        
        /* 주차 선택 그리드 */
        .drop-week-grid {
            display: grid;
            grid-template-columns: repeat(2, 1fr);
            gap: 4px;
            margin-right: 15px;
        }
        .week-btn {
            padding: 4px 8px;
            border: 1px solid #ddd;
            border-radius: 4px;
            font-size: 10px;
            font-weight: 700;
            background: #fdfdfd;
            color: #999;
            cursor: pointer;
            transition: all 0.2s;
            white-space: nowrap;
        }
        .week-btn.active {
            background: #FF6B6B;
            color: white;
            border-color: #FF6B6B;
        }
        .week-btn:hover:not(.active) {
            background: #f0f0f0;
            border-color: #ccc;
        }

        .drop-close-btn {
            background: #eee;
            border: none;
            border-radius: 6px;
            padding: 4px 12px;
            font-size: 11px;
            font-weight: 600;
            color: #666;
            cursor: pointer;
            transition: all 0.2s;
        }
        .drop-close-btn:hover {
            background: #e0e0e0;
            color: #333;
        }
        .drop-item {
            width: 36px;
            height: 36px;
            border-radius: 8px;
            border: 2px solid #eee;
            padding: 2px;
            cursor: pointer;
            transition: all 0.2s;
            background: white;
        }
        .drop-item:hover {
            border-color: #B4C5E4;
            background: #f0f4ff;
        }
        .drop-item.selected {
            border-color: #FF6B6B;
            background: #fff0f0;
            box-shadow: 0 0 5px rgba(255,107,107,0.3);
        }
        .drop-item img {
            width: 100%;
            height: 100%;
            object-fit: contain;
        }

        @keyframes slideDown {
            from { opacity: 0; transform: translateY(-5px); }
            to { opacity: 1; transform: translateY(0); }
        }

        @media (max-width: 768px) {
    /* 3단계: 보스 수익 계산기 6.1인치 최적화 */
    .boss-calculator { 
        grid-template-columns: 1fr !important; 
        gap: 15px !important;
        padding: 10px 0 !important;
    }

    /* 패널 순서 재배치: 캐릭터(1) -> 통계(2) -> 보스(3) */
    .character-panel { order: 1; }
    .stat-panel { order: 2; }
    .boss-panel { order: 3; }

    /* 캐릭터 목록 슬림화 */
    .char-list { padding: 8px; gap: 6px; }
    .char-item { padding: 8px 10px; }
    .char-avatar { width: 32px; height: 32px; font-size: 14px; }
    .char-name { font-size: 12px; }

    /* 통계 패널 압축 */
    .stat-content { padding: 12px; }
    .stat-row { padding: 10px; margin-bottom: 8px; }
    .stat-value { font-size: 14px; }

    /* ★ 보스 테이블 6.1인치 맞춤 */
    .panel-header { padding: 10px 12px; font-size: 13px; }
    .boss-table th, .boss-table td { padding: 8px 5px !important; }
    
    /* 열 너비 재조정 (6.1인치 기준) */
    .boss-table th:nth-child(1) { width: 110px !important; } /* 보스명 축소 */
    .boss-table th:nth-child(3) { width: 65px !important; }  /* 파티원 축소 */
    .boss-table th:nth-child(4) { width: 80px !important; }  /* 수익 축소 */

    .boss-name-cell { gap: 5px; }
    .boss-img { width: 24px; height: 24px; }
    .boss-label { font-size: 11px; }

    /* 난이도 버튼 그룹: 자동 줄바꿈 허용 */
    .diff-group { 
        flex-wrap: wrap !important; 
        gap: 3px !important;
    }
    .diff-btn { 
        padding: 4px 6px !important; 
        font-size: 9px !important;
        min-width: 40px;
    }

    .party-select { padding: 3px 5px; font-size: 11px; }
    .income-cell { font-size: 11px; }

    /* 드롭 아이템 패널 모바일 최적화 */
    .drop-panel-content { 
        flex-direction: column; 
        align-items: flex-start; 
        padding: 15px; 
        gap: 10px;
    }
    .drop-week-grid { margin-right: 0; width: 100%; }
    .drop-items-list { width: 100%; flex-wrap: wrap; justify-content: center; }

    /* 모바일 호버 효과 제거 */
    .char-item:hover, .boss-table tbody tr:hover, .diff-btn:hover { 
        border-color: transparent !important;
        background: inherit !important;
    }
    .char-item.active { border-color: #3C3744 !important; background: #eef2f8 !important; }
    .diff-btn.checked { background: #e3f2fd !important; border-color: #1565c0 !important; }

    /* 보스 이름 축약: 가디언 엔젤 슬라임 -> 가엔슬 */
    .boss-name-full { display: none; }
}

@media (max-width: 900px) {    .boss-calculator { grid-template-columns: 1fr; }
}

/* 커스텀 툴팁 스타일 */
.custom-tooltip {
    position: absolute;
    z-index: 9999;
    background: rgba(60, 55, 68, 0.95); /* 메인 남색 */
    color: white;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 12px;
    line-height: 1.6;
    pointer-events: none; /* 마우스 이벤트 방해 금지 */
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    border: 1px solid rgba(180, 197, 228, 0.3);
    white-space: pre-wrap;
    backdrop-filter: blur(4px);
}
.custom-tooltip b { color: #FF6B6B; font-weight: 700; } /* 강조 텍스트 */
