:root {
  --bg: #0c0e12;
  --panel: #15181f;
  --panel2: #1c2028;
  --border: #2b303b;
  --text: #edeff2;
  --text-dim: #929aa6;
  --accent: #5b96ff;
  --accent2: #2fd47a;
  --stop: #808893;
  --radius: 10px;
  --shadow: 0 2px 10px rgba(0,0,0,.25);
}
@media (prefers-color-scheme: light) {
  :root {
    --bg: #eef1f6;
    --panel: #ffffff;
    --panel2: #f3f5f9;
    --border: #dde2ea;
    --text: #191c22;
    --text-dim: #5b6270;
    --shadow: 0 2px 10px rgba(30,40,60,.08);
  }
}

* { box-sizing: border-box; }
.hidden { display: none !important; }

html, body {
  margin: 0; padding: 0;
  height: 100%; height: 100dvh;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "맑은 고딕", sans-serif;
  user-select: none;
  -webkit-user-select: none;
}

#topbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
  padding: 8px 10px;
  background: #22242b;
  border-bottom: 1px solid #33353d;
  position: relative;
  z-index: 5;
  height: 44px;
  box-sizing: border-box;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
}
#topbar::-webkit-scrollbar { display: none; }
#topbar h1 { font-size: 15px; margin: 0; font-weight: 700; white-space: nowrap; color: #e8e8ec; flex: none; cursor: pointer; }
#highwayRouteSelect {
  position: static;
  transform: none;
  width: min(185px, 22vw);
  min-width: 112px;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-left: auto;
}
#highwayRouteSelect:focus { outline: 2px solid #ff65c3; outline-offset: 1px; }
.highwayRoutePanel { position: fixed; top: 0; left: 0; z-index: 1400; width: 230px; max-height: 70vh; overflow: hidden; padding: 10px; background: #22242b; border: 1px solid #4a4d58; border-radius: 10px; box-shadow: 0 4px 16px rgba(0,0,0,.5); }
.highwayRoutePanel input { width: 100%; box-sizing: border-box; padding: 7px 8px; background: #2c2f38; color: #e8e8ec; border: 1px solid #4a4d58; border-radius: 6px; font-size: 12px; }
.highwayRouteList { max-height: calc(70vh - 58px); overflow-y: auto; margin-top: 6px; overscroll-behavior: contain; touch-action: pan-y; scrollbar-width: thin; }
.highwayRouteItem { display: block; width: 100%; padding: 7px 8px; border: 0; border-top: 1px solid #3a3d47; background: transparent; color: #e8e8ec; text-align: left; font-size: 12px; cursor: pointer; }
.highwayRouteItem:hover { background: #383c47; }
.highwayRouteRecentLabel { padding: 3px 8px; color: #ff4fbd; font-size: 10px; }
#topbar button { appearance: none; border: 1px solid #4a4d58; background: #2c2f38; color: #e8e8ec; border-radius: 6px; padding: 6px 10px; font-size: 13px; cursor: pointer; white-space: nowrap; flex-shrink: 0; }
#topbar button:active { background: #383c47; }
#locStatus { font-size: 12px; color: #9aa0ad; white-space: nowrap; margin-left: auto; flex-shrink: 0; }
#facilityChips { flex: 1 1 auto; min-width: 0; display: flex; align-items: center; justify-content: center; gap: 4px; overflow: hidden; white-space: nowrap; }
#facilityChips button { border-radius: 6px; padding: 4px 9px; font-size: 12px; color: #9aa0ad; }
#facilityChips button.on { background: #3568d4; border-color: #3568d4; color: #fff; }
#facilityChips button.facilityBulkChip { background: #fff; border-color: #d2d2d2; color: #111; }
#facilityBtn { display: none; }

.facilityPanel {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 50;
  display: block;
  min-width: 160px;
  max-width: min(340px, calc(100vw - 16px));
  max-height: min(60vh, 420px);
  overflow: auto;
  overscroll-behavior: contain;
  touch-action: pan-y;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  padding: 8px 10px;
  background: #22242b;
  border: 1px solid #4a4d58;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,.5);
}
.facilityPanel label {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  padding: 3px 2px;
  border: 0;
  border-radius: 0;
  color: #e8e8ec;
  font-size: 13px;
  white-space: nowrap;
  cursor: pointer;
}
.facilityPanel .facilityBulkTools { display: flex; justify-content: flex-end; gap: 5px; margin: 2px 0 5px; }
.facilityPanel .facilityBulkTools button { border: 1px solid #4a4d58; border-radius: 5px; background: #2c2f38; color: #e8e8ec; padding: 4px 7px; font-size: 11px; cursor: pointer; }
.facilityPanel input { accent-color: #5b96ff; margin: 0; }
.facilitySearchPanel {
  position: absolute;
  left: 10px;
  top: 10px;
  z-index: 45;
  width: min(360px, calc(100vw - 20px));
  max-height: min(65vh, 480px);
  overflow: hidden;
  padding: 9px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow);
}
.facilitySearchBtn { position: absolute; left: 10px; top: 10px; z-index: 44; }
.facilitySearchBtn { appearance: none; border: 1px solid #4a4d58; background: rgba(34,36,43,.92); color: #e8e8ec; border-radius: 8px; padding: 7px 12px; font-size: 13px; cursor: pointer; white-space: nowrap; box-shadow: 0 2px 8px rgba(0,0,0,.4); }
.facilitySearchHead { display: flex; gap: 6px; }
.facilitySearchHead input { flex: 1; min-width: 0; background: var(--panel2); color: var(--text); border: 1px solid var(--border); border-radius: 6px; padding: 7px 8px; }
.facilitySearchHead button { border: 1px solid var(--border); background: var(--panel2); color: var(--text); border-radius: 6px; padding: 0 8px; }
#facilitySearchCount { color: var(--text-dim); font-size: 11px; padding: 7px 2px 4px; }
#facilitySearchResults { max-height: 390px; overflow: auto; }
.facilitySearchResult { display: block; width: 100%; padding: 7px 4px; border: 0; border-top: 1px solid var(--border); background: transparent; color: var(--text); text-align: left; cursor: pointer; }
.facilitySearchResult strong { display: block; font-size: 12px; }
.facilitySearchResult span { display: block; color: var(--text-dim); font-size: 11px; margin-top: 2px; }

select {
  background: var(--panel);
  color: var(--text);
  border: none;
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 13px;
  box-shadow: var(--shadow);
}

/* 카카오맵 상단 컨트롤(둥근 캡슐 버튼 + 그림자) 스타일을 참고한 디자인 */
.secondaryBtn {
  background: var(--panel);
  color: var(--text);
  border: none;
  border-radius: 999px;
  padding: 9px 16px;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: background .12s, color .12s, box-shadow .12s;
}
.secondaryBtn:hover { background: var(--panel2); }
.secondaryBtn.active {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 2px 10px rgba(91,150,255,.45);
}

#app {
  display: flex;
  height: calc(100% - 44px);
  min-height: 0;
}
/* 직선도(webapp)의 "지도" 패널에 내장된 경우, 이 페이지 자체의 상단바를 숨기고 지도가 그 자리까지
   채운다(제목이 두 줄로 겹치지 않게, 2026-08-19). */
body.embedded #topbar { display: none; }
body.embedded #app { height: 100%; }
#mapWrap { position: relative; flex: 1; min-width: 0; }
#map { width: 100%; height: 100%; }

.mapStatus {
  position: absolute;
  left: 10px; bottom: 10px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 12px;
  color: var(--text-dim);
  box-shadow: var(--shadow);
  z-index: 20; /* #map(position:relative) 내부 카카오 레이어 중 z-index:1짜리가 있어 그 위로 올림 */
}
.mapStatus:empty { display: none; }

.roadviewHint {
  position: absolute;
  left: 50%; top: 12px;
  transform: translateX(-50%);
  background: var(--accent);
  color: #fff;
  font-size: 12.5px;
  font-weight: 600;
  padding: 7px 14px;
  border-radius: 999px;
  box-shadow: var(--shadow);
  z-index: 3;
  white-space: nowrap;
}

.rulerResult {
  position: absolute;
  left: 10px; bottom: 10px; top: auto;
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  padding: 10px 12px;
  border-radius: 6px;
  box-shadow: var(--shadow);
  z-index: 8;
  min-width: 168px;
  display: block;
}
.rulerTotal { display: flex; align-items: center; justify-content: space-between; gap: 18px; line-height: 1.3; }
.rulerTotal span { color: var(--text-dim); font-weight: 500; }
.rulerTotal strong { color: #ff4e4e; font-variant-numeric: tabular-nums; }
.rulerNote { border-top: 1px solid var(--border); margin-top: 8px; padding-top: 7px; color: var(--text-dim); font-size: 11px; font-weight: 500; }
.rulerResult .iconBtn { position: absolute; top: 3px; right: 3px; width: 22px; height: 22px; }

/* 이정 점에 마우스를 올리면 뜨는 관할 본부/지사 풍선(클릭 불필요, hover로만 여닫힘) */
.mgmtInfoBox {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 5px 10px;
  box-shadow: var(--shadow);
  white-space: nowrap;
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  pointer-events: none;
}

/* 로드뷰 창이 지금 보고 있는 위치를 지도 위에 표시(로드뷰 안에서 이동하면 같이 따라 움직임).
   드래그해서 놓으면 그 위치의 로드뷰로 창이 바로 이동한다. 핀 끝(뾰족한 아래쪽)이 실제
   위치를 가리키므로 오버레이 anchor도 아래쪽에 맞춘다(xAnchor 0.5 / yAnchor 1). */
.roadviewPosMarker {
  width: 34px; height: 44px;
  background: url('icons/roadview_pin.png') no-repeat center / contain;
  filter: invert(19%) sepia(97%) saturate(5144%) hue-rotate(350deg) brightness(98%) contrast(112%) drop-shadow(0 1px 3px rgba(0,0,0,.6));
  cursor: move;
  touch-action: none;
}
/* 직선도(PART A)에서 선택한 설비를 시설물명 배지로 표시(?facs= 딥링크). 애니메이션 없이 전체
   이름을 항상 그대로 보여준다(예: "CCTV", 2026-08-19 - 이전엔 첫 글자만 보이다가 hover/클릭 시
   펼쳐지는 방식이었음). */
.facDeviceBadge {
  display: inline-block;
  box-sizing: content-box;
  height: 20px;
  padding: 0 6px;
  background: #fff;
  color: #111; /* 종류별 색은 JS가 인라인 style.color로 지정(facColorFor) */
  border: 1.5px solid #111;
  border-radius: 999px;
  box-shadow: 0 1px 4px rgba(0,0,0,.4);
  font-size: 11px;
  font-weight: 800;
  line-height: 20px;
  text-align: left;
  white-space: nowrap;
  cursor: pointer;
  vertical-align: top;
}
/* 배경색은 설비 종류별로 다르게 지정(JS가 인라인 style로, FAC_CAT_COLOR 참고) - active 상태는
   배경을 덮어쓰지 않고 테두리 링으로만 표시해 종류 색을 계속 알아볼 수 있게 한다. */
.facDeviceBadge.active { box-shadow: 0 0 0 3px rgba(255,149,0,.55), 0 1px 4px rgba(0,0,0,.4); }
/* 배지를 클릭하면 정보창이 지도 좌표가 아니라 화면 우측 상단부터 아래로 순서대로 쌓인다(JS가
   top을 계산해 지정, restackPanels 참고) - 여러 개를 동시에 열어도 서로 겹치지 않게 하기 위함.
   배지와 마찬가지로 열릴 때는 기기번호(제목줄)만 먼저 보이다가 전체 정보(.facInfoPanelBody)가
   부드럽게 펼쳐지고, 닫을 때도 같은 방식으로 접히고 나서 사라진다(2026-08-19, 배지와 연동). */
.facInfoPanel {
  /* 직선도(구 상세정보) 카드와 같은 바탕색·모서리 반경·그림자(2026-08-19, 정보 패널이 없어지며
     그 카드 형식을 이정지도 정보창으로 옮겨왔다) - 위치/펼침 애니메이션은 그대로 유지한다. */
  position: absolute;
  right: 10px;
  /* 너비는 고정값(260px) 대신 그 정보창에서 가장 긴 줄에 맞춰 늘어난다(2026-08-20 요청).
     max-content라 접혀 있는 본문(.facInfoPanelBody)의 내용도 폭 계산에 포함되므로, 펼쳐질 때
     폭이 흔들리지 않는다. 상한(PC 420px / 모바일 화면 절반)을 넘으면 줄바꿈된다.
     같은 열(줄)에 놓인 창들은 그중 가장 넓은 값으로 JS(facRestackPanels)가 통일해 준다. */
  width: max-content;
  min-width: 150px;
  max-width: 420px;
  box-sizing: border-box;
  background: var(--panel2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  box-shadow: var(--shadow);
  font-size: 12px;
  white-space: normal;
  z-index: 5;
  /* 정보창을 위아래로 끌어 가려진 창을 볼 수 있게 한다(2026-08-20) - 터치에서 브라우저 기본
     스크롤 제스처가 이 드래그와 경합하지 않도록 touch-action을 끈다. */
  touch-action: none;
  /* 다른 정보창이 열리고 닫힐 때의 자리다툼(재배치)·열 이동도 부드럽게 */
  transition: top .25s ease, right .25s ease;
}
/* 끄는 동안에는 트랜지션을 꺼야 손끝을 바로 따라온다(facAttachStackDrag) */
.facStackDragging .facInfoPanel { transition: none; }
.facInfoPanelTitle {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  font-weight: 700;
  color: var(--text);
  padding-right: 0;
  white-space: nowrap;
  overflow: hidden;
}
.facInfoPanel {
  user-select: text;
  -webkit-user-select: text;
}
.facDeviceBadge-ic,
.facDeviceBadge-jc,
.facDeviceBadge-manhole-splice,
.facDeviceBadge-manhole-through,
.facDeviceBadge-암거,
.facDeviceBadge-bridge,
.facDeviceBadge-터널,
.facDeviceBadge-휴게소,
.facDeviceBadge-비상연결로,
.facDeviceBadge-EX,
.facDeviceBadge-TG {
  border-radius: 3px;
  border-width: 2px;
}
.facDeviceBadge-ic { border-color: #2f73d9; }
.facDeviceBadge-jc { border-color: #d9822b; }
.facDeviceBadge-manhole-splice { border-color: #2fa66a; }
.facDeviceBadge-manhole-through { border-color: #73808f; }
.facDeviceBadge-암거 { border-color: #c97b5f; }
.facDeviceBadge-bridge { border-color: #4f8cff; }
.facDeviceBadge-터널 { border-color: #8a7fc9; }
.facDeviceBadge-휴게소 { border-color: #4ca86b; }
.facDeviceBadge-비상연결로 { border-color: #e08b2d; }
.facDeviceBadge-EX { border-color: #16834b; }
.facDeviceBadge-TG { border-color: #b06a24; }
.facInfoPanelTitleText { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.facInfoPanelTitle.statusNextLine { flex-wrap: wrap; }
.facInfoPanelTitle.statusNextLine .facInfoPanelTitleText { flex: 1 1 100%; width: 100%; }
.facInfoPanelTitle.statusNextLine .facInfoPanelStatus { margin-left: 0; }
/* 직선도 상세정보 카드의 상태 배지(.badge)와 같은 알약 모양·색으로 표시한다. */
.facInfoPanelStatus { flex: 0 0 auto; font-size: 11px; padding: 2px 7px; border-radius: 999px; background: var(--accent); color: #fff; }
.facInfoPanelStatus.stop { background: transparent; color: #ff5252; padding: 0; border-radius: 0; }
.facInfoPanelStatus.manhole-splice { background: var(--accent2); color: #06231a; }
.facInfoPanelStatus.manhole-through { background: var(--text-dim); color: #06231a; }
/* 요약행("(대전지사) 호남지선 논산방향 41.8Km")은 종류별 제목색과 구분되게 파란색으로 통일
   (2026-08-20 요청) - 설비 종류에 상관없이 항상 같은 색이다. */
.facInfoPanelSub { color: var(--accent); font-size: 11px; margin: 4px 0; word-break: keep-all; overflow-wrap: break-word; }
/* 직선도 상세정보 카드와 같은 부가 항목(제조사/설치년도/규격 등)을 라벨:값 두 칸으로 표시. */
.facInfoPanelRows { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 2px 8px; }
.facInfoPanelRows dt { color: var(--text-dim); white-space: nowrap; }
/* 값이 아주 긴 항목(예: 설치 "2018년, (사)장애인인권센터 ICT사업단")까지 한 줄에 담으려고
   창을 넓히면 정보창이 지도를 너무 가린다. 값 칸에 상한을 둬서 그런 항목만 다음 줄로 넘어가게
   한다 - 창 자체의 너비(max-content)도 이 상한 안에서 정해진다(2026-08-20 요청). */
/* keep-all: 한글은 기본값이면 글자 단위로 아무 데서나 끊겨("(사)장애 / 인인권센터") 읽기 나빠서
   띄어쓰기 단위로만 줄을 바꾼다. 한 낱말이 칸보다 길 때만 break-word로 강제로 끊는다. */
.facInfoPanelRows dd { margin: 0; color: var(--text); word-break: keep-all; overflow-wrap: break-word; max-width: 190px; }
/* '설치'의 업체명처럼 한 덩어리로 다뤄야 하는 값 - 칸에 들어가면 앞 내용과 같은 줄에, 안 들어가면
   낱말 중간이 아니라 통째로 다음 줄로 넘어간다(inline-block이라 줄바꿈 단위가 이 상자 전체다). */
.facRowChunk { display: inline-block; }
.facInfoPanelBody {
  max-height: 0;
  opacity: 0;
  margin-top: 0;
  overflow: hidden;
  transition: max-height .25s ease, opacity .2s ease, margin-top .25s ease;
}
.facInfoPanelBody.open {
  opacity: 1;
  margin-top: 4px;
  /* max-height는 JS가 실제 내용 높이(scrollHeight)를 재서 인라인 style로 지정(글씨 잘림 방지) */
}
.facInfoPanelCloseBtn {
  position: absolute;
  top: 4px;
  width: 18px; height: 18px;
  background: none;
  border: none;
  border-radius: 50%;
  color: var(--text-dim);
  font-size: 11px;
  line-height: 18px;
  padding: 0;
  cursor: pointer;
}
.facInfoPanelCloseBtn { right: 4px; }
.facInfoPanelCloseBtn:hover { background: var(--panel2); color: var(--text); }

.rulerDot {
  width: 10px; height: 10px;
  background: #ff3b30;
  border: 2px solid #fff;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,.4);
}

.myLocationMarker {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  pointer-events: none;
}
.myLocationMarker::before {
  content: '';
  position: absolute;
  top: -5px;
  width: 36px;
  height: 36px;
  border: 3px solid rgba(38, 120, 255, .85);
  border-radius: 50%;
  animation: myLocationPulse 1.8s ease-out infinite;
}
.myLocationDot {
  position: relative;
  z-index: 1;
  width: 26px;
  height: 26px;
  box-sizing: border-box;
  background: #2678ff;
  border: 4px solid #fff;
  border-radius: 50%;
  box-shadow: 0 0 0 3px #1769e8, 0 2px 7px rgba(0,0,0,.55);
}
.myLocationDot::after {
  content: '';
  position: absolute;
  inset: 5px;
  background: #fff;
  border-radius: 50%;
}
.myLocationLabel {
  position: relative;
  z-index: 1;
  padding: 3px 7px;
  border: 1px solid rgba(255,255,255,.9);
  border-radius: 10px;
  background: #1769e8;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
  box-shadow: 0 1px 5px rgba(0,0,0,.45);
}
@keyframes myLocationPulse {
  0% { transform: scale(.65); opacity: .95; }
  75%, 100% { transform: scale(1.35); opacity: 0; }
}

.roadviewPanel {
  position: absolute;
  width: 360px;
  height: 280px;
  min-width: 220px;
  min-height: 160px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
  z-index: 4;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  container-type: size;
}
.roadviewHeader {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px;
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
  font-size: 12.5px;
  font-weight: 700;
  flex: none;
  cursor: default;
  touch-action: none;
  user-select: none;
  position: relative;
  z-index: 10;
}
.roadviewHeader.dragging { cursor: move; }
.roadviewTitleWrap { flex: 1 1 auto; width: 0; overflow: hidden; min-width: 0; }
.roadviewTitleLine {
  display: flex;
  align-items: baseline;
  gap: 7px;
  min-width: 0;
}
.roadviewTitle {
  display: inline-block;
  width: fit-content;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
  cursor: pointer;
}
.roadviewShotDate {
  flex: 0 0 auto;
  color: var(--text-dim);
  font-size: 11px;
  font-weight: 400;
  white-space: nowrap;
}
.roadviewInfo {
  display: block;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
  font-size: 11px;
  font-weight: 400;
  color: var(--text-dim);
  margin-top: 1px;
}
.roadviewInfo:empty { display: none; }
.roadviewHeaderBtns { display: flex; align-items: center; gap: 2px; flex: 0 0 auto; position: relative; z-index: 20; pointer-events: auto; }
.roadviewCloseBtn {
  position: relative;
  z-index: 21;
  min-width: 36px;
  min-height: 36px;
  padding: 0;
  pointer-events: auto;
  touch-action: manipulation;
}

/* 제목창 폭이 충분할 때는 주소도 제목·촬영일자와 같은 줄에 배치한다. */
@container (min-width: 620px) {
  .roadviewTitleWrap {
    display: flex;
    align-items: baseline;
    gap: 8px;
  }
  .roadviewInfo {
    flex: 1 1 auto;
    margin-top: 0;
  }
}

@media (min-width: 561px) {
  .roadviewPanel.fullscreenMode .roadviewTitleWrap {
    display: flex;
    align-items: baseline;
    gap: 8px;
  }
  .roadviewPanel.fullscreenMode .roadviewInfo {
    flex: 1 1 auto;
    margin-top: 0;
  }
}

.roadviewBody { flex: 1; min-height: 0; position: relative; }
.roadviewNav {
  position: absolute;
  right: 0; top: 0; bottom: 0;
  display: flex; flex-direction: column; align-items: stretch;
  z-index: 4;
  width: clamp(44px, 14cqw, 72px);
  pointer-events: none;
  user-select: none;
  transition: transform .28s ease;
}
.roadviewNav.collapsed {
  transform: translateX(calc(100% - 28px));
  pointer-events: auto;
}
.roadviewNavPeekBtn {
  display: none;
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 28px;
  height: 54px;
  border: 1px solid rgba(255,255,255,.38);
  border-right: 0;
  border-radius: 8px 0 0 8px;
  background: rgba(12,14,18,.78);
  color: #fff;
  font: 700 22px/1 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  cursor: pointer;
  pointer-events: auto;
}
.roadviewNav.collapsed .roadviewDirectionZone,
.roadviewNav.collapsed .roadviewNavBtn { visibility: hidden; }
.roadviewNav.collapsed .roadviewNavPeekBtn { display: block; }
.roadviewDirectionZone {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  border: 0;
  border-radius: 0;
  padding: 0;
  background: rgba(12,14,18,.28);
  color: #fff;
  font: 700 clamp(15px, min(5cqw, 4cqh), 24px)/1 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  cursor: pointer;
  pointer-events: auto;
  user-select: none;
}
.roadviewDirectionZone:hover { background: rgba(12,14,18,.48); }
.roadviewStep {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  font-size: clamp(15px, min(5cqw, 4cqh), 24px);
  line-height: 1;
  cursor: pointer;
  user-select: none;
}
.roadviewStep:hover { background: rgba(255,255,255,.16); }
.roadviewStep em {
  font-style: normal;
  font-size: clamp(8px, min(2.5cqw, 2.2cqh), 12px);
  line-height: 1;
}
.roadviewStep small {
  font-size: clamp(7px, min(2.2cqw, 2cqh), 11px);
  line-height: 1.1;
  white-space: nowrap;
}
.roadviewNavBtn {
  display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  position: absolute;
  right: 4px; top: 50%;
  transform: translateY(-50%);
  width: clamp(38px, min(12cqw, 18cqh), 60px); height: clamp(38px, min(12cqw, 18cqh), 60px);
  border: 1px solid rgba(255,255,255,.24);
  border-radius: 999px;
  padding: 5px 7px;
  background: rgba(255,255,255,.12);
  color: #fff;
  font: 700 clamp(9px, min(3cqw, 3cqh), 14px)/1 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  cursor: pointer;
  white-space: nowrap;
  pointer-events: auto;
}
.roadviewNavBtn:hover { background: rgba(255,255,255,.25); }
.roadviewNavBtn:disabled { opacity: .45; cursor: wait; }
.roadviewNavBtn span {
  display: block;
  width: 1em;
  font-size: clamp(8px, min(2.6cqw, 2.6cqh), 12px);
  line-height: 1.15;
  text-align: center;
  white-space: normal;
  word-break: break-all;
}
/* 작은 로드뷰창에서는 세로 공간을 확보하기 위해 방향 도시명은 숨기고 화살표만 남긴다. */
@container (max-height: 220px) {
  .roadviewStep small { display: none; }
}

.roadviewPanel.fullscreenMode {
  position: fixed !important;
  left: 0 !important; top: 0 !important; right: 0 !important; bottom: 0 !important;
  width: 100% !important; height: 100% !important;
  border-radius: 0;
  z-index: 9999;
}
.roadviewPanel.fullscreenMode .roadviewHeader { cursor: default; }
.roadviewPanel.fullscreenMode .roadviewResizeHandle { display: none; }
@media (max-width: 560px) {
  .roadviewHeader { gap: 2px; padding: 4px 5px; }
  .roadviewHeaderBtns { gap: 0; }
  .roadviewHeaderBtns .iconBtn { width: 34px; height: 34px; font-size: 16px; }
  .roadviewTitle, .roadviewInfo { line-height: 1.05; }
  .roadviewInfo { margin-top: 0; }
  .roadviewDirectionZone { font-size: clamp(15px, min(5cqw, 4cqh), 21px); }
  .roadviewNavBtn { padding: clamp(3px, 1cqw, 5px); }
}

.roadviewResizeHandle {
  position: absolute;
  right: 0; bottom: 0;
  width: 18px; height: 18px;
  cursor: nwse-resize;
  z-index: 10;
  pointer-events: auto;
  touch-action: none;
  background:
    linear-gradient(135deg, transparent 0 45%, var(--border) 45% 55%, transparent 55% 100%),
    linear-gradient(135deg, transparent 0 65%, var(--border) 65% 75%, transparent 75% 100%);
}

.ctxMenu {
  position: fixed;
  z-index: 60;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 4px;
  min-width: 200px;
  display: flex;
  flex-direction: column;
}
.ctxMenuItem {
  background: none;
  border: none;
  color: var(--text);
  text-align: left;
  padding: 9px 10px;
  font-size: 13px;
  border-radius: 6px;
  cursor: pointer;
}
.ctxMenuItem:hover { background: var(--panel2); }
.ctxMenuItem.active { color: var(--accent); font-weight: 700; }

.ctxMenuCoord {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}
.ctxMenuCopyBtn {
  background: var(--panel2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 3px 8px;
  font-size: 11.5px;
  cursor: pointer;
  flex: none;
}
.ctxMenuCopyBtn:hover { border-color: var(--accent); color: var(--accent); }

.ctxMenuAddr {
  padding: 0 10px 8px;
  margin-top: -6px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-dim);
}
.ctxMenuAddr:empty { display: none; }
.ctxMenuRegion {
  padding: 0 10px 8px;
  margin-top: -6px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--border);
  font-size: 11px;
  color: var(--text-dim);
}
.ctxMenuRegion:empty { display: none; }
.ctxMenuMgmt {
  padding: 8px 10px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-dim);
}

.iconBtn {
  background: none; border: none; color: var(--text-dim);
  width: 32px; height: 32px; border-radius: 50%; cursor: pointer; font-size: 17px;
  user-select: none;
}
.iconBtn:hover { background: var(--panel2); color: var(--text); }
.roadviewNaverBtn { color: #03c75a; font-weight: 800; }

.roadviewTextBtn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-dim);
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}
.roadviewTextBtn:hover { border-color: var(--accent); color: var(--accent); }

.mpPoint {
  position: relative;
  width: 9px;
  height: 9px;
  pointer-events: none;
}
.mpDot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  border: 1.5px solid #fff;
  box-shadow: 0 1px 2px rgba(0,0,0,.45);
}
.mpText {
  position: absolute;
  left: 50%;
  top: 100%;
  margin-top: 2px;
  transform: translateX(-50%);
  font-size: 11.5px;
  font-weight: 800;
  white-space: nowrap;
  text-shadow: -1px -1px 0 #fff, 1px -1px 0 #fff, -1px 1px 0 #fff, 1px 1px 0 #fff, 0 0 4px #fff;
}

/* "거리재기" 버튼 - 이 지도 단독 화면(/mileposts/)은 PC·모바일 모두 텍스트로 쓴다(2026-08-20
   사용자 요청 - 2026-08-19에 모바일만 줄자 아이콘으로 바꿨던 것을 되돌림). 아이콘 요소는
   마크업에 그대로 두되 항상 숨긴다. 루트 화면(PART C, test_integrated)의 같은 버튼은 상단바가
   더 빽빽해 모바일 아이콘 표기를 그대로 유지한다. */
#rulerBtn { display: inline-flex; align-items: center; }
.btnLabelIcon { display: none; width: 16px; height: 16px; }

@media (min-width: 701px) and (max-width: 1000px) {
  #facilityChips { display: none; }
  #facilityBtn { display: inline-block; margin-left: auto; }
}
@media (max-width: 700px) {
  #highwayRouteSelect { width: 120px; min-width: 96px; max-width: 130px; padding: 6px 8px; font-size: 12px; margin-left: auto; }
  .highwayRoutePanel { width: min(260px, calc(100vw - 16px)); max-width: calc(100vw - 16px); box-sizing: border-box; }
  #facilitySearchBtn, #mapTypeTopBtn, #myLocationBtn, #roadviewBtn, #rulerBtn {
    background: #111 !important; color: #fff !important; border: 1px solid #444 !important;
  }
  #facilitySearchBtn:active, #mapTypeTopBtn:active, #myLocationBtn:active, #roadviewBtn:active, #rulerBtn:active,
  #rulerBtn.active { background: #2c2c2c !important; color: #fff !important; }
  /* 모바일에서는 정보창이 화면 너비의 절반을 넘지 않게 하고, 넘치는 줄은 줄바꿈한다(2026-08-20 요청) */
  .facInfoPanel { max-width: 50vw; }
  #topbar { gap: 5px; padding: 8px; }
  #topbar h1 { font-size: 13px; }
  #topbar button { padding: 6px 8px; font-size: 12px; }
  #facilityChips { display: none; }
  #facilityBtn { display: inline-block; }
  #mapTypeTopBtn, #myLocationBtn, #roadviewBtn, #rulerBtn { right: 10px; width: 92px; justify-content: center; text-align: center; box-shadow: 0 2px 8px rgba(0,0,0,.45); }
  #mapTypeTopBtn { position: fixed; bottom: 118px; z-index: 1300; }
  #myLocationBtn { position: fixed; bottom: 80px; z-index: 1300; }
  #roadviewBtn { position: fixed; bottom: 42px; z-index: 1300; }
  #rulerBtn { position: fixed; bottom: 4px; z-index: 1300; padding: 6px 8px; }
  .btnLabelFull { display: inline; }
  .btnLabelIcon { display: none; }
  .facilityPanel { grid-template-columns: repeat(2, minmax(100px, 1fr)); width: min(280px, calc(100vw - 16px)); min-width: 0; }
  .facilitySearchBtn { left: 8px; top: 8px; }
  .facilitySearchPanel { left: 8px; top: 48px; width: calc(100vw - 16px); }
}
