/* ============================================================
   내 장비 기댓값 계산기 스타일
   ============================================================ */
.iv-container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 16px;
}

/* ── 검색 ── */
.iv-search-card {
    display: flex;
    gap: 10px;
    background: #fff;
    border: 1px solid #e6e8ee;
    border-radius: 14px;
    padding: 14px;
}
.iv-search-input {
    flex: 1;
    border: 1px solid #dfe3ea;
    border-radius: 10px;
    padding: 12px 14px;
    font-size: 15px;
    color: #222;
    background: #fafbfc;
}
.iv-search-input:focus { outline: none; border-color: #6aa0ff; background: #fff; }
.iv-search-btn {
    padding: 0 26px;
    border: none;
    border-radius: 10px;
    background: #3C3744;
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
}
.iv-search-btn:disabled { opacity: .6; cursor: default; }

.iv-status {
    min-height: 20px;
    margin: 8px 4px;
    font-size: 13px;
    color: #888;
}
.iv-status.err { color: #c0392b; font-weight: 600; }

/* ── 레이아웃 ── */
.iv-layout {
    display: grid;
    grid-template-columns: minmax(0, 420px) minmax(0, 1fr);
    gap: 16px;
    margin-top: 8px;
}
/* hidden 속성이 display:grid 에 덮이지 않도록 (결과 나오기 전엔 숨김) */
.iv-layout[hidden] { display: none; }
@media (max-width: 860px) {
    .iv-layout { grid-template-columns: 1fr; }
}

.iv-equip-card,
.iv-box {
    background: #fff;
    border: 1px solid #e6e8ee;
    border-radius: 14px;
    padding: 16px;
}

/* ── 캐릭터 헤더 ── */
.iv-char-head { display: flex; align-items: center; gap: 14px; min-height: 64px; }
/* 1번 영역: 고정 크기 상자(배경 프레임). 넘치는 부분은 잘림 */
.iv-char-imgbox {
    width: 60px; height: 60px; flex: none; position: relative;
    overflow: hidden; background: #eef3ff; border-radius: 10px;
}
/* 2번 영역: 이미지를 크게 그려서 캐릭터를 확대 (배경 여백은 상자 밖으로 잘림) */
.iv-char-img {
    position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
    width: 150px; height: 150px; object-fit: contain;
}
.iv-char-name { font-size: 16px; font-weight: 700; color: #2b2b33; }
.iv-char-sub { font-size: 12px; color: #888; margin-top: 2px; }

/* ── 장비 슬롯 그리드 (bossrecruit.css 이식) ── */
.equip-slot-grid {
    display: grid;
    grid-template-columns: repeat(7, 46px);
    grid-template-rows: repeat(6, 46px);
    gap: 4px;
    margin: 14px auto 0;
    width: fit-content;
}
.equip-slot-char-empty,
.equip-slot-char-cell {
    grid-column: 3 / 6;
    grid-row: 1 / 5;
    background: #eef3ff;
    border-radius: 8px;
}
/* 가운데 캐릭터: 상자 안에서 크게 그려 확대, 넘치는 배경은 잘림 */
.equip-slot-char-cell {
    position: relative;
    overflow: hidden;
}
.equip-slot-char-cell img {
    position: absolute;
    left: 50%; top: 46%;
    transform: translate(-50%, -50%);
    width: 300px; height: auto;
}
.equip-slot-item {
    position: relative;
    width: 46px;
    height: 46px;
    background: #f7f8fa;
    border: 2px solid #ccc;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.equip-slot-item img { width: 34px; height: 34px; object-fit: contain; }
.equip-slot-item .slot-star {
    position: absolute; top: 1px; left: 2px;
    font-size: 9px; color: #f5a623; font-weight: 700; line-height: 1;
    text-shadow: 0 0 3px rgba(0,0,0,.5);
}
.equip-slot-item.pot-rare      { border-color: #55b4f5; }
.equip-slot-item.pot-epic      { border-color: #b381e6; }
.equip-slot-item.pot-unique    { border-color: #f5c842; }
.equip-slot-item.pot-legendary { border-color: #6eff6e; box-shadow: 0 0 6px rgba(110,255,110,.4); }

/* ── 결과 ── */
.iv-result-col { display: flex; flex-direction: column; gap: 12px; }
.iv-result-row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
/* 좁은 폭에서 박스 헤더(제목+토글)가 겹치지 않도록 일찍 세로로 쌓는다 */
@media (max-width: 560px) { .iv-result-row2 { grid-template-columns: 1fr; } }
/* 박스 헤더는 폭이 모자라면 토글이 제목 아래로 줄바꿈 */
.iv-box-head { flex-wrap: wrap; }

.iv-box-title { font-size: 12px; color: #8a90a0; font-weight: 600; }
.iv-box-value { font-size: 22px; font-weight: 800; color: #2b2b33; margin-top: 6px; }
.iv-box-sub { font-size: 11px; color: #a0a4b0; margin-top: 4px; }

.iv-box-total { background: #3C3744; border-color: #3C3744; }
.iv-box-total .iv-box-title { color: #c9c3d6; }
.iv-box-total .iv-box-value { color: #fff; font-size: 26px; }
.iv-box-total .iv-box-sub { color: #9b93ad; }

/* ── 장비별 상세 ── */
.iv-detail-list { margin-top: 8px; }
.iv-detail-row {
    display: grid;
    grid-template-columns: 1fr 34px 84px 84px 104px;
    align-items: center;
    gap: 8px;
    padding: 7px 2px;
    border-top: 1px solid #f0f1f4;
    font-size: 13px;
}
.iv-detail-row.iv-detail-head {
    border-top: none;
    color: #a0a4b0;
    font-size: 11px;
    font-weight: 600;
}
.iv-detail-name { display: flex; align-items: center; gap: 6px; color: #333; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.iv-detail-name img { width: 20px; height: 20px; object-fit: contain; flex: none; }
.iv-detail-star { text-align: center; color: #f5a623; font-weight: 700; }
.iv-detail-cost { text-align: right; font-weight: 700; color: #2b2b33; }

/* ── 아이템 상세 호버 툴팁 ── */
.iv-tip {
    position: absolute;
    z-index: 9999;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    max-width: 96vw;
    pointer-events: none;
}
.iv-tip[hidden] { display: none; }
.iv-tip-main, .iv-tip-diag {
    background: #171a24;
    color: #e8eaf0;
    border: 1px solid #2a2f3d;
    border-radius: 12px;
    padding: 14px;
    box-shadow: 0 10px 28px rgba(0,0,0,.45);
    font-size: 13px;
    max-height: 88vh;
    overflow-y: auto;
}
.iv-tip-main { width: 284px; }
.iv-tip-diag { width: 240px; }
.iv-tip-head { display: flex; gap: 12px; align-items: flex-start; }
.iv-tip-icon {
    width: 54px; height: 54px; flex: none;
    object-fit: contain; background: #0e1017; border-radius: 10px; padding: 4px;
}
.iv-tip-headinfo { min-width: 0; }
.iv-tip-badges { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 5px; }
.iv-tip-grade {
    font-size: 10px; font-weight: 700; padding: 2px 6px; border-radius: 5px;
    background: #2a2f3d; color: #cdd3e0; white-space: nowrap;
}
.iv-tip-grade.g-rare      { background: #173a4d; color: #6ec6ff; }
.iv-tip-grade.g-epic      { background: #2e1f4d; color: #c39bff; }
.iv-tip-grade.g-unique    { background: #4a3c12; color: #ffd54a; }
.iv-tip-grade.g-legendary { background: #153d1c; color: #7dff7d; }
.iv-tip-name { font-size: 16px; font-weight: 800; color: #fff; line-height: 1.25; word-break: break-all; }
.iv-tip-part { font-size: 11px; color: #8a90a0; margin-top: 2px; }
.iv-tip-star { margin-top: 8px; color: #f5a623; font-weight: 700; font-size: 12px; }
.iv-tip-sec { margin-top: 12px; border-top: 1px solid #262b38; padding-top: 10px; }
.iv-tip-sec-title { font-size: 12px; font-weight: 700; margin-bottom: 6px; display: flex; align-items: center; gap: 6px; }
.iv-tip-sec-title { color: #cdd3e0; }
.iv-tip-sec-title.g-rare      { color: #6ec6ff; }
.iv-tip-sec-title.g-epic      { color: #c39bff; }
.iv-tip-sec-title.g-unique    { color: #ffd54a; }
.iv-tip-sec-title.g-legendary { color: #7dff7d; }
.iv-tip-opt { font-size: 13px; color: #d7dbe6; line-height: 1.75; }

/* 툴팁 세부 스탯 */
.iv-tip-meta { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; font-size: 11px; color: #8a90a0; }
.iv-tip-scroll { margin-top: 4px; font-size: 11px; color: #8a90a0; }
.iv-tip-stats { margin-top: 4px; }
.iv-tip-stat { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; line-height: 1.65; }
.iv-tip-stat-n { color: #9aa0ae; flex: none; }
.iv-tip-stat-v { color: #e8eaf0; text-align: right; }
.iv-tip-stat-total { color: #fff; font-weight: 700; }
.iv-tip-bd { color: #8a90a0; font-size: 11px; }

/* 스탯 출처별 색상 + 범례 */
.iv-tip-legend {
    display: flex; gap: 9px; flex-wrap: wrap; align-items: center;
    margin-top: 10px; padding-top: 8px;
    border-top: 1px solid #262b38;
    font-size: 10px; color: #8a90a0;
}
.iv-tip-legend .leg { display: inline-flex; align-items: center; gap: 3px; }
.iv-tip-legend .leg span { font-size: 9px; }
.seg-base { color: #cfd3dc; }
.seg-add  { color: #6ee7a8; }
.seg-etc  { color: #ffd54a; }
.seg-star { color: #ff9f6b; }

/* 큐브 기댓값 상세 진단 패널 */
.iv-diag-title { font-size: 13px; font-weight: 800; color: #ffd54a; margin-bottom: 4px; }
.iv-diag-title::before { content: '● '; font-size: 10px; }
.iv-diag-note { font-size: 10px; color: #8a90a0; margin-bottom: 12px; line-height: 1.5; }
.iv-diag-sec { margin-top: 14px; }
.iv-diag-sec:first-of-type { margin-top: 0; }
.iv-diag-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 6px; font-size: 13px; font-weight: 700; }
.iv-diag-head b { color: #6ec6ff; font-size: 13px; white-space: nowrap; }
.iv-diag-row { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; line-height: 1.7; }
.iv-diag-row > span:first-child { color: #8a90a0; flex: none; }
.iv-diag-row small { color: #8a90a0; }
.iv-diag-opts { text-align: right; color: #7dc4ff; }

/* ── "에디 유니크부터 계산" 토글 ── */
.iv-addi-toggle {
    margin-left: auto;
    display: inline-flex; align-items: center; gap: 7px;
    padding: 6px 12px 6px 8px;
    border-radius: 999px;
    border: 1px solid #d7dbe4;
    background: #f1f2f5; color: #8a90a0;
    font-size: 12px; font-weight: 700; cursor: pointer;
    white-space: nowrap;
    transition: background .15s, color .15s, border-color .15s;
}
.iv-addi-knob {
    width: 30px; height: 16px; border-radius: 999px; background: #c3c8d2;
    position: relative; flex: none; transition: background .15s;
}
.iv-addi-knob::after {
    content: ''; position: absolute; top: 2px; left: 2px;
    width: 12px; height: 12px; border-radius: 50%; background: #fff; transition: left .15s;
}
.iv-addi-toggle.on { background: #e8f0ff; color: #1565c0; border-color: #9cc0ff; }
.iv-addi-toggle.on .iv-addi-knob { background: #1565c0; }
.iv-addi-toggle.on .iv-addi-knob::after { left: 16px; }

/* ── 스타포스/큐브 박스 헤더 + 샤타포스·미라클 토글(컴팩트) ── */
.iv-box-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.iv-box-head .iv-box-title { margin: 0; }
.iv-box-toggle { margin-left: 0; padding: 4px 9px 4px 6px; font-size: 11px; gap: 5px; }
.iv-box-toggle .iv-addi-knob { width: 24px; height: 13px; }
.iv-box-toggle .iv-addi-knob::after { width: 9px; height: 9px; top: 2px; left: 2px; }
.iv-box-toggle.on .iv-addi-knob::after { left: 13px; }

/* 진단 패널 - 총합 미포함(취소선) */
.iv-diag-head b.iv-diag-excl { text-decoration: line-through; color: #8a90a0; }
.iv-diag-excl-tag {
    font-size: 9px; font-weight: 700; color: #ff8a8a;
    background: #3a2230; padding: 1px 5px; border-radius: 4px; margin-left: 4px;
}

/* 닉네임 줄에 토글 배치 (레벨 줄은 아래 전체폭) */
.iv-char-meta { flex: 1; min-width: 0; }
.iv-char-namerow { display: flex; align-items: center; gap: 8px; }
.iv-char-namerow .iv-char-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* "총합 미포함" 태그를 에디셔널 줄 아래로 */
.iv-diag-excl-line { margin: 3px 0 6px; }

/* 장비별 상세 헤더(성/스타포스/큐브) 중앙정렬 */
.iv-detail-head > span:not(:first-child) { text-align: center; }

/* 노작 시세 입력칸 (메소 원값) */
.iv-rev-input {
    width: 100%; box-sizing: border-box; padding: 3px 6px; text-align: right;
    border: 1px solid #dfe3ea; border-radius: 6px; background: #fafbfc;
    font-size: 12px; color: #222;
}
.iv-rev-input:focus { outline: none; border-color: #6aa0ff; background: #fff; }
.iv-rev-na { text-align: center; color: #c3c8d2; }

/* ── 스타포스 스펙업 패널 ── */
.equip-slot-item { cursor: pointer; }
.equip-slot-item.sel { outline: 2px solid #1565c0; outline-offset: 1px; }
.equip-slot-item.sel::after {
    content: '✓'; position: absolute; top: -6px; right: -6px;
    width: 15px; height: 15px; background: #1565c0; color: #fff;
    border-radius: 50%; font-size: 10px; line-height: 15px; text-align: center;
}
.iv-spec { margin-top: 14px; border-top: 1px solid #eef0f3; padding-top: 12px; }
.iv-spec-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; }
.iv-spec-title { font-size: 13px; font-weight: 700; color: #3C3744; }
.iv-spec-target { font-size: 12px; color: #8a90a0; }
.iv-spec-target input {
    width: 46px; padding: 3px 4px; text-align: center; margin: 0 3px;
    border: 1px solid #dfe3ea; border-radius: 6px; background: #fafbfc; font-size: 12px; color: #222;
}
.iv-spec-target input:focus { outline: none; border-color: #6aa0ff; background: #fff; }
.iv-spec-empty { font-size: 12px; color: #a0a4b0; padding: 6px 2px; line-height: 1.5; }
.iv-spec-row {
    display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 10px;
    padding: 9px 2px; border-top: 1px solid #f4f5f7; font-size: 13px;
}
.iv-spec-name { display: flex; align-items: center; gap: 6px; color: #333; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.iv-spec-name img { width: 18px; height: 18px; object-fit: contain; flex: none; }
.iv-spec-arrow { display: flex; align-items: center; color: #8a90a0; white-space: nowrap; font-size: 12px; }
.iv-spec-cost { font-weight: 700; color: #2b2b33; text-align: right; min-width: 62px; }
.iv-spec-total {
    display: flex; justify-content: space-between; align-items: center;
    margin-top: 8px; padding-top: 8px; border-top: 2px solid #e6e8ee; font-size: 13px; color: #555;
}
.iv-spec-total b { color: #1565c0; font-size: 15px; }
/* 스펙업 합계 계산 기준(샤타포스/일반) 배지 */
.iv-spec-basis {
    font-style: normal; font-size: 11px; font-weight: 700;
    margin-left: 4px; padding: 2px 7px; border-radius: 999px;
}
.iv-spec-basis.normal { color: #5b6472; background: #eef0f4; }
.iv-spec-basis.shatta { color: #1565c0; background: #e8f0ff; }

/* 스펙업 최대 성 표기 */
.iv-spec-cap { font-style: normal; font-size: 9px; color: #c0392b; background: #fdecea; padding: 1px 4px; border-radius: 4px; margin-left: 2px; }

/* 스펙업 장비별 목표 성 입력 */
.iv-spec-tinput {
    width: 52px; padding: 4px 6px; margin: 0 3px; text-align: center;
    border: 1px solid #dfe3ea; border-radius: 6px; background: #fafbfc; font-size: 13px; color: #222;
}
.iv-spec-tinput:focus { outline: none; border-color: #6aa0ff; background: #fff; }

/* ── 장비별 상세: 클릭 펼침 + 옵션 체크박스 ── */
.iv-detail-clickable { cursor: pointer; }
.iv-detail-clickable:hover { background: #fafbfd; }
.iv-detail-clickable.open { background: #f4f7ff; }
.iv-detail-caret { color: #9aa0ae; font-size: 10px; flex: none; margin-left: 5px; }
.iv-detail-nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.iv-detail-expand {
    display: flex;
    gap: 18px;
    padding: 12px 6px 14px 24px;
    background: #f7f9fc;
    border-top: 1px dashed #e3e7ef;
}
@media (max-width: 560px) { .iv-detail-expand { flex-direction: column; gap: 12px; } }
.iv-de-star { flex: none; width: 190px; }
.iv-de-cube { flex: 1; min-width: 0; }
.iv-de-star .iv-de-title { color: #3C3744; }
.iv-de-sf-na { font-size: 12px; color: #a8adb8; }
.iv-de-sf-row { display: flex; align-items: center; gap: 4px; font-size: 12px; color: #555; flex-wrap: wrap; }
.iv-de-sf-row b { color: #f5a623; }
.iv-de-sf-arrow { color: #b8bcc6; margin: 0 2px; }
.iv-sf-tinput {
    width: 50px; padding: 3px 5px; margin: 0 2px; text-align: center;
    border: 1px solid #dfe3ea; border-radius: 6px; background: #fff; font-size: 12px; color: #222;
}
.iv-sf-tinput:focus { outline: none; border-color: #6aa0ff; }
.iv-de-sf-ev { margin-top: 8px; font-size: 12px; color: #8a90a0; }
.iv-de-sf-ev b { color: #1565c0; font-size: 14px; }
.iv-de-sec { margin-bottom: 8px; }
.iv-de-sec:last-child { margin-bottom: 0; }
.iv-de-title { font-size: 12px; font-weight: 700; color: #3C3744; margin-bottom: 5px; display: flex; align-items: center; gap: 6px; }
.iv-de-title.g-rare { color: #2b8fd6; } .iv-de-title.g-epic { color: #8a5cd6; }
.iv-de-title.g-unique { color: #c79a15; } .iv-de-title.g-legendary { color: #2fae4e; }
.iv-de-opt {
    display: flex; align-items: center; gap: 6px;
    font-size: 12px; color: #444; padding: 3px 0; cursor: pointer;
}
.iv-de-opt input { margin: 0; cursor: pointer; }
.iv-de-opt.na { color: #b0b4bd; cursor: default; }
.iv-de-opt.na em { font-style: normal; font-size: 10px; color: #a8adb8; background: #eef0f3; padding: 1px 5px; border-radius: 4px; }
.iv-de-empty { font-size: 12px; color: #a0a4b0; }

/* 장비별 상세 헤더 (타이틀 + 에디 토글) */
.iv-detail-header { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.iv-box-detail .iv-box-title { margin: 0; }

/* 고정 노작가 표시 */
.iv-rev-fixed { text-align: right; font-size: 12px; color: #8a90a0; font-weight: 700; }

/* 페이지 헤더 (경험치 효율표와 동일 스타일) */
.iv-header { text-align: center; margin: 8px 0 22px; }
.iv-header h1 { font-size: 28px; color: #3C3744; margin: 0 0 8px; }
.iv-header-sub { color: #666; font-size: 14px; margin: 0; line-height: 1.5; }

/* ============================================================
   모바일 반응형 (≤480px) — 슬롯 그리드/상세 테이블 가로 넘침 방지
   ============================================================ */
@media (max-width: 480px) {
    .iv-container { padding: 12px; }
    .iv-equip-card, .iv-box { padding: 13px; }
    .iv-header h1 { font-size: 23px; }
    .iv-header-sub { font-size: 13px; }

    /* 장비 슬롯 그리드: 46px → 40px 로 축소 (7열 = 298px, 360px 폰에 맞춤) */
    .equip-slot-grid { grid-template-columns: repeat(7, 40px); grid-template-rows: repeat(6, 40px); gap: 3px; }
    .equip-slot-item { width: 40px; height: 40px; }
    .equip-slot-item img { width: 30px; height: 30px; }
    .equip-slot-item .slot-star { font-size: 8px; }
    /* 초소형(≤340px) 안전장치: 카드 안에서 가로 스크롤 (페이지 전체가 밀리지 않게) */
    .iv-equip-card { overflow-x: auto; }

    /* 장비별 상세 테이블: 열 폭 축소 + 이름 열은 minmax(0,1fr) 로 넘침 방지 */
    .iv-detail-row { grid-template-columns: minmax(0, 1fr) 26px 64px 64px 72px; gap: 5px; font-size: 12px; }
    .iv-detail-row.iv-detail-head { font-size: 10px; }
    .iv-detail-name img { width: 16px; height: 16px; }
    .iv-rev-input { font-size: 11px; padding: 3px 4px; }
    .iv-rev-fixed { font-size: 11px; }
}
