:root {
    --bg-color:     #EFE6D5;
    --card-bg:      #FDFAF5;
    --text-color:   #2C1E1A;
    --text-sub:     #5D4037;
    --accent-color: #9C7A3C;
    --active-color: #556B2F;
    --danger-color: #A63D40;
    --border-color: #D3C5B0;
    --fatigue-color:#8A8078;
    --tip-color:    #6D597A;
    --radius:       8px;
}

*, *::before, *::after { box-sizing: border-box; }

body {
    font-family: 'Noto Sans KR', 'Malgun Gothic', sans-serif;
    background: var(--bg-color);
    color: var(--text-color);
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
}


/* ── 서브 탭 바 ── */
.sub-tab-bar-wrap {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--card-bg);
    border-bottom: 2px solid var(--accent-color);
    flex-shrink: 0;
}

.sub-tab-bar {
    display: flex;
    overflow-x: auto;
    white-space: nowrap;
    scrollbar-width: none;
    scroll-behavior: smooth;
    padding-bottom: 2px;
}
.sub-tab-bar::-webkit-scrollbar { display: none; }

.sub-tab-bar-wrap::after {
    content: '';
    position: absolute;
    right: 0; top: 0; bottom: 2px;
    width: 30px;
    background: linear-gradient(to right, rgba(253, 250, 245, 0), rgba(253, 250, 245, 1)); 
    pointer-events: none;
}

.sub-tab-btn {
    flex-shrink: 0;
    padding: 8px 12px;
    font-size: 0.8em;
    font-family: 'Noto Sans KR', sans-serif;
    font-weight: 700;
    color: var(--text-sub);
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    transition: color 0.15s;
}

.sub-tab-btn:last-child {
    margin-right: 100px; 
}

.sub-tab-btn:hover { color: var(--accent-color); }

.sub-tab-btn.active {
    color: var(--active-color);
    border-bottom-color: var(--card-bg);
    border-top: 2px solid var(--active-color);
    border-left: 1px solid var(--active-color);
    border-right: 1px solid var(--active-color);
    border-radius: 6px 6px 0 0;
    position: relative;
    top: 1px;
    background: var(--bg-color);
}

/* ── 콘텐츠 영역 ── */
.sub-tab-content { padding: 14px 16px 24px; }
.sub-tab-panel { display: none; animation: fadeIn 0.2s ease; }
.sub-tab-panel.active { display: block; }

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

/* ── 아이콘 아이템 (HTML 수정 없이 CSS로 레이아웃 개편) ── */
.icon-item {
    display: flex;
    flex-wrap: wrap; /* 💡 자식 요소가 공간이 부족하면 줄바꿈되도록 허용 */
    align-items: center; /* 💡 아이콘과 제목 수직 중앙 정렬 */
    padding: 12px 0;
    border-bottom: 1px dashed var(--border-color);
}
.icon-item:last-child { border-bottom: none; }

.icon-wrap, .icon-wrap2 {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--card-bg);
    border-radius: 50%;
    border: 1px solid var(--border-color);
    margin-right: 12px; /* 💡 제목과의 가로 간격 */
    margin-bottom: 10px; /* 💡 하단 본문과의 세로 간격 */
}
.icon-wrap img { width: 20px; height: 20px; }
.icon-wrap2 img { width: 23px; height: 23px; }

/* 💡 핵심: 껍데기 역할을 없애서 내부 h4와 p가 개별 플렉스 아이템이 되도록 분리 */
.icon-info { 
    display: contents; 
}

/* ── 문단 제목(h4) 배경 강조 스타일 통합 ── */
.icon-info h4 {
    flex: 1; /* 💡 첫 줄의 남은 가로 공간을 모두 차지하여 제목을 꽉 채움 */
    text-align: left;
    font-size: 1em;
    font-weight: 700;
    color: var(--text-color);
    background: var(--bg-color);
    padding: 3px 7px;
    margin: 0 0 10px 0; /* 💡 아이콘 하단 마진과 높이 맞춤 */
    border-left: 4px solid var(--active-color); 
    border-radius: 0 6px 6px 0;
}

/* 💡 h4를 제외한 나머지 모든 태그(p, ul 등)는 너비 100%로 지정하여 아이콘 아래로 줄바꿈 */
.icon-info > *:not(h4) {
    width: 100%;
}

.icon-info p { 
    margin: 0; 
    font-size: 0.9em; 
    line-height: 1.6; 
    color: var(--text-sub); 
}

/* ── 여러 개의 아이콘을 가로로 묶어주는 그룹 ── */
.icon-multi-wrap {
    display: flex;
    align-items: center;
    gap: 3px;
    margin-right: 12px; 
    margin-bottom: 10px; 
}

/* 묶음 안쪽에 있는 개별 아이콘들의 여백 제거 */
.icon-multi-wrap .icon-wrap, 
.icon-multi-wrap .icon-wrap2 {
    margin: 0;
}

/* ── 설명 목록 ── */
.info-list { margin: 8px 0 0 0; padding: 0; list-style: none; font-size: 0.84em; line-height: 1.7; color: var(--text-sub); }
.info-list > li { margin-bottom: 8px; }
.info-list > li:last-child { margin-bottom: 0; }

.info-sublist { margin: 4px 0 0 0; padding-left: 12px; list-style: none; }
.info-sublist li { position: relative; margin-bottom: 4px; padding-left: 10px; }
.info-sublist li::before { content: '⁃'; position: absolute; left: 0; color: var(--accent-color); font-weight: 700; }

/* ── 아이콘 칩 ── */
.icon-chip {
    display: inline-flex;
    align-items: center;
    gap: 1px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 0 2px;
    font-size: 0.95em;
    vertical-align: middle;
    white-space: nowrap;
    vertical-align: 0em;
}
.icon-chip .status-icon { height: 1em; margin: 0; }

/* ── 노트/경고 블록 ── */
.ref-note {
    display: block;
    margin-top: 8px;
    padding: 6px 10px;
    background: var(--card-bg);
    border-left: 3px solid var(--accent-color);
    border-radius: 4px;
    font-size: 0.85rem;
    line-height: 1.5;
    color: var(--text-sub);
}
.ref-note.warn {
    border-left-color: var(--danger-color);
    color: var(--danger-color);
}
.info-list .ref-note {
    margin-top: 10px;
    margin-bottom: 4px;
}    
/* ── 그룹 서브 타이틀 ── */
.group-title {
    font-size: 0.75em;
    font-weight: 700;
    color: var(--text-sub);
    letter-spacing: 0.5px;
    text-transform: uppercase;
    padding: 6px 10px;
    margin: 10px -16px 8px -16px;
    background: var(--border-color);
    border-bottom: none;
}
.group-title:first-child { margin-top: 0; }

/* ── 적 칩 (Enemy) 패널 전용 스타일 ── */
.enemy-container {
    position: relative;
    width: 100%;
    max-width: 500px;
    margin: 0 auto 20px;
}
.enemy-img {
    width: 100%;
    display: block;
    border-radius: 50%;
}
.hotspot {
    position: absolute;
    cursor: pointer;
    background: rgba(255, 255, 255, 0);
    transition: background 0.2s;
}
.hotspot:active {
    background: rgba(255, 255, 255, 0.2);
}

@keyframes pulse-hint {
    0%   { background: rgba(212,175,55,0);   border-color: transparent; }
    50%  { background: rgba(212,175,55,0.3); border-color: #D4AF37; box-shadow: 0 0 15px rgba(212,175,55,0.6); }
    100% { background: rgba(212,175,55,0);   border-color: transparent; }
}

.hotspot.show-hint {
    animation: pulse-hint 1.2s ease-in-out 2;
    border: 3px solid transparent;
    border-radius: 5px;
}

/* 좌표 */
.hs-name        { top: 58%; left: 25%; width: 50%; height:  8%; border-radius: 5px; }
.hs-type        { top: 48%; left: 29%; width: 10%; height: 10%; border-radius: 5px; }
.hs-hp          { top: 29%; left: 13%; width: 14%; height: 14%; border-radius: 50%; }
.hs-level       { top: 47%; left: 43%; width: 15%; height: 10%; border-radius: 5px; }
.hs-range       { top: 44%; left: 10%; width: 14%; height: 14%; border-radius: 50%; }
.hs-atk         { top: 29%; right:12%; width: 14%; height: 14%; border-radius: 50%; }
.hs-def         { top: 44%; right: 9%; width: 14%; height: 14%; border-radius: 50%; }
.hs-priority    { top: 48%; right:28%; width: 10%; height: 10%; border-radius: 5px; }
.hs-skills-warp { bottom:22%; left: 20%; width: 60%; height: 10%; border-radius: 5px; }

/* 상세 정보 박스 */
.detail-box {
    margin-top: 20px;
    padding: 15px;
    background: var(--card-bg);
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    border-left: 5px solid var(--accent-color);
    transition: background-color 0.3s ease, border-color 0.3s ease;
}
.detail-box.active {
    background-color: var(--card-bg);
    border-left-color: var(--accent-color);
}
.detail-box strong {
    display: block;
    margin-bottom: 8px;
    font-size: 1.05em;
    color: var(--accent-color);
}
.detail-box p {
    margin: 0;
    font-size: 0.9em;
    line-height: 1.6;
    color: var(--text-sub);
}

/* 상세 텍스트 목록 */
.level-list { list-style: none; padding: 0; margin: 10px 0; }
.level-list li { margin-bottom: 6px; font-size: 0.95em; }
.lvl-1  { color: #1a1a1a; font-weight: 700; }
.lvl-5  { color: #2E7D32; font-weight: 700; }
.lvl-10 { color: #7B1FA2; font-weight: 700; }
.lvl-20 { color: #C62828; font-weight: 700; }
.lvl-q  { color: #633A24; font-weight: 700; }
.level-list li span { padding: 2px 4px; border-radius: 4px; }

.type-list { margin: 10px 0; }
.type-item {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
    padding: 5px 8px;
    background: rgba(0,0,0,0.03);
    border-radius: 6px;
}
.type-item img { width: 24px; height: 24px; object-fit: contain; flex-shrink: 0; }
.type-item strong { color: var(--accent-color); min-width: 80px; }

.info-panel { display: flex; flex-direction: column; gap: 12px; font-size: 0.95em; }
.info-panel-block {
    background: rgba(255,255,255,0.5);
    padding: 12px;
    border-radius: var(--radius);
    border: 1px solid rgba(0,0,0,0.06);
    line-height: 1.6;
    word-break: keep-all;
}
.info-panel-block .block-title { font-weight: 700; margin-bottom: 8px; color: var(--text-color); }
    .info-panel-block .block-note {
    font-size: 0.82em;
    color: var(--text-sub);
    border-top: 1px dashed var(--border-color);
    padding-top: 6px;
    margin-top: 8px;
    line-height: 1.4;
}
.priority-row { display: flex; align-items: flex-start; gap: 6px; margin-bottom: 6px; font-size: 0.9em; line-height: 1.4; }
.priority-row img { height: 1.3em; width: auto; flex-shrink: 0; position: relative; top: 0.1em; }
.priority-row span { display: inline; color: var(--text-sub); }

/* ── 세션 EP 표 ── */
.ep-block {
    display: block;
    padding: 0 4px;
}
.ep-intro {
    display: block;
    padding: 4px 0 10px 0;
}
.ep-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85em;
    text-align: center;
}
.ep-table thead tr {
    background: var(--text-color);
    color: var(--card-bg); /* 기존 --active-text 대신 배경색 변수 재활용 */
}
.ep-table th {
    padding: 6px 4px;
    text-align: center;
    color: var(--card-bg);
}
.ep-table th:first-child { text-align: left; }
.ep-table td {
    padding: 6px 4px;
    border-bottom: 1px dashed var(--border-color);
}
.ep-table td:first-child {
    text-align: left;
    font-weight: 700;
    color: var(--accent-color);
}
.ep-table tbody tr:nth-child(odd) {
    background: var(--bg-color);
}
.ep-table tbody tr:nth-child(even) {
    background: var(--card-bg);
}
.ep-table tbody tr:last-child td {
    border-bottom: none;
}
.ep-table small {
    color: var(--text-sub);
    font-size: 0.85em;
}

/* ── 하루 단계(Daily) 전용 페이즈 블록 스타일 ── */
.phase-block {
    margin-bottom: 14px;
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    overflow: hidden;
}
.phase-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    font-size: 0.88em;
    font-weight: 700;
    color: #fff;
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}
.phase-header .phase-num {
    font-family: 'Cinzel', serif;
    font-size: 0.8em;
    opacity: 0.8;
}
.phase-header .chevron {
    margin-left: auto;
    font-size: 0.75em;
    transition: transform 0.2s;
}
.phase-header.collapsed .chevron { transform: rotate(-90deg); }

.phase-1 .phase-header { background: #5D4037; }
.phase-2 .phase-header { background: var(--active-color); }
.phase-3 .phase-header { background: var(--danger-color); }
.phase-4 .phase-header { background: var(--accent-color); }
.phase-5 .phase-header { background: #37474F; }

.phase-body {
    padding: 12px 14px;
    background: var(--card-bg);
    font-size: 0.84em;
    line-height: 1.7;
    color: var(--text-sub);
}
.phase-body.hidden { display: none; }

.step-item {
    padding: 8px 0;
    border-bottom: 1px dashed var(--border-color);
}
.step-item:last-child { border-bottom: none; padding-bottom: 0; }
.step-title {
    font-weight: 700;
    color: var(--text-color);
    margin-bottom: 4px;
}
.step-desc { color: var(--text-sub); }

.branch-list {
    margin: 6px 0 0 0;
    padding-left: 12px;
    list-style: none;
}
.branch-list li {
    position: relative;
    padding-left: 10px;
    margin-bottom: 4px;
    font-size: 0.95em;
}
.branch-list li::before {
    content: '⁃';
    position: absolute;
    left: 0;
    color: var(--accent-color);
    font-weight: 700;
}
.branch-list li:last-child { margin-bottom: 0; }
.phase-body .ref-note { background-color: var(--bg-color); }

/* ── 길드 탭 전용 레이아웃 ── */

/* 1. 이미지와 설명을 나란히 배치하는 영역 */
.guild-content {
    display: flex;
    gap: 14px;
    align-items: center;
    margin-bottom: 12px;
}

/* 2. 길드 깃발 이미지 */
.guild-flag {
    width: 60px;
    height: auto;
    flex-shrink: 0; /* 텍스트가 길어져도 이미지 크기 유지 */
    border-radius: 4px;
    box-shadow: var(--shadow-sm);
}

/* 3. 길드 설명 텍스트 */
.guild-desc {
    margin: 0;
    color: var(--text-sub);
    line-height: 1.6;
}

/* 4. 길드 포커스 텍스트 */
.guild-focus {
    margin-top: 8px;
    font-size: 0.82em;
    color: var(--text-sub);
    border-top: 1px dashed var(--border-color);
    padding-top: 8px;
}

/* ── 길드 접수대 (마을 행동) 전용 스타일 ── */
.kiosk-title {
    display: flex;
    align-items: center;
    gap: 6px;
}
.kiosk-title img {
    width: 20px;
    height: 20px;
}
.kiosk-title strong {
    color: var(--text-color);
}
.kiosk-desc {
    display: block;
    margin-top: 4px;
}

/* 퀘스트 탭 키워드 블록 폰트 크기 강제 고정 */
.info-panel-block {
    font-size: 0.84em; /* 본문 폰트 크기인 0.84em과 통일 */
    line-height: 1.6;
}
.info-panel-block .block-title {
    font-size: 1.05em; /* 제목 크기를 다른 제목들과 균형 맞춤 */
}

/* ── 인라인 아코디언 스타일 추가 ── */
.accordion-btn {
    display: inline-block;
    margin-top: 8px; /* 위쪽 여백 */
    padding: 2px 6px;
    font-size: 0.75em;
    color: var(--accent-color);
    background: transparent;
    border: 1px solid var(--accent-color);
    border-radius: 4px;
    cursor: pointer;
    vertical-align: middle;
    transition: all 0.2s;
}

.accordion-btn:hover, .accordion-btn.active {
    background: var(--accent-color);
    color: #FDFAF5; /* 카드 배경색 */
}

.accordion-content {
    max-height: 0;           /* 닫혀 있을 때 보이지 않음 */
    overflow: hidden;        /* 내용이 넘치면 숨김 */
    transition: max-height 0.3s ease-out; /* 부드러운 애니메이션 */
    margin-top: 0;
    padding: 0 10px;
    background: rgba(0, 0, 0, 0.03);
    border-radius: 4px;
    font-size: 0.85em;
    color: var(--text-sub);
}

/* 열렸을 때의 스타일 */
.accordion-content.open {
    max-height: 500px; /* 충분한 높이로 설정 */
    margin-top: 6px;
    padding: 8px 10px;
}