/* Kakao AdFit 슬롯 보존·비활성화 */
    #hamburger-filter-adfit, #hero-detail-adfit, #object-detail-adfit,
    #recruit-role-adfit-slot { display: none !important; }

    /* 🚩 그리기 폼 스타일 - 드래그 이동 가능 */
    div#drawingForm[style],
    div#drawingForm {
        z-index: 10001 !important;
        background: rgba(30, 42, 56, 0.95) !important;
        padding: 8px 10px !important;
        border-radius: 7px !important;
        box-shadow: 0 2px 8px rgba(0,0,0,0.35) !important;
        width: 250px !important;
        max-width: 260px !important;
        color: #ecf0f1 !important;
    }
    
    #drawingForm form,
    div#drawingForm form {
        display: flex !important;
        flex-direction: column !important;
        gap: 0 !important;
    }

    /* 팝업이 항상 연대표와 label marker 위에 오도록 z-index 강제 */
    .leaflet-popup-pane {
        z-index: 10000 !important;
    }
    
    /* compact-popup — 새 팝업 스타일 블록에서 통합 관리 */

    /* �️ 지도 커서 — 속 빈 원형 */
    .leaflet-container {
        cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 20 20'%3E%3Ccircle cx='10' cy='10' r='7' fill='none' stroke='rgba(200,220,255,0.85)' stroke-width='1.5'/%3E%3Ccircle cx='10' cy='10' r='1.5' fill='rgba(200,220,255,0.85)'/%3E%3C/svg%3E") 10 10, crosshair !important;
    }
    .leaflet-dragging .leaflet-container,
    .leaflet-dragging .leaflet-grab {
        cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 20 20'%3E%3Ccircle cx='10' cy='10' r='7' fill='none' stroke='rgba(200,220,255,0.6)' stroke-width='1.5' stroke-dasharray='3 2'/%3E%3C/svg%3E") 10 10, crosshair !important;
    }

    /* 🚩 기본(위성모드)에서는 필터 없음 — 다크/라이트/일반 전환 시 JS가 인라인으로 적용 */
    #map {
        filter: none;
        font-family: 'Noto Serif KR', serif;
    }
    /* 🎞️ 다크/라이트/일반 모드일 때 빈티지 필터 (body 클래스로 구분) */
    body.tile-vintage #map {
        filter: saturate(0.59) contrast(1.04) brightness(1.04) hue-rotate(-8deg) sepia(0.18);
    }
    /* 역사 모드: 종이색 베이스맵과 낮은 대비의 라벨을 한 묶음으로 적용한다. */
    body.history-map-mode #map {
        background: #202a29;
        filter: saturate(0.92) contrast(1.06) brightness(1.05) sepia(0.06);
    }
    body.history-map-mode .leaflet-territory-pane {
        mix-blend-mode: multiply;
    }
    /* 벡터 실험 모드는 이미 절제된 색으로 조정하므로 영토를 다시 곱셈 합성하지 않는다. */
    body.history-map-mode.history-vector-mode .leaflet-territory-pane {
        mix-blend-mode: normal;
    }
    body.history-map-mode.history-vector-mode.history-vector-render-ready .leaflet-territory-pane {
        display: none;
    }
    body.history-map-mode .macro-country-name,
    body.history-map-mode .city-name,
    body.history-map-mode .cm-name,
    body.history-map-mode .label-text-marker > div {
        color: #eee5d2 !important;
        text-shadow: -1px -1px 0 rgba(20,24,23,.94), 1px -1px 0 rgba(20,24,23,.94),
                     -1px 1px 0 rgba(20,24,23,.94), 1px 1px 0 rgba(20,24,23,.94),
                     0 1px 4px rgba(0,0,0,.9) !important;
    }
    /* 국가 규모에서는 OldMapsOnline처럼 작은 상징과 국가명만 남긴다. */
    body.history-map-mode.history-lod-country .macro-country-symbol {
        width: 28px !important;
        height: 22px !important;
        overflow: hidden;
    }
    body.history-map-mode.history-lod-country .macro-country-symbol img {
        width: 28px !important;
        max-height: 22px !important;
        object-fit: contain;
    }
    body.history-map-mode.history-lod-country .macro-country-copy {
        margin-left: -20px !important;
        padding-bottom: 1px !important;
    }
    body.history-map-mode.history-lod-country .macro-country-ethnic {
        display: none !important;
    }
    /* Z 5 이하의 국가 개요 단계: 영토·국가명·해안선 외의 지도 오버레이를 숨긴다. */
    body.history-map-mode.history-country-only .leaflet-marker-pane,
    body.history-map-mode.history-country-only .leaflet-label-pane,
    body.history-map-mode.history-country-only .leaflet-drawing-pane,
    body.history-map-mode.history-country-only .leaflet-river-pane,
    body.history-map-mode.history-country-only .leaflet-waterLevel-pane,
    body.history-map-mode.history-country-only .leaflet-tooltip-pane {
        display: none !important;
    }
    .map-zoom-level-control {
        position: fixed;
        right: 8px;
        bottom: calc(68px + var(--ad-bottom-h, 0px));
        z-index: 20050;
        margin: 0 !important;
        padding: 3px 5px;
        border: 1px solid rgba(212,168,67,.42);
        border-radius: 3px;
        background: rgba(14,18,20,.88);
        color: #ead9b2;
        box-shadow: 0 1px 4px rgba(0,0,0,.4);
        font: 600 9px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
        letter-spacing: .02em;
        pointer-events: none;
    }
    body.force-mobile .map-zoom-level-control {
        right: 6px;
        bottom: calc(62px + var(--ad-bottom-h, 0px));
        font-size: 8px;
    }
    body.lod-hide-mountain-labels .natural-feature-marker.feature-mountain .feature-name,
    body.lod-hide-mountain-labels .mountain-path-label {
        display: none !important;
    }
    /* 휠 애니메이션 중 DOM 오버레이 합성을 쉬게 하고 종료 직후 복원한다. */
    body.map-wheel-zooming #map .leaflet-marker-pane,
    body.map-wheel-zooming #map .leaflet-label-pane,
    body.map-wheel-zooming #map .leaflet-tooltip-pane,
    body.map-wheel-zooming #map .leaflet-drawing-pane,
    body.map-wheel-zooming #map .leaflet-river-pane,
    body.map-wheel-zooming #map .leaflet-macroLabel-pane {
        opacity: 0 !important;
        transition: none !important;
    }
    #map .leaflet-marker-pane,
    #map .leaflet-label-pane,
    #map .leaflet-tooltip-pane,
    #map .leaflet-river-pane,
    #map .leaflet-macroLabel-pane {
        transition: opacity .14s ease-out;
    }
    .oldmaps-nav-control {
        position: fixed !important;
        left: 14px;
        top: 54%;
        z-index: 20040 !important;
        display: flex;
        flex-direction: column;
        margin: 0 !important;
        transform: translateY(-50%);
        overflow: hidden;
        border: 1px solid rgba(207,174,116,.24);
        border-radius: 4px;
        background: rgba(74,49,25,.92);
        box-shadow: 0 3px 12px rgba(0,0,0,.32);
    }
    .oldmaps-nav-control button {
        width: 42px;
        height: 42px;
        display: grid;
        place-items: center;
        box-sizing: border-box;
        padding: 0;
        border: 0;
        border-bottom: 1px solid rgba(255,255,255,.10);
        background: transparent;
        color: #e3d8c4;
        font: 300 29px/1 system-ui, sans-serif;
        cursor: pointer;
    }
    .oldmaps-nav-control button:last-child { border-bottom: 0; }
    .oldmaps-nav-control button:hover { background: rgba(255,255,255,.10); }
    .oldmaps-nav-control .nav-compass { font-size: 21px; }
    .oldmaps-nav-control .nav-world { background: rgba(255,255,255,.09); font-size: 23px; }
    body.force-mobile .oldmaps-nav-control { left: 7px; top: 50%; transform: translateY(-50%) scale(.84); transform-origin: left center; }
    /* 🚩 [추가] 마커/라벨 레이어는 filter 역보정 → 국가명이 흐릿해지지 않도록 */
    #map .leaflet-marker-pane,
    #map .leaflet-tooltip-pane,
    #map .leaflet-popup-pane {
        filter: none !important;
    }

    /* 🚩 [추가] 영토 폴리곤 전환 애니메이션 — 슬라이더 이동 시 자연스러운 변화 */
    .leaflet-overlay-pane svg path {
        transition: fill-opacity 0.25s ease, opacity 0.25s ease, stroke-opacity 0.25s ease;
    }
    /* 슬라이더 드래그 중에는 즉시 전환 (깜빡임 없는 snap) */
    body.slider-dragging .leaflet-overlay-pane svg path {
        transition: none;
    }
    /* 국가별 SVG 컨테이너(renderer)에도 드래그 중 즉시 전환 */
    body.slider-dragging .leaflet-overlay-pane svg {
        transition: none;
    }

    /* 🗺️ 영토 전용 pane — mix-blend-mode: multiply 로 지도 타일과 자연스럽게 합성
       (바다/강 등 지형지물이 영토 색상 아래로 비쳐 coastline이 자동으로 구분됨) */
    .leaflet-territory-pane {
        mix-blend-mode: multiply;
    }
    /* Leaflet 기본 파란색 path 스타일 완전 차단 — JS style 옵션이 적용되기 전 원색 깜빡임 방지 */
    .leaflet-territory-pane svg path {
        fill: transparent;
        stroke: transparent;
        transition: none;
    }
    body.slider-dragging .leaflet-territory-pane svg path {
        transition: none;
    }
    body.slider-dragging .leaflet-territory-pane svg {
        transition: none;
    }

    .water-level-status {
        position: fixed;
        left: 14px;
        bottom: 96px;
        z-index: 1200;
        display: none;
        max-width: min(320px, calc(100vw - 28px));
        padding: 8px 10px;
        border: 1px solid rgba(90, 170, 210, 0.42);
        border-radius: 6px;
        background: rgba(12, 26, 38, 0.88);
        color: #d9eef8;
        font-size: 11px;
        line-height: 1.35;
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
        pointer-events: none;
    }

    .water-level-status strong {
        display: block;
        color: #87d7ff;
        font-size: 12px;
        margin-bottom: 2px;
    }

    /* 🚩 [추가] 지도 변경 스위치(레이어 컨트롤) 빈티지 스타일 - 전체 분위기에 맞춤 */
    .leaflet-control-layers {
        border: 1px solid rgba(139, 69, 19, 0.6) !important;
        background: rgba(30, 42, 56, 0.95) !important;
        backdrop-filter: blur(8px) saturate(0.8) !important;
        box-shadow: 0 2px 12px rgba(0,0,0,0.3);
        border-radius: 6px !important;
        padding: 2px 4px !important;
        right: 12px !important;
        top: 12px !important;
        position: fixed !important;
        min-width: 56px;
        z-index: 1200 !important;
        font-family: 'Nanum Myeongjo', 'East Sea Dokdo', serif;
        font-size: 10px;
        color: #f5e9d2;
    }
    .leaflet-control-layers-toggle {
        background: linear-gradient(45deg, #8B4513, #A0522D);
        border-radius: 3px;
        width: 22px;
        height: 16px;
        box-shadow: 0 1px 4px rgba(0,0,0,0.4);
        border: 1px solid #DAA520;
        cursor: pointer;
        transition: all 0.3s ease;
        opacity: 0.9;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 7px;
        color: #f5e9d2;
        font-weight: bold;
        text-shadow: 0 1px 2px rgba(0,0,0,0.5);
    }
    .leaflet-control-layers-toggle::before {
        content: "";
    }
    .leaflet-control-layers-toggle:hover {
        opacity: 1;
        box-shadow: 0 3px 8px rgba(0,0,0,0.6);
        transform: scale(1.05);
        background: linear-gradient(45deg, #A0522D, #8B4513);
    }
    .leaflet-control-layers-expanded {
        background: rgba(30, 42, 56, 0.98) !important;
        border-radius: 7px !important;
        box-shadow: 0 3px 14px rgba(0,0,0,0.4);
        border: 1px solid rgba(218, 165, 32, 0.5);
        backdrop-filter: blur(10px) saturate(0.9) !important;
    }
    .leaflet-control-layers-list label {
        font-family: 'Nanum Myeongjo', 'East Sea Dokdo', serif;
        font-size: 10px;
        color: #f5e9d2;
        letter-spacing: 0.02em;
        margin-bottom: 1px;
        padding: 2px 3px;
        text-shadow: 0 1px 2px rgba(0,0,0,0.5);
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 3px;
        border-radius: 2px;
        transition: background-color 0.2s ease;
        white-space: nowrap;
    }
    .leaflet-control-layers-list label:hover {
        background-color: rgba(218, 165, 32, 0.1);
    }
    .leaflet-control-layers-separator {
        border-top: 1px solid rgba(218, 165, 32, 0.3);
        margin: 1px 0;
    }
    .leaflet-control-layers-base label input[type="radio"] {
        appearance: none;
        -webkit-appearance: none;
        -moz-appearance: none;
        width: 11px;
        height: 11px;
        border: 1px solid #DAA520;
        border-radius: 50%;
        background: rgba(30, 42, 56, 0.8);
        cursor: pointer;
        position: relative;
        transition: all 0.3s ease;
        flex-shrink: 0;
    }
    .leaflet-control-layers-base label input[type="radio"]:checked {
        background: #DAA520;
        border-color: #FFD700;
        box-shadow: 0 0 5px rgba(218, 165, 32, 0.6);
    }
    .leaflet-control-layers-base label input[type="radio"]:hover {
        border-color: #FFD700;
        box-shadow: 0 0 3px rgba(218, 165, 32, 0.4);
    }
    .leaflet-control-layers-base label input[type="radio"]:checked::before {
        content: '';
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        width: 3px;
        height: 3px;
        background: #2d1c0b;
        border-radius: 50%;
    }

    /* 🚩 [추가] 수묵화 번짐 효과 (SVG filter) - 블러 효과 제거, 선명도 향상 */
    .sumi-ink-effect {
        filter: contrast(1.1) brightness(1.05); /* 블러 대신 대비와 밝기 조정으로 선명도 향상 */
    }

    /* 🚩 [추가] 주요 지명/타이틀 폰트 */
    .vintage-label {
        font-family: 'East Sea Dokdo', 'Nanum Myeongjo', serif !important;
        font-size: 1.25em;
        letter-spacing: 0.04em;
        color: #2d1c0b;
        text-shadow: 0 1px 0 #fff, 0 0 6px #e5e0d8;
    }

    /* 🚩 [추가] 설명문/팝업용 */
    .vintage-desc {
        font-family: 'Noto Serif KR', serif;
        font-size: 1em;
        letter-spacing: 0.02em;
        line-height: 1.7;
        color: #3a2a1a;
    }

    /* 국가명 라벨 — 배경 박스 없이 지도 위에 직접 표시 */
    .macro-country-name {
        font-family: 'Pretendard Black', 'Noto Sans KR', 'Arial Black', 'Apple SD Gothic Neo', 'Malgun Gothic', Arial, sans-serif;
        font-size: 24px;
        font-weight: 900 !important;
        white-space: nowrap;
        pointer-events: none;
        text-align: center;
        line-height: 1;
        letter-spacing: -0.05em;
        color: #eee5d2;
        text-transform: uppercase;
        text-shadow: -1px -1px 0 #201b17, 1px -1px 0 #201b17,
                     -1px 1px 0 #201b17, 1px 1px 0 #201b17,
                     0 2px 3px rgba(0,0,0,.9);
        background: none;
        padding: 0;
        border-radius: 0;
        transform: scale(1) !important;
    }
    .macro-country-period {
        display: none;
        margin-top: 3px;
        color: #d8cbb5;
        font: 700 11px/1 'Noto Sans KR', 'Apple SD Gothic Neo', sans-serif;
        letter-spacing: -.02em;
        text-align: center;
        text-shadow: -1px -1px 0 #201b17, 1px -1px 0 #201b17,
                     -1px 1px 0 #201b17, 1px 1px 0 #201b17,
                     0 2px 3px rgba(0,0,0,.9);
    }
    body.history-map-mode .macro-country-period { display: block; }
    body.history-map-mode.history-lod-country .macro-country-name {
        font-size: 14px !important;
        letter-spacing: -.035em;
    }
    .macro-country-ethnic {
        font-family: 'Pretendard', 'Noto Sans KR', 'Apple SD Gothic Neo', 'Malgun Gothic', Arial, sans-serif;
        font-size: 11px;
        font-weight: 600;
        white-space: nowrap;
        pointer-events: none;
        text-align: center;
        line-height: 1.3;
        letter-spacing: 0.5px;
        color: #000000;
        text-shadow: none;
        background: none;
        padding: 2px 8px;
        border-radius: 3px;
        margin-top: 8px;
        display: inline-block;
    }

    .macro-country-label-icon { pointer-events: none; }

