/* ══════════════════════════════════════════
   국토종주 지도 — 디자인 시스템
   ══════════════════════════════════════════ */

:root {
  --bg: #f7f8fb;
  --bg-elev: #ffffff;
  --bg-sunk: #eef1f6;
  --border: #dfe4ec;
  --border-strong: #c6cede;
  --text: #16202f;
  --text-dim: #5b6779;
  --text-mute: #8b96a8;
  --accent: #0f7b6c;
  --accent-soft: #e3f4f0;
  --accent-text: #0a5c50;
  --danger: #c0392b;
  --warn: #b45309;
  --warn-soft: #fef3c7;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .1);
  --shadow-md: 0 4px 8px -2px rgba(16, 24, 40, .1), 0 2px 4px -2px rgba(16, 24, 40, .06);
  --shadow-lg: 0 12px 16px -4px rgba(16, 24, 40, .08), 0 4px 6px -2px rgba(16, 24, 40, .03);
  --radius: 12px;
  --radius-sm: 8px;
  --topbar-h: 60px;
  /* 한글 가독성 우선 스택: Pretendard → 애플/윈도 시스템 한글 → Noto Sans KR */
  --font: 'Pretendard Variable', Pretendard, 'Apple SD Gothic Neo', 'Malgun Gothic',
          'Noto Sans KR', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  /* 숫자(거리·고도)는 폭이 고정된 서체로 표에서 정렬이 맞도록 */
  --font-num: 'Pretendard Variable', Pretendard, 'Noto Sans KR', ui-monospace, sans-serif;
  --fs-base: 14.5px;
}

html.dark {
  --bg: #0b1120;
  --bg-elev: #141c2e;
  --bg-sunk: #0d1424;
  --border: #2b3852;
  --border-strong: #415273;
  /* 대비 강화: 본문 거의 흰색, 보조 텍스트도 WCAG AA 확보 */
  --text: #f2f6fc;
  --text-dim: #b6c3d8;
  --text-mute: #8b9bb6;
  --accent: #2dd4bf;
  --accent-soft: #10312e;
  --accent-text: #5eead4;
  --danger: #f87171;
  --warn: #fbbf24;
  --warn-soft: #3a2c0a;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, .4);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, .45);
  --shadow-lg: 0 16px 32px rgba(0, 0, 0, .5);
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  height: 100%;
  font-family: var(--font);
  font-size: var(--fs-base);
  line-height: 1.62;
  letter-spacing: -0.01em;
  font-weight: 450;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overscroll-behavior: none;
  word-break: keep-all;      /* 한글 단어 중간 줄바꿈 방지 */
  overflow-wrap: break-word;
}

/* 제목은 더 굵고 촘촘하게 */
h1, h2, h3, h4, .rc-name, .cr-name {
  letter-spacing: -0.025em;
  line-height: 1.35;
}

/* 숫자 정렬 */
.cr-km, .sv, .st-km, .d-km, .num {
  font-family: var(--font-num);
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum' 1;
}

body { display: flex; flex-direction: column; }

a { color: inherit; text-decoration: none; }
/* 전역 버튼: 부모 글자상을 상속해야 다크모드에서 보입니다 (미지정 시 분라우저 기본 검정 상) */
button { font-family: inherit; cursor: pointer; color: inherit; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 6px;
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 6px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--text-mute); }

/* ─────────── 부팅 화면 ─────────── */
.boot {
  position: fixed; inset: 0; z-index: 9999;
  background: var(--bg);
  display: grid; place-items: center;
  transition: opacity .4s ease, visibility .4s;
}
.boot.hide { opacity: 0; visibility: hidden; }
.boot-inner { text-align: center; }
.boot-icon { font-size: 52px; animation: bounce 1.1s ease-in-out infinite; }
@keyframes bounce { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-12px); } }
.boot-title { font-size: 20px; font-weight: 900; margin-top: 14px; letter-spacing: -.02em; }
.boot-bar { width: 200px; height: 4px; background: var(--bg-sunk); border-radius: 4px; margin: 18px auto 10px; overflow: hidden; }
.boot-bar span { display: block; height: 100%; width: 40%; background: var(--accent); border-radius: 4px; animation: slide 1.2s ease-in-out infinite; }
@keyframes slide { 0% { transform: translateX(-100%); } 100% { transform: translateX(350%); } }
.boot-sub { font-size: 12.5px; color: var(--text-mute); }

/* ─────────── 상단바 ─────────── */
.topbar {
  height: var(--topbar-h);
  flex: 0 0 auto;
  display: flex; align-items: center; gap: 16px;
  padding: 0 16px;
  background: var(--bg-elev);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  z-index: 800;
}
.brand { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }
.brand-mark { font-size: 24px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-size: 16px; font-weight: 900; letter-spacing: -.03em; }
.brand-text em { font-style: normal; font-size: 11px; color: var(--text-mute); font-weight: 500; }

.topnav { display: flex; gap: 4px; margin-left: auto; }
.nav-btn {
  display: flex; align-items: center; gap: 7px;
  padding: 8px 14px;
  background: transparent; border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--text-dim); font-size: 13.5px; font-weight: 700;
  transition: all .16s;
}
.nav-btn:hover { background: var(--bg-sunk); color: var(--text); }
.nav-btn.active { background: var(--accent-soft); color: var(--accent-text); border-color: color-mix(in srgb, var(--accent) 30%, transparent); }
.nav-btn i { font-size: 13px; }

.topbar-actions { display: flex; gap: 4px; }
.icon-btn {
  width: 36px; height: 36px;
  display: grid; place-items: center;
  background: transparent; border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-dim); font-size: 14px;
  transition: all .16s;
}
.icon-btn:hover { background: var(--bg-sunk); color: var(--text); border-color: var(--border-strong); }

/* ─────────── 메인 레이아웃 ─────────── */
#main { flex: 1 1 auto; min-height: 0; position: relative; overflow: hidden; }

.view { position: absolute; inset: 0; display: none; }
.view.active { display: block; }

/* ═══════ 지도 뷰 ═══════ */
.map-layout { display: grid; grid-template-columns: 340px 1fr; height: 100%; }
#map { height: 100%; width: 100%; background: var(--bg-sunk); z-index: 1; }

.side {
  border-right: 1px solid var(--border);
  background: var(--bg-elev);
  overflow-y: auto; overflow-x: hidden;
  display: flex; flex-direction: column;
}
.side-sec { padding: 14px 16px; border-bottom: 1px solid var(--border); }
.side-sec:last-child { border-bottom: none; }
.side-h {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 12px; font-weight: 800; letter-spacing: .04em;
  color: var(--text-dim);
  margin-bottom: 11px;
}
.side-h .cnt {
  font-size: 11.5px; font-weight: 800;
  background: var(--bg-sunk); color: var(--text-dim);
  padding: 2px 8px; border-radius: 20px; letter-spacing: 0;
  border: 1px solid var(--border);
}
.side-hint {
  margin: 10px 0 0; font-size: 12.5px; line-height: 1.62;
  color: var(--text-dim);
}
.side-hint b { color: var(--text); font-weight: 700; }

/* 종주 루트 카드 */
.route-list { display: flex; flex-direction: column; gap: 7px; }
.route-card {
  position: relative;
  display: flex; align-items: center; gap: 11px;
  padding: 11px 12px;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-left: 4px solid var(--rc, var(--accent));
  border-radius: var(--radius-sm);
  transition: all .15s;
  text-align: left; width: 100%;
  color: var(--text);
}
.route-card:hover { border-color: var(--border-strong); transform: translateX(2px); box-shadow: var(--shadow-sm); }
.route-card.on {
  background: var(--accent-soft);
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent) inset;
}
.route-card .rc-badge { font-size: 21px; flex: 0 0 auto; line-height: 1; }
.route-card .rc-body { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.route-card .rc-name { font-size: 14.5px; font-weight: 800; color: var(--text); }
.route-card .rc-meta {
  font-size: 12px; font-weight: 600; color: var(--text-dim); margin-top: 2px;
  font-variant-numeric: tabular-nums;
}
.route-card .rc-check {
  flex: 0 0 auto; font-size: 12px; color: var(--accent);
  opacity: 0; transform: scale(.6); transition: all .16s;
}
.route-card.on .rc-check { opacity: 1; transform: scale(1); }

/* 코스 필터 리스트 */
.course-list { display: flex; flex-direction: column; gap: 3px; }
.course-row {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  border: 1.5px solid transparent;
  transition: all .14s; width: 100%; text-align: left;
  background: transparent;
  color: var(--text);
}
.course-row:hover { background: var(--bg-sunk); }
.course-row.on {
  background: var(--accent-soft);
  border-color: var(--accent);
}
/* 체크 표시로 선택 상태를 명시 */
.course-row .cr-check {
  flex: 0 0 auto;
  width: 18px; height: 18px; border-radius: 5px;
  border: 1.5px solid var(--border-strong);
  display: grid; place-items: center;
  background: var(--bg-elev);
  transition: all .14s;
}
.course-row .cr-check i { font-size: 9.5px; color: #fff; opacity: 0; transform: scale(.5); transition: all .14s; }
.course-row.on .cr-check { background: var(--accent); border-color: var(--accent); }
.course-row.on .cr-check i { opacity: 1; transform: scale(1); }

.course-row .dot { width: 4px; height: 22px; border-radius: 3px; flex: 0 0 auto; }
.course-row .cr-text { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.course-row .cr-name { font-size: 13.5px; font-weight: 700; color: var(--text); }
.course-row .cr-region {
  font-size: 11.5px; font-weight: 500; color: var(--text-mute);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.course-row .cr-right { flex: 0 0 auto; display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }
.course-row .cr-km { font-size: 12.5px; font-weight: 800; color: var(--text-dim); }
.course-row.on .cr-km { color: var(--accent-text); }
.course-row .diff { display: flex; gap: 2px; }
.course-row .diff i { width: 3.5px; height: 9px; border-radius: 1px; background: var(--border-strong); }
.course-row .diff i.f { background: var(--warn); }

/* POI 필터 칩 */
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 11px;
  background: var(--bg); border: 1.5px solid var(--border);
  border-radius: 20px;
  font-size: 12.5px; font-weight: 700; color: var(--text-dim);
  transition: all .14s;
}
.chip:hover { border-color: var(--border-strong); color: var(--text); }
.chip.on {
  background: var(--accent-soft);
  border-color: var(--ck, var(--accent));
  color: var(--text);
}
.chip i { font-size: 11.5px; color: var(--ck, currentColor); }

.chip .chip-n {
  min-width: 17px; padding: 0 4px;
  font-size: 10.5px; font-weight: 800; line-height: 16px; text-align: center;
  background: var(--bg-sunk); border-radius: 20px; color: var(--text-mute);
  font-family: var(--font-num); font-variant-numeric: tabular-nums;
}
.chip.on .chip-n { background: var(--bg-elev); color: var(--accent-text); }

/* 시설 레이어 프리셋 버튼 줄 */
.poi-preset { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 11px; }
.poi-preset .pf-mini { padding: 5px 9px; font-size: 11.5px; }

/* 카테고리 그룹 */
.poi-grp { margin-bottom: 12px; }
.poi-grp:last-of-type { margin-bottom: 4px; }
.poi-grp-h {
  display: flex; align-items: center; gap: 6px; margin-bottom: 7px;
  font-size: 11.5px; font-weight: 900; color: var(--text-dim);
  letter-spacing: .03em;
}
.poi-grp-h i { font-size: 10.5px; color: var(--accent); }
.poi-grp-tog {
  margin-left: auto; padding: 3px 9px;
  font-size: 10.5px; font-weight: 800; color: var(--text-mute);
  background: var(--bg-sunk); border: 1px solid var(--border); border-radius: 20px;
  transition: all .14s;
}
.poi-grp-tog:hover { color: var(--accent-text); border-color: var(--accent); background: var(--accent-soft); }
#poi-zoom-hint { margin-top: 4px; }


/* 통계 그리드 */
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.stat {
  padding: 10px 11px;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.stat .sv { font-size: 18px; font-weight: 900; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.stat .sl { font-size: 10.5px; color: var(--text-mute); font-weight: 600; margin-top: 1px; }

/* 지도 오버레이 컨트롤 */
.map-wrap { position: relative; height: 100%; }
.map-ctrl {
  position: absolute; z-index: 500;
  background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: var(--radius-sm); box-shadow: var(--shadow-md);
}
.map-ctrl-tr { top: 12px; right: 12px; display: flex; flex-direction: column; overflow: hidden; }
.map-ctrl-tr button {
  min-width: 104px; height: 38px;
  display: flex; align-items: center; gap: 8px;
  padding: 0 12px;
  background: transparent; border: none; border-bottom: 1px solid var(--border);
  color: var(--text-dim); font-size: 12.5px; font-weight: 700;
  transition: all .14s; text-align: left;
}
.map-ctrl-tr button i { width: 14px; text-align: center; font-size: 13px; flex: 0 0 auto; }
.map-ctrl-tr button:last-child { border-bottom: none; }
.map-ctrl-tr button:hover { background: var(--bg-sunk); color: var(--text); }
.map-ctrl-tr button.on { background: var(--accent-soft); color: var(--accent-text); }
.map-ctrl-tr button:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

@media (max-width: 900px) {
  /* 모바일에서는 아이콘만 */
  .map-ctrl-tr button { min-width: 40px; justify-content: center; padding: 0; }
  .map-ctrl-tr button span { display: none; }
}

.map-legend {
  position: absolute; bottom: 12px; left: 12px; z-index: 500;
  background: color-mix(in srgb, var(--bg-elev) 94%, transparent);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 11px 13px; box-shadow: var(--shadow-md);
  font-size: 12.5px; font-weight: 600; color: var(--text-dim);
  max-width: 275px;
}
.map-legend .lg-row {
  display: flex; align-items: center; gap: 7px; margin-top: 5px;
  font-variant-numeric: tabular-nums;
}
.map-legend .lg-row:first-of-type { margin-top: 7px; }
.map-legend b {
  color: var(--text); font-size: 13.5px; font-weight: 800;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.map-legend .lg-tot {
  font-size: 12px; font-weight: 800; color: var(--accent-text);
  background: var(--accent-soft); border-radius: 20px; padding: 1px 8px;
}
.map-legend .lg-line { width: 16px; height: 4px; border-radius: 2px; flex: 0 0 auto; }
.map-legend .lg-dot { width: 10px; height: 10px; border-radius: 50%; flex: 0 0 auto; }
.map-legend .lg-part {
  font-size: 10.5px; font-weight: 700; color: var(--warn);
  border: 1px solid var(--warn); border-radius: 4px;
  padding: 0 4px; margin-left: 3px;
}
.map-legend .lg-foot {
  margin-top: 8px; padding-top: 7px;
  border-top: 1px dashed var(--border);
}

/* Leaflet 커스텀 */
.leaflet-container { font-family: var(--font); background: var(--bg-sunk); }
html.dark .leaflet-tile { filter: invert(1) hue-rotate(180deg) brightness(.92) contrast(.9) saturate(.7); }
html.dark .leaflet-control-attribution { background: rgba(20,28,46,.85) !important; color: var(--text-mute) !important; }
html.dark .leaflet-control-attribution a { color: var(--text-dim) !important; }
.leaflet-popup-content-wrapper {
  background: var(--bg-elev); color: var(--text);
  border-radius: var(--radius); box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
}
.leaflet-popup-tip { background: var(--bg-elev); border: 1px solid var(--border); }
.leaflet-popup-content { margin: 0; font-size: 13px; line-height: 1.55; }
.leaflet-popup-content-wrapper { overflow: hidden; padding: 0; }
.leaflet-popup-close-button {
  color: #fff !important; text-shadow: 0 1px 3px rgba(0,0,0,.55);
  width: 26px !important; height: 26px !important;
  font-size: 20px !important; padding: 2px 0 0 0 !important;
}
.leaflet-popup-content > *:not(.pop-art) { margin-left: 14px; margin-right: 14px; }

/* ─── 팝업 대표 이미지 (인라인 SVG 일러스트 / 이용자 사진) ─── */
.pop-art {
  position: relative; margin: 0 0 10px; line-height: 0;
  background: var(--bg-sunk); border-bottom: 1px solid var(--border);
}
.pop-art svg, .pop-art img { display: block; width: 100%; height: 108px; object-fit: cover; }
.pop-art figcaption {
  position: absolute; left: 0; right: 0; bottom: 0;
  font-size: 9.5px; letter-spacing: .01em; line-height: 1.4;
  padding: 8px 10px 4px; color: #fff; font-weight: 600;
  background: linear-gradient(to top, rgba(8,14,24,.72), rgba(8,14,24,0));
}
.pop-art.has-photo figcaption { font-weight: 700; }
html.dark .pop-art svg { filter: brightness(.86) saturate(.92); }

/* ─── 팝업 헤더 / 상세 행 ─── */
.pop-head { display: flex; align-items: center; gap: 6px; margin-bottom: 5px; flex-wrap: wrap; }
.pop-cat {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 10px; font-weight: 800; color: #fff;
  padding: 3px 8px; border-radius: 20px; letter-spacing: .01em;
}
.pop-cat i { font-size: 9px; }
.pop-star { font-size: 11px; color: var(--amber, #f59e0b); letter-spacing: .5px; }
.pop-star .off { color: var(--border); }
.pop-desc { font-size: 12.5px; line-height: 1.6; color: var(--text-dim); margin-bottom: 2px; }
.pop-rows {
  margin: 8px 0 0; padding: 8px 0 0; border-top: 1px dashed var(--border);
  display: grid; gap: 5px;
}
.pop-rows .pr { display: grid; grid-template-columns: 92px 1fr; gap: 8px; align-items: start; }
.pop-rows dt {
  font-size: 10.5px; font-weight: 800; color: var(--text-mute);
  display: flex; align-items: center; gap: 5px; padding-top: 1px;
}
.pop-rows dt i { font-size: 9.5px; width: 11px; text-align: center; opacity: .85; }
.pop-rows dd { margin: 0; font-size: 11.5px; font-weight: 600; color: var(--text); line-height: 1.5; }
.pop-tip {
  display: flex; gap: 7px; align-items: flex-start;
  margin-top: 9px; padding: 8px 9px; border-radius: 7px;
  background: var(--accent-soft); font-size: 11.5px; line-height: 1.55;
  color: var(--accent-text); font-weight: 600;
}
.pop-tip i { font-size: 11px; padding-top: 2px; flex-shrink: 0; }
.pop-actions button i { font-size: 10px; margin-right: 2px; }
.pop-foot {
  margin-top: 8px; margin-bottom: 12px; font-size: 9.5px;
  color: var(--text-mute); text-align: center; line-height: 1.4;
}
.pop-near { margin-top: 9px; padding-top: 8px; border-top: 1px dashed var(--border); }
.pop-near .pn-h {
  font-size: 10.5px; font-weight: 800; color: var(--text-mute);
  display: flex; align-items: center; gap: 5px; margin-bottom: 2px;
}
.pop-near .pn-h i { font-size: 9.5px; }
.pop-near .pop-meta { margin: 4px 0 0; }
.pop-near .pop-tag i { font-size: 9px; margin-right: 2px; }

.pop-title { font-size: 14.5px; font-weight: 900; margin-bottom: 2px; letter-spacing: -.02em; }
.pop-sub { font-size: 11.5px; color: var(--text-mute); margin-bottom: 8px; }
.pop-meta { display: flex; flex-wrap: wrap; gap: 4px; margin: 7px 0; }
.pop-tag {
  font-size: 10.5px; padding: 2px 7px; border-radius: 20px;
  background: var(--bg-sunk); color: var(--text-dim); font-weight: 700;
}
.pop-tag.hl { background: var(--accent-soft); color: var(--accent-text); }
.pop-tag.wn { background: var(--warn-soft); color: var(--warn); }
.pop-note { font-size: 11.5px; color: var(--text-dim); line-height: 1.5; margin-top: 6px; padding-top: 6px; border-top: 1px dashed var(--border); }
.pop-actions { display: flex; gap: 5px; margin-top: 9px; }
.pop-actions button {
  flex: 1; padding: 6px 8px; font-size: 11.5px; font-weight: 700;
  background: var(--bg-sunk); border: 1px solid var(--border);
  border-radius: 6px; color: var(--text-dim); transition: all .14s;
}
.pop-actions button:hover { background: var(--accent-soft); color: var(--accent-text); border-color: var(--accent); }
.pop-actions button.hl { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 800; }
html.dark .pop-actions button.hl { color: #05201c; }
.pop-actions button.off { background: var(--warn-soft); border-color: var(--warn); color: var(--warn); font-weight: 800; }


/* 인증센터 마커 */
.cm-icon {
  display: grid; place-items: center;
  border-radius: 50%;
  border: 2.5px solid var(--bg-elev);
  box-shadow: 0 2px 6px rgba(0,0,0,.35);
  font-size: 9px; font-weight: 900; color: #fff;
  transition: transform .12s;
}
.cm-icon:hover { transform: scale(1.25); z-index: 999 !important; }
.cm-icon.manned { border-color: #fbbf24; border-width: 3px; }
.cm-icon.done { background: #16a34a !important; }
.poi-icon {
  display: grid; place-items: center;
  border-radius: 50% 50% 50% 2px;
  transform: rotate(45deg);
  border: 2px solid var(--bg-elev);
  box-shadow: 0 2px 5px rgba(0,0,0,.3);
}
.poi-icon i { transform: rotate(-45deg); font-size: 10px; color: #fff; }
.poi-icon { transition: transform .12s; }

/* ─── 클릭 판정 확대용 투명 히트 영역 ─── */
.poi-hit, .cm-hit {
  display: grid !important; place-items: center;
  background: transparent !important; border: 0 !important;
  cursor: pointer;
}
.poi-hit:hover { z-index: 900 !important; }
.cm-hit:hover { z-index: 950 !important; }
.poi-hit:hover .poi-icon { transform: rotate(45deg) scale(1.3); }
.leaflet-interactive { cursor: pointer; }
.path-hit-hover { cursor: pointer; }
.kr-mask { pointer-events: none; }
.leaflet-pane .kr-mask { transition: fill .25s; }

/* ═══════ 일정 플래너 뷰 ═══════ */
.planner-layout { display: grid; grid-template-columns: 380px 1fr; height: 100%; transition: grid-template-columns .22s ease; }
.planner-layout.with-map { grid-template-columns: 340px minmax(320px, 1fr) minmax(380px, 42%); }
.plan-form { padding: 16px; overflow-y: auto; border-right: 1px solid var(--border); background: var(--bg-elev); }
.plan-result { overflow-y: auto; padding: 20px 24px; background: var(--bg); }

/* ─── 일정 설계 옆 지도 패널 ─── */
.plan-map-pane {
  display: flex; flex-direction: column; min-width: 0; min-height: 0;
  border-left: 1px solid var(--border); background: var(--bg-elev);
}
.plan-map-pane[hidden] { display: none; }
.pmp-head {
  display: flex; align-items: center; gap: 8px;
  padding: 11px 13px; border-bottom: 1px solid var(--border);
}
.pmp-title { display: flex; align-items: baseline; gap: 7px; min-width: 0; flex-wrap: wrap; }
.pmp-title > i { color: var(--accent); font-size: 13px; }
.pmp-title b { font-size: 14px; font-weight: 900; letter-spacing: -.01em; }
.pmp-title span { font-size: 11.5px; color: var(--text-mute); font-weight: 600; font-family: var(--font-num); }
.pmp-x {
  margin-left: auto; flex: 0 0 auto;
  width: 28px; height: 28px; border-radius: 8px;
  background: var(--bg-sunk); border: 1px solid var(--border);
  color: var(--text-dim); font-size: 13px; transition: all .14s;
}
.pmp-x:hover { color: var(--warn); border-color: var(--warn); background: var(--warn-soft); }

.pmp-bar {
  display: flex; gap: 6px; align-items: center;
  padding: 9px 13px; border-bottom: 1px solid var(--border); background: var(--bg-sunk);
}
.pmp-bar select {
  flex: 1 1 0; min-width: 0; padding: 7px 9px;
  font-size: 12px; font-weight: 700;
  background: var(--bg); color: var(--text);
  border: 1.5px solid var(--border); border-radius: 8px;
}
.pmp-bar select:disabled { opacity: .55; }
.pmp-bar .pf-mini { flex: 0 0 auto; padding: 7px 10px; }

.pmp-map { flex: 1 1 auto; min-height: 220px; }
.pmp-map .leaflet-container { width: 100%; height: 100%; background: var(--bg-sunk); }

.pmp-foot {
  flex: 0 0 auto; max-height: 40%; overflow-y: auto;
  padding: 10px 13px 13px; border-top: 1px solid var(--border);
}
.pmp-hint { font-size: 11.5px; line-height: 1.6; color: var(--text-mute); margin-bottom: 9px; }
.pmp-hint b { color: var(--text-dim); font-weight: 800; }
.pmp-empty { font-size: 11.5px; color: var(--text-mute); font-weight: 600; }
.pmp-erow { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; margin-bottom: 7px; }
.pmp-eday {
  flex: 0 0 auto; padding: 3px 8px; border-radius: 20px;
  background: var(--warn-soft); color: var(--warn);
  font-size: 10.5px; font-weight: 900; font-family: var(--font-num);
}
.pmp-echip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 9px; background: var(--bg); border: 1px solid var(--border);
  border-radius: 20px; font-size: 11.5px; font-weight: 700; color: var(--text);
  transition: all .14s;
}
.pmp-echip:hover { border-color: var(--warn); background: var(--warn-soft); color: var(--warn); }
.pmp-echip i { font-size: 10px; }
.pmp-echip .x { color: var(--text-mute); font-size: 9.5px; }

/* 일정 패널 지도 마커 */
.pm-day {
  width: 26px; height: 26px; border-radius: 8px;
  background: #f59e0b; color: #3a2c0a;
  display: grid; place-items: center;
  font-weight: 900; font-size: 11px; border: 2.5px solid #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,.4);
  font-family: var(--font-num);
}
.poi-pick {
  position: relative;
  width: 30px; height: 30px; border-radius: 50% 50% 50% 3px;
  transform: rotate(45deg);
  background: var(--accent); border: 2.5px solid #fff;
  display: grid; place-items: center;
  box-shadow: 0 3px 9px rgba(0,0,0,.45);
}
.poi-pick i { transform: rotate(-45deg); font-size: 12px; color: #fff; }
.poi-pick b {
  position: absolute; top: -5px; right: -5px;
  transform: rotate(-45deg);
  min-width: 15px; height: 15px; padding: 0 3px;
  border-radius: 20px; background: #f59e0b; color: #3a2c0a;
  font-size: 9.5px; font-weight: 900; line-height: 15px; text-align: center;
  border: 1.5px solid #fff; font-family: var(--font-num);
}

/* 현재 선택 상황 배너 */
.pf-now {
  display: flex; align-items: center; gap: 11px;
  padding: 12px 13px; margin-bottom: 16px;
  background: var(--accent-soft);
  border: 1.5px solid var(--accent);
  border-radius: var(--radius-sm);
}
.pf-now > i { font-size: 16px; color: var(--accent); flex: 0 0 auto; }
.pf-now b { display: block; font-size: 14px; font-weight: 800; letter-spacing: -.02em; color: var(--text); }
.pf-now span { display: block; font-size: 12px; font-weight: 600; color: var(--text-dim); margin-top: 2px; }

/* 단계 번호 배지 */
.stepno {
  display: inline-grid; place-items: center;
  width: 19px; height: 19px; margin-right: 6px;
  border-radius: 50%; background: var(--accent); color: #fff;
  font-size: 11px; font-weight: 900; vertical-align: -3px;
  font-variant-numeric: tabular-nums;
}
html.dark .stepno { color: #05201c; }
.fld > label em { font-style: normal; font-weight: 600; color: var(--text-mute); font-size: 12px; }

/* 1단계 모드 전환 패널 (종주 루트 / 개별 코스) */
.pf-pane { margin-top: 10px; }
.pf-pane[hidden] { display: none; }
#pf-mode button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
#pf-mode button i { font-size: 11px; }

.pf-pick-bar { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.pf-mini {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 6px 10px; background: var(--bg-sunk);
  border: 1.5px solid var(--border-strong); border-radius: 20px;
  font-size: 12px; font-weight: 700; color: var(--text);
  transition: all .14s;
}
.pf-mini:hover { border-color: var(--accent); background: var(--accent-soft); }
.pf-mini i { font-size: 10px; }
.pf-pick-sum {
  margin-left: auto; font-size: 12px; font-weight: 800;
  color: var(--accent-text); font-family: var(--font-num);
  font-variant-numeric: tabular-nums;
}

.pf-pick {
  display: flex; flex-direction: column; gap: 5px;
  max-height: 296px; overflow-y: auto;
  padding: 7px; background: var(--bg-sunk);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
}
.pf-pick-row {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 10px; width: 100%; text-align: left;
  background: var(--bg-elev); border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); transition: all .14s;
}
.pf-pick-row:hover { border-color: var(--accent); }
.pf-pick-row.on { border-color: var(--accent); background: var(--accent-soft); }
.pf-chk {
  flex: 0 0 auto; width: 19px; height: 19px; border-radius: 5px;
  border: 2px solid var(--border-strong); display: grid; place-items: center;
  font-size: 9px; color: transparent; transition: all .14s;
}
.pf-pick-row.on .pf-chk { background: var(--accent); border-color: var(--accent); color: #fff; }
html.dark .pf-pick-row.on .pf-chk { color: #05201c; }
.pf-cdot { flex: 0 0 auto; width: 9px; height: 9px; border-radius: 3px; }
.pf-cname { flex: 1 1 auto; font-size: 13px; font-weight: 700; color: var(--text); letter-spacing: -.01em; }
.pf-pick-row.on .pf-cname { color: var(--accent-text); }
.pf-ckm {
  flex: 0 0 auto; font-size: 12.5px; font-weight: 800; color: var(--text-dim);
  font-family: var(--font-num); font-variant-numeric: tabular-nums;
}
.pf-pick-row.on .pf-ckm { color: var(--accent-text); }

.fld { margin-bottom: 16px; }
.fld > label { display: block; font-size: 13px; font-weight: 800; margin-bottom: 8px; color: var(--text); letter-spacing: -.01em; }
.fld .hint { font-size: 12px; color: var(--text-dim); margin-top: 6px; line-height: 1.55; word-break: keep-all; }

.seg { display: flex; gap: 0; background: var(--bg-sunk); border-radius: var(--radius-sm); padding: 3px; }
.seg button {
  flex: 1; padding: 9px 6px; border: none; background: transparent;
  border-radius: 6px; font-size: 13px; font-weight: 700; color: var(--text-dim);
  transition: all .15s;
}
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--accent); color: #fff; font-weight: 800; box-shadow: var(--shadow-sm); }
html.dark .seg button.on { color: #05201c; }

input[type=text], input[type=date], input[type=number], textarea, select {
  width: 100%; padding: 9px 11px;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text); font-size: 13.5px; font-weight: 600; font-family: inherit;
  transition: border-color .15s;
}
select { cursor: pointer; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent); }
textarea { resize: vertical; min-height: 64px; }

input[type=range] { width: 100%; accent-color: var(--accent); }
.range-val { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 4px; }
.range-val b { font-size: 19px; font-weight: 900; font-variant-numeric: tabular-nums; letter-spacing: -.03em; }
.range-val span { font-size: 12px; color: var(--text-dim); font-weight: 600; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 11px 16px; width: 100%;
  background: var(--accent); color: #fff; border: 1.5px solid var(--accent);
  border-radius: var(--radius-sm);
  font-size: 13.5px; font-weight: 800;
  letter-spacing: -0.01em;
  transition: all .16s; box-shadow: var(--shadow-sm);
}
.btn:hover { filter: brightness(1.08); box-shadow: var(--shadow-md); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* 보조 버튼: 사이드바 배경과 확실히 구분되도록 테두리·대비 강화 */
.btn.sec {
  background: var(--bg-sunk);
  color: var(--text);
  border: 1.5px solid var(--border-strong);
  box-shadow: none;
}
.btn.sec:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--text);
  filter: none;
}
html.dark .btn.sec { background: #1c2740; }
html.dark .btn.sec:hover { background: #24344f; }

.btn.sm { padding: 9px 12px; font-size: 12.5px; width: auto; }
.btn-row { display: flex; gap: 7px; }

/* 주 버튼만 어두운 글자(민트 배경 위) — 보조 버튼은 밝은 글자를 유지해야 합니다 */
html.dark .btn:not(.sec) { color: #05201c; }
html.dark .btn.sec { color: var(--text); }
html.dark .btn.sec:hover { color: #fff; }
.btn.sec i { opacity: .9; }

/* 일정 결과 */
.plan-head { margin-bottom: 18px; }
.plan-title { font-size: 24px; font-weight: 900; letter-spacing: -.04em; word-break: keep-all; }
.plan-sum { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 11px; }
.plan-sum .ps {
  padding: 8px 13px; background: var(--bg-elev);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
}
.plan-sum .ps b { font-size: 19px; font-weight: 900; font-family: var(--font-num); font-variant-numeric: tabular-nums; letter-spacing: -.03em; }
.plan-sum .ps span { font-size: 11.5px; color: var(--text-dim); display: block; font-weight: 700; margin-top: 1px; }

.day-card {
  background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: var(--radius); margin-bottom: 11px;
  overflow: hidden; box-shadow: var(--shadow-sm);
  transition: box-shadow .18s;
}
.day-card:hover { box-shadow: var(--shadow-md); }
.day-top {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 16px; background: var(--bg-sunk);
  border-bottom: 1px solid var(--border);
  cursor: pointer; user-select: none;
}
.day-no {
  flex: 0 0 auto; width: 34px; height: 34px;
  display: grid; place-items: center;
  background: var(--accent); color: #fff;
  border-radius: 9px; font-size: 13px; font-weight: 900;
}
html.dark .day-no { color: #05201c; }
.day-route { flex: 1 1 auto; min-width: 0; }
.day-route .dr-main { font-size: 15px; font-weight: 800; letter-spacing: -.02em; display: flex; align-items: center; gap: 7px; flex-wrap: wrap; color: var(--text); }
.day-route .dr-main i { font-size: 10px; color: var(--text-mute); }
.day-route .dr-sub { font-size: 12px; color: var(--text-dim); margin-top: 3px; font-weight: 600; }
.day-nums { display: flex; gap: 15px; flex: 0 0 auto; text-align: right; }
.day-nums div b { font-size: 16.5px; font-weight: 900; font-family: var(--font-num); font-variant-numeric: tabular-nums; display: block; letter-spacing: -.03em; }
.day-nums div span { font-size: 11px; color: var(--text-dim); font-weight: 700; }
.day-caret { color: var(--text-mute); font-size: 12px; transition: transform .2s; }
.day-card.open .day-caret { transform: rotate(180deg); }

.day-body { display: none; padding: 14px 16px; }
.day-card.open .day-body { display: block; }

.via-line { display: flex; flex-direction: column; gap: 0; }
.via-item { display: flex; align-items: flex-start; gap: 11px; padding: 6px 0; }
.via-dot {
  flex: 0 0 auto; width: 9px; height: 9px; border-radius: 50%;
  background: var(--border-strong); margin-top: 5px;
  position: relative;
}
.via-item:not(:last-child) .via-dot::after {
  content: ''; position: absolute; left: 50%; top: 100%;
  width: 1.5px; height: 22px; background: var(--border);
  transform: translateX(-50%);
}
.via-item.ep .via-dot { background: var(--accent); width: 11px; height: 11px; margin-top: 4px; }
.via-body { flex: 1 1 auto; min-width: 0; }
.via-name { font-size: 13.5px; font-weight: 700; color: var(--text); }
.via-meta { font-size: 11.5px; color: var(--text-dim); margin-top: 2px; }
.via-km { font-size: 12.5px; color: var(--text); font-family: var(--font-num); font-variant-numeric: tabular-nums; font-weight: 800; flex: 0 0 auto; }

.warn-box {
  display: flex; gap: 8px; align-items: flex-start;
  background: var(--warn-soft); border: 1px solid color-mix(in srgb, var(--warn) 30%, transparent);
  border-radius: var(--radius-sm); padding: 9px 11px; margin-top: 11px;
  font-size: 12.5px; font-weight: 600; color: var(--warn); line-height: 1.6; word-break: keep-all;
}
.warn-box i { margin-top: 2px; flex: 0 0 auto; }

.poi-sug { margin-top: 13px; padding-top: 12px; border-top: 1px dashed var(--border); }
.poi-sug-h { font-size: 12px; font-weight: 900; color: var(--text-dim); letter-spacing: .04em; margin-bottom: 9px; }
.poi-mini { display: flex; flex-wrap: wrap; gap: 6px; }
.poi-mini-item {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 10px; background: var(--bg); border: 1px solid var(--border);
  border-radius: 20px; font-size: 12.5px; font-weight: 600; color: var(--text); transition: all .14s;
}
.poi-mini-item:hover { border-color: var(--accent); background: var(--accent-soft); }
.poi-mini-item i { font-size: 10px; }
.poi-mini-item .pm-d { color: var(--text-dim); font-size: 11.5px; font-weight: 700; font-family: var(--font-num); }
.poi-mini-item.picked { border-color: var(--accent); background: var(--accent-soft); }
.poi-mini-item .pm-nm { cursor: pointer; }
.poi-mini-item .pm-add {
  display: grid; place-items: center;
  width: 18px; height: 18px; margin-left: 2px;
  border-radius: 50%; background: var(--bg-sunk);
  border: 1px solid var(--border); transition: all .14s;
}
.poi-mini-item .pm-add i { font-size: 9px; color: var(--text-dim); }
.poi-mini-item .pm-add:hover { background: var(--accent); border-color: var(--accent); }
.poi-mini-item .pm-add:hover i { color: #fff; }
.poi-mini-item.picked .pm-add { background: var(--accent); border-color: var(--accent); }
.poi-mini-item.picked .pm-add i { color: #fff; }
html.dark .poi-mini-item.picked .pm-add i { color: #05201c; }

/* 일자 카드: 내가 추가한 시설 */
.day-extras { margin-top: 13px; padding-top: 12px; border-top: 1px dashed var(--border); }
.dx-empty {
  display: flex; align-items: center; gap: 7px;
  font-size: 11.5px; color: var(--text-mute); font-weight: 600;
}
.dx-empty i { color: var(--accent); font-size: 11px; }
.dx-h {
  display: flex; align-items: center; gap: 7px; margin-bottom: 9px;
  font-size: 12px; font-weight: 900; color: var(--text-dim); letter-spacing: .03em;
}
.dx-h i { color: var(--accent); font-size: 11px; }
.dx-detour {
  margin-left: auto; padding: 2px 8px; border-radius: 20px;
  background: var(--warn-soft); color: var(--warn);
  font-size: 10.5px; font-weight: 800; font-family: var(--font-num);
}
.dx-list { display: flex; flex-direction: column; gap: 6px; }
.dx-item {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 10px; background: var(--bg-sunk);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
}
.dx-ic {
  flex: 0 0 auto; display: grid; place-items: center;
  width: 26px; height: 26px; border-radius: 8px; color: #fff; font-size: 11px;
}
.dx-body { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.dx-nm { font-size: 13px; font-weight: 800; color: var(--text); }
.dx-mt { font-size: 11.5px; color: var(--text-mute); font-weight: 600; }
.dx-act { flex: 0 0 auto; display: flex; gap: 4px; }
.dx-act button {
  width: 26px; height: 26px; border-radius: 7px;
  background: var(--bg); border: 1px solid var(--border);
  color: var(--text-dim); font-size: 11px; transition: all .14s;
}
.dx-act button:hover { border-color: var(--accent); color: var(--accent-text); background: var(--accent-soft); }
.dx-act button:last-child:hover { border-color: var(--warn); color: var(--warn); background: var(--warn-soft); }

.day-add-bar { margin-top: 11px; }
.day-add-bar .pf-mini { width: 100%; justify-content: center; }


/* 고도 프로필 */
.elev-wrap { background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 16px; }
.elev-wrap h4 { margin: 0 0 11px; font-size: 13.5px; font-weight: 900; color: var(--text); letter-spacing: -.01em; }
.elev-canvas-box { height: 150px; position: relative; }

/* ═══════ 코스 도감 뷰 ═══════ */
.courses-scroll { height: 100%; overflow-y: auto; padding: 22px 24px 40px; }
.cg-head { max-width: 1200px; margin: 0 auto 20px; }
.cg-head h2 { font-size: 26px; font-weight: 900; letter-spacing: -.04em; margin: 0 0 7px; }
.cg-head p { font-size: 14px; color: var(--text-dim); margin: 0; line-height: 1.65; word-break: keep-all; }
.course-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 14px; max-width: 1200px; margin: 0 auto; }
.cg-card {
  background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow-sm); transition: all .2s;
  display: flex; flex-direction: column;
}
.cg-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); border-color: var(--border-strong); }
.cg-bar { height: 5px; }
.cg-body { padding: 15px 17px 17px; flex: 1 1 auto; display: flex; flex-direction: column; }
.cg-name { font-size: 16.5px; font-weight: 900; letter-spacing: -.03em; }
.cg-tag { font-size: 13px; color: var(--accent-text); font-weight: 700; margin-top: 4px; word-break: keep-all; }
.cg-nums { display: flex; gap: 16px; margin: 12px 0; padding: 11px 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.cg-nums div b { display: block; font-size: 18px; font-weight: 900; font-family: var(--font-num); font-variant-numeric: tabular-nums; letter-spacing: -.03em; }
.cg-nums div span { font-size: 11.5px; color: var(--text-dim); font-weight: 700; }
.cg-desc { font-size: 13.5px; color: var(--text-dim); line-height: 1.75; flex: 1 1 auto; word-break: keep-all; }
.cg-hl { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 11px; }
.cg-foot { display: flex; gap: 6px; margin-top: 14px; }

.diff-bar { display: inline-flex; gap: 2px; align-items: center; }
.diff-bar i { width: 4px; height: 12px; border-radius: 1px; background: var(--border-strong); }
.diff-bar i.f { background: var(--warn); }
.diff-label { font-size: 12px; color: var(--text-dim); margin-left: 5px; font-weight: 800; }

/* ═══════ 인증수첩 뷰 ═══════ */
.stamps-scroll { height: 100%; overflow-y: auto; padding: 22px 24px 40px; }
.st-wrap { max-width: 1100px; margin: 0 auto; }
.st-progress { background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 18px; }
.st-progress h3 { margin: 0 0 4px; font-size: 18px; font-weight: 900; letter-spacing: -.03em; }
.st-progress p { margin: 0 0 14px; font-size: 13px; color: var(--text-dim); word-break: keep-all; }
.pbar { height: 10px; background: var(--bg-sunk); border-radius: 6px; overflow: hidden; }
.pbar span { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), #22c55e); border-radius: 6px; transition: width .5s cubic-bezier(.4,0,.2,1); }
.pbar-txt { display: flex; justify-content: space-between; margin-top: 8px; font-size: 12.5px; color: var(--text-dim); font-weight: 800; font-family: var(--font-num); font-variant-numeric: tabular-nums; }

.st-course { background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 11px; overflow: hidden; }
.st-course-h { display: flex; align-items: center; gap: 10px; padding: 12px 16px; background: var(--bg-sunk); border-bottom: 1px solid var(--border); }
.st-course-h .dot { width: 11px; height: 11px; border-radius: 3px; }
.st-course-h .nm { font-size: 15px; font-weight: 900; flex: 1; letter-spacing: -.02em; color: var(--text); }
.st-course-h .ct { font-size: 12.5px; color: var(--text-dim); font-weight: 800; font-family: var(--font-num); font-variant-numeric: tabular-nums; }
.st-cells { display: grid; grid-template-columns: repeat(auto-fill, minmax(158px, 1fr)); gap: 8px; padding: 13px 16px; }
.st-cell {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 11px; background: var(--bg);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  transition: all .15s; text-align: left; width: 100%;
}
.st-cell:hover { border-color: var(--border-strong); }
.st-cell.done { background: var(--accent-soft); border-color: var(--accent); }
.st-cell .chk {
  flex: 0 0 auto; width: 20px; height: 20px; border-radius: 50%;
  border: 2px solid var(--border-strong); display: grid; place-items: center;
  font-size: 9px; color: transparent; transition: all .15s;
}
.st-cell.done .chk { background: var(--accent); border-color: var(--accent); color: #fff; }
.st-cell .nm2 { font-size: 13px; font-weight: 700; color: var(--text); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.st-cell .km2 { font-size: 11.5px; font-weight: 700; color: var(--text-dim); font-family: var(--font-num); font-variant-numeric: tabular-nums; }
.st-cell.done .nm2 { color: var(--accent-text); }
.st-cell.done .km2 { color: var(--accent-text); opacity: .85; }
.st-cell:hover { border-color: var(--accent); background: var(--bg-sunk); }

/* ═══════ 모달 / 토스트 ═══════ */
.modal-bg {
  position: fixed; inset: 0; z-index: 5000;
  background: rgba(6, 10, 20, .68);
  backdrop-filter: blur(4px);
  display: grid; place-items: center; padding: 20px;
  animation: fadeIn .18s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: 16px; box-shadow: var(--shadow-lg);
  max-width: 560px; width: 100%; max-height: 86vh;
  display: flex; flex-direction: column;
  animation: popIn .22s cubic-bezier(.34,1.4,.64,1);
}
@keyframes popIn { from { opacity: 0; transform: scale(.94) translateY(10px); } to { opacity: 1; transform: none; } }
.modal-h { display: flex; align-items: center; gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-h h3 { margin: 0; font-size: 16.5px; font-weight: 900; flex: 1; letter-spacing: -.03em; }
.modal-b { padding: 18px 20px; overflow-y: auto; font-size: 13.5px; line-height: 1.7; color: var(--text-dim); }
.modal-b h4 { color: var(--text); font-size: 13.5px; margin: 16px 0 6px; font-weight: 800; }
.modal-b h4:first-child { margin-top: 0; }
.modal-b ul { margin: 6px 0; padding-left: 20px; }
.modal-b li { margin: 4px 0; }
.modal-b code { background: var(--bg-sunk); padding: 1px 6px; border-radius: 4px; font-size: 12px; }
.modal-f { padding: 13px 20px; border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-end; }

.toast-root { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 6000; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast {
  display: flex; align-items: center; gap: 9px;
  background: var(--text); color: var(--bg);
  padding: 11px 18px; border-radius: 30px;
  font-size: 13px; font-weight: 700;
  box-shadow: var(--shadow-lg);
  animation: toastIn .25s cubic-bezier(.34,1.4,.64,1);
}
@keyframes toastIn { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
.toast.out { animation: toastOut .25s ease forwards; }
@keyframes toastOut { to { opacity: 0; transform: translateY(-8px); } }

.empty { display: grid; place-items: center; height: 100%; text-align: center; padding: 40px; }
.empty-icon { font-size: 44px; opacity: .35; margin-bottom: 12px; }
.empty h3 { margin: 0 0 6px; font-size: 17px; font-weight: 900; letter-spacing: -.02em; }
.empty p { margin: 0; font-size: 13px; color: var(--text-mute); line-height: 1.65; max-width: 340px; }

/* ─────────── 모바일 ─────────── */
.mob-toggle { display: none; }

@media (max-width: 1240px) {
  /* 지도 패널을 펼치면 결과 열이 너무 좁아지므로 폭 비율을 재조정합니다. */
  .planner-layout.with-map { grid-template-columns: 300px minmax(260px, 1fr) minmax(320px, 46%); }
}

@media (max-width: 1040px) {
  /* 3열이 불가능한 폭에서는 지도 패널을 결과 위에 오버레이로 띄웁니다. */
  .planner-layout.with-map { grid-template-columns: 340px 1fr; }
  .plan-map-pane {
    position: absolute; top: 0; right: 0; bottom: 0;
    width: min(440px, 78vw); z-index: 720;
    box-shadow: var(--shadow-lg);
  }
}

@media (max-width: 900px) {
  :root { --topbar-h: 54px; }
  .brand-text em { display: none; }
  .nav-btn span { display: none; }
  .nav-btn { padding: 8px 11px; }

  .map-layout, .planner-layout { grid-template-columns: 1fr; }
  .side, .plan-form {
    position: absolute; inset: 0; z-index: 700;
    border-right: none;
    transform: translateX(-100%);
    transition: transform .28s cubic-bezier(.4,0,.2,1);
    box-shadow: var(--shadow-lg);
  }
  .side.open, .plan-form.open { transform: none; }
  .plan-result { padding: 16px; }
  .planner-layout.with-map { grid-template-columns: 1fr; }
  .plan-map-pane { width: 100%; border-left: none; }
  .pmp-foot { max-height: 34%; }

  .mob-toggle {
    display: grid; place-items: center;
    position: absolute; bottom: 18px; left: 14px; z-index: 750;
    width: 50px; height: 50px; border-radius: 50%;
    background: var(--accent); color: #fff; border: none;
    box-shadow: var(--shadow-lg); font-size: 17px;
  }
  html.dark .mob-toggle { color: #05201c; }

  .day-nums { display: none; }
  .plan-title { font-size: 19px; }
  .course-grid { grid-template-columns: 1fr; }
  .courses-scroll, .stamps-scroll { padding: 16px 14px 32px; }
  .st-cells { grid-template-columns: 1fr 1fr; }
  .map-legend { display: none; }
}

@media (max-width: 480px) {
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .st-cells { grid-template-columns: 1fr; }
  .plan-sum .ps { flex: 1 1 calc(50% - 4px); }
}

/* ─────────── 인쇄 ─────────── */
@media print {
  .topbar, .side, .plan-form, .mob-toggle, .map-ctrl, .toast-root, #modal-root, .boot { display: none !important; }
  .plan-map-pane, .day-add-bar { display: none !important; }
  .dx-item { break-inside: avoid; }
  #main { overflow: visible; position: static; }
  .view { position: static; display: block !important; }
  .planner-layout { display: block; }
  .plan-result { overflow: visible; padding: 0; }
  .day-card { break-inside: avoid; box-shadow: none; border-color: #999; }
  .day-body { display: block !important; }
  body { background: #fff; color: #000; }
  html { --bg: #fff; --bg-elev: #fff; --text: #000; --text-dim: #333; --border: #bbb; }
}
