:root {
  --bg: #f7f8fa;
  --card: #ffffff;
  --line: #e3e6ea;
  --text: #1f2329;
  --muted: #8a909a;
  --accent: #2f6fed;
  --accent-weak: #e8f0fe;
  --danger: #e0533d;
  --panel-w: 360px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  color: var(--text);
  font-size: 13px;
}

#map { position: fixed; inset: 0 var(--panel-w) 0 0; }
body.playback-active #map { right: 0; }
body.playback-active #panel,
body.playback-active .map-ctl,
body.playback-active .map-chips,
body.playback-active .map-hint,
body.playback-active .elev-float { display: none !important; }
body.playback-active .wp-marker { display: none !important; }

/* 점 찍기 모드일 때 커서 변경 */
.leaflet-container.adding,
.leaflet-container.adding .leaflet-grab,
.leaflet-container.adding .leaflet-interactive { cursor: crosshair !important; }

/* 지도 컨트롤: 세로 기본 메뉴 + 선택 항목 우측 플라이아웃 */
.map-ctl {
  position: fixed; top: 10px; left: 10px; z-index: 1100;
  width: 82px;
}
.map-ctl .ctl-primary {
  display: flex; flex-direction: column; gap: 4px;
}
.map-ctl .ctl-row {
  display: flex; gap: 0; background: #fff; border: 1px solid var(--line);
  border-radius: 8px; overflow: hidden; box-shadow: 0 1px 4px rgba(0,0,0,0.15);
}
.map-ctl .ctl-item {
  border: none; background: #fff; padding: 0 12px; min-height: 38px; cursor: pointer;
  font-size: 12.5px; color: var(--muted); white-space: nowrap;
}
.map-ctl .ctl-primary .ctl-item {
  width: 82px; border: 1px solid var(--line); border-radius: 8px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.15);
}
.map-ctl .ctl-row .ctl-item { min-width: 56px; border-right: 1px solid var(--line); }
.map-ctl .ctl-row .ctl-item:last-child { border-right: none; }
.map-ctl .ctl-item.active { background: var(--accent); color: #fff; }
.map-ctl .ctl-item.open { background: var(--accent-weak); color: var(--accent); font-weight: 700; }
.map-ctl .ctl-flyout {
  position: absolute; left: 88px; flex-direction: column; border-color: var(--accent);
}
.map-ctl .ctl-flyout .ctl-item {
  min-width: 70px; border-right: none; border-bottom: 1px solid var(--line);
}
.map-ctl .ctl-flyout .ctl-item:last-child { border-bottom: none; }
.map-ctl #ctl-base { top: 0; }
.map-ctl #ctl-zoom { top: 42px; }

/* 지도 우상단: 미리주행 / 내 위치 / 초기화, 참고선은 둘째 줄 */
.map-chips {
  position: fixed; top: 10px; right: calc(var(--panel-w) + 10px); z-index: 1100;
  display: flex; flex-direction: column; align-items: flex-end; gap: 6px;
}
.map-action-row { display: flex; gap: 6px; }
.chip {
  min-height: 38px; border: none; border-radius: 8px; padding: 7px 12px; cursor: pointer;
  font-size: 12px; box-shadow: 0 1px 4px rgba(0,0,0,0.15);
}
.icon-chip { width: 38px; padding: 0; font-size: 17px; display: inline-grid; place-items: center; }
.track-controls {
  display: flex; gap: 0; overflow: hidden; border-radius: 8px;
  background: #f08a24; box-shadow: 0 1px 4px rgba(0,0,0,0.15);
}
.track-controls .chip { border-radius: 0; box-shadow: none; }
.track-controls.off { background: #f1f3f5; }
.track-chip { background: transparent; color: #fff; }
.track-controls.off .track-chip { color: var(--muted); }
.track-remove {
  width: 38px; padding: 0; background: transparent; color: #fff; font-size: 14px;
  border-left: 1px solid rgba(255,255,255,0.4);
}
.track-controls.off .track-remove { color: var(--danger); border-left-color: var(--line); }
.preview-route-chip {
  background: var(--accent); color: #fff; border: 1px solid var(--accent);
}
.preview-route-chip:hover { filter: brightness(0.96); }
.reset-chip { background: #fff; color: var(--muted); border: 1px solid var(--line); }
.reset-chip:hover { border-color: var(--danger); color: var(--danger); }
.loc-chip { background: #fff; color: var(--accent); border: 1px solid var(--line); }
.loc-chip:hover { border-color: var(--accent); }
.loc-chip.locating { opacity: 0.6; pointer-events: none; }

/* 웨이포인트 추가/삽입 안내 배너 (지도 상단 중앙) */
.map-hint {
  position: fixed; top: 12px; left: calc((100% - var(--panel-w)) / 2);
  transform: translateX(-50%); z-index: 1100;
  background: var(--accent); color: #fff; font-size: 12px;
  padding: 7px 14px; border-radius: 8px; box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  max-width: calc(100% - var(--panel-w) - 24px); white-space: nowrap;
}
.map-hint.hidden { display: none; }

#panel {
  position: fixed; top: 0; right: 0; bottom: 0; width: var(--panel-w);
  background: var(--bg); border-left: 1px solid var(--line);
  display: flex; flex-direction: column; z-index: 1000;
}

.panel-head { padding: 12px 14px 8px; background: var(--card); border-bottom: 1px solid var(--line); }
.head-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.panel-head h1 { font-size: 15px; margin: 0; }
.reset-btn { border: 1px solid var(--line); background: #fff; color: var(--muted); border-radius: 6px; padding: 4px 8px; font-size: 11.5px; cursor: pointer; white-space: nowrap; }
.reset-btn:hover { border-color: var(--danger); color: var(--danger); }
.sub { margin: 3px 0 0; color: var(--muted); font-size: 11.5px; }

.hidden { display: none !important; }

.search { padding: 10px 12px; background: var(--card); border-bottom: 1px solid var(--line); }
.search-row { display: flex; gap: 6px; }
.search-row input { flex: 1; min-width: 0; padding: 7px 9px; border: 1px solid var(--line); border-radius: 8px; font-size: 13px; }
.search-icon-btn { flex: 0 0 34px; width: 34px; padding: 0; font-size: 18px; }
.pick-btn {
  flex: 0 0 auto; padding: 7px 9px; border: 1px dashed var(--accent);
  background: #fff; color: var(--accent); border-radius: 8px; cursor: pointer; font-weight: 600; font-size: 12.5px;
  white-space: nowrap;
}
.pick-btn.on { background: var(--accent); color: #fff; border-style: solid; }
.edit-row { display: flex; gap: 5px; margin-top: 6px; overflow-x: auto; padding-bottom: 1px; }
.edit-row .mini { white-space: nowrap; }
.edit-row .mini.active, .tool-row .mini.active { border-color: var(--accent); color: var(--accent); background: var(--accent-weak); }
.deleted-menu {
  margin-top: 6px; padding: 6px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--bg); max-height: 120px; overflow-y: auto;
}
.deleted-menu button {
  display: block; width: 100%; padding: 6px 8px; margin-bottom: 4px; text-align: left;
  border: 1px solid var(--line); border-radius: 6px; background: #fff; color: var(--text); cursor: pointer;
}
.deleted-menu button:last-child { margin-bottom: 0; }
.deleted-menu button:hover { border-color: var(--accent); color: var(--accent); }

.insert-hint {
  margin-top: 8px; padding: 6px 8px; border-radius: 6px;
  background: var(--accent-weak); color: var(--accent); font-size: 11.5px;
  display: flex; justify-content: space-between; align-items: center;
}
.insert-hint button { background: none; border: none; color: var(--accent); cursor: pointer; text-decoration: underline; font-size: 11px; }

.results { list-style: none; margin: 8px 0 0; padding: 0; max-height: 220px; overflow-y: auto; }
.results li { padding: 7px 8px; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 6px; cursor: pointer; background: #fff; }
.results li:hover { border-color: var(--accent); background: var(--accent-weak); }
.results .r-name { font-weight: 600; }
.results .r-addr { color: var(--muted); font-size: 11px; margin-top: 2px; }
.results .r-type { font-size: 10px; color: #fff; background: var(--muted); border-radius: 4px; padding: 1px 5px; margin-left: 6px; }
.results .r-type.addr { background: #5b9; }

.wp-section { flex: 1; overflow-y: auto; padding: 10px 12px; min-height: 80px; }
.wp-head { display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: 11.5px; margin-bottom: 8px; }
.empty-msg { color: var(--muted); font-size: 11.5px; line-height: 1.6; text-align: center; padding: 16px 8px; }

.wp-list { list-style: none; margin: 0; padding: 0; }
.wp-item { display: flex; align-items: center; gap: 8px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; }
.wp-item.active { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-weak); }
.wp-badge { width: 22px; height: 22px; border-radius: 50%; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; color: #fff; font-size: 11px; font-weight: 700; }
.wp-name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.wp-name .loading { color: var(--muted); font-weight: 400; font-style: italic; }
.wp-del { border: 1px solid var(--line); background: #fff; border-radius: 6px; width: 22px; height: 22px; cursor: pointer; color: var(--muted); }
.wp-del:hover { color: var(--danger); border-color: var(--danger); }

.leg-item { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; padding: 4px 6px 4px 16px; margin: 2px 0; position: relative; }
.leg-item::before { content: ""; position: absolute; left: 21px; top: -2px; bottom: -2px; width: 2px; background: var(--line); }
.leg-meta { color: var(--muted); font-size: 11px; }
.leg-meta.err { color: var(--danger); }
.leg-retry { color: var(--danger); font-size: 11px; background: transparent; border: 0; padding: 2px 0; cursor: pointer; }
.leg-retry:hover { text-decoration: underline; }
.leg-mode { font-size: 11px; padding: 2px 4px; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.leg-insert { margin-left: auto; font-size: 11px; color: var(--accent); background: var(--accent-weak); border: none; border-radius: 6px; padding: 3px 8px; cursor: pointer; }
.leg-insert:hover { background: #d9e6ff; }
.leg-spinner { color: var(--accent); font-size: 11px; }

.tools { padding: 8px 12px; background: var(--card); border-bottom: 1px solid var(--line); }
.tool-row { display: flex; gap: 6px; margin-bottom: 6px; }
.tool-row:last-child { margin-bottom: 0; }
.saved-select { flex: 1; min-width: 0; padding: 5px; border: 1px solid var(--line); border-radius: 6px; font-size: 11.5px; background: #fff; }
.file-toolbar { align-items: center; gap: 8px; }
.folder-chip {
  white-space: nowrap;
}
.folder-chip.set { border-color: #1aa179; color: #147a5d; background: #effbf7; }
.file-menu-tools { position: relative; flex: 1 1 0; min-width: 0; }
.file-menu-tools > .mini {
  width: 100%; min-height: 40px; border-radius: 8px;
  font-size: 13px; font-weight: 700;
}
.file-action-menu {
  position: absolute; top: calc(100% + 5px); right: 0; z-index: 1400;
  width: 190px; padding: 5px; border: 1px solid var(--line); border-radius: 8px;
  background: #fff; box-shadow: 0 4px 14px rgba(0,0,0,0.16);
}
.file-toolbar .file-menu-tools:first-child .file-action-menu { left: 0; right: auto; }
.file-toolbar .file-menu-tools:nth-child(2) .file-action-menu { left: 50%; right: auto; transform: translateX(-50%); }
.file-menu-status {
  display: block; padding: 6px 9px; margin-bottom: 3px; color: var(--muted);
  border-bottom: 1px solid var(--line); font-size: 11px; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
}
.file-menu-action {
  display: flex; width: 100%; align-items: center; padding: 8px 9px;
  border: none; border-radius: 6px; background: #fff; color: var(--text);
  font-size: 12px; text-align: left; cursor: pointer;
}
.file-menu-action:hover { background: var(--accent-weak); color: var(--accent); }
.file-menu-action:disabled { color: #adb3bd; cursor: default; }
.file-menu-action:disabled:hover { background: #fff; color: #adb3bd; }
.mini { padding: 5px 8px; border: 1px solid var(--line); background: #fff; border-radius: 6px; cursor: pointer; font-size: 11.5px; color: var(--text); }
.mini:hover { border-color: var(--accent); color: var(--accent); }
.mini:disabled { opacity: 0.42; cursor: default; }
.mini:disabled:hover { border-color: var(--line); color: var(--text); }
.gradient-toggle { display: inline-flex; align-items: center; gap: 5px; }
.gradient-toggle-icons { display: inline-flex; width: 18px; height: 18px; }
.gradient-toggle svg { width: 18px; height: 18px; fill: none; overflow: visible; }
.gradient-toggle path { stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.gradient-chart-icon path { stroke: var(--accent); }
.segment-lines-icon { display: none; }
.segment-lines-icon .line-blue { stroke: #2f6fed; }
.segment-lines-icon .line-green { stroke: #1aa179; }
.segment-lines-icon .line-orange { stroke: #f08a24; }
.segment-lines-icon .line-red { stroke: #e0533d; }
.gradient-toggle.to-segments .gradient-chart-icon { display: none; }
.gradient-toggle.to-segments .segment-lines-icon { display: block; }
.mini.wide { flex: 1; text-align: center; }
.file-label { display: flex; align-items: center; }
.imported-summary { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 3px; }
.imported-meta { font-size: 11px; color: #c2790a; }
.route-correction-status { position: relative; padding-left: 13px; font-size: 11px; line-height: 1.35; white-space: pre-line; color: var(--muted); }
.route-correction-status::before { content: ""; position: absolute; left: 1px; top: 4px; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.route-correction-status.running, .route-correction-status.stopping { color: var(--accent); font-weight: 600; }
.route-correction-status.running::before, .route-correction-status.stopping::before { animation: correction-pulse 1s ease-in-out infinite; }
.route-correction-status.completed { color: #147a5d; }
.route-correction-status.stopped { color: #9a6700; }
.route-correction-status.failed { color: var(--danger); }
@keyframes correction-pulse { 50% { opacity: 0.28; transform: scale(0.72); } }
@media (prefers-reduced-motion: reduce) {
  .route-correction-status.running::before, .route-correction-status.stopping::before { animation: none; }
}

.panel-foot { padding: 10px 12px; background: var(--card); border-top: 1px solid var(--line); }

/* 지도 우측 하단 통합 박스(반투명 80%): 정보 / 고도차트 / 고도정보 */
.elev-float {
  position: fixed; right: calc(var(--panel-w) + 14px); bottom: 20px; z-index: 1100;
  width: 400px; max-width: calc(100vw - var(--panel-w) - 28px);
  background: rgba(255,255,255,0.8); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
  border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 2px 12px rgba(0,0,0,0.16);
  padding: 8px 10px 6px;
}
.stats { color: var(--muted); font-size: 12px; margin: 0 0 6px; min-height: 16px; text-align: left; }
.stats b { color: var(--text); }
.eta-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin: 6px -2px -2px; padding: 7px 2px 0; border-top: 1px solid var(--line);
  color: var(--text); font-size: 12px;
}
.eta-row .mini { flex-shrink: 0; }
.elev { position: relative; border-radius: 8px; overflow: hidden; background: transparent; }
.elev-cursor { position: absolute; top: 0; width: 2px; height: 108px; background: #2f6fed; pointer-events: none; display: none; z-index: 2; }
.elev svg { display: block; width: 100%; height: 108px; cursor: crosshair; }
.elev .elev-cap { display: flex; justify-content: space-between; padding: 4px 2px 0; margin-top: 2px; font-size: 11px; color: var(--muted); border-top: 1px solid var(--line); background: transparent; }

/* 확대 지도에서 경로를 따라가는 읽기 전용 미리주행 */
.playback-panel {
  position: fixed; left: 50%; bottom: 22px; z-index: 1600;
  transform: translateX(-50%);
  width: min(520px, calc(100vw - 28px));
  padding: 12px 14px;
  border: 1px solid rgba(255,255,255,0.75); border-radius: 14px;
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 6px 24px rgba(20,32,52,0.28);
}
.playback-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.playback-top > div { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
#playback-info { color: var(--text); }
#playback-elevation { color: var(--muted); font-size: 11.5px; }
.playback-grade {
  flex-shrink: 0; min-width: 72px; padding: 6px 9px; border-radius: 999px;
  color: #fff; background: var(--muted); font-weight: 700; text-align: center;
}
.playback-seek { width: 100%; margin: 10px 0 7px; accent-color: var(--accent); cursor: pointer; }
.playback-options { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 7px; }
.playback-options button { min-height: 30px; }
.playback-actions { display: grid; grid-template-columns: 1fr 1.5fr 1fr; gap: 8px; }
.playback-actions button { min-height: 34px; }
.playback-marker {
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--accent); border: 4px solid #fff;
  box-shadow: 0 2px 10px rgba(0,0,0,0.45), 0 0 0 3px rgba(47,111,237,0.28);
}
.playback-center {
  position: fixed; left: 50%; bottom: 180px; z-index: 1650; transform: translateX(-50%);
  border: 1px solid var(--line); border-radius: 9px; padding: 9px 13px;
  background: rgba(255,255,255,0.94); color: var(--accent); font-weight: 700;
  box-shadow: 0 3px 14px rgba(20,32,52,0.22); cursor: pointer;
}

/* 목록 드래그 핸들/순서 변경 */
.wp-drag { cursor: grab; color: var(--muted); font-size: 14px; line-height: 1; flex-shrink: 0; user-select: none; }
.wp-item.dragging { opacity: 0.5; }
.wp-item.drop-into { border-color: var(--accent); box-shadow: 0 -2px 0 0 var(--accent); }
.wp-item.editing-locked .wp-drag { cursor: not-allowed; opacity: 0.38; }

/* 모달 (저장 경로 미리보기) */
.modal { position: fixed; inset: 0; background: rgba(20,24,30,0.45); z-index: 3000; display: flex; align-items: center; justify-content: center; }
.modal-box { width: min(760px, 92vw); height: min(520px, 88vh); background: var(--card); border-radius: 12px; display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 12px 40px rgba(0,0,0,0.35); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border-bottom: 1px solid var(--line); font-weight: 700; }
.modal-x { border: none; background: none; font-size: 16px; color: var(--muted); cursor: pointer; }
.modal-body { flex: 1; display: flex; min-height: 0; }
.saved-list { list-style: none; margin: 0; padding: 8px; width: 220px; overflow-y: auto; border-right: 1px solid var(--line); }
.saved-list li { padding: 9px 10px; border-radius: 8px; cursor: pointer; font-size: 12.5px; margin-bottom: 4px; border: 1px solid transparent; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.saved-list li:hover { background: var(--bg); }
.saved-list li.sel { background: var(--accent-weak); border-color: var(--accent); color: var(--accent); font-weight: 600; }
.saved-list .empty { color: var(--muted); cursor: default; }
.preview { flex: 1; display: flex; flex-direction: column; min-width: 0; padding: 10px; gap: 8px; }
.preview-map-wrap { flex: 1; min-height: 160px; position: relative; }
.preview-map { position: absolute; inset: 0; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); background: #eef1f5; }
.preview-base { position: absolute; top: 8px; right: 8px; z-index: 500; display: flex; background: #fff; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; box-shadow: 0 1px 4px rgba(0,0,0,0.15); }
.preview-base button { border: none; background: #fff; padding: 5px 9px; cursor: pointer; font-size: 11px; color: var(--muted); border-right: 1px solid var(--line); }
.preview-base button:last-child { border-right: none; }
.preview-base button.active { background: var(--accent); color: #fff; }
/* 지도 우측 하단 겹침 + 너비 절반 + 반투명 (전체 코스 느낌용) */
.preview-elev { position: absolute; right: 8px; bottom: 8px; width: 50%; max-width: 280px; z-index: 500;
  border: 1px solid rgba(0,0,0,0.12); border-radius: 8px; overflow: hidden;
  background: rgba(255,255,255,0.6); box-shadow: 0 1px 6px rgba(0,0,0,0.18); }
.preview-elev svg { display: block; width: 100%; height: 66px; }
.preview-elev .elev-cap { display: flex; justify-content: space-between; padding: 2px 7px; font-size: 10px; color: var(--muted); border-top: 1px solid rgba(0,0,0,0.1); background: rgba(255,255,255,0.35); }
.preview-stats { font-size: 12px; color: var(--muted); min-height: 16px; }
.preview-stats b { color: var(--text); }
.preview-stats .eta-summary { color: var(--text); font-weight: 700; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 10px 14px; border-top: 1px solid var(--line); }
.modal-foot .primary:disabled { background: #b8c4da; cursor: default; }
/* 추천 원본은 저장 목록과 별도 상태/검색을 사용하며 수정·삭제 UI를 두지 않는다. */
.recommended-modal-box { width: min(980px, 96vw); }
.recommended-content { min-height: 420px; }
.recommended-sidebar { width: 260px; min-width: 220px; display: flex; flex-direction: column; border-right: 1px solid var(--line); }
.recommended-filters { display: flex; gap: 6px; overflow-x: auto; padding: 10px 10px 0; scrollbar-width: none; }
.recommended-filters::-webkit-scrollbar { display: none; }
.recommended-filters button { flex: 0 0 auto; min-height: 36px; padding: 7px 9px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); background: #fff; font-size: 11px; font-weight: 700; cursor: pointer; }
.recommended-filters button.active { border-color: var(--accent); color: #fff; background: var(--accent); }
.recommended-filters button span { display: inline-block; min-width: 16px; margin-left: 2px; padding: 1px 4px; border-radius: 999px; color: inherit; background: rgba(127,127,127,0.14); font-size: 10px; text-align: center; }
.recommended-filters button.active span { background: rgba(255,255,255,0.2); }
.recommended-search { margin: 10px 10px 2px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px; color: var(--text); background: #fff; }
.recommended-list { width: auto; flex: 1; border-right: 0; }
.recommended-list li { white-space: normal; }
.recommended-list li strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recommended-list li span { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; }
.recommended-list li .recommended-tags { color: var(--accent); font-weight: 700; }
.recommended-list li.sel span { color: inherit; opacity: 0.8; }
.recommended-list li[role="button"]:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.recommended-source { align-self: flex-start; color: var(--accent); font-size: 12px; text-decoration: none; font-weight: 600; }
.recommended-source:hover { text-decoration: underline; }
.recommended-source-row { display: flex; flex-wrap: wrap; gap: 12px; min-height: 18px; }
.recommended-route-label { background: transparent; border: 0; }
.recommended-route-bubble { display: block; max-width: 190px; overflow: hidden; padding: 7px 10px; border: 1px solid #c026d3; border-radius: 11px; color: var(--text); background: rgba(255,255,255,0.94); box-shadow: 0 2px 8px rgba(0,0,0,0.2); font-size: 11px; font-weight: 700; line-height: 1.2; text-overflow: ellipsis; white-space: nowrap; }
.recommended-route-marker { display: grid; width: 44px; height: 44px; place-items: center; background: transparent; border: 0; }
.recommended-route-dot { width: 15px; height: 15px; border: 3px solid #c026d3; border-radius: 50%; background: #fff; box-shadow: 0 1px 5px rgba(0,0,0,0.28); }
@media (max-width: 640px) {
  .recommended-sidebar { width: 42%; min-width: 150px; }
  .recommended-content { min-height: 380px; }
}

.google-modal-box { width: min(560px, 92vw); height: auto; max-height: min(560px, 88vh); }
.google-items-wrap { padding: 14px; overflow-y: auto; }
.google-items-note { margin: 0 0 10px; color: var(--muted); font-size: 12px; line-height: 1.45; }
.google-items { list-style: none; margin: 0; padding: 0; }
.google-items li { display: flex; align-items: center; gap: 10px; padding: 10px 8px; border-top: 1px solid var(--line); }
.google-items li:first-child { border-top: 0; }
.google-item-info { flex: 1; min-width: 0; }
.google-item-info strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.google-item-info span { color: var(--muted); font-size: 11px; }
.google-items .empty { color: var(--muted); justify-content: center; padding: 24px 8px; }
.my-location-marker {
  width: 24px; height: 24px; border: 4px solid #fff; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 0 7px rgba(47,111,237,0.22), 0 2px 9px rgba(0,0,0,0.35);
}
.eta-modal-box { width: min(520px, calc(100vw - 28px)); height: auto; max-height: calc(100vh - 28px); }
.eta-settings-body { padding: 14px 18px 18px; color: var(--text); }
.eta-settings-body p { margin: 0 0 16px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.eta-settings-grid { display: grid; grid-template-columns: 1.1fr 1fr 1fr; gap: 12px 10px; align-items: center; font-size: 13px; }
.eta-settings-grid label { display: flex; align-items: center; gap: 6px; color: var(--muted); white-space: nowrap; }
.eta-settings-grid input { width: 58px; padding: 7px 6px; border: 1px solid var(--line); border-radius: 7px; color: var(--text); }

/* GPX 열기 모달: 지도 위 / 방식 선택 아래 (세로 배치) */
.gpx-body { flex-direction: column; padding: 10px; gap: 10px; }
.gpx-modes { display: flex; flex-direction: column; gap: 8px; font-size: 13px; color: var(--text); }
.gpx-modes label { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.gpx-modes input:disabled { opacity: 0.4; }
/* 참고선 기본 안내 */
.gpx-note { color: var(--muted); font-size: 12.5px; padding: 6px 8px; background: #fff7ec; border: 1px solid #f0d9b8; border-radius: 6px; }
.gpx-wtoggle { font-weight: 600; }
/* 웨이포인트 하위 옵션: 새로 시작 / 이어서 추가 (웨이포인트 미선택 시 흐리게) */
.gpx-wpopt { display: flex; gap: 16px; margin: -2px 0 0 26px; font-size: 12px; color: var(--muted); }
.gpx-wpopt label { display: flex; align-items: center; gap: 6px; cursor: pointer; }
.gpx-wpopt.disabled { opacity: 0.4; }
.gpx-wpopt.disabled label { cursor: default; }

button.primary { background: var(--accent); color: #fff; border: none; border-radius: 8px; padding: 7px 12px; font-weight: 600; cursor: pointer; }
button.primary:disabled { background: #b8c4da; cursor: default; }
button.primary.block { width: 100%; padding: 10px; font-size: 14px; }
button.ghost { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 11.5px; text-decoration: underline; }

.wp-marker div { width: 24px; height: 24px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; font-size: 12px; border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,0.4); }

.toast { position: fixed; left: calc(50% - var(--panel-w) / 2); bottom: 24px; transform: translateX(-50%); background: rgba(31,35,41,0.92); color: #fff; padding: 8px 14px; border-radius: 8px; font-size: 12px; z-index: 2000; }
body.playback-active .toast { left: 50%; bottom: 150px; }

/* 좌표 목록 끝에만 표시하는 직접 정책 링크. */
.privacy-footer { margin-top:16px; padding:8px 0; text-align:center; }
.privacy-footer a { display:inline-block; padding:10px 8px; color:var(--accent); font-size:13px; line-height:1.5; text-decoration:none; }
.privacy-footer a:hover, .privacy-footer a:focus-visible { text-decoration:underline; }

/* 기능 버튼은 지도 표시 메뉴와 분리해 참고선 위에 둔다. */
.map-chips .gradient-toggle { background:#fff; color:var(--muted); }
.map-chips .gradient-toggle.active { background:var(--accent); color:#fff; }
.file-progress { display:flex; align-items:center; gap:8px; margin-top:8px; padding:8px; color:var(--accent); background:var(--accent-weak); border-radius:8px; line-height:1.5; }
.file-spinner { flex:0 0 18px; width:18px; height:18px; border:2px solid var(--accent-weak); border-top-color:var(--accent); border-radius:50%; animation:file-spin .8s linear infinite; }
@keyframes file-spin { to { transform:rotate(360deg); } }
@media (prefers-reduced-motion:reduce) { .file-spinner { animation:none; } }
/* 좁은 웹에서는 지도를 위, 좌표 목록을 아래에 배치한다. */
@media (max-width:640px) {
  #map { inset:0 0 48dvh; }
  #panel { top:52dvh; width:100%; border-left:0; border-top:1px solid var(--line); }
  .map-chips { right:10px; }
  .elev-float { right:10px; bottom:calc(48dvh + 10px); max-width:calc(100vw - 20px); }
  .panel-head { padding:7px 12px; }
  .panel-head .sub { display:none; }
  .wp-section { min-height:60px; }
  .recommended-content { flex-direction:column; min-height:0; }
  .recommended-sidebar { width:100%; min-width:0; flex:0 0 40%; min-height:0; border-right:0; border-bottom:1px solid var(--line); }
  .recommended-modal-box { height:92dvh; max-height:92dvh; }
}
