/* 레이아웃: 홈은 한 줄 카드 목록, 지도 화면은 전체 화면 지도 + 위·아래 안내판(HUD).
   색: 숲길 초록(pine) + 산길 리본 노랑(blaze)은 표지판, GPS 파랑(me)은 내 이동선. 햇빛 아래서도 읽히게 대비를 높게. */
:root {
  --paper: #f3efe6;
  --surface: #fffdf8;
  --surface-2: #f7f2e8;
  --ink: #1b2a22;
  --muted: #5f6a63;
  --line: #e3dccd;
  --pine: #1f4a3a;
  --pine-ink: #ffffff;
  --pine-soft: #e1ebe2;
  --blaze: #f2b705;
  --blaze-ink: #231a00;
  --me: #1a6fe0;
  --danger: #c8321f;
  --danger-soft: #fde7e3;
  --ok: #23845a;
  --shadow: 0 6px 24px rgba(19, 36, 29, 0.18);
  --lift: 0 1px 2px rgba(48, 38, 18, 0.06), 0 6px 18px rgba(48, 38, 18, 0.07);
  --font-display: 'Hahmlet', 'IBM Plex Sans KR', 'Apple SD Gothic Neo', serif;
  --font-body: 'IBM Plex Sans KR', 'Apple SD Gothic Neo', 'Malgun Gothic', system-ui, sans-serif;
  --font-data: 'IBM Plex Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;
  --r: 14px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --gutter-l: max(16px, env(safe-area-inset-left, 0px));
  --gutter-r: max(16px, env(safe-area-inset-right, 0px));
  /* 둘레길(바다 청록: 바다·강·마을)·오름길(숲 초록). 노랑은 표지판, 파랑은 내 위치 점이라 갈래 색으로 쓰지 않아요 */
  --dulle: #12808f; --dulle-soft: #dcf0f1; --dulle-ink: #0b4f58;
  --oreum: #3b6d11; --oreum-soft: #e5efdb; --oreum-ink: #27500a;
  /* 지도 바탕을 앱의 크림·숲 색에 맞춰 차분하게. 경로·표지판은 따로 그려서 그대로 또렷해요 */
  --map-tone: saturate(0.45) sepia(0.22) hue-rotate(-8deg) brightness(1.03) contrast(0.92);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0e1512;
    --surface: #16201b;
    --surface-2: #1c2822;
    --ink: #ece7db;
    --muted: #a39f92;
    --line: #2c3a32;
    --lift: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 22px rgba(0, 0, 0, 0.35);
    --pine: #3f9a74;
    --pine-ink: #04140d;
    --pine-soft: #1d3a2e;
    --blaze: #f5c536;
    --blaze-ink: #231a00;
    --me: #5d9dff;
    --danger: #ff6d58;
    --danger-soft: #3a1914;
    --ok: #4cc28c;
    --shadow: 0 6px 24px rgba(0, 0, 0, 0.5);
    --dulle: #5cc0cc; --dulle-soft: #0f3236; --dulle-ink: #bde8ec;
    --oreum: #8cc25a; --oreum-soft: #1d2f17; --oreum-ink: #cfe6b5;
  --map-tone: invert(0.9) hue-rotate(180deg) saturate(0.35) brightness(0.92) contrast(0.88);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #0e1512; --surface: #16201b; --surface-2: #1c2822; --ink: #ece7db; --muted: #a39f92;
  --line: #2c3a32; --lift: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 22px rgba(0, 0, 0, 0.35); --pine: #3f9a74; --pine-ink: #04140d; --pine-soft: #1d3a2e; --blaze: #f5c536;
  --blaze-ink: #231a00; --me: #5d9dff; --danger: #ff6d58; --danger-soft: #3a1914; --ok: #4cc28c;
  --shadow: 0 6px 24px rgba(0, 0, 0, 0.5); color-scheme: dark;
  --dulle: #5cc0cc; --dulle-soft: #0f3236; --dulle-ink: #bde8ec;
  --oreum: #8cc25a; --oreum-soft: #1d2f17; --oreum-ink: #cfe6b5;
  --map-tone: invert(0.9) hue-rotate(180deg) saturate(0.35) brightness(0.92) contrast(0.88);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 15px/1.55 var(--font-body);
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}
[hidden] { display: none !important; }
h1, h2, h3 { text-wrap: balance; margin: 0; }
button, input, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--me); outline-offset: 2px; }

/* ── 버튼 ── */
.btn {
  appearance: none;
  border: 1.5px solid transparent;
  border-radius: 12px;
  min-height: 46px;
  padding: 0 16px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  background: var(--surface-2);
  color: var(--ink);
  transition: transform 0.08s ease, background 0.15s;
  text-align: center;
  line-height: 1.2;
}
.btn:active { transform: scale(0.98); }
.btn.primary { background: var(--pine); color: var(--pine-ink); }
.btn.blaze { background: var(--blaze); color: var(--blaze-ink); }
.btn.ghost { background: var(--surface); border-color: var(--line); }
.btn.quiet { background: transparent; color: var(--muted); }
.btn.danger-quiet { background: transparent; color: var(--danger); }
.btn.danger-armed { background: var(--danger); color: #fff; }
.btn.small { position: relative; min-height: 36px; padding: 0 12px; font-size: 13px; }
/* 작은 버튼도 손가락으로 누르는 범위는 44px 높이 */
.btn.small::after { content: ''; position: absolute; inset: -4px 0; }
.btn.huge { min-height: 60px; font-size: 18px; width: 100%; border-radius: 16px; }
.btn.huge svg { width: 24px; height: 24px; fill: currentColor; }
.btn.wide { width: 100%; }
.btn[aria-pressed="true"] { background: var(--pine-soft); border-color: var(--pine); color: var(--ink); }
.row { display: flex; gap: 8px; flex-wrap: wrap; }
.row > .btn { flex: 1 1 0; min-width: 0; }
.stack { display: grid; gap: 8px; }

/* ── 홈 ── */
.masthead {
  position: relative;
  overflow: hidden;
  background: radial-gradient(120% 90% at 85% 0%, #2c6450 0%, var(--pine) 55%, #163729 100%);
  color: var(--pine-ink);
  padding-top: calc(var(--safe-t) + 16px);
  padding-bottom: 22px;
  padding-left: var(--gutter-l);
  padding-right: var(--gutter-r);
  border-radius: 0 0 28px 28px;
}
.topo { position: absolute; inset: 0; width: 100%; height: 100%; color: #ffffff; opacity: 0.09; pointer-events: none; }
.masthead-inner { position: relative; max-width: 640px; margin: 0 auto; display: grid; gap: 8px; }
.brand { display: flex; align-items: center; gap: 8px; }
.mark { width: 30px; height: 30px; flex: none; }
.mark-post { fill: currentColor; opacity: 0.55; }
.mark-plate { fill: var(--blaze); }
.mark-plate2 { fill: currentColor; opacity: 0.9; }
.brand-name { font-family: var(--font-display); font-weight: 700; font-size: 18px; letter-spacing: 0.02em; }
.brand-sub { font-size: 12.5px; opacity: 0.75; padding-left: 8px; border-left: 1px solid rgba(255, 255, 255, 0.3); }
.masthead h1 { font-family: var(--font-display); font-size: clamp(23px, 6.4vw, 32px); font-weight: 700; letter-spacing: -0.01em; line-height: 1.28; margin-top: 2px; }
.masthead .lede { margin: 0; opacity: 0.8; font-size: 13.5px; max-width: 30em; }
.hero-stats { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.hero-stats li {
  display: inline-flex; align-items: baseline; gap: 5px; padding: 5px 11px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.1); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14); font-size: 12.5px;
}
.hero-stats b { font-family: var(--font-data); font-size: 14px; color: var(--blaze); font-variant-numeric: tabular-nums; }
.hero-stats li { align-items: center; }
/* 산길의 노란 이정표 판처럼 화살표 모양 */
.hero-stats .hero-plate {
  background: var(--blaze); color: var(--blaze-ink); box-shadow: none; font-weight: 700; border-radius: 4px 0 0 4px; padding: 5px 20px 5px 11px;
  clip-path: polygon(0 0, calc(100% - 11px) 0, 100% 50%, calc(100% - 11px) 100%, 0 100%);
}
.hero-stats .hero-plate b { color: inherit; font-size: 15px; margin: 0 1px; }

.home-body {
  max-width: 640px;
  margin: 0 auto;
  padding-left: var(--gutter-l);
  padding-right: var(--gutter-r);
  padding-block: 20px calc(var(--safe-b) + 32px);
  display: grid;
  gap: 18px;
}
.draft {
  background: var(--blaze);
  color: var(--blaze-ink);
  border-radius: var(--r);
  padding: 14px;
  display: grid;
  gap: 10px;
}
.draft span { display: block; font-size: 13px; }
.draft .btn.quiet { color: var(--blaze-ink); }

.modes { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.mode-card {
  appearance: none;
  text-align: left;
  border: 1.5px solid var(--line);
  border-radius: var(--r);
  background: var(--surface);
  padding: 14px;
  display: grid;
  gap: 4px;
  align-content: start;
  cursor: pointer;
  min-width: 0;
}
.mode-card.rec { background: var(--pine); border-color: var(--pine); color: var(--pine-ink); }
.mode-kicker { font-size: 11px; letter-spacing: 0.08em; font-weight: 600; opacity: 0.75; }
.mode-title { font-size: 18px; font-weight: 700; }
.mode-desc { font-size: 13px; opacity: 0.85; line-height: 1.45; }
@media (max-width: 360px) { .modes { grid-template-columns: 1fr; } }

.section-label { font-size: 13px; letter-spacing: 0.06em; color: var(--muted); font-weight: 600; margin-top: 4px; }
.section-label .hint { font-weight: 400; letter-spacing: 0; }

.course-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.course {
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: var(--r);
  padding: 14px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 12px;
  align-items: center;
}
.course-name { font-weight: 700; font-size: 16px; min-width: 0; overflow-wrap: anywhere; }
.course-name .tag {
  font-size: 11px; font-weight: 600; background: var(--pine-soft); color: var(--ink);
  border-radius: 6px; padding: 1px 6px; margin-left: 6px; vertical-align: 2px; white-space: nowrap;
}
.course-meta { grid-column: 1; font-family: var(--font-data); font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.course-actions { grid-column: 2; grid-row: 1 / span 2; display: flex; gap: 6px; }
.course-actions .btn { min-height: 42px; }
.course-actions .more { width: 42px; padding: 0; font-size: 20px; letter-spacing: 1px; }
.empty { color: var(--muted); font-size: 14px; padding: 18px; border: 1.5px dashed var(--line); border-radius: var(--r); text-align: center; }

.settings { background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--r); padding: 14px; }
.switch { display: flex; gap: 12px; align-items: flex-start; cursor: pointer; }
.switch small { color: var(--muted); }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch-ui {
  flex: none; width: 44px; height: 26px; border-radius: 13px; background: var(--line);
  position: relative; transition: background 0.15s; margin-top: 2px;
}
.switch-ui::after {
  content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%;
  background: var(--surface); transition: transform 0.15s; box-shadow: 0 1px 3px rgba(0,0,0,.25);
}
.switch input:checked + .switch-ui { background: var(--pine); }
.switch input:checked + .switch-ui::after { transform: translateX(18px); }
.switch input:focus-visible + .switch-ui { outline: 3px solid var(--me); outline-offset: 2px; }
.foot { font-size: 12px; color: var(--muted); margin: 0; }

/* ── 지도 화면 ── */
.mapview { position: fixed; inset: 0; background: var(--paper); }
#map { position: absolute; inset: 0; background: var(--surface-2); }
#map .leaflet-tile-pane { filter: var(--map-tone); }
.leaflet-container { font-family: var(--font-body); }
.leaflet-control-attribution { font-size: 10px; }

.hud-top {
  position: absolute;
  top: calc(var(--safe-t) + 10px);
  left: var(--gutter-l);
  right: var(--gutter-r);
  z-index: 500;
  background: var(--surface);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  padding: 10px 12px;
  max-width: 560px;
  margin: 0 auto;
}
.hud-bottom {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 500;
  background: var(--surface);
  border-radius: 20px 20px 0 0;
  box-shadow: var(--shadow);
  padding-top: 14px;
  padding-bottom: calc(var(--safe-b) + 14px);
  padding-left: var(--gutter-l);
  padding-right: var(--gutter-r);
  display: grid;
  gap: 10px;
}
.hud-bottom > * { max-width: 560px; width: 100%; justify-self: center; }

.rec-hud { display: flex; align-items: center; gap: 12px; }
.pill { font-size: 12px; font-weight: 700; border-radius: 999px; padding: 4px 10px; white-space: nowrap; }
.pill.live { background: var(--danger); color: #fff; }
.pill.live::before { content: ''; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: currentColor; margin-right: 6px; vertical-align: 1px; animation: blink 1.2s infinite; }
.pill.paused { background: var(--line); color: var(--ink); }
.pill.paused::before { display: none; }
@keyframes blink { 50% { opacity: 0.2; } }
.stats { display: flex; flex: 1; justify-content: space-around; margin: 0; gap: 8px; }
.stats div { text-align: center; min-width: 0; }
.stats dt { font-size: 11px; color: var(--muted); }
.stats dd { margin: 0; font-family: var(--font-data); font-weight: 600; font-size: 18px; font-variant-numeric: tabular-nums; }

/* 길 안내 카드 */
.guide { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; transition: background 0.2s; }
.guide-arrow { position: relative; width: 72px; height: 72px; }
.guide-arrow svg { width: 100%; height: 100%; display: block; }
.arrow-ring { fill: var(--pine-soft); }
.arrow-shape { fill: var(--pine); }
#guide-arrow { transform-origin: 50px 50px; transition: transform 0.4s ease; }
.guide-dir {
  position: absolute; left: 50%; bottom: -6px; transform: translateX(-50%);
  font-size: 11px; font-weight: 700; background: var(--surface); border-radius: 6px; padding: 0 5px; white-space: nowrap;
}
.guide-text { min-width: 0; }
.guide-main { font-size: 20px; font-weight: 700; line-height: 1.25; font-variant-numeric: tabular-nums; }
.guide-main .num {
  display: inline-grid; place-items: center; min-width: 26px; height: 26px; padding: 0 5px; border-radius: 6px;
  background: var(--blaze); color: var(--blaze-ink); font-family: var(--font-data); font-size: 15px; margin-right: 4px; vertical-align: 2px;
}
.guide-main .num.junction { background: var(--surface); color: var(--ink); box-shadow: inset 0 0 0 2px var(--pine); }
.guide-main .num.caution { background: var(--danger); color: #fff; }
.guide-sub { font-size: 14px; color: var(--muted); margin-top: 2px; overflow-wrap: anywhere; }
.guide-photo { appearance: none; border: 0; padding: 0; width: 60px; height: 60px; border-radius: 10px; overflow: hidden; cursor: pointer; background: var(--line); }
.guide-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.guide.is-off { background: var(--danger-soft); }
.guide.is-off .arrow-shape { fill: var(--danger); }
.guide.is-done .arrow-shape { fill: var(--ok); }

.offroute {
  position: absolute;
  z-index: 499;
  left: var(--gutter-l);
  right: var(--gutter-r);
  top: calc(var(--safe-t) + 112px);
  max-width: 560px;
  margin: 0 auto;
  background: var(--danger);
  color: #fff;
  border-radius: 12px;
  padding: 8px 12px;
  display: grid;
  font-size: 13px;
  box-shadow: var(--shadow);
}
.offroute strong { font-size: 15px; }

.map-side {
  position: absolute;
  z-index: 498;
  right: var(--gutter-r);
  bottom: 230px;
  display: grid;
  gap: 8px;
  justify-items: end;
}
.gps-chip {
  font-size: 12px; font-weight: 600; background: var(--surface); border-radius: 999px; padding: 4px 10px;
  box-shadow: var(--shadow); font-family: var(--font-data); font-variant-numeric: tabular-nums;
}
.gps-chip.weak { background: var(--blaze); color: var(--blaze-ink); }
.gps-chip.sim { background: var(--pine); color: var(--pine-ink); }
.fab {
  width: 48px; height: 48px; border-radius: 50%; border: 0; background: var(--surface); box-shadow: var(--shadow);
  display: grid; place-items: center; cursor: pointer; color: var(--me);
}
.fab svg { width: 24px; height: 24px; fill: currentColor; stroke: currentColor; stroke-width: 2; }
.fab.off { color: var(--muted); }
.fab.sos { background: var(--danger); color: #fff; font: 800 13px/1 var(--font-body); letter-spacing: 0.04em; }

/* 긴급 화면 */
.sos-kpn { display: grid; gap: 2px; padding: 12px 14px; border-radius: 14px; background: var(--blaze); color: var(--blaze-ink); }
.sos-kpn small { font-size: 12px; font-weight: 600; }
.sos-kpn b { font: 700 26px/1.2 var(--font-data); letter-spacing: 0.02em; font-variant-numeric: tabular-nums; }
.sos-hint { margin: 0; font-size: 13px; color: var(--muted); }
.sos-facts { margin: 0; display: grid; gap: 6px; }
.sos-facts div { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; }
.sos-facts dt { color: var(--muted); }
.sos-facts dd { margin: 0; text-align: right; font-family: var(--font-data); font-variant-numeric: tabular-nums; }
.btn.sos-call { background: var(--danger); color: #fff; text-decoration: none; text-align: center; font-weight: 700; }
#fol-sun { margin: 0; padding: 6px 10px; font-size: 12.5px; }

.progress { position: relative; height: 10px; background: var(--line); border-radius: 5px; overflow: hidden; }
.progress-bar { position: absolute; inset: 0 auto 0 0; width: 0; background: var(--pine); transition: width 0.5s; }
.progress-ticks span { position: absolute; top: 1px; width: 8px; height: 8px; margin-left: -4px; border-radius: 2px; background: var(--blaze); box-shadow: 0 0 0 1px var(--surface); }
.progress-ticks span.done { background: var(--surface); }
.fol-stats { display: flex; justify-content: space-between; gap: 8px; font-family: var(--font-data); font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; flex-wrap: wrap; }
#fol-bottom .row .btn { padding: 0 8px; font-size: 14px; }

/* 지도 마커 */
.wp-icon { background: none; border: 0; }
.wp {
  width: 30px; height: 30px; display: grid; place-items: center; font-family: var(--font-data); font-weight: 600; font-size: 14px;
  border-radius: 7px; background: var(--blaze); color: var(--blaze-ink); box-shadow: 0 0 0 2px #fff, 0 2px 6px rgba(0,0,0,.35);
}
.wp.junction { background: #fff; color: #13241d; border-radius: 50%; box-shadow: 0 0 0 3px var(--pine), 0 2px 6px rgba(0,0,0,.35); }
.wp.caution { background: var(--danger); color: #fff; }
.wp.place { background: #fff; color: #13241d; border-radius: 50% 50% 50% 4px; box-shadow: 0 0 0 2.5px var(--blaze), 0 2px 6px rgba(0,0,0,.35); }
.guide-main .num.place { background: var(--surface); color: var(--ink); box-shadow: inset 0 0 0 2px var(--blaze); }
.tag.estimated { background: var(--blaze); color: var(--blaze-ink); }
.wp.reached { opacity: 0.45; }
.wp.next { transform: scale(1.25); box-shadow: 0 0 0 3px var(--me), 0 2px 8px rgba(0,0,0,.4); }
.me-icon { background: none; border: 0; }
.me-dot { width: 20px; height: 20px; border-radius: 50%; background: var(--me); box-shadow: 0 0 0 3px #fff, 0 0 0 9px rgba(26,111,224,.22); }
.start-flag { background: none; border: 0; }
.start-flag div { font-size: 11px; font-weight: 700; background: var(--pine); color: var(--pine-ink); padding: 2px 6px; border-radius: 6px; white-space: nowrap; box-shadow: 0 0 0 2px #fff; }

/* ── 시트 ── */
.backdrop { position: fixed; inset: 0; background: rgba(8, 16, 12, 0.45); z-index: 900; }
.sheet {
  position: fixed;
  z-index: 901;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: 88vh;
  overflow-y: auto;
  background: var(--surface);
  border-radius: 20px 20px 0 0;
  padding-top: 8px;
  padding-bottom: calc(var(--safe-b) + 18px);
  padding-left: var(--gutter-l);
  padding-right: var(--gutter-r);
  display: grid;
  gap: 14px;
  box-shadow: var(--shadow);
  animation: rise 0.2s ease-out;
}
/* 넓은 화면에서도 내용은 가운데 한 줄(최대 560px)로. 문단의 margin: 0 에 덮이지 않게 여백 대신 justify-self 로 맞춰요 */
.sheet > * { max-width: 560px; width: 100%; justify-self: center; }
.sheet.tall { height: 80vh; grid-template-rows: auto auto 1fr auto; }
@keyframes rise { from { transform: translateY(30px); opacity: 0; } }
.sheet-grip { width: 40px; height: 4px; border-radius: 2px; background: var(--line); }
.sheet h3 { font-size: 20px; }
.summary { margin: 0; color: var(--muted); font-size: 14px; overflow-wrap: anywhere; }
.summary b { color: var(--ink); font-family: var(--font-data); font-variant-numeric: tabular-nums; }

.chips { border: 0; padding: 0; display: flex; gap: 8px; flex-wrap: wrap; }
.chips input { position: absolute; opacity: 0; pointer-events: none; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 999px; border: 1.5px solid var(--line); font-weight: 600; cursor: pointer; }
.chip::before { content: ''; width: 12px; height: 12px; border-radius: 3px; background: var(--blaze); }
.chip.junction::before { border-radius: 50%; background: #fff; box-shadow: inset 0 0 0 2.5px var(--pine); }
.chip.caution::before { background: var(--danger); }
.chips input:checked + .chip { border-color: var(--pine); background: var(--pine-soft); }
.chips input:focus-visible + .chip { outline: 3px solid var(--me); outline-offset: 2px; }

.field { display: grid; gap: 6px; font-size: 13px; font-weight: 600; color: var(--muted); }
.field textarea, .field input {
  border: 1.5px solid var(--line); border-radius: 12px; padding: 10px 12px; background: var(--surface-2);
  font-size: 16px; font-weight: 400; color: var(--ink); resize: vertical; width: 100%;
}
.photo-field { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.photo-field img { width: 84px; height: 84px; object-fit: cover; border-radius: 10px; }
.pos-note { margin: 0; font-size: 13px; color: var(--muted); font-family: var(--font-data); }
.pos-note.weak { color: var(--danger); font-family: var(--font-body); }

.wp-list { list-style: none; margin: 0; padding: 0; overflow-y: auto; display: grid; gap: 8px; align-content: start; min-height: 0; }
.wp-item { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; padding: 8px; border-radius: 12px; background: var(--surface-2); }
.wp-item.reached { opacity: 0.55; }
.wp-item.next { box-shadow: inset 0 0 0 2px var(--me); }
.wp-item .wp { width: 28px; height: 28px; font-size: 13px; }
.wp-item-text { min-width: 0; font-size: 14px; }
.wp-item-text small { display: block; color: var(--muted); font-family: var(--font-data); font-size: 12px; }
.wp-item img { width: 48px; height: 48px; border-radius: 8px; object-fit: cover; }
.photo-full { width: 100%; max-height: 40vh; object-fit: contain; border-radius: 12px; background: var(--surface-2); }

.toast {
  position: fixed;
  z-index: 950;
  left: var(--gutter-l);
  right: var(--gutter-r);
  bottom: calc(var(--safe-b) + 200px);
  max-width: 480px;
  margin: 0 auto;
  background: var(--ink);
  color: var(--paper);
  padding: 12px 16px;
  border-radius: 12px;
  font-weight: 600;
  text-align: center;
  box-shadow: var(--shadow);
}
.home-visible .toast { bottom: calc(var(--safe-b) + 24px); }

/* ── 홈 탭 · 둘러보기 ── */
.tabs { display: grid; grid-template-columns: repeat(3, 1fr); background: var(--surface-2); border: 1.5px solid var(--line); border-radius: 14px; padding: 4px; gap: 4px; }
.tabs button {
  appearance: none; border: 0; background: transparent; border-radius: 10px; min-height: 42px; font-weight: 700; color: var(--muted); cursor: pointer;
}
.tabs button[aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 4px rgba(19, 36, 29, 0.14); }
.panel { display: grid; gap: 14px; }
.search {
  display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1.5px solid var(--line); border-radius: 12px; padding: 0 12px;
}
.search svg { width: 18px; height: 18px; flex: none; fill: none; stroke: var(--muted); stroke-width: 2; }
.search input { border: 0; background: transparent; min-height: 46px; flex: 1; min-width: 0; font-size: 16px; outline: none; }
.search:focus-within { border-color: var(--me); }
.region-chips {
  display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none;
  margin-left: calc(-1 * var(--gutter-l)); margin-right: calc(-1 * var(--gutter-r));
  padding-left: var(--gutter-l); padding-right: var(--gutter-r);
}
.region {
  appearance: none; flex: none; border: 1.5px solid var(--line); background: var(--surface); border-radius: 999px;
  min-height: 44px; padding: 0 14px; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
}
.region span { font-family: var(--font-data); font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.region.empty { color: var(--muted); }
.region[aria-pressed="true"] { background: var(--pine); border-color: var(--pine); color: var(--pine-ink); }
.region[aria-pressed="true"] span { color: inherit; opacity: 0.8; }
.browse-bar { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.hint { color: var(--muted); font-size: 13px; }
.notice { background: var(--surface); border: 1.5px dashed var(--line); border-radius: var(--r); padding: 14px; display: grid; gap: 10px; justify-items: start; font-size: 14px; color: var(--muted); }

.course.remote { grid-template-columns: 1fr; cursor: pointer; }
.course.remote:hover { border-color: var(--pine); }
.course-social { font-size: 12.5px; color: var(--muted); display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.region-badge { display: inline-block; font-family: var(--font-body); font-size: 12px; font-weight: 700; color: var(--ink); background: var(--pine-soft); border-radius: 6px; padding: 1px 7px; }
.tag.mine { background: var(--blaze); color: var(--blaze-ink); }
.tag.open { background: var(--surface-2); color: var(--muted); box-shadow: inset 0 0 0 1px var(--line); }
.mini-alert { display: inline-block; font-size: 11.5px; font-weight: 700; background: var(--danger-soft); color: var(--danger); border-radius: 6px; padding: 1px 7px; }
.block { display: block; margin-top: 4px; }

.setting-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding-bottom: 12px; margin-bottom: 12px; border-bottom: 1px solid var(--line); font-size: 14px; }
.setting-row strong { margin-left: 4px; }

/* ── 공유 · 상세 시트 ── */
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.field select {
  border: 1.5px solid var(--line); border-radius: 12px; padding: 10px 12px; background: var(--surface-2);
  font-size: 16px; font-weight: 400; color: var(--ink); width: 100%; min-height: 46px;
}
.field small { font-weight: 400; }
.privacy { margin: 0; font-size: 13px; background: var(--surface-2); border-radius: 10px; padding: 10px 12px; color: var(--muted); }
.desc { margin: 0; font-size: 15px; white-space: pre-wrap; overflow-wrap: anywhere; }
.desc-source { margin: 0; font-size: 12.5px; line-height: 1.5; color: var(--muted); white-space: pre-wrap; overflow-wrap: anywhere; }
/* 상세 창의 주요 버튼: 스크롤해도 창 아래에 붙어 있어요. 창의 아래 여백만큼 내려 바닥에 딱 붙여요 */
.sheet > .sheet-cta {
  position: sticky; z-index: 1; bottom: calc(-1 * (var(--safe-b) + 18px));
  display: grid; gap: 8px; padding: 18px 0 calc(var(--safe-b) + 14px); margin-top: -14px;
  background: linear-gradient(transparent, var(--surface) 18px);
}
.sheet-cta .pos-note:empty { display: none; }
.sub-label { margin: 0 0 8px; font-size: 13px; letter-spacing: 0.06em; color: var(--muted); }

.notes { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.note { background: var(--surface-2); border-radius: 12px; padding: 10px 12px; display: grid; gap: 6px; }
.note.report { background: var(--danger-soft); }
.note p { margin: 0; font-size: 14.5px; overflow-wrap: anywhere; }
.note img { width: 100%; max-height: 220px; object-fit: cover; border-radius: 8px; }
.note-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.note-tag { font-size: 11.5px; font-weight: 700; border-radius: 6px; padding: 1px 7px; background: var(--surface); color: var(--ink); }
.note-tag.report { background: var(--danger); color: #fff; }
.note-by { font-size: 12px; color: var(--muted); }
.note-actions { display: flex; justify-content: flex-end; }
.note-actions .btn { min-height: 30px; }
.pending { font-size: 12px; color: var(--muted); font-weight: 600; }
.note-empty { font-size: 14px; color: var(--muted); padding: 6px 0; }

.community { display: grid; gap: 12px; }
.composer { display: grid; gap: 10px; border-top: 1px solid var(--line); padding-top: 12px; }
.chip.report::before { background: var(--danger); border-radius: 50%; }
.chip.comment::before { background: var(--me); border-radius: 50%; }
.chip.plain::before { display: none; }
.chips.small .chip { padding: 6px 11px; font-size: 13.5px; }
.photo-field .send { margin-left: auto; min-width: 96px; }
.photo-field #pt-compose-preview { width: 56px; height: 56px; }
.confirm-btn[aria-pressed="true"] { background: var(--pine-soft); border-color: var(--pine); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* 지도 위 표지판의 댓글 수, 지점 제보 핀 */
.wp { position: relative; }
.wp-badge {
  position: absolute; top: -9px; right: -11px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 9px;
  background: var(--me); color: #fff; font: 700 11px/18px var(--font-body); font-style: normal; text-align: center; box-shadow: 0 0 0 2px #fff;
}
.wp-badge.alert { background: var(--danger); }
.note-icon { background: none; border: 0; }
.note-pin { position: relative; width: 30px; height: 30px; border-radius: 50%; background: #fff; display: grid; place-items: center; box-shadow: 0 0 0 2px var(--me), 0 2px 6px rgba(0,0,0,.35); }
.note-pin svg { width: 16px; height: 16px; fill: var(--me); }
.note-pin.report { box-shadow: 0 0 0 2px var(--danger), 0 2px 6px rgba(0,0,0,.35); }
.note-pin.report svg { fill: var(--danger); }
.note-pin b { position: absolute; top: -7px; right: -8px; min-width: 16px; height: 16px; border-radius: 8px; background: var(--ink); color: var(--paper); font: 700 10px/16px var(--font-body); text-align: center; }
.report-btn { color: var(--danger); }
.mapview .note-pin::after { content: ''; position: absolute; bottom: -6px; left: 50%; margin-left: -4px; border: 4px solid transparent; border-top-color: #fff; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ───────── 3D로 미리 걷기 ───────── */
.flyover { position: fixed; inset: 0; background: #b9d3ea; z-index: 10; }
#fly-map { position: absolute; inset: 0; }
.flyover .maplibregl-ctrl-top-right { top: calc(var(--safe-t) + 176px); }
.flyover .maplibregl-ctrl-attrib { font-size: 10px; }
.fly-top { display: flex; align-items: center; gap: 10px; padding: 8px 12px 8px 8px; }
.fly-close { flex: none; width: 40px; height: 40px; border: 0; border-radius: 12px; background: var(--surface-2); color: var(--ink); display: grid; place-items: center; cursor: pointer; }
.fly-close svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.fly-title { min-width: 0; display: grid; }
.fly-title strong { font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fly-title small { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fly-title small:empty { display: none; }

.fly-bottom { gap: 8px; }
.fly-next { font-size: 15px; min-height: 22px; }
.fly-next b { font-weight: 700; }
.fly-next small { display: block; color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fly-profile-wrap { position: relative; }
.fly-profile-box { position: relative; height: 56px; }
.fly-profile { display: block; width: 100%; height: 100%; border-radius: 10px; background: var(--surface-2); }
.fly-profile-area { fill: var(--pine-soft); }
.fly-profile-line { fill: none; stroke: var(--pine); stroke-width: 1.5; vector-effect: non-scaling-stroke; }
/* 지나온 구간은 노랗게 채우고, 지금 위치는 지도 위 걷는 사람 표시와 같은 노란 점으로 */
.fly-profile-done { fill: var(--blaze); opacity: 0.6; }
.fly-cursor { stroke: var(--ink); stroke-width: 1; stroke-dasharray: 3 3; opacity: 0.45; vector-effect: non-scaling-stroke; }
.fly-dot {
  position: absolute; left: 0; top: 100%; width: 16px; height: 16px; margin: -8px 0 0 -8px; border-radius: 50%;
  background: var(--blaze); border: 3px solid #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.45); pointer-events: none;
}
.fly-seek { width: 100%; margin: 4px 0 0; accent-color: var(--pine); height: 28px; }
.fly-gain { color: var(--muted); font-weight: 500; }
.fly-controls { display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; }
.fly-controls #fly-speed { min-width: 64px; font-family: var(--font-data); }
.fly-controls:has(#fly-follow[hidden]) { grid-template-columns: 1fr auto; }

.fly-wp { cursor: pointer; }
.fly-wp .wp { transition: transform 0.2s, opacity 0.3s; }
.fly-me { width: 26px; height: 26px; border-radius: 50%; background: var(--blaze); border: 3px solid #fff; box-shadow: 0 0 0 0 rgba(242, 183, 5, 0.7), 0 2px 8px rgba(0, 0, 0, 0.45); animation: fly-pulse 1.6s infinite; }
@keyframes fly-pulse { 70% { box-shadow: 0 0 0 16px rgba(242, 183, 5, 0), 0 2px 8px rgba(0, 0, 0, 0.45); } 100% { box-shadow: 0 0 0 0 rgba(242, 183, 5, 0), 0 2px 8px rgba(0, 0, 0, 0.45); } }
@media (prefers-reduced-motion: reduce) { .fly-me { animation: none; } }

.fly-card {
  position: absolute; z-index: 501; left: var(--gutter-l); right: var(--gutter-r); top: calc(var(--safe-t) + 76px);
  max-width: 420px; margin: 0 auto; display: grid; grid-template-columns: auto 1fr; gap: 10px; align-items: center;
  background: var(--surface); border-radius: var(--r); box-shadow: var(--shadow); padding: 10px 12px; animation: fly-in 0.25s ease-out;
}
.fly-card .wp { width: 32px; height: 32px; }
.fly-card-text { display: grid; min-width: 0; font-size: 14px; }
.fly-card-text span { color: var(--muted); }
.fly-card img { grid-column: 1 / -1; width: 100%; max-height: 180px; object-fit: cover; border-radius: 10px; }
@keyframes fly-in { from { opacity: 0; transform: translateY(-8px); } }

/* ═════════ 디자인: 산행 수첩 ═════════
   등고선 무늬, 경로 실루엣, 노란 이정표 판, 세리프 제목(함렛)으로 '길 안내 수첩' 같은 인상을 줘요. */
.masthead { background: radial-gradient(120% 90% at 85% 0%, #2c6450 0%, #1f4a3a 55%, #163729 100%); color: #fff; }
body.home-visible { background: var(--paper); }
.home-body { gap: 16px; padding-top: 18px; }

/* 탭: 둥근 알약 */
.tabs { background: var(--surface-2); border: 0; box-shadow: inset 0 0 0 1px var(--line); border-radius: 999px; padding: 4px; }
.tabs button { border-radius: 999px; min-height: 44px; }
.tabs button[aria-selected="true"] { background: var(--surface); box-shadow: var(--lift); }

.search { border: 0; box-shadow: inset 0 0 0 1px var(--line); border-radius: 999px; padding: 0 16px; background: var(--surface); }
.search:focus-within { box-shadow: inset 0 0 0 2px var(--pine); }

/* 지역 칩: 양 끝이 흐려지며 넘겨 보는 띠 */
.region-chips { -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 var(--gutter-l), #000 calc(100% - 28px), transparent 100%); mask-image: linear-gradient(90deg, transparent 0, #000 var(--gutter-l), #000 calc(100% - 28px), transparent 100%); }
.region { border: 0; box-shadow: inset 0 0 0 1px var(--line); min-height: 44px; padding: 0 13px; font-size: 14px; }
.region[aria-pressed="true"] { box-shadow: none; }

.browse-bar .hint { font-family: var(--font-display); font-weight: 600; font-size: 15px; color: var(--ink); }
.browse-bar .hint small { font-family: var(--font-body); font-weight: 400; font-size: 12.5px; color: var(--muted); margin-left: 4px; }

/* 코스 카드: 왼쪽에 경로 실루엣, 오른쪽에 이름·이정표 판 */
.course-list { gap: 12px; }
.course.remote, .course.card {
  grid-template-columns: 84px 1fr; gap: 0 14px; align-items: stretch; padding: 12px; border: 0;
  border-radius: 18px; box-shadow: var(--lift); cursor: pointer; transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.course.remote:hover, .course.card:hover { transform: translateY(-1px); }
.course.remote:active, .course.card:active { transform: scale(0.99); }
.course.card { cursor: pointer; transition: transform 0.15s ease, box-shadow 0.15s ease; }
.course.card { grid-template-columns: 84px 1fr; }
.thumb {
  grid-row: 1 / span 3; width: 100%; aspect-ratio: 1; border-radius: 14px; overflow: hidden; align-self: start;
  background-color: var(--pine-soft);
  /* 등고선처럼 보이는 둥근 무늬 */
  background-image: repeating-radial-gradient(circle at 72% 30%, transparent 0 9px, rgba(31, 74, 58, 0.09) 9px 10px);
}
.thumb svg { display: block; width: 100%; height: 100%; }
.thumb .route { fill: none; stroke: var(--pine); stroke-width: 3.2; stroke-linecap: round; stroke-linejoin: round; }
.thumb .route.est { stroke-dasharray: 1 6.5; stroke-width: 3.6; }
.thumb .start { fill: var(--blaze); stroke: #fff; stroke-width: 2.5; }
.thumb .end { fill: var(--pine); stroke: #fff; stroke-width: 2; }
.course-body { min-width: 0; display: grid; gap: 5px; align-content: center; }
.course-body .course-name { font-family: var(--font-display); font-weight: 600; font-size: 17px; line-height: 1.3; }
.course-where { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.course-where b { color: var(--ink); font-weight: 600; }
.course-facts { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.course-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.course-tags:empty { display: none; }

/* 노란 이정표 판 (화살표 모양) */
.plate {
  display: inline-flex; align-items: center; height: 24px; padding: 0 15px 0 9px; background: var(--blaze); color: var(--blaze-ink);
  font: 600 13px/1 var(--font-data); font-variant-numeric: tabular-nums; border-radius: 4px 0 0 4px;
  clip-path: polygon(0 0, calc(100% - 9px) 0, 100% 50%, calc(100% - 9px) 100%, 0 100%);
}
.fact { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.fact svg { width: 14px; height: 14px; fill: currentColor; }
.fact b { color: var(--ink); font-weight: 600; }
.badge { font-size: 11px; font-weight: 700; border-radius: 999px; padding: 2px 8px; white-space: nowrap; }
.badge.est { color: var(--muted); box-shadow: inset 0 0 0 1px var(--line); background: transparent; }
.badge.est::before { content: '┈ '; letter-spacing: -1px; }
.badge.trusted { background: var(--pine-soft); color: var(--pine); }
.badge.alert { background: var(--danger-soft); color: var(--danger); }
.badge.mine { background: var(--blaze); color: var(--blaze-ink); }
.badge.sample { background: var(--surface-2); color: var(--muted); box-shadow: inset 0 0 0 1px var(--line); }
.badge.dulle { background: var(--dulle-soft); color: var(--dulle-ink); }
.badge.oreum { background: var(--oreum-soft); color: var(--oreum-ink); }

/* 상세 창 고도 그래프와 해 지는 시각 */
.profile { margin: 0; padding: 10px 12px 8px; background: var(--surface-2); border-radius: 14px; display: grid; gap: 4px; }
.profile svg { width: 100%; height: 64px; display: block; }
.profile-area { fill: var(--dulle-soft); }
.profile-line { fill: none; stroke: var(--dulle); stroke-width: 2; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.profile[data-kind="oreum"] .profile-area { fill: var(--oreum-soft); }
.profile[data-kind="oreum"] .profile-line { stroke: var(--oreum); }
.profile-axis { display: flex; justify-content: space-between; font: 600 11px var(--font-data); color: var(--muted); font-variant-numeric: tabular-nums; }
.profile figcaption { font: 600 12px var(--font-data); color: var(--muted); font-variant-numeric: tabular-nums; }
.sun-note { margin: 0; padding: 9px 12px; border-radius: 12px; font-size: 13px; background: var(--surface-2); color: var(--ink); }
.sun-note::before { content: '☀ '; color: var(--blaze); }
.sun-note[data-level="tight"] { background: color-mix(in srgb, var(--blaze) 24%, var(--surface)); font-weight: 600; }
.sun-note[data-level="late"], .sun-note[data-level="dark"] { background: var(--danger-soft); color: var(--danger); font-weight: 600; }
.sun-note[data-level="dark"]::before { content: '☾ '; color: inherit; }

/* 둘레길·오름길 입구 카드: 누르면 그 갈래만, 다시 누르면 전체 */
.kind-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.kind-card {
  display: grid; gap: 2px; justify-items: start; text-align: left; padding: 12px 14px; border-radius: var(--r);
  border: 0; background: var(--surface); box-shadow: inset 0 0 0 1.5px var(--line), var(--lift); color: var(--ink); cursor: pointer; font: inherit;
}
.kind-card svg { width: 26px; height: 26px; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.kind-card .kind-name { font-family: var(--font-display); font-weight: 700; font-size: 17px; display: flex; align-items: baseline; gap: 6px; }
.kind-card .kind-name span { font: 600 13px var(--font-data); color: var(--muted); font-variant-numeric: tabular-nums; }
.kind-card small { font-size: 12px; color: var(--muted); }
/* 처음부터 갈래 색을 옅게 깔아요. 고르면 진한 색으로 채우고, 고르지 않은 쪽은 흐리게 */
.kind-card { transition: background 0.15s, color 0.15s, opacity 0.15s; }
.kind-card.dulle { background: var(--dulle-soft); color: var(--dulle-ink); box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--dulle) 30%, transparent), var(--lift); }
.kind-card.oreum { background: var(--oreum-soft); color: var(--oreum-ink); box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--oreum) 30%, transparent), var(--lift); }
.kind-card .kind-name span, .kind-card small { color: inherit; opacity: 0.78; }
.kind-card.dulle svg { stroke: var(--dulle); }
.kind-card.oreum svg { stroke: var(--oreum); }
.kind-card.dulle[aria-pressed="true"] { background: var(--dulle); color: var(--surface); box-shadow: var(--lift); }
.kind-card.oreum[aria-pressed="true"] { background: var(--oreum); color: var(--surface); box-shadow: var(--lift); }
.kind-card[aria-pressed="true"] svg { stroke: currentColor; }
.kind-card[aria-pressed="true"] .kind-name span, .kind-card[aria-pressed="true"] small { opacity: 0.9; }
.kind-cards:has([aria-pressed="true"]) .kind-card[aria-pressed="false"] { opacity: 0.55; }

/* 시험판 주소에서만 보이는 띠 (app.js 가 html[data-stage="test"] 를 붙여요) */
.stage-strip { display: none; }
html[data-stage="test"] .stage-strip {
  display: block; position: sticky; top: 0; z-index: 1000; padding: calc(var(--safe-t) + 4px) 12px 4px; text-align: center;
  background: #c8321f; color: #fff; font: 700 12.5px/1.4 var(--font-body); letter-spacing: 0.02em;
}
.course.card .course-actions { grid-column: 3; grid-row: 1 / span 3; align-self: center; flex-direction: column; }
.course.card .course-actions .btn { min-height: 38px; }
.more-btn { border-radius: 999px; }

/* 상세 창 머리: 큰 경로 실루엣 */
.sheet { border-radius: 24px 24px 0 0; }
.sheet-hero:empty { display: none; }
.sheet-hero {
  height: 132px; border-radius: 18px; overflow: hidden; position: relative;
  background-color: var(--pine-soft);
  background-image: repeating-radial-gradient(circle at 78% 25%, transparent 0 13px, rgba(31, 74, 58, 0.08) 13px 14px),
    repeating-radial-gradient(circle at 12% 95%, transparent 0 17px, rgba(31, 74, 58, 0.06) 17px 18px);
}
.sheet-hero svg { width: 100%; height: 100%; display: block; }
.sheet-hero .route { fill: none; stroke: var(--pine); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.sheet-hero .route.est { stroke-dasharray: 1 7; stroke-width: 3; }
.sheet-hero .start { fill: var(--blaze); stroke: #fff; stroke-width: 2; vector-effect: non-scaling-stroke; }
.sheet-hero .end { fill: var(--pine); stroke: #fff; stroke-width: 2; vector-effect: non-scaling-stroke; }
.sheet-hero .legend { position: absolute; left: 10px; bottom: 8px; font-size: 11px; color: var(--muted); background: color-mix(in srgb, var(--surface) 80%, transparent); padding: 2px 8px; border-radius: 999px; }
.sheet-title { font-family: var(--font-display); font-weight: 700; font-size: 22px; line-height: 1.3; }
.stat-row:empty { display: none; }
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: 8px; }
.stat { background: var(--surface-2); border-radius: 14px; padding: 10px 12px; display: grid; gap: 2px; }
.stat small { font-size: 11.5px; color: var(--muted); }
.stat b { font: 700 16px/1.25 var(--font-body); font-variant-numeric: tabular-nums; white-space: nowrap; letter-spacing: -0.01em; }
.stat.lead { background: var(--blaze); color: var(--blaze-ink); }
.stat.lead small { color: inherit; opacity: 0.75; }

/* 어두운 화면: 실루엣 색을 밝게 */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .thumb, :root:not([data-theme="light"]) .sheet-hero { background-image: repeating-radial-gradient(circle at 72% 30%, transparent 0 9px, rgba(255, 255, 255, 0.05) 9px 10px); }
  :root:not([data-theme="light"]) .thumb .route, :root:not([data-theme="light"]) .sheet-hero .route { stroke: #8fd1b3; }
}
:root[data-theme="dark"] .thumb .route, :root[data-theme="dark"] .sheet-hero .route { stroke: #8fd1b3; }
/* 공유 코스 실루엣은 갈래 색으로 (어두운 화면 색은 --dulle·--oreum 이 바꿔요. 위 규칙보다 앞서도록 같은 :root 조건을 붙여요) */
.thumb .route.dulle, .sheet-hero .route.dulle,
:root:not([data-theme="light"]) .thumb .route.dulle, :root:not([data-theme="light"]) .sheet-hero .route.dulle { stroke: var(--dulle); }
.thumb .route.oreum, .sheet-hero .route.oreum,
:root:not([data-theme="light"]) .thumb .route.oreum, :root:not([data-theme="light"]) .sheet-hero .route.oreum { stroke: var(--oreum); }
.fact.none { font-style: normal; opacity: 0.8; border-bottom: 1px dashed var(--line); }
/* 넓은 화면(PC): 카드를 두 줄로 */
@media (min-width: 900px) {
  .masthead-inner, .home-body { max-width: 980px; }
  .masthead { padding-top: 34px; padding-bottom: 38px; }
  .course-list { grid-template-columns: 1fr 1fr; }
  .course-list > .empty { grid-column: 1 / -1; }
}
/* 내 코스: 기록·가져오기 카드와 설정 상자도 같은 결로 */
.mode-card { border: 0; border-radius: 18px; box-shadow: var(--lift); padding: 16px; }
.mode-card.rec { background: radial-gradient(120% 120% at 100% 0%, #2c6450 0%, #1f4a3a 60%); color: #fff; }
.mode-title { font-family: var(--font-display); font-weight: 700; font-size: 19px; }
.settings { border: 0; border-radius: 18px; box-shadow: var(--lift); }
.section-label { font-family: var(--font-display); font-size: 15px; letter-spacing: 0; color: var(--ink); }
.empty { border-radius: 18px; }

/* 시트 닫기(×)와 끌어내리는 손잡이 */
.sheet > .sheet-x {
  position: sticky; top: 0; z-index: 3; justify-self: end; width: 44px; height: 44px;
  margin: -2px max(-6px, calc((100% - 560px) / 2 - 6px)) -58px 0;
  border: 0; border-radius: 50%; background: var(--surface-2); color: var(--ink); cursor: pointer;
  display: grid; place-items: center; box-shadow: 0 1px 3px rgba(48, 38, 18, 0.12);
}
.sheet-x svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }
.sheet-x:active { transform: scale(0.94); }
.sheet > .sheet-grip { width: 100%; height: 24px; margin-bottom: -10px; background: none; position: relative; touch-action: none; cursor: grab; }
.sheet > .sheet-grip::before { content: ''; position: absolute; left: 50%; top: 9px; width: 40px; height: 4px; margin-left: -20px; border-radius: 2px; background: var(--line); }
.sheet > .sheet-grip:active { cursor: grabbing; }
/* 제목은 화면 낭독기가 읽도록 초점만 받는 곳이라(누르는 곳이 아니라) 테두리를 그리지 않아요 */
.sheet h3:focus, .sheet h3:focus-visible { outline: none; }
/* 제목이 닫기 버튼 밑으로 들어가지 않게 */
.sheet > h3 { padding-right: 48px; }
@media (prefers-reduced-motion: reduce) { .sheet { animation: none; } }

/* 앱처럼 설치하기 안내 카드 */
.install-card {
  position: relative; display: grid; grid-template-columns: 48px 1fr; gap: 4px 12px; align-items: center;
  padding: 14px 44px 14px 14px; border-radius: 18px; background: var(--surface); box-shadow: var(--lift);
}
.install-icon { width: 48px; height: 48px; border-radius: 12px; grid-row: 1 / span 2; }
.install-text { display: grid; gap: 2px; font-size: 13.5px; color: var(--muted); min-width: 0; }
.install-text strong { font-family: var(--font-display); font-size: 16px; color: var(--ink); }
.install-actions:empty { display: none; }
.install-actions { grid-column: 2; display: flex; gap: 8px; margin-top: 6px; }
.install-actions .btn { min-height: 40px; padding: 0 16px; border-radius: 999px; }
.install-x {
  position: absolute; top: 4px; right: 4px; width: 40px; height: 40px; border: 0; border-radius: 50%;
  background: transparent; color: var(--muted); font-size: 22px; line-height: 1; cursor: pointer;
}
.ios-share-wrap { display: inline-flex; vertical-align: -3px; }
.ios-share { width: 18px; height: 18px; fill: none; stroke: var(--me); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* 목록 그림 바탕도 갈래 색으로 (상세 창 머리 그림도 같이) */
.thumb[data-kind="dulle"], .sheet-hero[data-kind="dulle"] { background-color: var(--dulle-soft); }
.thumb[data-kind="oreum"], .sheet-hero[data-kind="oreum"] { background-color: var(--oreum-soft); }

/* 목록을 불러오는 동안: 빈 카드 모양, 다시 불러올 땐 지금 목록을 흐리게 */
.course-list.is-loading > .course:not(.skeleton) { opacity: 0.5; transition: opacity 0.2s; }
.course.skeleton { pointer-events: none; box-shadow: none; }
.course.skeleton .thumb { background-image: none; background-color: var(--surface-2); }
.course.skeleton i { display: block; height: 12px; border-radius: 6px; background: var(--surface-2); }
.course.skeleton i:nth-child(1) { width: 70%; height: 17px; }
.course.skeleton i:nth-child(2) { width: 45%; }
.course.skeleton i:nth-child(3) { width: 60%; }
.course.skeleton .thumb, .course.skeleton i { animation: skeleton-pulse 1.1s ease-in-out infinite alternate; }
@keyframes skeleton-pulse { to { opacity: 0.45; } }

/* 카드가 위에서부터 차례로 살짝 떠오르며 나타나요 */
.course.remote.enter { animation: card-in 0.32s cubic-bezier(0.2, 0.7, 0.3, 1) backwards; animation-delay: calc(var(--i, 0) * 35ms); }
@keyframes card-in { from { opacity: 0; transform: translateY(10px); } }
@media (prefers-reduced-motion: reduce) {
  .course.remote.enter, .course.skeleton .thumb, .course.skeleton i { animation: none; }
}

/* 하단 안내 문서 링크 */
.foot-links a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }

/* 이 주소의 안내 글 (server/seo.js): 첫 화면 아래 카드. 산·길 모음은 코스 비교표, 코스는 요약과 같은 산 다른 들머리 */
.seo-body {
  background: var(--surface); border-radius: var(--r); box-shadow: inset 0 0 0 1px var(--line); padding: 16px 16px 8px;
  font-size: 14px; line-height: 1.65; overflow-wrap: anywhere;
}
.seo-body > nav { font-size: 12.5px; color: var(--muted); margin-bottom: 6px; }
.seo-body h1 { font: 700 20px/1.35 var(--font-display); margin-bottom: 6px; }
.seo-body h2 { font: 700 16px/1.4 var(--font-display); margin: 18px 0 6px; }
.seo-body p { margin: 0 0 10px; }
.seo-body ul { margin: 0 0 10px; padding-left: 1.1em; }
.seo-body li + li { margin-top: 4px; }
.seo-body a { color: var(--pine); text-underline-offset: 2px; }
.seo-body details { border-top: 1px solid var(--line); padding: 4px 0; }
.seo-body summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; font-weight: 600; }
.seo-body summary h2 { margin: 0; font-size: 15px; }
.seo-body table { width: 100%; border-collapse: collapse; font-size: 13px; margin: 0 0 12px; font-variant-numeric: tabular-nums; }
.seo-body th, .seo-body td { text-align: left; padding: 7px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
.seo-body th { font-weight: 600; color: var(--muted); font-size: 12px; white-space: nowrap; }
.seo-body td.num { white-space: nowrap; }

/* 안내 문서 (/about · /privacy · /terms) */
body.doc { height: auto; min-height: 100%; }
.doc-head {
  position: sticky; top: 0; z-index: 1; display: flex; align-items: center; justify-content: space-between;
  padding: calc(env(safe-area-inset-top, 0px) + 10px) 16px 10px; background: var(--pine); color: var(--pine-ink);
}
.doc-brand { font: 700 18px var(--font-display); color: inherit; text-decoration: none; min-height: 44px; display: inline-flex; align-items: center; }
.doc-open { color: inherit; font-weight: 600; font-size: 14px; min-height: 44px; display: inline-flex; align-items: center; padding: 0 4px; }
.doc-main { max-width: 680px; margin: 0 auto; padding: 24px 16px 40px; line-height: 1.75; }
.doc-main h1 { font: 700 26px/1.3 var(--font-display); margin-bottom: 12px; }
.doc-main h2 { font: 700 18px/1.4 var(--font-display); margin: 28px 0 8px; }
.doc-main ul { padding-left: 1.2em; }
.doc-main li + li { margin-top: 4px; }
.doc-main a, .doc-foot a { color: var(--pine); }
.doc-foot { max-width: 680px; margin: 0 auto; padding: 16px 16px calc(env(safe-area-inset-bottom, 0px) + 32px); border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); }
.doc-foot p { margin: 4px 0; }

/* 산·길 모음 탭: 둘레길 시리즈 칩, 지역별 산 목록, 산·시리즈의 코스 목록 */
#panel-collect { display: grid; gap: 10px; }
#panel-collect[hidden] { display: none; }
#collect-index, #collect-detail { display: grid; gap: 10px; }
#collect-index[hidden], #collect-detail[hidden] { display: none; }
.collect-head { font: 700 16px/1.35 var(--font-display); margin-top: 6px; }
.collect-head small { font: 600 13px var(--font-data); color: var(--muted); margin-left: 4px; }
/* 시리즈는 옆으로 넘기는 한 줄 (지역 칩과 같은 여백) */
.trail-chips {
  display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px;
  margin-left: calc(-1 * var(--gutter-l)); margin-right: calc(-1 * var(--gutter-r)); padding-left: var(--gutter-l); padding-right: var(--gutter-r);
}
.trail-chips::-webkit-scrollbar { display: none; }
.trail-chip { flex: none; }
.trail-chip {
  appearance: none; border: 0; cursor: pointer; text-align: left; display: grid; gap: 1px; min-height: 44px; padding: 8px 12px; border-radius: 12px;
  background: var(--dulle-soft); color: var(--dulle-ink); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--dulle) 30%, transparent);
}
.trail-chip b { font-weight: 700; font-size: 14px; }
.trail-chip span { font: 500 11.5px var(--font-data); opacity: 0.8; font-variant-numeric: tabular-nums; }
.mountain-list { list-style: none; margin: 0; padding: 0; background: var(--surface); border-radius: var(--r); box-shadow: inset 0 0 0 1px var(--line); }
.mountain-list > li + li { border-top: 1px solid var(--line); }
.mountain-list > li.empty { padding: 16px; color: var(--muted); font-size: 14px; }
.mountain-row {
  appearance: none; border: 0; background: transparent; width: 100%; cursor: pointer; text-align: left; color: var(--ink);
  display: grid; grid-template-columns: 1fr auto; grid-template-areas: 'name n' 'where n'; gap: 1px 10px; align-items: center; min-height: 56px; padding: 8px 14px;
}
.mountain-row:active { background: var(--surface-2); }
.mt-name { grid-area: name; font: 700 16px/1.3 var(--font-display); }
.mt-name small { font: 600 12px var(--font-data); color: var(--muted); }
.mt-where { grid-area: where; font-size: 12.5px; color: var(--muted); }
.mt-n { grid-area: n; font-size: 12.5px; font-weight: 700; color: var(--oreum-ink); background: var(--oreum-soft); border-radius: 999px; padding: 3px 10px; white-space: nowrap; }
.collect-back { justify-self: start; }
.collect-title { font: 700 22px/1.3 var(--font-display); }
.collect-sub { margin: -4px 0 4px; font-size: 13px; color: var(--muted); }

/* 옛 주소(workers.dev)에서 열렸을 때 새 도메인 안내 (public/js/app.js noticeMoved) */
.move-strip {
  position: sticky; top: 0; z-index: 1000; padding: calc(var(--safe-t) + 8px) 16px 8px;
  background: var(--blaze); color: var(--blaze-ink); font: 600 13px/1.5 var(--font-body);
}
.move-strip a { color: inherit; font-weight: 700; text-underline-offset: 2px; }
