/* korean/timeline-chart.css — 사건 연표 차트 공유 스타일
   series.html 인라인 스타일에서 추출. timeline.html(전체 DB 페이지)에서 사용.
   (Phase B에서 series.html도 이 파일을 링크하도록 이관 예정) */

/* base CSS(style.css/learn.css)가 없을 때를 대비한 보조 변수 폴백 */
:root {
    --hub-text-secondary: var(--hub-muted, #807565);
    --hub-text-primary: var(--hub-text, #2c251e);
    --hub-text-main: var(--hub-text, #2c251e);
    --hub-sidebar-bg: #faf8f5;
}

.event-timeline-wrap {
    margin-bottom: 20px;
    border: 1px solid var(--hub-border);
    border-radius: 10px;
    overflow: hidden;
    background: var(--hub-card-bg);
}
.event-timeline-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: var(--hub-sidebar-bg);
    border-bottom: 1px solid var(--hub-border);
    cursor: pointer;
    user-select: none;
}
.event-timeline-header-title {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--hub-text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
}
.event-timeline-header-right {
    display: flex;
    align-items: center;
    gap: 10px;
}
.event-timeline-toggle-icon {
    font-size: 0.75rem;
    color: var(--hub-text-secondary);
    transition: transform 0.25s;
}
.event-timeline-toggle-icon.open { transform: rotate(180deg); }
.event-timeline-body { padding: 12px 14px; }

/* 다운로드 버튼 */
.clt-download-btn {
    border: 1px solid var(--hub-border);
    border-radius: 8px;
    background: var(--hub-card-bg);
    padding: 7px 13px;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--hub-text-secondary);
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    line-height: 1;
    vertical-align: middle;
}
.clt-download-btn:hover {
    border-color: var(--hub-accent);
    color: var(--hub-accent);
    background: var(--hub-sidebar-bg);
}
.clt-download-btn svg { width: 15px; height: 15px; }
/* 저장: 강조(채움) 버튼 — 눈에 잘 띄게 */
.clt-download-btn.is-primary { background: #0f766e; border-color: #0f766e; color: #fff; }
.clt-download-btn.is-primary:hover { background: #0b5c54; border-color: #0b5c54; color: #fff; }
/* 헤더 액션 묶음 — 좁으면 줄바꿈해 오른쪽 정렬 */
.tl-head-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; flex-shrink: 0; }

/* ── 세로 연표(연표형) ── */
.series-tl-chart-wrap {
    position: relative;
    border: 1px solid var(--hub-border);
    border-radius: 12px;
    background: #ffffff;
    overflow: hidden;
    box-shadow: var(--hub-shadow-sm);
}
.series-tl-chart-scroll {
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
}
.series-tl-chart-scroll svg {
    display: block;
    width: auto !important;
    max-width: none !important;
}

/* 연표 컨트롤 — 범례 / 나라 선택 / 옵션 */
.etl-controls {
    border-bottom: 1px solid var(--hub-border);
    background: var(--hub-card-bg);
    font-size: 0.82rem;
    color: var(--hub-text-secondary);
}
.etl-legend {
    display: flex; flex-wrap: wrap; align-items: center;
    gap: 6px 16px; padding: 10px 14px;
}
.etl-legend-item { display: inline-flex; align-items: center; gap: 6px; }
.etl-legend-swatch { display: inline-block; width: 16px; height: 9px; border-radius: 2px; }
.etl-legend-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; }
.etl-legend-dash { display: inline-block; width: 18px; height: 0; border-top: 2px dashed currentColor; }

.etl-ctrl-row { padding: 11px 14px; border-top: 1px solid var(--hub-border); }
.etl-ctrl-inline { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.etl-ctrl-head { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; font-weight: 700; color: var(--hub-text); margin-bottom: 9px; }
.etl-ctrl-inline .etl-ctrl-head { margin-bottom: 0; white-space: nowrap; }
.etl-ctrl-hint { font-weight: 500; font-size: 0.73rem; color: var(--hub-muted); }

/* 칩 검색 + 높이 제한 스크롤 (항목 많을 때) */
.etl-chip-search {
    margin-left: auto; width: 150px; max-width: 45%; padding: 5px 11px;
    border: 1px solid var(--hub-border); border-radius: 8px; font-size: 0.8rem;
    font-family: inherit; outline: none; background: var(--hub-card-bg, #fff);
}
.etl-chip-search:focus { border-color: #0f766e; }
.etl-chip-search-row { margin: 0 0 8px; }
.etl-chip-search-row .etl-chip-search { margin-left: 0; width: 100%; max-width: 100%; }
.etl-chip-wrap.is-scroll, .tl-lineage-wrap.is-scroll {
    max-height: 196px; overflow-y: auto; padding: 4px;
    border: 1px solid var(--hub-border); border-radius: 10px; background: rgba(0,0,0,0.015);
}

/* 맨 위 줄은 카드 경계와 겹치지 않게 윗선 제거 */
.etl-controls > :first-child { border-top: none; }

/* 보기 설정(연도 구간·빈 구간 접기·세로 간격) 접기 패널 */
.etl-settings { border-top: 1px solid var(--hub-border); }
.etl-settings-toggle {
    display: flex; align-items: center; gap: 8px; width: 100%;
    padding: 12px 14px; border: none; cursor: pointer;
    font: inherit; font-weight: 700; color: var(--hub-text); text-align: left;
    background: rgba(15, 118, 110, 0.06);
}
.etl-settings-toggle:hover { background: rgba(15, 118, 110, 0.11); }
/* 펼친 상태: 헤더처럼 강조해 '접는 표시'를 분명히 */
.etl-settings-toggle.is-open {
    background: rgba(15, 118, 110, 0.14);
    color: #0f766e;
    border-bottom: 1px solid var(--hub-border);
}
.etl-settings-caret {
    margin-left: auto; font-size: 0.95rem; color: var(--hub-muted);
    transition: transform 0.2s ease;
}
.etl-settings-toggle.is-open .etl-settings-caret { transform: rotate(180deg); color: #0f766e; }
/* 펼쳐진 내용은 살짝 들어간 배경으로 묶어서 구분 */
.etl-settings-panel { background: rgba(0, 0, 0, 0.025); }
.etl-settings-panel[hidden] { display: none; }

/* 하단 범례: 참고용이라 작고 차분하게 */
.etl-legend.is-foot { border-top: 1px solid var(--hub-border); font-size: 0.74rem; color: var(--hub-muted); }

/* 미선택(빈) 안내 */
.etl-empty-pick { text-align: center; padding: 48px 20px 60px; color: var(--hub-muted); }
.etl-empty-ico { font-size: 2.4rem; margin-bottom: 10px; }
.etl-empty-title { font-size: 1.05rem; font-weight: 800; color: var(--hub-text); margin-bottom: 6px; }
.etl-empty-desc { font-size: 0.88rem; line-height: 1.6; }
.etl-empty-desc b { color: #0f766e; }

/* 상단 컴팩트 툴바 (보기 설정 버튼 + 바로 조절 항목들) */
.etl-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; padding: 11px 14px; }
/* 연도 구간/세기 바 — 모달 밖, 툴바 아래에 항상 표시 (즉시 반영) */
.etl-rangebar { padding: 9px 14px; border-top: 1px solid var(--hub-border); background: var(--hub-bg, #f8fafc); }
.etl-rangebar .etl-ctrl-inline { gap: 10px 12px; }

/* 세계 공통 사건 — 연도 묶음 라벨 & 펼침 팝업 */
.etl-global-more { font-size: 0.82em; opacity: 0.8; }
.etl-gg-pop {
    position: fixed; z-index: 100050; max-width: 280px; max-height: 60vh; overflow-y: auto;
    background: #fff; border: 1px solid var(--hub-border); border-radius: 10px;
    box-shadow: 0 12px 36px rgba(0,0,0,0.22); padding: 6px;
    font-family: 'Noto Sans KR', 'Malgun Gothic', sans-serif;
}
.etl-gg-head { font-size: 0.78rem; font-weight: 800; color: #6d4caf; padding: 5px 8px 7px; }
.etl-gg-item {
    display: block; width: 100%; text-align: left; border: none; background: transparent;
    padding: 7px 9px; border-radius: 7px; cursor: pointer; font-family: inherit;
    font-size: 0.85rem; font-weight: 600; color: var(--hub-text); line-height: 1.3;
}
.etl-gg-item:hover { background: var(--hub-bg, #f1f5f9); color: #6d4caf; }
.etl-cfg-open {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 6px 14px;
    background: #0f766e; color: #fff; border: none; border-radius: 8px;
    font-weight: 800; font-size: 0.8rem; cursor: pointer; font-family: inherit; white-space: nowrap;
}
.etl-cfg-open:hover { background: #0b5c54; }
.etl-toolbar-min { justify-content: center; padding: 16px 14px; }
.etl-toolbar-min .etl-cfg-open { font-size: 0.92rem; padding: 12px 22px; }
.etl-tb-item { display: inline-flex; align-items: center; gap: 7px; }
.etl-tb-lbl { font-size: 0.8rem; font-weight: 700; color: var(--hub-text-secondary); white-space: nowrap; }
.etl-tb-zoom .etl-zoom-range { width: 120px; max-width: none; }
/* 데스크톱: 보기설정·중요는 왼쪽, 세로·글자는 오른쪽으로 */
.etl-tb-zoom { margin-left: auto; }

.etl-cfg-open-btn-round {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 10px 24px; font-size: 0.85rem; font-weight: 800;
    background: #ffffff; border: 1.5px solid var(--hub-accent, #6b1f1f); border-radius: 999px;
    color: var(--hub-accent, #6b1f1f); cursor: pointer; transition: all 0.2s;
    font-family: inherit; margin: 0 auto; box-shadow: 0 2px 6px rgba(0,0,0,0.03);
}
.etl-cfg-open-btn-round:hover {
    background: rgba(107, 31, 31, 0.04);
    box-shadow: 0 4px 12px rgba(107, 31, 31, 0.08);
}

@media (max-width: 768px) {
    .etl-toolbar { gap: 10px 14px; }
    .etl-cfg-open { flex: none; padding: 7px 14px; font-size: 0.8rem; border-radius: 8px; }      /* 모바일에서도 컴팩트하게 정렬 */
    .etl-tb-imp { flex: 1 1 100%; }                        /* 중요 사건만: 한 줄 */
    .etl-tb-zoom { margin-left: 0; flex: 1 1 auto; }       /* 세로 + 글자는 한 줄에 함께 */
    .etl-tb-zoom .etl-zoom-range { flex: 1; width: auto; min-width: 80px; }
}

/* 보기 설정 모달 */
.etl-cfg-modal {
    position: fixed; inset: 0; z-index: 100001; padding: 18px;
    background: rgba(15, 23, 42, 0.5); display: flex; align-items: center; justify-content: center;
    font-family: 'Noto Sans KR', 'Malgun Gothic', sans-serif;
}
.etl-cfg-modal[hidden] { display: none; }
.etl-cfg-card {
    background: #fff; border-radius: 16px; width: 100%; max-width: 520px; max-height: 86vh;
    display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.etl-cfg-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 15px 18px; border-bottom: 1px solid var(--hub-border);
    font-weight: 800; font-size: 1.02rem; color: var(--hub-text);
}
.etl-cfg-close { width: 30px; height: 30px; border: none; border-radius: 8px; background: #f1f5f9; color: #475569; cursor: pointer; font-size: 0.95rem; }
.etl-cfg-close:hover { background: #e2e8f0; }
.etl-cfg-body { overflow-y: auto; }
.etl-cfg-body .etl-ctrl-row:first-child { border-top: none; }
.etl-cfg-actions { margin-left: auto; display: inline-flex; gap: 6px; }

/* 보기 설정 모달 하단 — '적용' 버튼 (변경은 적용을 눌러야 반영) */
.etl-cfg-foot {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 12px 18px; border-top: 1px solid var(--hub-border); background: #fff;
}
.etl-cfg-foot-hint { font-size: 0.78rem; color: var(--hub-text-secondary); }
.etl-cfg-apply {
    flex: none; border: none; border-radius: 9px; cursor: pointer;
    padding: 9px 26px; font-size: 0.9rem; font-weight: 800; font-family: inherit;
    background: var(--hub-accent, #6b1f1f); color: #fff;
    transition: filter .15s;
}
.etl-cfg-apply:hover { filter: brightness(1.08); }
.etl-cfg-apply:active { filter: brightness(0.95); }
.etl-century-hint { font-size: 0.72rem; font-weight: 600; color: var(--hub-muted); }

/* 글자 크기 −/+ 컨트롤 */
.etl-fontsize { display: inline-flex; align-items: center; gap: 8px; }
.etl-fs-btn {
    width: 30px; height: 30px; border: 1px solid var(--hub-border); border-radius: 6px;
    background: var(--hub-card-bg); color: var(--hub-text); font-size: 1rem; font-weight: 700;
    line-height: 1; cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
}
.etl-fs-btn:hover { border-color: var(--hub-accent, #6b1f1f); color: var(--hub-accent, #6b1f1f); }
.etl-fs-val { min-width: 42px; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--hub-text); }

.etl-chip-wrap { display: flex; flex-wrap: wrap; gap: 7px; }
.etl-chip {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 5px 11px; border-radius: 999px;
    border: 1px solid var(--hub-border); background: var(--hub-card-bg);
    color: var(--hub-text-secondary); line-height: 1;
    cursor: pointer; user-select: none;
    transition: border-color .15s, background .15s, color .15s;
}
.etl-chip input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.etl-chip-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; flex: none; }
.etl-chip:hover { border-color: #94a3b8; }
.etl-chip:has(input:checked) {
    background: var(--hub-bg, #f1f5f9); border-color: #64748b;
    color: var(--hub-text); font-weight: 700;
}
.etl-chip.is-fixed { cursor: default; }
.etl-chip.is-fixed:hover { border-color: #64748b; }
.etl-chip-tag {
    font-size: 9.5px; font-weight: 800; line-height: 1; letter-spacing: .2px;
    padding: 2px 5px; border-radius: 999px; background: #475569; color: #fff;
}
.etl-chip-tag.is-kin { background: #0f766e; }

.etl-switch { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; user-select: none; }
.etl-switch input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.etl-switch-track {
    position: relative; flex: none; width: 38px; height: 22px; border-radius: 999px;
    background: #cbd5e1; transition: background .18s;
}
.etl-switch-track::after {
    content: ''; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px;
    border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: transform .18s;
}
.etl-switch input:checked + .etl-switch-track { background: #0f766e; }
.etl-switch input:checked + .etl-switch-track::after { transform: translateX(16px); }
.etl-switch-label { color: var(--hub-text); font-weight: 600; }

/* 연도 구간 입력 */
.etl-range-input {
    width: 68px; padding: 4px 8px; border: 1.5px solid var(--hub-border, #e2e8f0); border-radius: 8px;
    font-size: 0.82rem; font-weight: 700; color: var(--hub-text); text-align: center; font-family: inherit;
    outline: none; transition: border-color 0.15s; background: var(--hub-card-bg);
}
.etl-range-input:focus { border-color: var(--hub-accent, #6b1f1f); }
.etl-range-input::-webkit-outer-spin-button,
.etl-range-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.etl-range-sep { color: var(--hub-muted); font-weight: 700; font-size: 0.85rem; margin: 0 2px; }

.etl-range-btn-compact {
    padding: 5px 12px; background: #fff; border: 1.5px solid var(--hub-border, #e2e8f0); border-radius: 8px;
    font-size: 0.8rem; font-weight: 700; color: var(--hub-muted, #64748b); cursor: pointer; transition: all 0.15s;
    font-family: inherit; display: inline-flex; align-items: center; justify-content: center;
    white-space: nowrap;
}
.etl-range-btn-compact:hover { background: #f1f5f9; border-color: #cbd5e1; color: var(--hub-text); }

/* 세기 빠른 선택 */
.etl-century-btn {
    padding: 5px 12px; background: #fff; border: 1.5px solid var(--hub-border, #e2e8f0); border-radius: 8px;
    font-size: 0.8rem; font-weight: 700; color: var(--hub-text); cursor: pointer; transition: all 0.15s;
    font-family: inherit; display: inline-flex; align-items: center; justify-content: center;
    white-space: nowrap;
}
.etl-century-btn:hover { background: #fdfcf9; border-color: var(--hub-accent, #6b1f1f); color: var(--hub-accent, #6b1f1f); }
.etl-century-btn.is-on { background: var(--hub-accent, #6b1f1f); border-color: var(--hub-accent, #6b1f1f); color: #fff; }

.etl-div { display: inline-block; width: 1.5px; height: 16px; background: var(--hub-border, #e2e8f0); margin: 0 4px; align-self: center; }

.etl-zoom-range { flex: 1; max-width: 240px; cursor: pointer; accent-color: #0f766e; }
.etl-zoom-val { min-width: 44px; text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--hub-text); }

/* 모바일: 연표 이미지 미리보기(탭하여 확대) */
.etl-mobile-preview {
    position: relative;
    overflow: hidden;
    padding: 6px;
    cursor: zoom-in;
    user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
}
.etl-mobile-preview svg {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    height: auto !important;
    pointer-events: none;
}
.etl-mobile-preview.is-locked { max-height: 320px; }
.etl-mobile-preview.is-locked::after {
    content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 96px;
    background: linear-gradient(to bottom, rgba(255,255,255,0), var(--hub-card-bg));
    pointer-events: none;
}
.etl-mobile-preview-hint {
    position: absolute; right: 12px; bottom: 10px;
    background: rgba(15,23,42,0.82); color: #fff;
    font-size: 0.74rem; font-weight: 700; padding: 5px 10px; border-radius: 999px;
    pointer-events: none;
}

/* 연표 확대 모달 */
.etl-zoom-modal {
    position: fixed; inset: 0; z-index: 100000;
    background: rgba(10,15,28,0.88);
    -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
    user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
    touch-action: none;
    animation: etlZoomFade 0.18s ease-out;
}
@keyframes etlZoomFade { from { opacity: 0; } to { opacity: 1; } }
.etl-zoom-stage { position: absolute; inset: 0; overflow: hidden; touch-action: none; }
.etl-zoom-content {
    position: absolute; top: 0; left: 0; transform-origin: 0 0;
    background: #ffffff; border-radius: 10px;
    box-shadow: 0 16px 50px rgba(0,0,0,0.55);
    max-width: none !important; max-height: none !important;
}
.etl-zoom-content svg {
    pointer-events: none; display: block;
    max-width: none !important; max-height: none !important; min-width: 0 !important;
}
.etl-zoom-topbar {
    position: absolute; top: 0; left: 0; right: 0; z-index: 2;
    display: flex; align-items: center; justify-content: space-between;
    gap: 10px; padding: 14px 16px;
    background: linear-gradient(to bottom, rgba(10,15,28,0.65), rgba(10,15,28,0));
    pointer-events: none;
}
.etl-zoom-topbar > * { pointer-events: auto; }
.etl-zoom-brand { color: #f8fafc; font-weight: 800; font-size: 0.92rem; text-shadow: 0 1px 3px rgba(0,0,0,0.5); }
.etl-zoom-close {
    width: 40px; height: 40px; border: none; border-radius: 50%;
    background: #ef4444; color: #fff; font-size: 18px; font-weight: 800;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    box-shadow: 0 3px 10px rgba(0,0,0,0.35);
}
.etl-zoom-close:active { background: #dc2626; }
.etl-zoom-controls {
    position: absolute; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 2;
    display: flex; align-items: center; gap: 6px;
    padding: 7px 10px; border-radius: 999px;
    background: rgba(30,41,59,0.92);
    -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.4);
}
.etl-zoom-btn {
    width: 40px; height: 40px; border: none; border-radius: 50%;
    background: rgba(255,255,255,0.12); color: #fff; font-size: 19px; font-weight: 800;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.etl-zoom-btn:active { background: rgba(255,255,255,0.28); }
.etl-zoom-pct { min-width: 56px; text-align: center; color: #fff; font-weight: 700; font-variant-numeric: tabular-nums; }
.etl-zoom-lockbar {
    position: absolute; left: 50%; bottom: 78px; transform: translateX(-50%); z-index: 2;
    max-width: 90%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    padding: 8px 16px; border-radius: 999px;
    background: rgba(124,45,18,0.94); color: #fff;
    font-size: 0.78rem; font-weight: 700; text-align: center;
    box-shadow: 0 4px 14px rgba(0,0,0,0.35);
}

/* SVG 텍스트/요소 스타일 */
.etl-grid-line { stroke: var(--hub-border); stroke-width: 1; opacity: 0.5; }
.series-tl-chart-scroll svg text,
.etl-mobile-preview svg text,
.etl-zoom-content svg text {
    font-family: 'Noto Sans KR', 'Pretendard', 'Malgun Gothic', 'Apple SD Gothic Neo', sans-serif;
}
.etl-year-label { font-size: calc(12px * var(--etl-fs, 1)); fill: var(--hub-text-secondary); font-weight: 600; }
.etl-col-head { font-size: calc(15px * var(--etl-fs, 1)); font-weight: 900; letter-spacing: -0.2px; }
.etl-lineage-head { font-size: calc(13px * var(--etl-fs, 1)); font-weight: 800; }
.etl-leader-label { font-size: calc(11px * var(--etl-fs, 1)); fill: #ffffff; font-weight: 800; }
.etl-leader-callout { font-size: calc(11px * var(--etl-fs, 1)); font-weight: 700; }
.etl-term-year { font-size: calc(9.5px * var(--etl-fs, 1)); font-weight: 800; }
.etl-event-text { font-size: calc(11.5px * var(--etl-fs, 1)); }
.etl-event-year { font-weight: 800; }
.etl-era-label { fill: #ffffff; font-size: 11px; font-weight: 800; }
.etl-era-scope { font-size: 0.78em; color: var(--hub-muted); font-weight: 500; }
/* 클릭 가능한 사건 텍스트 */
.etl-event-text[data-evt] { cursor: pointer; pointer-events: auto; }
.etl-event-text[data-evt]:hover { text-decoration: underline; }

/* 사건 상세 모달 (나무위키식 간략 설명) */
.etl-info-modal {
    position: fixed; inset: 0; z-index: 100001;
    background: rgba(15, 23, 42, 0.55);
    display: flex; align-items: center; justify-content: center; padding: 20px;
    font-family: 'Noto Sans KR', 'Pretendard', 'Malgun Gothic', 'Apple SD Gothic Neo', sans-serif;
}
.etl-info-card {
    position: relative; background: #fff; border-radius: 16px;
    width: 100%; max-width: 460px; max-height: 82vh; overflow-y: auto;
    padding: 24px 24px 26px; box-shadow: 0 20px 60px rgba(15, 23, 42, 0.35);
}
/* 모달 스크롤바 — 얇고 차분하게 */
.etl-info-card, .etl-person-body { scrollbar-width: thin; scrollbar-color: rgba(100,116,139,0.35) transparent; }
.etl-info-card::-webkit-scrollbar, .etl-person-body::-webkit-scrollbar { width: 8px; }
.etl-info-card::-webkit-scrollbar-track, .etl-person-body::-webkit-scrollbar-track { background: transparent; }
.etl-info-card::-webkit-scrollbar-thumb, .etl-person-body::-webkit-scrollbar-thumb {
    background: rgba(100,116,139,0.35); border-radius: 999px; border: 2px solid transparent; background-clip: padding-box;
}
.etl-info-card::-webkit-scrollbar-thumb:hover, .etl-person-body::-webkit-scrollbar-thumb:hover { background: rgba(100,116,139,0.55); background-clip: padding-box; }
.etl-info-close {
    position: absolute; top: 14px; right: 14px; width: 32px; height: 32px;
    border: none; border-radius: 9px; background: #f1f5f9; color: #475569;
    font-size: 1rem; line-height: 1; cursor: pointer; transition: background 0.15s;
}
.etl-info-close:hover { background: #e2e8f0; }
.etl-info-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.etl-info-year { font-weight: 800; font-size: 1.05rem; color: #334155; font-variant-numeric: tabular-nums; letter-spacing: 0.3px; }
.etl-info-badge { color: #fff; font-size: 0.72rem; font-weight: 700; padding: 3px 10px; border-radius: 999px; letter-spacing: 0.2px; }
.etl-info-modal .etl-info-title {
    margin: 0 0 16px; font-size: 1.4rem; font-weight: 800; color: #15233b;
    font-family: 'Noto Sans KR', 'Pretendard', 'Malgun Gothic', 'Apple SD Gothic Neo', sans-serif;
    line-height: 1.35; letter-spacing: -0.4px; padding-right: 30px;
}
.etl-info-memo {
    margin: 0 0 0.95em; color: #3f4a5a; font-size: 0.93rem; line-height: 1.75;
    white-space: pre-wrap; text-align: justify; word-break: break-word; line-break: auto;
}
.etl-info-memo:last-of-type { margin-bottom: 18px; }
.etl-info-apps-label {
    font-size: 0.72rem; font-weight: 800; color: #94a3b8; letter-spacing: 0.5px;
    text-transform: uppercase; margin: 0 0 10px;
    padding-top: 16px; border-top: 1px solid #eef1f5;
}
/* 등장 콘텐츠 카드 */
.etl-info-app {
    display: flex; align-items: center; gap: 12px;
    background: #f8fafb; border: 1px solid #eaeef2;
    border-radius: 12px; padding: 13px 14px; margin-bottom: 9px;
    text-decoration: none;
}
.etl-info-app-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.etl-info-app-series {
    font-size: 0.72rem; font-weight: 700; color: #0f766e; letter-spacing: 0.1px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.etl-info-app-ep {
    font-size: 0.92rem; font-weight: 700; color: #1e293b; line-height: 1.45; word-break: keep-all;
}
.etl-info-app-arrow {
    flex-shrink: 0; width: 30px; height: 30px; border-radius: 50%;
    background: #e4efed; color: #0f766e; font-size: 1.05rem; font-weight: 700;
    display: flex; align-items: center; justify-content: center;
    transition: transform 0.15s, background 0.15s, color 0.15s;
}
.etl-info-app.is-link { cursor: pointer; transition: background 0.15s, border-color 0.15s, box-shadow 0.15s; }
.etl-info-app.is-link:hover {
    background: #fff; border-color: #0f766e;
    box-shadow: 0 4px 14px rgba(15, 118, 110, 0.14);
}
.etl-info-app.is-link:hover .etl-info-app-arrow { background: #0f766e; color: #fff; transform: translateX(2px); }
.etl-info-empty { color: #94a3b8; font-size: 0.9rem; margin: 8px 0 0; }

/* 동시대 가로 비교 커서 (SVG 내부) */
.etl-cmp-hline { stroke: #0f766e; stroke-width: 1.5; stroke-dasharray: 6 3; opacity: 0.9; }
.etl-cmp-hbg { fill: #0f766e; }
.etl-cmp-hyear { fill: #ffffff; font-size: 12px; font-weight: 800; }

/* 검색창 */
.tl-search {
    position: relative; display: flex; align-items: center; gap: 8px;
    margin: 0 0 14px; padding: 0 12px; height: 44px;
    background: var(--hub-card-bg, #fff); border: 1px solid var(--hub-border); border-radius: 11px;
}
.tl-search:focus-within { border-color: #0f766e; box-shadow: 0 0 0 3px rgba(15,118,110,0.12); }
.tl-search-ico { width: 18px; height: 18px; color: var(--hub-muted); flex-shrink: 0; }
.tl-search input {
    flex: 1; min-width: 0; border: none; outline: none; background: transparent;
    font-size: 0.92rem; color: var(--hub-text); font-family: inherit;
}
.tl-search-clear { border: none; background: transparent; color: var(--hub-muted); cursor: pointer; font-size: 0.85rem; padding: 4px; flex-shrink: 0; }
.tl-search-results {
    position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 50;
    max-height: 320px; overflow-y: auto; background: #fff;
    border: 1px solid var(--hub-border); border-radius: 11px; box-shadow: 0 12px 34px rgba(0,0,0,0.16);
    padding: 6px;
}
.tl-search-item {
    display: flex; align-items: center; gap: 10px; width: 100%;
    padding: 9px 11px; border: none; background: transparent; border-radius: 8px;
    cursor: pointer; text-align: left; font-family: inherit;
}
.tl-search-item:hover, .tl-search-item.is-active { background: rgba(15,118,110,0.08); }
.tl-search-type { flex-shrink: 0; font-size: 0.68rem; font-weight: 800; padding: 2px 7px; border-radius: 999px; color: #fff; }
.tl-search-type.event { background: #c0392b; }
.tl-search-type.leader { background: #4338ca; }
.tl-search-type.nation { background: #0f766e; }
.tl-search-type.year { background: #b45309; }
.tl-search-name { flex: 1; min-width: 0; font-size: 0.9rem; font-weight: 700; color: #1e293b; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tl-search-sub { flex-shrink: 0; font-size: 0.78rem; color: #94a3b8; font-variant-numeric: tabular-nums; }
.tl-search-empty { padding: 14px; text-align: center; color: #94a3b8; font-size: 0.86rem; }

/* 검색 결과 위치로 이동 시 깜빡 강조 */
.tl-search-flash {
    position: fixed; z-index: 90; pointer-events: none; border-radius: 8px;
    box-shadow: 0 0 0 3px #f59e0b, 0 0 0 9999px rgba(0,0,0,0);
    animation: tlFlash 1.6s ease-out forwards;
}
@keyframes tlFlash {
    0% { box-shadow: 0 0 0 3px #f59e0b, 0 0 18px 6px rgba(245,158,11,0.7); opacity: 1; }
    70% { box-shadow: 0 0 0 3px #f59e0b, 0 0 12px 4px rgba(245,158,11,0.5); opacity: 1; }
    100% { box-shadow: 0 0 0 3px rgba(245,158,11,0); opacity: 0; }
}

/* 코치마크 가이드 투어 (스포트라이트 + 말풍선) */
.tl-tour-mask { position: fixed; inset: 0; z-index: 100030; cursor: pointer; }
.tl-tour-spot {
    position: fixed; z-index: 100040; pointer-events: none; border-radius: 12px;
    box-shadow: 0 0 0 9999px rgba(15, 23, 42, 0.68), 0 0 0 3px rgba(255,255,255,0.9);
    transition: top 0.25s ease, left 0.25s ease, width 0.25s ease, height 0.25s ease;
}
.tl-tour-pop {
    position: fixed; z-index: 100050; width: min(320px, calc(100vw - 24px));
    background: #fff; border-radius: 14px; padding: 16px 18px 14px;
    box-shadow: 0 16px 44px rgba(0,0,0,0.32);
    font-family: 'Noto Sans KR', 'Malgun Gothic', sans-serif;
    transition: top 0.2s ease, left 0.2s ease;
}
.tl-tour-step { font-size: 0.72rem; font-weight: 700; color: #0f766e; letter-spacing: 0.5px; margin-bottom: 4px; }
.tl-tour-title { font-size: 1.02rem; font-weight: 800; color: #15233b; margin-bottom: 6px; }
.tl-tour-text { font-size: 0.88rem; line-height: 1.6; color: #475569; word-break: keep-all; }
.tl-tour-btns { display: flex; align-items: center; gap: 8px; margin-top: 14px; }
.tl-tour-btns button { border: none; border-radius: 8px; cursor: pointer; font-weight: 700; font-size: 0.84rem; padding: 7px 14px; font-family: inherit; }
.tl-tour-skip { background: transparent; color: #94a3b8; padding: 7px 4px !important; }
.tl-tour-prev { background: #eef2f6; color: #475569; }
.tl-tour-next { background: #0f766e; color: #fff; }
.tl-tour-next:hover { background: #0b5c54; }
/* 손가락 탭 시늉 */
.tl-tour-finger { position: fixed; z-index: 100050; pointer-events: none; }
.tl-tour-hand { position: absolute; top: 4px; left: -5px; font-size: 38px; transform-origin: top center; animation: tlFingerTap 1.05s ease-in-out infinite; filter: drop-shadow(0 2px 4px rgba(0,0,0,0.45)); }
.tl-tour-ripple { position: absolute; top: 0; left: 0; width: 46px; height: 46px; margin: -23px 0 0 -23px; border-radius: 50%; background: rgba(255,255,255,0.55); animation: tlRipple 1.05s ease-out infinite; }
@keyframes tlFingerTap { 0%, 100% { transform: translateY(0) scale(1); } 45% { transform: translateY(9px) scale(0.9); } }
@keyframes tlRipple { 0% { transform: scale(0.3); opacity: 0.6; } 100% { transform: scale(1.55); opacity: 0; } }

/* 관련 사건 칩 */
.etl-info-related { margin-top: 16px; }
.etl-rel-wrap { display: flex; flex-wrap: wrap; gap: 7px; }
.etl-rel-chip {
    font-size: 0.84rem; font-weight: 600; color: #475569;
    background: #f1f5f9; border: 1px solid #e2e8f0; border-radius: 999px;
    padding: 5px 12px; line-height: 1.2;
}
.etl-rel-chip.is-link { cursor: pointer; color: #0f766e; transition: background 0.15s, border-color 0.15s; }
.etl-rel-chip.is-link:hover { background: #e4efed; border-color: #0f766e; }


/* 클릭 가능한 집권자(막대 세그먼트·이름) */
.etl-leader-seg { cursor: pointer; }
.etl-leader-seg:hover { opacity: 1; }
.etl-leader-label[data-leader], .etl-leader-callout[data-leader] { cursor: pointer; pointer-events: auto; }
.etl-leader-label[data-leader]:hover, .etl-leader-callout[data-leader]:hover { text-decoration: underline; }

/* 집권자 상세 모달 — 인물 프로필 분위기(컬러 배너) */
.etl-person-card {
    position: relative; background: #fff; border-radius: 18px;
    width: 100%; max-width: 440px; max-height: 84vh; overflow: hidden;
    display: flex; flex-direction: column;
    box-shadow: 0 22px 64px rgba(15, 23, 42, 0.42);
}
.etl-person-banner {
    position: relative; flex-shrink: 0; display: flex; align-items: center; gap: 16px;
    padding: 26px 22px 24px; border-radius: 18px 18px 0 0; color: var(--p-text, #fff);
    background: linear-gradient(140deg, rgba(255,255,255,0.18), rgba(0,0,0,0.32)), var(--p-color, #475569);
}
.etl-person-avatar {
    flex-shrink: 0; width: 58px; height: 58px; border-radius: 50%; overflow: hidden;
    display: flex; align-items: center; justify-content: center;
    background: rgba(255,255,255,0.95); border: 2px solid rgba(255,255,255,0.7);
    box-shadow: 0 4px 12px rgba(0,0,0,0.18); color: var(--p-color, #475569);
}
/* 원형 국기 아바타 — 원을 꽉 채움(가운데 기준) */
.etl-flag-img { width: 100%; height: 100%; object-fit: cover; object-position: center; }
.etl-flag-svg { width: 30px; height: 30px; }
.etl-person-nation { display: inline-flex; align-items: center; gap: 6px; }
.etl-flag-mini { width: 22px; height: 15px; object-fit: cover; border-radius: 3px; box-shadow: 0 0 0 1px rgba(0,0,0,0.12); }
.etl-flag-mini-svg { width: 15px; height: 15px; color: #64748b; }
.etl-person-headtext { min-width: 0; }
.etl-person-faction { display: block; color: var(--p-text, #fff); font-size: 0.74rem; font-weight: 700; opacity: 0.88; letter-spacing: 0.2px; }
.etl-info-modal .etl-person-name {
    margin: 3px 0 0; color: var(--p-text, #fff);
    font-family: 'Noto Sans KR', 'Pretendard', 'Malgun Gothic', 'Apple SD Gothic Neo', sans-serif;
    font-size: 1.5rem; font-weight: 800; letter-spacing: -0.5px; line-height: 1.2;
    display: flex; align-items: baseline; flex-wrap: wrap; gap: 8px;
}
.etl-person-reading { color: var(--p-text, #fff); opacity: 0.78; font-size: 0.86rem; font-weight: 600; letter-spacing: 0; }
.etl-person-close {
    position: absolute; top: 14px; right: 14px; width: 30px; height: 30px; z-index: 1;
    border: none; border-radius: 9px; background: rgba(127,127,127,0.28); color: var(--p-text, #fff);
    font-size: 0.95rem; line-height: 1; cursor: pointer; transition: background 0.15s;
}
.etl-person-close:hover { background: rgba(127,127,127,0.45); }
.etl-person-body { padding: 18px 22px 22px; overflow-y: auto; flex: 1; min-height: 0; }
/* 간략 정보(생몰·소속·재임) */
.etl-person-facts {
    display: flex; flex-direction: column; gap: 8px;
    background: #f6f8fa; border: 1px solid #eceff3; border-radius: 12px;
    padding: 13px 15px; margin-bottom: 18px;
}
.etl-person-fact { display: flex; gap: 12px; font-size: 0.87rem; line-height: 1.5; }
.etl-person-fact-k {
    flex-shrink: 0; width: 58px; color: #94a3b8; font-weight: 700; font-size: 0.78rem;
    padding-top: 1px;
}
.etl-person-fact-v { color: #2d3a4d; font-weight: 600; word-break: keep-all; }
/* 재임기간 — 나무위키식: 대수/직책 위, 기간 아래 */
.etl-person-term-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.etl-person-term-row + .etl-person-term-row { margin-top: 4px; padding-top: 4px; border-top: 1px dashed #e2e7ee; }
.etl-person-term-role { color: #15233b; font-weight: 700; word-break: keep-all; }
.etl-person-term-span { color: #64748b; font-weight: 600; font-size: 0.83rem; white-space: nowrap; flex: 0 0 auto; }
/* 재임기간 접기/펼치기 */
.etl-person-terms.is-collapsed .etl-term-extra { display: none; }
.etl-person-terms-toggle {
    margin-top: 6px; padding: 2px 0; background: none; border: none;
    color: #2563eb; font-weight: 700; font-size: 0.8rem; cursor: pointer; font-family: inherit;
}
.etl-person-terms-toggle:hover { text-decoration: underline; }
.series-tl-chart-hint {
    font-size: 0.72rem;
    color: var(--hub-muted);
    padding: 7px 14px;
    border-top: 1px solid var(--hub-border);
    background: var(--hub-sidebar-bg, #faf8f5);
}
.series-tl-chart-scroll.is-locked { max-height: 360px; overflow: hidden; }
.series-tl-chart-lock {
    position: absolute;
    left: 0; right: 0; bottom: 0;
    height: 62%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    text-align: center;
    padding: 20px;
    background: linear-gradient(to bottom, rgba(255,255,255,0) 0%, rgba(255,255,255,0.92) 38%, #ffffff 100%);
}
.series-tl-chart-lock-title { font-size: 0.85rem; font-weight: 800; color: var(--hub-text); }
.series-tl-chart-lock-desc { font-size: 0.74rem; color: var(--hub-muted); }

@media (max-width: 768px) {
    .event-timeline-body { padding: 10px; }
}
