/* ═══════════════════════════════════════════════════════════════
   랜드매니저 — 오른쪽 도구 패널 (2026-10-13 JB 「앱으로 넣어」)
   방향: 측량 기계의 조작판. 앱 머리줄·「입력 & 작업」 단추와 같은 남색,
         굵기를 맞춘 선 그림, 고른 도구에 파란 빛 막대가 미끄러져 간다.
   ═══════════════════════════════════════════════════════════════ */
:root {
    --lm-ts-bg-1: #0f172a;
    --lm-ts-bg-2: #1e293b;
    --lm-ts-line: rgba(148, 163, 184, 0.16);
    --lm-ts-ink: #cbd5e1;
    --lm-ts-ink-dim: #94a3b8;
    --lm-ts-ink-hi: #ffffff;
    --lm-ts-accent: #3b82f6;
    --lm-ts-accent-glow: rgba(59, 130, 246, 0.55);
    --lm-ts-on: #34d399;
    --lm-ts-btn-h: 46px;
    --lm-ts-w: 58px;
}

#lm-tool-strip {
    position: fixed;
    right: 14px;
    top: 112px;                       /* 「결과 & 목록」·「공지」 단추 아래 */
    z-index: 1500;                    /* 지도 위, 사이드바(2000) 아래 */
    width: var(--lm-ts-w);
    padding: 6px 0;
    border-radius: 16px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0) 40%),
        linear-gradient(160deg, var(--lm-ts-bg-1), var(--lm-ts-bg-2));
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.08) inset,
        0 12px 28px -8px rgba(15, 23, 42, 0.55),
        0 2px 6px rgba(15, 23, 42, 0.25);
    font-family: 'Noto Sans KR', sans-serif;
    transition: right 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;
}

/* 오른쪽 결과 칸이 열리면 그 옆으로 비켜 선다 */
body.sidebar-right-open #lm-tool-strip {
    right: 374px;
}

/* 묶음 사이 가는 선 */
.lm-ts-group + .lm-ts-group {
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px solid var(--lm-ts-line);
}

.lm-ts-group {
    position: relative;
}

.lm-ts-btn {
    position: relative;
    width: 100%;
    height: var(--lm-ts-btn-h);
    border: none;
    background: transparent;
    color: var(--lm-ts-ink);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    cursor: pointer;
    padding: 0;
    font-family: inherit;
    opacity: 0;
    transform: translateX(8px);
    animation: lmTsIn 0.42s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

.lm-ts-btn svg {
    width: 21px;
    height: 21px;
    stroke: currentColor;
    stroke-width: 1.7;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: transform 0.18s ease;
}

.lm-ts-label {
    font-size: 10.5px;
    font-weight: 500;
    letter-spacing: -0.4px;
    color: var(--lm-ts-ink-dim);
    white-space: nowrap;
    transition: color 0.18s ease;
}

.lm-ts-btn:hover {
    color: var(--lm-ts-ink-hi);
}

.lm-ts-btn:hover svg {
    transform: translateY(-1px);
}

.lm-ts-btn:hover .lm-ts-label {
    color: var(--lm-ts-ink);
}

.lm-ts-btn:focus-visible {
    outline: 2px solid var(--lm-ts-accent);
    outline-offset: -4px;
    border-radius: 10px;
}

/* 지금 쓰는 도구 — 글자·그림을 밝게 */
.lm-ts-btn.is-active {
    color: var(--lm-ts-ink-hi);
}

.lm-ts-btn.is-active .lm-ts-label {
    color: #bfdbfe;
    font-weight: 700;
}

/* 고른 도구 표시: 왼쪽 가장자리의 파란 빛 막대 + 은은한 바탕. 도구를 바꾸면 미끄러져 간다 */
.lm-ts-indicator {
    position: absolute;
    left: 6px;
    right: 6px;
    top: 0;
    height: var(--lm-ts-btn-h);
    border-radius: 11px;
    background: linear-gradient(90deg, rgba(59, 130, 246, 0.28), rgba(59, 130, 246, 0.08));
    pointer-events: none;
    transition: transform 0.32s cubic-bezier(0.34, 1.3, 0.5, 1);
}

.lm-ts-indicator::before {
    content: '';
    position: absolute;
    left: -6px;
    top: 10px;
    bottom: 10px;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: var(--lm-ts-accent);
    box-shadow: 0 0 10px var(--lm-ts-accent-glow);
}

/* 켜고 끄는 단추(위성·규제구역)가 켜지면 초록 점 */
.lm-ts-btn[data-toggle]::after,
.lm-ts-btn[data-on-id]::after {
    content: '';
    position: absolute;
    top: 8px;
    right: 12px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: transparent;
    transition: background 0.2s ease, box-shadow 0.2s ease;
}

.lm-ts-btn.is-on::after {
    background: var(--lm-ts-on);
    box-shadow: 0 0 0 2px var(--lm-ts-bg-1), 0 0 8px rgba(52, 211, 153, 0.8);
}

.lm-ts-btn.is-on {
    color: #d1fae5;
}

/* 마우스를 올리면 왼쪽으로 설명이 미끄러져 나온다 */
.lm-ts-tip {
    position: absolute;
    right: calc(100% + 12px);
    top: 50%;
    transform: translate(6px, -50%);
    opacity: 0;
    pointer-events: none;
    white-space: nowrap;
    background: #0f172a;
    color: #e2e8f0;
    font-size: 12px;
    font-weight: 400;
    letter-spacing: -0.3px;
    padding: 7px 11px;
    border-radius: 8px;
    box-shadow: 0 6px 16px rgba(15, 23, 42, 0.35);
    transition: opacity 0.16s ease, transform 0.16s ease;
}

.lm-ts-tip b {
    color: #ffffff;
    font-weight: 700;
    margin-right: 6px;
}

.lm-ts-tip::after {
    content: '';
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    border: 5px solid transparent;
    border-left-color: #0f172a;
}

.lm-ts-btn:hover .lm-ts-tip,
.lm-ts-btn:focus-visible .lm-ts-tip {
    opacity: 1;
    transform: translate(0, -50%);
    transition-delay: 0.25s;
}

/* 「사용법」 둥근 단추는 도구 패널 왼쪽으로 비켜 둔다 (노트북 화면에서 「화면저장」을 가리던 것) */
body:has(#lm-tool-strip) #lm-tut-help {
    right: calc(14px + var(--lm-ts-w) + 12px) !important;
}

body.sidebar-right-open:has(#lm-tool-strip) #lm-tut-help {
    right: calc(374px + var(--lm-ts-w) + 12px) !important;
}

@keyframes lmTsIn {
    to {
        opacity: 1;
        transform: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .lm-ts-btn {
        animation: none;
        opacity: 1;
        transform: none;
    }
    .lm-ts-indicator,
    #lm-tool-strip {
        transition: none;
    }
}

/* 화면 높이가 낮은 노트북: 단추를 조금 낮춘다 */
@media (max-height: 700px) {
    :root {
        --lm-ts-btn-h: 40px;
    }
    #lm-tool-strip {
        top: 106px;               /* 아래 안내 문구(footer)와 닿지 않게 (2026-10-13 겹침 검사) */
    }
    .lm-ts-label {
        font-size: 10px;
    }
}

/* 태블릿 세로: 결과 칸이 아래 반쪽 시트라 옆으로 비킬 필요가 없다 */
@media (orientation: portrait) and (min-width: 769px) and (max-width: 1100px) {
    body.sidebar-right-open #lm-tool-strip {
        right: 14px;
    }
    body.sidebar-right-open:has(#lm-tool-strip) #lm-tut-help {
        right: calc(14px + var(--lm-ts-w) + 12px) !important;
    }
}

/* 휴대폰(/m/)은 아래 단추줄이 있으므로 쓰지 않는다 */
@media (max-width: 768px) {
    #lm-tool-strip {
        display: none;
    }
}

@media print {
    #lm-tool-strip {
        display: none;
    }
}
