:root {
  --bg: #0f1115;
  --panel: #171a21;
  --panel-2: #1f242e;
  --text: #e8eaed;
  --muted: #9aa3b2;
  --line: #2a2f3a;
  --accent: #E8413A;
  --float-bg: rgba(23, 26, 33, 0.92);
  --float-shadow: 0 8px 30px rgba(0, 0, 0, 0.45);
  --iw-bg: #1f242e;
  --iw-title: #ffffff;
  --iw-link: #6aa3ff;
  --toggle-off: #2a2f3a;
  --hover: rgba(255, 255, 255, 0.04);
}

:root[data-theme="light"] {
  --bg: #eef0f3;
  --panel: #ffffff;
  --panel-2: #f1f3f6;
  --text: #1b1e24;
  --muted: #6b7280;
  --line: #e2e5ea;
  --accent: #E8413A;
  --float-bg: rgba(255, 255, 255, 0.94);
  --float-shadow: 0 8px 30px rgba(60, 70, 90, 0.16);
  --iw-bg: #ffffff;
  --iw-title: #14161a;
  --iw-link: #2f6bff;
  --toggle-off: #cdd2da;
  --hover: rgba(0, 0, 0, 0.05);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: "NanumSquareNeo", -apple-system,
    "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
}

/* 나눔스퀘어Neo 굵기 매핑 (가변폰트 미지원 → weight별 패밀리) */
.brand__name { font-family: "NanumSquareNeoHeavy", "NanumSquareNeo", sans-serif; }
.sidebar__title,
.iw__title,
.course-item__name,
.course-item__dist {
  font-family: "NanumSquareNeoBold", "NanumSquareNeo", sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* 헤더·푸터 숨기고 지도를 화면 전체로 */
.hero, .footer { display: none; }

/* ── 히어로 ── */
.hero {
  background:
    radial-gradient(1200px 400px at 70% -10%, rgba(232, 65, 58, 0.25), transparent 60%),
    linear-gradient(180deg, #14171d, #0f1115);
  border-bottom: 1px solid var(--line);
}
.hero__inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 56px 24px 40px;
}
.hero__badge {
  display: inline-block;
  font-size: 13px;
  font-weight: 600;
  color: #ffd2cf;
  background: rgba(232, 65, 58, 0.15);
  border: 1px solid rgba(232, 65, 58, 0.4);
  padding: 6px 12px;
  border-radius: 999px;
}
.hero__title {
  margin: 18px 0 12px;
  font-size: clamp(28px, 5vw, 46px);
  line-height: 1.15;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.hero__sub {
  margin: 0;
  color: var(--muted);
  font-size: 16px;
}

/* ── 레이아웃: 화면 전체 ── */
.layout {
  position: fixed;
  inset: 0;
  margin: 0;
  padding: 0;
  display: block;
}

/* ── 상단 바: 로고와 검색을 세로로 나열 ── */
.topbar {
  position: absolute;
  z-index: 11;
  top: 16px;
  left: 16px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
}

/* 로고 + 테마 토글 한 줄 */
.topbar__top {
  display: flex;
  align-items: center;
  gap: 12px;
}
.topbar__right { margin-left: auto; display: flex; align-items: center; gap: 10px; }

/* ── 로그인(카카오·네이버) 위젯 — 우측 컨트롤 열 맨 위 ── */
.auth { position: absolute; z-index: 11; top: 16px; right: 16px; }
.auth__menu { right: 0; }
.auth__login {
  flex: none; width: 44px; height: 44px; padding: 0; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  background: var(--float-bg); border: 1px solid var(--line); color: var(--text); cursor: pointer;
  box-shadow: var(--float-shadow);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
.auth__login svg {
  width: 20px; height: 20px; fill: none; stroke: currentColor;
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
.auth__login:hover { border-color: var(--accent); color: var(--accent); }
.auth__login[hidden] { display: none; }
.auth__opt {
  display: block; padding: 13px 12px; border-radius: 10px; text-decoration: none;
  font-size: 15px; font-weight: 700; text-align: center; color: #191919;
}
.auth__opt--kakao { background: #fee500; }
.auth__opt--naver { background: #03c75a; color: #fff; }
.auth__opt:hover { filter: brightness(0.96); }
.auth__user { display: flex; align-items: center; gap: 8px; justify-content: flex-end; }
.auth__user[hidden] { display: none; }
.auth__avatar { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; border: 1px solid var(--line); }
.auth__avatar[hidden] { display: none; }
.auth__name {
  font-size: 14px; font-weight: 700; color: var(--text);
  max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.auth__logout {
  height: 32px; padding: 0 12px; border-radius: 999px;
  background: transparent; border: 1px solid var(--line); color: var(--muted);
  font: inherit; font-size: 12px; cursor: pointer;
}
.auth__logout:hover { border-color: var(--accent); color: var(--accent); }

/* 로그인 모달 (중앙 팝업) */
.login-modal { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; }
.login-modal[hidden] { display: none; }
.login-modal__backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.5); }
.login-modal__card {
  position: relative; width: 320px; max-width: calc(100vw - 32px);
  display: flex; flex-direction: column; gap: 10px; padding: 24px;
  background: var(--card, var(--float-bg)); border: 1px solid var(--line);
  border-radius: 16px; box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
}
.login-modal__x {
  position: absolute; top: 12px; right: 12px; width: 32px; height: 32px;
  border: 0; background: transparent; color: var(--muted); font-size: 22px; cursor: pointer; line-height: 1;
}
.login-modal__x:hover { color: var(--text); }
.login-modal__title { margin: 0; font-size: 20px; }
.login-modal__sub { margin: 0 0 6px; font-size: 13px; color: var(--muted); }

/* 테마 토글 — 우측 컨트롤 열 (로그인 아래) */
.theme-toggle {
  position: absolute;
  z-index: 11;
  top: 72px;
  right: 16px;
  flex: none;
  width: 44px;
  height: 44px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--float-bg);
  backdrop-filter: blur(8px);
  box-shadow: var(--float-shadow);
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.theme-toggle:hover { border-color: var(--accent); }
.theme-toggle svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
/* 색깔 아이콘: 해 = 앰버, 달 = 따뜻한 옐로 */
.theme-toggle .ic-sun { stroke: #fbbf24; }
.theme-toggle .ic-moon { stroke: #fcd34d; fill: #fcd34d; }

/* 지도 유형 — 우측 컨트롤 열, 로그인 아래. 라벨=빠른전환, '‹'=패널 펼침 */
.maptype { position: absolute; z-index: 11; top: 128px; right: 16px; }
.maptype-toggle {
  min-width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 11px;
  font-size: 13px;
  font-weight: 700;
  background: var(--float-bg);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--float-shadow);
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.maptype-toggle__arrow {
  font-size: 18px; color: var(--muted); line-height: 1;
  padding-right: 6px; border-right: 1px solid var(--line); cursor: pointer;
}
.maptype-toggle__arrow:hover { color: var(--accent); }
.maptype-toggle:hover { border-color: var(--accent); }
/* 펼침 패널: 토글 왼쪽으로 ('‹' 방향) */
.maptype-panel {
  position: absolute; top: 0; right: calc(100% + 8px); z-index: 12;
  display: flex; gap: 4px; padding: 6px; white-space: nowrap;
  background: var(--float-bg); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: var(--float-shadow); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
.maptype-panel[hidden] { display: none; }
.maptype-opt {
  height: 32px; padding: 0 10px; border-radius: 8px;
  background: transparent; border: 1px solid transparent; color: var(--muted);
  font: inherit; font-size: 13px; font-weight: 700; cursor: pointer;
}
.maptype-opt:hover { color: var(--text); border-color: var(--line); }
.maptype-opt.is-active { color: var(--text); background: var(--panel-2); }

/* 줌 컨트롤 (+/−) */
.zoom {
  position: absolute;
  z-index: 11;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  background: var(--float-bg);
  backdrop-filter: blur(8px);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--float-shadow);
  overflow: hidden;
}
.zoom__btn {
  width: 44px;
  height: 44px;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 20px;
  font-weight: 600;
  font-family: inherit;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s;
}
.zoom__btn:hover { background: var(--panel-2); }
.zoom__btn:first-child { border-bottom: 1px solid var(--line); }
/* 너무 축소했을 때(줌 6~7) 안내 */
.zoom-hint {
  position: absolute; z-index: 12; left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  background: var(--float-bg); color: var(--text);
  border: 1px solid var(--line); border-radius: 999px;
  padding: 12px 22px; font-size: 15px; font-weight: 700;
  box-shadow: var(--float-shadow); pointer-events: none; white-space: nowrap;
}
.zoom-hint[hidden] { display: none; }

/* 현재 줌 레벨 숫자 (+ / − 사이) */
.zoom__level {
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  padding: 4px 0;
  border-bottom: 1px solid var(--line);
  font-variant-numeric: tabular-nums;
  user-select: none;
}

/* 도구 (거리재기 / 거리뷰) */
.tools {
  position: absolute;
  z-index: 11;
  top: 184px;
  right: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.tool__btn {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  padding: 0;
  background: var(--float-bg);
  backdrop-filter: blur(8px);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--float-shadow);
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, opacity 0.15s;
}
.tool__btn svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
/* 글자형 도구 버튼(거리재기·거리뷰) — 현위치 아이콘과 같은 너비, 좁으면 두 줄(거리/재기) */
.tool__btn--text {
  width: 44px; height: auto; min-height: 44px;
  padding: 5px 3px; font-size: 13px; font-weight: 600; line-height: 1.2;
  white-space: normal; text-align: center; color: var(--text);
}
.tool__btn:hover { border-color: var(--accent); color: var(--accent); }
.tool__btn.is-active { border-color: var(--accent); color: var(--accent); background: var(--panel-2); }
.tool__btn.is-loading { opacity: 0.5; pointer-events: none; }

/* 내 현위치 마커 */
.me-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #2f6bff;
  border: 3px solid #fff;
  box-shadow: 0 0 0 5px rgba(47, 107, 255, 0.25), 0 1px 4px rgba(0, 0, 0, 0.4);
}

/* 거리 측정 표시 (상단 중앙) */
.dist-readout {
  position: absolute;
  z-index: 11;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 12px;
  height: 44px;
  padding: 0 8px 0 16px;
  background: var(--float-bg);
  backdrop-filter: blur(8px);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--float-shadow);
  font-size: 13px;
  color: var(--text);
}
.dist-readout[hidden] { display: none; }
.dist-readout__hint { color: var(--muted); }
.dist-readout__value { font-weight: 700; font-size: 14px; }
.dist-readout__clear {
  height: 30px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
  color: var(--text);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.dist-readout__clear:hover { border-color: var(--accent); }

/* 거리 측정 점 마커 */
.dist-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.3);
}

/* 파노라마(거리뷰) 바닥에 깔리는 코스 경로점 */
.pano-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35);
  opacity: 0.92;
}

/* 거리뷰 파노라마 패널 (우하단) */
.pano {
  position: absolute;
  z-index: 12;
  right: 16px;
  bottom: 16px;
  width: 440px;
  height: 290px;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--line);
  box-shadow: var(--float-shadow);
}
.pano__view { width: 100%; height: 100%; background: var(--panel-2); }
.pano__close {
  position: absolute;
  z-index: 2;
  top: 8px;
  right: 8px;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}
.pano__close:hover { background: rgba(0, 0, 0, 0.8); }

/* ── 사이드바: 상단 바 아래 떠 있는 패널 ── */
.sidebar {
  position: absolute;
  z-index: 10;
  top: 74px;
  left: 16px;
  width: 320px;
  max-height: calc(100vh - 90px);
  overflow-y: auto;
  background: var(--float-bg);
  backdrop-filter: blur(8px);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 20px;
  box-shadow: var(--float-shadow);
}
/* 브랜드 로고 (독립 박스) */
/* 검색창에 통합된 로고 마크 (m·t) */
.brand__mark {
  flex: none;
  font-family: "NanumSquareNeoHeavy", "NanumSquareNeo", sans-serif;
  font-size: 20px; font-weight: 800; font-style: italic; letter-spacing: -0.03em;
  line-height: 1; color: var(--text); user-select: none;
  padding-right: 10px; margin-right: 2px; border-right: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 52px;
  background: var(--float-bg);
  backdrop-filter: blur(8px);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0 16px;
  box-shadow: var(--float-shadow);
}
.brand__name {
  font-size: 24px;
  font-weight: 800;
  font-style: italic;
  letter-spacing: -0.03em;
}
.brand__accent { color: var(--accent); }

/* 검색창 (독립 박스) */
.search {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 320px;
  height: 52px;
  background: var(--float-bg);
  backdrop-filter: blur(8px);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0 14px;
  box-shadow: var(--float-shadow);
}
.search:focus-within { border-color: var(--accent); }
.search__icon {
  width: 17px;
  height: 17px;
  flex: none;
  color: var(--muted);
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}
.search:focus-within .search__icon { color: var(--accent); }
.search__input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: 0;
  outline: 0;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
}
.search__input::placeholder { color: var(--muted); }
.search__input::-webkit-search-cancel-button { filter: invert(0.6); }
.search__empty {
  margin: 12px 2px 0;
  color: var(--muted);
  font-size: 13px;
}

.sidebar__title { margin: 0; font-size: 18px; }
.sidebar__bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 0 0 12px; }
.toggle-all {
  flex: none; height: 30px; padding: 0 12px; border-radius: 999px;
  background: var(--float-bg); border: 1px solid var(--line); color: var(--text);
  font: inherit; font-size: 12px; font-weight: 700; cursor: pointer;
}
.toggle-all:hover { border-color: var(--accent); color: var(--accent); }
.sidebar__hint { margin: 0 0 16px; color: var(--muted); font-size: 13px; }
.sidebar__note {
  margin: 16px 0 0;
  padding-top: 14px;
  border-top: 1px dashed var(--line);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

/* 검색창 안 오른쪽 필터 아이콘 */
.search__filter {
  flex: none;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  margin-right: -4px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.12s, background 0.12s;
}
.search__filter:hover,
.search__filter.is-active { color: var(--accent); background: var(--panel-2); }
.search__filter svg { width: 18px; height: 18px; stroke: currentColor; stroke-width: 2; stroke-linecap: round; fill: none; }

/* 필터 팝업 (필터 아이콘으로 토글) */
.filter-panel {
  position: absolute;
  z-index: 30;
  top: 132px;
  left: 16px;
  width: 320px;
  max-width: calc(100vw - 32px);
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  background: var(--float-bg);
  backdrop-filter: blur(8px);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--float-shadow);
}
.filter-panel[hidden] { display: none; } /* [hidden] + display:flex 충돌 방지 */
.filter-panel__head { display: flex; align-items: center; justify-content: space-between; }
.filter-panel__title { font-size: 14px; font-weight: 700; color: var(--text); }
.filters__row { display: flex; flex-direction: column; gap: 6px; }
.filters__label { font-size: 12px; color: var(--muted); }
.filters__val { color: var(--text); font-weight: 600; }
.filters__none { font-size: 12px; color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg);
  color: var(--muted);
  font-family: inherit;
  font-size: 12px;
  cursor: pointer;
  transition: border-color 0.12s, color 0.12s, background 0.12s;
}
.chip:hover { color: var(--text); }
.chip.is-on { background: var(--accent); border-color: var(--accent); color: #fff; }
/* 단일 트랙 + 핸들 2개 듀얼 슬라이더 */
.range { position: relative; height: 24px; }
.range__track {
  position: absolute;
  top: 10px;
  left: 0;
  right: 0;
  height: 4px;
  border-radius: 2px;
  background: var(--line);
}
.range__fill {
  position: absolute;
  top: 10px;
  height: 4px;
  border-radius: 2px;
  background: var(--accent);
}
.range input[type="range"] {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 24px;
  margin: 0;
  background: transparent;
  pointer-events: none; /* 트랙은 클릭 안 됨, 핸들만 */
  -webkit-appearance: none;
  appearance: none;
}
.range input[type="range"]::-webkit-slider-runnable-track { background: transparent; height: 24px; }
.range input[type="range"]::-moz-range-track { background: transparent; }
.range input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  pointer-events: auto;
  width: 16px;
  height: 16px;
  margin-top: 4px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--accent);
  cursor: pointer;
}
.range input[type="range"]::-moz-range-thumb {
  pointer-events: auto;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--accent);
  cursor: pointer;
}
.filters__dates { display: flex; align-items: center; gap: 6px; }
.filters__tilde { color: var(--muted); }
.filters__date {
  flex: 1;
  min-width: 0;
  height: 32px;
  padding: 0 8px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  font-family: inherit;
  font-size: 12px;
}
.filters__reset {
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.filters__reset:hover { border-color: var(--accent); }

.course-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.course-item[hidden] { display: none; }

/* 대회 카드 */
.course-item {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  transition: border-color 0.15s;
}
.course-item:hover { border-color: #3a414f; }

/* 카드 헤드(대회명/장소/일정) */
.course-item__head { padding: 11px 14px 8px; }
.course-item__name { font-size: 14px; font-weight: 600; line-height: 1.3; }
.course-item__meta {
  margin-top: 5px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 3px 8px;
  font-size: 12px;
  color: var(--muted);
}

/* 거리별 코스 — 칩 가로 배치 (클릭 = 표시 on/off) */
.course-item__head { cursor: pointer; }
.variant-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 14px 12px;
  border-top: 1px solid var(--line);
}
.variant {
  --course-color: var(--accent);
  padding: 3px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.variant:hover { color: var(--text); border-color: var(--course-color); }
.variant.is-on {
  background: var(--course-color);
  border-color: var(--course-color);
  color: #fff;
}

/* 스크린리더 전용 (실제 체크박스) */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ── 지도 ── */
.map-wrap {
  position: absolute;
  inset: 0;
  overflow: hidden;
}
.map { width: 100%; height: 100%; }

/* 다크모드: 일반 지도 타일만 어둡게 (위성사진·마커·코스선·말풍선은 유지) */
html:not([data-theme="light"]) .map img[src*="/styles/basic/"] {
  filter: invert(1) hue-rotate(180deg) brightness(0.92) contrast(0.95);
}
.map-fallback[hidden] { display: none; }
.map-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 8px;
  padding: 24px;
  background: var(--panel);
  color: var(--muted);
}
.map-fallback h3 { color: var(--text); margin: 0; }
.map-fallback code {
  background: var(--panel-2);
  padding: 2px 6px;
  border-radius: 6px;
  color: #ffd2cf;
}

/* 인포윈도우 (지도 위, 둥근 말풍선) */
.iw {
  font-size: 13px;
  line-height: 1.5;
  color: var(--text);
  min-width: 210px;
  max-width: 260px;
  background: var(--iw-bg);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--float-shadow);
  overflow: hidden;
}
.iw__title {
  display: block;
  font-size: 14px;
  font-weight: 700;
  color: var(--iw-title);
  padding: 12px 14px 10px;
}
.iw__rows {
  padding: 0 14px 12px;
  display: grid;
  gap: 5px;
}
.iw__row { display: flex; gap: 10px; }
.iw__label {
  flex: none;
  width: 42px;
  color: var(--muted);
  font-size: 12px;
}
.iw__link {
  display: block;
  padding: 10px 14px;
  border-top: 1px solid var(--line);
  color: var(--iw-link);
  font-weight: 600;
  text-decoration: none;
}
.iw__link:hover { background: var(--hover); }

/* ── 푸터 ── */
.footer {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

/* ── 반응형: 좁은 화면에선 사이드바 폭만 줄임 ── */
/* ── 반응형 ── */
@media (max-width: 860px) {
  .sidebar { width: calc(100vw - 32px); max-width: 360px; }
  .filter-panel { width: calc(100vw - 32px); max-width: 320px; }
  .pano { width: calc(100vw - 32px); max-width: 440px; }
}

@media (max-width: 640px) {
  /* 검색: 폭 축소(우상단 컨트롤과 안 겹치게) */
  .topbar { top: 12px; left: 12px; gap: 10px; }
  .search { width: min(320px, calc(100vw - 92px)); height: 48px; border: 1px solid var(--line); border-radius: 14px; }
  /* 우측 컨트롤 열을 화면 안쪽으로 (검색창과 안 겹치게) */
  .auth { top: 12px; right: 12px; }
  .theme-toggle { top: 64px; right: 12px; width: 44px; height: 44px; }
  .maptype { top: 116px; right: 12px; }

  /* 줌 버튼 숨김 (손가락 핀치 줌으로 대체) */
  .zoom { display: none; }
  /* 도구(거리재기·거리뷰·현위치)를 하단 시트 위로 */
  .tools { top: auto; bottom: calc(46vh + 12px); right: 12px; }
  .tool__btn { width: 44px; height: 44px; }
  .tool__btn--text { width: 44px; height: auto; min-height: 44px; padding: 4px 2px; font-size: 12px; }

  /* 코스목록: 하단 시트 (제목 탭으로 접기) */
  .sidebar {
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    width: auto;
    max-width: none;
    max-height: 46vh;
    border-radius: 16px 16px 0 0;
    border-bottom: 0;
  }
  .sidebar.is-collapsed { max-height: 56px; overflow: hidden; }
  .sidebar__title { cursor: pointer; }
  .sidebar__title::after { content: "▾"; float: right; color: var(--muted); }
  .sidebar.is-collapsed .sidebar__title::after { content: "▸"; }

  /* 필터: 하단 시트 */
  .filter-panel {
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    width: auto;
    max-width: none;
    max-height: 85vh;
    overflow-y: auto;
    border-radius: 16px 16px 0 0;
    z-index: 40;
  }

  /* 거리뷰: 가로 꽉 */
  .pano { left: 12px; right: 12px; width: auto; max-width: none; height: 38vh; bottom: 12px; }

  /* 거리재기 안내: 검색 아래로 */
  .dist-readout { top: 118px; left: 12px; right: 12px; transform: none; width: auto; }

  /* 의견 버튼: 모바일에선 라벨 숨기고 아이콘만 */
  .fb-btn { right: 12px; bottom: 12px; padding: 0; width: 44px; height: 44px; justify-content: center; }
  .fb-btn__label { display: none; }
  .fb-modal__card { width: auto; left: 12px; right: 12px; max-width: none; }
}

/* ── 사용자 의견(기능 제안 / 문제 신고) ─────────────────────────── */
.fb-btn {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 40;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 16px;
  height: 44px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  background: var(--float-bg);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  box-shadow: var(--float-shadow);
  color: var(--text);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.fb-btn:hover { border-color: var(--accent); color: var(--accent); }
.fb-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.fb-btn__label { font-size: 14px; }

.fb-modal { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; }
.fb-modal[hidden] { display: none; }
.fb-modal__backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.5); }
.fb-modal__card {
  position: relative;
  width: 420px;
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 20px;
  border-radius: 16px;
  background: var(--panel);
  box-shadow: var(--float-shadow);
  color: var(--text);
}
.fb-modal__head { display: flex; align-items: center; justify-content: space-between; }
.fb-modal__title { margin: 0; font-size: 18px; font-family: "NanumSquareNeoBold", sans-serif; }
.fb-modal__x { border: 0; background: none; color: var(--muted); font-size: 26px; line-height: 1; cursor: pointer; padding: 0 4px; }
.fb-modal__x:hover { color: var(--text); }

.fb-seg { display: flex; gap: 6px; padding: 4px; background: var(--panel-2); border-radius: 10px; }
.fb-seg__btn { flex: 1; padding: 8px 0; border: 0; border-radius: 7px; background: none; color: var(--muted); font: inherit; font-weight: 700; cursor: pointer; }
.fb-seg__btn.is-on { background: var(--panel); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25); }

.fb-field { display: flex; flex-direction: column; gap: 6px; }
.fb-field__label { font-size: 13px; color: var(--muted); font-weight: 700; }
.fb-field__opt { font-weight: 400; opacity: 0.8; }
.fb-field__input {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 9px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
}
.fb-field__input:focus { outline: none; border-color: var(--accent); }
textarea.fb-field__input { resize: vertical; min-height: 92px; }

.fb-modal__actions { display: flex; justify-content: flex-end; }
.fb-submit {
  padding: 10px 22px;
  border: 0;
  border-radius: 9px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.fb-submit:hover { filter: brightness(1.08); }
.fb-submit:disabled { opacity: 0.6; cursor: default; }

.fb-msg { margin: 0; font-size: 13px; }
.fb-msg--ok { color: #34c759; }
.fb-msg--err { color: var(--accent); }

/* ── 정렬 셀렉트 (필터 패널 안) ─────────────────────────────────── */
.filters__sort {
  width: 100%;
  height: 34px;
  padding: 0 8px;
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}
.filters__sort:focus { outline: none; border-color: var(--accent); }

/* 코스 위 지점(출발/도착/반환점/급수대/km 등) 핀 — 점 중심이 좌표에 앵커됨 */
.wp-pin { position: relative; width: 12px; height: 12px; }
.wp-pin__dot {
  display: block; width: 12px; height: 12px; box-sizing: border-box;
  border-radius: 50%; background: var(--wp); border: 2px solid #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.45);
}
.wp-pin__label {
  position: absolute; left: 50%; bottom: 17px; transform: translateX(-50%);
  white-space: nowrap; font-family: "NanumSquareNeoBold", sans-serif;
  font-size: 11px; line-height: 1; color: #fff; background: var(--wp);
  padding: 3px 7px; border-radius: 999px; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}
.wp-pin__label::after {
  content: ""; position: absolute; left: 50%; top: 100%; transform: translateX(-50%);
  border: 4px solid transparent; border-top-color: var(--wp);
}

/* 출발 마커 — 마라톤 배번호판(bib). 점 중심이 출발 좌표에 앵커됨 */
.bib-pin { position: relative; width: 12px; height: 12px; }
.bib-pin__dot {
  display: block; width: 12px; height: 12px; box-sizing: border-box;
  border-radius: 50%; background: var(--bib); border: 2px solid #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}
.bib {
  position: absolute; left: 50%; bottom: 16px;
  transform: translateX(-50%) scale(var(--bib-scale, 1)); transform-origin: bottom center;
  background: #fff; border-radius: 8px; overflow: hidden; text-align: center;
  border: 1px solid rgba(0, 0, 0, 0.18); box-shadow: 0 3px 10px rgba(0, 0, 0, 0.35);
}
.bib__top {
  display: block; background: var(--bib); color: #fff;
  font-family: "NanumSquareNeoBold", sans-serif; font-size: 10px; line-height: 1.5;
  letter-spacing: 2px; padding: 1px 10px;
}
.bib__num {
  display: block; color: #1a1a1a; white-space: nowrap;
  font-family: "NanumSquareNeoHeavy", "NanumSquareNeoBold", sans-serif;
  font-size: 17px; line-height: 1.1; padding: 4px 12px 3px;
}
/* hover 툴팁: 클릭 말풍선과 같은 .iw 스타일 재사용 */

/* 줌별 LOD 집계 라벨(광역/시군) — 중심이 좌표에 오도록 translate */
.agg {
  transform: translate(-50%, -50%);
  display: flex; flex-direction: column; align-items: center; line-height: 1.2;
  background: rgba(18, 22, 28, 0.92); color: #fff; cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.22); border-radius: 12px;
  padding: 6px 13px; white-space: nowrap; box-shadow: 0 3px 14px rgba(0, 0, 0, 0.45);
}
.agg b { font-family: "NanumSquareNeoBold", sans-serif; font-size: 14px; }
.agg span { font-size: 11px; opacity: 0.82; margin-top: 1px; }
.agg--sido { padding: 8px 16px; border-color: var(--accent); }
.agg--sido b { font-family: "NanumSquareNeoHeavy", "NanumSquareNeoBold", sans-serif; font-size: 17px; }
.agg:hover { border-color: var(--accent); }

/* ── 첫 방문 튜토리얼 (스포트라이트) ── */
.tour { position: fixed; inset: 0; z-index: 200; }
.tour[hidden] { display: none; }
/* 강조 박스: 큰 box-shadow로 주변을 어둡게, 대상만 환하게 */
.tour__spot {
  position: absolute; border-radius: 12px; pointer-events: none;
  border: 2px solid var(--accent);
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.62);
  transition: all 0.25s ease; opacity: 0;
}
.tour__pop {
  position: absolute; width: 300px; max-width: calc(100vw - 24px);
  display: flex; flex-direction: column; gap: 14px; padding: 22px 20px 16px;
  background: var(--card, var(--float-bg)); border: 1px solid var(--line);
  border-radius: 16px; box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
  transition: top 0.25s ease, left 0.25s ease;
}
.tour__x {
  position: absolute; top: 12px; right: 12px; width: 32px; height: 32px;
  border: 0; background: transparent; color: var(--muted); font-size: 22px; line-height: 1; cursor: pointer;
}
.tour__x:hover { color: var(--text); }
.tour__step { min-height: 92px; }
.tour__count { font-size: 12px; font-weight: 700; color: var(--accent); }
.tour__body h2 { margin: 7px 0 8px; font-size: 18px; }
.tour__body p { margin: 0; color: var(--muted); font-size: 13.5px; line-height: 1.6; }
.tour__dots { display: flex; gap: 6px; justify-content: center; }
.tour__dot { width: 7px; height: 7px; border-radius: 50%; background: var(--line); }
.tour__dot.is-on { background: var(--accent); }
.tour__actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.tour__nav { display: flex; gap: 8px; }
.tour__skip {
  background: transparent; border: 0; color: var(--muted); font: inherit; font-size: 13px; cursor: pointer;
}
.tour__skip:hover { color: var(--text); }
.tour__btn {
  height: 38px; padding: 0 18px; border-radius: 999px; border: 1px solid var(--accent);
  background: var(--accent); color: #fff; font: inherit; font-size: 14px; font-weight: 700; cursor: pointer;
}
.tour__btn--ghost { background: transparent; color: var(--text); border-color: var(--line); }
.tour__btn--ghost:disabled { opacity: 0.4; cursor: default; }
.tour__dontshow { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); cursor: pointer; }
.tour__dontshow input { accent-color: var(--accent); }

/* ── 스크롤바: 테마 색에 맞춤 ── */
.sidebar,
.filter-panel,
.fb-modal__card,
.login-modal__card { scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
.sidebar::-webkit-scrollbar,
.filter-panel::-webkit-scrollbar,
.fb-modal__card::-webkit-scrollbar,
.login-modal__card::-webkit-scrollbar { width: 10px; height: 10px; }
.sidebar::-webkit-scrollbar-track,
.filter-panel::-webkit-scrollbar-track,
.fb-modal__card::-webkit-scrollbar-track,
.login-modal__card::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb,
.filter-panel::-webkit-scrollbar-thumb,
.fb-modal__card::-webkit-scrollbar-thumb,
.login-modal__card::-webkit-scrollbar-thumb {
  background: var(--line); border-radius: 999px;
  border: 2px solid transparent; background-clip: padding-box;
}
.sidebar::-webkit-scrollbar-thumb:hover,
.filter-panel::-webkit-scrollbar-thumb:hover,
.fb-modal__card::-webkit-scrollbar-thumb:hover,
.login-modal__card::-webkit-scrollbar-thumb:hover { background: var(--muted); background-clip: padding-box; }
