.map-selector {
    flex: 1;
    padding: 8px;
    background: white;
    border: 2px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    transition: all 0.2s;
}

.map-selector.active {
    border-width: 3px;
    font-weight: 700;
}

/* 기존(레거시) 지도 제공자 버튼: .map-selector 레이아웃을 쓸 때만 적용 */
#kakaoMapBtn.map-selector {
    color: #000;
}

#kakaoMapBtn.map-selector.active {
    background: #fee500;
    border-color: #fee500;
}

#naverMapBtn.map-selector {
    color: #03c75a;
}

#naverMapBtn.map-selector.active {
    background: #03c75a;
    color: white;
}

#googleMapBtn.map-selector {
    color: #4285f4;
}

#googleMapBtn.map-selector.active {
    background: #4285f4;
    color: white;
}

.map-type-selector {
    flex: 1;
    padding: 8px;
    background: white;
    border: 2px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    transition: all 0.2s;
    color: #333;
}

#mapControlPanel .map-type-selector {
    flex: 0 0 var(--toolbar-btn-size);
    width: var(--toolbar-btn-size);
    min-width: var(--toolbar-btn-size);
    height: var(--toolbar-btn-size);
    padding: 0;
    box-sizing: border-box;
}

.map-type-selector.active {
    background: #1976d2;
    border-color: #1976d2;
    color: white;
    border-width: 3px;
    font-weight: 700;
}

/* 툴바 컨테이너 - 배경 없음, 패딩 없음 */
.map-control-panel {
    position: absolute;
    top: var(--ui-inset-y, 20px);
    right: var(--ui-inset-x, 20px);
    z-index: 12;
    background: transparent;
    padding: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-end; /* 각 행을 우측 끝 기준으로 정렬 */
    gap: var(--toolbar-row-gap, 6px);
}
.map-control-panel.compact-controls {
    transform: scale(var(--ui-scale, 1));
    transform-origin: top right;
}

/* 툴바 행 */
.control-row-1,
.control-row-2,
.control-row-3 {
    display: flex;
    gap: var(--toolbar-btn-gap, 0px);
    justify-content: flex-end;
}

/* 공통 툴바 버튼 - 직사각형, 간격 없음 */
#mapControlPanel {
    --toolbar-btn-size: 36px;
}

.toolbar-btn {
    border: none;
    border-radius: 0;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    background: #f5f5f5;
    color: #333;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
}

#mapControlPanel .toolbar-btn {
    width: var(--toolbar-btn-size);
    min-width: var(--toolbar-btn-size);
    height: var(--toolbar-btn-size);
    padding: 0;
    box-sizing: border-box;
}

.toolbar-btn:hover {
    filter: brightness(0.95);
}

/* 툴박스(우측 상단) 버튼 hover: 위성지도 위에서도 배경이 확실히 보이도록 공통 처리
 * - 제공자(K/N/G) 버튼은 고유 색상을 유지해야 하므로 제외 */
#mapControlPanel .toolbar-btn:not(.provider-btn):hover:not(.active) {
    filter: none;
    background: #e6e6e6;
    box-shadow: inset 0 0 0 2px rgba(0,0,0,0.14);
}

.toolbar-btn:focus {
    outline: none;
}

/* 키보드 포커스는 접근성을 위해 유지하되, 마우스 클릭 포커스 링이 과하게 보이지 않게 정리 */
.toolbar-btn:focus-visible {
    outline: 2px solid rgba(43, 111, 255, 0.75);
    outline-offset: -2px;
}

.toolbar-btn.active {
    background: #1976d2;
    color: white;
}

/* 지도 제공자 버튼 - 기본 색상 유지, 선택은 빨간 테두리 */
.toolbar-btn.provider-btn[data-provider="kakao"] {
    background: #FEE500;
    color: #3C1E1E;
}

.toolbar-btn.provider-btn[data-provider="naver"] {
    background: #03C75A;
    color: #fff;
}

.toolbar-btn.provider-btn[data-provider="google"] {
    background: #4285F4;
    color: #fff;
}

.toolbar-btn.provider-btn.active {
    /* 현재 선택된 지도(K/N/G) 테두리 강조 */
    box-shadow: inset 0 0 0 3px #e53935;
}

/* 아이콘 버튼 */
.icon-btn {
    padding: 6px;
}

.icon-btn img {
    height: 20px;
    width: auto;
    display: block;
}

.icon-btn svg {
    display: block;
}

.icon-btn.active img {
    filter: brightness(0) invert(1);
}

.icon-btn svg {
    width: 24px;
    height: 24px;
    display: block;
}

.icon-btn.active svg {
    filter: brightness(0) invert(1);
}

.help-manual-btn {
    text-decoration: none;
    font-weight: 900;
    font-size: 16px;
    line-height: 1;
    color: #2b6fff;
    background: #ffffff;
    box-shadow: inset 0 0 0 2px rgba(43,111,255,0.35);
}

.help-manual-btn:visited {
    color: #2b6fff;
}

.help-manual-btn:hover {
    /* 다른 툴바 버튼처럼 "배경이 확실히 보이게" 불투명 톤으로 */
    filter: none;
    background: #eaf2ff;
    box-shadow: inset 0 0 0 2px rgba(43,111,255,0.55);
}

.help-manual-btn:active {
    transform: translateY(1px);
}

/* 면적 단위 버튼 */
.unit-btn {
    font-size: 11px;
    font-weight: 600;
    min-width: 28px;
}

/* 설정 모달 */
.settings-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
}

.settings-modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
}

.settings-modal-content {
    position: relative;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    min-width: 320px;
    max-width: 400px;
    animation: modalFadeIn 0.2s ease;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.settings-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #eee;
}

.settings-modal-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.settings-modal-body {
    padding: 20px;
}

.settings-section {
    margin-bottom: 20px;
}

.settings-section:last-child {
    margin-bottom: 0;
}

.settings-section h4 {
    font-size: 14px;
    color: #666;
    margin-bottom: 12px;
    font-weight: 600;
}

.scale-control {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.scale-control input[type="range"] {
    flex: 1;
    height: 6px;
    border-radius: 3px;
    background: #e0e0e0;
    appearance: none;
    cursor: pointer;
}

.scale-control input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #1976d2;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.scale-control input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #1976d2;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

#uiScaleValue {
    min-width: 45px;
    text-align: right;
    font-weight: 600;
    color: #1976d2;
    font-size: 14px;
}

.scale-presets {
    display: flex;
    gap: 8px;
}

.scale-preset-btn {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #ddd;
    background: #f5f5f5;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.scale-preset-btn:hover {
    background: #e8e8e8;
    border-color: #ccc;
}

.scale-preset-btn.active {
    background: #1976d2;
    color: white;
    border-color: #1976d2;
}
